hexsha
stringlengths
40
40
size
int64
6
1.05M
ext
stringclasses
3 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
232
max_stars_repo_name
stringlengths
7
106
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
7
max_stars_count
int64
1
33.5k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
232
max_issues_repo_name
stringlengths
7
106
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
7
max_issues_count
int64
1
37.5k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
232
max_forks_repo_name
stringlengths
7
106
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
7
max_forks_count
int64
1
12.6k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
6
1.05M
avg_line_length
float64
1.16
19.7k
max_line_length
int64
2
938k
alphanum_fraction
float64
0
1
6ff490cf677a1034dd30cdb8b8f6b10412d19b32
3,868
asm
Assembly
_incObj/43 Roller.asm
kodishmediacenter/msu-md-sonic
3aa7c5e8add9660df2cd0eceaa214e7d59f2415c
[ "CC0-1.0" ]
9
2021-01-15T13:47:53.000Z
2022-01-17T15:33:55.000Z
_incObj/43 Roller.asm
kodishmediacenter/msu-md-sonic
3aa7c5e8add9660df2cd0eceaa214e7d59f2415c
[ "CC0-1.0" ]
7
2021-01-14T02:18:48.000Z
2021-03-24T15:44:30.000Z
_incObj/43 Roller.asm
kodishmediacenter/msu-md-sonic
3aa7c5e8add9660df2cd0eceaa214e7d59f2415c
[ "CC0-1.0" ]
2
2021-01-14T13:14:26.000Z
2021-01-29T17:46:04.000Z
; --------------------------------------------------------------------------- ; Object 43 - Roller enemy (SYZ) ; --------------------------------------------------------------------------- Roller: moveq #0,d0 move.b obRoutine(a0),d0 move.w Roll_Index(pc,d0.w),d1 jmp Roll_Index(pc,d1.w) ; =========================================================================== Roll_Index: dc.w Roll_Main-Roll_Index dc.w Roll_Action-Roll_Index ; =========================================================================== Roll_Main: ; Routine 0 move.b #$E,obHeight(a0) move.b #8,obWidth(a0) bsr.w ObjectFall bsr.w ObjFloorDist tst.w d1 bpl.s locret_E052 add.w d1,obY(a0) ; match roller's position with the floor move.w #0,obVelY(a0) addq.b #2,obRoutine(a0) move.l #Map_Roll,obMap(a0) move.w #$4B8,obGfx(a0) move.b #4,obRender(a0) move.b #4,obPriority(a0) move.b #$10,obActWid(a0) locret_E052: rts ; =========================================================================== Roll_Action: ; Routine 2 moveq #0,d0 move.b ob2ndRout(a0),d0 move.w Roll_Index2(pc,d0.w),d1 jsr Roll_Index2(pc,d1.w) lea (Ani_Roll).l,a1 bsr.w AnimateSprite move.w obX(a0),d0 andi.w #$FF80,d0 move.w (v_screenposx).w,d1 subi.w #$80,d1 andi.w #$FF80,d1 sub.w d1,d0 cmpi.w #$280,d0 bgt.w Roll_ChkGone bra.w DisplaySprite ; =========================================================================== Roll_ChkGone: lea (v_objstate).w,a2 moveq #0,d0 move.b obRespawnNo(a0),d0 beq.s Roll_Delete bclr #7,2(a2,d0.w) Roll_Delete: bra.w DeleteObject ; =========================================================================== Roll_Index2: dc.w Roll_RollChk-Roll_Index2 dc.w Roll_RollNoChk-Roll_Index2 dc.w Roll_ChkJump-Roll_Index2 dc.w Roll_MatchFloor-Roll_Index2 ; =========================================================================== Roll_RollChk: move.w (v_player+obX).w,d0 subi.w #$100,d0 bcs.s loc_E0D2 sub.w obX(a0),d0 ; check distance between Roller and Sonic bcs.s loc_E0D2 addq.b #4,ob2ndRout(a0) move.b #2,obAnim(a0) move.w #$700,obVelX(a0) ; move Roller horizontally move.b #$8E,obColType(a0) ; make Roller invincible loc_E0D2: addq.l #4,sp rts ; =========================================================================== Roll_RollNoChk: cmpi.b #2,obAnim(a0) beq.s loc_E0F8 subq.w #1,$30(a0) bpl.s locret_E0F6 move.b #1,obAnim(a0) move.w #$700,obVelX(a0) move.b #$8E,obColType(a0) locret_E0F6: rts ; =========================================================================== loc_E0F8: addq.b #2,ob2ndRout(a0) rts ; =========================================================================== Roll_ChkJump: bsr.w Roll_Stop bsr.w SpeedToPos bsr.w ObjFloorDist cmpi.w #-8,d1 blt.s Roll_Jump cmpi.w #$C,d1 bge.s Roll_Jump add.w d1,obY(a0) rts ; =========================================================================== Roll_Jump: addq.b #2,ob2ndRout(a0) bset #0,$32(a0) beq.s locret_E12E move.w #-$600,obVelY(a0) ; move Roller vertically locret_E12E: rts ; =========================================================================== Roll_MatchFloor: bsr.w ObjectFall tst.w obVelY(a0) bmi.s locret_E150 bsr.w ObjFloorDist tst.w d1 bpl.s locret_E150 add.w d1,obY(a0) ; match Roller's position with the floor subq.b #2,ob2ndRout(a0) move.w #0,obVelY(a0) locret_E150: rts ; ||||||||||||||| S U B R O U T I N E ||||||||||||||||||||||||||||||||||||||| Roll_Stop: tst.b $32(a0) bmi.s locret_E188 move.w (v_player+obX).w,d0 subi.w #$30,d0 sub.w obX(a0),d0 bcc.s locret_E188 move.b #0,obAnim(a0) move.b #$E,obColType(a0) clr.w obVelX(a0) move.w #120,$30(a0) ; set waiting time to 2 seconds move.b #2,ob2ndRout(a0) bset #7,$32(a0) locret_E188: rts ; End of function Roll_Stop
24.327044
77
0.492244
972dde432ad8744f69efc440381dc9398f7b366e
148
asm
Assembly
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sccz80/tshr_saddr2py.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
38
2021-06-18T12:56:15.000Z
2022-03-12T20:38:40.000Z
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sccz80/tshr_saddr2py.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
2
2021-06-20T16:28:12.000Z
2021-11-17T21:33:56.000Z
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sccz80/tshr_saddr2py.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
6
2021-06-18T18:18:36.000Z
2021-12-22T08:01:32.000Z
; uchar tshr_saddr2py(void *saddr) SECTION code_clib SECTION code_arch PUBLIC tshr_saddr2py EXTERN zx_saddr2py defc tshr_saddr2py = zx_saddr2py
13.454545
34
0.831081
bb6530105be4d9345bf466c41dc219e8c0a8b185
555
asm
Assembly
programs/oeis/342/A342673.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/342/A342673.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/342/A342673.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A342673: a(n) = gcd(n, sigma(A003961(n))), where A003961 is fully multiplicative with a(prime(k)) = prime(k+1), and sigma is the sum of divisors of n. ; 1,2,3,1,1,6,1,8,1,2,1,6,1,2,3,1,1,2,1,4,3,2,1,24,1,2,3,4,1,6,1,4,3,2,1,1,1,2,3,40,1,6,1,2,1,2,1,6,7,2,3,26,1,6,1,8,3,2,1,12,1,2,3,1,1,6,1,4,3,2,1,8,1,2,3,4,7,6,1,8,1,2,1,12,5,2,3,8,1,2,1,2,3,2,1,24,1,14,1,1 mov $1,$0 add $0,1 seq $1,3973 ; Inverse Möbius transform of A003961; a(n) = sigma(A003961(n)), where A003961 shifts the prime factorization of n one step towards the larger primes. gcd $0,$1
69.375
208
0.636036
8928c9ad46d69f736155ab880538326ceb892b00
273
asm
Assembly
libsrc/_DEVELOPMENT/compress/zx1/c/sdcc/dzx1_smart_rcs_back_callee.asm
ahjelm/z88dk
c4de367f39a76b41f6390ceeab77737e148178fa
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/compress/zx1/c/sdcc/dzx1_smart_rcs_back_callee.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/compress/zx1/c/sdcc/dzx1_smart_rcs_back_callee.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; void dzx1_smart_rcs_back_callee(void *src, void *dst) SECTION code_clib SECTION code_compress_zx1 PUBLIC _dzx1_smart_rcs_back_callee EXTERN asm_dzx1_smart_rcs_back _dzx1_smart_rcs_back_callee: pop af pop hl pop de push af jp asm_dzx1_smart_rcs_back
14.368421
55
0.802198
bd0339f502ea6cf2dc97c83f72ff121be527a1c7
58
asm
Assembly
src/main/fragment/mos6502-common/vwum1=_neg_vwum1.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
2
2022-03-01T02:21:14.000Z
2022-03-01T04:33:35.000Z
src/main/fragment/mos6502-common/vwum1=_neg_vwum1.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
null
null
null
src/main/fragment/mos6502-common/vwum1=_neg_vwum1.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
null
null
null
sec lda #0 sbc {m1} sta {m1} lda #0 sbc {m1}+1 sta {m1}+1
7.25
10
0.568966
26984d11ce8878d37539a2e552cc06f558deb403
3,129
asm
Assembly
Examples/basics/dealcards.asm
agguro/linux-nasm
3e72083c3db6d7118eb2aa430b73e0d20e88456b
[ "Unlicense" ]
6
2020-07-19T18:34:43.000Z
2022-03-26T10:21:09.000Z
Examples/basics/dealcards.asm
NrdyBhu1/linux-nasm
3e72083c3db6d7118eb2aa430b73e0d20e88456b
[ "Unlicense" ]
null
null
null
Examples/basics/dealcards.asm
NrdyBhu1/linux-nasm
3e72083c3db6d7118eb2aa430b73e0d20e88456b
[ "Unlicense" ]
3
2020-07-19T18:35:10.000Z
2021-07-25T17:34:50.000Z
;name: dealcards.asm ; ;build: nasm -felf64 dealcards.asm -o dealcards.o ; ld -s -melf_x86_64 -o dealcards dealcards.o ; ;description: Create a set of shuffled cards. ; This demo creates 20 sets of dealed cards [list -] %include "unistd.inc" [list +] ;numbers are displayed wrong above 99 %define TOTAL_CARDS 52 bits 64 section .data shuffledcards: times TOTAL_CARDS db 0 buffer: times 2 db 0 spacer: db " " eol: db 0x0A section .text global _start _start: mov rdi,shuffledcards ; pointer to buffer for the shuffled cards mov rsi,TOTAL_CARDS ; total cards to shuffle call shuffle ; shuffle the cards mov rdi,shuffledcards ; pointer to the cards mov rsi,TOTAL_CARDS ; number of cards to show call showCards ; show the cards mov rsi,eol mov rdx,1 call writeString ; print end of line syscall exit,0 showCards: ;RDI : pointer to buffer with cards to show ;RSI : number of cards to show mov rcx,rsi ; number of cards to show in rcx mov rsi,rdi ; pointer to card buffer in rdi xor rax,rax .next: lodsb mov rbx,10 xor rdx,rdx idiv rbx or dl,"0" mov byte[buffer+1],dl mov rdx,2 ; length of output or al,"0" mov byte[buffer],al push rcx push rsi mov rsi,buffer mov rdx,3 call writeString pop rsi pop rcx loopnz .next ret writeString: ;RSI : pointer to the string ;RDX : length of the string syscall write,stdout ret shuffle: ;RDI : pointer to buffer where the cards must be stored ;RSI : total cards in a deck mov rbx,rsi ; TOTAL_CARDS in bl xor r8,r8 .newcard: inc r8 ; increment counter cmp r8,rbx ; TOTAL_CARDS reached? jg .endshuffling .tryagain: rdtsc ; read the time stamp counter shr rax,3 ; divide by 8, this an empirical value, without, the algorithm takes a long time for cards = 52, 20 ; still don't know why xor ah,ah idiv bl ; tsc divided by TOTAL_OF_CARDS, modulo in RDX and ah,ah jne .check mov ah,bl ; if remainder is zero, then remainder is the highest card ; loop through shuffledcards to check if card is already choosen .check: mov rsi,rdi mov rcx,r8 .checknext: lodsb ; AL has the card and al,al je .storecard cmp al,ah je .tryagain loop .checknext .storecard: dec rsi mov byte[rsi],ah jmp .newcard .endshuffling: ret
28.445455
142
0.515181
62a3ef6352e824bdf9404b6d49757f78bd56bc1d
572
asm
Assembly
programs/oeis/258/A258121.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/258/A258121.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/258/A258121.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A258121: Number of vertices of degree n in all Lucas cubes. ; 2,5,15,39,102,267,699,1830,4791,12543,32838,85971,225075,589254,1542687,4038807,10573734,27682395,72473451,189737958,496740423,1300483311,3404709510,8913645219,23336226147,61095033222,159948873519,418751587335,1096305888486,2870166078123,7514192345883,19672410959526,51503040532695,134836710638559,353007091382982,924184563510387,2419546599148179,6334455233934150 mov $3,5 lpb $0,1 sub $0,1 add $2,$3 sub $2,2 add $3,3 mov $4,2 trn $4,$0 add $3,$4 add $3,$2 lpe mov $0,$2 add $0,2 mov $1,$0
31.777778
365
0.770979
09d35fcc6deefe8aa17673c15a8de3d0f3d9ea58
173
asm
Assembly
libsrc/_DEVELOPMENT/adt/w_array/c/sccz80/w_array_clear.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/_DEVELOPMENT/adt/w_array/c/sccz80/w_array_clear.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/_DEVELOPMENT/adt/w_array/c/sccz80/w_array_clear.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
; void w_array_clear(w_array_t *a) SECTION code_adt_w_array PUBLIC w_array_clear defc w_array_clear = asm_w_array_clear INCLUDE "adt/w_array/z80/asm_w_array_clear.asm"
15.727273
47
0.82659
c56586b6fe8e6b395c57887eaa5a67b82f524158
389
asm
Assembly
oeis/038/A038478.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/038/A038478.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/038/A038478.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A038478: Sums of 2 distinct powers of 6. ; Submitted by Christian Krause ; 7,37,42,217,222,252,1297,1302,1332,1512,7777,7782,7812,7992,9072,46657,46662,46692,46872,47952,54432,279937,279942,279972,280152,281232,287712,326592,1679617,1679622,1679652,1679832,1680912,1687392 lpb $0 add $1,1 sub $0,$1 mov $2,$1 lpe mov $1,6 add $2,1 pow $1,$2 mov $2,6 pow $2,$0 add $1,$2 mov $0,$1
22.882353
199
0.714653
b7722b5eea35dab167350d33cd9b03d6e9cec941
1,846
asm
Assembly
libsrc/_DEVELOPMENT/font/fzx/z80/asm_fzx_string_partition_ww.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/font/fzx/z80/asm_fzx_string_partition_ww.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/font/fzx/z80/asm_fzx_string_partition_ww.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; void *fzx_string_partition_ww(struct fzx_font *ff, char *s, uint16_t allowed_width) INCLUDE "config_private.inc" SECTION code_font SECTION code_font_fzx PUBLIC asm_fzx_string_partition_ww EXTERN __fzx_string_glyph_width, __fzx_partition_width_adjust, l_inc_sp asm_fzx_string_partition_ww: ; find longest prefix of string without splitting words ; that has pixel extent <= to the allowed pixel extent ; ; enter : ix = struct fzx_font * ; hl = allowed width in pixels ; de = char *s ; ; exit : hl = s + prefix_len ; de = remaining allowed width ; carry set if allowed width exceeded ; ; uses : af, bc, de, hl call __fzx_partition_width_adjust next_spaces: push de ; save allowed prefix push hl ; save allowed width remaining consume_spaces_loop: ld a,(de) or a jr z, end_string_accept cp CHAR_LF jr z, end_string_accept cp CHAR_CR jr z, end_string_accept cp ' ' jr nz, consume_word_loop call __fzx_string_glyph_width jr c, end_string ; if allowed width exceeded inc de jr consume_spaces_loop consume_word_loop: call __fzx_string_glyph_width jr c, end_string ; if allowed width exceeded inc de ld a,(de) or a jr z, end_string_accept cp CHAR_LF jr z, end_string_accept cp CHAR_CR jr z, end_string_accept cp ' ' jr nz, consume_word_loop ; word ends pop bc ; junk last save point pop bc jr next_spaces end_string_accept: ex de,hl jp l_inc_sp - 4 ; junk last save point end_string: pop de ; de = saved allowed width remaining pop hl ; hl = saved s + prefix_len ret
19.638298
85
0.622969
fc674e017cdce7473afbc6bfcd5f5904e110ae7d
4,616
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_213.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_213.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_213.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %rcx push %rdi push %rsi lea addresses_WC_ht+0x15c19, %rsi lea addresses_WT_ht+0x11ee7, %rdi nop nop nop and %r10, %r10 mov $47, %rcx rep movsw cmp $27752, %r12 pop %rsi pop %rdi pop %rcx pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r9 push %rax push %rbp push %rbx push %rcx push %rdx // Store mov $0x57b, %r10 nop cmp %rbx, %rbx mov $0x5152535455565758, %rbp movq %rbp, %xmm0 movups %xmm0, (%r10) nop nop nop nop nop add $7408, %rcx // Load mov $0x587, %rcx nop nop nop cmp %rdx, %rdx mov (%rcx), %rbp cmp $15008, %rax // Faulty Load lea addresses_D+0x617b, %rdx clflush (%rdx) nop nop nop nop sub $46642, %r10 movups (%rdx), %xmm7 vpextrq $1, %xmm7, %rax lea oracles, %r9 and $0xff, %rax shlq $12, %rax mov (%r9,%rax,1), %rax pop %rdx pop %rcx pop %rbx pop %rbp pop %rax pop %r9 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_P'}} {'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_P'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': True, 'type': 'addresses_WT_ht'}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
49.634409
2,999
0.657929
3047598dc9a47cec042b2fc56a7edfbe50185b70
1,294
asm
Assembly
win64/lesson26.asm
mashingan/notes-asmtutor
88532e0b364a63cd1e7578a537807795d429fc2f
[ "MIT" ]
1
2021-11-05T06:41:49.000Z
2021-11-05T06:41:49.000Z
win64/lesson26.asm
mashingan/notes-asmtutor
88532e0b364a63cd1e7578a537807795d429fc2f
[ "MIT" ]
null
null
null
win64/lesson26.asm
mashingan/notes-asmtutor
88532e0b364a63cd1e7578a537807795d429fc2f
[ "MIT" ]
null
null
null
format PE64 console entry start include 'win64w.inc' section '.data' data readable writeable stdout dq ? filename TCHAR 'filecreate.txt', 0h failc db 'failed code: ', 0h writes db 'read file success', 0h content rw 32 contlen = $ - content section '.text' code readable executable start: fastcall setStdout enter 16, 0 lea r15, [rbp-8] invoke CreateFile, filename,\ GENERIC_READ,\ 0,\ 0,\ OPEN_ALWAYS,\ FILE_ATTRIBUTE_NORMAL,\ 0 mov [r15], rax cmp rax, 0 jne @f jmp .err @@: lea r14, [rbp-16] mov rdi, [r15] invoke ReadFile, rdi, content, contlen, r14, 0 cmp rax, false jne @f jmp .err @@: mov rcx, [r14] fastcall iprintLF mov rdx, [r14] mov rcx, content fastcall snprint .closehandle: invoke CloseHandle, rdi cmp rax, 0 je .err .leave: leave fastcall quitProgram .err: invoke GetLastError mov r13, rax mov rcx, failc fastcall sprint mov rcx, r13 fastcall iprintLF jmp .leave include 'procs.inc' section '.idata' import data readable library kernel32, 'kernel32.dll' include 'api\kernel32.inc'
19.029412
51
0.57187
97ae81873fb95667b2d90c3f5a24a6456cedc34b
743
asm
Assembly
oeis/084/A084773.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/084/A084773.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/084/A084773.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A084773: Coefficients of 1/sqrt(1-12*x+4*x^2); also, a(n) is the central coefficient of (1+6x+8x^2)^n. ; Submitted by Jon Maiga ; 1,6,52,504,5136,53856,575296,6225792,68026624,748832256,8291791872,92255680512,1030537089024,11550176206848,129824329777152,1462841567576064,16518691986407424,186887008999047168,2117944490818011136,24038305911245635584,273199990096465494016,3108768242420517175296,35414245789835924078592,403838032953160608251904,4609342278338599437991936,52655127146721792655097856,601982103040884946486951936,6887191686805272094322982912,78848542482761579175214055424,903270208971802400115828719616 mov $1,$0 mov $0,2 pow $0,$1 seq $1,1850 ; Central Delannoy numbers: a(n) = Sum_{k=0..n} C(n,k)*C(n+k,k). mul $1,$0 mov $0,$1
67.545455
485
0.827725
937c426536dd0531b5bbc6be81850e3395e129ee
1,805
asm
Assembly
programming/inline-assembly/lab7/source.asm
tonykozlovsky/bsu
6ea290ec69bf4ac1a2bfc4c800065ae1c68039a3
[ "MIT" ]
113
2017-02-02T13:09:21.000Z
2022-03-14T08:54:41.000Z
programming/inline-assembly/lab7/source.asm
tonykozlovsky/bsu
6ea290ec69bf4ac1a2bfc4c800065ae1c68039a3
[ "MIT" ]
12
2017-04-14T12:01:50.000Z
2022-03-08T22:47:22.000Z
programming/inline-assembly/lab7/source.asm
Drapegnik/bsu
769ddac58eddd5877e40949227998575fd4dec77
[ "MIT" ]
78
2017-03-18T22:36:13.000Z
2022-02-20T14:42:34.000Z
; ; Created by Drapegnik on 16.05.15. ; .386 .model flat .data str1 db 100 dup('0') str2 db 100 dup('0') str3 db 100 dup('0') len1 dd ? len2 dd ? .code _sum@8 proc push ebp mov ebp, esp mov ebx, dword ptr [ebp+8] xor ecx,ecx _while1: mov dl, [ebx] inc ebx inc ecx cmp dl, 0 jne _while1 dec ecx dec ebx dec ebx mov len1,ecx lea esi,[ebx] lea edi,str1 std _reverse1: lodsb mov byte ptr[edi],al inc edi loop _reverse1 cld ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; mov ebx, dword ptr [ebp+12] xor ecx,ecx _while2: mov dl, [ebx] inc ebx inc ecx cmp dl, 0 jne _while2 dec ecx dec ebx dec ebx mov len2,ecx lea esi,[ebx] lea edi,str2 std _reverse2: lodsb mov byte ptr[edi],al inc edi loop _reverse2 cld ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; mov ecx,len1 cmp ecx,len2 jl _len2 lea esi,str1 lea edi,str2 jmp _next _len2: lea esi,str2 lea edi,str1 mov ecx,len2 _next: mov len1,ecx xor eax,eax _sum: add al,byte ptr[edi] sub byte ptr[esi],'0' add al,byte ptr[esi] sub al,'0' cbw mov bl,10 div bl add ah,'0' mov byte ptr[esi],ah inc esi inc edi loop _sum cmp al,0 je _next2 add byte ptr[esi],al inc len1 inc esi _next2: mov ebx,0 mov [esi],ebx ;sub esi,len1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; mov ecx,len1 dec esi lea edi,str3 std _reverse3: lodsb mov byte ptr[edi],al inc edi loop _reverse3 cld mov byte ptr[edi],0 lea eax,str3 pop ebp ret 8 _sum@8 endp end
12.363014
60
0.492521
571d635fe16a82665f5a6cc57e83abb0d3eeed65
851
asm
Assembly
oeis/222/A222941.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/222/A222941.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/222/A222941.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A222941: Number of nX3 0..4 arrays with no element equal to another at a city block distance of exactly two, and new values 0..4 introduced in row major order ; Submitted by Jamie Morken(s2) ; 3,33,420,5880,82320,1152480,16134720,225886080,3162405120,44273671680,619831403520,8677639649280,121486955089920,1700817371258880,23811443197624320,333360204766740480,4667042866734366720,65338600134281134080,914740401879935877120,12806365626319102279680,179289118768467431915520,2510047662758544046817280,35140667278619616655441920,491969341900674633176186880,6887570786609444864466616320,96425991012532228102532628480,1349963874175451193435456798720,18899494238456316708096395182080 seq $0,170648 ; Number of reduced words of length n in Coxeter group on 15 generators S_i with relations (S_i)^2 = (S_i S_j)^49 = I. mov $1,$0 mul $0,2 mod $1,6 add $0,$1
85.1
485
0.846063
5dda906ca9b418e8e23044db789b40b1277b1e5e
611
asm
Assembly
oeis/166/A166752.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/166/A166752.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/166/A166752.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A166752: Interleave A007583 and A000012. ; 1,1,3,1,11,1,43,1,171,1,683,1,2731,1,10923,1,43691,1,174763,1,699051,1,2796203,1,11184811,1,44739243,1,178956971,1,715827883,1,2863311531,1,11453246123,1,45812984491,1,183251937963,1,733007751851,1,2932031007403,1,11728124029611,1,46912496118443,1,187649984473771,1,750599937895083,1,3002399751580331,1,12009599006321323,1,48038396025285291,1,192153584101141163,1,768614336404564651,1,3074457345618258603,1,12297829382473034411,1,49191317529892137643,1,196765270119568550571,1,787061080478274202283 mov $1,2 gcd $1,$0 pow $1,$0 div $1,3 mul $1,2 add $1,1 mov $0,$1
55.545455
500
0.813421
af9c8eb200eefd4bd8950d31123cfe1f5d198de0
86,717
asm
Assembly
src/m2-vwf-entries.asm
Iemnur/Mother2GbaTranslation
b8ca6df07ef69762fc5cc7453657b8e71178c78d
[ "MIT" ]
null
null
null
src/m2-vwf-entries.asm
Iemnur/Mother2GbaTranslation
b8ca6df07ef69762fc5cc7453657b8e71178c78d
[ "MIT" ]
null
null
null
src/m2-vwf-entries.asm
Iemnur/Mother2GbaTranslation
b8ca6df07ef69762fc5cc7453657b8e71178c78d
[ "MIT" ]
null
null
null
//============================================================================== c980c_custom_codes: push {r1-r2,lr} mov r1,r7 mov r2,r5 bl custom_codes_parse ldr r1,[r6] // If 0, return [r6]+2; otherwise, return [r6]+r0 cmp r0,#0 beq @@next cmp r0,#0 bge @@continue //If -1, then set this to 0 mov r0,#0 @@continue: add r0,r0,r1 pop {r1-r2,pc} @@next: add r0,r1,2 pop {r1-r2,pc} //============================================================================== c980c_weld_entry: push {r0-r3,lr} mov r0,r5 mov r1,r7 bl weld_entry pop {r0-r3,pc} //============================================================================== c8ffc_custom_codes: push {r2,r5,lr} ldrb r0,[r2] mov r5,r0 mov r1,r2 mov r2,r4 bl custom_codes_parse cmp r0,0 beq @@next mov r2,r12 add r0,r0,r2 strh r0,[r4,0x14] pop {r2,r5} add sp,4 ldr r1,=0x80C904D bx r1 @@next: mov r0,r5 cmp r0,1 pop {r2,r5,pc} .pool //============================================================================== c8ffc_weld_entry: push {r0-r1,lr} mov r0,r4 mov r1,r2 bl weld_entry pop {r0-r1,pc} //============================================================================== c980c_resetx: push {r1,lr} mov r1,0 strb r1,[r0,2] pop {r1} bl 0x80C87D0 pop {pc} //============================================================================== c980c_resetx_newline: push {lr} strh r0,[r5,0x2C] strh r4,[r5,0x2A] strb r4,[r5,2] pop {pc} //============================================================================== c980c_resetx_scroll: push {lr} strh r0,[r5,0x2C] strh r1,[r5,0x2A] strb r1,[r5,2] pop {pc} //============================================================================== c980c_resetx_other: push {lr} strh r0,[r5,0x2C] strh r2,[r5,0x2A] strb r2,[r5,2] pop {pc} //============================================================================== c980c_resetx_other2: push {lr} mov r2,0 strh r2,[r5,0x2A] strb r2,[r5,2] pop {pc} //============================================================================== c980c_resetx_other3: push {lr} mov r1,0 strh r1,[r5,0x2A] strb r1,[r5,2] pop {pc} //============================================================================== c980c_resetx_other4: push {lr} strh r0,[r5,0x2C] strh r6,[r5,0x2A] strb r6,[r5,2] pop {pc} //============================================================================== c87d0_clear_entry: push {lr} // Reset X mov r1,0 strb r1,[r0,2] // Clear window bl clear_window // Clobbered code ldr r4,=0x3005270 mov r1,0x24 pop {pc} .pool //============================================================================== c9634_resetx: push {lr} mov r4,0 strb r4,[r6,2] // Clobbered code strh r5,[r1] pop {pc} //============================================================================== // Only render the (None) strings in the equip window if there's nothing equipped c4b2c_skip_nones: push {r7,lr} add sp,-4 mov r7,0 // Get the (none) pointer mov r0,r4 mov r1,r10 mov r2,0x2A bl 0x80BE260 mov r5,r0 // Check each equip slot ldr r6,=0x3001D40 ldr r3,=0x3005264 ldrh r0,[r3] // active party character mov r1,0x6C mul r0,r1 add r6,r0,r6 add r6,0x75 ldrb r0,[r6] cmp r0,0 bne @@next // Weapon mov r0,r8 mov r1,r5 mov r2,0x6 mov r3,0 str r7,[sp] bl 0x80C9634 @@next: ldrb r0,[r6,1] cmp r0,0 bne @@next2 // Body mov r0,r8 mov r1,r5 mov r2,0x6 mov r3,1 str r7,[sp] bl 0x80C9634 @@next2: ldrb r0,[r6,2] cmp r0,0 bne @@next3 // Arms mov r0,r8 mov r1,r5 mov r2,0x6 mov r3,2 str r7,[sp] bl 0x80C9634 @@next3: ldrb r0,[r6,3] cmp r0,0 bne @@next4 // Other mov r0,r8 mov r1,r5 mov r2,0x6 mov r3,3 str r7,[sp] bl 0x80C9634 @@next4: mov r0,0 mov r10,r0 add sp,4 pop {r7,pc} .pool //============================================================================== //Print numbers in the numbers window at the beginning - Used in order to make sure the one-person version prints the numbers print_equip_base_numbers: push {lr} add sp,#-4 bl 0x80BC034 lsl r0,r0,#0x18 lsr r0,r0,#0x18 mov r1,r8 mov r2,#3 bl m2_formatnumber mov r5,#0 mov r0,r10 strb r5,[r0,#0x15] mov r0,#0xFF mov r1,r10 strb r0,[r1,#0x16] ldr r0,[r4,#0x14] str r5,[sp] mov r1,r8 mov r2,#0x37 mov r3,#3 bl printnumberequip //Prints Offense number bl 0x80BC0CC lsl r0,r0,#0x18 lsr r0,r0,#0x18 mov r1,r8 mov r2,#3 bl m2_formatnumber mov r0,r10 strb r5,[r0,#0x15] mov r0,#0xFF mov r1,r10 strb r0,[r1,#0x16] ldr r0,[r4,#0x14] str r5,[sp] mov r1,r8 mov r2,#0x37 mov r3,#0x13 bl printnumberequip //Prints Defense number bl store_pixels_overworld add sp,#4 pop {pc} //============================================================================== // Clears the equipment portion of the equip window // r0 = window pointer clear_equipment: push {r0-r4,lr} add sp,-4 mov r3,r0 ldr r0,=0x44444444 str r0,[sp] ldrh r0,[r3,0x22] add r0,6 ldrh r1,[r3,0x24] ldrh r2,[r3,0x26] sub r2,6 ldrh r3,[r3,0x28] bl clear_rect add sp,4 pop {r0-r4,pc} .pool //============================================================================== // Clear equipment and offense/defense when moving left/right on equip screen // r6 = window pointer c4b2c_clear_left: mov r0,r6 bl clear_equipment // Clear offense/defense push {r0-r3} mov r0,9 mov r1,0xB mov r2,8 bl bb21c_print_blankstr_buffer mov r0,9 mov r1,0xD mov r2,8 bl bb21c_print_blankstr_buffer pop {r0-r3} // Clobbered code strh r1,[r3] ldr r0,=0x80C4F3B bx r0 c4b2c_clear_right: mov r0,r6 bl clear_equipment // Clear offense/defense push {r0-r3} mov r0,9 mov r1,0xB mov r2,8 bl bb21c_print_blankstr_buffer mov r0,9 mov r1,0xD mov r2,8 bl bb21c_print_blankstr_buffer pop {r0-r3} // Clobbered code strh r1,[r3] ldr r0,=0x80C4EFF bx r0 .pool //============================================================================== // Prints a string in the status window c0a5c_printstr: push {r0-r2,lr} mov r0,r1 mov r1,r2 mov r2,r3 bl print_string pop {r0-r2,pc} //============================================================================== // Prints an empty space instead of the "Press A for PSI info" string c0a5c_psi_info_blank: push {r0-r3,lr} mov r0,5 mov r1,0xF mov r2,0x14 bl bb21c_print_blankstr_buffer pop {r0-r3,pc} //============================================================================== // Redraws the status window (when exiting the PSI submenu, etc.) bac18_redraw_status: push {r4,lr} ldr r4,=0x3005230 ldr r4,[r4,0x18] // Get the address of the status text ldr r0,=0x8B17EE4 ldr r1,=0x8B17424 mov r2,0x11 bl 0x80BE260 // Prepare the window for parsing mov r1,r0 mov r0,r4 mov r2,0 bl initWindow_buffer // Render text mov r0,r4 bl statusWindowText // Render numbers mov r0,r4 ldrh r1,[r0,#0] ldr r2,=#0xFBFF and r1,r2 strh r1,[r0,#0] mov r1,0 bl statusNumbersPrint pop {r4,pc} .pool //============================================================================== // Redraws the status window (when exiting the PSI menu) and stores it bac18_redraw_status_store: push {lr} bl bac18_redraw_status bl store_pixels_overworld pop {pc} .pool //============================================================================== // Calls m2_soundeffect only if we're going in either talk or check beaa6_fix_sounds: push {lr} mov r1,r10 add r1,r1,r4 mov r2,r5 add r2,#0x42 ldrb r2,[r2,#0] //Is this the status window? If not, then do the sound cmp r2,#0 beq @@sound cmp r1,#0 beq @@sound cmp r1,#4 bne @@end @@sound: bl m2_soundeffect @@end: pop {pc} //============================================================================== // Loads the buffer up in battle dc22a_load_buffer_battle: push {lr} mov r9,r0 ldr r3,[r5,#0] bl load_pixels_overworld push {r0-r3} swi #5 pop {r0-r3} pop {pc} //============================================================================== // Calls m2_soundeffect only if we're out of the main menu bea88_fix_sounds: push {lr} mov r2,r5 add r2,#0x42 ldrb r2,[r2,#0] //Is this the status window? If not, then we may not want to do the sound cmp r2,#0 bne @@sound ldrb r2,[r5,#3] //If we are printing, then don't do the sound mov r1,#1 and r1,r2 cmp r1,#0 beq @@end @@sound: bl m2_soundeffect @@end: pop {pc} //============================================================================== // Only if the character changed store the buffer - called when reading inputs bac6e_statusWindowNumbersInputManagement: push {lr} ldr r2,=#m2_active_window_pc ldrb r2,[r2,#0] push {r2} bl statusWindowNumbers pop {r2} ldr r1,=#m2_active_window_pc ldrb r1,[r1,#0] cmp r1,r2 beq @@end bl store_pixels_overworld @@end: pop {pc} //============================================================================== //Prints the attack target choice menu and stores the buffer e02c6_print_target_store: push {lr} bl printTargetOfAttack bl store_pixels_overworld pop {pc} //============================================================================== // Clears the PSI window when switching classes // r5 = 0x3005230 bac18_clear_psi: push {r0,lr} ldr r0,[r5,0x20] // PSI class window pointer ldrb r0,[r0] mov r1,0x10 and r0,r1 cmp r0,0 beq @@next // If flag 0x10 is set, clear the PSI window bl check_overworld_buffer ldr r1,=#buffer_subtractor sub r1,r0,r1 ldr r0,[r5,0x1C] // PSI window bl clear_window_buffer @@next: // Clobbered code pop {r0} lsl r0,r0,0x10 asr r4,r0,0x10 pop {pc} //============================================================================== // Clear offense/defense when re-equipping (or un-equipping) something baef8_reequip_erase: push {r0-r3,lr} mov r0,8 mov r1,0xB mov r2,4 bl bb21c_print_blankstr_buffer mov r0,8 mov r1,0xD mov r2,4 bl bb21c_print_blankstr_buffer // Clobbered code pop {r0-r3} mov r0,2 strh r0,[r1] pop {pc} //============================================================================== // Redraw main menu when exiting PSI target window b8bbc_redraw_menu_2to1: push {r1-r4,lr} add sp,-4 swi #5 // Copied from 80B7A74 mov r0,0 str r0,[sp] ldr r0,=0x3005230 ldr r0,[r0] // main menu window pointer ldr r1,[r0,4] // text pointer mov r2,5 mov r3,2 mov r4,r0 bl 0x80BE4C8 mov r0,r4 bl print_window_with_buffer swi #5 // Clobbered code (restore the window borders, etc.) mov r0,1 bl m2_swapwindowbuf add sp,4 pop {r1-r4,pc} .pool //============================================================================== // Redraw main menu when exiting PSI window from using a PSI and stores the buffer b8bbc_redraw_menu_13to2_store: push {lr} bl b8bbc_redraw_menu_13to2 mov r3,r9 cmp r3,#0 beq @@end //store only if we're exiting the menu bl store_pixels_overworld @@end: pop {pc} //============================================================================== // Redraw main menu when entering PSI target window b8bbc_redraw_menu_13to2: push {r1-r4,lr} add sp,-4 swi #5 // Copied from 80B7A74 mov r0,0 str r0,[sp] ldr r0,=0x3005230 ldr r0,[r0] // main menu window pointer ldr r1,[r0,4] // text pointer mov r2,5 mov r3,2 mov r4,r0 bl 0x80BE4C8 mov r0,r4 bl print_window_with_buffer swi #5 // Clobbered code (restore the window borders, etc.) mov r0,1 bl 0x80BD7F8 add sp,4 pop {r1-r4,pc} .pool //============================================================================== // Print a space before the Greek letter d3934_print_space: push {r2-r3,lr} mov r0,r4 bl print_space pop {r2-r3} // Clobbered code ldrb r1,[r3,1] lsl r0,r1,1 pop {pc} //============================================================================== // Copy a tile up one line // r4: (x << 16) (relative) // r5: dest tilemap // r6: window // r7: source tilemap // r8: y (dest, relative) // r10: 3005270 ca4bc_copy_tile_up: push {r4-r7,lr} // Four cases: // 1) copy blank to blank // 2) copy blank to non-blank // 3) copy non-blank to blank // 4) copy non-blank to non-blank // 1) we don't have to do anything: pixels are blank for source and dest, // and the tilemap won't change either // 2) we have to erase dest pixels and set dest tilemap to 0xE2FF // 3) we have to copy source pixels to dest pixels and set dest tilemap // to the proper tile index // 4) we only have to copy the source pixels to dest pixels // Check blank by comparing tilemap with 0xE2FF // 0xE2FF is already stored to [sp+(# of regs pushed * 4)] ldr r0,[sp,20] ldrh r1,[r7] ldrh r2,[r5] cmp r1,r0 bne @@next cmp r2,r0 bne @@blank_to_nonblank // Case 1: blank to blank b @@end @@next: cmp r2,r0 bne @@nonblank_to_nonblank // Case 3: non-blank to blank @@nonblank_to_blank: // Copy pixels up ldrh r0,[r6,0x22] lsl r0,r0,16 add r0,r0,r4 lsr r0,r0,16 // x ldrh r1,[r6,0x24] add r1,r8 // dest y mov r4,r1 add r1,2 // source y mov r6,r0 bl copy_tile_up // Set proper tilemap mov r0,r6 // dest x mov r1,r4 // dest y bl get_tile_number ldr r1,=0x30051EC ldrh r2,[r1] add r0,r0,r2 // dest tile number ldrh r1,[r1,0x3C] // 0xE000 orr r0,r1 strh r0,[r5] b @@end // Case 2: blank to non-blank @@blank_to_nonblank: // Set dest tilemap to 0xE2FF strh r0,[r5] // Case 4: non-blank to non-blank @@nonblank_to_nonblank: // Copy pixels up ldrh r0,[r6,0x22] lsl r0,r0,16 add r0,r0,r4 lsr r0,r0,16 // x ldrh r1,[r6,0x24] add r1,r8 // dest y add r1,2 // source y bl copy_tile_up @@end: pop {r4-r7,pc} .pool //============================================================================== // Erase tile (for short windows) // r2: 100 // r4: (x << 16) (relative) // r5: dest tilemap // r6: window // r8: y (dest, relative) ca4bc_erase_tile_short: push {r0-r1,lr} // Clobbered code orr r0,r1 // 0xE2FF strh r0,[r5] // dest tilemap // We need to erase the pixels ca4bc_erase_tile_common: ldrh r2,[r6,0x22] lsl r2,r2,16 add r2,r2,r4 lsr r0,r2,16 // x ldrh r1,[r6,0x24] add r1,r8 // y ldr r2,=0x44444444 bl clear_tile pop {r0-r1,pc} .pool //============================================================================== // Erase tile ca4bc_erase_tile: push {r0-r1,lr} // Clobbered code ldrh r1,[r1] strh r1,[r5] // We need to erase the pixels b ca4bc_erase_tile_common .pool //============================================================================== // Clear PSI window when scrolling through classes e06ec_clear_window: push {r0-r1,lr} ldr r0,=0x3002500 ldrh r0,[r0] cmp r0,0 beq @@next bl check_overworld_buffer ldr r1,=#buffer_subtractor sub r1,r0,r1 ldr r0,=#0x3005230 ldr r0,[r0,0x1C] bl clear_window_buffer @@next: pop {r0-r1} // Clobbered code lsl r0,r0,0x10 asr r4,r0,0x10 pop {pc} .pool //============================================================================== // Redraw PSI command when exiting PSI subwindow e06ec_redraw_psi: push {r0-r3,lr} mov r0,#1 mov r1,#2 mov r2,#2 bl printBattleMenu // Clobbered code pop {r0-r3} bl 0x80BD7F8 // restore tilemaps pop {pc} .pool //============================================================================== // Redraw Bash/Do Nothing and PSI commands when exiting PSI ally target subwindow e06ec_redraw_bash_psi: push {r0-r3,lr} mov r0,#1 mov r1,#3 mov r2,#2 bl printBattleMenu // Clobbered code pop {r0-r3} bl 0x80BD7F8 // restore tilemaps pop {pc} .pool //============================================================================== // Redraw Bash/Do Nothing, PSI commands, Goods and Defend when choosing enemy target e06ec_redraw_bash_psi_goods_defend: push {lr} push {r0-r3} ldr r2,=#0x8B204E4 //Is this an offensive PSI which needs a target? If so, redraw the background window ldr r1,=#0x8B2A9B0 ldr r0,[r6,#0x1C] ldr r0,[r0,#0x10] ldrh r3,[r0,#2] lsl r3,r3,#4 add r0,r3,r1 ldrh r3,[r0,#4] lsl r0,r3,#1 add r0,r0,r3 lsl r0,r0,#2 add r3,r0,r2 ldrb r0,[r3,#1] cmp r0,#1 beq @@keep cmp r0,#3 bne @@notOffensive //Otherwise, do not do it @@keep: ldrb r0,[r3] cmp r0,#0 bne @@notOffensive mov r0,#3 mov r1,#3 mov r2,#2 bl printBattleMenu @@notOffensive: pop {r0-r3} bl 0x80C2480 //Prints the target pop {pc} .pool //============================================================================== //Redraw main battle window for "goods" targets e0ce4_redraw_battle_window_first_four: push {lr} push {r0-r3} mov r0,#3 mov r1,#3 mov r2,#4 bl printBattleMenu pop {r0-r3} bl initWindow_buffer pop {pc} //============================================================================== //Redraw main battle window for going back to Goods from targets e0faa_redraw_battle_window_first_two: push {r4,lr} push {r0-r3} mov r0,#1 mov r1,#1 mov r2,#4 bl printBattleMenu pop {r0-r3} ldr r4,[sp,#8] add sp,#-4 str r4,[sp,#0] bl initWindow_cursor_buffer mov r0,#4 bl store_pixels_overworld_buffer_totalTiles mov r0,#0 add sp,#4 pop {r4,pc} //============================================================================== //Calls the funcion which loads the targets in and then stores the buffer ba8ac_load_targets_print: push {lr} ldr r2,=#0x20248AC ldrh r2,[r2,#0] push {r2} bl 0x80BAA80 pop {r2} cmp r2,#0 bne @@end //Store the buffer to vram only if the target window was printed. bl store_pixels_overworld @@end: pop {pc} //============================================================================== // Print "PSI " c239c_print_psi: push {lr} add sp,-4 mov r2,0 str r2,[sp] mov r2,r4 lsl r3,r3,3 // tiles-to-pixels bl printstr_hlight_pixels_buffer add sp,4 pop {pc} //============================================================================== // Use new pointer for user/target strings ebfd4_user_pointer: push {lr} bl save_last_pc_overworld mov r4,0x4C lsl r4,r4,4 add r0,r0,r4 mov r5,r0 lsl r4,r1,0x10 asr r4,r4,0x10 mov r1,r2 mov r2,r4 bl 0x80F4C78 add r0,r4,r5 mov r1,0 strb r1,[r0] mov r1,0xFF strb r1,[r0,1] pop {pc} ec004_user_pointer: push {r1} ldr r1,[sp,4] mov lr,r1 pop {r1} add sp,4 ldr r0,=0x3005220 ldr r0,[r0] mov r1,0x4C lsl r1,r1,4 add r0,r0,r1 bx lr ec010_target_pointer: push {lr} mov r4,0x50 lsl r4,r4,4 add r0,r0,r4 mov r5,r0 lsl r4,r1,0x10 asr r4,r4,0x10 mov r1,r2 mov r2,r4 bl 0x80F4C78 add r0,r4,r5 mov r1,0 strb r1,[r0] mov r1,0xFF strb r1,[r0,1] pop {pc} ec046_target_pointer: push {r1} ldr r1,[sp,4] mov lr,r1 pop {r1} add sp,4 ldr r0,[r0] mov r1,0x50 lsl r1,r1,4 add r0,r0,r1 bx lr c980c_user_pointer: push {lr} bl custom_user_pointer ldr r0,[r5,0x1C] pop {pc} c980c_target_pointer: ldr r0,[r0] mov r7,0x50 lsl r7,r7,4 add r0,r0,r7 bx lr .pool //============================================================================== //Saves the last loaded pc for the overworld save_last_pc_overworld: push {r0-r1,lr} ldr r1,=m2_is_battle ldrh r1,[r1] cmp r1,#0 //Are we in the overworld? bne @@total_end mov r1,0 //If we are, find out which pc it is... ldr r0,=m2_ness_name //Ness cmp r0,r2 beq @@end mov r1,1 add r0,7 //Paula cmp r0,r2 beq @@end mov r1,2 add r0,7 //Jeff cmp r0,r2 beq @@end mov r1,3 add r0,7 //Poo cmp r0,r2 beq @@end mov r1,0xFF @@end: ldr r0,=m2_cstm_last_pc //Save it here strb r1,[r0] @@total_end: pop {r0-r1,pc} //============================================================================== //Sets the names' background to a default _215a_load_names: push {lr} bl 0x8012460 bl set_background_loaded_names pop {pc} //============================================================================== // Add a space between enemy name and letter in multi-enemy fights for the selection window. Called only by enemies. dcd00_enemy_letter: push {r1-r2,lr} ldrb r1,[r5,#0] cmp r1,#1 //In case the name has a "the " at the beginning, remove it bne @@end mov r2,sp add r2,#0xC //Get where the writing stack for the name starts sub r5,r5,#4 @@cycle: //The removed and shifted everything by 4 bytes ldr r1,[r2,#4] str r1,[r2,#0] add r2,#4 cmp r2,r5 ble @@cycle @@end: sub r5,r5,#2 //The the flag must be accounted for. It moves the pointer by 2, so we put it back sub r0,0x90 strb r0,[r5,#1] //Put the letter near the enemy writing space mov r0,#0x50 //Store the space strb r0,[r5] mov r0,#0 //Store the the flag as 0 strb r0,[r5,#4] pop {r1-r2,pc} .pool //============================================================================== // Add a space between enemy name and letter in multi-enemy fights for 9F FF and AD FF. Only enemies call this. dae00_enemy_letter: push {lr} sub r0,0x90 strb r0,[r4,#1] //Put the letter near the enemy writing space mov r0,#0x50 //Store the space strb r0,[r4] mov r0,#0 //Store the the flag as 0 strb r0,[r4,#4] pop {pc} .pool //============================================================================== // "The" flag checks for the Target window. It will always be lowercase, this makes things much simpler because it will never be changed due to the character printed before it, unlike how it happens with 9F FF and AD FF. dcd5c_theflag: push {r4,lr} // Clobbered code: get enemy string pointer lsl r4,r2,1 bl 0x80BE260 mov r1,r0 mov r0,sp add r0,8 // Check for "The" flag ldr r3,=m2_enemy_attributes ldrb r3,[r3,r4] // "The" flag cmp r3,0 beq @@next // Write "the " before the enemy name ldr r2,=0x509598A4 str r2,[r0] add r0,4 @@next: pop {r4,pc} .pool //============================================================================== db08e_theflagflag: //Puts a flag at the end of the name that is 1 if the has been added. 0 otherwise. (called right after db04c_theflag or dcd5c_theflag) push {r3,lr} bl 0x80DAEEC pop {r3} add r0,#2 strb r3,[r0,#0] mov r3,r0 pop {pc} .pool //============================================================================== ca442_store_letter: push {r1,lr} ldr r1,=m2_cstm_last_printed ldrb r0,[r7,#0] strb r0,[r1,#0] lsl r0,r0,#1 pop {r1,pc} //============================================================================== custom_user_pointer: //Routine that gives in r1 the user string pointer ldr r1,[r0,#0] mov r0,#0x4C lsl r0,r0,#4 add r1,r0,r1 bx lr //============================================================================== // r0 = window // r9 = item index // Return: r2 = x location for item string (relative to window location) // Can use: r1, r3, r5 b998e_get_itemstring_x: push {lr} mov r5,r0 // r2 = cursor_x + 1 + (is_equipped(current_item_index) ? 1 : 0) mov r0,r9 add r0,1 bl m2_isequipped ldrh r1,[r5,0x34] // cursor_x add r0,r0,r1 add r2,r0,1 mov r0,r5 pop {pc} .pool //============================================================================== //Loads the player's name properly eeb1a_player_name: push {lr} mov r2,#0x18 //Maximum amount of characters in the name ldr r1,=m2_player1 //Player's name new location mov r3,#0 @@continue_cycle: //Count the amount of characters cmp r3,r2 bge @@exit_cycle add r0,r1,r3 ldrb r0,[r0,#0] cmp r0,#0xFF beq @@exit_cycle add r3,#1 b @@continue_cycle @@exit_cycle: mov r4,r3 //Store the amount of characters in r4 bl 0x80A322C //Clobbered code: load at which letter the routine is lsl r1,r4,#0x10 lsl r0,r0,#0x10 cmp r1,r0 blt @@ended bl 0x80A322C mov r3,#1 ldr r1,=m2_player1 //Player's name new location. The routine starts from 1 because the original routine had a flag before the name, so we subtract 1 to the address we look at in order to avoid skipping a character sub r1,r1,r3 lsl r0,r0,#0x10 asr r0,r0,#0x10 add r1,r1,r0 ldrb r0,[r1,#0] b @@next @@ended: mov r0,#0 @@next: //Do the rest of the routine pop {pc} .pool //============================================================================== //These three hacks remove the game's ability to read the script instantly out of a won battle cb936_battle_won: //Called at the end of a battle if it is won push {lr} ldr r0,=m2_script_readability //Remove the ability to instantly read the script mov r1,#8 strb r1,[r0,#0] ldr r0,=#0x3000A6C //Clobbered code mov r1,#0 pop {pc} .pool //============================================================================== b7702_check_script_reading: //Makes the game wait six extra frames before being able to read the script out of battle push {lr} ldr r0,=m2_script_readability ldrb r1,[r0,#0] cmp r1,#2 //If the value is > 2, then lower it ble @@next sub r1,r1,#1 strb r1,[r0,#0] b @@end @@next: cmp r1,#2 //If the value is 2, change it to 0 and allow reading the script bne @@end mov r1,#0 strb r1,[r0,#0] @@end: mov r7,r10 //Clobbered code mov r6,r9 pop {pc} .pool //============================================================================== a1f8c_set_script_reading: //Changes the way the game sets the ability to read the script push {lr} ldrb r1,[r0,#0] cmp r1,#8 //If this particular flag is set, then don't do a thing. Allows to make it so the game waits before reading the script. beq @@next mov r1,#0 strb r1,[r0,#0] b @@end @@next: mov r1,#0 @@end: pop {pc} .pool //============================================================================== //Hacks that load specific numbers for the new names _2352_load_1d7: mov r0,#0xEB lsl r0,r0,#1 add r0,r0,#1 bx lr _2372_load_1e5: mov r0,#0xF2 lsl r0,r0,#1 add r0,r0,#1 bx lr c98c4_load_1d7: mov r4,#0xEB lsl r4,r4,#1 add r4,r4,#1 bx lr c98d4_load_1e5: mov r4,#0xF2 lsl r4,r4,#1 add r4,r4,#1 bx lr //============================================================================== //Fast routine that uses the defaults and stores them. Original one is a nightmare. Rewriting it from scratch. r1 has the target address. r5 has 0. cb2f2_hardcoded_defaults: push {lr} mov r0,#0x7E //Ness' name strb r0,[r1,#0] mov r2,#0x95 strb r2,[r1,#1] strb r2,[r1,#0xF] mov r0,#0xA3 strb r0,[r1,#2] strb r0,[r1,#3] mov r4,#0xFF lsl r5,r4,#8 strh r5,[r1,#4] add r1,#7 mov r0,#0x80 //Paula's name strb r0,[r1,#0] strb r0,[r1,#0xE] mov r3,#0x91 strb r3,[r1,#1] strb r3,[r1,#4] mov r0,#0xA5 strb r0,[r1,#2] mov r0,#0x9C strb r0,[r1,#3] strb r5,[r1,#5] strb r4,[r1,#6] add r1,#7 mov r0,#0x7A //Jeff's name strb r0,[r1,#0] mov r0,#0x95 strb r0,[r1,#1] mov r0,#0x96 strb r0,[r1,#2] strb r0,[r1,#3] strh r5,[r1,#4] add r1,#7 strb r4,[r1,#4] mov r4,#0x9F //Poo's name strb r4,[r1,#1] strb r4,[r1,#2] strb r5,[r1,#3] add r1,#7 mov r0,#0x7B //King's name strb r0,[r1,#0] mov r0,#0x99 strb r0,[r1,#1] mov r0,#0x9E strb r0,[r1,#2] mov r0,#0x97 strb r0,[r1,#3] strh r5,[r1,#4] add r1,#8 mov r0,#0x83 //Steak's name strb r0,[r1,#0] mov r0,#0xA4 strb r0,[r1,#1] strb r2,[r1,#2] strb r3,[r1,#3] mov r3,#0x9B strb r3,[r1,#4] mov r2,#0xFF strb r5,[r1,#5] strb r2,[r1,#6] add r1,#8 mov r0,#0x82 //Rockin's name strb r0,[r1,#0] strb r4,[r1,#1] mov r0,#0x93 strb r0,[r1,#2] strb r3,[r1,#3] mov r0,#0x99 strb r0,[r1,#4] mov r0,#0x9E strb r0,[r1,#5] strh r5,[r1,#6] mov r2,#1 mov r5,#0 pop {pc} //============================================================================== //Routine for window headers that fixes the issue character - tiles fix_char_tiles: push {lr} lsl r0,r2,#1 lsl r1,r2,#2 add r1,r1,r0 //Multiply r2 (character count) by 6 lsr r0,r1,#3 //Divide by 8 lsl r0,r0,#3 //Re-multiply by 8 cmp r0,r1 //Can it stay in r0 pixels? (Was this a division by 8 without remainder?) beq @@next add r0,#8 //If it cannot stay in x tiles, add 1 to the amount of tiles needed @@next: lsr r0,r0,#3 //Get the amount of tiles needed cmp r0,r2 //If it's not the same amout as the characters... beq @@end sub r0,r2,r0 lsl r0,r0,#1 sub r6,r6,r0 //Remove the amount of extra tiles @@end: pop {pc} //============================================================================== //Specific fix_char_tiles routine - Status window c0b28_fix_char_tiles: push {lr} bl fix_char_tiles ldr r0,[r4,#0] //Clobbered code add r0,#0xB3 pop {pc} //============================================================================== //Specific fix_char_tiles routine - Give window c009e_fix_char_tiles: push {lr} mov r2,r5 bl fix_char_tiles ldr r2,=#0x30051EC //Clobbered code ldrh r0,[r2] pop {pc} //============================================================================== //Specific fix_char_tiles routine - Equip window c4bd6_fix_char_tiles: push {lr} mov r6,r7 bl fix_char_tiles mov r7,r6 ldr r2,=#0x30051EC //Clobbered code ldrh r0,[r2] pop {pc} .pool //============================================================================== //Specific fix_char_tiles routine - Outer PSI window c42e0_fix_char_tiles: push {lr} bl fix_char_tiles mov r2,r9 //Clobbered code ldrh r0,[r2,#0] pop {pc} //============================================================================== //Specific fix_char_tiles routine - Inner PSI window - part 2 c4448_fix_char_tiles: push {lr} bl fix_char_tiles mov r2,r8 //Clobbered code ldrh r0,[r2,#0] pop {pc} //============================================================================== //Routine which clears the header and THEN makes it so the string is printed c6190_clean_print: push {lr} push {r0-r3} mov r1,#6 //Number of tiles to clean bl clear_window_header pop {r0-r3} bl 0x80CAB90 pop {pc} //============================================================================== //Routine which prints just the number with a tiny buffer c6190_buffer_number: push {lr} lsl r2,r2,#3 lsl r3,r3,#3 bl print_window_number_header_string add r0,#7 lsr r0,r0,#3 pop {pc} //============================================================================== //Routine which clears the header and THEN makes it so the string is printed c65da_clean_print: push {lr} push {r0-r3} mov r1,#3 //Number of tiles to clean bl clear_window_header pop {r0-r3} bl 0x80CAB90 pop {pc} //============================================================================== //Routine which clears the header and THEN makes it so the string is printed _0x10_clean_print: push {lr} push {r0-r3} mov r1,#0x10 //Number of tiles to clean bl clear_window_header pop {r0-r3} bl 0x80CAB90 pop {pc} //============================================================================== //Routine which calls the header clearer and changes the position of Stored Goods in the arrangement c6570_clean_print_change_pos: push {lr} ldrb r0,[r6,#2] //Load pixel_x cmp r0,#0xFF bne @@after_header mov r0,#0 strb r0,[r6,#2] mov r0,r7 bl _0x10_clean_print @@after_header: ldr r2,=#0x230 //Change starting position mov r0,r2 //Clobbered code ldrh r3,[r4,#0] add r0,r0,r3 mov r2,r8 ldrh r1,[r2,#0] orr r0,r1 mov r2,#0 @@cycle: //Print 9 tiles in the arrangement lsl r0,r0,#0x10 lsr r0,r0,#0x10 mov r1,r0 add r0,r1,#1 strh r1,[r5,#0] add r5,#2 add r2,#1 cmp r2,#9 bne @@cycle bl store_pixels_overworld // Stores buffer after printing happened pop {pc} .pool //============================================================================== //Routine which gives the address to the party member's inventory get_inventory_selected: push {r3,lr} ldr r0,=m2_source_pc //Load source pc ldrb r0,[r0,#0] ldr r3,=#0x3001D40 //Get inventory mov r2,#0x6C mul r0,r2 add r3,#0x14 add r0,r0,r3 pop {r3,pc} //============================================================================== //Routine which gets the address to the selected party member's inventory and then prints it get_print_inventory_window: push {r0-r4,lr} bl get_inventory_selected mov r1,r0 //Inventory ldr r0,[r4,#0x10] //Window ldr r3,=m2_active_window_pc //Change the pc of the window so m2_isequipped can work properly ldr r2,[r3,#0] lsl r2,r2,#0x10 asr r2,r2,#0x10 push {r2} ldr r2,=m2_source_pc //Load source pc ldrb r2,[r2,#0] str r2,[r3,#0] //Store it mov r2,#0 //No y offset bl goods_print_items //Print the inventory bl store_pixels_overworld pop {r2} ldr r3,=m2_active_window_pc //Restore pc of the window lsl r2,r2,#0x10 asr r2,r2,#0x10 str r2,[r3,#0] pop {r0-r4,pc} //============================================================================== //Specific Routine which calls get_print_inventory_window ba48e_get_print_inventory_window: push {lr} push {r4} ldr r4,=#0x3005230 bl get_print_inventory_window //Prints old inventory pop {r4} bl 0x80BD7F8 //Copies old arrangements, this includes the highlight pop {pc} //============================================================================== //Specific Routine which calls get_print_inventory_window b9ecc_get_print_inventory_window: push {lr} push {r4} ldr r4,=#0x3005230 bl get_print_inventory_window //Prints old inventory pop {r4} bl 0x80BD7F8 //Copies old arrangements, this includes the highlight pop {pc} //============================================================================== //Specific Routine which calls get_print_inventory_window ba61c_get_print_inventory_window: push {r5,lr} mov r5,r7 bl get_print_inventory_window //Prints old inventory bl 0x80BD7F8 //Copies old arrangements, this includes the highlight pop {r5,pc} .pool //============================================================================== //Reprints both the Main window and the Cash window if need be generic_reprinting_first_menu: push {lr} push {r0-r6} add sp,#-8 ldr r6,=#0x3005078 //Make sure the game expects only the right amount of lines to be written (so only 1) ldrb r4,[r6,#0] str r4,[sp,#4] mov r4,#0 strb r4,[r6,#0] ldr r4,=#0x3005230 //Window generic address //Main window mov r2,#1 ldr r0,[r4,#0] //Main window place in ram ldrb r0,[r0,#0] and r2,r0 cmp r2,#0 beq @@cash //Check if window is enabled before printing in it ldr r0,=#0x8B17EE4 ldr r1,=#0x8B17424 ldr r3,=m2_psi_exist //Flag which if not 0xFF means no one has PSI ldrb r3,[r3,#0] cmp r3,#0xFF beq @@psiNotFound mov r2,#0 b @@keep_going @@psiNotFound: mov r2,#1 @@keep_going: bl m2_strlookup //Load the proper menu string based on m2_psi_exist mov r1,#0 str r1,[sp,#0] mov r1,r0 ldr r0,[r4,#0] mov r2,#5 mov r3,#2 bl 0x80BE4C8 //Let it do its things ldr r0,[r4,#0] bl print_window_with_buffer //Print text in the window mov r2,#1 ldr r0,[r4,#4] //Cash window place in ram ldrb r0,[r0,#0] and r2,r0 cmp r2,#0 bne @@insidecash bl store_pixels_overworld_options //Only this window must be reprinted b @@end @@cash: //Cash mov r2,#1 ldr r0,[r4,#4] //Cash window place in ram ldrb r0,[r0,#0] and r2,r0 cmp r2,#0 beq @@end //Check if window is enabled before printing in it @@insidecash: ldr r2,=#0x300130C ldr r0,[r2,#0] mov r1,#2 orr r0,r1 str r0,[r2,#0] ldr r0,=#0x3001D40 mov r1,#0xD2 lsl r1,r1,#3 add r0,r0,r1 ldr r0,[r0,#0] //Load the money ldr r5,=#0x3005200 ldr r1,[r5,#0] mov r2,r1 //Load the string address mov r1,#0x30 //Padding bl format_cash_window ldr r0,[r4,#4] ldr r1,[r5,#0] mov r2,#0 bl initWindow_buffer //Let it do its things ldr r0,[r4,#4] bl print_window_with_buffer //Print text in the window bl store_pixels_overworld_psi_window @@end: ldr r4,[sp,#4] strb r4,[r6,#0] //Restore expected amount of lines to be written add sp,#8 pop {r0-r6} pop {pc} .pool //============================================================================== //Reprints both the Main window and the Cash window if need be, but highlights "Talk to" generic_reprinting_first_menu_talk_to_highlight: push {lr} push {r0-r6} add sp,#-8 ldr r6,=#0x3005078 //Make sure the game expects only the right amount of lines to be written (so only 1) ldrb r4,[r6,#0] str r4,[sp,#4] mov r4,#0 strb r4,[r6,#0] ldr r4,=#0x3005230 //Window generic address //Main window mov r2,#1 ldr r0,[r4,#0] //Main window place in ram ldrb r0,[r0,#0] and r2,r0 cmp r2,#0 beq @@cash //Check if window is enabled before printing in it ldr r0,=#0x8B17EE4 ldr r1,=#0x8B17424 ldr r3,=m2_psi_exist //Flag which if not 0xFF means no one has PSI ldrb r3,[r3,#0] cmp r3,#0xFF beq @@psiNotFound mov r2,#0 b @@keep_going @@psiNotFound: mov r2,#1 @@keep_going: bl m2_strlookup //Load the proper menu string based on m2_psi_exist mov r1,#0 str r1,[sp,#0] mov r1,r0 ldr r0,[r4,#0] mov r2,#5 mov r3,#2 bl 0x80BE4C8 //Let it do its things ldr r0,[r4,#0] bl print_window_with_buffer //Print text in the window bl highlight_talk_to mov r2,#1 ldr r0,[r4,#4] //Cash window place in ram ldrb r0,[r0,#0] and r2,r0 cmp r2,#0 bne @@insidecash bl store_pixels_overworld_options //Only this window must be reprinted b @@end @@cash: //Cash mov r2,#1 ldr r0,[r4,#4] //Cash window place in ram ldrb r0,[r0,#0] and r2,r0 cmp r2,#0 beq @@end //Check if window is enabled before printing in it @@insidecash: ldr r2,=#0x300130C ldr r0,[r2,#0] mov r1,#2 orr r0,r1 str r0,[r2,#0] ldr r0,=#0x3001D40 mov r1,#0xD2 lsl r1,r1,#3 add r0,r0,r1 ldr r0,[r0,#0] //Load the money ldr r5,=#0x3005200 ldr r1,[r5,#0] mov r2,r1 //Load the string address mov r1,#0x30 //Padding bl format_cash_window ldr r0,[r4,#4] ldr r1,[r5,#0] mov r2,#0 bl initWindow_buffer //Let it do its things ldr r0,[r4,#4] bl print_window_with_buffer //Print text in the window bl store_pixels_overworld_psi_window @@end: ldr r4,[sp,#4] strb r4,[r6,#0] //Restore expected amount of lines to be written add sp,#8 pop {r0-r6} pop {pc} .pool //============================================================================== //Specific (But still very generic) call to generic_reprinting_first_menu which then calls swapwindowbuf as expected from the game _reprint_first_menu: push {lr} bl generic_reprinting_first_menu mov r0,#1 bl m2_swapwindowbuf pop {pc} //============================================================================== //Specific call to b9aa2_special_string, needed for the help function ba7be_reprint_first_menu: push {lr} bl b9aa2_special_string ldr r1,=#0x40000D4 ldr r0,=#0x3005200 pop {pc} //============================================================================== //Specific call to b9aa2_special_string, needed for when you exit the item action function b9aa2_reprint_first_menu: push {lr} bl b9aa2_special_string mov r0,#1 bl 0x80BD7F8 pop {pc} //============================================================================== //Setup which only prints either "Check" or "PSI \n Check" in the main window. Needed in order to avoid the not-needed options popping in the item window for 2-3 frames b9aa2_special_string: push {lr} push {r0-r5} add sp,#-68 ldr r5,=#0x3005078 //Make sure the game expects only the right amount of lines to be written (so only 1) ldrb r4,[r5,#0] str r4,[sp,#4] mov r4,#0 strb r4,[r5,#0] ldr r4,=#0x3005230 //Window generic address //Main window mov r2,#1 ldr r0,[r4,#0] //Main window place in ram ldrb r0,[r0,#0] and r2,r0 cmp r2,#0 beq @@end //Check if window is enabled before printing in it ldr r1,=m2_psi_exist ldrb r1,[r1,#0] add r0,sp,#8 bl setupShortMainMenu //Get shortened menu string mov r1,#0 str r1,[sp,#0] add r1,sp,#8 ldr r0,[r4,#0] mov r2,#5 mov r3,#2 bl 0x80BE4C8 //Let it do its things ldr r0,[r4,#0] ldrb r1,[r0,#0] mov r2,#0xDF and r2,r1 strb r2,[r0,#0] //Do not redraw the window mov r3,r0 mov r0,#1 mov r1,#2 mov r2,#4 bl print_blankstr_window_buffer //Clears PSI mov r0,#1 mov r1,#4 mov r2,#4 ldr r3,[r4,#0] bl print_blankstr_window_buffer //Clears Check ldr r0,[r4,#0] bl print_window_with_buffer //Print text in the window bl store_pixels_overworld_options @@end: ldr r4,[sp,#4] strb r4,[r5,#0] //Restore expected amount of lines to be written add sp,#68 pop {r0-r5} pop {pc} .pool //============================================================================== //Setup which only prints either "Talk to" and "Goods" in the main window. b9040_special_string: push {lr} push {r0-r5} add sp,#-76 ldr r5,=#0x3005078 //Make sure the game expects only the right amount of lines to be written (so only 1) ldrb r4,[r5,#0] str r4,[sp,#4] mov r4,#0 strb r4,[r5,#0] ldr r4,=#0x3005230 //Window generic address //Main window lsl r1,r0,#0x18 lsr r1,r1,#0x18 cmp r1,#0 bne @@end //Print only if there is an effective need to do so (So the routine before returned 0) ldr r0,[r4,#0] //Main window place in ram ldr r2,[r0,#4] //Save proper text_start and text_start2 str r2,[sp,#8] ldr r2,[r0,#8] str r2,[sp,#0xC] ldrb r0,[r0,#0] mov r2,#1 and r2,r0 cmp r2,#0 beq @@end //Check if window is enabled before printing in it add r0,sp,#16 bl setupShortMainMenu_Talk_to_Goods //Get shortened menu string mov r1,#0 str r1,[sp,#0] add r1,sp,#16 ldr r0,[r4,#0] mov r2,#5 mov r3,#2 bl 0x80BE4C8 //Let it do its things ldr r0,[r4,#0] bl print_window_with_buffer //Print text in the window ldr r0,[r4,#0] //Restore text_start and text_start2 ldr r1,[sp,#8] str r1,[r0,#4] ldr r1,[sp,#0xC] str r1,[r0,#8] @@end: ldr r4,[sp,#4] strb r4,[r5,#0] //Restore expected amount of lines to be written add sp,#76 pop {r0-r5} lsl r0,r0,#0x18 //Clobbered code lsr r0,r0,#0x18 pop {pc} .pool //============================================================================== //Makes it sure the outer PSI window of the PSI Overworld menu prints the PSIs only once b8cd2_psi_window: push {lr} ldrb r1,[r0,#3] //Checks vwf_skip mov r2,#1 and r2,r1 cmp r2,#1 beq @@do_not_print mov r2,#1 //Goes on as usual and sets vwf_skip to true orr r2,r1 strb r2,[r0,#3] bl clearWindowTiles_buffer pop {pc} @@do_not_print: //Doesn't print in the PSI window ldr r1,=#m2_active_window_pc mov r2,#0 ldsh r1,[r1,r2] push {r1} //Stores the active window pc bl 0x80C3F28 //Input management function pop {r1} //Restores the active window pc cmp r0,#0 //Are we changing the window we're in? If this is 0, we're not beq @@no_change_in_window lsl r0,r0,#0x10 //If r0 is 0xFFFFFFFF, then we're exiting the window lsr r5,r0,#0x10 //Set up r5 properly b @@goToInner @@no_change_in_window: mov r5,#0 ldr r0,=#m2_active_window_pc mov r2,#0 ldsh r0,[r0,r2] //Has the main character changed? cmp r0,r1 beq @@keep ldr r0,[r4,#0x1C] //If it has, set wvf_skip to false mov r2,#0 strb r2,[r0,#3] pop {r0} add r0,#0xA bx r0 @@goToInner: ldr r0,[r4,#0x1C] //Stores false in vwf_skip, which means the window will be printed mov r2,#0 strb r2,[r0,#3] @@keep: ldr r7,=#m2_active_window_pc //The game sets this up in the code we jump, so we need to set it up here pop {r0} add r0,#0x18 bx r0 //Jump to the next useful piece of code .pool //============================================================================== //Makes it sure the outer PSI window of the PSI Status menu prints the PSIs only once bacea_status_psi_window: push {lr} ldrh r2,[r0,#0x36] push {r2} //Stores the cursor's Y position bl 0x80BE53C //Input management function push {r0} //Stores the input ldr r0,[r5,#0x20] //Loads vwf_skip ldrb r1,[r0,#3] mov r2,#1 and r2,r1 cmp r2,#1 //Checks if true beq @@do_not_print mov r2,#1 //Sets vwf_skip to true and proceeds as usual orr r2,r1 strb r2,[r0,#3] pop {r0} pop {r2} pop {pc} @@do_not_print: pop {r0} cmp r0,#0 //If the input is > 0, then we're entering one of the submenus (Offensive, Healing, etc.) bgt @@goToInner cmp r0,#0 beq @@noAction lsl r0,r0,0x10 //If the input is 0xFFFFFFFF we're exiting the window. Sets r4 up and vwf_skip to false, then exits the routine. asr r4,r0,0x10 ldr r0,[r5,#0x20] mov r2,#0 strb r2,[r0,#3] pop {r0} pop {r0} add r0,#4 bx r0 @@noAction: mov r4,#0 pop {r1} ldr r0,[r5,#0x20] ldrh r2,[r0,#0x36] cmp r1,r2 //Checks if the cursor's Y position is the same as it was before beq @@noActionAtAll mov r2,#0 //If it's not, then sets vwf_skip to false strb r2,[r0,#3] @@noActionAtAll: b @@end //Goes to the end of the routine @@goToInner: lsl r0,r0,0x10 //Properly stores the output into r4 and, since we're going into the inner window, sets vwf_skip to false asr r4,r0,0x10 ldr r0,[r5,#0x20] mov r2,#0 strb r2,[r0,#3] pop {r0} @@end: pop {r0} add r0,#0x3E bx r0 //Jump to the next useful piece of code //============================================================================== //Makes it sure the outer PSI window of the PSI battle menu prints the PSIs only once //It's the same as the one above, but the bottom exit is different e079a_battle_psi_window: push {lr} ldrh r2,[r0,#0x36] push {r2} //Stores the cursor's Y position bl 0x80BE53C //Input management function push {r0} //Stores the input ldr r0,[r5,#0x20] //Loads vwf_skip ldrb r1,[r0,#3] mov r2,#1 and r2,r1 cmp r2,#1 //Checks if true beq @@do_not_print mov r2,#1 //Sets vwf_skip to true and proceeds as usual orr r2,r1 strb r2,[r0,#3] pop {r0} pop {r2} pop {pc} @@do_not_print: pop {r0} cmp r0,#0 //If the input is > 0, then we're entering one of the submenus (Offensive, Healing, etc.) bgt @@goToInner cmp r0,#0 beq @@noAction lsl r0,r0,0x10 //If the input is 0xFFFFFFFF we're exiting the window. Sets r4 up and vwf_skip to false, then exits the routine. asr r4,r0,0x10 ldr r0,[r5,#0x20] mov r2,#0 strb r2,[r0,#3] pop {r0} pop {r0} add r0,#4 bx r0 @@noAction: mov r4,#0 pop {r1} ldr r0,[r5,#0x20] ldrh r2,[r0,#0x36] cmp r1,r2 //Checks if the cursor's Y position is the same as it was before beq @@noActionAtAll mov r2,#0 //If it's not, then sets vwf_skip to false strb r2,[r0,#3] @@noActionAtAll: b @@end //Goes to the end of the routine @@goToInner: lsl r0,r0,0x10 //Properly stores the output into r4 and, since we're going into the inner window, sets vwf_skip to false asr r4,r0,0x10 ldr r0,[r5,#0x20] mov r2,#0 strb r2,[r0,#3] pop {r0} @@end: pop {r0} add r0,#0x36 bx r0 //Jump to the next useful piece of code //============================================================================== //Makes it sure the inner PSI window of the PSI status menu prints the descriptions only once //It also sets things up to make it so the target window is only printed once badb0_status_inner_window: push {lr} ldrh r1,[r0,#0x36] //Stores the cursor's Y of the window push {r1} ldrh r1,[r0,#0x34] //Stores the cursor's X of the window push {r1} bl PSITargetWindowInput //Input management, target printing and header printing function. Now the function takes the cursor's Y and X as arguments too in the stack lsl r0,r0,#0x10 lsr r4,r0,#0x10 //Properly stores the output into r4 ldr r1,=#0x8B2A9B0 //Clobbered code ldr r0,[r5,#0x1C] add r0,#0x42 ldrb r0,[r0,#0] lsl r0,r0,#4 add r1,#0xC add r0,r0,r1 ldr r2,[r0,#0] ldr r0,[r5,#0x1C] ldrh r1,[r0,#0x34] ldr r3,[sp,#0] cmp r1,r3 //Checks if the cursor's X changed bne @@ChangedPosition ldr r3,[sp,#4] //If it did not, checks if the cursor's Y changed ldrh r1,[r0,#0x36] cmp r1,r3 beq @@print @@ChangedPosition: ldr r0,[r5,0x28] //Sets wvf_skip to false mov r1,#0 strb r1,[r0,#3] @@print: //Description printing ldr r0,[r5,0x28] ldrb r1,[r0,#3] mov r3,#1 and r1,r3 cmp r1,#0 //Checks if vwf_skip is false bne @@end mov r1,r2 //If it is, prints the PSI description mov r2,0 bl initWindow_buffer //Initializes the PSI description window ldr r0,[r5,0x28] bl print_window_with_buffer //Prints the PSI description window bl store_pixels_overworld ldr r0,[r5,0x28] ldrb r1,[r0,#3] //Sets vwf_skip to true mov r3,#1 orr r1,r3 strb r1,[r0,#3] @@end: ldr r0,=#0xFFFF //Are we exiting this window? cmp r4,r0 bne @@ending //If we are, set vwf_skip to false for both the description window and the target window ldr r0,[r5,0x28] //Description window mov r2,#0 strb r2,[r0,#3] ldr r0,[r5,0x24] //Target window strb r2,[r0,#3] @@ending: pop {r0} pop {r0} pop {r0} add r0,#0x18 bx r0 //Jump to the next useful piece of code .pool //============================================================================== //Stores the buffer for the Stored Goods window when switching the page c6ac0_store_buffer_stored_goods_switch_page: mov r0,#8 str r0,[sp,#0x2C] push {lr} bl store_pixels_overworld pop {pc} //============================================================================== //Calls print_window_with_buffer and then stores the buffer baf9c_print_window_store_buffer: push {lr} bl print_window_with_buffer bl store_pixels_overworld pop {pc} //============================================================================== //Calls print_window_with_buffer and then stores the buffer if need be baf9c_print_window_store_buffer_needed: push {lr} add sp,#-4 mov r1,#0x44 add r1,r1,r0 ldrb r1,[r1,#0] str r1,[sp,#0] bl print_window_with_buffer ldr r1,[sp,#0] cmp r1,#0 beq @@end bl store_pixels_overworld_use @@end: add sp,#4 pop {pc} //============================================================================== //Calls print_window_with_buffer and then stores the buffer if need be - Special edition which does only a few tiles b98b8_print_window_store_buffer_needed: push {lr} add sp,#-4 mov r1,#0x44 add r1,r1,r0 ldrb r1,[r1,#0] str r1,[sp,#0] bl print_window_with_buffer ldr r1,[sp,#0] cmp r1,#0 beq @@end mov r0,#4 bl store_pixels_overworld_buffer_totalTiles @@end: add sp,#4 pop {pc} //============================================================================== //Calls print_window_with_buffer and then stores the buffer baf9c_print_window_store_buffer_top: push {lr} bl print_window_with_buffer bl store_pixels_overworld_top pop {pc} //============================================================================== //Calls printstr_hlight_buffer and then stores the buffer c5f80_printstr_hlight_buffer_store_buffer: push {r4,lr} ldr r4,[sp,#8] add sp,#-4 str r4,[sp,#0] bl printstr_hlight_buffer bl store_pixels_overworld add sp,#4 pop {r4,pc} //============================================================================== //Fixes issue with sounds when going from the PSI window to the inner PSI window b8d40_psi_going_inner_window: push {lr} bl PSITargetWindowInput bl store_pixels_overworld pop {pc} //============================================================================== //It sets things up to make it so the target window is only printed once b8db4_psi_inner_window: push {r4,lr} mov r4,r0 ldrb r1,[r4,#3] push {r1} ldrh r1,[r4,#0x36] //Stores the cursor's Y of the window push {r1} ldrh r1,[r4,#0x34] //Stores the cursor's X of the window push {r1} bl PSITargetWindowInput //Input management, target printing and header printing function. Now the function takes the cursor's Y and X as arguments too in the stack pop {r2} ldrh r1,[r4,#0x34] //Stores the cursor's X of the window cmp r1,r2 bne @@store_buffer_first pop {r2} ldrh r1,[r4,#0x36] //Stores the cursor's Y of the window cmp r1,r2 bne @@store_buffer_second pop {r2} mov r1,#1 and r1,r2 cmp r1,#1 beq @@continue b @@store_buffer @@store_buffer_first: pop {r2} @@store_buffer_second: pop {r2} @@store_buffer: cmp r0,#0 bne @@continue bl store_pixels_overworld @@continue: cmp r0,#0 beq @@ending mov r2,#0 //Sets vwf_skip to false since the window is changed strb r2,[r4,#3] @@ending: pop {r4,pc} .pool //============================================================================== //It sets things up to make it so the target window is only printed once e0854_psi_inner_window_battle: push {lr} ldrb r1,[r0,#3] push {r1} ldrh r1,[r0,#0x36] //Stores the cursor's Y of the window push {r1} ldrh r1,[r0,#0x34] //Stores the cursor's X of the window push {r1} bl PSITargetWindowInput //Input management, target printing and header printing function. Now the function takes the cursor's Y and X as arguments too in the stack pop {r2} ldr r3,[r4,0x24] //Target window ldrh r1,[r3,#0x34] //Stores the cursor's X of the window cmp r1,r2 bne @@store_buffer_first pop {r2} ldrh r1,[r3,#0x36] //Stores the cursor's Y of the window cmp r1,r2 bne @@store_buffer_second pop {r2} mov r1,#1 and r1,r2 cmp r1,#1 beq @@continue b @@store_buffer @@store_buffer_first: pop {r2} @@store_buffer_second: pop {r2} @@store_buffer: cmp r0,#0 bne @@continue bl store_pixels_overworld_psi_window @@continue: cmp r0,#0 beq @@ending mov r2,#0 //Sets vwf_skip to false since the window is change ldr r1,[r5,0x24] //Target window strb r2,[r1,#3] @@ending: pop {pc} .pool //============================================================================== _4092_print_window: push {lr} push {r0-r4} bl print_windows pop {r0-r4} bl 0x800341C pop {pc} //============================================================================== _4294_print_window_store: push {lr} push {r0-r4} ldr r2,[sp,#0x20] bl print_windows bl store_pixels pop {r0-r4} mov r2,#0 mov r3,#0 pop {pc} //============================================================================== c7ea2_shop_clear: push {lr} bl m2_store_to_win_memory ldr r0,=#0x3005230 //Window generic address ldr r0,[r0,#8] //Load the dialogue window bl clear_window pop {pc} //============================================================================== //X cursor for the Options submenu position _position_X_Options: push {lr} cmp r0,#1 bne @@next1 mov r0,#5 b @@end @@next1: cmp r0,#6 bne @@next2 mov r0,#11 b @@end @@next2: cmp r0,#11 bne @@next3 mov r0,#15 b @@end @@next3: mov r0,#20 @@end: pop {pc} //============================================================================== //Sets X for highlighting the Options submenu in the File Select window _40e2_cursor_X: push {lr} mov r0,r1 bl _position_X_Options sub r1,r0,#3 mov r0,#2 pop {pc} //============================================================================== //Sets X cursor for the Options submenu in the File Select window _41d4_cursor_X: push {lr} bl _position_X_Options lsl r0,r0,#3 pop {pc} //============================================================================== //Makes sure Paula's window is loaded properly since the name length has been changed to 5 and the game previously used the 4 to load the window too _4f7c_window_selector: push {lr} mov r0,#4 mov r10,r0 ldr r1,=#0x82B7FF8 pop {pc} .pool //============================================================================== //Prints and stores the PSI window in the PSI menu baec6_psi_window_print_buffer: push {lr} bl psiWindow_buffer bl store_pixels_overworld pop {pc} //============================================================================== //Loads the buffer in if entering another window from the main window b7d9a_main_window_manage_input: push {lr} bl 0x80BE53C cmp r0,#0 beq @@end cmp r0,#0 blt @@end bl load_pixels_overworld push {r0-r2} swi #5 pop {r0-r2} @@end: pop {pc} //============================================================================== //Prints the target window if and only if the cursor's position changed in this input management function c495a_status_target: push {r4,lr} ldr r1,=#0x3005230 ldr r4,[r1,#0x24] //Loads the target window ldr r3,[sp,#0x30] ldrh r2,[r5,#0x34] cmp r2,r3 //Has the cursor's X changed? bne @@Updated ldr r3,[sp,#0x34] //If not, has the cursor's Y changed? ldrh r2,[r5,#0x36] cmp r2,r3 beq @@printing @@Updated: mov r2,#0 //If the cursor's position changed, set vwf_skip to false strb r2,[r4,#3] @@printing: ldrb r1,[r4,#0x3] mov r2,#1 and r2,r1 cmp r2,#0 //Checks if vwf_skip is false bne @@end ldrb r1,[r4,#0x3] //If it is, sets vwf_skip to true, clears the window and updates the target window mov r2,#1 orr r2,r1 strb r2,[r4,#0x3] push {r0} bl check_overworld_buffer ldr r1,=#buffer_subtractor sub r1,r0,r1 mov r0,r4 pop {r4} bl clear_window_buffer mov r0,r4 bl psiTargetWindow_buffer @@end: pop {r4,pc} //============================================================================== //Makes sure m2_initwindow properly sets vwf_skip to false be45a_set_proper_wvf_skip: push {lr} mov r3,r0 mov r0,#0 strb r0,[r3,#3] pop {pc} //============================================================================== //Makes sure this initialization routine properly sets vwf_skip to false. This fixes an issue where due to a background the Goods window in battle might have not be printed be4ca_set_proper_wvf_skip_goods_battle_window: push {lr} mov r4,#0 strb r4,[r0,#3] mov r12,r0 //Clobbered code mov r4,r1 pop {pc} //============================================================================== //Makes sure the window type is set to 0 for the inner PSI overworld menu window. Fixes an issue in M2GBA. b8c2a_set_proper_wvf_skip_and_window_type: push {lr} strb r1,[r0,#1] bl initWindow_buffer pop {pc} //============================================================================== //Fix the random garbage issue for the alphabet for good _2322_setup_windowing: push {lr} bl 0x8012460 //Default code which sets up the names by copying memory which can be random push {r0-r1} ldr r0,=#m2_cstm_last_printed //Set the window flag to 0 so no issue can happen mov r1,#0 strb r1,[r0,#0] pop {r0-r1} pop {pc} .pool //============================================================================== //Loads the vram into the buffer, it's called each time there is only the main file_select window active (a good way to set the whole thing up) _38c0_load_pixels: push {lr} ldr r3,=#0x40000B0 //DMA transfer 0 ldr r0,=#0x6008000 //Source str r0,[r3] ldr r0,=#0x2015000 //Target str r0,[r3,#4] ldr r0,=#0x84001200 //Store 0x4800 bytes str r0,[r3,#8] ldr r0,[r3,#8] ldr r3,[r5,#0] mov r0,#0x84 lsl r0,r0,#2 pop {pc} //============================================================================== //Stores the buffer into the vram. This avoids screen tearing. store_pixels: push {r0-r1,lr} ldr r1,=#0x40000B0 //DMA transfer 0 ldr r0,=#0x2015000 //Source str r0,[r1] ldr r0,=#0x6008000 //Target str r0,[r1,#4] ldr r0,=#0x94001200 //Store 0x4800 bytes str r0,[r1,#8] ldr r0,[r1,#8] pop {r0-r1,pc} //============================================================================== //Specific routine which calls store_pixels for the main file_select window _38f8_store_pixels: push {lr} bl store_pixels ldr r1,[r5,#0] mov r3,#0xC pop {pc} //============================================================================== //Generic routine which prints a window and then stores the pixels of all the other windows. It's called once, after all the other windows (which will use _4092_print_window) have printed. _4092_print_window_store: push {lr} bl _4092_print_window bl store_pixels pop {pc} //============================================================================== //Routine for the top part of the screen only. Used in order to make printing the names less CPU intensive when naming the characters _4edc_print_window_store: push {lr} bl _4092_print_window push {r0-r1} ldr r1,=#0x40000B0 //DMA transfer 0 ldr r0,=#0x2015000 //Source str r0,[r1] ldr r0,=#0x6008000 //Target str r0,[r1,#4] ldr r0,=#0x94000200 //Store 0x800 bytes str r0,[r1,#8] ldr r0,[r1,#8] pop {r0-r1} pop {pc} //============================================================================== //Loads and prints the text lines for the file select main window _setup_file_strings: push {r4-r5,lr} add sp,#-8 ldr r5,=#0x3000024 ldr r2,[r5,#0] ldr r4,[r2,#4] str r4,[sp,#4] //Save this here mov r4,#0 str r4,[r2,#4] mov r0,#0 bl 0x8002170 //Routine which loads the save corresponding to r0 mov r0,#1 bl 0x8002170 mov r0,#2 bl 0x8002170 ldr r3,[r5,#0] mov r0,#0x84 lsl r0,r0,#2 add r3,r3,r0 str r4,[sp,#0] mov r0,#2 mov r1,#1 mov r2,#0x40 bl wrapper_file_string_selection ldr r3,[r5,#0] ldr r0,=#0x454 add r3,r3,r0 str r4,[sp,#0] mov r0,#2 mov r1,#3 mov r2,#0x40 bl wrapper_file_string_selection ldr r3,[r5,#0] mov r0,#0xD3 lsl r0,r0,#3 add r3,r3,r0 str r4,[sp,#0] mov r0,#2 mov r1,#5 mov r2,#0x40 bl wrapper_file_string_selection mov r0,#1 mov r1,#0 mov r2,#0 bl 0x800341C ldr r2,[r5,#0] ldr r4,[sp,#4] str r4,[r2,#4] //Restore this add sp,#8 pop {r4-r5,pc} .pool //============================================================================== //Prints a digit to the dialogue window d37ec_print_number: push {lr} bl decode_character mov r1,r5 bl print_character_to_window pop {pc} //============================================================================== //Makes it sure the outer equip menu prints the window only when needed baf60_outer_equip_setup: push {lr} ldr r1,=#m2_active_window_pc ldrb r1,[r1,#0] push {r1} //Stores the active_window_pc bl equipReadInput //Input management function pop {r1} cmp r0,#0 //Has an action happened? (Are we entering/exiting the menu?) beq @@check_character_change ldr r1,[r6,#0x18] //Main equip window - If it has, then set vwf_skip to false for both the equipment numbers window and the main equipment window mov r2,#0 strb r2,[r1,#3] ldr r1,[r6,#0x14] //Offense and Defense window strb r2,[r1,#3] b @@end @@check_character_change: ldr r2,=#m2_active_window_pc ldrb r2,[r2,#0] //Has the character changed? cmp r2,r1 beq @@end ldr r1,[r6,#0x14] //Offense and Defense window - If it has, then set vwf_skip to false for the equipment numbers window mov r2,#0 strb r2,[r1,#3] @@end: pop {pc} //============================================================================== //Prints the outer equip window only when needed - makes it so 0x80C4EB0 takes the previous m2_active_window_pc as a function parameter c518e_outer_equip: push {lr} ldr r1,[sp,#0x1C] lsl r1,r1,#0x18 lsr r1,r1,#0x18 ldr r2,=#m2_active_window_pc ldrb r2,[r2,#0] cmp r1,r2 //Has the active_window_pc changed? beq @@printing mov r2,#0 //If it has, then reprint the window strb r2,[r0,#3] @@printing: ldrb r1,[r0,#3] mov r2,#1 and r2,r1 cmp r2,#1 beq @@skip //Check if vwf_skip is false mov r2,#1 //If it is, print and set it to true orr r2,r1 strb r2,[r0,#3] bl 0x80C4B2C //Prints the equip menu @@skip: pop {pc} //============================================================================== //Prints the numbers in the offense/defense window for the outer equip window only when needed bafc8_outer_equip_attack_defense: push {lr} ldr r1,[r6,#0x14] //Offense and Defense window ldrb r2,[r1,#3] mov r3,#1 and r3,r2 cmp r3,#1 //Is vwf_skip false? beq @@skip cmp r5,#0 //If it is, then print, but only if no action was performed bne @@skip mov r3,#1 //Set vwf_skip to true and continue as usual orr r3,r2 strb r3,[r1,#3] lsl r0,r0,#0x18 //Clobbered code lsr r0,r0,#0x18 pop {pc} @@skip: mov r5,r7 add r5,#0x12 //Setup r5 just like the code skipped does pop {r0} mov r1,#0xF1 lsl r1,r1,#1 add r0,r0,r1 //Jump to 0x80BB1AE bx r0 .pool //============================================================================== //Prints defense number and then sotres the buffer bb1aa_printnumberequip_store: push {r4,lr} mov r4,r3 mov r3,#0 push {r3} mov r3,r4 bl printNumberEquip bl store_pixels_overworld pop {r3} pop {r4,pc} //============================================================================== //Prints blankstr in the buffer bb21c_print_blankstr_buffer: push {lr} push {r0-r2} bl check_overworld_buffer ldr r3,=#buffer_subtractor sub r3,r0,r3 pop {r0-r2} bl print_blankstr_buffer pop {pc} //============================================================================== //Prints blankstr in the buffer and stores it bb21c_print_blankstr_buffer_store: push {lr} push {r0-r2} bl check_overworld_buffer ldr r3,=#buffer_subtractor sub r3,r0,r3 pop {r0-r2} bl print_blankstr_buffer bl store_pixels_overworld pop {pc} //============================================================================== //Set things up so the numbers for Offense and Defense for the innermost equipment window is only printed when needed bb990_inner_equip_attack_defense_setup: push {lr} ldr r1,=#0x3005200 ldr r1,[r1,#0xC] //Window's item list mov r2,#0x36 ldsh r2,[r0,r2] //Window's Y cursor add r1,r1,r2 ldrb r1,[r1,#0] //Selected item push {r1} bl equippableReadInput //Input management function - returns the currently selected item pop {r1} cmp r1,r0 //Has the currently selected item changed? bne @@refresh ldr r1,=#0x3005230 //If not, check if A has been pressed ldr r1,[r1,#0x10] ldr r2,=#0xFFFF ldrh r3,[r1,#0x32] //If A has been pressed this becomes 0xFFFF cmp r2,r3 bne @@end @@refresh: ldr r1,=#0x3005230 //Set wvf_skip to false ldr r1,[r1,#0x14] mov r2,#0 strb r2,[r1,#3] @@end: pop {pc} //============================================================================== //Prints the numbers for Offense and Defense for the innermost window only if needed - Valid weapons bb6b2_inner_equip_attack_defense_weapon: push {lr} mov r1,r9 ldr r1,[r1,#0x14] ldrb r0,[r1,#3] mov r2,#1 and r2,r0 cmp r2,#1 //Is vwf_skip false? beq @@skip mov r2,#1 //If it is, set vwf_skip to true, clear the numbers' space and proceed normally orr r2,r0 strb r2,[r1,#3] bl clear_offense_defense_inner_equip mov r1,r8 mov r2,#0 pop {pc} @@skip: mov r5,r7 //Otherwise skip some code add r5,#0x12 mov r4,#0 pop {r0} add r0,#0x62 //Go to 0x80BB718 bx r0 //============================================================================== //Prints the numbers for Offense and Defense for the innermost window only if needed - None in weapons bb64e_inner_equip_attack_defense_none_weapon: push {lr} mov r1,r9 ldr r1,[r1,#0x14] ldrb r0,[r1,#3] mov r2,#1 and r2,r0 cmp r2,#1 //Is vwf_skip false? beq @@skip mov r2,#1 //If it is, set vwf_skip to true, clear the numbers' space and proceed normally orr r2,r0 strb r2,[r1,#3] bl clear_offense_defense_inner_equip mov r3,r8 //This is where this differs from the routine above mov r1,#0 pop {pc} @@skip: mov r5,r7 //Otherwise skip some code add r5,#0x12 mov r4,#0 pop {r0} add r0,#0xC6 //Go to 0x80BB718 - The routine differs here too bx r0 //============================================================================== //Prints the numbers for Offense and Defense for the innermost window only if needed - Defensive equipment bbe7c_inner_equip_attack_defense_defensive_equipment: push {lr} ldr r1,=#0x3005230 ldr r1,[r1,#0x14] ldrb r0,[r1,#3] mov r2,#1 and r2,r0 cmp r2,#1 //Is vwf_skip false? beq @@skip mov r2,#1 //If it is, set vwf_skip to true, clear the numbers' space and proceed normally orr r2,r0 strb r2,[r1,#3] bl clear_offense_defense_inner_equip mov r4,#0 strb r4,[r7,#0x15] pop {pc} @@skip: pop {r0} //Otherwise go to the routine's end ldr r0,=#0x80BBEC7 //End of routine bx r0 //============================================================================== //Clears the rightmost part of the Offense/Defense window for the innermost equipment menu clear_offense_defense_inner_equip: push {lr} mov r0,0xD mov r1,0xB mov r2,0x3 bl bb21c_print_blankstr_buffer mov r0,0xD mov r1,0xD mov r2,0x3 bl bb21c_print_blankstr_buffer pop {pc} .pool //============================================================================== //Fixes issue with file select menu not printing after going back to it from the alphabet _53f6_fix_out_of_description: push {lr} bl 0x800341C bl _setup_file_strings mov r0,#3 mov r1,#0xA mov r2,#1 bl _4092_print_window //Prints the text speed menu mov r0,#0xF mov r1,#4 mov r2,#2 bl _4092_print_window //Prints the text flavour menu bl store_pixels pop {pc} //============================================================================== //Fixes issue with the option submenu (if it's there) and the file select menu after going back to the text speed window from the text flavour window _3dce_fix_out_of_text_flavour: push {lr} bl 0x8003F44 mov r0,#0 ldsh r0,[r5,r0] //Checks whether or not to print the option menu cmp r0,#0 blt @@end mov r0,#4 mov r1,#7 mov r2,#0xE bl _4092_print_window //Prints the option menu @@end: bl _setup_file_strings bl store_pixels pop {pc} //============================================================================== //Fixes text reprinting when pressing up or down in the text flavour window _3e86_special_setup: push {lr} push {r0-r2} ldr r0,=#m2_cstm_last_printed ldrb r2,[r0,#0] mov r1,#0x80 orr r1,r2 strb r1,[r0,#0] pop {r0-r2} bl 0x8003F44 pop {pc} //============================================================================== //Highlights all of the file string with the proper palette _highlight_file: push {lr} mov r0,#2 ldr r1,=#0x3000024 //Load in r1 the y co-ordinate ldr r1,[r1,#0] ldr r1,[r1,#8] lsl r1,r1,#1 add r1,#1 mov r2,#0 mov r3,r4 bl setPaletteOnFile pop {pc} .pool //============================================================================== //File highlighting for the up-down arrows in the text flavour window _3f78_highlight_file: push {lr} bl _highlight_file mov r0,#4 //Clobbered code ldsh r2,[r4,r0] pop {pc} //============================================================================== //File highlighting for when a file is selected _3a04_highlight_file: push {lr} bl _highlight_file mov r0,#1 //Clobbered code mov r1,#0 pop {pc} //============================================================================== //A Press c75b4_overworld_naming_top_printing: push {lr} ldr r0,=#m2_player1 mov r1,r2 str r3,[sp,#0x24] bl player_name_printing_registration bl store_pixels_overworld_player_naming pop {pc} //============================================================================== //B Press c780e_overworld_naming_top_printing: push {lr} ldr r1,=#0x3005230 ldr r1,[r1,#0x0C] ldr r0,=#m2_player1 bl player_name_printing_registration bl store_pixels_overworld_player_naming pop {pc} //============================================================================== //Backspace c74cc_overworld_naming_top_printing: push {lr} ldr r1,=#0x3005230 ldr r1,[r1,#0x0C] ldr r0,=#m2_player1 bl player_name_printing_registration bl store_pixels_overworld_player_naming pop {pc} //============================================================================== //Re-enter the menu c6cc6_overworld_naming_top_printing: push {lr} mov r2,r0 mov r0,r1 mov r1,r2 bl player_name_printing_registration str r0,[sp,#0x24] mov r9,r0 pop {pc} //============================================================================== //Cursor movement of overworld alphabet c6f24_overworld_alphabet_movement: push {lr} mov r0,r7 ldr r1,=#0x3002500 add r1,#0x18 bl setupCursorMovement_Overworld_Alphabet mov r9,r0 ldr r2,=#0x3002500 pop {pc} .pool //============================================================================== //Generic alphabet printing routine. Uses the default code. r0 is the alphabet and r1 is the alphabet string to print if need be print_alphabet_if_needed: push {lr} ldr r2,[sp,#0x2C] cmp r2,r0 //Is the alphabet loaded different from the one we're going in? beq @@end str r0,[sp,#0x2C] //If it is, print the new alphabet ldr r5,=#0x3005230 //Default printing code ldr r4,[r5,#0x10] //Window mov r2,r1 //String to load ldr r0,=#0x8B17EE4 //String ldr r1,=#0x8B17424 bl m2_strlookup mov r1,r0 mov r0,r4 mov r2,#0 bl initWindow_buffer ldr r0,[r5,#0x10] bl print_alphabet_buffer //Print alphabet in buffer bl store_pixels_overworld @@end: pop {pc} //============================================================================== //Prints the first alphabet and stores the buffer c6d78_print_slphabet_store: push {lr} bl print_alphabet_buffer bl store_pixels_overworld pop {pc} //============================================================================== //Loads stuff up for the small alphabet and calls print_alphabet_if_needed c73c0_small_overworld_alphabet: push {lr} mov r0,#1 //Alphabet 1, small mov r1,#0x62 //String 0x62, small alphabet bl print_alphabet_if_needed pop {pc} //============================================================================== //Loads stuff up for the CAPITAL alphabet and calls print_alphabet_if_needed c7394_CAPITAL_overworld_alphabet: push {lr} mov r0,#0 //Alphabet 0, CAPITAL mov r1,#0x63 //String 0x63, CAPITAL alphabet bl print_alphabet_if_needed pop {pc} //============================================================================== //Loads the proper letter table based on the loaded alphabet c7578_load_letters: push {lr} ldr r2,=#m2_overworld_alphabet_table //Letter table ldr r0,[sp,#0x28] cmp r0,#1 bne @@generic_end mov r0,#0x90 //If this is the small alphabet, go to its alphabet add r2,r2,r0 @@generic_end: mov r3,#0x36 //Clobbered code pop {pc} .pool //============================================================================== //Prints the cash window and then stores the buffer to vram b8894_printCashWindowAndStore: push {lr} bl printCashWindow bl store_pixels_overworld pop {pc} //============================================================================== //UNUSED bac46_statusWindowNumbersStore: push {lr} bl statusWindowNumbers bl store_pixels_overworld pop {pc} //============================================================================== //Prints the status text and numbers in the buffer, then loads it in vram b8320_statusWindowTextStore: push {lr} push {r0} bl statusWindowText pop {r0} mov r1,#0 bl statusNumbersPrint bl store_pixels_overworld pop {pc} //============================================================================== //Routine which checks if all the teleport locations have been printed. If they do, it stores the buffer c5f04_store_if_done: push {lr} lsr r5,r0,#0x10 ldr r2,[sp,#0x18] cmp r0,r2 blt @@end bl store_pixels_overworld @@end: pop {pc} //============================================================================== //Allocs the printing buffer's pointer. It needs 4 bytes _05b80_alloc_buffer_pointer: push {lr} mov r0,#4 bl 0x8005B9C ldr r0,=#0x3002A4C str r4,[r0,#0] pop {pc} //============================================================================== //Loads the vram into the buffer, it's called each time there is only the main file_select window active (a good way to set the whole thing up) load_pixels_overworld: push {r0-r3,lr} bl load_pixels_overworld_buffer pop {r0-r3,pc} //============================================================================== //Stores the buffer into the vram. This avoids screen tearing. store_pixels_overworld: push {r0-r3,lr} swi #5 //The improved performances allow using a VBlank before the storage in order to prevent screen tearing effectively mov r0,#0x10 bl store_pixels_overworld_buffer pop {r0-r3,pc} //============================================================================== //Stores the buffer into the vram. This avoids screen tearing. store_pixels_overworld_options: push {r0-r3,lr} swi #5 //The improved performances allow using a VBlank before the storage in order to prevent screen tearing effectively mov r0,#6 bl store_pixels_overworld_buffer pop {r0-r3,pc} //============================================================================== //Stores the buffer into the vram. This avoids screen tearing. store_pixels_overworld_use: push {r0-r3,lr} swi #5 //The improved performances allow using a VBlank before the storage in order to prevent screen tearing effectively mov r0,#8 bl store_pixels_overworld_buffer pop {r0-r3,pc} //============================================================================== //Stores the buffer into the vram. This avoids screen tearing. store_pixels_overworld_top: push {r0-r3,lr} swi #5 //The improved performances allow using a VBlank before the storage in order to prevent screen tearing effectively mov r0,#0x2 bl store_pixels_overworld_buffer pop {r0-r3,pc} //============================================================================== //Stores the buffer into the vram. This avoids screen tearing. store_pixels_overworld_player_naming: push {r0-r3,lr} swi #5 //The improved performances allow using a VBlank before the storage in order to prevent screen tearing effectively mov r0,#0x4 bl store_pixels_overworld_buffer pop {r0-r3,pc} //============================================================================== //Stores the buffer into the vram. This avoids screen tearing. store_pixels_overworld_psi_window: push {r0-r3,lr} swi #5 //The improved performances allow using a VBlank before the storage in order to prevent screen tearing effectively mov r0,#0xA bl store_pixels_overworld_buffer pop {r0-r3,pc} //============================================================================== //Change tile only if need be (it's different) - foreground call change_palette_needed_foreground: push {lr} mov r3,#0 bl change_palette_needed pop {pc} //============================================================================== //Change tile only if need be (it's different) - background call change_palette_needed_background: push {lr} mov r3,#1 bl change_palette_needed pop {pc} //============================================================================== //Change tile only if need be (it's different), r3 contains whether the EB cart is in the background or not change_palette_needed: push {lr} ldrh r2,[r1,#0] ldrh r1,[r0,#0] cmp r1,r2 beq @@end mov r0,r3 bl eb_cartridge_palette_change @@end: pop {pc} //============================================================================== //Prevents changing the palette based on the flavour for the cast roll sequence prevent_cast_changed_palettes: push {lr} ldr r1,=#m2_cast_roll_pointers cmp r0,r1 beq @@alternate_end bl 0x8010028 pop {pc} @@alternate_end: bl 0x8010028 ldr r1,=#0x40000D4 ldr r0,=#0x2010000 str r0,[r1,#0] ldr r3,=#0x3001B30 str r3,[r1,#4] ldr r0,=#0x84000080 str r0,[r1,#8] ldr r0,[r1,#8] pop {r0} ldr r0,=#0x8010501 //Go to the end of the routine bx r0 //============================================================================== //Creates a new event that updates the "THE END..." screen to the second frame extra_event_end_question_mark: push {lr} add r0,r0,r1 asr r0,r0,#0x10 cmp r0,#0x48 bne @@end push {r0} ldr r0,=#m2_end_frame1 ldr r1,=#0x6001000 mov r2,#0xA0 lsl r2,r2,#1 swi #0xC pop {r0} @@end: pop {pc} //============================================================================== //Prints the sick tiles and then the names sick_name: push {lr} push {r0-r3} bl 0x80CAC70 //Purple tiles mov r4,r0 pop {r0-r3} bl 0x80CABF8 //Name mov r0,r4 pop {pc} //============================================================================== //Prints the dead tiles and then the names dead_name: push {lr} push {r0-r3} bl 0x80CACE8 //Red tiles mov r4,r0 pop {r0-r3} bl 0x80CABF8 //Name mov r0,r4 pop {pc} //============================================================================== //Prints the alive tiles and then the names - right after the normal status is restored d6dac_alive_name: push {r7,lr} mov r7,r5 bl alive_name pop {r7,pc} //============================================================================== //Prints the alive tiles and then the names alive_name: push {r4,lr} push {r5} mov r5,r2 push {r0-r3} mov r0,r7 mov r1,#0x4D mov r2,r5 mov r3,#0x12 bl 0x80CAD60 //The 1st alive tile mov r0,r7 mov r1,#0x4D mov r2,#1 add r2,r2,r5 mov r3,#0x12 bl 0x80CAD60 //The 2nd alive tile mov r0,r7 mov r1,#0x4D mov r2,#2 add r2,r2,r5 mov r3,#0x12 bl 0x80CAD60 //The 3rd alive tile mov r0,r7 mov r1,#0x4D mov r2,#3 add r2,r2,r5 mov r3,#0x12 bl 0x80CAD60 //The 4th alive tile mov r0,r7 mov r1,#0x4D mov r2,#4 add r2,r2,r5 mov r3,#0x12 bl 0x80CAD60 //The 5th alive tile mov r4,#5 pop {r0-r3} pop {r5} bl 0x80CABF8 //Name mov r0,r4 pop {r4,pc} .pool //============================================================================== // Returns in r0 the result of m2_div, and in r1 the result of m2_remainder __aeabi_uidiv: __aeabi_uidivmod: push {r4,lr} push {r0,r1} bl m2_remainder mov r4,r0 pop {r0,r1} bl m2_div mov r1,r4 pop {r4,pc} .pool
25.363264
220
0.541163
5ee5c4dcf3f5f0afbec8f6f54030beb1216f162b
457
asm
Assembly
programs/oeis/138/A138150.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/138/A138150.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/138/A138150.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A138150: n-th run has length n-th prime, with digits 0 and 1 only, starting with 0. ; 0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 mov $1,1 mov $2,$0 lpb $2 sub $2,2 sub $3,1 mov $6,$0 lpb $6 add $2,$4 trn $3,2 mov $1,$3 sub $5,$3 mov $3,6 sub $6,$6 lpe add $1,$4 sub $2,1 mov $4,$5 lpe gcd $1,2 sub $1,1
19.041667
155
0.509847
e9b264d7b04ddc66278cb59d2227ba7e1d4f9edc
3,840
asm
Assembly
sim/func_level/bin/irq_div.asm
cpulabs/mist1032isa
ae90e1afda5aed4690aeff20dcd258ab3c23dba7
[ "BSD-2-Clause" ]
3
2017-02-09T13:05:39.000Z
2021-05-13T23:34:34.000Z
sim/func_level/bin/irq_div.asm
cpulabs/mist1032isa
ae90e1afda5aed4690aeff20dcd258ab3c23dba7
[ "BSD-2-Clause" ]
null
null
null
sim/func_level/bin/irq_div.asm
cpulabs/mist1032isa
ae90e1afda5aed4690aeff20dcd258ab3c23dba7
[ "BSD-2-Clause" ]
1
2022-01-16T15:32:30.000Z
2022-01-16T15:32:30.000Z
./out/irq_div.out: file format elf32-mist32 Disassembly of section .text: 00000000 <_start>: 0: 0d 40 00 00 wl16 r0,0x0 4: 0d 60 00 0f wh16 r0,0xf 8: 1c 00 00 00 srspw r0 c: 14 30 00 1a br 74 <target>,#al 00000010 <mem_print>: 10: 0d 40 02 08 wl16 r16,0x8 14: 0d 60 02 02 wh16 r16,0x2 18: 10 a0 00 10 st32 r0,r16 1c: 14 40 03 e0 b rret,#al 00000020 <error>: 20: 0d 40 03 20 wl16 r25,0x0 24: 0d 60 03 22 wh16 r25,0x2 28: 0e c0 03 40 lil r26,0 2c: 10 a0 03 59 st32 r26,r25 30: 0d 40 03 30 wl16 r25,0x10 34: 0d 60 03 22 wh16 r25,0x2 38: 10 a0 03 79 st32 r27,r25 3c: 0d 40 03 2c wl16 r25,0xc 40: 0d 60 03 22 wh16 r25,0x2 44: 10 a0 03 99 st32 r28,r25 48: 0d 40 03 34 wl16 r25,0x14 4c: 0d 60 03 22 wh16 r25,0x2 50: 10 a0 03 b9 st32 rglobl,r25 54: 0d 40 03 38 wl16 r25,0x18 58: 0d 60 03 22 wh16 r25,0x2 5c: 10 a0 03 d9 st32 rbase,r25 00000060 <finish>: 60: 0d 40 03 24 wl16 r25,0x4 64: 0d 60 03 22 wh16 r25,0x2 68: 0e c0 03 41 lil r26,1 6c: 10 a0 03 59 st32 r26,r25 70: 14 30 00 00 br 70 <finish+0x10>,#al 00000074 <target>: 74: 0d c0 00 00 clr r0 78: 0d c0 00 20 clr r1 0000007c <clr_idt_lp>: 7c: 0d 40 02 00 wl16 r16,0x0 80: 0d 60 02 04 wh16 r16,0x4 84: 00 00 02 01 add r16,r1 88: 0d 40 02 20 wl16 r17,0x0 8c: 0d 60 02 20 wh16 r17,0x0 90: 0d 40 02 40 wl16 r18,0x0 94: 0d 60 02 40 wh16 r18,0x0 98: 10 a0 02 30 st32 r17,r16 9c: 00 10 02 04 add r16,4 a0: 10 a0 02 50 st32 r18,r16 a4: 00 10 00 28 add r1,8 a8: 02 00 00 00 inc r0,r0 ac: 00 d0 10 00 cmp r0,128 b0: 14 3b ff f3 br 7c <clr_idt_lp>,#leu b4: 0d c0 00 00 clr r0 b8: 0d 40 30 18 wl16 r0,0x198 bc: 0d 40 02 00 wl16 r16,0x0 c0: 0d 60 02 04 wh16 r16,0x4 c4: 00 00 02 00 add r16,r0 c8: 0d 40 02 23 wl16 r17,0x3 cc: 0d 60 02 20 wh16 r17,0x0 d0: 0d 40 22 48 wl16 r18,0x108 d4: 0d 60 02 40 wh16 r18,0x0 d8: 10 a0 02 30 st32 r17,r16 dc: 00 10 02 04 add r16,4 e0: 10 a0 02 50 st32 r18,r16 e4: 0d 40 00 00 wl16 r0,0x0 e8: 0d 60 00 04 wh16 r0,0x4 ec: 1e 40 00 00 sridtw r0 f0: 24 40 00 00 idts f4: 1c b0 00 01 srieiw 0x1 f8: 0d c0 00 00 clr r0 fc: 0d c0 00 20 clr r1 100: 00 e0 00 01 div r0,r1 104: 14 30 00 00 br 104 <clr_idt_lp+0x88>,#al 00000108 <test0>: 108: 20 00 00 00 nop 10c: 0d c0 00 00 clr r0 110: 0d 40 30 18 wl16 r0,0x198 114: 0d 40 02 00 wl16 r16,0x0 118: 0d 60 02 04 wh16 r16,0x4 11c: 00 00 02 00 add r16,r0 120: 0d 40 02 23 wl16 r17,0x3 124: 0d 60 02 20 wh16 r17,0x0 128: 0d 40 2e 40 wl16 r18,0x160 12c: 0d 60 02 40 wh16 r18,0x0 130: 10 a0 02 30 st32 r17,r16 134: 00 10 02 04 add r16,4 138: 10 a0 02 50 st32 r18,r16 13c: 0d 40 00 00 wl16 r0,0x0 140: 0d 60 00 04 wh16 r0,0x4 144: 1e 40 00 00 sridtw r0 148: 24 40 00 00 idts 14c: 1c b0 00 01 srieiw 0x1 150: 0d c0 00 00 clr r0 154: 0d c0 00 20 clr r1 158: 00 e0 00 01 div r0,r1 15c: 14 30 00 04 br 16c <test1_return>,#al 00000160 <test1_irq>: 160: 20 00 00 00 nop 164: 14 60 00 00 ib 168: 14 30 00 00 br 168 <test1_irq+0x8>,#al 0000016c <test1_return>: 16c: 20 00 00 00 nop 00000170 <test_end>: 170: 14 30 ff bc br 60 <finish>,#al Disassembly of section .assert: 00020000 <CHECK_FLAG>: 20000: 00 00 00 01 add r0,r1 00020004 <CHECK_FINISH>: 20004: 00 00 00 00 add r0,r0 00020008 <CHECK_LOG>: 20008: 00 00 00 00 add r0,r0 0002000c <ERROR_TYPE>: 2000c: 00 00 00 00 add r0,r0 00020010 <ERROR_NUMBER>: 20010: 00 00 00 00 add r0,r0 00020014 <ERROR_RESULT>: 20014: 00 00 00 00 add r0,r0 00020018 <ERROR_EXPECT>: 20018: 00 00 00 00 add r0,r0 Disassembly of section .idt: 00040000 <idt_label>: 40000: 20 00 00 00 nop 40004: 20 00 00 00 nop Disassembly of section .stack: 000f0000 <STACK_INDEX>: f0000: 00 00 00 00 add r0,r0
25.098039
47
0.640104
91604ced51a72bb58c4a7b7394297e0d531afa9a
771
asm
Assembly
programs/oeis/163/A163661.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/163/A163661.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/163/A163661.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A163661: a(n) = n*(2*n^2 + 5*n + 17)/2. ; 0,12,35,75,138,230,357,525,740,1008,1335,1727,2190,2730,3353,4065,4872,5780,6795,7923,9170,10542,12045,13685,15468,17400,19487,21735,24150,26738,29505,32457,35600,38940,42483,46235,50202,54390,58805,63453,68340,73472,78855,84495,90398,96570,103017,109745,116760,124068,131675,139587,147810,156350,165213,174405,183932,193800,204015,214583,225510,236802,248465,260505,272928,285740,298947,312555,326570,340998,355845,371117,386820,402960,419543,436575,454062,472010,490425,509313,528680,548532,568875,589715,611058,632910,655277,678165,701580,725528,750015,775047,800630,826770,853473,880745,908592,937020,966035,995643 mov $2,$0 mul $0,2 mov $3,5 lpb $2 add $3,6 add $1,$3 add $1,$2 sub $2,1 add $3,$0 lpe mov $0,$1
51.4
620
0.763943
15e679ee7434900d4ebbe3bd493648e6da814cce
819
asm
Assembly
oeis/142/A142095.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/142/A142095.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/142/A142095.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A142095: Primes congruent to 29 mod 35. ; Submitted by Jon Maiga ; 29,239,379,449,659,1009,1289,1429,1499,1709,2129,2269,2339,2549,2689,2969,3109,3319,3389,3529,3739,4019,4159,4229,4649,4789,4999,5209,5279,5419,5839,6329,6469,6679,6959,7309,7589,8009,8219,8429,8779,8849,9059,9199,9479,9619,9689,9829,10039,10459,10529,10739,10949,11159,11299,11369,11579,11719,11789,12979,13049,13259,13399,13469,13679,14029,14449,14519,14869,14939,15149,15289,15359,15569,15919,16339,16619,16759,16829,17389,17599,17669,18089,18229,18439,18719,18859,19069,19139,19489,19559,19699 mov $2,$0 add $2,6 pow $2,2 mov $4,9 lpb $2 mov $3,$4 add $3,19 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $1,$0 max $1,0 cmp $1,$0 mul $2,$1 sub $2,1 add $4,35 lpe mov $0,$4 add $0,20
35.608696
499
0.727717
7612d2cc4120d102d06160b2716ead1828b14e9d
3,675
asm
Assembly
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_1529.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_1529.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_1529.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %r8 push %r9 push %rcx // Faulty Load lea addresses_A+0x1d420, %r10 and $47287, %rcx mov (%r10), %r9 lea oracles, %r10 and $0xff, %r9 shlq $12, %r9 mov (%r10,%r9,1), %r9 pop %rcx pop %r9 pop %r8 pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'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 */
91.875
2,999
0.662585
c45a1112914b40b14273d82d43896c7ce94ef6a0
716
asm
Assembly
programs/oeis/001/A001048.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/001/A001048.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/001/A001048.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A001048: a(n) = n! + (n-1)!. ; 2,3,8,30,144,840,5760,45360,403200,3991680,43545600,518918400,6706022400,93405312000,1394852659200,22230464256000,376610217984000,6758061133824000,128047474114560000,2554547108585472000,53523844179886080000,1175091669949317120000,26976017466662584320000,646300418472124416000000,16131658445064225423360000,418802671169936621568000000,11292160911544957796352000000,315777214062132212662272000000,9146650338351415815045120000000,274094621805930760590852096000000,8488091513990113876361871360000000,271353675587871452984943575040000000 mov $1,$0 add $0,2 seq $1,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters). mul $0,$1
89.5
534
0.853352
aa6d6b6fd8d4035129600ebf509c0cd938afa281
498
asm
Assembly
libsrc/target/lviv/games/joystick.asm
ahjelm/z88dk
c4de367f39a76b41f6390ceeab77737e148178fa
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/target/lviv/games/joystick.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/target/lviv/games/joystick.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; Keyboard joysticks based on inkey SECTION code_clib PUBLIC joystick PUBLIC _joystick EXTERN joystick_sc EXTERN keys_qaop EXTERN keys_8246 EXTERN keys_cursor joystick: _joystick: ld a,l ld hl,keys_qaop cp 1 jp z,joystick_sc ld hl,keys_8246 cp 2 jp z,joystick_sc ld hl,keys_cursor cp 3 jp z,joystick_sc ld hl,0 ret
17.785714
35
0.52008
c9531cab609dcd7e27113bc1600b0a7e2be51c3d
734,392
asm
Assembly
kernel.asm
ray5273/os_project4
1ed4cb594205baed90d821d5c4c93be26ec6a889
[ "MIT-0" ]
null
null
null
kernel.asm
ray5273/os_project4
1ed4cb594205baed90d821d5c4c93be26ec6a889
[ "MIT-0" ]
null
null
null
kernel.asm
ray5273/os_project4
1ed4cb594205baed90d821d5c4c93be26ec6a889
[ "MIT-0" ]
null
null
null
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 b0 10 00 mov $0x10b000,%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 80 d6 10 80 mov $0x8010d680,%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 69 38 10 80 mov $0x80103869,%eax jmp *%eax 80100032: ff e0 jmp *%eax 80100034 <binit>: struct buf head; } bcache; void binit(void) { 80100034: 55 push %ebp 80100035: 89 e5 mov %esp,%ebp 80100037: 83 ec 18 sub $0x18,%esp struct buf *b; initlock(&bcache.lock, "bcache"); 8010003a: 83 ec 08 sub $0x8,%esp 8010003d: 68 34 8d 10 80 push $0x80108d34 80100042: 68 80 d6 10 80 push $0x8010d680 80100047: e8 02 55 00 00 call 8010554e <initlock> 8010004c: 83 c4 10 add $0x10,%esp //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; 8010004f: c7 05 90 15 11 80 84 movl $0x80111584,0x80111590 80100056: 15 11 80 bcache.head.next = &bcache.head; 80100059: c7 05 94 15 11 80 84 movl $0x80111584,0x80111594 80100060: 15 11 80 for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 80100063: c7 45 f4 b4 d6 10 80 movl $0x8010d6b4,-0xc(%ebp) 8010006a: eb 3a jmp 801000a6 <binit+0x72> b->next = bcache.head.next; 8010006c: 8b 15 94 15 11 80 mov 0x80111594,%edx 80100072: 8b 45 f4 mov -0xc(%ebp),%eax 80100075: 89 50 10 mov %edx,0x10(%eax) b->prev = &bcache.head; 80100078: 8b 45 f4 mov -0xc(%ebp),%eax 8010007b: c7 40 0c 84 15 11 80 movl $0x80111584,0xc(%eax) b->dev = -1; 80100082: 8b 45 f4 mov -0xc(%ebp),%eax 80100085: c7 40 04 ff ff ff ff movl $0xffffffff,0x4(%eax) bcache.head.next->prev = b; 8010008c: a1 94 15 11 80 mov 0x80111594,%eax 80100091: 8b 55 f4 mov -0xc(%ebp),%edx 80100094: 89 50 0c mov %edx,0xc(%eax) bcache.head.next = b; 80100097: 8b 45 f4 mov -0xc(%ebp),%eax 8010009a: a3 94 15 11 80 mov %eax,0x80111594 //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; bcache.head.next = &bcache.head; for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 8010009f: 81 45 f4 18 02 00 00 addl $0x218,-0xc(%ebp) 801000a6: b8 84 15 11 80 mov $0x80111584,%eax 801000ab: 39 45 f4 cmp %eax,-0xc(%ebp) 801000ae: 72 bc jb 8010006c <binit+0x38> b->prev = &bcache.head; b->dev = -1; bcache.head.next->prev = b; bcache.head.next = b; } } 801000b0: 90 nop 801000b1: c9 leave 801000b2: c3 ret 801000b3 <bget>: // Look through buffer cache for block on device dev. // If not found, allocate a buffer. // In either case, return B_BUSY buffer. static struct buf* bget(uint dev, uint blockno) { 801000b3: 55 push %ebp 801000b4: 89 e5 mov %esp,%ebp 801000b6: 83 ec 18 sub $0x18,%esp struct buf *b; acquire(&bcache.lock); 801000b9: 83 ec 0c sub $0xc,%esp 801000bc: 68 80 d6 10 80 push $0x8010d680 801000c1: e8 aa 54 00 00 call 80105570 <acquire> 801000c6: 83 c4 10 add $0x10,%esp loop: // Is the block already cached? for(b = bcache.head.next; b != &bcache.head; b = b->next){ 801000c9: a1 94 15 11 80 mov 0x80111594,%eax 801000ce: 89 45 f4 mov %eax,-0xc(%ebp) 801000d1: eb 67 jmp 8010013a <bget+0x87> if(b->dev == dev && b->blockno == blockno){ 801000d3: 8b 45 f4 mov -0xc(%ebp),%eax 801000d6: 8b 40 04 mov 0x4(%eax),%eax 801000d9: 3b 45 08 cmp 0x8(%ebp),%eax 801000dc: 75 53 jne 80100131 <bget+0x7e> 801000de: 8b 45 f4 mov -0xc(%ebp),%eax 801000e1: 8b 40 08 mov 0x8(%eax),%eax 801000e4: 3b 45 0c cmp 0xc(%ebp),%eax 801000e7: 75 48 jne 80100131 <bget+0x7e> if(!(b->flags & B_BUSY)){ 801000e9: 8b 45 f4 mov -0xc(%ebp),%eax 801000ec: 8b 00 mov (%eax),%eax 801000ee: 83 e0 01 and $0x1,%eax 801000f1: 85 c0 test %eax,%eax 801000f3: 75 27 jne 8010011c <bget+0x69> b->flags |= B_BUSY; 801000f5: 8b 45 f4 mov -0xc(%ebp),%eax 801000f8: 8b 00 mov (%eax),%eax 801000fa: 83 c8 01 or $0x1,%eax 801000fd: 89 c2 mov %eax,%edx 801000ff: 8b 45 f4 mov -0xc(%ebp),%eax 80100102: 89 10 mov %edx,(%eax) release(&bcache.lock); 80100104: 83 ec 0c sub $0xc,%esp 80100107: 68 80 d6 10 80 push $0x8010d680 8010010c: e8 c6 54 00 00 call 801055d7 <release> 80100111: 83 c4 10 add $0x10,%esp return b; 80100114: 8b 45 f4 mov -0xc(%ebp),%eax 80100117: e9 98 00 00 00 jmp 801001b4 <bget+0x101> } sleep(b, &bcache.lock); 8010011c: 83 ec 08 sub $0x8,%esp 8010011f: 68 80 d6 10 80 push $0x8010d680 80100124: ff 75 f4 pushl -0xc(%ebp) 80100127: e8 34 51 00 00 call 80105260 <sleep> 8010012c: 83 c4 10 add $0x10,%esp goto loop; 8010012f: eb 98 jmp 801000c9 <bget+0x16> acquire(&bcache.lock); loop: // Is the block already cached? for(b = bcache.head.next; b != &bcache.head; b = b->next){ 80100131: 8b 45 f4 mov -0xc(%ebp),%eax 80100134: 8b 40 10 mov 0x10(%eax),%eax 80100137: 89 45 f4 mov %eax,-0xc(%ebp) 8010013a: 81 7d f4 84 15 11 80 cmpl $0x80111584,-0xc(%ebp) 80100141: 75 90 jne 801000d3 <bget+0x20> } // Not cached; recycle some non-busy and clean buffer. // "clean" because B_DIRTY and !B_BUSY means log.c // hasn't yet committed the changes to the buffer. for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ 80100143: a1 90 15 11 80 mov 0x80111590,%eax 80100148: 89 45 f4 mov %eax,-0xc(%ebp) 8010014b: eb 51 jmp 8010019e <bget+0xeb> if((b->flags & B_BUSY) == 0 && (b->flags & B_DIRTY) == 0){ 8010014d: 8b 45 f4 mov -0xc(%ebp),%eax 80100150: 8b 00 mov (%eax),%eax 80100152: 83 e0 01 and $0x1,%eax 80100155: 85 c0 test %eax,%eax 80100157: 75 3c jne 80100195 <bget+0xe2> 80100159: 8b 45 f4 mov -0xc(%ebp),%eax 8010015c: 8b 00 mov (%eax),%eax 8010015e: 83 e0 04 and $0x4,%eax 80100161: 85 c0 test %eax,%eax 80100163: 75 30 jne 80100195 <bget+0xe2> b->dev = dev; 80100165: 8b 45 f4 mov -0xc(%ebp),%eax 80100168: 8b 55 08 mov 0x8(%ebp),%edx 8010016b: 89 50 04 mov %edx,0x4(%eax) b->blockno = blockno; 8010016e: 8b 45 f4 mov -0xc(%ebp),%eax 80100171: 8b 55 0c mov 0xc(%ebp),%edx 80100174: 89 50 08 mov %edx,0x8(%eax) b->flags = B_BUSY; 80100177: 8b 45 f4 mov -0xc(%ebp),%eax 8010017a: c7 00 01 00 00 00 movl $0x1,(%eax) release(&bcache.lock); 80100180: 83 ec 0c sub $0xc,%esp 80100183: 68 80 d6 10 80 push $0x8010d680 80100188: e8 4a 54 00 00 call 801055d7 <release> 8010018d: 83 c4 10 add $0x10,%esp return b; 80100190: 8b 45 f4 mov -0xc(%ebp),%eax 80100193: eb 1f jmp 801001b4 <bget+0x101> } // Not cached; recycle some non-busy and clean buffer. // "clean" because B_DIRTY and !B_BUSY means log.c // hasn't yet committed the changes to the buffer. for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ 80100195: 8b 45 f4 mov -0xc(%ebp),%eax 80100198: 8b 40 0c mov 0xc(%eax),%eax 8010019b: 89 45 f4 mov %eax,-0xc(%ebp) 8010019e: 81 7d f4 84 15 11 80 cmpl $0x80111584,-0xc(%ebp) 801001a5: 75 a6 jne 8010014d <bget+0x9a> b->flags = B_BUSY; release(&bcache.lock); return b; } } panic("bget: no buffers"); 801001a7: 83 ec 0c sub $0xc,%esp 801001aa: 68 3b 8d 10 80 push $0x80108d3b 801001af: e8 b2 03 00 00 call 80100566 <panic> } 801001b4: c9 leave 801001b5: c3 ret 801001b6 <bread>: // Return a B_BUSY buf with the contents of the indicated block. struct buf* bread(uint dev, uint blockno) { 801001b6: 55 push %ebp 801001b7: 89 e5 mov %esp,%ebp 801001b9: 83 ec 18 sub $0x18,%esp struct buf *b; b = bget(dev, blockno); 801001bc: 83 ec 08 sub $0x8,%esp 801001bf: ff 75 0c pushl 0xc(%ebp) 801001c2: ff 75 08 pushl 0x8(%ebp) 801001c5: e8 e9 fe ff ff call 801000b3 <bget> 801001ca: 83 c4 10 add $0x10,%esp 801001cd: 89 45 f4 mov %eax,-0xc(%ebp) if(!(b->flags & B_VALID)) { 801001d0: 8b 45 f4 mov -0xc(%ebp),%eax 801001d3: 8b 00 mov (%eax),%eax 801001d5: 83 e0 02 and $0x2,%eax 801001d8: 85 c0 test %eax,%eax 801001da: 75 0e jne 801001ea <bread+0x34> iderw(b); 801001dc: 83 ec 0c sub $0xc,%esp 801001df: ff 75 f4 pushl -0xc(%ebp) 801001e2: e8 dc 26 00 00 call 801028c3 <iderw> 801001e7: 83 c4 10 add $0x10,%esp } return b; 801001ea: 8b 45 f4 mov -0xc(%ebp),%eax } 801001ed: c9 leave 801001ee: c3 ret 801001ef <bwrite>: // Write b's contents to disk. Must be B_BUSY. void bwrite(struct buf *b) { 801001ef: 55 push %ebp 801001f0: 89 e5 mov %esp,%ebp 801001f2: 83 ec 08 sub $0x8,%esp if((b->flags & B_BUSY) == 0) 801001f5: 8b 45 08 mov 0x8(%ebp),%eax 801001f8: 8b 00 mov (%eax),%eax 801001fa: 83 e0 01 and $0x1,%eax 801001fd: 85 c0 test %eax,%eax 801001ff: 75 0d jne 8010020e <bwrite+0x1f> panic("bwrite"); 80100201: 83 ec 0c sub $0xc,%esp 80100204: 68 4c 8d 10 80 push $0x80108d4c 80100209: e8 58 03 00 00 call 80100566 <panic> b->flags |= B_DIRTY; 8010020e: 8b 45 08 mov 0x8(%ebp),%eax 80100211: 8b 00 mov (%eax),%eax 80100213: 83 c8 04 or $0x4,%eax 80100216: 89 c2 mov %eax,%edx 80100218: 8b 45 08 mov 0x8(%ebp),%eax 8010021b: 89 10 mov %edx,(%eax) iderw(b); 8010021d: 83 ec 0c sub $0xc,%esp 80100220: ff 75 08 pushl 0x8(%ebp) 80100223: e8 9b 26 00 00 call 801028c3 <iderw> 80100228: 83 c4 10 add $0x10,%esp } 8010022b: 90 nop 8010022c: c9 leave 8010022d: c3 ret 8010022e <brelse>: // Release a B_BUSY buffer. // Move to the head of the MRU list. void brelse(struct buf *b) { 8010022e: 55 push %ebp 8010022f: 89 e5 mov %esp,%ebp 80100231: 83 ec 08 sub $0x8,%esp if((b->flags & B_BUSY) == 0) 80100234: 8b 45 08 mov 0x8(%ebp),%eax 80100237: 8b 00 mov (%eax),%eax 80100239: 83 e0 01 and $0x1,%eax 8010023c: 85 c0 test %eax,%eax 8010023e: 75 0d jne 8010024d <brelse+0x1f> panic("brelse"); 80100240: 83 ec 0c sub $0xc,%esp 80100243: 68 53 8d 10 80 push $0x80108d53 80100248: e8 19 03 00 00 call 80100566 <panic> acquire(&bcache.lock); 8010024d: 83 ec 0c sub $0xc,%esp 80100250: 68 80 d6 10 80 push $0x8010d680 80100255: e8 16 53 00 00 call 80105570 <acquire> 8010025a: 83 c4 10 add $0x10,%esp b->next->prev = b->prev; 8010025d: 8b 45 08 mov 0x8(%ebp),%eax 80100260: 8b 40 10 mov 0x10(%eax),%eax 80100263: 8b 55 08 mov 0x8(%ebp),%edx 80100266: 8b 52 0c mov 0xc(%edx),%edx 80100269: 89 50 0c mov %edx,0xc(%eax) b->prev->next = b->next; 8010026c: 8b 45 08 mov 0x8(%ebp),%eax 8010026f: 8b 40 0c mov 0xc(%eax),%eax 80100272: 8b 55 08 mov 0x8(%ebp),%edx 80100275: 8b 52 10 mov 0x10(%edx),%edx 80100278: 89 50 10 mov %edx,0x10(%eax) b->next = bcache.head.next; 8010027b: 8b 15 94 15 11 80 mov 0x80111594,%edx 80100281: 8b 45 08 mov 0x8(%ebp),%eax 80100284: 89 50 10 mov %edx,0x10(%eax) b->prev = &bcache.head; 80100287: 8b 45 08 mov 0x8(%ebp),%eax 8010028a: c7 40 0c 84 15 11 80 movl $0x80111584,0xc(%eax) bcache.head.next->prev = b; 80100291: a1 94 15 11 80 mov 0x80111594,%eax 80100296: 8b 55 08 mov 0x8(%ebp),%edx 80100299: 89 50 0c mov %edx,0xc(%eax) bcache.head.next = b; 8010029c: 8b 45 08 mov 0x8(%ebp),%eax 8010029f: a3 94 15 11 80 mov %eax,0x80111594 b->flags &= ~B_BUSY; 801002a4: 8b 45 08 mov 0x8(%ebp),%eax 801002a7: 8b 00 mov (%eax),%eax 801002a9: 83 e0 fe and $0xfffffffe,%eax 801002ac: 89 c2 mov %eax,%edx 801002ae: 8b 45 08 mov 0x8(%ebp),%eax 801002b1: 89 10 mov %edx,(%eax) wakeup(b); 801002b3: 83 ec 0c sub $0xc,%esp 801002b6: ff 75 08 pushl 0x8(%ebp) 801002b9: e8 90 50 00 00 call 8010534e <wakeup> 801002be: 83 c4 10 add $0x10,%esp release(&bcache.lock); 801002c1: 83 ec 0c sub $0xc,%esp 801002c4: 68 80 d6 10 80 push $0x8010d680 801002c9: e8 09 53 00 00 call 801055d7 <release> 801002ce: 83 c4 10 add $0x10,%esp } 801002d1: 90 nop 801002d2: c9 leave 801002d3: c3 ret 801002d4 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 801002d4: 55 push %ebp 801002d5: 89 e5 mov %esp,%ebp 801002d7: 83 ec 14 sub $0x14,%esp 801002da: 8b 45 08 mov 0x8(%ebp),%eax 801002dd: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801002e1: 0f b7 45 ec movzwl -0x14(%ebp),%eax 801002e5: 89 c2 mov %eax,%edx 801002e7: ec in (%dx),%al 801002e8: 88 45 ff mov %al,-0x1(%ebp) return data; 801002eb: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 801002ef: c9 leave 801002f0: c3 ret 801002f1 <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 801002f1: 55 push %ebp 801002f2: 89 e5 mov %esp,%ebp 801002f4: 83 ec 08 sub $0x8,%esp 801002f7: 8b 55 08 mov 0x8(%ebp),%edx 801002fa: 8b 45 0c mov 0xc(%ebp),%eax 801002fd: 66 89 55 fc mov %dx,-0x4(%ebp) 80100301: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80100304: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80100308: 0f b7 55 fc movzwl -0x4(%ebp),%edx 8010030c: ee out %al,(%dx) } 8010030d: 90 nop 8010030e: c9 leave 8010030f: c3 ret 80100310 <cli>: asm volatile("movw %0, %%gs" : : "r" (v)); } static inline void cli(void) { 80100310: 55 push %ebp 80100311: 89 e5 mov %esp,%ebp asm volatile("cli"); 80100313: fa cli } 80100314: 90 nop 80100315: 5d pop %ebp 80100316: c3 ret 80100317 <printint>: int locking; } cons; static void printint(int xx, int base, int sign) { 80100317: 55 push %ebp 80100318: 89 e5 mov %esp,%ebp 8010031a: 53 push %ebx 8010031b: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789abcdef"; char buf[16]; int i; uint x; if(sign && (sign = xx < 0)) 8010031e: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80100322: 74 1c je 80100340 <printint+0x29> 80100324: 8b 45 08 mov 0x8(%ebp),%eax 80100327: c1 e8 1f shr $0x1f,%eax 8010032a: 0f b6 c0 movzbl %al,%eax 8010032d: 89 45 10 mov %eax,0x10(%ebp) 80100330: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80100334: 74 0a je 80100340 <printint+0x29> x = -xx; 80100336: 8b 45 08 mov 0x8(%ebp),%eax 80100339: f7 d8 neg %eax 8010033b: 89 45 f0 mov %eax,-0x10(%ebp) 8010033e: eb 06 jmp 80100346 <printint+0x2f> else x = xx; 80100340: 8b 45 08 mov 0x8(%ebp),%eax 80100343: 89 45 f0 mov %eax,-0x10(%ebp) i = 0; 80100346: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 8010034d: 8b 4d f4 mov -0xc(%ebp),%ecx 80100350: 8d 41 01 lea 0x1(%ecx),%eax 80100353: 89 45 f4 mov %eax,-0xc(%ebp) 80100356: 8b 5d 0c mov 0xc(%ebp),%ebx 80100359: 8b 45 f0 mov -0x10(%ebp),%eax 8010035c: ba 00 00 00 00 mov $0x0,%edx 80100361: f7 f3 div %ebx 80100363: 89 d0 mov %edx,%eax 80100365: 0f b6 80 04 a0 10 80 movzbl -0x7fef5ffc(%eax),%eax 8010036c: 88 44 0d e0 mov %al,-0x20(%ebp,%ecx,1) }while((x /= base) != 0); 80100370: 8b 5d 0c mov 0xc(%ebp),%ebx 80100373: 8b 45 f0 mov -0x10(%ebp),%eax 80100376: ba 00 00 00 00 mov $0x0,%edx 8010037b: f7 f3 div %ebx 8010037d: 89 45 f0 mov %eax,-0x10(%ebp) 80100380: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80100384: 75 c7 jne 8010034d <printint+0x36> if(sign) 80100386: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8010038a: 74 2a je 801003b6 <printint+0x9f> buf[i++] = '-'; 8010038c: 8b 45 f4 mov -0xc(%ebp),%eax 8010038f: 8d 50 01 lea 0x1(%eax),%edx 80100392: 89 55 f4 mov %edx,-0xc(%ebp) 80100395: c6 44 05 e0 2d movb $0x2d,-0x20(%ebp,%eax,1) while(--i >= 0) 8010039a: eb 1a jmp 801003b6 <printint+0x9f> consputc(buf[i]); 8010039c: 8d 55 e0 lea -0x20(%ebp),%edx 8010039f: 8b 45 f4 mov -0xc(%ebp),%eax 801003a2: 01 d0 add %edx,%eax 801003a4: 0f b6 00 movzbl (%eax),%eax 801003a7: 0f be c0 movsbl %al,%eax 801003aa: 83 ec 0c sub $0xc,%esp 801003ad: 50 push %eax 801003ae: e8 df 03 00 00 call 80100792 <consputc> 801003b3: 83 c4 10 add $0x10,%esp }while((x /= base) != 0); if(sign) buf[i++] = '-'; while(--i >= 0) 801003b6: 83 6d f4 01 subl $0x1,-0xc(%ebp) 801003ba: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801003be: 79 dc jns 8010039c <printint+0x85> consputc(buf[i]); } 801003c0: 90 nop 801003c1: 8b 5d fc mov -0x4(%ebp),%ebx 801003c4: c9 leave 801003c5: c3 ret 801003c6 <cprintf>: //PAGEBREAK: 50 // Print to the console. only understands %d, %x, %p, %s. void cprintf(char *fmt, ...) { 801003c6: 55 push %ebp 801003c7: 89 e5 mov %esp,%ebp 801003c9: 83 ec 28 sub $0x28,%esp int i, c, locking; uint *argp; char *s; locking = cons.locking; 801003cc: a1 14 c6 10 80 mov 0x8010c614,%eax 801003d1: 89 45 e8 mov %eax,-0x18(%ebp) if(locking) 801003d4: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 801003d8: 74 10 je 801003ea <cprintf+0x24> acquire(&cons.lock); 801003da: 83 ec 0c sub $0xc,%esp 801003dd: 68 e0 c5 10 80 push $0x8010c5e0 801003e2: e8 89 51 00 00 call 80105570 <acquire> 801003e7: 83 c4 10 add $0x10,%esp if (fmt == 0) 801003ea: 8b 45 08 mov 0x8(%ebp),%eax 801003ed: 85 c0 test %eax,%eax 801003ef: 75 0d jne 801003fe <cprintf+0x38> panic("null fmt"); 801003f1: 83 ec 0c sub $0xc,%esp 801003f4: 68 5a 8d 10 80 push $0x80108d5a 801003f9: e8 68 01 00 00 call 80100566 <panic> argp = (uint*)(void*)(&fmt + 1); 801003fe: 8d 45 0c lea 0xc(%ebp),%eax 80100401: 89 45 f0 mov %eax,-0x10(%ebp) for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 80100404: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010040b: e9 1a 01 00 00 jmp 8010052a <cprintf+0x164> if(c != '%'){ 80100410: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 80100414: 74 13 je 80100429 <cprintf+0x63> consputc(c); 80100416: 83 ec 0c sub $0xc,%esp 80100419: ff 75 e4 pushl -0x1c(%ebp) 8010041c: e8 71 03 00 00 call 80100792 <consputc> 80100421: 83 c4 10 add $0x10,%esp continue; 80100424: e9 fd 00 00 00 jmp 80100526 <cprintf+0x160> } c = fmt[++i] & 0xff; 80100429: 8b 55 08 mov 0x8(%ebp),%edx 8010042c: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80100430: 8b 45 f4 mov -0xc(%ebp),%eax 80100433: 01 d0 add %edx,%eax 80100435: 0f b6 00 movzbl (%eax),%eax 80100438: 0f be c0 movsbl %al,%eax 8010043b: 25 ff 00 00 00 and $0xff,%eax 80100440: 89 45 e4 mov %eax,-0x1c(%ebp) if(c == 0) 80100443: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 80100447: 0f 84 ff 00 00 00 je 8010054c <cprintf+0x186> break; switch(c){ 8010044d: 8b 45 e4 mov -0x1c(%ebp),%eax 80100450: 83 f8 70 cmp $0x70,%eax 80100453: 74 47 je 8010049c <cprintf+0xd6> 80100455: 83 f8 70 cmp $0x70,%eax 80100458: 7f 13 jg 8010046d <cprintf+0xa7> 8010045a: 83 f8 25 cmp $0x25,%eax 8010045d: 0f 84 98 00 00 00 je 801004fb <cprintf+0x135> 80100463: 83 f8 64 cmp $0x64,%eax 80100466: 74 14 je 8010047c <cprintf+0xb6> 80100468: e9 9d 00 00 00 jmp 8010050a <cprintf+0x144> 8010046d: 83 f8 73 cmp $0x73,%eax 80100470: 74 47 je 801004b9 <cprintf+0xf3> 80100472: 83 f8 78 cmp $0x78,%eax 80100475: 74 25 je 8010049c <cprintf+0xd6> 80100477: e9 8e 00 00 00 jmp 8010050a <cprintf+0x144> case 'd': printint(*argp++, 10, 1); 8010047c: 8b 45 f0 mov -0x10(%ebp),%eax 8010047f: 8d 50 04 lea 0x4(%eax),%edx 80100482: 89 55 f0 mov %edx,-0x10(%ebp) 80100485: 8b 00 mov (%eax),%eax 80100487: 83 ec 04 sub $0x4,%esp 8010048a: 6a 01 push $0x1 8010048c: 6a 0a push $0xa 8010048e: 50 push %eax 8010048f: e8 83 fe ff ff call 80100317 <printint> 80100494: 83 c4 10 add $0x10,%esp break; 80100497: e9 8a 00 00 00 jmp 80100526 <cprintf+0x160> case 'x': case 'p': printint(*argp++, 16, 0); 8010049c: 8b 45 f0 mov -0x10(%ebp),%eax 8010049f: 8d 50 04 lea 0x4(%eax),%edx 801004a2: 89 55 f0 mov %edx,-0x10(%ebp) 801004a5: 8b 00 mov (%eax),%eax 801004a7: 83 ec 04 sub $0x4,%esp 801004aa: 6a 00 push $0x0 801004ac: 6a 10 push $0x10 801004ae: 50 push %eax 801004af: e8 63 fe ff ff call 80100317 <printint> 801004b4: 83 c4 10 add $0x10,%esp break; 801004b7: eb 6d jmp 80100526 <cprintf+0x160> case 's': if((s = (char*)*argp++) == 0) 801004b9: 8b 45 f0 mov -0x10(%ebp),%eax 801004bc: 8d 50 04 lea 0x4(%eax),%edx 801004bf: 89 55 f0 mov %edx,-0x10(%ebp) 801004c2: 8b 00 mov (%eax),%eax 801004c4: 89 45 ec mov %eax,-0x14(%ebp) 801004c7: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 801004cb: 75 22 jne 801004ef <cprintf+0x129> s = "(null)"; 801004cd: c7 45 ec 63 8d 10 80 movl $0x80108d63,-0x14(%ebp) for(; *s; s++) 801004d4: eb 19 jmp 801004ef <cprintf+0x129> consputc(*s); 801004d6: 8b 45 ec mov -0x14(%ebp),%eax 801004d9: 0f b6 00 movzbl (%eax),%eax 801004dc: 0f be c0 movsbl %al,%eax 801004df: 83 ec 0c sub $0xc,%esp 801004e2: 50 push %eax 801004e3: e8 aa 02 00 00 call 80100792 <consputc> 801004e8: 83 c4 10 add $0x10,%esp printint(*argp++, 16, 0); break; case 's': if((s = (char*)*argp++) == 0) s = "(null)"; for(; *s; s++) 801004eb: 83 45 ec 01 addl $0x1,-0x14(%ebp) 801004ef: 8b 45 ec mov -0x14(%ebp),%eax 801004f2: 0f b6 00 movzbl (%eax),%eax 801004f5: 84 c0 test %al,%al 801004f7: 75 dd jne 801004d6 <cprintf+0x110> consputc(*s); break; 801004f9: eb 2b jmp 80100526 <cprintf+0x160> case '%': consputc('%'); 801004fb: 83 ec 0c sub $0xc,%esp 801004fe: 6a 25 push $0x25 80100500: e8 8d 02 00 00 call 80100792 <consputc> 80100505: 83 c4 10 add $0x10,%esp break; 80100508: eb 1c jmp 80100526 <cprintf+0x160> default: // Print unknown % sequence to draw attention. consputc('%'); 8010050a: 83 ec 0c sub $0xc,%esp 8010050d: 6a 25 push $0x25 8010050f: e8 7e 02 00 00 call 80100792 <consputc> 80100514: 83 c4 10 add $0x10,%esp consputc(c); 80100517: 83 ec 0c sub $0xc,%esp 8010051a: ff 75 e4 pushl -0x1c(%ebp) 8010051d: e8 70 02 00 00 call 80100792 <consputc> 80100522: 83 c4 10 add $0x10,%esp break; 80100525: 90 nop if (fmt == 0) panic("null fmt"); argp = (uint*)(void*)(&fmt + 1); for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 80100526: 83 45 f4 01 addl $0x1,-0xc(%ebp) 8010052a: 8b 55 08 mov 0x8(%ebp),%edx 8010052d: 8b 45 f4 mov -0xc(%ebp),%eax 80100530: 01 d0 add %edx,%eax 80100532: 0f b6 00 movzbl (%eax),%eax 80100535: 0f be c0 movsbl %al,%eax 80100538: 25 ff 00 00 00 and $0xff,%eax 8010053d: 89 45 e4 mov %eax,-0x1c(%ebp) 80100540: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 80100544: 0f 85 c6 fe ff ff jne 80100410 <cprintf+0x4a> 8010054a: eb 01 jmp 8010054d <cprintf+0x187> consputc(c); continue; } c = fmt[++i] & 0xff; if(c == 0) break; 8010054c: 90 nop consputc(c); break; } } if(locking) 8010054d: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 80100551: 74 10 je 80100563 <cprintf+0x19d> release(&cons.lock); 80100553: 83 ec 0c sub $0xc,%esp 80100556: 68 e0 c5 10 80 push $0x8010c5e0 8010055b: e8 77 50 00 00 call 801055d7 <release> 80100560: 83 c4 10 add $0x10,%esp } 80100563: 90 nop 80100564: c9 leave 80100565: c3 ret 80100566 <panic>: void panic(char *s) { 80100566: 55 push %ebp 80100567: 89 e5 mov %esp,%ebp 80100569: 83 ec 38 sub $0x38,%esp int i; uint pcs[10]; cli(); 8010056c: e8 9f fd ff ff call 80100310 <cli> cons.locking = 0; 80100571: c7 05 14 c6 10 80 00 movl $0x0,0x8010c614 80100578: 00 00 00 cprintf("cpu%d: panic: ", cpu->id); 8010057b: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80100581: 0f b6 00 movzbl (%eax),%eax 80100584: 0f b6 c0 movzbl %al,%eax 80100587: 83 ec 08 sub $0x8,%esp 8010058a: 50 push %eax 8010058b: 68 6a 8d 10 80 push $0x80108d6a 80100590: e8 31 fe ff ff call 801003c6 <cprintf> 80100595: 83 c4 10 add $0x10,%esp cprintf(s); 80100598: 8b 45 08 mov 0x8(%ebp),%eax 8010059b: 83 ec 0c sub $0xc,%esp 8010059e: 50 push %eax 8010059f: e8 22 fe ff ff call 801003c6 <cprintf> 801005a4: 83 c4 10 add $0x10,%esp cprintf("\n"); 801005a7: 83 ec 0c sub $0xc,%esp 801005aa: 68 79 8d 10 80 push $0x80108d79 801005af: e8 12 fe ff ff call 801003c6 <cprintf> 801005b4: 83 c4 10 add $0x10,%esp getcallerpcs(&s, pcs); 801005b7: 83 ec 08 sub $0x8,%esp 801005ba: 8d 45 cc lea -0x34(%ebp),%eax 801005bd: 50 push %eax 801005be: 8d 45 08 lea 0x8(%ebp),%eax 801005c1: 50 push %eax 801005c2: e8 62 50 00 00 call 80105629 <getcallerpcs> 801005c7: 83 c4 10 add $0x10,%esp for(i=0; i<10; i++) 801005ca: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801005d1: eb 1c jmp 801005ef <panic+0x89> cprintf(" %p", pcs[i]); 801005d3: 8b 45 f4 mov -0xc(%ebp),%eax 801005d6: 8b 44 85 cc mov -0x34(%ebp,%eax,4),%eax 801005da: 83 ec 08 sub $0x8,%esp 801005dd: 50 push %eax 801005de: 68 7b 8d 10 80 push $0x80108d7b 801005e3: e8 de fd ff ff call 801003c6 <cprintf> 801005e8: 83 c4 10 add $0x10,%esp cons.locking = 0; cprintf("cpu%d: panic: ", cpu->id); cprintf(s); cprintf("\n"); getcallerpcs(&s, pcs); for(i=0; i<10; i++) 801005eb: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801005ef: 83 7d f4 09 cmpl $0x9,-0xc(%ebp) 801005f3: 7e de jle 801005d3 <panic+0x6d> cprintf(" %p", pcs[i]); panicked = 1; // freeze other CPU 801005f5: c7 05 c0 c5 10 80 01 movl $0x1,0x8010c5c0 801005fc: 00 00 00 for(;;) ; 801005ff: eb fe jmp 801005ff <panic+0x99> 80100601 <cgaputc>: #define CRTPORT 0x3d4 static ushort *crt = (ushort*)P2V(0xb8000); // CGA memory static void cgaputc(int c) { 80100601: 55 push %ebp 80100602: 89 e5 mov %esp,%ebp 80100604: 83 ec 18 sub $0x18,%esp int pos; // Cursor position: col + 80*row. outb(CRTPORT, 14); 80100607: 6a 0e push $0xe 80100609: 68 d4 03 00 00 push $0x3d4 8010060e: e8 de fc ff ff call 801002f1 <outb> 80100613: 83 c4 08 add $0x8,%esp pos = inb(CRTPORT+1) << 8; 80100616: 68 d5 03 00 00 push $0x3d5 8010061b: e8 b4 fc ff ff call 801002d4 <inb> 80100620: 83 c4 04 add $0x4,%esp 80100623: 0f b6 c0 movzbl %al,%eax 80100626: c1 e0 08 shl $0x8,%eax 80100629: 89 45 f4 mov %eax,-0xc(%ebp) outb(CRTPORT, 15); 8010062c: 6a 0f push $0xf 8010062e: 68 d4 03 00 00 push $0x3d4 80100633: e8 b9 fc ff ff call 801002f1 <outb> 80100638: 83 c4 08 add $0x8,%esp pos |= inb(CRTPORT+1); 8010063b: 68 d5 03 00 00 push $0x3d5 80100640: e8 8f fc ff ff call 801002d4 <inb> 80100645: 83 c4 04 add $0x4,%esp 80100648: 0f b6 c0 movzbl %al,%eax 8010064b: 09 45 f4 or %eax,-0xc(%ebp) if(c == '\n') 8010064e: 83 7d 08 0a cmpl $0xa,0x8(%ebp) 80100652: 75 30 jne 80100684 <cgaputc+0x83> pos += 80 - pos%80; 80100654: 8b 4d f4 mov -0xc(%ebp),%ecx 80100657: ba 67 66 66 66 mov $0x66666667,%edx 8010065c: 89 c8 mov %ecx,%eax 8010065e: f7 ea imul %edx 80100660: c1 fa 05 sar $0x5,%edx 80100663: 89 c8 mov %ecx,%eax 80100665: c1 f8 1f sar $0x1f,%eax 80100668: 29 c2 sub %eax,%edx 8010066a: 89 d0 mov %edx,%eax 8010066c: c1 e0 02 shl $0x2,%eax 8010066f: 01 d0 add %edx,%eax 80100671: c1 e0 04 shl $0x4,%eax 80100674: 29 c1 sub %eax,%ecx 80100676: 89 ca mov %ecx,%edx 80100678: b8 50 00 00 00 mov $0x50,%eax 8010067d: 29 d0 sub %edx,%eax 8010067f: 01 45 f4 add %eax,-0xc(%ebp) 80100682: eb 34 jmp 801006b8 <cgaputc+0xb7> else if(c == BACKSPACE){ 80100684: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp) 8010068b: 75 0c jne 80100699 <cgaputc+0x98> if(pos > 0) --pos; 8010068d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80100691: 7e 25 jle 801006b8 <cgaputc+0xb7> 80100693: 83 6d f4 01 subl $0x1,-0xc(%ebp) 80100697: eb 1f jmp 801006b8 <cgaputc+0xb7> } else crt[pos++] = (c&0xff) | 0x0700; // black on white 80100699: 8b 0d 00 a0 10 80 mov 0x8010a000,%ecx 8010069f: 8b 45 f4 mov -0xc(%ebp),%eax 801006a2: 8d 50 01 lea 0x1(%eax),%edx 801006a5: 89 55 f4 mov %edx,-0xc(%ebp) 801006a8: 01 c0 add %eax,%eax 801006aa: 01 c8 add %ecx,%eax 801006ac: 8b 55 08 mov 0x8(%ebp),%edx 801006af: 0f b6 d2 movzbl %dl,%edx 801006b2: 80 ce 07 or $0x7,%dh 801006b5: 66 89 10 mov %dx,(%eax) if(pos < 0 || pos > 25*80) 801006b8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801006bc: 78 09 js 801006c7 <cgaputc+0xc6> 801006be: 81 7d f4 d0 07 00 00 cmpl $0x7d0,-0xc(%ebp) 801006c5: 7e 0d jle 801006d4 <cgaputc+0xd3> panic("pos under/overflow"); 801006c7: 83 ec 0c sub $0xc,%esp 801006ca: 68 7f 8d 10 80 push $0x80108d7f 801006cf: e8 92 fe ff ff call 80100566 <panic> if((pos/80) >= 24){ // Scroll up. 801006d4: 81 7d f4 7f 07 00 00 cmpl $0x77f,-0xc(%ebp) 801006db: 7e 4c jle 80100729 <cgaputc+0x128> memmove(crt, crt+80, sizeof(crt[0])*23*80); 801006dd: a1 00 a0 10 80 mov 0x8010a000,%eax 801006e2: 8d 90 a0 00 00 00 lea 0xa0(%eax),%edx 801006e8: a1 00 a0 10 80 mov 0x8010a000,%eax 801006ed: 83 ec 04 sub $0x4,%esp 801006f0: 68 60 0e 00 00 push $0xe60 801006f5: 52 push %edx 801006f6: 50 push %eax 801006f7: e8 96 51 00 00 call 80105892 <memmove> 801006fc: 83 c4 10 add $0x10,%esp pos -= 80; 801006ff: 83 6d f4 50 subl $0x50,-0xc(%ebp) memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); 80100703: b8 80 07 00 00 mov $0x780,%eax 80100708: 2b 45 f4 sub -0xc(%ebp),%eax 8010070b: 8d 14 00 lea (%eax,%eax,1),%edx 8010070e: a1 00 a0 10 80 mov 0x8010a000,%eax 80100713: 8b 4d f4 mov -0xc(%ebp),%ecx 80100716: 01 c9 add %ecx,%ecx 80100718: 01 c8 add %ecx,%eax 8010071a: 83 ec 04 sub $0x4,%esp 8010071d: 52 push %edx 8010071e: 6a 00 push $0x0 80100720: 50 push %eax 80100721: e8 ad 50 00 00 call 801057d3 <memset> 80100726: 83 c4 10 add $0x10,%esp } outb(CRTPORT, 14); 80100729: 83 ec 08 sub $0x8,%esp 8010072c: 6a 0e push $0xe 8010072e: 68 d4 03 00 00 push $0x3d4 80100733: e8 b9 fb ff ff call 801002f1 <outb> 80100738: 83 c4 10 add $0x10,%esp outb(CRTPORT+1, pos>>8); 8010073b: 8b 45 f4 mov -0xc(%ebp),%eax 8010073e: c1 f8 08 sar $0x8,%eax 80100741: 0f b6 c0 movzbl %al,%eax 80100744: 83 ec 08 sub $0x8,%esp 80100747: 50 push %eax 80100748: 68 d5 03 00 00 push $0x3d5 8010074d: e8 9f fb ff ff call 801002f1 <outb> 80100752: 83 c4 10 add $0x10,%esp outb(CRTPORT, 15); 80100755: 83 ec 08 sub $0x8,%esp 80100758: 6a 0f push $0xf 8010075a: 68 d4 03 00 00 push $0x3d4 8010075f: e8 8d fb ff ff call 801002f1 <outb> 80100764: 83 c4 10 add $0x10,%esp outb(CRTPORT+1, pos); 80100767: 8b 45 f4 mov -0xc(%ebp),%eax 8010076a: 0f b6 c0 movzbl %al,%eax 8010076d: 83 ec 08 sub $0x8,%esp 80100770: 50 push %eax 80100771: 68 d5 03 00 00 push $0x3d5 80100776: e8 76 fb ff ff call 801002f1 <outb> 8010077b: 83 c4 10 add $0x10,%esp crt[pos] = ' ' | 0x0700; 8010077e: a1 00 a0 10 80 mov 0x8010a000,%eax 80100783: 8b 55 f4 mov -0xc(%ebp),%edx 80100786: 01 d2 add %edx,%edx 80100788: 01 d0 add %edx,%eax 8010078a: 66 c7 00 20 07 movw $0x720,(%eax) } 8010078f: 90 nop 80100790: c9 leave 80100791: c3 ret 80100792 <consputc>: void consputc(int c) { 80100792: 55 push %ebp 80100793: 89 e5 mov %esp,%ebp 80100795: 83 ec 08 sub $0x8,%esp if(panicked){ 80100798: a1 c0 c5 10 80 mov 0x8010c5c0,%eax 8010079d: 85 c0 test %eax,%eax 8010079f: 74 07 je 801007a8 <consputc+0x16> cli(); 801007a1: e8 6a fb ff ff call 80100310 <cli> for(;;) ; 801007a6: eb fe jmp 801007a6 <consputc+0x14> } if(c == BACKSPACE){ 801007a8: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp) 801007af: 75 29 jne 801007da <consputc+0x48> uartputc('\b'); uartputc(' '); uartputc('\b'); 801007b1: 83 ec 0c sub $0xc,%esp 801007b4: 6a 08 push $0x8 801007b6: e8 01 6b 00 00 call 801072bc <uartputc> 801007bb: 83 c4 10 add $0x10,%esp 801007be: 83 ec 0c sub $0xc,%esp 801007c1: 6a 20 push $0x20 801007c3: e8 f4 6a 00 00 call 801072bc <uartputc> 801007c8: 83 c4 10 add $0x10,%esp 801007cb: 83 ec 0c sub $0xc,%esp 801007ce: 6a 08 push $0x8 801007d0: e8 e7 6a 00 00 call 801072bc <uartputc> 801007d5: 83 c4 10 add $0x10,%esp 801007d8: eb 0e jmp 801007e8 <consputc+0x56> } else uartputc(c); 801007da: 83 ec 0c sub $0xc,%esp 801007dd: ff 75 08 pushl 0x8(%ebp) 801007e0: e8 d7 6a 00 00 call 801072bc <uartputc> 801007e5: 83 c4 10 add $0x10,%esp cgaputc(c); 801007e8: 83 ec 0c sub $0xc,%esp 801007eb: ff 75 08 pushl 0x8(%ebp) 801007ee: e8 0e fe ff ff call 80100601 <cgaputc> 801007f3: 83 c4 10 add $0x10,%esp } 801007f6: 90 nop 801007f7: c9 leave 801007f8: c3 ret 801007f9 <consoleintr>: #define C(x) ((x)-'@') // Control-x void consoleintr(int (*getc)(void)) { 801007f9: 55 push %ebp 801007fa: 89 e5 mov %esp,%ebp 801007fc: 83 ec 18 sub $0x18,%esp int c, doprocdump = 0; 801007ff: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) acquire(&cons.lock); 80100806: 83 ec 0c sub $0xc,%esp 80100809: 68 e0 c5 10 80 push $0x8010c5e0 8010080e: e8 5d 4d 00 00 call 80105570 <acquire> 80100813: 83 c4 10 add $0x10,%esp while((c = getc()) >= 0){ 80100816: e9 44 01 00 00 jmp 8010095f <consoleintr+0x166> switch(c){ 8010081b: 8b 45 f0 mov -0x10(%ebp),%eax 8010081e: 83 f8 10 cmp $0x10,%eax 80100821: 74 1e je 80100841 <consoleintr+0x48> 80100823: 83 f8 10 cmp $0x10,%eax 80100826: 7f 0a jg 80100832 <consoleintr+0x39> 80100828: 83 f8 08 cmp $0x8,%eax 8010082b: 74 6b je 80100898 <consoleintr+0x9f> 8010082d: e9 9b 00 00 00 jmp 801008cd <consoleintr+0xd4> 80100832: 83 f8 15 cmp $0x15,%eax 80100835: 74 33 je 8010086a <consoleintr+0x71> 80100837: 83 f8 7f cmp $0x7f,%eax 8010083a: 74 5c je 80100898 <consoleintr+0x9f> 8010083c: e9 8c 00 00 00 jmp 801008cd <consoleintr+0xd4> case C('P'): // Process listing. doprocdump = 1; // procdump() locks cons.lock indirectly; invoke later 80100841: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) break; 80100848: e9 12 01 00 00 jmp 8010095f <consoleintr+0x166> case C('U'): // Kill line. while(input.e != input.w && input.buf[(input.e-1) % INPUT_BUF] != '\n'){ input.e--; 8010084d: a1 28 18 11 80 mov 0x80111828,%eax 80100852: 83 e8 01 sub $0x1,%eax 80100855: a3 28 18 11 80 mov %eax,0x80111828 consputc(BACKSPACE); 8010085a: 83 ec 0c sub $0xc,%esp 8010085d: 68 00 01 00 00 push $0x100 80100862: e8 2b ff ff ff call 80100792 <consputc> 80100867: 83 c4 10 add $0x10,%esp switch(c){ case C('P'): // Process listing. doprocdump = 1; // procdump() locks cons.lock indirectly; invoke later break; case C('U'): // Kill line. while(input.e != input.w && 8010086a: 8b 15 28 18 11 80 mov 0x80111828,%edx 80100870: a1 24 18 11 80 mov 0x80111824,%eax 80100875: 39 c2 cmp %eax,%edx 80100877: 0f 84 e2 00 00 00 je 8010095f <consoleintr+0x166> input.buf[(input.e-1) % INPUT_BUF] != '\n'){ 8010087d: a1 28 18 11 80 mov 0x80111828,%eax 80100882: 83 e8 01 sub $0x1,%eax 80100885: 83 e0 7f and $0x7f,%eax 80100888: 0f b6 80 a0 17 11 80 movzbl -0x7feee860(%eax),%eax switch(c){ case C('P'): // Process listing. doprocdump = 1; // procdump() locks cons.lock indirectly; invoke later break; case C('U'): // Kill line. while(input.e != input.w && 8010088f: 3c 0a cmp $0xa,%al 80100891: 75 ba jne 8010084d <consoleintr+0x54> input.buf[(input.e-1) % INPUT_BUF] != '\n'){ input.e--; consputc(BACKSPACE); } break; 80100893: e9 c7 00 00 00 jmp 8010095f <consoleintr+0x166> case C('H'): case '\x7f': // Backspace if(input.e != input.w){ 80100898: 8b 15 28 18 11 80 mov 0x80111828,%edx 8010089e: a1 24 18 11 80 mov 0x80111824,%eax 801008a3: 39 c2 cmp %eax,%edx 801008a5: 0f 84 b4 00 00 00 je 8010095f <consoleintr+0x166> input.e--; 801008ab: a1 28 18 11 80 mov 0x80111828,%eax 801008b0: 83 e8 01 sub $0x1,%eax 801008b3: a3 28 18 11 80 mov %eax,0x80111828 consputc(BACKSPACE); 801008b8: 83 ec 0c sub $0xc,%esp 801008bb: 68 00 01 00 00 push $0x100 801008c0: e8 cd fe ff ff call 80100792 <consputc> 801008c5: 83 c4 10 add $0x10,%esp } break; 801008c8: e9 92 00 00 00 jmp 8010095f <consoleintr+0x166> default: if(c != 0 && input.e-input.r < INPUT_BUF){ 801008cd: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801008d1: 0f 84 87 00 00 00 je 8010095e <consoleintr+0x165> 801008d7: 8b 15 28 18 11 80 mov 0x80111828,%edx 801008dd: a1 20 18 11 80 mov 0x80111820,%eax 801008e2: 29 c2 sub %eax,%edx 801008e4: 89 d0 mov %edx,%eax 801008e6: 83 f8 7f cmp $0x7f,%eax 801008e9: 77 73 ja 8010095e <consoleintr+0x165> c = (c == '\r') ? '\n' : c; 801008eb: 83 7d f0 0d cmpl $0xd,-0x10(%ebp) 801008ef: 74 05 je 801008f6 <consoleintr+0xfd> 801008f1: 8b 45 f0 mov -0x10(%ebp),%eax 801008f4: eb 05 jmp 801008fb <consoleintr+0x102> 801008f6: b8 0a 00 00 00 mov $0xa,%eax 801008fb: 89 45 f0 mov %eax,-0x10(%ebp) input.buf[input.e++ % INPUT_BUF] = c; 801008fe: a1 28 18 11 80 mov 0x80111828,%eax 80100903: 8d 50 01 lea 0x1(%eax),%edx 80100906: 89 15 28 18 11 80 mov %edx,0x80111828 8010090c: 83 e0 7f and $0x7f,%eax 8010090f: 8b 55 f0 mov -0x10(%ebp),%edx 80100912: 88 90 a0 17 11 80 mov %dl,-0x7feee860(%eax) consputc(c); 80100918: 83 ec 0c sub $0xc,%esp 8010091b: ff 75 f0 pushl -0x10(%ebp) 8010091e: e8 6f fe ff ff call 80100792 <consputc> 80100923: 83 c4 10 add $0x10,%esp if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ 80100926: 83 7d f0 0a cmpl $0xa,-0x10(%ebp) 8010092a: 74 18 je 80100944 <consoleintr+0x14b> 8010092c: 83 7d f0 04 cmpl $0x4,-0x10(%ebp) 80100930: 74 12 je 80100944 <consoleintr+0x14b> 80100932: a1 28 18 11 80 mov 0x80111828,%eax 80100937: 8b 15 20 18 11 80 mov 0x80111820,%edx 8010093d: 83 ea 80 sub $0xffffff80,%edx 80100940: 39 d0 cmp %edx,%eax 80100942: 75 1a jne 8010095e <consoleintr+0x165> input.w = input.e; 80100944: a1 28 18 11 80 mov 0x80111828,%eax 80100949: a3 24 18 11 80 mov %eax,0x80111824 wakeup(&input.r); 8010094e: 83 ec 0c sub $0xc,%esp 80100951: 68 20 18 11 80 push $0x80111820 80100956: e8 f3 49 00 00 call 8010534e <wakeup> 8010095b: 83 c4 10 add $0x10,%esp } } break; 8010095e: 90 nop consoleintr(int (*getc)(void)) { int c, doprocdump = 0; acquire(&cons.lock); while((c = getc()) >= 0){ 8010095f: 8b 45 08 mov 0x8(%ebp),%eax 80100962: ff d0 call *%eax 80100964: 89 45 f0 mov %eax,-0x10(%ebp) 80100967: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8010096b: 0f 89 aa fe ff ff jns 8010081b <consoleintr+0x22> } } break; } } release(&cons.lock); 80100971: 83 ec 0c sub $0xc,%esp 80100974: 68 e0 c5 10 80 push $0x8010c5e0 80100979: e8 59 4c 00 00 call 801055d7 <release> 8010097e: 83 c4 10 add $0x10,%esp if(doprocdump) { 80100981: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80100985: 74 05 je 8010098c <consoleintr+0x193> procdump(); // now call procdump() wo. cons.lock held 80100987: e8 80 4a 00 00 call 8010540c <procdump> } } 8010098c: 90 nop 8010098d: c9 leave 8010098e: c3 ret 8010098f <consoleread>: int consoleread(struct inode *ip, char *dst, int n) { 8010098f: 55 push %ebp 80100990: 89 e5 mov %esp,%ebp 80100992: 83 ec 18 sub $0x18,%esp uint target; int c; iunlock(ip); 80100995: 83 ec 0c sub $0xc,%esp 80100998: ff 75 08 pushl 0x8(%ebp) 8010099b: e8 de 10 00 00 call 80101a7e <iunlock> 801009a0: 83 c4 10 add $0x10,%esp target = n; 801009a3: 8b 45 10 mov 0x10(%ebp),%eax 801009a6: 89 45 f4 mov %eax,-0xc(%ebp) acquire(&cons.lock); 801009a9: 83 ec 0c sub $0xc,%esp 801009ac: 68 e0 c5 10 80 push $0x8010c5e0 801009b1: e8 ba 4b 00 00 call 80105570 <acquire> 801009b6: 83 c4 10 add $0x10,%esp while(n > 0){ 801009b9: e9 ac 00 00 00 jmp 80100a6a <consoleread+0xdb> while(input.r == input.w){ if(proc->killed){ 801009be: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801009c4: 8b 40 24 mov 0x24(%eax),%eax 801009c7: 85 c0 test %eax,%eax 801009c9: 74 28 je 801009f3 <consoleread+0x64> release(&cons.lock); 801009cb: 83 ec 0c sub $0xc,%esp 801009ce: 68 e0 c5 10 80 push $0x8010c5e0 801009d3: e8 ff 4b 00 00 call 801055d7 <release> 801009d8: 83 c4 10 add $0x10,%esp ilock(ip); 801009db: 83 ec 0c sub $0xc,%esp 801009de: ff 75 08 pushl 0x8(%ebp) 801009e1: e8 3a 0f 00 00 call 80101920 <ilock> 801009e6: 83 c4 10 add $0x10,%esp return -1; 801009e9: b8 ff ff ff ff mov $0xffffffff,%eax 801009ee: e9 ab 00 00 00 jmp 80100a9e <consoleread+0x10f> } sleep(&input.r, &cons.lock); 801009f3: 83 ec 08 sub $0x8,%esp 801009f6: 68 e0 c5 10 80 push $0x8010c5e0 801009fb: 68 20 18 11 80 push $0x80111820 80100a00: e8 5b 48 00 00 call 80105260 <sleep> 80100a05: 83 c4 10 add $0x10,%esp iunlock(ip); target = n; acquire(&cons.lock); while(n > 0){ while(input.r == input.w){ 80100a08: 8b 15 20 18 11 80 mov 0x80111820,%edx 80100a0e: a1 24 18 11 80 mov 0x80111824,%eax 80100a13: 39 c2 cmp %eax,%edx 80100a15: 74 a7 je 801009be <consoleread+0x2f> ilock(ip); return -1; } sleep(&input.r, &cons.lock); } c = input.buf[input.r++ % INPUT_BUF]; 80100a17: a1 20 18 11 80 mov 0x80111820,%eax 80100a1c: 8d 50 01 lea 0x1(%eax),%edx 80100a1f: 89 15 20 18 11 80 mov %edx,0x80111820 80100a25: 83 e0 7f and $0x7f,%eax 80100a28: 0f b6 80 a0 17 11 80 movzbl -0x7feee860(%eax),%eax 80100a2f: 0f be c0 movsbl %al,%eax 80100a32: 89 45 f0 mov %eax,-0x10(%ebp) if(c == C('D')){ // EOF 80100a35: 83 7d f0 04 cmpl $0x4,-0x10(%ebp) 80100a39: 75 17 jne 80100a52 <consoleread+0xc3> if(n < target){ 80100a3b: 8b 45 10 mov 0x10(%ebp),%eax 80100a3e: 3b 45 f4 cmp -0xc(%ebp),%eax 80100a41: 73 2f jae 80100a72 <consoleread+0xe3> // Save ^D for next time, to make sure // caller gets a 0-byte result. input.r--; 80100a43: a1 20 18 11 80 mov 0x80111820,%eax 80100a48: 83 e8 01 sub $0x1,%eax 80100a4b: a3 20 18 11 80 mov %eax,0x80111820 } break; 80100a50: eb 20 jmp 80100a72 <consoleread+0xe3> } *dst++ = c; 80100a52: 8b 45 0c mov 0xc(%ebp),%eax 80100a55: 8d 50 01 lea 0x1(%eax),%edx 80100a58: 89 55 0c mov %edx,0xc(%ebp) 80100a5b: 8b 55 f0 mov -0x10(%ebp),%edx 80100a5e: 88 10 mov %dl,(%eax) --n; 80100a60: 83 6d 10 01 subl $0x1,0x10(%ebp) if(c == '\n') 80100a64: 83 7d f0 0a cmpl $0xa,-0x10(%ebp) 80100a68: 74 0b je 80100a75 <consoleread+0xe6> int c; iunlock(ip); target = n; acquire(&cons.lock); while(n > 0){ 80100a6a: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80100a6e: 7f 98 jg 80100a08 <consoleread+0x79> 80100a70: eb 04 jmp 80100a76 <consoleread+0xe7> if(n < target){ // Save ^D for next time, to make sure // caller gets a 0-byte result. input.r--; } break; 80100a72: 90 nop 80100a73: eb 01 jmp 80100a76 <consoleread+0xe7> } *dst++ = c; --n; if(c == '\n') break; 80100a75: 90 nop } release(&cons.lock); 80100a76: 83 ec 0c sub $0xc,%esp 80100a79: 68 e0 c5 10 80 push $0x8010c5e0 80100a7e: e8 54 4b 00 00 call 801055d7 <release> 80100a83: 83 c4 10 add $0x10,%esp ilock(ip); 80100a86: 83 ec 0c sub $0xc,%esp 80100a89: ff 75 08 pushl 0x8(%ebp) 80100a8c: e8 8f 0e 00 00 call 80101920 <ilock> 80100a91: 83 c4 10 add $0x10,%esp return target - n; 80100a94: 8b 45 10 mov 0x10(%ebp),%eax 80100a97: 8b 55 f4 mov -0xc(%ebp),%edx 80100a9a: 29 c2 sub %eax,%edx 80100a9c: 89 d0 mov %edx,%eax } 80100a9e: c9 leave 80100a9f: c3 ret 80100aa0 <consolewrite>: int consolewrite(struct inode *ip, char *buf, int n) { 80100aa0: 55 push %ebp 80100aa1: 89 e5 mov %esp,%ebp 80100aa3: 83 ec 18 sub $0x18,%esp int i; iunlock(ip); 80100aa6: 83 ec 0c sub $0xc,%esp 80100aa9: ff 75 08 pushl 0x8(%ebp) 80100aac: e8 cd 0f 00 00 call 80101a7e <iunlock> 80100ab1: 83 c4 10 add $0x10,%esp acquire(&cons.lock); 80100ab4: 83 ec 0c sub $0xc,%esp 80100ab7: 68 e0 c5 10 80 push $0x8010c5e0 80100abc: e8 af 4a 00 00 call 80105570 <acquire> 80100ac1: 83 c4 10 add $0x10,%esp for(i = 0; i < n; i++) 80100ac4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80100acb: eb 21 jmp 80100aee <consolewrite+0x4e> consputc(buf[i] & 0xff); 80100acd: 8b 55 f4 mov -0xc(%ebp),%edx 80100ad0: 8b 45 0c mov 0xc(%ebp),%eax 80100ad3: 01 d0 add %edx,%eax 80100ad5: 0f b6 00 movzbl (%eax),%eax 80100ad8: 0f be c0 movsbl %al,%eax 80100adb: 0f b6 c0 movzbl %al,%eax 80100ade: 83 ec 0c sub $0xc,%esp 80100ae1: 50 push %eax 80100ae2: e8 ab fc ff ff call 80100792 <consputc> 80100ae7: 83 c4 10 add $0x10,%esp { int i; iunlock(ip); acquire(&cons.lock); for(i = 0; i < n; i++) 80100aea: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80100aee: 8b 45 f4 mov -0xc(%ebp),%eax 80100af1: 3b 45 10 cmp 0x10(%ebp),%eax 80100af4: 7c d7 jl 80100acd <consolewrite+0x2d> consputc(buf[i] & 0xff); release(&cons.lock); 80100af6: 83 ec 0c sub $0xc,%esp 80100af9: 68 e0 c5 10 80 push $0x8010c5e0 80100afe: e8 d4 4a 00 00 call 801055d7 <release> 80100b03: 83 c4 10 add $0x10,%esp ilock(ip); 80100b06: 83 ec 0c sub $0xc,%esp 80100b09: ff 75 08 pushl 0x8(%ebp) 80100b0c: e8 0f 0e 00 00 call 80101920 <ilock> 80100b11: 83 c4 10 add $0x10,%esp return n; 80100b14: 8b 45 10 mov 0x10(%ebp),%eax } 80100b17: c9 leave 80100b18: c3 ret 80100b19 <consoleinit>: void consoleinit(void) { 80100b19: 55 push %ebp 80100b1a: 89 e5 mov %esp,%ebp 80100b1c: 83 ec 08 sub $0x8,%esp initlock(&cons.lock, "console"); 80100b1f: 83 ec 08 sub $0x8,%esp 80100b22: 68 92 8d 10 80 push $0x80108d92 80100b27: 68 e0 c5 10 80 push $0x8010c5e0 80100b2c: e8 1d 4a 00 00 call 8010554e <initlock> 80100b31: 83 c4 10 add $0x10,%esp devsw[CONSOLE].write = consolewrite; 80100b34: c7 05 ec 21 11 80 a0 movl $0x80100aa0,0x801121ec 80100b3b: 0a 10 80 devsw[CONSOLE].read = consoleread; 80100b3e: c7 05 e8 21 11 80 8f movl $0x8010098f,0x801121e8 80100b45: 09 10 80 cons.locking = 1; 80100b48: c7 05 14 c6 10 80 01 movl $0x1,0x8010c614 80100b4f: 00 00 00 picenable(IRQ_KBD); 80100b52: 83 ec 0c sub $0xc,%esp 80100b55: 6a 01 push $0x1 80100b57: e8 6f 33 00 00 call 80103ecb <picenable> 80100b5c: 83 c4 10 add $0x10,%esp ioapicenable(IRQ_KBD, 0); 80100b5f: 83 ec 08 sub $0x8,%esp 80100b62: 6a 00 push $0x0 80100b64: 6a 01 push $0x1 80100b66: e8 25 1f 00 00 call 80102a90 <ioapicenable> 80100b6b: 83 c4 10 add $0x10,%esp } 80100b6e: 90 nop 80100b6f: c9 leave 80100b70: c3 ret 80100b71 <exec>: #include "x86.h" #include "elf.h" int exec(char *path, char **argv) { 80100b71: 55 push %ebp 80100b72: 89 e5 mov %esp,%ebp 80100b74: 81 ec 18 01 00 00 sub $0x118,%esp struct elfhdr elf; struct inode *ip; struct proghdr ph; pde_t *pgdir, *oldpgdir; begin_op(); 80100b7a: e8 a8 29 00 00 call 80103527 <begin_op> if((ip = namei(path)) == 0){ 80100b7f: 83 ec 0c sub $0xc,%esp 80100b82: ff 75 08 pushl 0x8(%ebp) 80100b85: e8 54 19 00 00 call 801024de <namei> 80100b8a: 83 c4 10 add $0x10,%esp 80100b8d: 89 45 d8 mov %eax,-0x28(%ebp) 80100b90: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 80100b94: 75 0f jne 80100ba5 <exec+0x34> end_op(); 80100b96: e8 18 2a 00 00 call 801035b3 <end_op> return -1; 80100b9b: b8 ff ff ff ff mov $0xffffffff,%eax 80100ba0: e9 ce 03 00 00 jmp 80100f73 <exec+0x402> } ilock(ip); 80100ba5: 83 ec 0c sub $0xc,%esp 80100ba8: ff 75 d8 pushl -0x28(%ebp) 80100bab: e8 70 0d 00 00 call 80101920 <ilock> 80100bb0: 83 c4 10 add $0x10,%esp pgdir = 0; 80100bb3: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf)) 80100bba: 6a 34 push $0x34 80100bbc: 6a 00 push $0x0 80100bbe: 8d 85 0c ff ff ff lea -0xf4(%ebp),%eax 80100bc4: 50 push %eax 80100bc5: ff 75 d8 pushl -0x28(%ebp) 80100bc8: e8 c1 12 00 00 call 80101e8e <readi> 80100bcd: 83 c4 10 add $0x10,%esp 80100bd0: 83 f8 33 cmp $0x33,%eax 80100bd3: 0f 86 49 03 00 00 jbe 80100f22 <exec+0x3b1> goto bad; if(elf.magic != ELF_MAGIC) 80100bd9: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax 80100bdf: 3d 7f 45 4c 46 cmp $0x464c457f,%eax 80100be4: 0f 85 3b 03 00 00 jne 80100f25 <exec+0x3b4> goto bad; if((pgdir = setupkvm()) == 0) 80100bea: e8 38 78 00 00 call 80108427 <setupkvm> 80100bef: 89 45 d4 mov %eax,-0x2c(%ebp) 80100bf2: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) 80100bf6: 0f 84 2c 03 00 00 je 80100f28 <exec+0x3b7> goto bad; // Load program into memory. sz = 0; 80100bfc: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100c03: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) 80100c0a: 8b 85 28 ff ff ff mov -0xd8(%ebp),%eax 80100c10: 89 45 e8 mov %eax,-0x18(%ebp) 80100c13: e9 ab 00 00 00 jmp 80100cc3 <exec+0x152> if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) 80100c18: 8b 45 e8 mov -0x18(%ebp),%eax 80100c1b: 6a 20 push $0x20 80100c1d: 50 push %eax 80100c1e: 8d 85 ec fe ff ff lea -0x114(%ebp),%eax 80100c24: 50 push %eax 80100c25: ff 75 d8 pushl -0x28(%ebp) 80100c28: e8 61 12 00 00 call 80101e8e <readi> 80100c2d: 83 c4 10 add $0x10,%esp 80100c30: 83 f8 20 cmp $0x20,%eax 80100c33: 0f 85 f2 02 00 00 jne 80100f2b <exec+0x3ba> goto bad; if(ph.type != ELF_PROG_LOAD) 80100c39: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 80100c3f: 83 f8 01 cmp $0x1,%eax 80100c42: 75 71 jne 80100cb5 <exec+0x144> continue; if(ph.memsz < ph.filesz) 80100c44: 8b 95 00 ff ff ff mov -0x100(%ebp),%edx 80100c4a: 8b 85 fc fe ff ff mov -0x104(%ebp),%eax 80100c50: 39 c2 cmp %eax,%edx 80100c52: 0f 82 d6 02 00 00 jb 80100f2e <exec+0x3bd> goto bad; if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) 80100c58: 8b 95 f4 fe ff ff mov -0x10c(%ebp),%edx 80100c5e: 8b 85 00 ff ff ff mov -0x100(%ebp),%eax 80100c64: 01 d0 add %edx,%eax 80100c66: 83 ec 04 sub $0x4,%esp 80100c69: 50 push %eax 80100c6a: ff 75 e0 pushl -0x20(%ebp) 80100c6d: ff 75 d4 pushl -0x2c(%ebp) 80100c70: e8 59 7b 00 00 call 801087ce <allocuvm> 80100c75: 83 c4 10 add $0x10,%esp 80100c78: 89 45 e0 mov %eax,-0x20(%ebp) 80100c7b: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80100c7f: 0f 84 ac 02 00 00 je 80100f31 <exec+0x3c0> goto bad; if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) 80100c85: 8b 95 fc fe ff ff mov -0x104(%ebp),%edx 80100c8b: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax 80100c91: 8b 8d f4 fe ff ff mov -0x10c(%ebp),%ecx 80100c97: 83 ec 0c sub $0xc,%esp 80100c9a: 52 push %edx 80100c9b: 50 push %eax 80100c9c: ff 75 d8 pushl -0x28(%ebp) 80100c9f: 51 push %ecx 80100ca0: ff 75 d4 pushl -0x2c(%ebp) 80100ca3: e8 4f 7a 00 00 call 801086f7 <loaduvm> 80100ca8: 83 c4 20 add $0x20,%esp 80100cab: 85 c0 test %eax,%eax 80100cad: 0f 88 81 02 00 00 js 80100f34 <exec+0x3c3> 80100cb3: eb 01 jmp 80100cb6 <exec+0x145> sz = 0; for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) goto bad; if(ph.type != ELF_PROG_LOAD) continue; 80100cb5: 90 nop if((pgdir = setupkvm()) == 0) goto bad; // Load program into memory. sz = 0; for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100cb6: 83 45 ec 01 addl $0x1,-0x14(%ebp) 80100cba: 8b 45 e8 mov -0x18(%ebp),%eax 80100cbd: 83 c0 20 add $0x20,%eax 80100cc0: 89 45 e8 mov %eax,-0x18(%ebp) 80100cc3: 0f b7 85 38 ff ff ff movzwl -0xc8(%ebp),%eax 80100cca: 0f b7 c0 movzwl %ax,%eax 80100ccd: 3b 45 ec cmp -0x14(%ebp),%eax 80100cd0: 0f 8f 42 ff ff ff jg 80100c18 <exec+0xa7> if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) goto bad; if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) goto bad; } iunlockput(ip); 80100cd6: 83 ec 0c sub $0xc,%esp 80100cd9: ff 75 d8 pushl -0x28(%ebp) 80100cdc: e8 ff 0e 00 00 call 80101be0 <iunlockput> 80100ce1: 83 c4 10 add $0x10,%esp end_op(); 80100ce4: e8 ca 28 00 00 call 801035b3 <end_op> ip = 0; 80100ce9: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp) // Allocate two pages at the next page boundary. // Make the first inaccessible. Use the second as the user stack. sz = PGROUNDUP(sz); 80100cf0: 8b 45 e0 mov -0x20(%ebp),%eax 80100cf3: 05 ff 0f 00 00 add $0xfff,%eax 80100cf8: 25 00 f0 ff ff and $0xfffff000,%eax 80100cfd: 89 45 e0 mov %eax,-0x20(%ebp) if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) 80100d00: 8b 45 e0 mov -0x20(%ebp),%eax 80100d03: 05 00 20 00 00 add $0x2000,%eax 80100d08: 83 ec 04 sub $0x4,%esp 80100d0b: 50 push %eax 80100d0c: ff 75 e0 pushl -0x20(%ebp) 80100d0f: ff 75 d4 pushl -0x2c(%ebp) 80100d12: e8 b7 7a 00 00 call 801087ce <allocuvm> 80100d17: 83 c4 10 add $0x10,%esp 80100d1a: 89 45 e0 mov %eax,-0x20(%ebp) 80100d1d: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80100d21: 0f 84 10 02 00 00 je 80100f37 <exec+0x3c6> goto bad; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); 80100d27: 8b 45 e0 mov -0x20(%ebp),%eax 80100d2a: 2d 00 20 00 00 sub $0x2000,%eax 80100d2f: 83 ec 08 sub $0x8,%esp 80100d32: 50 push %eax 80100d33: ff 75 d4 pushl -0x2c(%ebp) 80100d36: e8 b9 7c 00 00 call 801089f4 <clearpteu> 80100d3b: 83 c4 10 add $0x10,%esp sp = sz; 80100d3e: 8b 45 e0 mov -0x20(%ebp),%eax 80100d41: 89 45 dc mov %eax,-0x24(%ebp) // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100d44: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 80100d4b: e9 96 00 00 00 jmp 80100de6 <exec+0x275> if(argc >= MAXARG) 80100d50: 83 7d e4 1f cmpl $0x1f,-0x1c(%ebp) 80100d54: 0f 87 e0 01 00 00 ja 80100f3a <exec+0x3c9> goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100d5a: 8b 45 e4 mov -0x1c(%ebp),%eax 80100d5d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80100d64: 8b 45 0c mov 0xc(%ebp),%eax 80100d67: 01 d0 add %edx,%eax 80100d69: 8b 00 mov (%eax),%eax 80100d6b: 83 ec 0c sub $0xc,%esp 80100d6e: 50 push %eax 80100d6f: e8 ac 4c 00 00 call 80105a20 <strlen> 80100d74: 83 c4 10 add $0x10,%esp 80100d77: 89 c2 mov %eax,%edx 80100d79: 8b 45 dc mov -0x24(%ebp),%eax 80100d7c: 29 d0 sub %edx,%eax 80100d7e: 83 e8 01 sub $0x1,%eax 80100d81: 83 e0 fc and $0xfffffffc,%eax 80100d84: 89 45 dc mov %eax,-0x24(%ebp) if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80100d87: 8b 45 e4 mov -0x1c(%ebp),%eax 80100d8a: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80100d91: 8b 45 0c mov 0xc(%ebp),%eax 80100d94: 01 d0 add %edx,%eax 80100d96: 8b 00 mov (%eax),%eax 80100d98: 83 ec 0c sub $0xc,%esp 80100d9b: 50 push %eax 80100d9c: e8 7f 4c 00 00 call 80105a20 <strlen> 80100da1: 83 c4 10 add $0x10,%esp 80100da4: 83 c0 01 add $0x1,%eax 80100da7: 89 c1 mov %eax,%ecx 80100da9: 8b 45 e4 mov -0x1c(%ebp),%eax 80100dac: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80100db3: 8b 45 0c mov 0xc(%ebp),%eax 80100db6: 01 d0 add %edx,%eax 80100db8: 8b 00 mov (%eax),%eax 80100dba: 51 push %ecx 80100dbb: 50 push %eax 80100dbc: ff 75 dc pushl -0x24(%ebp) 80100dbf: ff 75 d4 pushl -0x2c(%ebp) 80100dc2: e8 e4 7d 00 00 call 80108bab <copyout> 80100dc7: 83 c4 10 add $0x10,%esp 80100dca: 85 c0 test %eax,%eax 80100dcc: 0f 88 6b 01 00 00 js 80100f3d <exec+0x3cc> goto bad; ustack[3+argc] = sp; 80100dd2: 8b 45 e4 mov -0x1c(%ebp),%eax 80100dd5: 8d 50 03 lea 0x3(%eax),%edx 80100dd8: 8b 45 dc mov -0x24(%ebp),%eax 80100ddb: 89 84 95 40 ff ff ff mov %eax,-0xc0(%ebp,%edx,4) goto bad; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100de2: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 80100de6: 8b 45 e4 mov -0x1c(%ebp),%eax 80100de9: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80100df0: 8b 45 0c mov 0xc(%ebp),%eax 80100df3: 01 d0 add %edx,%eax 80100df5: 8b 00 mov (%eax),%eax 80100df7: 85 c0 test %eax,%eax 80100df9: 0f 85 51 ff ff ff jne 80100d50 <exec+0x1df> 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; 80100dff: 8b 45 e4 mov -0x1c(%ebp),%eax 80100e02: 83 c0 03 add $0x3,%eax 80100e05: c7 84 85 40 ff ff ff movl $0x0,-0xc0(%ebp,%eax,4) 80100e0c: 00 00 00 00 ustack[0] = 0xffffffff; // fake return PC 80100e10: c7 85 40 ff ff ff ff movl $0xffffffff,-0xc0(%ebp) 80100e17: ff ff ff ustack[1] = argc; 80100e1a: 8b 45 e4 mov -0x1c(%ebp),%eax 80100e1d: 89 85 44 ff ff ff mov %eax,-0xbc(%ebp) ustack[2] = sp - (argc+1)*4; // argv pointer 80100e23: 8b 45 e4 mov -0x1c(%ebp),%eax 80100e26: 83 c0 01 add $0x1,%eax 80100e29: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80100e30: 8b 45 dc mov -0x24(%ebp),%eax 80100e33: 29 d0 sub %edx,%eax 80100e35: 89 85 48 ff ff ff mov %eax,-0xb8(%ebp) sp -= (3+argc+1) * 4; 80100e3b: 8b 45 e4 mov -0x1c(%ebp),%eax 80100e3e: 83 c0 04 add $0x4,%eax 80100e41: c1 e0 02 shl $0x2,%eax 80100e44: 29 45 dc sub %eax,-0x24(%ebp) if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) 80100e47: 8b 45 e4 mov -0x1c(%ebp),%eax 80100e4a: 83 c0 04 add $0x4,%eax 80100e4d: c1 e0 02 shl $0x2,%eax 80100e50: 50 push %eax 80100e51: 8d 85 40 ff ff ff lea -0xc0(%ebp),%eax 80100e57: 50 push %eax 80100e58: ff 75 dc pushl -0x24(%ebp) 80100e5b: ff 75 d4 pushl -0x2c(%ebp) 80100e5e: e8 48 7d 00 00 call 80108bab <copyout> 80100e63: 83 c4 10 add $0x10,%esp 80100e66: 85 c0 test %eax,%eax 80100e68: 0f 88 d2 00 00 00 js 80100f40 <exec+0x3cf> goto bad; // Save program name for debugging. for(last=s=path; *s; s++) 80100e6e: 8b 45 08 mov 0x8(%ebp),%eax 80100e71: 89 45 f4 mov %eax,-0xc(%ebp) 80100e74: 8b 45 f4 mov -0xc(%ebp),%eax 80100e77: 89 45 f0 mov %eax,-0x10(%ebp) 80100e7a: eb 17 jmp 80100e93 <exec+0x322> if(*s == '/') 80100e7c: 8b 45 f4 mov -0xc(%ebp),%eax 80100e7f: 0f b6 00 movzbl (%eax),%eax 80100e82: 3c 2f cmp $0x2f,%al 80100e84: 75 09 jne 80100e8f <exec+0x31e> last = s+1; 80100e86: 8b 45 f4 mov -0xc(%ebp),%eax 80100e89: 83 c0 01 add $0x1,%eax 80100e8c: 89 45 f0 mov %eax,-0x10(%ebp) sp -= (3+argc+1) * 4; if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) goto bad; // Save program name for debugging. for(last=s=path; *s; s++) 80100e8f: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80100e93: 8b 45 f4 mov -0xc(%ebp),%eax 80100e96: 0f b6 00 movzbl (%eax),%eax 80100e99: 84 c0 test %al,%al 80100e9b: 75 df jne 80100e7c <exec+0x30b> if(*s == '/') last = s+1; safestrcpy(proc->name, last, sizeof(proc->name)); 80100e9d: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100ea3: 83 c0 6c add $0x6c,%eax 80100ea6: 83 ec 04 sub $0x4,%esp 80100ea9: 6a 10 push $0x10 80100eab: ff 75 f0 pushl -0x10(%ebp) 80100eae: 50 push %eax 80100eaf: e8 22 4b 00 00 call 801059d6 <safestrcpy> 80100eb4: 83 c4 10 add $0x10,%esp // Commit to the user image. oldpgdir = proc->pgdir; 80100eb7: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100ebd: 8b 40 04 mov 0x4(%eax),%eax 80100ec0: 89 45 d0 mov %eax,-0x30(%ebp) proc->pgdir = pgdir; 80100ec3: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100ec9: 8b 55 d4 mov -0x2c(%ebp),%edx 80100ecc: 89 50 04 mov %edx,0x4(%eax) proc->sz = sz; 80100ecf: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100ed5: 8b 55 e0 mov -0x20(%ebp),%edx 80100ed8: 89 10 mov %edx,(%eax) proc->tf->eip = elf.entry; // main 80100eda: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100ee0: 8b 40 18 mov 0x18(%eax),%eax 80100ee3: 8b 95 24 ff ff ff mov -0xdc(%ebp),%edx 80100ee9: 89 50 38 mov %edx,0x38(%eax) proc->tf->esp = sp; 80100eec: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100ef2: 8b 40 18 mov 0x18(%eax),%eax 80100ef5: 8b 55 dc mov -0x24(%ebp),%edx 80100ef8: 89 50 44 mov %edx,0x44(%eax) switchuvm(proc); 80100efb: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80100f01: 83 ec 0c sub $0xc,%esp 80100f04: 50 push %eax 80100f05: e8 04 76 00 00 call 8010850e <switchuvm> 80100f0a: 83 c4 10 add $0x10,%esp freevm(oldpgdir); 80100f0d: 83 ec 0c sub $0xc,%esp 80100f10: ff 75 d0 pushl -0x30(%ebp) 80100f13: e8 3c 7a 00 00 call 80108954 <freevm> 80100f18: 83 c4 10 add $0x10,%esp return 0; 80100f1b: b8 00 00 00 00 mov $0x0,%eax 80100f20: eb 51 jmp 80100f73 <exec+0x402> ilock(ip); pgdir = 0; // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf)) goto bad; 80100f22: 90 nop 80100f23: eb 1c jmp 80100f41 <exec+0x3d0> if(elf.magic != ELF_MAGIC) goto bad; 80100f25: 90 nop 80100f26: eb 19 jmp 80100f41 <exec+0x3d0> if((pgdir = setupkvm()) == 0) goto bad; 80100f28: 90 nop 80100f29: eb 16 jmp 80100f41 <exec+0x3d0> // Load program into memory. sz = 0; for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) goto bad; 80100f2b: 90 nop 80100f2c: eb 13 jmp 80100f41 <exec+0x3d0> if(ph.type != ELF_PROG_LOAD) continue; if(ph.memsz < ph.filesz) goto bad; 80100f2e: 90 nop 80100f2f: eb 10 jmp 80100f41 <exec+0x3d0> if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) goto bad; 80100f31: 90 nop 80100f32: eb 0d jmp 80100f41 <exec+0x3d0> if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) goto bad; 80100f34: 90 nop 80100f35: eb 0a jmp 80100f41 <exec+0x3d0> // 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; 80100f37: 90 nop 80100f38: eb 07 jmp 80100f41 <exec+0x3d0> sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { if(argc >= MAXARG) goto bad; 80100f3a: 90 nop 80100f3b: eb 04 jmp 80100f41 <exec+0x3d0> sp = (sp - (strlen(argv[argc]) + 1)) & ~3; if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) goto bad; 80100f3d: 90 nop 80100f3e: eb 01 jmp 80100f41 <exec+0x3d0> ustack[1] = argc; ustack[2] = sp - (argc+1)*4; // argv pointer sp -= (3+argc+1) * 4; if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) goto bad; 80100f40: 90 nop switchuvm(proc); freevm(oldpgdir); return 0; bad: if(pgdir) 80100f41: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) 80100f45: 74 0e je 80100f55 <exec+0x3e4> freevm(pgdir); 80100f47: 83 ec 0c sub $0xc,%esp 80100f4a: ff 75 d4 pushl -0x2c(%ebp) 80100f4d: e8 02 7a 00 00 call 80108954 <freevm> 80100f52: 83 c4 10 add $0x10,%esp if(ip){ 80100f55: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 80100f59: 74 13 je 80100f6e <exec+0x3fd> iunlockput(ip); 80100f5b: 83 ec 0c sub $0xc,%esp 80100f5e: ff 75 d8 pushl -0x28(%ebp) 80100f61: e8 7a 0c 00 00 call 80101be0 <iunlockput> 80100f66: 83 c4 10 add $0x10,%esp end_op(); 80100f69: e8 45 26 00 00 call 801035b3 <end_op> } return -1; 80100f6e: b8 ff ff ff ff mov $0xffffffff,%eax } 80100f73: c9 leave 80100f74: c3 ret 80100f75 <fileinit>: struct file file[NFILE]; } ftable; void fileinit(void) { 80100f75: 55 push %ebp 80100f76: 89 e5 mov %esp,%ebp 80100f78: 83 ec 08 sub $0x8,%esp initlock(&ftable.lock, "ftable"); 80100f7b: 83 ec 08 sub $0x8,%esp 80100f7e: 68 9a 8d 10 80 push $0x80108d9a 80100f83: 68 40 18 11 80 push $0x80111840 80100f88: e8 c1 45 00 00 call 8010554e <initlock> 80100f8d: 83 c4 10 add $0x10,%esp } 80100f90: 90 nop 80100f91: c9 leave 80100f92: c3 ret 80100f93 <filealloc>: // Allocate a file structure. struct file* filealloc(void) { 80100f93: 55 push %ebp 80100f94: 89 e5 mov %esp,%ebp 80100f96: 83 ec 18 sub $0x18,%esp struct file *f; acquire(&ftable.lock); 80100f99: 83 ec 0c sub $0xc,%esp 80100f9c: 68 40 18 11 80 push $0x80111840 80100fa1: e8 ca 45 00 00 call 80105570 <acquire> 80100fa6: 83 c4 10 add $0x10,%esp for(f = ftable.file; f < ftable.file + NFILE; f++){ 80100fa9: c7 45 f4 74 18 11 80 movl $0x80111874,-0xc(%ebp) 80100fb0: eb 2d jmp 80100fdf <filealloc+0x4c> if(f->ref == 0){ 80100fb2: 8b 45 f4 mov -0xc(%ebp),%eax 80100fb5: 8b 40 04 mov 0x4(%eax),%eax 80100fb8: 85 c0 test %eax,%eax 80100fba: 75 1f jne 80100fdb <filealloc+0x48> f->ref = 1; 80100fbc: 8b 45 f4 mov -0xc(%ebp),%eax 80100fbf: c7 40 04 01 00 00 00 movl $0x1,0x4(%eax) release(&ftable.lock); 80100fc6: 83 ec 0c sub $0xc,%esp 80100fc9: 68 40 18 11 80 push $0x80111840 80100fce: e8 04 46 00 00 call 801055d7 <release> 80100fd3: 83 c4 10 add $0x10,%esp return f; 80100fd6: 8b 45 f4 mov -0xc(%ebp),%eax 80100fd9: eb 23 jmp 80100ffe <filealloc+0x6b> filealloc(void) { struct file *f; acquire(&ftable.lock); for(f = ftable.file; f < ftable.file + NFILE; f++){ 80100fdb: 83 45 f4 18 addl $0x18,-0xc(%ebp) 80100fdf: b8 d4 21 11 80 mov $0x801121d4,%eax 80100fe4: 39 45 f4 cmp %eax,-0xc(%ebp) 80100fe7: 72 c9 jb 80100fb2 <filealloc+0x1f> f->ref = 1; release(&ftable.lock); return f; } } release(&ftable.lock); 80100fe9: 83 ec 0c sub $0xc,%esp 80100fec: 68 40 18 11 80 push $0x80111840 80100ff1: e8 e1 45 00 00 call 801055d7 <release> 80100ff6: 83 c4 10 add $0x10,%esp return 0; 80100ff9: b8 00 00 00 00 mov $0x0,%eax } 80100ffe: c9 leave 80100fff: c3 ret 80101000 <filedup>: // Increment ref count for file f. struct file* filedup(struct file *f) { 80101000: 55 push %ebp 80101001: 89 e5 mov %esp,%ebp 80101003: 83 ec 08 sub $0x8,%esp acquire(&ftable.lock); 80101006: 83 ec 0c sub $0xc,%esp 80101009: 68 40 18 11 80 push $0x80111840 8010100e: e8 5d 45 00 00 call 80105570 <acquire> 80101013: 83 c4 10 add $0x10,%esp if(f->ref < 1) 80101016: 8b 45 08 mov 0x8(%ebp),%eax 80101019: 8b 40 04 mov 0x4(%eax),%eax 8010101c: 85 c0 test %eax,%eax 8010101e: 7f 0d jg 8010102d <filedup+0x2d> panic("filedup"); 80101020: 83 ec 0c sub $0xc,%esp 80101023: 68 a1 8d 10 80 push $0x80108da1 80101028: e8 39 f5 ff ff call 80100566 <panic> f->ref++; 8010102d: 8b 45 08 mov 0x8(%ebp),%eax 80101030: 8b 40 04 mov 0x4(%eax),%eax 80101033: 8d 50 01 lea 0x1(%eax),%edx 80101036: 8b 45 08 mov 0x8(%ebp),%eax 80101039: 89 50 04 mov %edx,0x4(%eax) release(&ftable.lock); 8010103c: 83 ec 0c sub $0xc,%esp 8010103f: 68 40 18 11 80 push $0x80111840 80101044: e8 8e 45 00 00 call 801055d7 <release> 80101049: 83 c4 10 add $0x10,%esp return f; 8010104c: 8b 45 08 mov 0x8(%ebp),%eax } 8010104f: c9 leave 80101050: c3 ret 80101051 <fileclose>: // Close file f. (Decrement ref count, close when reaches 0.) void fileclose(struct file *f) { 80101051: 55 push %ebp 80101052: 89 e5 mov %esp,%ebp 80101054: 83 ec 28 sub $0x28,%esp struct file ff; acquire(&ftable.lock); 80101057: 83 ec 0c sub $0xc,%esp 8010105a: 68 40 18 11 80 push $0x80111840 8010105f: e8 0c 45 00 00 call 80105570 <acquire> 80101064: 83 c4 10 add $0x10,%esp if(f->ref < 1) 80101067: 8b 45 08 mov 0x8(%ebp),%eax 8010106a: 8b 40 04 mov 0x4(%eax),%eax 8010106d: 85 c0 test %eax,%eax 8010106f: 7f 0d jg 8010107e <fileclose+0x2d> panic("fileclose"); 80101071: 83 ec 0c sub $0xc,%esp 80101074: 68 a9 8d 10 80 push $0x80108da9 80101079: e8 e8 f4 ff ff call 80100566 <panic> if(--f->ref > 0){ 8010107e: 8b 45 08 mov 0x8(%ebp),%eax 80101081: 8b 40 04 mov 0x4(%eax),%eax 80101084: 8d 50 ff lea -0x1(%eax),%edx 80101087: 8b 45 08 mov 0x8(%ebp),%eax 8010108a: 89 50 04 mov %edx,0x4(%eax) 8010108d: 8b 45 08 mov 0x8(%ebp),%eax 80101090: 8b 40 04 mov 0x4(%eax),%eax 80101093: 85 c0 test %eax,%eax 80101095: 7e 15 jle 801010ac <fileclose+0x5b> release(&ftable.lock); 80101097: 83 ec 0c sub $0xc,%esp 8010109a: 68 40 18 11 80 push $0x80111840 8010109f: e8 33 45 00 00 call 801055d7 <release> 801010a4: 83 c4 10 add $0x10,%esp 801010a7: e9 8b 00 00 00 jmp 80101137 <fileclose+0xe6> return; } ff = *f; 801010ac: 8b 45 08 mov 0x8(%ebp),%eax 801010af: 8b 10 mov (%eax),%edx 801010b1: 89 55 e0 mov %edx,-0x20(%ebp) 801010b4: 8b 50 04 mov 0x4(%eax),%edx 801010b7: 89 55 e4 mov %edx,-0x1c(%ebp) 801010ba: 8b 50 08 mov 0x8(%eax),%edx 801010bd: 89 55 e8 mov %edx,-0x18(%ebp) 801010c0: 8b 50 0c mov 0xc(%eax),%edx 801010c3: 89 55 ec mov %edx,-0x14(%ebp) 801010c6: 8b 50 10 mov 0x10(%eax),%edx 801010c9: 89 55 f0 mov %edx,-0x10(%ebp) 801010cc: 8b 40 14 mov 0x14(%eax),%eax 801010cf: 89 45 f4 mov %eax,-0xc(%ebp) f->ref = 0; 801010d2: 8b 45 08 mov 0x8(%ebp),%eax 801010d5: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) f->type = FD_NONE; 801010dc: 8b 45 08 mov 0x8(%ebp),%eax 801010df: c7 00 00 00 00 00 movl $0x0,(%eax) release(&ftable.lock); 801010e5: 83 ec 0c sub $0xc,%esp 801010e8: 68 40 18 11 80 push $0x80111840 801010ed: e8 e5 44 00 00 call 801055d7 <release> 801010f2: 83 c4 10 add $0x10,%esp if(ff.type == FD_PIPE) 801010f5: 8b 45 e0 mov -0x20(%ebp),%eax 801010f8: 83 f8 01 cmp $0x1,%eax 801010fb: 75 19 jne 80101116 <fileclose+0xc5> pipeclose(ff.pipe, ff.writable); 801010fd: 0f b6 45 e9 movzbl -0x17(%ebp),%eax 80101101: 0f be d0 movsbl %al,%edx 80101104: 8b 45 ec mov -0x14(%ebp),%eax 80101107: 83 ec 08 sub $0x8,%esp 8010110a: 52 push %edx 8010110b: 50 push %eax 8010110c: e8 23 30 00 00 call 80104134 <pipeclose> 80101111: 83 c4 10 add $0x10,%esp 80101114: eb 21 jmp 80101137 <fileclose+0xe6> else if(ff.type == FD_INODE){ 80101116: 8b 45 e0 mov -0x20(%ebp),%eax 80101119: 83 f8 02 cmp $0x2,%eax 8010111c: 75 19 jne 80101137 <fileclose+0xe6> begin_op(); 8010111e: e8 04 24 00 00 call 80103527 <begin_op> iput(ff.ip); 80101123: 8b 45 f0 mov -0x10(%ebp),%eax 80101126: 83 ec 0c sub $0xc,%esp 80101129: 50 push %eax 8010112a: e8 c1 09 00 00 call 80101af0 <iput> 8010112f: 83 c4 10 add $0x10,%esp end_op(); 80101132: e8 7c 24 00 00 call 801035b3 <end_op> } } 80101137: c9 leave 80101138: c3 ret 80101139 <filestat>: // Get metadata about file f. int filestat(struct file *f, struct stat *st) { 80101139: 55 push %ebp 8010113a: 89 e5 mov %esp,%ebp 8010113c: 83 ec 08 sub $0x8,%esp if(f->type == FD_INODE){ 8010113f: 8b 45 08 mov 0x8(%ebp),%eax 80101142: 8b 00 mov (%eax),%eax 80101144: 83 f8 02 cmp $0x2,%eax 80101147: 75 40 jne 80101189 <filestat+0x50> ilock(f->ip); 80101149: 8b 45 08 mov 0x8(%ebp),%eax 8010114c: 8b 40 10 mov 0x10(%eax),%eax 8010114f: 83 ec 0c sub $0xc,%esp 80101152: 50 push %eax 80101153: e8 c8 07 00 00 call 80101920 <ilock> 80101158: 83 c4 10 add $0x10,%esp stati(f->ip, st); 8010115b: 8b 45 08 mov 0x8(%ebp),%eax 8010115e: 8b 40 10 mov 0x10(%eax),%eax 80101161: 83 ec 08 sub $0x8,%esp 80101164: ff 75 0c pushl 0xc(%ebp) 80101167: 50 push %eax 80101168: e8 db 0c 00 00 call 80101e48 <stati> 8010116d: 83 c4 10 add $0x10,%esp iunlock(f->ip); 80101170: 8b 45 08 mov 0x8(%ebp),%eax 80101173: 8b 40 10 mov 0x10(%eax),%eax 80101176: 83 ec 0c sub $0xc,%esp 80101179: 50 push %eax 8010117a: e8 ff 08 00 00 call 80101a7e <iunlock> 8010117f: 83 c4 10 add $0x10,%esp return 0; 80101182: b8 00 00 00 00 mov $0x0,%eax 80101187: eb 05 jmp 8010118e <filestat+0x55> } return -1; 80101189: b8 ff ff ff ff mov $0xffffffff,%eax } 8010118e: c9 leave 8010118f: c3 ret 80101190 <fileread>: // Read from file f. int fileread(struct file *f, char *addr, int n) { 80101190: 55 push %ebp 80101191: 89 e5 mov %esp,%ebp 80101193: 83 ec 18 sub $0x18,%esp int r; if(f->readable == 0) 80101196: 8b 45 08 mov 0x8(%ebp),%eax 80101199: 0f b6 40 08 movzbl 0x8(%eax),%eax 8010119d: 84 c0 test %al,%al 8010119f: 75 0a jne 801011ab <fileread+0x1b> return -1; 801011a1: b8 ff ff ff ff mov $0xffffffff,%eax 801011a6: e9 9b 00 00 00 jmp 80101246 <fileread+0xb6> if(f->type == FD_PIPE) 801011ab: 8b 45 08 mov 0x8(%ebp),%eax 801011ae: 8b 00 mov (%eax),%eax 801011b0: 83 f8 01 cmp $0x1,%eax 801011b3: 75 1a jne 801011cf <fileread+0x3f> return piperead(f->pipe, addr, n); 801011b5: 8b 45 08 mov 0x8(%ebp),%eax 801011b8: 8b 40 0c mov 0xc(%eax),%eax 801011bb: 83 ec 04 sub $0x4,%esp 801011be: ff 75 10 pushl 0x10(%ebp) 801011c1: ff 75 0c pushl 0xc(%ebp) 801011c4: 50 push %eax 801011c5: e8 12 31 00 00 call 801042dc <piperead> 801011ca: 83 c4 10 add $0x10,%esp 801011cd: eb 77 jmp 80101246 <fileread+0xb6> if(f->type == FD_INODE){ 801011cf: 8b 45 08 mov 0x8(%ebp),%eax 801011d2: 8b 00 mov (%eax),%eax 801011d4: 83 f8 02 cmp $0x2,%eax 801011d7: 75 60 jne 80101239 <fileread+0xa9> ilock(f->ip); 801011d9: 8b 45 08 mov 0x8(%ebp),%eax 801011dc: 8b 40 10 mov 0x10(%eax),%eax 801011df: 83 ec 0c sub $0xc,%esp 801011e2: 50 push %eax 801011e3: e8 38 07 00 00 call 80101920 <ilock> 801011e8: 83 c4 10 add $0x10,%esp if((r = readi(f->ip, addr, f->off, n)) > 0) 801011eb: 8b 4d 10 mov 0x10(%ebp),%ecx 801011ee: 8b 45 08 mov 0x8(%ebp),%eax 801011f1: 8b 50 14 mov 0x14(%eax),%edx 801011f4: 8b 45 08 mov 0x8(%ebp),%eax 801011f7: 8b 40 10 mov 0x10(%eax),%eax 801011fa: 51 push %ecx 801011fb: 52 push %edx 801011fc: ff 75 0c pushl 0xc(%ebp) 801011ff: 50 push %eax 80101200: e8 89 0c 00 00 call 80101e8e <readi> 80101205: 83 c4 10 add $0x10,%esp 80101208: 89 45 f4 mov %eax,-0xc(%ebp) 8010120b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010120f: 7e 11 jle 80101222 <fileread+0x92> f->off += r; 80101211: 8b 45 08 mov 0x8(%ebp),%eax 80101214: 8b 50 14 mov 0x14(%eax),%edx 80101217: 8b 45 f4 mov -0xc(%ebp),%eax 8010121a: 01 c2 add %eax,%edx 8010121c: 8b 45 08 mov 0x8(%ebp),%eax 8010121f: 89 50 14 mov %edx,0x14(%eax) iunlock(f->ip); 80101222: 8b 45 08 mov 0x8(%ebp),%eax 80101225: 8b 40 10 mov 0x10(%eax),%eax 80101228: 83 ec 0c sub $0xc,%esp 8010122b: 50 push %eax 8010122c: e8 4d 08 00 00 call 80101a7e <iunlock> 80101231: 83 c4 10 add $0x10,%esp return r; 80101234: 8b 45 f4 mov -0xc(%ebp),%eax 80101237: eb 0d jmp 80101246 <fileread+0xb6> } panic("fileread"); 80101239: 83 ec 0c sub $0xc,%esp 8010123c: 68 b3 8d 10 80 push $0x80108db3 80101241: e8 20 f3 ff ff call 80100566 <panic> } 80101246: c9 leave 80101247: c3 ret 80101248 <filewrite>: //PAGEBREAK! // Write to file f. int filewrite(struct file *f, char *addr, int n) { 80101248: 55 push %ebp 80101249: 89 e5 mov %esp,%ebp 8010124b: 53 push %ebx 8010124c: 83 ec 14 sub $0x14,%esp int r; if(f->writable == 0) 8010124f: 8b 45 08 mov 0x8(%ebp),%eax 80101252: 0f b6 40 09 movzbl 0x9(%eax),%eax 80101256: 84 c0 test %al,%al 80101258: 75 0a jne 80101264 <filewrite+0x1c> return -1; 8010125a: b8 ff ff ff ff mov $0xffffffff,%eax 8010125f: e9 1b 01 00 00 jmp 8010137f <filewrite+0x137> if(f->type == FD_PIPE) 80101264: 8b 45 08 mov 0x8(%ebp),%eax 80101267: 8b 00 mov (%eax),%eax 80101269: 83 f8 01 cmp $0x1,%eax 8010126c: 75 1d jne 8010128b <filewrite+0x43> return pipewrite(f->pipe, addr, n); 8010126e: 8b 45 08 mov 0x8(%ebp),%eax 80101271: 8b 40 0c mov 0xc(%eax),%eax 80101274: 83 ec 04 sub $0x4,%esp 80101277: ff 75 10 pushl 0x10(%ebp) 8010127a: ff 75 0c pushl 0xc(%ebp) 8010127d: 50 push %eax 8010127e: e8 5b 2f 00 00 call 801041de <pipewrite> 80101283: 83 c4 10 add $0x10,%esp 80101286: e9 f4 00 00 00 jmp 8010137f <filewrite+0x137> if(f->type == FD_INODE){ 8010128b: 8b 45 08 mov 0x8(%ebp),%eax 8010128e: 8b 00 mov (%eax),%eax 80101290: 83 f8 02 cmp $0x2,%eax 80101293: 0f 85 d9 00 00 00 jne 80101372 <filewrite+0x12a> // the maximum log transaction size, including // i-node, indirect block, allocation blocks, // and 2 blocks of slop for non-aligned writes. // this really belongs lower down, since writei() // might be writing a device like the console. int max = ((LOGSIZE-1-1-2) / 2) * 512; 80101299: c7 45 ec 00 1a 00 00 movl $0x1a00,-0x14(%ebp) int i = 0; 801012a0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) while(i < n){ 801012a7: e9 a3 00 00 00 jmp 8010134f <filewrite+0x107> int n1 = n - i; 801012ac: 8b 45 10 mov 0x10(%ebp),%eax 801012af: 2b 45 f4 sub -0xc(%ebp),%eax 801012b2: 89 45 f0 mov %eax,-0x10(%ebp) if(n1 > max) 801012b5: 8b 45 f0 mov -0x10(%ebp),%eax 801012b8: 3b 45 ec cmp -0x14(%ebp),%eax 801012bb: 7e 06 jle 801012c3 <filewrite+0x7b> n1 = max; 801012bd: 8b 45 ec mov -0x14(%ebp),%eax 801012c0: 89 45 f0 mov %eax,-0x10(%ebp) begin_op(); 801012c3: e8 5f 22 00 00 call 80103527 <begin_op> ilock(f->ip); 801012c8: 8b 45 08 mov 0x8(%ebp),%eax 801012cb: 8b 40 10 mov 0x10(%eax),%eax 801012ce: 83 ec 0c sub $0xc,%esp 801012d1: 50 push %eax 801012d2: e8 49 06 00 00 call 80101920 <ilock> 801012d7: 83 c4 10 add $0x10,%esp if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) 801012da: 8b 4d f0 mov -0x10(%ebp),%ecx 801012dd: 8b 45 08 mov 0x8(%ebp),%eax 801012e0: 8b 50 14 mov 0x14(%eax),%edx 801012e3: 8b 5d f4 mov -0xc(%ebp),%ebx 801012e6: 8b 45 0c mov 0xc(%ebp),%eax 801012e9: 01 c3 add %eax,%ebx 801012eb: 8b 45 08 mov 0x8(%ebp),%eax 801012ee: 8b 40 10 mov 0x10(%eax),%eax 801012f1: 51 push %ecx 801012f2: 52 push %edx 801012f3: 53 push %ebx 801012f4: 50 push %eax 801012f5: e8 eb 0c 00 00 call 80101fe5 <writei> 801012fa: 83 c4 10 add $0x10,%esp 801012fd: 89 45 e8 mov %eax,-0x18(%ebp) 80101300: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 80101304: 7e 11 jle 80101317 <filewrite+0xcf> f->off += r; 80101306: 8b 45 08 mov 0x8(%ebp),%eax 80101309: 8b 50 14 mov 0x14(%eax),%edx 8010130c: 8b 45 e8 mov -0x18(%ebp),%eax 8010130f: 01 c2 add %eax,%edx 80101311: 8b 45 08 mov 0x8(%ebp),%eax 80101314: 89 50 14 mov %edx,0x14(%eax) iunlock(f->ip); 80101317: 8b 45 08 mov 0x8(%ebp),%eax 8010131a: 8b 40 10 mov 0x10(%eax),%eax 8010131d: 83 ec 0c sub $0xc,%esp 80101320: 50 push %eax 80101321: e8 58 07 00 00 call 80101a7e <iunlock> 80101326: 83 c4 10 add $0x10,%esp end_op(); 80101329: e8 85 22 00 00 call 801035b3 <end_op> if(r < 0) 8010132e: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 80101332: 78 29 js 8010135d <filewrite+0x115> break; if(r != n1) 80101334: 8b 45 e8 mov -0x18(%ebp),%eax 80101337: 3b 45 f0 cmp -0x10(%ebp),%eax 8010133a: 74 0d je 80101349 <filewrite+0x101> panic("short filewrite"); 8010133c: 83 ec 0c sub $0xc,%esp 8010133f: 68 bc 8d 10 80 push $0x80108dbc 80101344: e8 1d f2 ff ff call 80100566 <panic> i += r; 80101349: 8b 45 e8 mov -0x18(%ebp),%eax 8010134c: 01 45 f4 add %eax,-0xc(%ebp) // and 2 blocks of slop for non-aligned writes. // this really belongs lower down, since writei() // might be writing a device like the console. int max = ((LOGSIZE-1-1-2) / 2) * 512; int i = 0; while(i < n){ 8010134f: 8b 45 f4 mov -0xc(%ebp),%eax 80101352: 3b 45 10 cmp 0x10(%ebp),%eax 80101355: 0f 8c 51 ff ff ff jl 801012ac <filewrite+0x64> 8010135b: eb 01 jmp 8010135e <filewrite+0x116> f->off += r; iunlock(f->ip); end_op(); if(r < 0) break; 8010135d: 90 nop if(r != n1) panic("short filewrite"); i += r; } return i == n ? n : -1; 8010135e: 8b 45 f4 mov -0xc(%ebp),%eax 80101361: 3b 45 10 cmp 0x10(%ebp),%eax 80101364: 75 05 jne 8010136b <filewrite+0x123> 80101366: 8b 45 10 mov 0x10(%ebp),%eax 80101369: eb 14 jmp 8010137f <filewrite+0x137> 8010136b: b8 ff ff ff ff mov $0xffffffff,%eax 80101370: eb 0d jmp 8010137f <filewrite+0x137> } panic("filewrite"); 80101372: 83 ec 0c sub $0xc,%esp 80101375: 68 cc 8d 10 80 push $0x80108dcc 8010137a: e8 e7 f1 ff ff call 80100566 <panic> } 8010137f: 8b 5d fc mov -0x4(%ebp),%ebx 80101382: c9 leave 80101383: c3 ret 80101384 <readsb>: struct superblock sb; // there should be one per dev, but we run with one dev // Read the super block. void readsb(int dev, struct superblock *sb) { 80101384: 55 push %ebp 80101385: 89 e5 mov %esp,%ebp 80101387: 83 ec 18 sub $0x18,%esp struct buf *bp; bp = bread(dev, 1); 8010138a: 8b 45 08 mov 0x8(%ebp),%eax 8010138d: 83 ec 08 sub $0x8,%esp 80101390: 6a 01 push $0x1 80101392: 50 push %eax 80101393: e8 1e ee ff ff call 801001b6 <bread> 80101398: 83 c4 10 add $0x10,%esp 8010139b: 89 45 f4 mov %eax,-0xc(%ebp) memmove(sb, bp->data, sizeof(*sb)); 8010139e: 8b 45 f4 mov -0xc(%ebp),%eax 801013a1: 83 c0 18 add $0x18,%eax 801013a4: 83 ec 04 sub $0x4,%esp 801013a7: 6a 1c push $0x1c 801013a9: 50 push %eax 801013aa: ff 75 0c pushl 0xc(%ebp) 801013ad: e8 e0 44 00 00 call 80105892 <memmove> 801013b2: 83 c4 10 add $0x10,%esp brelse(bp); 801013b5: 83 ec 0c sub $0xc,%esp 801013b8: ff 75 f4 pushl -0xc(%ebp) 801013bb: e8 6e ee ff ff call 8010022e <brelse> 801013c0: 83 c4 10 add $0x10,%esp } 801013c3: 90 nop 801013c4: c9 leave 801013c5: c3 ret 801013c6 <bzero>: // Zero a block. static void bzero(int dev, int bno) { 801013c6: 55 push %ebp 801013c7: 89 e5 mov %esp,%ebp 801013c9: 83 ec 18 sub $0x18,%esp struct buf *bp; bp = bread(dev, bno); 801013cc: 8b 55 0c mov 0xc(%ebp),%edx 801013cf: 8b 45 08 mov 0x8(%ebp),%eax 801013d2: 83 ec 08 sub $0x8,%esp 801013d5: 52 push %edx 801013d6: 50 push %eax 801013d7: e8 da ed ff ff call 801001b6 <bread> 801013dc: 83 c4 10 add $0x10,%esp 801013df: 89 45 f4 mov %eax,-0xc(%ebp) memset(bp->data, 0, BSIZE); 801013e2: 8b 45 f4 mov -0xc(%ebp),%eax 801013e5: 83 c0 18 add $0x18,%eax 801013e8: 83 ec 04 sub $0x4,%esp 801013eb: 68 00 02 00 00 push $0x200 801013f0: 6a 00 push $0x0 801013f2: 50 push %eax 801013f3: e8 db 43 00 00 call 801057d3 <memset> 801013f8: 83 c4 10 add $0x10,%esp log_write(bp); 801013fb: 83 ec 0c sub $0xc,%esp 801013fe: ff 75 f4 pushl -0xc(%ebp) 80101401: e8 59 23 00 00 call 8010375f <log_write> 80101406: 83 c4 10 add $0x10,%esp brelse(bp); 80101409: 83 ec 0c sub $0xc,%esp 8010140c: ff 75 f4 pushl -0xc(%ebp) 8010140f: e8 1a ee ff ff call 8010022e <brelse> 80101414: 83 c4 10 add $0x10,%esp } 80101417: 90 nop 80101418: c9 leave 80101419: c3 ret 8010141a <balloc>: // Blocks. // Allocate a zeroed disk block. static uint balloc(uint dev) { 8010141a: 55 push %ebp 8010141b: 89 e5 mov %esp,%ebp 8010141d: 83 ec 18 sub $0x18,%esp int b, bi, m; struct buf *bp; bp = 0; 80101420: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) for(b = 0; b < sb.size; b += BPB){ 80101427: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010142e: e9 13 01 00 00 jmp 80101546 <balloc+0x12c> bp = bread(dev, BBLOCK(b, sb)); 80101433: 8b 45 f4 mov -0xc(%ebp),%eax 80101436: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx 8010143c: 85 c0 test %eax,%eax 8010143e: 0f 48 c2 cmovs %edx,%eax 80101441: c1 f8 0c sar $0xc,%eax 80101444: 89 c2 mov %eax,%edx 80101446: a1 58 22 11 80 mov 0x80112258,%eax 8010144b: 01 d0 add %edx,%eax 8010144d: 83 ec 08 sub $0x8,%esp 80101450: 50 push %eax 80101451: ff 75 08 pushl 0x8(%ebp) 80101454: e8 5d ed ff ff call 801001b6 <bread> 80101459: 83 c4 10 add $0x10,%esp 8010145c: 89 45 ec mov %eax,-0x14(%ebp) for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 8010145f: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 80101466: e9 a6 00 00 00 jmp 80101511 <balloc+0xf7> m = 1 << (bi % 8); 8010146b: 8b 45 f0 mov -0x10(%ebp),%eax 8010146e: 99 cltd 8010146f: c1 ea 1d shr $0x1d,%edx 80101472: 01 d0 add %edx,%eax 80101474: 83 e0 07 and $0x7,%eax 80101477: 29 d0 sub %edx,%eax 80101479: ba 01 00 00 00 mov $0x1,%edx 8010147e: 89 c1 mov %eax,%ecx 80101480: d3 e2 shl %cl,%edx 80101482: 89 d0 mov %edx,%eax 80101484: 89 45 e8 mov %eax,-0x18(%ebp) if((bp->data[bi/8] & m) == 0){ // Is block free? 80101487: 8b 45 f0 mov -0x10(%ebp),%eax 8010148a: 8d 50 07 lea 0x7(%eax),%edx 8010148d: 85 c0 test %eax,%eax 8010148f: 0f 48 c2 cmovs %edx,%eax 80101492: c1 f8 03 sar $0x3,%eax 80101495: 89 c2 mov %eax,%edx 80101497: 8b 45 ec mov -0x14(%ebp),%eax 8010149a: 0f b6 44 10 18 movzbl 0x18(%eax,%edx,1),%eax 8010149f: 0f b6 c0 movzbl %al,%eax 801014a2: 23 45 e8 and -0x18(%ebp),%eax 801014a5: 85 c0 test %eax,%eax 801014a7: 75 64 jne 8010150d <balloc+0xf3> bp->data[bi/8] |= m; // Mark block in use. 801014a9: 8b 45 f0 mov -0x10(%ebp),%eax 801014ac: 8d 50 07 lea 0x7(%eax),%edx 801014af: 85 c0 test %eax,%eax 801014b1: 0f 48 c2 cmovs %edx,%eax 801014b4: c1 f8 03 sar $0x3,%eax 801014b7: 8b 55 ec mov -0x14(%ebp),%edx 801014ba: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx 801014bf: 89 d1 mov %edx,%ecx 801014c1: 8b 55 e8 mov -0x18(%ebp),%edx 801014c4: 09 ca or %ecx,%edx 801014c6: 89 d1 mov %edx,%ecx 801014c8: 8b 55 ec mov -0x14(%ebp),%edx 801014cb: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1) log_write(bp); 801014cf: 83 ec 0c sub $0xc,%esp 801014d2: ff 75 ec pushl -0x14(%ebp) 801014d5: e8 85 22 00 00 call 8010375f <log_write> 801014da: 83 c4 10 add $0x10,%esp brelse(bp); 801014dd: 83 ec 0c sub $0xc,%esp 801014e0: ff 75 ec pushl -0x14(%ebp) 801014e3: e8 46 ed ff ff call 8010022e <brelse> 801014e8: 83 c4 10 add $0x10,%esp bzero(dev, b + bi); 801014eb: 8b 55 f4 mov -0xc(%ebp),%edx 801014ee: 8b 45 f0 mov -0x10(%ebp),%eax 801014f1: 01 c2 add %eax,%edx 801014f3: 8b 45 08 mov 0x8(%ebp),%eax 801014f6: 83 ec 08 sub $0x8,%esp 801014f9: 52 push %edx 801014fa: 50 push %eax 801014fb: e8 c6 fe ff ff call 801013c6 <bzero> 80101500: 83 c4 10 add $0x10,%esp return b + bi; 80101503: 8b 55 f4 mov -0xc(%ebp),%edx 80101506: 8b 45 f0 mov -0x10(%ebp),%eax 80101509: 01 d0 add %edx,%eax 8010150b: eb 57 jmp 80101564 <balloc+0x14a> 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++){ 8010150d: 83 45 f0 01 addl $0x1,-0x10(%ebp) 80101511: 81 7d f0 ff 0f 00 00 cmpl $0xfff,-0x10(%ebp) 80101518: 7f 17 jg 80101531 <balloc+0x117> 8010151a: 8b 55 f4 mov -0xc(%ebp),%edx 8010151d: 8b 45 f0 mov -0x10(%ebp),%eax 80101520: 01 d0 add %edx,%eax 80101522: 89 c2 mov %eax,%edx 80101524: a1 40 22 11 80 mov 0x80112240,%eax 80101529: 39 c2 cmp %eax,%edx 8010152b: 0f 82 3a ff ff ff jb 8010146b <balloc+0x51> brelse(bp); bzero(dev, b + bi); return b + bi; } } brelse(bp); 80101531: 83 ec 0c sub $0xc,%esp 80101534: ff 75 ec pushl -0x14(%ebp) 80101537: e8 f2 ec ff ff call 8010022e <brelse> 8010153c: 83 c4 10 add $0x10,%esp { int b, bi, m; struct buf *bp; bp = 0; for(b = 0; b < sb.size; b += BPB){ 8010153f: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80101546: 8b 15 40 22 11 80 mov 0x80112240,%edx 8010154c: 8b 45 f4 mov -0xc(%ebp),%eax 8010154f: 39 c2 cmp %eax,%edx 80101551: 0f 87 dc fe ff ff ja 80101433 <balloc+0x19> return b + bi; } } brelse(bp); } panic("balloc: out of blocks"); 80101557: 83 ec 0c sub $0xc,%esp 8010155a: 68 d6 8d 10 80 push $0x80108dd6 8010155f: e8 02 f0 ff ff call 80100566 <panic> } 80101564: c9 leave 80101565: c3 ret 80101566 <bfree>: // Free a disk block. static void bfree(int dev, uint b) { 80101566: 55 push %ebp 80101567: 89 e5 mov %esp,%ebp 80101569: 83 ec 18 sub $0x18,%esp struct buf *bp; int bi, m; readsb(dev, &sb); 8010156c: 83 ec 08 sub $0x8,%esp 8010156f: 68 40 22 11 80 push $0x80112240 80101574: ff 75 08 pushl 0x8(%ebp) 80101577: e8 08 fe ff ff call 80101384 <readsb> 8010157c: 83 c4 10 add $0x10,%esp bp = bread(dev, BBLOCK(b, sb)); 8010157f: 8b 45 0c mov 0xc(%ebp),%eax 80101582: c1 e8 0c shr $0xc,%eax 80101585: 89 c2 mov %eax,%edx 80101587: a1 58 22 11 80 mov 0x80112258,%eax 8010158c: 01 c2 add %eax,%edx 8010158e: 8b 45 08 mov 0x8(%ebp),%eax 80101591: 83 ec 08 sub $0x8,%esp 80101594: 52 push %edx 80101595: 50 push %eax 80101596: e8 1b ec ff ff call 801001b6 <bread> 8010159b: 83 c4 10 add $0x10,%esp 8010159e: 89 45 f4 mov %eax,-0xc(%ebp) bi = b % BPB; 801015a1: 8b 45 0c mov 0xc(%ebp),%eax 801015a4: 25 ff 0f 00 00 and $0xfff,%eax 801015a9: 89 45 f0 mov %eax,-0x10(%ebp) m = 1 << (bi % 8); 801015ac: 8b 45 f0 mov -0x10(%ebp),%eax 801015af: 99 cltd 801015b0: c1 ea 1d shr $0x1d,%edx 801015b3: 01 d0 add %edx,%eax 801015b5: 83 e0 07 and $0x7,%eax 801015b8: 29 d0 sub %edx,%eax 801015ba: ba 01 00 00 00 mov $0x1,%edx 801015bf: 89 c1 mov %eax,%ecx 801015c1: d3 e2 shl %cl,%edx 801015c3: 89 d0 mov %edx,%eax 801015c5: 89 45 ec mov %eax,-0x14(%ebp) if((bp->data[bi/8] & m) == 0) 801015c8: 8b 45 f0 mov -0x10(%ebp),%eax 801015cb: 8d 50 07 lea 0x7(%eax),%edx 801015ce: 85 c0 test %eax,%eax 801015d0: 0f 48 c2 cmovs %edx,%eax 801015d3: c1 f8 03 sar $0x3,%eax 801015d6: 89 c2 mov %eax,%edx 801015d8: 8b 45 f4 mov -0xc(%ebp),%eax 801015db: 0f b6 44 10 18 movzbl 0x18(%eax,%edx,1),%eax 801015e0: 0f b6 c0 movzbl %al,%eax 801015e3: 23 45 ec and -0x14(%ebp),%eax 801015e6: 85 c0 test %eax,%eax 801015e8: 75 0d jne 801015f7 <bfree+0x91> panic("freeing free block"); 801015ea: 83 ec 0c sub $0xc,%esp 801015ed: 68 ec 8d 10 80 push $0x80108dec 801015f2: e8 6f ef ff ff call 80100566 <panic> bp->data[bi/8] &= ~m; 801015f7: 8b 45 f0 mov -0x10(%ebp),%eax 801015fa: 8d 50 07 lea 0x7(%eax),%edx 801015fd: 85 c0 test %eax,%eax 801015ff: 0f 48 c2 cmovs %edx,%eax 80101602: c1 f8 03 sar $0x3,%eax 80101605: 8b 55 f4 mov -0xc(%ebp),%edx 80101608: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx 8010160d: 89 d1 mov %edx,%ecx 8010160f: 8b 55 ec mov -0x14(%ebp),%edx 80101612: f7 d2 not %edx 80101614: 21 ca and %ecx,%edx 80101616: 89 d1 mov %edx,%ecx 80101618: 8b 55 f4 mov -0xc(%ebp),%edx 8010161b: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1) log_write(bp); 8010161f: 83 ec 0c sub $0xc,%esp 80101622: ff 75 f4 pushl -0xc(%ebp) 80101625: e8 35 21 00 00 call 8010375f <log_write> 8010162a: 83 c4 10 add $0x10,%esp brelse(bp); 8010162d: 83 ec 0c sub $0xc,%esp 80101630: ff 75 f4 pushl -0xc(%ebp) 80101633: e8 f6 eb ff ff call 8010022e <brelse> 80101638: 83 c4 10 add $0x10,%esp } 8010163b: 90 nop 8010163c: c9 leave 8010163d: c3 ret 8010163e <iinit>: struct inode inode[NINODE]; } icache; void iinit(int dev) { 8010163e: 55 push %ebp 8010163f: 89 e5 mov %esp,%ebp 80101641: 83 ec 08 sub $0x8,%esp initlock(&icache.lock, "icache"); 80101644: 83 ec 08 sub $0x8,%esp 80101647: 68 ff 8d 10 80 push $0x80108dff 8010164c: 68 60 22 11 80 push $0x80112260 80101651: e8 f8 3e 00 00 call 8010554e <initlock> 80101656: 83 c4 10 add $0x10,%esp readsb(dev, &sb); 80101659: 83 ec 08 sub $0x8,%esp 8010165c: 68 40 22 11 80 push $0x80112240 80101661: ff 75 08 pushl 0x8(%ebp) 80101664: e8 1b fd ff ff call 80101384 <readsb> 80101669: 83 c4 10 add $0x10,%esp } 8010166c: 90 nop 8010166d: c9 leave 8010166e: c3 ret 8010166f <ialloc>: //PAGEBREAK! // Allocate a new inode with the given type on device dev. // A free inode has a type of zero. struct inode* ialloc(uint dev, short type) { 8010166f: 55 push %ebp 80101670: 89 e5 mov %esp,%ebp 80101672: 83 ec 28 sub $0x28,%esp 80101675: 8b 45 0c mov 0xc(%ebp),%eax 80101678: 66 89 45 e4 mov %ax,-0x1c(%ebp) int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 8010167c: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) 80101683: e9 9e 00 00 00 jmp 80101726 <ialloc+0xb7> bp = bread(dev, IBLOCK(inum, sb)); 80101688: 8b 45 f4 mov -0xc(%ebp),%eax 8010168b: c1 e8 03 shr $0x3,%eax 8010168e: 89 c2 mov %eax,%edx 80101690: a1 54 22 11 80 mov 0x80112254,%eax 80101695: 01 d0 add %edx,%eax 80101697: 83 ec 08 sub $0x8,%esp 8010169a: 50 push %eax 8010169b: ff 75 08 pushl 0x8(%ebp) 8010169e: e8 13 eb ff ff call 801001b6 <bread> 801016a3: 83 c4 10 add $0x10,%esp 801016a6: 89 45 f0 mov %eax,-0x10(%ebp) dip = (struct dinode*)bp->data + inum%IPB; 801016a9: 8b 45 f0 mov -0x10(%ebp),%eax 801016ac: 8d 50 18 lea 0x18(%eax),%edx 801016af: 8b 45 f4 mov -0xc(%ebp),%eax 801016b2: 83 e0 07 and $0x7,%eax 801016b5: c1 e0 06 shl $0x6,%eax 801016b8: 01 d0 add %edx,%eax 801016ba: 89 45 ec mov %eax,-0x14(%ebp) if(dip->type == 0){ // a free inode 801016bd: 8b 45 ec mov -0x14(%ebp),%eax 801016c0: 0f b7 00 movzwl (%eax),%eax 801016c3: 66 85 c0 test %ax,%ax 801016c6: 75 4c jne 80101714 <ialloc+0xa5> memset(dip, 0, sizeof(*dip)); 801016c8: 83 ec 04 sub $0x4,%esp 801016cb: 6a 40 push $0x40 801016cd: 6a 00 push $0x0 801016cf: ff 75 ec pushl -0x14(%ebp) 801016d2: e8 fc 40 00 00 call 801057d3 <memset> 801016d7: 83 c4 10 add $0x10,%esp dip->type = type; 801016da: 8b 45 ec mov -0x14(%ebp),%eax 801016dd: 0f b7 55 e4 movzwl -0x1c(%ebp),%edx 801016e1: 66 89 10 mov %dx,(%eax) log_write(bp); // mark it allocated on the disk 801016e4: 83 ec 0c sub $0xc,%esp 801016e7: ff 75 f0 pushl -0x10(%ebp) 801016ea: e8 70 20 00 00 call 8010375f <log_write> 801016ef: 83 c4 10 add $0x10,%esp brelse(bp); 801016f2: 83 ec 0c sub $0xc,%esp 801016f5: ff 75 f0 pushl -0x10(%ebp) 801016f8: e8 31 eb ff ff call 8010022e <brelse> 801016fd: 83 c4 10 add $0x10,%esp return iget(dev, inum); 80101700: 8b 45 f4 mov -0xc(%ebp),%eax 80101703: 83 ec 08 sub $0x8,%esp 80101706: 50 push %eax 80101707: ff 75 08 pushl 0x8(%ebp) 8010170a: e8 f8 00 00 00 call 80101807 <iget> 8010170f: 83 c4 10 add $0x10,%esp 80101712: eb 30 jmp 80101744 <ialloc+0xd5> } brelse(bp); 80101714: 83 ec 0c sub $0xc,%esp 80101717: ff 75 f0 pushl -0x10(%ebp) 8010171a: e8 0f eb ff ff call 8010022e <brelse> 8010171f: 83 c4 10 add $0x10,%esp { int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 80101722: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80101726: 8b 15 48 22 11 80 mov 0x80112248,%edx 8010172c: 8b 45 f4 mov -0xc(%ebp),%eax 8010172f: 39 c2 cmp %eax,%edx 80101731: 0f 87 51 ff ff ff ja 80101688 <ialloc+0x19> brelse(bp); return iget(dev, inum); } brelse(bp); } panic("ialloc: no inodes"); 80101737: 83 ec 0c sub $0xc,%esp 8010173a: 68 06 8e 10 80 push $0x80108e06 8010173f: e8 22 ee ff ff call 80100566 <panic> } 80101744: c9 leave 80101745: c3 ret 80101746 <iupdate>: // Copy a modified in-memory inode to disk. void iupdate(struct inode *ip) { 80101746: 55 push %ebp 80101747: 89 e5 mov %esp,%ebp 80101749: 83 ec 18 sub $0x18,%esp struct buf *bp; struct dinode *dip; bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 8010174c: 8b 45 08 mov 0x8(%ebp),%eax 8010174f: 8b 40 04 mov 0x4(%eax),%eax 80101752: c1 e8 03 shr $0x3,%eax 80101755: 89 c2 mov %eax,%edx 80101757: a1 54 22 11 80 mov 0x80112254,%eax 8010175c: 01 c2 add %eax,%edx 8010175e: 8b 45 08 mov 0x8(%ebp),%eax 80101761: 8b 00 mov (%eax),%eax 80101763: 83 ec 08 sub $0x8,%esp 80101766: 52 push %edx 80101767: 50 push %eax 80101768: e8 49 ea ff ff call 801001b6 <bread> 8010176d: 83 c4 10 add $0x10,%esp 80101770: 89 45 f4 mov %eax,-0xc(%ebp) dip = (struct dinode*)bp->data + ip->inum%IPB; 80101773: 8b 45 f4 mov -0xc(%ebp),%eax 80101776: 8d 50 18 lea 0x18(%eax),%edx 80101779: 8b 45 08 mov 0x8(%ebp),%eax 8010177c: 8b 40 04 mov 0x4(%eax),%eax 8010177f: 83 e0 07 and $0x7,%eax 80101782: c1 e0 06 shl $0x6,%eax 80101785: 01 d0 add %edx,%eax 80101787: 89 45 f0 mov %eax,-0x10(%ebp) dip->type = ip->type; 8010178a: 8b 45 08 mov 0x8(%ebp),%eax 8010178d: 0f b7 50 10 movzwl 0x10(%eax),%edx 80101791: 8b 45 f0 mov -0x10(%ebp),%eax 80101794: 66 89 10 mov %dx,(%eax) dip->major = ip->major; 80101797: 8b 45 08 mov 0x8(%ebp),%eax 8010179a: 0f b7 50 12 movzwl 0x12(%eax),%edx 8010179e: 8b 45 f0 mov -0x10(%ebp),%eax 801017a1: 66 89 50 02 mov %dx,0x2(%eax) dip->minor = ip->minor; 801017a5: 8b 45 08 mov 0x8(%ebp),%eax 801017a8: 0f b7 50 14 movzwl 0x14(%eax),%edx 801017ac: 8b 45 f0 mov -0x10(%ebp),%eax 801017af: 66 89 50 04 mov %dx,0x4(%eax) dip->nlink = ip->nlink; 801017b3: 8b 45 08 mov 0x8(%ebp),%eax 801017b6: 0f b7 50 16 movzwl 0x16(%eax),%edx 801017ba: 8b 45 f0 mov -0x10(%ebp),%eax 801017bd: 66 89 50 06 mov %dx,0x6(%eax) dip->size = ip->size; 801017c1: 8b 45 08 mov 0x8(%ebp),%eax 801017c4: 8b 50 18 mov 0x18(%eax),%edx 801017c7: 8b 45 f0 mov -0x10(%ebp),%eax 801017ca: 89 50 08 mov %edx,0x8(%eax) memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 801017cd: 8b 45 08 mov 0x8(%ebp),%eax 801017d0: 8d 50 1c lea 0x1c(%eax),%edx 801017d3: 8b 45 f0 mov -0x10(%ebp),%eax 801017d6: 83 c0 0c add $0xc,%eax 801017d9: 83 ec 04 sub $0x4,%esp 801017dc: 6a 34 push $0x34 801017de: 52 push %edx 801017df: 50 push %eax 801017e0: e8 ad 40 00 00 call 80105892 <memmove> 801017e5: 83 c4 10 add $0x10,%esp log_write(bp); 801017e8: 83 ec 0c sub $0xc,%esp 801017eb: ff 75 f4 pushl -0xc(%ebp) 801017ee: e8 6c 1f 00 00 call 8010375f <log_write> 801017f3: 83 c4 10 add $0x10,%esp brelse(bp); 801017f6: 83 ec 0c sub $0xc,%esp 801017f9: ff 75 f4 pushl -0xc(%ebp) 801017fc: e8 2d ea ff ff call 8010022e <brelse> 80101801: 83 c4 10 add $0x10,%esp } 80101804: 90 nop 80101805: c9 leave 80101806: c3 ret 80101807 <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) { 80101807: 55 push %ebp 80101808: 89 e5 mov %esp,%ebp 8010180a: 83 ec 18 sub $0x18,%esp struct inode *ip, *empty; acquire(&icache.lock); 8010180d: 83 ec 0c sub $0xc,%esp 80101810: 68 60 22 11 80 push $0x80112260 80101815: e8 56 3d 00 00 call 80105570 <acquire> 8010181a: 83 c4 10 add $0x10,%esp // Is the inode already cached? empty = 0; 8010181d: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 80101824: c7 45 f4 94 22 11 80 movl $0x80112294,-0xc(%ebp) 8010182b: eb 5d jmp 8010188a <iget+0x83> if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ 8010182d: 8b 45 f4 mov -0xc(%ebp),%eax 80101830: 8b 40 08 mov 0x8(%eax),%eax 80101833: 85 c0 test %eax,%eax 80101835: 7e 39 jle 80101870 <iget+0x69> 80101837: 8b 45 f4 mov -0xc(%ebp),%eax 8010183a: 8b 00 mov (%eax),%eax 8010183c: 3b 45 08 cmp 0x8(%ebp),%eax 8010183f: 75 2f jne 80101870 <iget+0x69> 80101841: 8b 45 f4 mov -0xc(%ebp),%eax 80101844: 8b 40 04 mov 0x4(%eax),%eax 80101847: 3b 45 0c cmp 0xc(%ebp),%eax 8010184a: 75 24 jne 80101870 <iget+0x69> ip->ref++; 8010184c: 8b 45 f4 mov -0xc(%ebp),%eax 8010184f: 8b 40 08 mov 0x8(%eax),%eax 80101852: 8d 50 01 lea 0x1(%eax),%edx 80101855: 8b 45 f4 mov -0xc(%ebp),%eax 80101858: 89 50 08 mov %edx,0x8(%eax) release(&icache.lock); 8010185b: 83 ec 0c sub $0xc,%esp 8010185e: 68 60 22 11 80 push $0x80112260 80101863: e8 6f 3d 00 00 call 801055d7 <release> 80101868: 83 c4 10 add $0x10,%esp return ip; 8010186b: 8b 45 f4 mov -0xc(%ebp),%eax 8010186e: eb 74 jmp 801018e4 <iget+0xdd> } if(empty == 0 && ip->ref == 0) // Remember empty slot. 80101870: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80101874: 75 10 jne 80101886 <iget+0x7f> 80101876: 8b 45 f4 mov -0xc(%ebp),%eax 80101879: 8b 40 08 mov 0x8(%eax),%eax 8010187c: 85 c0 test %eax,%eax 8010187e: 75 06 jne 80101886 <iget+0x7f> empty = ip; 80101880: 8b 45 f4 mov -0xc(%ebp),%eax 80101883: 89 45 f0 mov %eax,-0x10(%ebp) acquire(&icache.lock); // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 80101886: 83 45 f4 50 addl $0x50,-0xc(%ebp) 8010188a: 81 7d f4 34 32 11 80 cmpl $0x80113234,-0xc(%ebp) 80101891: 72 9a jb 8010182d <iget+0x26> if(empty == 0 && ip->ref == 0) // Remember empty slot. empty = ip; } // Recycle an inode cache entry. if(empty == 0) 80101893: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80101897: 75 0d jne 801018a6 <iget+0x9f> panic("iget: no inodes"); 80101899: 83 ec 0c sub $0xc,%esp 8010189c: 68 18 8e 10 80 push $0x80108e18 801018a1: e8 c0 ec ff ff call 80100566 <panic> ip = empty; 801018a6: 8b 45 f0 mov -0x10(%ebp),%eax 801018a9: 89 45 f4 mov %eax,-0xc(%ebp) ip->dev = dev; 801018ac: 8b 45 f4 mov -0xc(%ebp),%eax 801018af: 8b 55 08 mov 0x8(%ebp),%edx 801018b2: 89 10 mov %edx,(%eax) ip->inum = inum; 801018b4: 8b 45 f4 mov -0xc(%ebp),%eax 801018b7: 8b 55 0c mov 0xc(%ebp),%edx 801018ba: 89 50 04 mov %edx,0x4(%eax) ip->ref = 1; 801018bd: 8b 45 f4 mov -0xc(%ebp),%eax 801018c0: c7 40 08 01 00 00 00 movl $0x1,0x8(%eax) ip->flags = 0; 801018c7: 8b 45 f4 mov -0xc(%ebp),%eax 801018ca: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) release(&icache.lock); 801018d1: 83 ec 0c sub $0xc,%esp 801018d4: 68 60 22 11 80 push $0x80112260 801018d9: e8 f9 3c 00 00 call 801055d7 <release> 801018de: 83 c4 10 add $0x10,%esp return ip; 801018e1: 8b 45 f4 mov -0xc(%ebp),%eax } 801018e4: c9 leave 801018e5: c3 ret 801018e6 <idup>: // Increment reference count for ip. // Returns ip to enable ip = idup(ip1) idiom. struct inode* idup(struct inode *ip) { 801018e6: 55 push %ebp 801018e7: 89 e5 mov %esp,%ebp 801018e9: 83 ec 08 sub $0x8,%esp acquire(&icache.lock); 801018ec: 83 ec 0c sub $0xc,%esp 801018ef: 68 60 22 11 80 push $0x80112260 801018f4: e8 77 3c 00 00 call 80105570 <acquire> 801018f9: 83 c4 10 add $0x10,%esp ip->ref++; 801018fc: 8b 45 08 mov 0x8(%ebp),%eax 801018ff: 8b 40 08 mov 0x8(%eax),%eax 80101902: 8d 50 01 lea 0x1(%eax),%edx 80101905: 8b 45 08 mov 0x8(%ebp),%eax 80101908: 89 50 08 mov %edx,0x8(%eax) release(&icache.lock); 8010190b: 83 ec 0c sub $0xc,%esp 8010190e: 68 60 22 11 80 push $0x80112260 80101913: e8 bf 3c 00 00 call 801055d7 <release> 80101918: 83 c4 10 add $0x10,%esp return ip; 8010191b: 8b 45 08 mov 0x8(%ebp),%eax } 8010191e: c9 leave 8010191f: c3 ret 80101920 <ilock>: // Lock the given inode. // Reads the inode from disk if necessary. void ilock(struct inode *ip) { 80101920: 55 push %ebp 80101921: 89 e5 mov %esp,%ebp 80101923: 83 ec 18 sub $0x18,%esp struct buf *bp; struct dinode *dip; if(ip == 0 || ip->ref < 1) 80101926: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 8010192a: 74 0a je 80101936 <ilock+0x16> 8010192c: 8b 45 08 mov 0x8(%ebp),%eax 8010192f: 8b 40 08 mov 0x8(%eax),%eax 80101932: 85 c0 test %eax,%eax 80101934: 7f 0d jg 80101943 <ilock+0x23> panic("ilock"); 80101936: 83 ec 0c sub $0xc,%esp 80101939: 68 28 8e 10 80 push $0x80108e28 8010193e: e8 23 ec ff ff call 80100566 <panic> acquire(&icache.lock); 80101943: 83 ec 0c sub $0xc,%esp 80101946: 68 60 22 11 80 push $0x80112260 8010194b: e8 20 3c 00 00 call 80105570 <acquire> 80101950: 83 c4 10 add $0x10,%esp while(ip->flags & I_BUSY) 80101953: eb 13 jmp 80101968 <ilock+0x48> sleep(ip, &icache.lock); 80101955: 83 ec 08 sub $0x8,%esp 80101958: 68 60 22 11 80 push $0x80112260 8010195d: ff 75 08 pushl 0x8(%ebp) 80101960: e8 fb 38 00 00 call 80105260 <sleep> 80101965: 83 c4 10 add $0x10,%esp if(ip == 0 || ip->ref < 1) panic("ilock"); acquire(&icache.lock); while(ip->flags & I_BUSY) 80101968: 8b 45 08 mov 0x8(%ebp),%eax 8010196b: 8b 40 0c mov 0xc(%eax),%eax 8010196e: 83 e0 01 and $0x1,%eax 80101971: 85 c0 test %eax,%eax 80101973: 75 e0 jne 80101955 <ilock+0x35> sleep(ip, &icache.lock); ip->flags |= I_BUSY; 80101975: 8b 45 08 mov 0x8(%ebp),%eax 80101978: 8b 40 0c mov 0xc(%eax),%eax 8010197b: 83 c8 01 or $0x1,%eax 8010197e: 89 c2 mov %eax,%edx 80101980: 8b 45 08 mov 0x8(%ebp),%eax 80101983: 89 50 0c mov %edx,0xc(%eax) release(&icache.lock); 80101986: 83 ec 0c sub $0xc,%esp 80101989: 68 60 22 11 80 push $0x80112260 8010198e: e8 44 3c 00 00 call 801055d7 <release> 80101993: 83 c4 10 add $0x10,%esp if(!(ip->flags & I_VALID)){ 80101996: 8b 45 08 mov 0x8(%ebp),%eax 80101999: 8b 40 0c mov 0xc(%eax),%eax 8010199c: 83 e0 02 and $0x2,%eax 8010199f: 85 c0 test %eax,%eax 801019a1: 0f 85 d4 00 00 00 jne 80101a7b <ilock+0x15b> bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801019a7: 8b 45 08 mov 0x8(%ebp),%eax 801019aa: 8b 40 04 mov 0x4(%eax),%eax 801019ad: c1 e8 03 shr $0x3,%eax 801019b0: 89 c2 mov %eax,%edx 801019b2: a1 54 22 11 80 mov 0x80112254,%eax 801019b7: 01 c2 add %eax,%edx 801019b9: 8b 45 08 mov 0x8(%ebp),%eax 801019bc: 8b 00 mov (%eax),%eax 801019be: 83 ec 08 sub $0x8,%esp 801019c1: 52 push %edx 801019c2: 50 push %eax 801019c3: e8 ee e7 ff ff call 801001b6 <bread> 801019c8: 83 c4 10 add $0x10,%esp 801019cb: 89 45 f4 mov %eax,-0xc(%ebp) dip = (struct dinode*)bp->data + ip->inum%IPB; 801019ce: 8b 45 f4 mov -0xc(%ebp),%eax 801019d1: 8d 50 18 lea 0x18(%eax),%edx 801019d4: 8b 45 08 mov 0x8(%ebp),%eax 801019d7: 8b 40 04 mov 0x4(%eax),%eax 801019da: 83 e0 07 and $0x7,%eax 801019dd: c1 e0 06 shl $0x6,%eax 801019e0: 01 d0 add %edx,%eax 801019e2: 89 45 f0 mov %eax,-0x10(%ebp) ip->type = dip->type; 801019e5: 8b 45 f0 mov -0x10(%ebp),%eax 801019e8: 0f b7 10 movzwl (%eax),%edx 801019eb: 8b 45 08 mov 0x8(%ebp),%eax 801019ee: 66 89 50 10 mov %dx,0x10(%eax) ip->major = dip->major; 801019f2: 8b 45 f0 mov -0x10(%ebp),%eax 801019f5: 0f b7 50 02 movzwl 0x2(%eax),%edx 801019f9: 8b 45 08 mov 0x8(%ebp),%eax 801019fc: 66 89 50 12 mov %dx,0x12(%eax) ip->minor = dip->minor; 80101a00: 8b 45 f0 mov -0x10(%ebp),%eax 80101a03: 0f b7 50 04 movzwl 0x4(%eax),%edx 80101a07: 8b 45 08 mov 0x8(%ebp),%eax 80101a0a: 66 89 50 14 mov %dx,0x14(%eax) ip->nlink = dip->nlink; 80101a0e: 8b 45 f0 mov -0x10(%ebp),%eax 80101a11: 0f b7 50 06 movzwl 0x6(%eax),%edx 80101a15: 8b 45 08 mov 0x8(%ebp),%eax 80101a18: 66 89 50 16 mov %dx,0x16(%eax) ip->size = dip->size; 80101a1c: 8b 45 f0 mov -0x10(%ebp),%eax 80101a1f: 8b 50 08 mov 0x8(%eax),%edx 80101a22: 8b 45 08 mov 0x8(%ebp),%eax 80101a25: 89 50 18 mov %edx,0x18(%eax) memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 80101a28: 8b 45 f0 mov -0x10(%ebp),%eax 80101a2b: 8d 50 0c lea 0xc(%eax),%edx 80101a2e: 8b 45 08 mov 0x8(%ebp),%eax 80101a31: 83 c0 1c add $0x1c,%eax 80101a34: 83 ec 04 sub $0x4,%esp 80101a37: 6a 34 push $0x34 80101a39: 52 push %edx 80101a3a: 50 push %eax 80101a3b: e8 52 3e 00 00 call 80105892 <memmove> 80101a40: 83 c4 10 add $0x10,%esp brelse(bp); 80101a43: 83 ec 0c sub $0xc,%esp 80101a46: ff 75 f4 pushl -0xc(%ebp) 80101a49: e8 e0 e7 ff ff call 8010022e <brelse> 80101a4e: 83 c4 10 add $0x10,%esp ip->flags |= I_VALID; 80101a51: 8b 45 08 mov 0x8(%ebp),%eax 80101a54: 8b 40 0c mov 0xc(%eax),%eax 80101a57: 83 c8 02 or $0x2,%eax 80101a5a: 89 c2 mov %eax,%edx 80101a5c: 8b 45 08 mov 0x8(%ebp),%eax 80101a5f: 89 50 0c mov %edx,0xc(%eax) if(ip->type == 0) 80101a62: 8b 45 08 mov 0x8(%ebp),%eax 80101a65: 0f b7 40 10 movzwl 0x10(%eax),%eax 80101a69: 66 85 c0 test %ax,%ax 80101a6c: 75 0d jne 80101a7b <ilock+0x15b> panic("ilock: no type"); 80101a6e: 83 ec 0c sub $0xc,%esp 80101a71: 68 2e 8e 10 80 push $0x80108e2e 80101a76: e8 eb ea ff ff call 80100566 <panic> } } 80101a7b: 90 nop 80101a7c: c9 leave 80101a7d: c3 ret 80101a7e <iunlock>: // Unlock the given inode. void iunlock(struct inode *ip) { 80101a7e: 55 push %ebp 80101a7f: 89 e5 mov %esp,%ebp 80101a81: 83 ec 08 sub $0x8,%esp if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1) 80101a84: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80101a88: 74 17 je 80101aa1 <iunlock+0x23> 80101a8a: 8b 45 08 mov 0x8(%ebp),%eax 80101a8d: 8b 40 0c mov 0xc(%eax),%eax 80101a90: 83 e0 01 and $0x1,%eax 80101a93: 85 c0 test %eax,%eax 80101a95: 74 0a je 80101aa1 <iunlock+0x23> 80101a97: 8b 45 08 mov 0x8(%ebp),%eax 80101a9a: 8b 40 08 mov 0x8(%eax),%eax 80101a9d: 85 c0 test %eax,%eax 80101a9f: 7f 0d jg 80101aae <iunlock+0x30> panic("iunlock"); 80101aa1: 83 ec 0c sub $0xc,%esp 80101aa4: 68 3d 8e 10 80 push $0x80108e3d 80101aa9: e8 b8 ea ff ff call 80100566 <panic> acquire(&icache.lock); 80101aae: 83 ec 0c sub $0xc,%esp 80101ab1: 68 60 22 11 80 push $0x80112260 80101ab6: e8 b5 3a 00 00 call 80105570 <acquire> 80101abb: 83 c4 10 add $0x10,%esp ip->flags &= ~I_BUSY; 80101abe: 8b 45 08 mov 0x8(%ebp),%eax 80101ac1: 8b 40 0c mov 0xc(%eax),%eax 80101ac4: 83 e0 fe and $0xfffffffe,%eax 80101ac7: 89 c2 mov %eax,%edx 80101ac9: 8b 45 08 mov 0x8(%ebp),%eax 80101acc: 89 50 0c mov %edx,0xc(%eax) wakeup(ip); 80101acf: 83 ec 0c sub $0xc,%esp 80101ad2: ff 75 08 pushl 0x8(%ebp) 80101ad5: e8 74 38 00 00 call 8010534e <wakeup> 80101ada: 83 c4 10 add $0x10,%esp release(&icache.lock); 80101add: 83 ec 0c sub $0xc,%esp 80101ae0: 68 60 22 11 80 push $0x80112260 80101ae5: e8 ed 3a 00 00 call 801055d7 <release> 80101aea: 83 c4 10 add $0x10,%esp } 80101aed: 90 nop 80101aee: c9 leave 80101aef: c3 ret 80101af0 <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) { 80101af0: 55 push %ebp 80101af1: 89 e5 mov %esp,%ebp 80101af3: 83 ec 08 sub $0x8,%esp acquire(&icache.lock); 80101af6: 83 ec 0c sub $0xc,%esp 80101af9: 68 60 22 11 80 push $0x80112260 80101afe: e8 6d 3a 00 00 call 80105570 <acquire> 80101b03: 83 c4 10 add $0x10,%esp if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){ 80101b06: 8b 45 08 mov 0x8(%ebp),%eax 80101b09: 8b 40 08 mov 0x8(%eax),%eax 80101b0c: 83 f8 01 cmp $0x1,%eax 80101b0f: 0f 85 a9 00 00 00 jne 80101bbe <iput+0xce> 80101b15: 8b 45 08 mov 0x8(%ebp),%eax 80101b18: 8b 40 0c mov 0xc(%eax),%eax 80101b1b: 83 e0 02 and $0x2,%eax 80101b1e: 85 c0 test %eax,%eax 80101b20: 0f 84 98 00 00 00 je 80101bbe <iput+0xce> 80101b26: 8b 45 08 mov 0x8(%ebp),%eax 80101b29: 0f b7 40 16 movzwl 0x16(%eax),%eax 80101b2d: 66 85 c0 test %ax,%ax 80101b30: 0f 85 88 00 00 00 jne 80101bbe <iput+0xce> // inode has no links and no other references: truncate and free. if(ip->flags & I_BUSY) 80101b36: 8b 45 08 mov 0x8(%ebp),%eax 80101b39: 8b 40 0c mov 0xc(%eax),%eax 80101b3c: 83 e0 01 and $0x1,%eax 80101b3f: 85 c0 test %eax,%eax 80101b41: 74 0d je 80101b50 <iput+0x60> panic("iput busy"); 80101b43: 83 ec 0c sub $0xc,%esp 80101b46: 68 45 8e 10 80 push $0x80108e45 80101b4b: e8 16 ea ff ff call 80100566 <panic> ip->flags |= I_BUSY; 80101b50: 8b 45 08 mov 0x8(%ebp),%eax 80101b53: 8b 40 0c mov 0xc(%eax),%eax 80101b56: 83 c8 01 or $0x1,%eax 80101b59: 89 c2 mov %eax,%edx 80101b5b: 8b 45 08 mov 0x8(%ebp),%eax 80101b5e: 89 50 0c mov %edx,0xc(%eax) release(&icache.lock); 80101b61: 83 ec 0c sub $0xc,%esp 80101b64: 68 60 22 11 80 push $0x80112260 80101b69: e8 69 3a 00 00 call 801055d7 <release> 80101b6e: 83 c4 10 add $0x10,%esp itrunc(ip); 80101b71: 83 ec 0c sub $0xc,%esp 80101b74: ff 75 08 pushl 0x8(%ebp) 80101b77: e8 a8 01 00 00 call 80101d24 <itrunc> 80101b7c: 83 c4 10 add $0x10,%esp ip->type = 0; 80101b7f: 8b 45 08 mov 0x8(%ebp),%eax 80101b82: 66 c7 40 10 00 00 movw $0x0,0x10(%eax) iupdate(ip); 80101b88: 83 ec 0c sub $0xc,%esp 80101b8b: ff 75 08 pushl 0x8(%ebp) 80101b8e: e8 b3 fb ff ff call 80101746 <iupdate> 80101b93: 83 c4 10 add $0x10,%esp acquire(&icache.lock); 80101b96: 83 ec 0c sub $0xc,%esp 80101b99: 68 60 22 11 80 push $0x80112260 80101b9e: e8 cd 39 00 00 call 80105570 <acquire> 80101ba3: 83 c4 10 add $0x10,%esp ip->flags = 0; 80101ba6: 8b 45 08 mov 0x8(%ebp),%eax 80101ba9: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) wakeup(ip); 80101bb0: 83 ec 0c sub $0xc,%esp 80101bb3: ff 75 08 pushl 0x8(%ebp) 80101bb6: e8 93 37 00 00 call 8010534e <wakeup> 80101bbb: 83 c4 10 add $0x10,%esp } ip->ref--; 80101bbe: 8b 45 08 mov 0x8(%ebp),%eax 80101bc1: 8b 40 08 mov 0x8(%eax),%eax 80101bc4: 8d 50 ff lea -0x1(%eax),%edx 80101bc7: 8b 45 08 mov 0x8(%ebp),%eax 80101bca: 89 50 08 mov %edx,0x8(%eax) release(&icache.lock); 80101bcd: 83 ec 0c sub $0xc,%esp 80101bd0: 68 60 22 11 80 push $0x80112260 80101bd5: e8 fd 39 00 00 call 801055d7 <release> 80101bda: 83 c4 10 add $0x10,%esp } 80101bdd: 90 nop 80101bde: c9 leave 80101bdf: c3 ret 80101be0 <iunlockput>: // Common idiom: unlock, then put. void iunlockput(struct inode *ip) { 80101be0: 55 push %ebp 80101be1: 89 e5 mov %esp,%ebp 80101be3: 83 ec 08 sub $0x8,%esp iunlock(ip); 80101be6: 83 ec 0c sub $0xc,%esp 80101be9: ff 75 08 pushl 0x8(%ebp) 80101bec: e8 8d fe ff ff call 80101a7e <iunlock> 80101bf1: 83 c4 10 add $0x10,%esp iput(ip); 80101bf4: 83 ec 0c sub $0xc,%esp 80101bf7: ff 75 08 pushl 0x8(%ebp) 80101bfa: e8 f1 fe ff ff call 80101af0 <iput> 80101bff: 83 c4 10 add $0x10,%esp } 80101c02: 90 nop 80101c03: c9 leave 80101c04: c3 ret 80101c05 <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) { 80101c05: 55 push %ebp 80101c06: 89 e5 mov %esp,%ebp 80101c08: 53 push %ebx 80101c09: 83 ec 14 sub $0x14,%esp uint addr, *a; struct buf *bp; if(bn < NDIRECT){ 80101c0c: 83 7d 0c 0b cmpl $0xb,0xc(%ebp) 80101c10: 77 42 ja 80101c54 <bmap+0x4f> if((addr = ip->addrs[bn]) == 0) 80101c12: 8b 45 08 mov 0x8(%ebp),%eax 80101c15: 8b 55 0c mov 0xc(%ebp),%edx 80101c18: 83 c2 04 add $0x4,%edx 80101c1b: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax 80101c1f: 89 45 f4 mov %eax,-0xc(%ebp) 80101c22: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80101c26: 75 24 jne 80101c4c <bmap+0x47> ip->addrs[bn] = addr = balloc(ip->dev); 80101c28: 8b 45 08 mov 0x8(%ebp),%eax 80101c2b: 8b 00 mov (%eax),%eax 80101c2d: 83 ec 0c sub $0xc,%esp 80101c30: 50 push %eax 80101c31: e8 e4 f7 ff ff call 8010141a <balloc> 80101c36: 83 c4 10 add $0x10,%esp 80101c39: 89 45 f4 mov %eax,-0xc(%ebp) 80101c3c: 8b 45 08 mov 0x8(%ebp),%eax 80101c3f: 8b 55 0c mov 0xc(%ebp),%edx 80101c42: 8d 4a 04 lea 0x4(%edx),%ecx 80101c45: 8b 55 f4 mov -0xc(%ebp),%edx 80101c48: 89 54 88 0c mov %edx,0xc(%eax,%ecx,4) return addr; 80101c4c: 8b 45 f4 mov -0xc(%ebp),%eax 80101c4f: e9 cb 00 00 00 jmp 80101d1f <bmap+0x11a> } bn -= NDIRECT; 80101c54: 83 6d 0c 0c subl $0xc,0xc(%ebp) if(bn < NINDIRECT){ 80101c58: 83 7d 0c 7f cmpl $0x7f,0xc(%ebp) 80101c5c: 0f 87 b0 00 00 00 ja 80101d12 <bmap+0x10d> // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) 80101c62: 8b 45 08 mov 0x8(%ebp),%eax 80101c65: 8b 40 4c mov 0x4c(%eax),%eax 80101c68: 89 45 f4 mov %eax,-0xc(%ebp) 80101c6b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80101c6f: 75 1d jne 80101c8e <bmap+0x89> ip->addrs[NDIRECT] = addr = balloc(ip->dev); 80101c71: 8b 45 08 mov 0x8(%ebp),%eax 80101c74: 8b 00 mov (%eax),%eax 80101c76: 83 ec 0c sub $0xc,%esp 80101c79: 50 push %eax 80101c7a: e8 9b f7 ff ff call 8010141a <balloc> 80101c7f: 83 c4 10 add $0x10,%esp 80101c82: 89 45 f4 mov %eax,-0xc(%ebp) 80101c85: 8b 45 08 mov 0x8(%ebp),%eax 80101c88: 8b 55 f4 mov -0xc(%ebp),%edx 80101c8b: 89 50 4c mov %edx,0x4c(%eax) bp = bread(ip->dev, addr); 80101c8e: 8b 45 08 mov 0x8(%ebp),%eax 80101c91: 8b 00 mov (%eax),%eax 80101c93: 83 ec 08 sub $0x8,%esp 80101c96: ff 75 f4 pushl -0xc(%ebp) 80101c99: 50 push %eax 80101c9a: e8 17 e5 ff ff call 801001b6 <bread> 80101c9f: 83 c4 10 add $0x10,%esp 80101ca2: 89 45 f0 mov %eax,-0x10(%ebp) a = (uint*)bp->data; 80101ca5: 8b 45 f0 mov -0x10(%ebp),%eax 80101ca8: 83 c0 18 add $0x18,%eax 80101cab: 89 45 ec mov %eax,-0x14(%ebp) if((addr = a[bn]) == 0){ 80101cae: 8b 45 0c mov 0xc(%ebp),%eax 80101cb1: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80101cb8: 8b 45 ec mov -0x14(%ebp),%eax 80101cbb: 01 d0 add %edx,%eax 80101cbd: 8b 00 mov (%eax),%eax 80101cbf: 89 45 f4 mov %eax,-0xc(%ebp) 80101cc2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80101cc6: 75 37 jne 80101cff <bmap+0xfa> a[bn] = addr = balloc(ip->dev); 80101cc8: 8b 45 0c mov 0xc(%ebp),%eax 80101ccb: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80101cd2: 8b 45 ec mov -0x14(%ebp),%eax 80101cd5: 8d 1c 02 lea (%edx,%eax,1),%ebx 80101cd8: 8b 45 08 mov 0x8(%ebp),%eax 80101cdb: 8b 00 mov (%eax),%eax 80101cdd: 83 ec 0c sub $0xc,%esp 80101ce0: 50 push %eax 80101ce1: e8 34 f7 ff ff call 8010141a <balloc> 80101ce6: 83 c4 10 add $0x10,%esp 80101ce9: 89 45 f4 mov %eax,-0xc(%ebp) 80101cec: 8b 45 f4 mov -0xc(%ebp),%eax 80101cef: 89 03 mov %eax,(%ebx) log_write(bp); 80101cf1: 83 ec 0c sub $0xc,%esp 80101cf4: ff 75 f0 pushl -0x10(%ebp) 80101cf7: e8 63 1a 00 00 call 8010375f <log_write> 80101cfc: 83 c4 10 add $0x10,%esp } brelse(bp); 80101cff: 83 ec 0c sub $0xc,%esp 80101d02: ff 75 f0 pushl -0x10(%ebp) 80101d05: e8 24 e5 ff ff call 8010022e <brelse> 80101d0a: 83 c4 10 add $0x10,%esp return addr; 80101d0d: 8b 45 f4 mov -0xc(%ebp),%eax 80101d10: eb 0d jmp 80101d1f <bmap+0x11a> } panic("bmap: out of range"); 80101d12: 83 ec 0c sub $0xc,%esp 80101d15: 68 4f 8e 10 80 push $0x80108e4f 80101d1a: e8 47 e8 ff ff call 80100566 <panic> } 80101d1f: 8b 5d fc mov -0x4(%ebp),%ebx 80101d22: c9 leave 80101d23: c3 ret 80101d24 <itrunc>: // to it (no directory entries referring to it) // and has no in-memory reference to it (is // not an open file or current directory). static void itrunc(struct inode *ip) { 80101d24: 55 push %ebp 80101d25: 89 e5 mov %esp,%ebp 80101d27: 83 ec 18 sub $0x18,%esp int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ 80101d2a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80101d31: eb 45 jmp 80101d78 <itrunc+0x54> if(ip->addrs[i]){ 80101d33: 8b 45 08 mov 0x8(%ebp),%eax 80101d36: 8b 55 f4 mov -0xc(%ebp),%edx 80101d39: 83 c2 04 add $0x4,%edx 80101d3c: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax 80101d40: 85 c0 test %eax,%eax 80101d42: 74 30 je 80101d74 <itrunc+0x50> bfree(ip->dev, ip->addrs[i]); 80101d44: 8b 45 08 mov 0x8(%ebp),%eax 80101d47: 8b 55 f4 mov -0xc(%ebp),%edx 80101d4a: 83 c2 04 add $0x4,%edx 80101d4d: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax 80101d51: 8b 55 08 mov 0x8(%ebp),%edx 80101d54: 8b 12 mov (%edx),%edx 80101d56: 83 ec 08 sub $0x8,%esp 80101d59: 50 push %eax 80101d5a: 52 push %edx 80101d5b: e8 06 f8 ff ff call 80101566 <bfree> 80101d60: 83 c4 10 add $0x10,%esp ip->addrs[i] = 0; 80101d63: 8b 45 08 mov 0x8(%ebp),%eax 80101d66: 8b 55 f4 mov -0xc(%ebp),%edx 80101d69: 83 c2 04 add $0x4,%edx 80101d6c: c7 44 90 0c 00 00 00 movl $0x0,0xc(%eax,%edx,4) 80101d73: 00 { int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ 80101d74: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80101d78: 83 7d f4 0b cmpl $0xb,-0xc(%ebp) 80101d7c: 7e b5 jle 80101d33 <itrunc+0xf> bfree(ip->dev, ip->addrs[i]); ip->addrs[i] = 0; } } if(ip->addrs[NDIRECT]){ 80101d7e: 8b 45 08 mov 0x8(%ebp),%eax 80101d81: 8b 40 4c mov 0x4c(%eax),%eax 80101d84: 85 c0 test %eax,%eax 80101d86: 0f 84 a1 00 00 00 je 80101e2d <itrunc+0x109> bp = bread(ip->dev, ip->addrs[NDIRECT]); 80101d8c: 8b 45 08 mov 0x8(%ebp),%eax 80101d8f: 8b 50 4c mov 0x4c(%eax),%edx 80101d92: 8b 45 08 mov 0x8(%ebp),%eax 80101d95: 8b 00 mov (%eax),%eax 80101d97: 83 ec 08 sub $0x8,%esp 80101d9a: 52 push %edx 80101d9b: 50 push %eax 80101d9c: e8 15 e4 ff ff call 801001b6 <bread> 80101da1: 83 c4 10 add $0x10,%esp 80101da4: 89 45 ec mov %eax,-0x14(%ebp) a = (uint*)bp->data; 80101da7: 8b 45 ec mov -0x14(%ebp),%eax 80101daa: 83 c0 18 add $0x18,%eax 80101dad: 89 45 e8 mov %eax,-0x18(%ebp) for(j = 0; j < NINDIRECT; j++){ 80101db0: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 80101db7: eb 3c jmp 80101df5 <itrunc+0xd1> if(a[j]) 80101db9: 8b 45 f0 mov -0x10(%ebp),%eax 80101dbc: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80101dc3: 8b 45 e8 mov -0x18(%ebp),%eax 80101dc6: 01 d0 add %edx,%eax 80101dc8: 8b 00 mov (%eax),%eax 80101dca: 85 c0 test %eax,%eax 80101dcc: 74 23 je 80101df1 <itrunc+0xcd> bfree(ip->dev, a[j]); 80101dce: 8b 45 f0 mov -0x10(%ebp),%eax 80101dd1: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80101dd8: 8b 45 e8 mov -0x18(%ebp),%eax 80101ddb: 01 d0 add %edx,%eax 80101ddd: 8b 00 mov (%eax),%eax 80101ddf: 8b 55 08 mov 0x8(%ebp),%edx 80101de2: 8b 12 mov (%edx),%edx 80101de4: 83 ec 08 sub $0x8,%esp 80101de7: 50 push %eax 80101de8: 52 push %edx 80101de9: e8 78 f7 ff ff call 80101566 <bfree> 80101dee: 83 c4 10 add $0x10,%esp } if(ip->addrs[NDIRECT]){ bp = bread(ip->dev, ip->addrs[NDIRECT]); a = (uint*)bp->data; for(j = 0; j < NINDIRECT; j++){ 80101df1: 83 45 f0 01 addl $0x1,-0x10(%ebp) 80101df5: 8b 45 f0 mov -0x10(%ebp),%eax 80101df8: 83 f8 7f cmp $0x7f,%eax 80101dfb: 76 bc jbe 80101db9 <itrunc+0x95> if(a[j]) bfree(ip->dev, a[j]); } brelse(bp); 80101dfd: 83 ec 0c sub $0xc,%esp 80101e00: ff 75 ec pushl -0x14(%ebp) 80101e03: e8 26 e4 ff ff call 8010022e <brelse> 80101e08: 83 c4 10 add $0x10,%esp bfree(ip->dev, ip->addrs[NDIRECT]); 80101e0b: 8b 45 08 mov 0x8(%ebp),%eax 80101e0e: 8b 40 4c mov 0x4c(%eax),%eax 80101e11: 8b 55 08 mov 0x8(%ebp),%edx 80101e14: 8b 12 mov (%edx),%edx 80101e16: 83 ec 08 sub $0x8,%esp 80101e19: 50 push %eax 80101e1a: 52 push %edx 80101e1b: e8 46 f7 ff ff call 80101566 <bfree> 80101e20: 83 c4 10 add $0x10,%esp ip->addrs[NDIRECT] = 0; 80101e23: 8b 45 08 mov 0x8(%ebp),%eax 80101e26: c7 40 4c 00 00 00 00 movl $0x0,0x4c(%eax) } ip->size = 0; 80101e2d: 8b 45 08 mov 0x8(%ebp),%eax 80101e30: c7 40 18 00 00 00 00 movl $0x0,0x18(%eax) iupdate(ip); 80101e37: 83 ec 0c sub $0xc,%esp 80101e3a: ff 75 08 pushl 0x8(%ebp) 80101e3d: e8 04 f9 ff ff call 80101746 <iupdate> 80101e42: 83 c4 10 add $0x10,%esp } 80101e45: 90 nop 80101e46: c9 leave 80101e47: c3 ret 80101e48 <stati>: // Copy stat information from inode. void stati(struct inode *ip, struct stat *st) { 80101e48: 55 push %ebp 80101e49: 89 e5 mov %esp,%ebp st->dev = ip->dev; 80101e4b: 8b 45 08 mov 0x8(%ebp),%eax 80101e4e: 8b 00 mov (%eax),%eax 80101e50: 89 c2 mov %eax,%edx 80101e52: 8b 45 0c mov 0xc(%ebp),%eax 80101e55: 89 50 04 mov %edx,0x4(%eax) st->ino = ip->inum; 80101e58: 8b 45 08 mov 0x8(%ebp),%eax 80101e5b: 8b 50 04 mov 0x4(%eax),%edx 80101e5e: 8b 45 0c mov 0xc(%ebp),%eax 80101e61: 89 50 08 mov %edx,0x8(%eax) st->type = ip->type; 80101e64: 8b 45 08 mov 0x8(%ebp),%eax 80101e67: 0f b7 50 10 movzwl 0x10(%eax),%edx 80101e6b: 8b 45 0c mov 0xc(%ebp),%eax 80101e6e: 66 89 10 mov %dx,(%eax) st->nlink = ip->nlink; 80101e71: 8b 45 08 mov 0x8(%ebp),%eax 80101e74: 0f b7 50 16 movzwl 0x16(%eax),%edx 80101e78: 8b 45 0c mov 0xc(%ebp),%eax 80101e7b: 66 89 50 0c mov %dx,0xc(%eax) st->size = ip->size; 80101e7f: 8b 45 08 mov 0x8(%ebp),%eax 80101e82: 8b 50 18 mov 0x18(%eax),%edx 80101e85: 8b 45 0c mov 0xc(%ebp),%eax 80101e88: 89 50 10 mov %edx,0x10(%eax) } 80101e8b: 90 nop 80101e8c: 5d pop %ebp 80101e8d: c3 ret 80101e8e <readi>: //PAGEBREAK! // Read data from inode. int readi(struct inode *ip, char *dst, uint off, uint n) { 80101e8e: 55 push %ebp 80101e8f: 89 e5 mov %esp,%ebp 80101e91: 83 ec 18 sub $0x18,%esp uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101e94: 8b 45 08 mov 0x8(%ebp),%eax 80101e97: 0f b7 40 10 movzwl 0x10(%eax),%eax 80101e9b: 66 83 f8 03 cmp $0x3,%ax 80101e9f: 75 5c jne 80101efd <readi+0x6f> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) 80101ea1: 8b 45 08 mov 0x8(%ebp),%eax 80101ea4: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101ea8: 66 85 c0 test %ax,%ax 80101eab: 78 20 js 80101ecd <readi+0x3f> 80101ead: 8b 45 08 mov 0x8(%ebp),%eax 80101eb0: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101eb4: 66 83 f8 09 cmp $0x9,%ax 80101eb8: 7f 13 jg 80101ecd <readi+0x3f> 80101eba: 8b 45 08 mov 0x8(%ebp),%eax 80101ebd: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101ec1: 98 cwtl 80101ec2: 8b 04 c5 e0 21 11 80 mov -0x7feede20(,%eax,8),%eax 80101ec9: 85 c0 test %eax,%eax 80101ecb: 75 0a jne 80101ed7 <readi+0x49> return -1; 80101ecd: b8 ff ff ff ff mov $0xffffffff,%eax 80101ed2: e9 0c 01 00 00 jmp 80101fe3 <readi+0x155> return devsw[ip->major].read(ip, dst, n); 80101ed7: 8b 45 08 mov 0x8(%ebp),%eax 80101eda: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101ede: 98 cwtl 80101edf: 8b 04 c5 e0 21 11 80 mov -0x7feede20(,%eax,8),%eax 80101ee6: 8b 55 14 mov 0x14(%ebp),%edx 80101ee9: 83 ec 04 sub $0x4,%esp 80101eec: 52 push %edx 80101eed: ff 75 0c pushl 0xc(%ebp) 80101ef0: ff 75 08 pushl 0x8(%ebp) 80101ef3: ff d0 call *%eax 80101ef5: 83 c4 10 add $0x10,%esp 80101ef8: e9 e6 00 00 00 jmp 80101fe3 <readi+0x155> } if(off > ip->size || off + n < off) 80101efd: 8b 45 08 mov 0x8(%ebp),%eax 80101f00: 8b 40 18 mov 0x18(%eax),%eax 80101f03: 3b 45 10 cmp 0x10(%ebp),%eax 80101f06: 72 0d jb 80101f15 <readi+0x87> 80101f08: 8b 55 10 mov 0x10(%ebp),%edx 80101f0b: 8b 45 14 mov 0x14(%ebp),%eax 80101f0e: 01 d0 add %edx,%eax 80101f10: 3b 45 10 cmp 0x10(%ebp),%eax 80101f13: 73 0a jae 80101f1f <readi+0x91> return -1; 80101f15: b8 ff ff ff ff mov $0xffffffff,%eax 80101f1a: e9 c4 00 00 00 jmp 80101fe3 <readi+0x155> if(off + n > ip->size) 80101f1f: 8b 55 10 mov 0x10(%ebp),%edx 80101f22: 8b 45 14 mov 0x14(%ebp),%eax 80101f25: 01 c2 add %eax,%edx 80101f27: 8b 45 08 mov 0x8(%ebp),%eax 80101f2a: 8b 40 18 mov 0x18(%eax),%eax 80101f2d: 39 c2 cmp %eax,%edx 80101f2f: 76 0c jbe 80101f3d <readi+0xaf> n = ip->size - off; 80101f31: 8b 45 08 mov 0x8(%ebp),%eax 80101f34: 8b 40 18 mov 0x18(%eax),%eax 80101f37: 2b 45 10 sub 0x10(%ebp),%eax 80101f3a: 89 45 14 mov %eax,0x14(%ebp) for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80101f3d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80101f44: e9 8b 00 00 00 jmp 80101fd4 <readi+0x146> bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101f49: 8b 45 10 mov 0x10(%ebp),%eax 80101f4c: c1 e8 09 shr $0x9,%eax 80101f4f: 83 ec 08 sub $0x8,%esp 80101f52: 50 push %eax 80101f53: ff 75 08 pushl 0x8(%ebp) 80101f56: e8 aa fc ff ff call 80101c05 <bmap> 80101f5b: 83 c4 10 add $0x10,%esp 80101f5e: 89 c2 mov %eax,%edx 80101f60: 8b 45 08 mov 0x8(%ebp),%eax 80101f63: 8b 00 mov (%eax),%eax 80101f65: 83 ec 08 sub $0x8,%esp 80101f68: 52 push %edx 80101f69: 50 push %eax 80101f6a: e8 47 e2 ff ff call 801001b6 <bread> 80101f6f: 83 c4 10 add $0x10,%esp 80101f72: 89 45 f0 mov %eax,-0x10(%ebp) m = min(n - tot, BSIZE - off%BSIZE); 80101f75: 8b 45 10 mov 0x10(%ebp),%eax 80101f78: 25 ff 01 00 00 and $0x1ff,%eax 80101f7d: ba 00 02 00 00 mov $0x200,%edx 80101f82: 29 c2 sub %eax,%edx 80101f84: 8b 45 14 mov 0x14(%ebp),%eax 80101f87: 2b 45 f4 sub -0xc(%ebp),%eax 80101f8a: 39 c2 cmp %eax,%edx 80101f8c: 0f 46 c2 cmovbe %edx,%eax 80101f8f: 89 45 ec mov %eax,-0x14(%ebp) memmove(dst, bp->data + off%BSIZE, m); 80101f92: 8b 45 f0 mov -0x10(%ebp),%eax 80101f95: 8d 50 18 lea 0x18(%eax),%edx 80101f98: 8b 45 10 mov 0x10(%ebp),%eax 80101f9b: 25 ff 01 00 00 and $0x1ff,%eax 80101fa0: 01 d0 add %edx,%eax 80101fa2: 83 ec 04 sub $0x4,%esp 80101fa5: ff 75 ec pushl -0x14(%ebp) 80101fa8: 50 push %eax 80101fa9: ff 75 0c pushl 0xc(%ebp) 80101fac: e8 e1 38 00 00 call 80105892 <memmove> 80101fb1: 83 c4 10 add $0x10,%esp brelse(bp); 80101fb4: 83 ec 0c sub $0xc,%esp 80101fb7: ff 75 f0 pushl -0x10(%ebp) 80101fba: e8 6f e2 ff ff call 8010022e <brelse> 80101fbf: 83 c4 10 add $0x10,%esp if(off > ip->size || off + n < off) return -1; if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80101fc2: 8b 45 ec mov -0x14(%ebp),%eax 80101fc5: 01 45 f4 add %eax,-0xc(%ebp) 80101fc8: 8b 45 ec mov -0x14(%ebp),%eax 80101fcb: 01 45 10 add %eax,0x10(%ebp) 80101fce: 8b 45 ec mov -0x14(%ebp),%eax 80101fd1: 01 45 0c add %eax,0xc(%ebp) 80101fd4: 8b 45 f4 mov -0xc(%ebp),%eax 80101fd7: 3b 45 14 cmp 0x14(%ebp),%eax 80101fda: 0f 82 69 ff ff ff jb 80101f49 <readi+0xbb> bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); memmove(dst, bp->data + off%BSIZE, m); brelse(bp); } return n; 80101fe0: 8b 45 14 mov 0x14(%ebp),%eax } 80101fe3: c9 leave 80101fe4: c3 ret 80101fe5 <writei>: // PAGEBREAK! // Write data to inode. int writei(struct inode *ip, char *src, uint off, uint n) { 80101fe5: 55 push %ebp 80101fe6: 89 e5 mov %esp,%ebp 80101fe8: 83 ec 18 sub $0x18,%esp uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101feb: 8b 45 08 mov 0x8(%ebp),%eax 80101fee: 0f b7 40 10 movzwl 0x10(%eax),%eax 80101ff2: 66 83 f8 03 cmp $0x3,%ax 80101ff6: 75 5c jne 80102054 <writei+0x6f> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) 80101ff8: 8b 45 08 mov 0x8(%ebp),%eax 80101ffb: 0f b7 40 12 movzwl 0x12(%eax),%eax 80101fff: 66 85 c0 test %ax,%ax 80102002: 78 20 js 80102024 <writei+0x3f> 80102004: 8b 45 08 mov 0x8(%ebp),%eax 80102007: 0f b7 40 12 movzwl 0x12(%eax),%eax 8010200b: 66 83 f8 09 cmp $0x9,%ax 8010200f: 7f 13 jg 80102024 <writei+0x3f> 80102011: 8b 45 08 mov 0x8(%ebp),%eax 80102014: 0f b7 40 12 movzwl 0x12(%eax),%eax 80102018: 98 cwtl 80102019: 8b 04 c5 e4 21 11 80 mov -0x7feede1c(,%eax,8),%eax 80102020: 85 c0 test %eax,%eax 80102022: 75 0a jne 8010202e <writei+0x49> return -1; 80102024: b8 ff ff ff ff mov $0xffffffff,%eax 80102029: e9 3d 01 00 00 jmp 8010216b <writei+0x186> return devsw[ip->major].write(ip, src, n); 8010202e: 8b 45 08 mov 0x8(%ebp),%eax 80102031: 0f b7 40 12 movzwl 0x12(%eax),%eax 80102035: 98 cwtl 80102036: 8b 04 c5 e4 21 11 80 mov -0x7feede1c(,%eax,8),%eax 8010203d: 8b 55 14 mov 0x14(%ebp),%edx 80102040: 83 ec 04 sub $0x4,%esp 80102043: 52 push %edx 80102044: ff 75 0c pushl 0xc(%ebp) 80102047: ff 75 08 pushl 0x8(%ebp) 8010204a: ff d0 call *%eax 8010204c: 83 c4 10 add $0x10,%esp 8010204f: e9 17 01 00 00 jmp 8010216b <writei+0x186> } if(off > ip->size || off + n < off) 80102054: 8b 45 08 mov 0x8(%ebp),%eax 80102057: 8b 40 18 mov 0x18(%eax),%eax 8010205a: 3b 45 10 cmp 0x10(%ebp),%eax 8010205d: 72 0d jb 8010206c <writei+0x87> 8010205f: 8b 55 10 mov 0x10(%ebp),%edx 80102062: 8b 45 14 mov 0x14(%ebp),%eax 80102065: 01 d0 add %edx,%eax 80102067: 3b 45 10 cmp 0x10(%ebp),%eax 8010206a: 73 0a jae 80102076 <writei+0x91> return -1; 8010206c: b8 ff ff ff ff mov $0xffffffff,%eax 80102071: e9 f5 00 00 00 jmp 8010216b <writei+0x186> if(off + n > MAXFILE*BSIZE) 80102076: 8b 55 10 mov 0x10(%ebp),%edx 80102079: 8b 45 14 mov 0x14(%ebp),%eax 8010207c: 01 d0 add %edx,%eax 8010207e: 3d 00 18 01 00 cmp $0x11800,%eax 80102083: 76 0a jbe 8010208f <writei+0xaa> return -1; 80102085: b8 ff ff ff ff mov $0xffffffff,%eax 8010208a: e9 dc 00 00 00 jmp 8010216b <writei+0x186> for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 8010208f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80102096: e9 99 00 00 00 jmp 80102134 <writei+0x14f> bp = bread(ip->dev, bmap(ip, off/BSIZE)); 8010209b: 8b 45 10 mov 0x10(%ebp),%eax 8010209e: c1 e8 09 shr $0x9,%eax 801020a1: 83 ec 08 sub $0x8,%esp 801020a4: 50 push %eax 801020a5: ff 75 08 pushl 0x8(%ebp) 801020a8: e8 58 fb ff ff call 80101c05 <bmap> 801020ad: 83 c4 10 add $0x10,%esp 801020b0: 89 c2 mov %eax,%edx 801020b2: 8b 45 08 mov 0x8(%ebp),%eax 801020b5: 8b 00 mov (%eax),%eax 801020b7: 83 ec 08 sub $0x8,%esp 801020ba: 52 push %edx 801020bb: 50 push %eax 801020bc: e8 f5 e0 ff ff call 801001b6 <bread> 801020c1: 83 c4 10 add $0x10,%esp 801020c4: 89 45 f0 mov %eax,-0x10(%ebp) m = min(n - tot, BSIZE - off%BSIZE); 801020c7: 8b 45 10 mov 0x10(%ebp),%eax 801020ca: 25 ff 01 00 00 and $0x1ff,%eax 801020cf: ba 00 02 00 00 mov $0x200,%edx 801020d4: 29 c2 sub %eax,%edx 801020d6: 8b 45 14 mov 0x14(%ebp),%eax 801020d9: 2b 45 f4 sub -0xc(%ebp),%eax 801020dc: 39 c2 cmp %eax,%edx 801020de: 0f 46 c2 cmovbe %edx,%eax 801020e1: 89 45 ec mov %eax,-0x14(%ebp) memmove(bp->data + off%BSIZE, src, m); 801020e4: 8b 45 f0 mov -0x10(%ebp),%eax 801020e7: 8d 50 18 lea 0x18(%eax),%edx 801020ea: 8b 45 10 mov 0x10(%ebp),%eax 801020ed: 25 ff 01 00 00 and $0x1ff,%eax 801020f2: 01 d0 add %edx,%eax 801020f4: 83 ec 04 sub $0x4,%esp 801020f7: ff 75 ec pushl -0x14(%ebp) 801020fa: ff 75 0c pushl 0xc(%ebp) 801020fd: 50 push %eax 801020fe: e8 8f 37 00 00 call 80105892 <memmove> 80102103: 83 c4 10 add $0x10,%esp log_write(bp); 80102106: 83 ec 0c sub $0xc,%esp 80102109: ff 75 f0 pushl -0x10(%ebp) 8010210c: e8 4e 16 00 00 call 8010375f <log_write> 80102111: 83 c4 10 add $0x10,%esp brelse(bp); 80102114: 83 ec 0c sub $0xc,%esp 80102117: ff 75 f0 pushl -0x10(%ebp) 8010211a: e8 0f e1 ff ff call 8010022e <brelse> 8010211f: 83 c4 10 add $0x10,%esp if(off > ip->size || off + n < off) return -1; if(off + n > MAXFILE*BSIZE) return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 80102122: 8b 45 ec mov -0x14(%ebp),%eax 80102125: 01 45 f4 add %eax,-0xc(%ebp) 80102128: 8b 45 ec mov -0x14(%ebp),%eax 8010212b: 01 45 10 add %eax,0x10(%ebp) 8010212e: 8b 45 ec mov -0x14(%ebp),%eax 80102131: 01 45 0c add %eax,0xc(%ebp) 80102134: 8b 45 f4 mov -0xc(%ebp),%eax 80102137: 3b 45 14 cmp 0x14(%ebp),%eax 8010213a: 0f 82 5b ff ff ff jb 8010209b <writei+0xb6> memmove(bp->data + off%BSIZE, src, m); log_write(bp); brelse(bp); } if(n > 0 && off > ip->size){ 80102140: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 80102144: 74 22 je 80102168 <writei+0x183> 80102146: 8b 45 08 mov 0x8(%ebp),%eax 80102149: 8b 40 18 mov 0x18(%eax),%eax 8010214c: 3b 45 10 cmp 0x10(%ebp),%eax 8010214f: 73 17 jae 80102168 <writei+0x183> ip->size = off; 80102151: 8b 45 08 mov 0x8(%ebp),%eax 80102154: 8b 55 10 mov 0x10(%ebp),%edx 80102157: 89 50 18 mov %edx,0x18(%eax) iupdate(ip); 8010215a: 83 ec 0c sub $0xc,%esp 8010215d: ff 75 08 pushl 0x8(%ebp) 80102160: e8 e1 f5 ff ff call 80101746 <iupdate> 80102165: 83 c4 10 add $0x10,%esp } return n; 80102168: 8b 45 14 mov 0x14(%ebp),%eax } 8010216b: c9 leave 8010216c: c3 ret 8010216d <namecmp>: //PAGEBREAK! // Directories int namecmp(const char *s, const char *t) { 8010216d: 55 push %ebp 8010216e: 89 e5 mov %esp,%ebp 80102170: 83 ec 08 sub $0x8,%esp return strncmp(s, t, DIRSIZ); 80102173: 83 ec 04 sub $0x4,%esp 80102176: 6a 0e push $0xe 80102178: ff 75 0c pushl 0xc(%ebp) 8010217b: ff 75 08 pushl 0x8(%ebp) 8010217e: e8 a5 37 00 00 call 80105928 <strncmp> 80102183: 83 c4 10 add $0x10,%esp } 80102186: c9 leave 80102187: c3 ret 80102188 <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) { 80102188: 55 push %ebp 80102189: 89 e5 mov %esp,%ebp 8010218b: 83 ec 28 sub $0x28,%esp uint off, inum; struct dirent de; if(dp->type != T_DIR) 8010218e: 8b 45 08 mov 0x8(%ebp),%eax 80102191: 0f b7 40 10 movzwl 0x10(%eax),%eax 80102195: 66 83 f8 01 cmp $0x1,%ax 80102199: 74 0d je 801021a8 <dirlookup+0x20> panic("dirlookup not DIR"); 8010219b: 83 ec 0c sub $0xc,%esp 8010219e: 68 62 8e 10 80 push $0x80108e62 801021a3: e8 be e3 ff ff call 80100566 <panic> for(off = 0; off < dp->size; off += sizeof(de)){ 801021a8: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801021af: eb 7b jmp 8010222c <dirlookup+0xa4> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 801021b1: 6a 10 push $0x10 801021b3: ff 75 f4 pushl -0xc(%ebp) 801021b6: 8d 45 e0 lea -0x20(%ebp),%eax 801021b9: 50 push %eax 801021ba: ff 75 08 pushl 0x8(%ebp) 801021bd: e8 cc fc ff ff call 80101e8e <readi> 801021c2: 83 c4 10 add $0x10,%esp 801021c5: 83 f8 10 cmp $0x10,%eax 801021c8: 74 0d je 801021d7 <dirlookup+0x4f> panic("dirlink read"); 801021ca: 83 ec 0c sub $0xc,%esp 801021cd: 68 74 8e 10 80 push $0x80108e74 801021d2: e8 8f e3 ff ff call 80100566 <panic> if(de.inum == 0) 801021d7: 0f b7 45 e0 movzwl -0x20(%ebp),%eax 801021db: 66 85 c0 test %ax,%ax 801021de: 74 47 je 80102227 <dirlookup+0x9f> continue; if(namecmp(name, de.name) == 0){ 801021e0: 83 ec 08 sub $0x8,%esp 801021e3: 8d 45 e0 lea -0x20(%ebp),%eax 801021e6: 83 c0 02 add $0x2,%eax 801021e9: 50 push %eax 801021ea: ff 75 0c pushl 0xc(%ebp) 801021ed: e8 7b ff ff ff call 8010216d <namecmp> 801021f2: 83 c4 10 add $0x10,%esp 801021f5: 85 c0 test %eax,%eax 801021f7: 75 2f jne 80102228 <dirlookup+0xa0> // entry matches path element if(poff) 801021f9: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 801021fd: 74 08 je 80102207 <dirlookup+0x7f> *poff = off; 801021ff: 8b 45 10 mov 0x10(%ebp),%eax 80102202: 8b 55 f4 mov -0xc(%ebp),%edx 80102205: 89 10 mov %edx,(%eax) inum = de.inum; 80102207: 0f b7 45 e0 movzwl -0x20(%ebp),%eax 8010220b: 0f b7 c0 movzwl %ax,%eax 8010220e: 89 45 f0 mov %eax,-0x10(%ebp) return iget(dp->dev, inum); 80102211: 8b 45 08 mov 0x8(%ebp),%eax 80102214: 8b 00 mov (%eax),%eax 80102216: 83 ec 08 sub $0x8,%esp 80102219: ff 75 f0 pushl -0x10(%ebp) 8010221c: 50 push %eax 8010221d: e8 e5 f5 ff ff call 80101807 <iget> 80102222: 83 c4 10 add $0x10,%esp 80102225: eb 19 jmp 80102240 <dirlookup+0xb8> for(off = 0; off < dp->size; off += sizeof(de)){ if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("dirlink read"); if(de.inum == 0) continue; 80102227: 90 nop struct dirent de; if(dp->type != T_DIR) panic("dirlookup not DIR"); for(off = 0; off < dp->size; off += sizeof(de)){ 80102228: 83 45 f4 10 addl $0x10,-0xc(%ebp) 8010222c: 8b 45 08 mov 0x8(%ebp),%eax 8010222f: 8b 40 18 mov 0x18(%eax),%eax 80102232: 3b 45 f4 cmp -0xc(%ebp),%eax 80102235: 0f 87 76 ff ff ff ja 801021b1 <dirlookup+0x29> inum = de.inum; return iget(dp->dev, inum); } } return 0; 8010223b: b8 00 00 00 00 mov $0x0,%eax } 80102240: c9 leave 80102241: c3 ret 80102242 <dirlink>: // Write a new directory entry (name, inum) into the directory dp. int dirlink(struct inode *dp, char *name, uint inum) { 80102242: 55 push %ebp 80102243: 89 e5 mov %esp,%ebp 80102245: 83 ec 28 sub $0x28,%esp int off; struct dirent de; struct inode *ip; // Check that name is not present. if((ip = dirlookup(dp, name, 0)) != 0){ 80102248: 83 ec 04 sub $0x4,%esp 8010224b: 6a 00 push $0x0 8010224d: ff 75 0c pushl 0xc(%ebp) 80102250: ff 75 08 pushl 0x8(%ebp) 80102253: e8 30 ff ff ff call 80102188 <dirlookup> 80102258: 83 c4 10 add $0x10,%esp 8010225b: 89 45 f0 mov %eax,-0x10(%ebp) 8010225e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80102262: 74 18 je 8010227c <dirlink+0x3a> iput(ip); 80102264: 83 ec 0c sub $0xc,%esp 80102267: ff 75 f0 pushl -0x10(%ebp) 8010226a: e8 81 f8 ff ff call 80101af0 <iput> 8010226f: 83 c4 10 add $0x10,%esp return -1; 80102272: b8 ff ff ff ff mov $0xffffffff,%eax 80102277: e9 9c 00 00 00 jmp 80102318 <dirlink+0xd6> } // Look for an empty dirent. for(off = 0; off < dp->size; off += sizeof(de)){ 8010227c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80102283: eb 39 jmp 801022be <dirlink+0x7c> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80102285: 8b 45 f4 mov -0xc(%ebp),%eax 80102288: 6a 10 push $0x10 8010228a: 50 push %eax 8010228b: 8d 45 e0 lea -0x20(%ebp),%eax 8010228e: 50 push %eax 8010228f: ff 75 08 pushl 0x8(%ebp) 80102292: e8 f7 fb ff ff call 80101e8e <readi> 80102297: 83 c4 10 add $0x10,%esp 8010229a: 83 f8 10 cmp $0x10,%eax 8010229d: 74 0d je 801022ac <dirlink+0x6a> panic("dirlink read"); 8010229f: 83 ec 0c sub $0xc,%esp 801022a2: 68 74 8e 10 80 push $0x80108e74 801022a7: e8 ba e2 ff ff call 80100566 <panic> if(de.inum == 0) 801022ac: 0f b7 45 e0 movzwl -0x20(%ebp),%eax 801022b0: 66 85 c0 test %ax,%ax 801022b3: 74 18 je 801022cd <dirlink+0x8b> iput(ip); return -1; } // Look for an empty dirent. for(off = 0; off < dp->size; off += sizeof(de)){ 801022b5: 8b 45 f4 mov -0xc(%ebp),%eax 801022b8: 83 c0 10 add $0x10,%eax 801022bb: 89 45 f4 mov %eax,-0xc(%ebp) 801022be: 8b 45 08 mov 0x8(%ebp),%eax 801022c1: 8b 50 18 mov 0x18(%eax),%edx 801022c4: 8b 45 f4 mov -0xc(%ebp),%eax 801022c7: 39 c2 cmp %eax,%edx 801022c9: 77 ba ja 80102285 <dirlink+0x43> 801022cb: eb 01 jmp 801022ce <dirlink+0x8c> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("dirlink read"); if(de.inum == 0) break; 801022cd: 90 nop } strncpy(de.name, name, DIRSIZ); 801022ce: 83 ec 04 sub $0x4,%esp 801022d1: 6a 0e push $0xe 801022d3: ff 75 0c pushl 0xc(%ebp) 801022d6: 8d 45 e0 lea -0x20(%ebp),%eax 801022d9: 83 c0 02 add $0x2,%eax 801022dc: 50 push %eax 801022dd: e8 9c 36 00 00 call 8010597e <strncpy> 801022e2: 83 c4 10 add $0x10,%esp de.inum = inum; 801022e5: 8b 45 10 mov 0x10(%ebp),%eax 801022e8: 66 89 45 e0 mov %ax,-0x20(%ebp) if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 801022ec: 8b 45 f4 mov -0xc(%ebp),%eax 801022ef: 6a 10 push $0x10 801022f1: 50 push %eax 801022f2: 8d 45 e0 lea -0x20(%ebp),%eax 801022f5: 50 push %eax 801022f6: ff 75 08 pushl 0x8(%ebp) 801022f9: e8 e7 fc ff ff call 80101fe5 <writei> 801022fe: 83 c4 10 add $0x10,%esp 80102301: 83 f8 10 cmp $0x10,%eax 80102304: 74 0d je 80102313 <dirlink+0xd1> panic("dirlink"); 80102306: 83 ec 0c sub $0xc,%esp 80102309: 68 81 8e 10 80 push $0x80108e81 8010230e: e8 53 e2 ff ff call 80100566 <panic> return 0; 80102313: b8 00 00 00 00 mov $0x0,%eax } 80102318: c9 leave 80102319: c3 ret 8010231a <skipelem>: // skipelem("a", name) = "", setting name = "a" // skipelem("", name) = skipelem("////", name) = 0 // static char* skipelem(char *path, char *name) { 8010231a: 55 push %ebp 8010231b: 89 e5 mov %esp,%ebp 8010231d: 83 ec 18 sub $0x18,%esp char *s; int len; while(*path == '/') 80102320: eb 04 jmp 80102326 <skipelem+0xc> path++; 80102322: 83 45 08 01 addl $0x1,0x8(%ebp) skipelem(char *path, char *name) { char *s; int len; while(*path == '/') 80102326: 8b 45 08 mov 0x8(%ebp),%eax 80102329: 0f b6 00 movzbl (%eax),%eax 8010232c: 3c 2f cmp $0x2f,%al 8010232e: 74 f2 je 80102322 <skipelem+0x8> path++; if(*path == 0) 80102330: 8b 45 08 mov 0x8(%ebp),%eax 80102333: 0f b6 00 movzbl (%eax),%eax 80102336: 84 c0 test %al,%al 80102338: 75 07 jne 80102341 <skipelem+0x27> return 0; 8010233a: b8 00 00 00 00 mov $0x0,%eax 8010233f: eb 7b jmp 801023bc <skipelem+0xa2> s = path; 80102341: 8b 45 08 mov 0x8(%ebp),%eax 80102344: 89 45 f4 mov %eax,-0xc(%ebp) while(*path != '/' && *path != 0) 80102347: eb 04 jmp 8010234d <skipelem+0x33> path++; 80102349: 83 45 08 01 addl $0x1,0x8(%ebp) while(*path == '/') path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) 8010234d: 8b 45 08 mov 0x8(%ebp),%eax 80102350: 0f b6 00 movzbl (%eax),%eax 80102353: 3c 2f cmp $0x2f,%al 80102355: 74 0a je 80102361 <skipelem+0x47> 80102357: 8b 45 08 mov 0x8(%ebp),%eax 8010235a: 0f b6 00 movzbl (%eax),%eax 8010235d: 84 c0 test %al,%al 8010235f: 75 e8 jne 80102349 <skipelem+0x2f> path++; len = path - s; 80102361: 8b 55 08 mov 0x8(%ebp),%edx 80102364: 8b 45 f4 mov -0xc(%ebp),%eax 80102367: 29 c2 sub %eax,%edx 80102369: 89 d0 mov %edx,%eax 8010236b: 89 45 f0 mov %eax,-0x10(%ebp) if(len >= DIRSIZ) 8010236e: 83 7d f0 0d cmpl $0xd,-0x10(%ebp) 80102372: 7e 15 jle 80102389 <skipelem+0x6f> memmove(name, s, DIRSIZ); 80102374: 83 ec 04 sub $0x4,%esp 80102377: 6a 0e push $0xe 80102379: ff 75 f4 pushl -0xc(%ebp) 8010237c: ff 75 0c pushl 0xc(%ebp) 8010237f: e8 0e 35 00 00 call 80105892 <memmove> 80102384: 83 c4 10 add $0x10,%esp 80102387: eb 26 jmp 801023af <skipelem+0x95> else { memmove(name, s, len); 80102389: 8b 45 f0 mov -0x10(%ebp),%eax 8010238c: 83 ec 04 sub $0x4,%esp 8010238f: 50 push %eax 80102390: ff 75 f4 pushl -0xc(%ebp) 80102393: ff 75 0c pushl 0xc(%ebp) 80102396: e8 f7 34 00 00 call 80105892 <memmove> 8010239b: 83 c4 10 add $0x10,%esp name[len] = 0; 8010239e: 8b 55 f0 mov -0x10(%ebp),%edx 801023a1: 8b 45 0c mov 0xc(%ebp),%eax 801023a4: 01 d0 add %edx,%eax 801023a6: c6 00 00 movb $0x0,(%eax) } while(*path == '/') 801023a9: eb 04 jmp 801023af <skipelem+0x95> path++; 801023ab: 83 45 08 01 addl $0x1,0x8(%ebp) memmove(name, s, DIRSIZ); else { memmove(name, s, len); name[len] = 0; } while(*path == '/') 801023af: 8b 45 08 mov 0x8(%ebp),%eax 801023b2: 0f b6 00 movzbl (%eax),%eax 801023b5: 3c 2f cmp $0x2f,%al 801023b7: 74 f2 je 801023ab <skipelem+0x91> path++; return path; 801023b9: 8b 45 08 mov 0x8(%ebp),%eax } 801023bc: c9 leave 801023bd: c3 ret 801023be <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) { 801023be: 55 push %ebp 801023bf: 89 e5 mov %esp,%ebp 801023c1: 83 ec 18 sub $0x18,%esp struct inode *ip, *next; if(*path == '/') 801023c4: 8b 45 08 mov 0x8(%ebp),%eax 801023c7: 0f b6 00 movzbl (%eax),%eax 801023ca: 3c 2f cmp $0x2f,%al 801023cc: 75 17 jne 801023e5 <namex+0x27> ip = iget(ROOTDEV, ROOTINO); 801023ce: 83 ec 08 sub $0x8,%esp 801023d1: 6a 01 push $0x1 801023d3: 6a 01 push $0x1 801023d5: e8 2d f4 ff ff call 80101807 <iget> 801023da: 83 c4 10 add $0x10,%esp 801023dd: 89 45 f4 mov %eax,-0xc(%ebp) 801023e0: e9 bb 00 00 00 jmp 801024a0 <namex+0xe2> else ip = idup(proc->cwd); 801023e5: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801023eb: 8b 40 68 mov 0x68(%eax),%eax 801023ee: 83 ec 0c sub $0xc,%esp 801023f1: 50 push %eax 801023f2: e8 ef f4 ff ff call 801018e6 <idup> 801023f7: 83 c4 10 add $0x10,%esp 801023fa: 89 45 f4 mov %eax,-0xc(%ebp) while((path = skipelem(path, name)) != 0){ 801023fd: e9 9e 00 00 00 jmp 801024a0 <namex+0xe2> ilock(ip); 80102402: 83 ec 0c sub $0xc,%esp 80102405: ff 75 f4 pushl -0xc(%ebp) 80102408: e8 13 f5 ff ff call 80101920 <ilock> 8010240d: 83 c4 10 add $0x10,%esp if(ip->type != T_DIR){ 80102410: 8b 45 f4 mov -0xc(%ebp),%eax 80102413: 0f b7 40 10 movzwl 0x10(%eax),%eax 80102417: 66 83 f8 01 cmp $0x1,%ax 8010241b: 74 18 je 80102435 <namex+0x77> iunlockput(ip); 8010241d: 83 ec 0c sub $0xc,%esp 80102420: ff 75 f4 pushl -0xc(%ebp) 80102423: e8 b8 f7 ff ff call 80101be0 <iunlockput> 80102428: 83 c4 10 add $0x10,%esp return 0; 8010242b: b8 00 00 00 00 mov $0x0,%eax 80102430: e9 a7 00 00 00 jmp 801024dc <namex+0x11e> } if(nameiparent && *path == '\0'){ 80102435: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 80102439: 74 20 je 8010245b <namex+0x9d> 8010243b: 8b 45 08 mov 0x8(%ebp),%eax 8010243e: 0f b6 00 movzbl (%eax),%eax 80102441: 84 c0 test %al,%al 80102443: 75 16 jne 8010245b <namex+0x9d> // Stop one level early. iunlock(ip); 80102445: 83 ec 0c sub $0xc,%esp 80102448: ff 75 f4 pushl -0xc(%ebp) 8010244b: e8 2e f6 ff ff call 80101a7e <iunlock> 80102450: 83 c4 10 add $0x10,%esp return ip; 80102453: 8b 45 f4 mov -0xc(%ebp),%eax 80102456: e9 81 00 00 00 jmp 801024dc <namex+0x11e> } if((next = dirlookup(ip, name, 0)) == 0){ 8010245b: 83 ec 04 sub $0x4,%esp 8010245e: 6a 00 push $0x0 80102460: ff 75 10 pushl 0x10(%ebp) 80102463: ff 75 f4 pushl -0xc(%ebp) 80102466: e8 1d fd ff ff call 80102188 <dirlookup> 8010246b: 83 c4 10 add $0x10,%esp 8010246e: 89 45 f0 mov %eax,-0x10(%ebp) 80102471: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80102475: 75 15 jne 8010248c <namex+0xce> iunlockput(ip); 80102477: 83 ec 0c sub $0xc,%esp 8010247a: ff 75 f4 pushl -0xc(%ebp) 8010247d: e8 5e f7 ff ff call 80101be0 <iunlockput> 80102482: 83 c4 10 add $0x10,%esp return 0; 80102485: b8 00 00 00 00 mov $0x0,%eax 8010248a: eb 50 jmp 801024dc <namex+0x11e> } iunlockput(ip); 8010248c: 83 ec 0c sub $0xc,%esp 8010248f: ff 75 f4 pushl -0xc(%ebp) 80102492: e8 49 f7 ff ff call 80101be0 <iunlockput> 80102497: 83 c4 10 add $0x10,%esp ip = next; 8010249a: 8b 45 f0 mov -0x10(%ebp),%eax 8010249d: 89 45 f4 mov %eax,-0xc(%ebp) if(*path == '/') ip = iget(ROOTDEV, ROOTINO); else ip = idup(proc->cwd); while((path = skipelem(path, name)) != 0){ 801024a0: 83 ec 08 sub $0x8,%esp 801024a3: ff 75 10 pushl 0x10(%ebp) 801024a6: ff 75 08 pushl 0x8(%ebp) 801024a9: e8 6c fe ff ff call 8010231a <skipelem> 801024ae: 83 c4 10 add $0x10,%esp 801024b1: 89 45 08 mov %eax,0x8(%ebp) 801024b4: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 801024b8: 0f 85 44 ff ff ff jne 80102402 <namex+0x44> return 0; } iunlockput(ip); ip = next; } if(nameiparent){ 801024be: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 801024c2: 74 15 je 801024d9 <namex+0x11b> iput(ip); 801024c4: 83 ec 0c sub $0xc,%esp 801024c7: ff 75 f4 pushl -0xc(%ebp) 801024ca: e8 21 f6 ff ff call 80101af0 <iput> 801024cf: 83 c4 10 add $0x10,%esp return 0; 801024d2: b8 00 00 00 00 mov $0x0,%eax 801024d7: eb 03 jmp 801024dc <namex+0x11e> } return ip; 801024d9: 8b 45 f4 mov -0xc(%ebp),%eax } 801024dc: c9 leave 801024dd: c3 ret 801024de <namei>: struct inode* namei(char *path) { 801024de: 55 push %ebp 801024df: 89 e5 mov %esp,%ebp 801024e1: 83 ec 18 sub $0x18,%esp char name[DIRSIZ]; return namex(path, 0, name); 801024e4: 83 ec 04 sub $0x4,%esp 801024e7: 8d 45 ea lea -0x16(%ebp),%eax 801024ea: 50 push %eax 801024eb: 6a 00 push $0x0 801024ed: ff 75 08 pushl 0x8(%ebp) 801024f0: e8 c9 fe ff ff call 801023be <namex> 801024f5: 83 c4 10 add $0x10,%esp } 801024f8: c9 leave 801024f9: c3 ret 801024fa <nameiparent>: struct inode* nameiparent(char *path, char *name) { 801024fa: 55 push %ebp 801024fb: 89 e5 mov %esp,%ebp 801024fd: 83 ec 08 sub $0x8,%esp return namex(path, 1, name); 80102500: 83 ec 04 sub $0x4,%esp 80102503: ff 75 0c pushl 0xc(%ebp) 80102506: 6a 01 push $0x1 80102508: ff 75 08 pushl 0x8(%ebp) 8010250b: e8 ae fe ff ff call 801023be <namex> 80102510: 83 c4 10 add $0x10,%esp } 80102513: c9 leave 80102514: c3 ret 80102515 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 80102515: 55 push %ebp 80102516: 89 e5 mov %esp,%ebp 80102518: 83 ec 14 sub $0x14,%esp 8010251b: 8b 45 08 mov 0x8(%ebp),%eax 8010251e: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102522: 0f b7 45 ec movzwl -0x14(%ebp),%eax 80102526: 89 c2 mov %eax,%edx 80102528: ec in (%dx),%al 80102529: 88 45 ff mov %al,-0x1(%ebp) return data; 8010252c: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 80102530: c9 leave 80102531: c3 ret 80102532 <insl>: static inline void insl(int port, void *addr, int cnt) { 80102532: 55 push %ebp 80102533: 89 e5 mov %esp,%ebp 80102535: 57 push %edi 80102536: 53 push %ebx asm volatile("cld; rep insl" : 80102537: 8b 55 08 mov 0x8(%ebp),%edx 8010253a: 8b 4d 0c mov 0xc(%ebp),%ecx 8010253d: 8b 45 10 mov 0x10(%ebp),%eax 80102540: 89 cb mov %ecx,%ebx 80102542: 89 df mov %ebx,%edi 80102544: 89 c1 mov %eax,%ecx 80102546: fc cld 80102547: f3 6d rep insl (%dx),%es:(%edi) 80102549: 89 c8 mov %ecx,%eax 8010254b: 89 fb mov %edi,%ebx 8010254d: 89 5d 0c mov %ebx,0xc(%ebp) 80102550: 89 45 10 mov %eax,0x10(%ebp) "=D" (addr), "=c" (cnt) : "d" (port), "0" (addr), "1" (cnt) : "memory", "cc"); } 80102553: 90 nop 80102554: 5b pop %ebx 80102555: 5f pop %edi 80102556: 5d pop %ebp 80102557: c3 ret 80102558 <outb>: static inline void outb(ushort port, uchar data) { 80102558: 55 push %ebp 80102559: 89 e5 mov %esp,%ebp 8010255b: 83 ec 08 sub $0x8,%esp 8010255e: 8b 55 08 mov 0x8(%ebp),%edx 80102561: 8b 45 0c mov 0xc(%ebp),%eax 80102564: 66 89 55 fc mov %dx,-0x4(%ebp) 80102568: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010256b: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 8010256f: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80102573: ee out %al,(%dx) } 80102574: 90 nop 80102575: c9 leave 80102576: c3 ret 80102577 <outsl>: asm volatile("out %0,%1" : : "a" (data), "d" (port)); } static inline void outsl(int port, const void *addr, int cnt) { 80102577: 55 push %ebp 80102578: 89 e5 mov %esp,%ebp 8010257a: 56 push %esi 8010257b: 53 push %ebx asm volatile("cld; rep outsl" : 8010257c: 8b 55 08 mov 0x8(%ebp),%edx 8010257f: 8b 4d 0c mov 0xc(%ebp),%ecx 80102582: 8b 45 10 mov 0x10(%ebp),%eax 80102585: 89 cb mov %ecx,%ebx 80102587: 89 de mov %ebx,%esi 80102589: 89 c1 mov %eax,%ecx 8010258b: fc cld 8010258c: f3 6f rep outsl %ds:(%esi),(%dx) 8010258e: 89 c8 mov %ecx,%eax 80102590: 89 f3 mov %esi,%ebx 80102592: 89 5d 0c mov %ebx,0xc(%ebp) 80102595: 89 45 10 mov %eax,0x10(%ebp) "=S" (addr), "=c" (cnt) : "d" (port), "0" (addr), "1" (cnt) : "cc"); } 80102598: 90 nop 80102599: 5b pop %ebx 8010259a: 5e pop %esi 8010259b: 5d pop %ebp 8010259c: c3 ret 8010259d <idewait>: static void idestart(struct buf*); // Wait for IDE disk to become ready. static int idewait(int checkerr) { 8010259d: 55 push %ebp 8010259e: 89 e5 mov %esp,%ebp 801025a0: 83 ec 10 sub $0x10,%esp int r; while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 801025a3: 90 nop 801025a4: 68 f7 01 00 00 push $0x1f7 801025a9: e8 67 ff ff ff call 80102515 <inb> 801025ae: 83 c4 04 add $0x4,%esp 801025b1: 0f b6 c0 movzbl %al,%eax 801025b4: 89 45 fc mov %eax,-0x4(%ebp) 801025b7: 8b 45 fc mov -0x4(%ebp),%eax 801025ba: 25 c0 00 00 00 and $0xc0,%eax 801025bf: 83 f8 40 cmp $0x40,%eax 801025c2: 75 e0 jne 801025a4 <idewait+0x7> ; if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0) 801025c4: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 801025c8: 74 11 je 801025db <idewait+0x3e> 801025ca: 8b 45 fc mov -0x4(%ebp),%eax 801025cd: 83 e0 21 and $0x21,%eax 801025d0: 85 c0 test %eax,%eax 801025d2: 74 07 je 801025db <idewait+0x3e> return -1; 801025d4: b8 ff ff ff ff mov $0xffffffff,%eax 801025d9: eb 05 jmp 801025e0 <idewait+0x43> return 0; 801025db: b8 00 00 00 00 mov $0x0,%eax } 801025e0: c9 leave 801025e1: c3 ret 801025e2 <ideinit>: void ideinit(void) { 801025e2: 55 push %ebp 801025e3: 89 e5 mov %esp,%ebp 801025e5: 83 ec 18 sub $0x18,%esp int i; initlock(&idelock, "ide"); 801025e8: 83 ec 08 sub $0x8,%esp 801025eb: 68 89 8e 10 80 push $0x80108e89 801025f0: 68 20 c6 10 80 push $0x8010c620 801025f5: e8 54 2f 00 00 call 8010554e <initlock> 801025fa: 83 c4 10 add $0x10,%esp picenable(IRQ_IDE); 801025fd: 83 ec 0c sub $0xc,%esp 80102600: 6a 0e push $0xe 80102602: e8 c4 18 00 00 call 80103ecb <picenable> 80102607: 83 c4 10 add $0x10,%esp ioapicenable(IRQ_IDE, ncpu - 1); 8010260a: a1 60 39 11 80 mov 0x80113960,%eax 8010260f: 83 e8 01 sub $0x1,%eax 80102612: 83 ec 08 sub $0x8,%esp 80102615: 50 push %eax 80102616: 6a 0e push $0xe 80102618: e8 73 04 00 00 call 80102a90 <ioapicenable> 8010261d: 83 c4 10 add $0x10,%esp idewait(0); 80102620: 83 ec 0c sub $0xc,%esp 80102623: 6a 00 push $0x0 80102625: e8 73 ff ff ff call 8010259d <idewait> 8010262a: 83 c4 10 add $0x10,%esp // Check if disk 1 is present outb(0x1f6, 0xe0 | (1<<4)); 8010262d: 83 ec 08 sub $0x8,%esp 80102630: 68 f0 00 00 00 push $0xf0 80102635: 68 f6 01 00 00 push $0x1f6 8010263a: e8 19 ff ff ff call 80102558 <outb> 8010263f: 83 c4 10 add $0x10,%esp for(i=0; i<1000; i++){ 80102642: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80102649: eb 24 jmp 8010266f <ideinit+0x8d> if(inb(0x1f7) != 0){ 8010264b: 83 ec 0c sub $0xc,%esp 8010264e: 68 f7 01 00 00 push $0x1f7 80102653: e8 bd fe ff ff call 80102515 <inb> 80102658: 83 c4 10 add $0x10,%esp 8010265b: 84 c0 test %al,%al 8010265d: 74 0c je 8010266b <ideinit+0x89> havedisk1 = 1; 8010265f: c7 05 58 c6 10 80 01 movl $0x1,0x8010c658 80102666: 00 00 00 break; 80102669: eb 0d jmp 80102678 <ideinit+0x96> ioapicenable(IRQ_IDE, ncpu - 1); idewait(0); // Check if disk 1 is present outb(0x1f6, 0xe0 | (1<<4)); for(i=0; i<1000; i++){ 8010266b: 83 45 f4 01 addl $0x1,-0xc(%ebp) 8010266f: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp) 80102676: 7e d3 jle 8010264b <ideinit+0x69> break; } } // Switch back to disk 0. outb(0x1f6, 0xe0 | (0<<4)); 80102678: 83 ec 08 sub $0x8,%esp 8010267b: 68 e0 00 00 00 push $0xe0 80102680: 68 f6 01 00 00 push $0x1f6 80102685: e8 ce fe ff ff call 80102558 <outb> 8010268a: 83 c4 10 add $0x10,%esp } 8010268d: 90 nop 8010268e: c9 leave 8010268f: c3 ret 80102690 <idestart>: // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { 80102690: 55 push %ebp 80102691: 89 e5 mov %esp,%ebp 80102693: 83 ec 18 sub $0x18,%esp if(b == 0) 80102696: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 8010269a: 75 0d jne 801026a9 <idestart+0x19> panic("idestart"); 8010269c: 83 ec 0c sub $0xc,%esp 8010269f: 68 8d 8e 10 80 push $0x80108e8d 801026a4: e8 bd de ff ff call 80100566 <panic> if(b->blockno >= FSSIZE) 801026a9: 8b 45 08 mov 0x8(%ebp),%eax 801026ac: 8b 40 08 mov 0x8(%eax),%eax 801026af: 3d e7 03 00 00 cmp $0x3e7,%eax 801026b4: 76 0d jbe 801026c3 <idestart+0x33> panic("incorrect blockno"); 801026b6: 83 ec 0c sub $0xc,%esp 801026b9: 68 96 8e 10 80 push $0x80108e96 801026be: e8 a3 de ff ff call 80100566 <panic> int sector_per_block = BSIZE/SECTOR_SIZE; 801026c3: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) int sector = b->blockno * sector_per_block; 801026ca: 8b 45 08 mov 0x8(%ebp),%eax 801026cd: 8b 50 08 mov 0x8(%eax),%edx 801026d0: 8b 45 f4 mov -0xc(%ebp),%eax 801026d3: 0f af c2 imul %edx,%eax 801026d6: 89 45 f0 mov %eax,-0x10(%ebp) if (sector_per_block > 7) panic("idestart"); 801026d9: 83 7d f4 07 cmpl $0x7,-0xc(%ebp) 801026dd: 7e 0d jle 801026ec <idestart+0x5c> 801026df: 83 ec 0c sub $0xc,%esp 801026e2: 68 8d 8e 10 80 push $0x80108e8d 801026e7: e8 7a de ff ff call 80100566 <panic> idewait(0); 801026ec: 83 ec 0c sub $0xc,%esp 801026ef: 6a 00 push $0x0 801026f1: e8 a7 fe ff ff call 8010259d <idewait> 801026f6: 83 c4 10 add $0x10,%esp outb(0x3f6, 0); // generate interrupt 801026f9: 83 ec 08 sub $0x8,%esp 801026fc: 6a 00 push $0x0 801026fe: 68 f6 03 00 00 push $0x3f6 80102703: e8 50 fe ff ff call 80102558 <outb> 80102708: 83 c4 10 add $0x10,%esp outb(0x1f2, sector_per_block); // number of sectors 8010270b: 8b 45 f4 mov -0xc(%ebp),%eax 8010270e: 0f b6 c0 movzbl %al,%eax 80102711: 83 ec 08 sub $0x8,%esp 80102714: 50 push %eax 80102715: 68 f2 01 00 00 push $0x1f2 8010271a: e8 39 fe ff ff call 80102558 <outb> 8010271f: 83 c4 10 add $0x10,%esp outb(0x1f3, sector & 0xff); 80102722: 8b 45 f0 mov -0x10(%ebp),%eax 80102725: 0f b6 c0 movzbl %al,%eax 80102728: 83 ec 08 sub $0x8,%esp 8010272b: 50 push %eax 8010272c: 68 f3 01 00 00 push $0x1f3 80102731: e8 22 fe ff ff call 80102558 <outb> 80102736: 83 c4 10 add $0x10,%esp outb(0x1f4, (sector >> 8) & 0xff); 80102739: 8b 45 f0 mov -0x10(%ebp),%eax 8010273c: c1 f8 08 sar $0x8,%eax 8010273f: 0f b6 c0 movzbl %al,%eax 80102742: 83 ec 08 sub $0x8,%esp 80102745: 50 push %eax 80102746: 68 f4 01 00 00 push $0x1f4 8010274b: e8 08 fe ff ff call 80102558 <outb> 80102750: 83 c4 10 add $0x10,%esp outb(0x1f5, (sector >> 16) & 0xff); 80102753: 8b 45 f0 mov -0x10(%ebp),%eax 80102756: c1 f8 10 sar $0x10,%eax 80102759: 0f b6 c0 movzbl %al,%eax 8010275c: 83 ec 08 sub $0x8,%esp 8010275f: 50 push %eax 80102760: 68 f5 01 00 00 push $0x1f5 80102765: e8 ee fd ff ff call 80102558 <outb> 8010276a: 83 c4 10 add $0x10,%esp outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); 8010276d: 8b 45 08 mov 0x8(%ebp),%eax 80102770: 8b 40 04 mov 0x4(%eax),%eax 80102773: 83 e0 01 and $0x1,%eax 80102776: c1 e0 04 shl $0x4,%eax 80102779: 89 c2 mov %eax,%edx 8010277b: 8b 45 f0 mov -0x10(%ebp),%eax 8010277e: c1 f8 18 sar $0x18,%eax 80102781: 83 e0 0f and $0xf,%eax 80102784: 09 d0 or %edx,%eax 80102786: 83 c8 e0 or $0xffffffe0,%eax 80102789: 0f b6 c0 movzbl %al,%eax 8010278c: 83 ec 08 sub $0x8,%esp 8010278f: 50 push %eax 80102790: 68 f6 01 00 00 push $0x1f6 80102795: e8 be fd ff ff call 80102558 <outb> 8010279a: 83 c4 10 add $0x10,%esp if(b->flags & B_DIRTY){ 8010279d: 8b 45 08 mov 0x8(%ebp),%eax 801027a0: 8b 00 mov (%eax),%eax 801027a2: 83 e0 04 and $0x4,%eax 801027a5: 85 c0 test %eax,%eax 801027a7: 74 30 je 801027d9 <idestart+0x149> outb(0x1f7, IDE_CMD_WRITE); 801027a9: 83 ec 08 sub $0x8,%esp 801027ac: 6a 30 push $0x30 801027ae: 68 f7 01 00 00 push $0x1f7 801027b3: e8 a0 fd ff ff call 80102558 <outb> 801027b8: 83 c4 10 add $0x10,%esp outsl(0x1f0, b->data, BSIZE/4); 801027bb: 8b 45 08 mov 0x8(%ebp),%eax 801027be: 83 c0 18 add $0x18,%eax 801027c1: 83 ec 04 sub $0x4,%esp 801027c4: 68 80 00 00 00 push $0x80 801027c9: 50 push %eax 801027ca: 68 f0 01 00 00 push $0x1f0 801027cf: e8 a3 fd ff ff call 80102577 <outsl> 801027d4: 83 c4 10 add $0x10,%esp } else { outb(0x1f7, IDE_CMD_READ); } } 801027d7: eb 12 jmp 801027eb <idestart+0x15b> outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); if(b->flags & B_DIRTY){ outb(0x1f7, IDE_CMD_WRITE); outsl(0x1f0, b->data, BSIZE/4); } else { outb(0x1f7, IDE_CMD_READ); 801027d9: 83 ec 08 sub $0x8,%esp 801027dc: 6a 20 push $0x20 801027de: 68 f7 01 00 00 push $0x1f7 801027e3: e8 70 fd ff ff call 80102558 <outb> 801027e8: 83 c4 10 add $0x10,%esp } } 801027eb: 90 nop 801027ec: c9 leave 801027ed: c3 ret 801027ee <ideintr>: // Interrupt handler. void ideintr(void) { 801027ee: 55 push %ebp 801027ef: 89 e5 mov %esp,%ebp 801027f1: 83 ec 18 sub $0x18,%esp struct buf *b; // First queued buffer is the active request. acquire(&idelock); 801027f4: 83 ec 0c sub $0xc,%esp 801027f7: 68 20 c6 10 80 push $0x8010c620 801027fc: e8 6f 2d 00 00 call 80105570 <acquire> 80102801: 83 c4 10 add $0x10,%esp if((b = idequeue) == 0){ 80102804: a1 54 c6 10 80 mov 0x8010c654,%eax 80102809: 89 45 f4 mov %eax,-0xc(%ebp) 8010280c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80102810: 75 15 jne 80102827 <ideintr+0x39> release(&idelock); 80102812: 83 ec 0c sub $0xc,%esp 80102815: 68 20 c6 10 80 push $0x8010c620 8010281a: e8 b8 2d 00 00 call 801055d7 <release> 8010281f: 83 c4 10 add $0x10,%esp // cprintf("spurious IDE interrupt\n"); return; 80102822: e9 9a 00 00 00 jmp 801028c1 <ideintr+0xd3> } idequeue = b->qnext; 80102827: 8b 45 f4 mov -0xc(%ebp),%eax 8010282a: 8b 40 14 mov 0x14(%eax),%eax 8010282d: a3 54 c6 10 80 mov %eax,0x8010c654 // Read data if needed. if(!(b->flags & B_DIRTY) && idewait(1) >= 0) 80102832: 8b 45 f4 mov -0xc(%ebp),%eax 80102835: 8b 00 mov (%eax),%eax 80102837: 83 e0 04 and $0x4,%eax 8010283a: 85 c0 test %eax,%eax 8010283c: 75 2d jne 8010286b <ideintr+0x7d> 8010283e: 83 ec 0c sub $0xc,%esp 80102841: 6a 01 push $0x1 80102843: e8 55 fd ff ff call 8010259d <idewait> 80102848: 83 c4 10 add $0x10,%esp 8010284b: 85 c0 test %eax,%eax 8010284d: 78 1c js 8010286b <ideintr+0x7d> insl(0x1f0, b->data, BSIZE/4); 8010284f: 8b 45 f4 mov -0xc(%ebp),%eax 80102852: 83 c0 18 add $0x18,%eax 80102855: 83 ec 04 sub $0x4,%esp 80102858: 68 80 00 00 00 push $0x80 8010285d: 50 push %eax 8010285e: 68 f0 01 00 00 push $0x1f0 80102863: e8 ca fc ff ff call 80102532 <insl> 80102868: 83 c4 10 add $0x10,%esp // Wake process waiting for this buf. b->flags |= B_VALID; 8010286b: 8b 45 f4 mov -0xc(%ebp),%eax 8010286e: 8b 00 mov (%eax),%eax 80102870: 83 c8 02 or $0x2,%eax 80102873: 89 c2 mov %eax,%edx 80102875: 8b 45 f4 mov -0xc(%ebp),%eax 80102878: 89 10 mov %edx,(%eax) b->flags &= ~B_DIRTY; 8010287a: 8b 45 f4 mov -0xc(%ebp),%eax 8010287d: 8b 00 mov (%eax),%eax 8010287f: 83 e0 fb and $0xfffffffb,%eax 80102882: 89 c2 mov %eax,%edx 80102884: 8b 45 f4 mov -0xc(%ebp),%eax 80102887: 89 10 mov %edx,(%eax) wakeup(b); 80102889: 83 ec 0c sub $0xc,%esp 8010288c: ff 75 f4 pushl -0xc(%ebp) 8010288f: e8 ba 2a 00 00 call 8010534e <wakeup> 80102894: 83 c4 10 add $0x10,%esp // Start disk on next buf in queue. if(idequeue != 0) 80102897: a1 54 c6 10 80 mov 0x8010c654,%eax 8010289c: 85 c0 test %eax,%eax 8010289e: 74 11 je 801028b1 <ideintr+0xc3> idestart(idequeue); 801028a0: a1 54 c6 10 80 mov 0x8010c654,%eax 801028a5: 83 ec 0c sub $0xc,%esp 801028a8: 50 push %eax 801028a9: e8 e2 fd ff ff call 80102690 <idestart> 801028ae: 83 c4 10 add $0x10,%esp release(&idelock); 801028b1: 83 ec 0c sub $0xc,%esp 801028b4: 68 20 c6 10 80 push $0x8010c620 801028b9: e8 19 2d 00 00 call 801055d7 <release> 801028be: 83 c4 10 add $0x10,%esp } 801028c1: c9 leave 801028c2: c3 ret 801028c3 <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) { 801028c3: 55 push %ebp 801028c4: 89 e5 mov %esp,%ebp 801028c6: 83 ec 18 sub $0x18,%esp struct buf **pp; if(!(b->flags & B_BUSY)) 801028c9: 8b 45 08 mov 0x8(%ebp),%eax 801028cc: 8b 00 mov (%eax),%eax 801028ce: 83 e0 01 and $0x1,%eax 801028d1: 85 c0 test %eax,%eax 801028d3: 75 0d jne 801028e2 <iderw+0x1f> panic("iderw: buf not busy"); 801028d5: 83 ec 0c sub $0xc,%esp 801028d8: 68 a8 8e 10 80 push $0x80108ea8 801028dd: e8 84 dc ff ff call 80100566 <panic> if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) 801028e2: 8b 45 08 mov 0x8(%ebp),%eax 801028e5: 8b 00 mov (%eax),%eax 801028e7: 83 e0 06 and $0x6,%eax 801028ea: 83 f8 02 cmp $0x2,%eax 801028ed: 75 0d jne 801028fc <iderw+0x39> panic("iderw: nothing to do"); 801028ef: 83 ec 0c sub $0xc,%esp 801028f2: 68 bc 8e 10 80 push $0x80108ebc 801028f7: e8 6a dc ff ff call 80100566 <panic> if(b->dev != 0 && !havedisk1) 801028fc: 8b 45 08 mov 0x8(%ebp),%eax 801028ff: 8b 40 04 mov 0x4(%eax),%eax 80102902: 85 c0 test %eax,%eax 80102904: 74 16 je 8010291c <iderw+0x59> 80102906: a1 58 c6 10 80 mov 0x8010c658,%eax 8010290b: 85 c0 test %eax,%eax 8010290d: 75 0d jne 8010291c <iderw+0x59> panic("iderw: ide disk 1 not present"); 8010290f: 83 ec 0c sub $0xc,%esp 80102912: 68 d1 8e 10 80 push $0x80108ed1 80102917: e8 4a dc ff ff call 80100566 <panic> acquire(&idelock); //DOC:acquire-lock 8010291c: 83 ec 0c sub $0xc,%esp 8010291f: 68 20 c6 10 80 push $0x8010c620 80102924: e8 47 2c 00 00 call 80105570 <acquire> 80102929: 83 c4 10 add $0x10,%esp // Append b to idequeue. b->qnext = 0; 8010292c: 8b 45 08 mov 0x8(%ebp),%eax 8010292f: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 80102936: c7 45 f4 54 c6 10 80 movl $0x8010c654,-0xc(%ebp) 8010293d: eb 0b jmp 8010294a <iderw+0x87> 8010293f: 8b 45 f4 mov -0xc(%ebp),%eax 80102942: 8b 00 mov (%eax),%eax 80102944: 83 c0 14 add $0x14,%eax 80102947: 89 45 f4 mov %eax,-0xc(%ebp) 8010294a: 8b 45 f4 mov -0xc(%ebp),%eax 8010294d: 8b 00 mov (%eax),%eax 8010294f: 85 c0 test %eax,%eax 80102951: 75 ec jne 8010293f <iderw+0x7c> ; *pp = b; 80102953: 8b 45 f4 mov -0xc(%ebp),%eax 80102956: 8b 55 08 mov 0x8(%ebp),%edx 80102959: 89 10 mov %edx,(%eax) // Start disk if necessary. if(idequeue == b) 8010295b: a1 54 c6 10 80 mov 0x8010c654,%eax 80102960: 3b 45 08 cmp 0x8(%ebp),%eax 80102963: 75 23 jne 80102988 <iderw+0xc5> idestart(b); 80102965: 83 ec 0c sub $0xc,%esp 80102968: ff 75 08 pushl 0x8(%ebp) 8010296b: e8 20 fd ff ff call 80102690 <idestart> 80102970: 83 c4 10 add $0x10,%esp // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 80102973: eb 13 jmp 80102988 <iderw+0xc5> sleep(b, &idelock); 80102975: 83 ec 08 sub $0x8,%esp 80102978: 68 20 c6 10 80 push $0x8010c620 8010297d: ff 75 08 pushl 0x8(%ebp) 80102980: e8 db 28 00 00 call 80105260 <sleep> 80102985: 83 c4 10 add $0x10,%esp // Start disk if necessary. if(idequeue == b) idestart(b); // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 80102988: 8b 45 08 mov 0x8(%ebp),%eax 8010298b: 8b 00 mov (%eax),%eax 8010298d: 83 e0 06 and $0x6,%eax 80102990: 83 f8 02 cmp $0x2,%eax 80102993: 75 e0 jne 80102975 <iderw+0xb2> sleep(b, &idelock); } release(&idelock); 80102995: 83 ec 0c sub $0xc,%esp 80102998: 68 20 c6 10 80 push $0x8010c620 8010299d: e8 35 2c 00 00 call 801055d7 <release> 801029a2: 83 c4 10 add $0x10,%esp } 801029a5: 90 nop 801029a6: c9 leave 801029a7: c3 ret 801029a8 <ioapicread>: uint data; }; static uint ioapicread(int reg) { 801029a8: 55 push %ebp 801029a9: 89 e5 mov %esp,%ebp ioapic->reg = reg; 801029ab: a1 34 32 11 80 mov 0x80113234,%eax 801029b0: 8b 55 08 mov 0x8(%ebp),%edx 801029b3: 89 10 mov %edx,(%eax) return ioapic->data; 801029b5: a1 34 32 11 80 mov 0x80113234,%eax 801029ba: 8b 40 10 mov 0x10(%eax),%eax } 801029bd: 5d pop %ebp 801029be: c3 ret 801029bf <ioapicwrite>: static void ioapicwrite(int reg, uint data) { 801029bf: 55 push %ebp 801029c0: 89 e5 mov %esp,%ebp ioapic->reg = reg; 801029c2: a1 34 32 11 80 mov 0x80113234,%eax 801029c7: 8b 55 08 mov 0x8(%ebp),%edx 801029ca: 89 10 mov %edx,(%eax) ioapic->data = data; 801029cc: a1 34 32 11 80 mov 0x80113234,%eax 801029d1: 8b 55 0c mov 0xc(%ebp),%edx 801029d4: 89 50 10 mov %edx,0x10(%eax) } 801029d7: 90 nop 801029d8: 5d pop %ebp 801029d9: c3 ret 801029da <ioapicinit>: void ioapicinit(void) { 801029da: 55 push %ebp 801029db: 89 e5 mov %esp,%ebp 801029dd: 83 ec 18 sub $0x18,%esp int i, id, maxintr; if(!ismp) 801029e0: a1 64 33 11 80 mov 0x80113364,%eax 801029e5: 85 c0 test %eax,%eax 801029e7: 0f 84 a0 00 00 00 je 80102a8d <ioapicinit+0xb3> return; ioapic = (volatile struct ioapic*)IOAPIC; 801029ed: c7 05 34 32 11 80 00 movl $0xfec00000,0x80113234 801029f4: 00 c0 fe maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; 801029f7: 6a 01 push $0x1 801029f9: e8 aa ff ff ff call 801029a8 <ioapicread> 801029fe: 83 c4 04 add $0x4,%esp 80102a01: c1 e8 10 shr $0x10,%eax 80102a04: 25 ff 00 00 00 and $0xff,%eax 80102a09: 89 45 f0 mov %eax,-0x10(%ebp) id = ioapicread(REG_ID) >> 24; 80102a0c: 6a 00 push $0x0 80102a0e: e8 95 ff ff ff call 801029a8 <ioapicread> 80102a13: 83 c4 04 add $0x4,%esp 80102a16: c1 e8 18 shr $0x18,%eax 80102a19: 89 45 ec mov %eax,-0x14(%ebp) if(id != ioapicid) 80102a1c: 0f b6 05 60 33 11 80 movzbl 0x80113360,%eax 80102a23: 0f b6 c0 movzbl %al,%eax 80102a26: 3b 45 ec cmp -0x14(%ebp),%eax 80102a29: 74 10 je 80102a3b <ioapicinit+0x61> cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); 80102a2b: 83 ec 0c sub $0xc,%esp 80102a2e: 68 f0 8e 10 80 push $0x80108ef0 80102a33: e8 8e d9 ff ff call 801003c6 <cprintf> 80102a38: 83 c4 10 add $0x10,%esp // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ 80102a3b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80102a42: eb 3f jmp 80102a83 <ioapicinit+0xa9> ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); 80102a44: 8b 45 f4 mov -0xc(%ebp),%eax 80102a47: 83 c0 20 add $0x20,%eax 80102a4a: 0d 00 00 01 00 or $0x10000,%eax 80102a4f: 89 c2 mov %eax,%edx 80102a51: 8b 45 f4 mov -0xc(%ebp),%eax 80102a54: 83 c0 08 add $0x8,%eax 80102a57: 01 c0 add %eax,%eax 80102a59: 83 ec 08 sub $0x8,%esp 80102a5c: 52 push %edx 80102a5d: 50 push %eax 80102a5e: e8 5c ff ff ff call 801029bf <ioapicwrite> 80102a63: 83 c4 10 add $0x10,%esp ioapicwrite(REG_TABLE+2*i+1, 0); 80102a66: 8b 45 f4 mov -0xc(%ebp),%eax 80102a69: 83 c0 08 add $0x8,%eax 80102a6c: 01 c0 add %eax,%eax 80102a6e: 83 c0 01 add $0x1,%eax 80102a71: 83 ec 08 sub $0x8,%esp 80102a74: 6a 00 push $0x0 80102a76: 50 push %eax 80102a77: e8 43 ff ff ff call 801029bf <ioapicwrite> 80102a7c: 83 c4 10 add $0x10,%esp if(id != ioapicid) cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ 80102a7f: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80102a83: 8b 45 f4 mov -0xc(%ebp),%eax 80102a86: 3b 45 f0 cmp -0x10(%ebp),%eax 80102a89: 7e b9 jle 80102a44 <ioapicinit+0x6a> 80102a8b: eb 01 jmp 80102a8e <ioapicinit+0xb4> ioapicinit(void) { int i, id, maxintr; if(!ismp) return; 80102a8d: 90 nop // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); ioapicwrite(REG_TABLE+2*i+1, 0); } } 80102a8e: c9 leave 80102a8f: c3 ret 80102a90 <ioapicenable>: void ioapicenable(int irq, int cpunum) { 80102a90: 55 push %ebp 80102a91: 89 e5 mov %esp,%ebp if(!ismp) 80102a93: a1 64 33 11 80 mov 0x80113364,%eax 80102a98: 85 c0 test %eax,%eax 80102a9a: 74 39 je 80102ad5 <ioapicenable+0x45> return; // Mark interrupt edge-triggered, active high, // enabled, and routed to the given cpunum, // which happens to be that cpu's APIC ID. ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq); 80102a9c: 8b 45 08 mov 0x8(%ebp),%eax 80102a9f: 83 c0 20 add $0x20,%eax 80102aa2: 89 c2 mov %eax,%edx 80102aa4: 8b 45 08 mov 0x8(%ebp),%eax 80102aa7: 83 c0 08 add $0x8,%eax 80102aaa: 01 c0 add %eax,%eax 80102aac: 52 push %edx 80102aad: 50 push %eax 80102aae: e8 0c ff ff ff call 801029bf <ioapicwrite> 80102ab3: 83 c4 08 add $0x8,%esp ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); 80102ab6: 8b 45 0c mov 0xc(%ebp),%eax 80102ab9: c1 e0 18 shl $0x18,%eax 80102abc: 89 c2 mov %eax,%edx 80102abe: 8b 45 08 mov 0x8(%ebp),%eax 80102ac1: 83 c0 08 add $0x8,%eax 80102ac4: 01 c0 add %eax,%eax 80102ac6: 83 c0 01 add $0x1,%eax 80102ac9: 52 push %edx 80102aca: 50 push %eax 80102acb: e8 ef fe ff ff call 801029bf <ioapicwrite> 80102ad0: 83 c4 08 add $0x8,%esp 80102ad3: eb 01 jmp 80102ad6 <ioapicenable+0x46> void ioapicenable(int irq, int cpunum) { if(!ismp) return; 80102ad5: 90 nop // 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); } 80102ad6: c9 leave 80102ad7: c3 ret 80102ad8 <v2p>: #define KERNBASE 0x80000000 // First kernel virtual address #define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked #ifndef __ASSEMBLER__ static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; } 80102ad8: 55 push %ebp 80102ad9: 89 e5 mov %esp,%ebp 80102adb: 8b 45 08 mov 0x8(%ebp),%eax 80102ade: 05 00 00 00 80 add $0x80000000,%eax 80102ae3: 5d pop %ebp 80102ae4: c3 ret 80102ae5 <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) { 80102ae5: 55 push %ebp 80102ae6: 89 e5 mov %esp,%ebp 80102ae8: 83 ec 08 sub $0x8,%esp initlock(&kmem.lock, "kmem"); 80102aeb: 83 ec 08 sub $0x8,%esp 80102aee: 68 22 8f 10 80 push $0x80108f22 80102af3: 68 40 32 11 80 push $0x80113240 80102af8: e8 51 2a 00 00 call 8010554e <initlock> 80102afd: 83 c4 10 add $0x10,%esp kmem.use_lock = 0; 80102b00: c7 05 74 32 11 80 00 movl $0x0,0x80113274 80102b07: 00 00 00 freerange(vstart, vend); 80102b0a: 83 ec 08 sub $0x8,%esp 80102b0d: ff 75 0c pushl 0xc(%ebp) 80102b10: ff 75 08 pushl 0x8(%ebp) 80102b13: e8 2a 00 00 00 call 80102b42 <freerange> 80102b18: 83 c4 10 add $0x10,%esp } 80102b1b: 90 nop 80102b1c: c9 leave 80102b1d: c3 ret 80102b1e <kinit2>: void kinit2(void *vstart, void *vend) { 80102b1e: 55 push %ebp 80102b1f: 89 e5 mov %esp,%ebp 80102b21: 83 ec 08 sub $0x8,%esp freerange(vstart, vend); 80102b24: 83 ec 08 sub $0x8,%esp 80102b27: ff 75 0c pushl 0xc(%ebp) 80102b2a: ff 75 08 pushl 0x8(%ebp) 80102b2d: e8 10 00 00 00 call 80102b42 <freerange> 80102b32: 83 c4 10 add $0x10,%esp kmem.use_lock = 1; 80102b35: c7 05 74 32 11 80 01 movl $0x1,0x80113274 80102b3c: 00 00 00 } 80102b3f: 90 nop 80102b40: c9 leave 80102b41: c3 ret 80102b42 <freerange>: void freerange(void *vstart, void *vend) { 80102b42: 55 push %ebp 80102b43: 89 e5 mov %esp,%ebp 80102b45: 83 ec 18 sub $0x18,%esp char *p; p = (char*)PGROUNDUP((uint)vstart); 80102b48: 8b 45 08 mov 0x8(%ebp),%eax 80102b4b: 05 ff 0f 00 00 add $0xfff,%eax 80102b50: 25 00 f0 ff ff and $0xfffff000,%eax 80102b55: 89 45 f4 mov %eax,-0xc(%ebp) for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102b58: eb 15 jmp 80102b6f <freerange+0x2d> kfree(p); 80102b5a: 83 ec 0c sub $0xc,%esp 80102b5d: ff 75 f4 pushl -0xc(%ebp) 80102b60: e8 1a 00 00 00 call 80102b7f <kfree> 80102b65: 83 c4 10 add $0x10,%esp void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102b68: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80102b6f: 8b 45 f4 mov -0xc(%ebp),%eax 80102b72: 05 00 10 00 00 add $0x1000,%eax 80102b77: 3b 45 0c cmp 0xc(%ebp),%eax 80102b7a: 76 de jbe 80102b5a <freerange+0x18> kfree(p); } 80102b7c: 90 nop 80102b7d: c9 leave 80102b7e: c3 ret 80102b7f <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) { 80102b7f: 55 push %ebp 80102b80: 89 e5 mov %esp,%ebp 80102b82: 83 ec 18 sub $0x18,%esp struct run *r; if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP) 80102b85: 8b 45 08 mov 0x8(%ebp),%eax 80102b88: 25 ff 0f 00 00 and $0xfff,%eax 80102b8d: 85 c0 test %eax,%eax 80102b8f: 75 1b jne 80102bac <kfree+0x2d> 80102b91: 81 7d 08 60 65 11 80 cmpl $0x80116560,0x8(%ebp) 80102b98: 72 12 jb 80102bac <kfree+0x2d> 80102b9a: ff 75 08 pushl 0x8(%ebp) 80102b9d: e8 36 ff ff ff call 80102ad8 <v2p> 80102ba2: 83 c4 04 add $0x4,%esp 80102ba5: 3d ff ff ff 0d cmp $0xdffffff,%eax 80102baa: 76 0d jbe 80102bb9 <kfree+0x3a> panic("kfree"); 80102bac: 83 ec 0c sub $0xc,%esp 80102baf: 68 27 8f 10 80 push $0x80108f27 80102bb4: e8 ad d9 ff ff call 80100566 <panic> // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); 80102bb9: 83 ec 04 sub $0x4,%esp 80102bbc: 68 00 10 00 00 push $0x1000 80102bc1: 6a 01 push $0x1 80102bc3: ff 75 08 pushl 0x8(%ebp) 80102bc6: e8 08 2c 00 00 call 801057d3 <memset> 80102bcb: 83 c4 10 add $0x10,%esp if(kmem.use_lock) 80102bce: a1 74 32 11 80 mov 0x80113274,%eax 80102bd3: 85 c0 test %eax,%eax 80102bd5: 74 10 je 80102be7 <kfree+0x68> acquire(&kmem.lock); 80102bd7: 83 ec 0c sub $0xc,%esp 80102bda: 68 40 32 11 80 push $0x80113240 80102bdf: e8 8c 29 00 00 call 80105570 <acquire> 80102be4: 83 c4 10 add $0x10,%esp numfreepages++; 80102be7: a1 5c c6 10 80 mov 0x8010c65c,%eax 80102bec: 83 c0 01 add $0x1,%eax 80102bef: a3 5c c6 10 80 mov %eax,0x8010c65c r = (struct run*)v; 80102bf4: 8b 45 08 mov 0x8(%ebp),%eax 80102bf7: 89 45 f4 mov %eax,-0xc(%ebp) r->next = kmem.freelist; 80102bfa: 8b 15 78 32 11 80 mov 0x80113278,%edx 80102c00: 8b 45 f4 mov -0xc(%ebp),%eax 80102c03: 89 10 mov %edx,(%eax) kmem.freelist = r; 80102c05: 8b 45 f4 mov -0xc(%ebp),%eax 80102c08: a3 78 32 11 80 mov %eax,0x80113278 if(kmem.use_lock) 80102c0d: a1 74 32 11 80 mov 0x80113274,%eax 80102c12: 85 c0 test %eax,%eax 80102c14: 74 10 je 80102c26 <kfree+0xa7> release(&kmem.lock); 80102c16: 83 ec 0c sub $0xc,%esp 80102c19: 68 40 32 11 80 push $0x80113240 80102c1e: e8 b4 29 00 00 call 801055d7 <release> 80102c23: 83 c4 10 add $0x10,%esp } 80102c26: 90 nop 80102c27: c9 leave 80102c28: c3 ret 80102c29 <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) { 80102c29: 55 push %ebp 80102c2a: 89 e5 mov %esp,%ebp 80102c2c: 83 ec 18 sub $0x18,%esp struct run *r; if(kmem.use_lock) 80102c2f: a1 74 32 11 80 mov 0x80113274,%eax 80102c34: 85 c0 test %eax,%eax 80102c36: 74 10 je 80102c48 <kalloc+0x1f> acquire(&kmem.lock); 80102c38: 83 ec 0c sub $0xc,%esp 80102c3b: 68 40 32 11 80 push $0x80113240 80102c40: e8 2b 29 00 00 call 80105570 <acquire> 80102c45: 83 c4 10 add $0x10,%esp numfreepages--; 80102c48: a1 5c c6 10 80 mov 0x8010c65c,%eax 80102c4d: 83 e8 01 sub $0x1,%eax 80102c50: a3 5c c6 10 80 mov %eax,0x8010c65c r = kmem.freelist; 80102c55: a1 78 32 11 80 mov 0x80113278,%eax 80102c5a: 89 45 f4 mov %eax,-0xc(%ebp) if(r) 80102c5d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80102c61: 74 0a je 80102c6d <kalloc+0x44> kmem.freelist = r->next; 80102c63: 8b 45 f4 mov -0xc(%ebp),%eax 80102c66: 8b 00 mov (%eax),%eax 80102c68: a3 78 32 11 80 mov %eax,0x80113278 if(kmem.use_lock) 80102c6d: a1 74 32 11 80 mov 0x80113274,%eax 80102c72: 85 c0 test %eax,%eax 80102c74: 74 10 je 80102c86 <kalloc+0x5d> release(&kmem.lock); 80102c76: 83 ec 0c sub $0xc,%esp 80102c79: 68 40 32 11 80 push $0x80113240 80102c7e: e8 54 29 00 00 call 801055d7 <release> 80102c83: 83 c4 10 add $0x10,%esp return (char*)r; 80102c86: 8b 45 f4 mov -0xc(%ebp),%eax } 80102c89: c9 leave 80102c8a: c3 ret 80102c8b <freemem>: int freemem(){ 80102c8b: 55 push %ebp 80102c8c: 89 e5 mov %esp,%ebp return numfreepages; 80102c8e: a1 5c c6 10 80 mov 0x8010c65c,%eax } 80102c93: 5d pop %ebp 80102c94: c3 ret 80102c95 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 80102c95: 55 push %ebp 80102c96: 89 e5 mov %esp,%ebp 80102c98: 83 ec 14 sub $0x14,%esp 80102c9b: 8b 45 08 mov 0x8(%ebp),%eax 80102c9e: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102ca2: 0f b7 45 ec movzwl -0x14(%ebp),%eax 80102ca6: 89 c2 mov %eax,%edx 80102ca8: ec in (%dx),%al 80102ca9: 88 45 ff mov %al,-0x1(%ebp) return data; 80102cac: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 80102cb0: c9 leave 80102cb1: c3 ret 80102cb2 <kbdgetc>: #include "defs.h" #include "kbd.h" int kbdgetc(void) { 80102cb2: 55 push %ebp 80102cb3: 89 e5 mov %esp,%ebp 80102cb5: 83 ec 10 sub $0x10,%esp static uchar *charcode[4] = { normalmap, shiftmap, ctlmap, ctlmap }; uint st, data, c; st = inb(KBSTATP); 80102cb8: 6a 64 push $0x64 80102cba: e8 d6 ff ff ff call 80102c95 <inb> 80102cbf: 83 c4 04 add $0x4,%esp 80102cc2: 0f b6 c0 movzbl %al,%eax 80102cc5: 89 45 f4 mov %eax,-0xc(%ebp) if((st & KBS_DIB) == 0) 80102cc8: 8b 45 f4 mov -0xc(%ebp),%eax 80102ccb: 83 e0 01 and $0x1,%eax 80102cce: 85 c0 test %eax,%eax 80102cd0: 75 0a jne 80102cdc <kbdgetc+0x2a> return -1; 80102cd2: b8 ff ff ff ff mov $0xffffffff,%eax 80102cd7: e9 23 01 00 00 jmp 80102dff <kbdgetc+0x14d> data = inb(KBDATAP); 80102cdc: 6a 60 push $0x60 80102cde: e8 b2 ff ff ff call 80102c95 <inb> 80102ce3: 83 c4 04 add $0x4,%esp 80102ce6: 0f b6 c0 movzbl %al,%eax 80102ce9: 89 45 fc mov %eax,-0x4(%ebp) if(data == 0xE0){ 80102cec: 81 7d fc e0 00 00 00 cmpl $0xe0,-0x4(%ebp) 80102cf3: 75 17 jne 80102d0c <kbdgetc+0x5a> shift |= E0ESC; 80102cf5: a1 60 c6 10 80 mov 0x8010c660,%eax 80102cfa: 83 c8 40 or $0x40,%eax 80102cfd: a3 60 c6 10 80 mov %eax,0x8010c660 return 0; 80102d02: b8 00 00 00 00 mov $0x0,%eax 80102d07: e9 f3 00 00 00 jmp 80102dff <kbdgetc+0x14d> } else if(data & 0x80){ 80102d0c: 8b 45 fc mov -0x4(%ebp),%eax 80102d0f: 25 80 00 00 00 and $0x80,%eax 80102d14: 85 c0 test %eax,%eax 80102d16: 74 45 je 80102d5d <kbdgetc+0xab> // Key released data = (shift & E0ESC ? data : data & 0x7F); 80102d18: a1 60 c6 10 80 mov 0x8010c660,%eax 80102d1d: 83 e0 40 and $0x40,%eax 80102d20: 85 c0 test %eax,%eax 80102d22: 75 08 jne 80102d2c <kbdgetc+0x7a> 80102d24: 8b 45 fc mov -0x4(%ebp),%eax 80102d27: 83 e0 7f and $0x7f,%eax 80102d2a: eb 03 jmp 80102d2f <kbdgetc+0x7d> 80102d2c: 8b 45 fc mov -0x4(%ebp),%eax 80102d2f: 89 45 fc mov %eax,-0x4(%ebp) shift &= ~(shiftcode[data] | E0ESC); 80102d32: 8b 45 fc mov -0x4(%ebp),%eax 80102d35: 05 20 a0 10 80 add $0x8010a020,%eax 80102d3a: 0f b6 00 movzbl (%eax),%eax 80102d3d: 83 c8 40 or $0x40,%eax 80102d40: 0f b6 c0 movzbl %al,%eax 80102d43: f7 d0 not %eax 80102d45: 89 c2 mov %eax,%edx 80102d47: a1 60 c6 10 80 mov 0x8010c660,%eax 80102d4c: 21 d0 and %edx,%eax 80102d4e: a3 60 c6 10 80 mov %eax,0x8010c660 return 0; 80102d53: b8 00 00 00 00 mov $0x0,%eax 80102d58: e9 a2 00 00 00 jmp 80102dff <kbdgetc+0x14d> } else if(shift & E0ESC){ 80102d5d: a1 60 c6 10 80 mov 0x8010c660,%eax 80102d62: 83 e0 40 and $0x40,%eax 80102d65: 85 c0 test %eax,%eax 80102d67: 74 14 je 80102d7d <kbdgetc+0xcb> // Last character was an E0 escape; or with 0x80 data |= 0x80; 80102d69: 81 4d fc 80 00 00 00 orl $0x80,-0x4(%ebp) shift &= ~E0ESC; 80102d70: a1 60 c6 10 80 mov 0x8010c660,%eax 80102d75: 83 e0 bf and $0xffffffbf,%eax 80102d78: a3 60 c6 10 80 mov %eax,0x8010c660 } shift |= shiftcode[data]; 80102d7d: 8b 45 fc mov -0x4(%ebp),%eax 80102d80: 05 20 a0 10 80 add $0x8010a020,%eax 80102d85: 0f b6 00 movzbl (%eax),%eax 80102d88: 0f b6 d0 movzbl %al,%edx 80102d8b: a1 60 c6 10 80 mov 0x8010c660,%eax 80102d90: 09 d0 or %edx,%eax 80102d92: a3 60 c6 10 80 mov %eax,0x8010c660 shift ^= togglecode[data]; 80102d97: 8b 45 fc mov -0x4(%ebp),%eax 80102d9a: 05 20 a1 10 80 add $0x8010a120,%eax 80102d9f: 0f b6 00 movzbl (%eax),%eax 80102da2: 0f b6 d0 movzbl %al,%edx 80102da5: a1 60 c6 10 80 mov 0x8010c660,%eax 80102daa: 31 d0 xor %edx,%eax 80102dac: a3 60 c6 10 80 mov %eax,0x8010c660 c = charcode[shift & (CTL | SHIFT)][data]; 80102db1: a1 60 c6 10 80 mov 0x8010c660,%eax 80102db6: 83 e0 03 and $0x3,%eax 80102db9: 8b 14 85 20 a5 10 80 mov -0x7fef5ae0(,%eax,4),%edx 80102dc0: 8b 45 fc mov -0x4(%ebp),%eax 80102dc3: 01 d0 add %edx,%eax 80102dc5: 0f b6 00 movzbl (%eax),%eax 80102dc8: 0f b6 c0 movzbl %al,%eax 80102dcb: 89 45 f8 mov %eax,-0x8(%ebp) if(shift & CAPSLOCK){ 80102dce: a1 60 c6 10 80 mov 0x8010c660,%eax 80102dd3: 83 e0 08 and $0x8,%eax 80102dd6: 85 c0 test %eax,%eax 80102dd8: 74 22 je 80102dfc <kbdgetc+0x14a> if('a' <= c && c <= 'z') 80102dda: 83 7d f8 60 cmpl $0x60,-0x8(%ebp) 80102dde: 76 0c jbe 80102dec <kbdgetc+0x13a> 80102de0: 83 7d f8 7a cmpl $0x7a,-0x8(%ebp) 80102de4: 77 06 ja 80102dec <kbdgetc+0x13a> c += 'A' - 'a'; 80102de6: 83 6d f8 20 subl $0x20,-0x8(%ebp) 80102dea: eb 10 jmp 80102dfc <kbdgetc+0x14a> else if('A' <= c && c <= 'Z') 80102dec: 83 7d f8 40 cmpl $0x40,-0x8(%ebp) 80102df0: 76 0a jbe 80102dfc <kbdgetc+0x14a> 80102df2: 83 7d f8 5a cmpl $0x5a,-0x8(%ebp) 80102df6: 77 04 ja 80102dfc <kbdgetc+0x14a> c += 'a' - 'A'; 80102df8: 83 45 f8 20 addl $0x20,-0x8(%ebp) } return c; 80102dfc: 8b 45 f8 mov -0x8(%ebp),%eax } 80102dff: c9 leave 80102e00: c3 ret 80102e01 <kbdintr>: void kbdintr(void) { 80102e01: 55 push %ebp 80102e02: 89 e5 mov %esp,%ebp 80102e04: 83 ec 08 sub $0x8,%esp consoleintr(kbdgetc); 80102e07: 83 ec 0c sub $0xc,%esp 80102e0a: 68 b2 2c 10 80 push $0x80102cb2 80102e0f: e8 e5 d9 ff ff call 801007f9 <consoleintr> 80102e14: 83 c4 10 add $0x10,%esp } 80102e17: 90 nop 80102e18: c9 leave 80102e19: c3 ret 80102e1a <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 80102e1a: 55 push %ebp 80102e1b: 89 e5 mov %esp,%ebp 80102e1d: 83 ec 14 sub $0x14,%esp 80102e20: 8b 45 08 mov 0x8(%ebp),%eax 80102e23: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102e27: 0f b7 45 ec movzwl -0x14(%ebp),%eax 80102e2b: 89 c2 mov %eax,%edx 80102e2d: ec in (%dx),%al 80102e2e: 88 45 ff mov %al,-0x1(%ebp) return data; 80102e31: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 80102e35: c9 leave 80102e36: c3 ret 80102e37 <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 80102e37: 55 push %ebp 80102e38: 89 e5 mov %esp,%ebp 80102e3a: 83 ec 08 sub $0x8,%esp 80102e3d: 8b 55 08 mov 0x8(%ebp),%edx 80102e40: 8b 45 0c mov 0xc(%ebp),%eax 80102e43: 66 89 55 fc mov %dx,-0x4(%ebp) 80102e47: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102e4a: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80102e4e: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80102e52: ee out %al,(%dx) } 80102e53: 90 nop 80102e54: c9 leave 80102e55: c3 ret 80102e56 <readeflags>: asm volatile("ltr %0" : : "r" (sel)); } static inline uint readeflags(void) { 80102e56: 55 push %ebp 80102e57: 89 e5 mov %esp,%ebp 80102e59: 83 ec 10 sub $0x10,%esp uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 80102e5c: 9c pushf 80102e5d: 58 pop %eax 80102e5e: 89 45 fc mov %eax,-0x4(%ebp) return eflags; 80102e61: 8b 45 fc mov -0x4(%ebp),%eax } 80102e64: c9 leave 80102e65: c3 ret 80102e66 <lapicw>: volatile uint *lapic; // Initialized in mp.c static void lapicw(int index, int value) { 80102e66: 55 push %ebp 80102e67: 89 e5 mov %esp,%ebp lapic[index] = value; 80102e69: a1 7c 32 11 80 mov 0x8011327c,%eax 80102e6e: 8b 55 08 mov 0x8(%ebp),%edx 80102e71: c1 e2 02 shl $0x2,%edx 80102e74: 01 c2 add %eax,%edx 80102e76: 8b 45 0c mov 0xc(%ebp),%eax 80102e79: 89 02 mov %eax,(%edx) lapic[ID]; // wait for write to finish, by reading 80102e7b: a1 7c 32 11 80 mov 0x8011327c,%eax 80102e80: 83 c0 20 add $0x20,%eax 80102e83: 8b 00 mov (%eax),%eax } 80102e85: 90 nop 80102e86: 5d pop %ebp 80102e87: c3 ret 80102e88 <lapicinit>: //PAGEBREAK! void lapicinit(void) { 80102e88: 55 push %ebp 80102e89: 89 e5 mov %esp,%ebp if(!lapic) 80102e8b: a1 7c 32 11 80 mov 0x8011327c,%eax 80102e90: 85 c0 test %eax,%eax 80102e92: 0f 84 0b 01 00 00 je 80102fa3 <lapicinit+0x11b> return; // Enable local APIC; set spurious interrupt vector. lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS)); 80102e98: 68 3f 01 00 00 push $0x13f 80102e9d: 6a 3c push $0x3c 80102e9f: e8 c2 ff ff ff call 80102e66 <lapicw> 80102ea4: 83 c4 08 add $0x8,%esp // The timer repeatedly counts down at bus frequency // from lapic[TICR] and then issues an interrupt. // If xv6 cared more about precise timekeeping, // TICR would be calibrated using an external time source. lapicw(TDCR, X1); 80102ea7: 6a 0b push $0xb 80102ea9: 68 f8 00 00 00 push $0xf8 80102eae: e8 b3 ff ff ff call 80102e66 <lapicw> 80102eb3: 83 c4 08 add $0x8,%esp lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER)); 80102eb6: 68 20 00 02 00 push $0x20020 80102ebb: 68 c8 00 00 00 push $0xc8 80102ec0: e8 a1 ff ff ff call 80102e66 <lapicw> 80102ec5: 83 c4 08 add $0x8,%esp lapicw(TICR, 10000000); 80102ec8: 68 80 96 98 00 push $0x989680 80102ecd: 68 e0 00 00 00 push $0xe0 80102ed2: e8 8f ff ff ff call 80102e66 <lapicw> 80102ed7: 83 c4 08 add $0x8,%esp // Disable logical interrupt lines. lapicw(LINT0, MASKED); 80102eda: 68 00 00 01 00 push $0x10000 80102edf: 68 d4 00 00 00 push $0xd4 80102ee4: e8 7d ff ff ff call 80102e66 <lapicw> 80102ee9: 83 c4 08 add $0x8,%esp lapicw(LINT1, MASKED); 80102eec: 68 00 00 01 00 push $0x10000 80102ef1: 68 d8 00 00 00 push $0xd8 80102ef6: e8 6b ff ff ff call 80102e66 <lapicw> 80102efb: 83 c4 08 add $0x8,%esp // Disable performance counter overflow interrupts // on machines that provide that interrupt entry. if(((lapic[VER]>>16) & 0xFF) >= 4) 80102efe: a1 7c 32 11 80 mov 0x8011327c,%eax 80102f03: 83 c0 30 add $0x30,%eax 80102f06: 8b 00 mov (%eax),%eax 80102f08: c1 e8 10 shr $0x10,%eax 80102f0b: 0f b6 c0 movzbl %al,%eax 80102f0e: 83 f8 03 cmp $0x3,%eax 80102f11: 76 12 jbe 80102f25 <lapicinit+0x9d> lapicw(PCINT, MASKED); 80102f13: 68 00 00 01 00 push $0x10000 80102f18: 68 d0 00 00 00 push $0xd0 80102f1d: e8 44 ff ff ff call 80102e66 <lapicw> 80102f22: 83 c4 08 add $0x8,%esp // Map error interrupt to IRQ_ERROR. lapicw(ERROR, T_IRQ0 + IRQ_ERROR); 80102f25: 6a 33 push $0x33 80102f27: 68 dc 00 00 00 push $0xdc 80102f2c: e8 35 ff ff ff call 80102e66 <lapicw> 80102f31: 83 c4 08 add $0x8,%esp // Clear error status register (requires back-to-back writes). lapicw(ESR, 0); 80102f34: 6a 00 push $0x0 80102f36: 68 a0 00 00 00 push $0xa0 80102f3b: e8 26 ff ff ff call 80102e66 <lapicw> 80102f40: 83 c4 08 add $0x8,%esp lapicw(ESR, 0); 80102f43: 6a 00 push $0x0 80102f45: 68 a0 00 00 00 push $0xa0 80102f4a: e8 17 ff ff ff call 80102e66 <lapicw> 80102f4f: 83 c4 08 add $0x8,%esp // Ack any outstanding interrupts. lapicw(EOI, 0); 80102f52: 6a 00 push $0x0 80102f54: 6a 2c push $0x2c 80102f56: e8 0b ff ff ff call 80102e66 <lapicw> 80102f5b: 83 c4 08 add $0x8,%esp // Send an Init Level De-Assert to synchronise arbitration ID's. lapicw(ICRHI, 0); 80102f5e: 6a 00 push $0x0 80102f60: 68 c4 00 00 00 push $0xc4 80102f65: e8 fc fe ff ff call 80102e66 <lapicw> 80102f6a: 83 c4 08 add $0x8,%esp lapicw(ICRLO, BCAST | INIT | LEVEL); 80102f6d: 68 00 85 08 00 push $0x88500 80102f72: 68 c0 00 00 00 push $0xc0 80102f77: e8 ea fe ff ff call 80102e66 <lapicw> 80102f7c: 83 c4 08 add $0x8,%esp while(lapic[ICRLO] & DELIVS) 80102f7f: 90 nop 80102f80: a1 7c 32 11 80 mov 0x8011327c,%eax 80102f85: 05 00 03 00 00 add $0x300,%eax 80102f8a: 8b 00 mov (%eax),%eax 80102f8c: 25 00 10 00 00 and $0x1000,%eax 80102f91: 85 c0 test %eax,%eax 80102f93: 75 eb jne 80102f80 <lapicinit+0xf8> ; // Enable interrupts on the APIC (but not on the processor). lapicw(TPR, 0); 80102f95: 6a 00 push $0x0 80102f97: 6a 20 push $0x20 80102f99: e8 c8 fe ff ff call 80102e66 <lapicw> 80102f9e: 83 c4 08 add $0x8,%esp 80102fa1: eb 01 jmp 80102fa4 <lapicinit+0x11c> void lapicinit(void) { if(!lapic) return; 80102fa3: 90 nop while(lapic[ICRLO] & DELIVS) ; // Enable interrupts on the APIC (but not on the processor). lapicw(TPR, 0); } 80102fa4: c9 leave 80102fa5: c3 ret 80102fa6 <cpunum>: int cpunum(void) { 80102fa6: 55 push %ebp 80102fa7: 89 e5 mov %esp,%ebp 80102fa9: 83 ec 08 sub $0x8,%esp // Cannot call cpu when interrupts are enabled: // result not guaranteed to last long enough to be used! // Would prefer to panic but even printing is chancy here: // almost everything, including cprintf and panic, calls cpu, // often indirectly through acquire and release. if(readeflags()&FL_IF){ 80102fac: e8 a5 fe ff ff call 80102e56 <readeflags> 80102fb1: 25 00 02 00 00 and $0x200,%eax 80102fb6: 85 c0 test %eax,%eax 80102fb8: 74 26 je 80102fe0 <cpunum+0x3a> static int n; if(n++ == 0) 80102fba: a1 64 c6 10 80 mov 0x8010c664,%eax 80102fbf: 8d 50 01 lea 0x1(%eax),%edx 80102fc2: 89 15 64 c6 10 80 mov %edx,0x8010c664 80102fc8: 85 c0 test %eax,%eax 80102fca: 75 14 jne 80102fe0 <cpunum+0x3a> cprintf("cpu called from %x with interrupts enabled\n", 80102fcc: 8b 45 04 mov 0x4(%ebp),%eax 80102fcf: 83 ec 08 sub $0x8,%esp 80102fd2: 50 push %eax 80102fd3: 68 30 8f 10 80 push $0x80108f30 80102fd8: e8 e9 d3 ff ff call 801003c6 <cprintf> 80102fdd: 83 c4 10 add $0x10,%esp __builtin_return_address(0)); } if(lapic) 80102fe0: a1 7c 32 11 80 mov 0x8011327c,%eax 80102fe5: 85 c0 test %eax,%eax 80102fe7: 74 0f je 80102ff8 <cpunum+0x52> return lapic[ID]>>24; 80102fe9: a1 7c 32 11 80 mov 0x8011327c,%eax 80102fee: 83 c0 20 add $0x20,%eax 80102ff1: 8b 00 mov (%eax),%eax 80102ff3: c1 e8 18 shr $0x18,%eax 80102ff6: eb 05 jmp 80102ffd <cpunum+0x57> return 0; 80102ff8: b8 00 00 00 00 mov $0x0,%eax } 80102ffd: c9 leave 80102ffe: c3 ret 80102fff <lapiceoi>: // Acknowledge interrupt. void lapiceoi(void) { 80102fff: 55 push %ebp 80103000: 89 e5 mov %esp,%ebp if(lapic) 80103002: a1 7c 32 11 80 mov 0x8011327c,%eax 80103007: 85 c0 test %eax,%eax 80103009: 74 0c je 80103017 <lapiceoi+0x18> lapicw(EOI, 0); 8010300b: 6a 00 push $0x0 8010300d: 6a 2c push $0x2c 8010300f: e8 52 fe ff ff call 80102e66 <lapicw> 80103014: 83 c4 08 add $0x8,%esp } 80103017: 90 nop 80103018: c9 leave 80103019: c3 ret 8010301a <microdelay>: // Spin for a given number of microseconds. // On real hardware would want to tune this dynamically. void microdelay(int us) { 8010301a: 55 push %ebp 8010301b: 89 e5 mov %esp,%ebp } 8010301d: 90 nop 8010301e: 5d pop %ebp 8010301f: c3 ret 80103020 <lapicstartap>: // Start additional processor running entry code at addr. // See Appendix B of MultiProcessor Specification. void lapicstartap(uchar apicid, uint addr) { 80103020: 55 push %ebp 80103021: 89 e5 mov %esp,%ebp 80103023: 83 ec 14 sub $0x14,%esp 80103026: 8b 45 08 mov 0x8(%ebp),%eax 80103029: 88 45 ec mov %al,-0x14(%ebp) ushort *wrv; // "The BSP must initialize CMOS shutdown code to 0AH // and the warm reset vector (DWORD based at 40:67) to point at // the AP startup code prior to the [universal startup algorithm]." outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code 8010302c: 6a 0f push $0xf 8010302e: 6a 70 push $0x70 80103030: e8 02 fe ff ff call 80102e37 <outb> 80103035: 83 c4 08 add $0x8,%esp outb(CMOS_PORT+1, 0x0A); 80103038: 6a 0a push $0xa 8010303a: 6a 71 push $0x71 8010303c: e8 f6 fd ff ff call 80102e37 <outb> 80103041: 83 c4 08 add $0x8,%esp wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector 80103044: c7 45 f8 67 04 00 80 movl $0x80000467,-0x8(%ebp) wrv[0] = 0; 8010304b: 8b 45 f8 mov -0x8(%ebp),%eax 8010304e: 66 c7 00 00 00 movw $0x0,(%eax) wrv[1] = addr >> 4; 80103053: 8b 45 f8 mov -0x8(%ebp),%eax 80103056: 83 c0 02 add $0x2,%eax 80103059: 8b 55 0c mov 0xc(%ebp),%edx 8010305c: c1 ea 04 shr $0x4,%edx 8010305f: 66 89 10 mov %dx,(%eax) // "Universal startup algorithm." // Send INIT (level-triggered) interrupt to reset other CPU. lapicw(ICRHI, apicid<<24); 80103062: 0f b6 45 ec movzbl -0x14(%ebp),%eax 80103066: c1 e0 18 shl $0x18,%eax 80103069: 50 push %eax 8010306a: 68 c4 00 00 00 push $0xc4 8010306f: e8 f2 fd ff ff call 80102e66 <lapicw> 80103074: 83 c4 08 add $0x8,%esp lapicw(ICRLO, INIT | LEVEL | ASSERT); 80103077: 68 00 c5 00 00 push $0xc500 8010307c: 68 c0 00 00 00 push $0xc0 80103081: e8 e0 fd ff ff call 80102e66 <lapicw> 80103086: 83 c4 08 add $0x8,%esp microdelay(200); 80103089: 68 c8 00 00 00 push $0xc8 8010308e: e8 87 ff ff ff call 8010301a <microdelay> 80103093: 83 c4 04 add $0x4,%esp lapicw(ICRLO, INIT | LEVEL); 80103096: 68 00 85 00 00 push $0x8500 8010309b: 68 c0 00 00 00 push $0xc0 801030a0: e8 c1 fd ff ff call 80102e66 <lapicw> 801030a5: 83 c4 08 add $0x8,%esp microdelay(100); // should be 10ms, but too slow in Bochs! 801030a8: 6a 64 push $0x64 801030aa: e8 6b ff ff ff call 8010301a <microdelay> 801030af: 83 c4 04 add $0x4,%esp // Send startup IPI (twice!) to enter code. // Regular hardware is supposed to only accept a STARTUP // when it is in the halted state due to an INIT. So the second // should be ignored, but it is part of the official Intel algorithm. // Bochs complains about the second one. Too bad for Bochs. for(i = 0; i < 2; i++){ 801030b2: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 801030b9: eb 3d jmp 801030f8 <lapicstartap+0xd8> lapicw(ICRHI, apicid<<24); 801030bb: 0f b6 45 ec movzbl -0x14(%ebp),%eax 801030bf: c1 e0 18 shl $0x18,%eax 801030c2: 50 push %eax 801030c3: 68 c4 00 00 00 push $0xc4 801030c8: e8 99 fd ff ff call 80102e66 <lapicw> 801030cd: 83 c4 08 add $0x8,%esp lapicw(ICRLO, STARTUP | (addr>>12)); 801030d0: 8b 45 0c mov 0xc(%ebp),%eax 801030d3: c1 e8 0c shr $0xc,%eax 801030d6: 80 cc 06 or $0x6,%ah 801030d9: 50 push %eax 801030da: 68 c0 00 00 00 push $0xc0 801030df: e8 82 fd ff ff call 80102e66 <lapicw> 801030e4: 83 c4 08 add $0x8,%esp microdelay(200); 801030e7: 68 c8 00 00 00 push $0xc8 801030ec: e8 29 ff ff ff call 8010301a <microdelay> 801030f1: 83 c4 04 add $0x4,%esp // Send startup IPI (twice!) to enter code. // Regular hardware is supposed to only accept a STARTUP // when it is in the halted state due to an INIT. So the second // should be ignored, but it is part of the official Intel algorithm. // Bochs complains about the second one. Too bad for Bochs. for(i = 0; i < 2; i++){ 801030f4: 83 45 fc 01 addl $0x1,-0x4(%ebp) 801030f8: 83 7d fc 01 cmpl $0x1,-0x4(%ebp) 801030fc: 7e bd jle 801030bb <lapicstartap+0x9b> lapicw(ICRHI, apicid<<24); lapicw(ICRLO, STARTUP | (addr>>12)); microdelay(200); } } 801030fe: 90 nop 801030ff: c9 leave 80103100: c3 ret 80103101 <cmos_read>: #define DAY 0x07 #define MONTH 0x08 #define YEAR 0x09 static uint cmos_read(uint reg) { 80103101: 55 push %ebp 80103102: 89 e5 mov %esp,%ebp outb(CMOS_PORT, reg); 80103104: 8b 45 08 mov 0x8(%ebp),%eax 80103107: 0f b6 c0 movzbl %al,%eax 8010310a: 50 push %eax 8010310b: 6a 70 push $0x70 8010310d: e8 25 fd ff ff call 80102e37 <outb> 80103112: 83 c4 08 add $0x8,%esp microdelay(200); 80103115: 68 c8 00 00 00 push $0xc8 8010311a: e8 fb fe ff ff call 8010301a <microdelay> 8010311f: 83 c4 04 add $0x4,%esp return inb(CMOS_RETURN); 80103122: 6a 71 push $0x71 80103124: e8 f1 fc ff ff call 80102e1a <inb> 80103129: 83 c4 04 add $0x4,%esp 8010312c: 0f b6 c0 movzbl %al,%eax } 8010312f: c9 leave 80103130: c3 ret 80103131 <fill_rtcdate>: static void fill_rtcdate(struct rtcdate *r) { 80103131: 55 push %ebp 80103132: 89 e5 mov %esp,%ebp r->second = cmos_read(SECS); 80103134: 6a 00 push $0x0 80103136: e8 c6 ff ff ff call 80103101 <cmos_read> 8010313b: 83 c4 04 add $0x4,%esp 8010313e: 89 c2 mov %eax,%edx 80103140: 8b 45 08 mov 0x8(%ebp),%eax 80103143: 89 10 mov %edx,(%eax) r->minute = cmos_read(MINS); 80103145: 6a 02 push $0x2 80103147: e8 b5 ff ff ff call 80103101 <cmos_read> 8010314c: 83 c4 04 add $0x4,%esp 8010314f: 89 c2 mov %eax,%edx 80103151: 8b 45 08 mov 0x8(%ebp),%eax 80103154: 89 50 04 mov %edx,0x4(%eax) r->hour = cmos_read(HOURS); 80103157: 6a 04 push $0x4 80103159: e8 a3 ff ff ff call 80103101 <cmos_read> 8010315e: 83 c4 04 add $0x4,%esp 80103161: 89 c2 mov %eax,%edx 80103163: 8b 45 08 mov 0x8(%ebp),%eax 80103166: 89 50 08 mov %edx,0x8(%eax) r->day = cmos_read(DAY); 80103169: 6a 07 push $0x7 8010316b: e8 91 ff ff ff call 80103101 <cmos_read> 80103170: 83 c4 04 add $0x4,%esp 80103173: 89 c2 mov %eax,%edx 80103175: 8b 45 08 mov 0x8(%ebp),%eax 80103178: 89 50 0c mov %edx,0xc(%eax) r->month = cmos_read(MONTH); 8010317b: 6a 08 push $0x8 8010317d: e8 7f ff ff ff call 80103101 <cmos_read> 80103182: 83 c4 04 add $0x4,%esp 80103185: 89 c2 mov %eax,%edx 80103187: 8b 45 08 mov 0x8(%ebp),%eax 8010318a: 89 50 10 mov %edx,0x10(%eax) r->year = cmos_read(YEAR); 8010318d: 6a 09 push $0x9 8010318f: e8 6d ff ff ff call 80103101 <cmos_read> 80103194: 83 c4 04 add $0x4,%esp 80103197: 89 c2 mov %eax,%edx 80103199: 8b 45 08 mov 0x8(%ebp),%eax 8010319c: 89 50 14 mov %edx,0x14(%eax) } 8010319f: 90 nop 801031a0: c9 leave 801031a1: c3 ret 801031a2 <cmostime>: // qemu seems to use 24-hour GWT and the values are BCD encoded void cmostime(struct rtcdate *r) { 801031a2: 55 push %ebp 801031a3: 89 e5 mov %esp,%ebp 801031a5: 83 ec 48 sub $0x48,%esp struct rtcdate t1, t2; int sb, bcd; sb = cmos_read(CMOS_STATB); 801031a8: 6a 0b push $0xb 801031aa: e8 52 ff ff ff call 80103101 <cmos_read> 801031af: 83 c4 04 add $0x4,%esp 801031b2: 89 45 f4 mov %eax,-0xc(%ebp) bcd = (sb & (1 << 2)) == 0; 801031b5: 8b 45 f4 mov -0xc(%ebp),%eax 801031b8: 83 e0 04 and $0x4,%eax 801031bb: 85 c0 test %eax,%eax 801031bd: 0f 94 c0 sete %al 801031c0: 0f b6 c0 movzbl %al,%eax 801031c3: 89 45 f0 mov %eax,-0x10(%ebp) // make sure CMOS doesn't modify time while we read it for (;;) { fill_rtcdate(&t1); 801031c6: 8d 45 d8 lea -0x28(%ebp),%eax 801031c9: 50 push %eax 801031ca: e8 62 ff ff ff call 80103131 <fill_rtcdate> 801031cf: 83 c4 04 add $0x4,%esp if (cmos_read(CMOS_STATA) & CMOS_UIP) 801031d2: 6a 0a push $0xa 801031d4: e8 28 ff ff ff call 80103101 <cmos_read> 801031d9: 83 c4 04 add $0x4,%esp 801031dc: 25 80 00 00 00 and $0x80,%eax 801031e1: 85 c0 test %eax,%eax 801031e3: 75 27 jne 8010320c <cmostime+0x6a> continue; fill_rtcdate(&t2); 801031e5: 8d 45 c0 lea -0x40(%ebp),%eax 801031e8: 50 push %eax 801031e9: e8 43 ff ff ff call 80103131 <fill_rtcdate> 801031ee: 83 c4 04 add $0x4,%esp if (memcmp(&t1, &t2, sizeof(t1)) == 0) 801031f1: 83 ec 04 sub $0x4,%esp 801031f4: 6a 18 push $0x18 801031f6: 8d 45 c0 lea -0x40(%ebp),%eax 801031f9: 50 push %eax 801031fa: 8d 45 d8 lea -0x28(%ebp),%eax 801031fd: 50 push %eax 801031fe: e8 37 26 00 00 call 8010583a <memcmp> 80103203: 83 c4 10 add $0x10,%esp 80103206: 85 c0 test %eax,%eax 80103208: 74 05 je 8010320f <cmostime+0x6d> 8010320a: eb ba jmp 801031c6 <cmostime+0x24> // make sure CMOS doesn't modify time while we read it for (;;) { fill_rtcdate(&t1); if (cmos_read(CMOS_STATA) & CMOS_UIP) continue; 8010320c: 90 nop fill_rtcdate(&t2); if (memcmp(&t1, &t2, sizeof(t1)) == 0) break; } 8010320d: eb b7 jmp 801031c6 <cmostime+0x24> fill_rtcdate(&t1); if (cmos_read(CMOS_STATA) & CMOS_UIP) continue; fill_rtcdate(&t2); if (memcmp(&t1, &t2, sizeof(t1)) == 0) break; 8010320f: 90 nop } // convert if (bcd) { 80103210: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80103214: 0f 84 b4 00 00 00 je 801032ce <cmostime+0x12c> #define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) CONV(second); 8010321a: 8b 45 d8 mov -0x28(%ebp),%eax 8010321d: c1 e8 04 shr $0x4,%eax 80103220: 89 c2 mov %eax,%edx 80103222: 89 d0 mov %edx,%eax 80103224: c1 e0 02 shl $0x2,%eax 80103227: 01 d0 add %edx,%eax 80103229: 01 c0 add %eax,%eax 8010322b: 89 c2 mov %eax,%edx 8010322d: 8b 45 d8 mov -0x28(%ebp),%eax 80103230: 83 e0 0f and $0xf,%eax 80103233: 01 d0 add %edx,%eax 80103235: 89 45 d8 mov %eax,-0x28(%ebp) CONV(minute); 80103238: 8b 45 dc mov -0x24(%ebp),%eax 8010323b: c1 e8 04 shr $0x4,%eax 8010323e: 89 c2 mov %eax,%edx 80103240: 89 d0 mov %edx,%eax 80103242: c1 e0 02 shl $0x2,%eax 80103245: 01 d0 add %edx,%eax 80103247: 01 c0 add %eax,%eax 80103249: 89 c2 mov %eax,%edx 8010324b: 8b 45 dc mov -0x24(%ebp),%eax 8010324e: 83 e0 0f and $0xf,%eax 80103251: 01 d0 add %edx,%eax 80103253: 89 45 dc mov %eax,-0x24(%ebp) CONV(hour ); 80103256: 8b 45 e0 mov -0x20(%ebp),%eax 80103259: c1 e8 04 shr $0x4,%eax 8010325c: 89 c2 mov %eax,%edx 8010325e: 89 d0 mov %edx,%eax 80103260: c1 e0 02 shl $0x2,%eax 80103263: 01 d0 add %edx,%eax 80103265: 01 c0 add %eax,%eax 80103267: 89 c2 mov %eax,%edx 80103269: 8b 45 e0 mov -0x20(%ebp),%eax 8010326c: 83 e0 0f and $0xf,%eax 8010326f: 01 d0 add %edx,%eax 80103271: 89 45 e0 mov %eax,-0x20(%ebp) CONV(day ); 80103274: 8b 45 e4 mov -0x1c(%ebp),%eax 80103277: c1 e8 04 shr $0x4,%eax 8010327a: 89 c2 mov %eax,%edx 8010327c: 89 d0 mov %edx,%eax 8010327e: c1 e0 02 shl $0x2,%eax 80103281: 01 d0 add %edx,%eax 80103283: 01 c0 add %eax,%eax 80103285: 89 c2 mov %eax,%edx 80103287: 8b 45 e4 mov -0x1c(%ebp),%eax 8010328a: 83 e0 0f and $0xf,%eax 8010328d: 01 d0 add %edx,%eax 8010328f: 89 45 e4 mov %eax,-0x1c(%ebp) CONV(month ); 80103292: 8b 45 e8 mov -0x18(%ebp),%eax 80103295: c1 e8 04 shr $0x4,%eax 80103298: 89 c2 mov %eax,%edx 8010329a: 89 d0 mov %edx,%eax 8010329c: c1 e0 02 shl $0x2,%eax 8010329f: 01 d0 add %edx,%eax 801032a1: 01 c0 add %eax,%eax 801032a3: 89 c2 mov %eax,%edx 801032a5: 8b 45 e8 mov -0x18(%ebp),%eax 801032a8: 83 e0 0f and $0xf,%eax 801032ab: 01 d0 add %edx,%eax 801032ad: 89 45 e8 mov %eax,-0x18(%ebp) CONV(year ); 801032b0: 8b 45 ec mov -0x14(%ebp),%eax 801032b3: c1 e8 04 shr $0x4,%eax 801032b6: 89 c2 mov %eax,%edx 801032b8: 89 d0 mov %edx,%eax 801032ba: c1 e0 02 shl $0x2,%eax 801032bd: 01 d0 add %edx,%eax 801032bf: 01 c0 add %eax,%eax 801032c1: 89 c2 mov %eax,%edx 801032c3: 8b 45 ec mov -0x14(%ebp),%eax 801032c6: 83 e0 0f and $0xf,%eax 801032c9: 01 d0 add %edx,%eax 801032cb: 89 45 ec mov %eax,-0x14(%ebp) #undef CONV } *r = t1; 801032ce: 8b 45 08 mov 0x8(%ebp),%eax 801032d1: 8b 55 d8 mov -0x28(%ebp),%edx 801032d4: 89 10 mov %edx,(%eax) 801032d6: 8b 55 dc mov -0x24(%ebp),%edx 801032d9: 89 50 04 mov %edx,0x4(%eax) 801032dc: 8b 55 e0 mov -0x20(%ebp),%edx 801032df: 89 50 08 mov %edx,0x8(%eax) 801032e2: 8b 55 e4 mov -0x1c(%ebp),%edx 801032e5: 89 50 0c mov %edx,0xc(%eax) 801032e8: 8b 55 e8 mov -0x18(%ebp),%edx 801032eb: 89 50 10 mov %edx,0x10(%eax) 801032ee: 8b 55 ec mov -0x14(%ebp),%edx 801032f1: 89 50 14 mov %edx,0x14(%eax) r->year += 2000; 801032f4: 8b 45 08 mov 0x8(%ebp),%eax 801032f7: 8b 40 14 mov 0x14(%eax),%eax 801032fa: 8d 90 d0 07 00 00 lea 0x7d0(%eax),%edx 80103300: 8b 45 08 mov 0x8(%ebp),%eax 80103303: 89 50 14 mov %edx,0x14(%eax) } 80103306: 90 nop 80103307: c9 leave 80103308: c3 ret 80103309 <initlog>: static void recover_from_log(void); static void commit(); void initlog(int dev) { 80103309: 55 push %ebp 8010330a: 89 e5 mov %esp,%ebp 8010330c: 83 ec 28 sub $0x28,%esp if (sizeof(struct logheader) >= BSIZE) panic("initlog: too big logheader"); struct superblock sb; initlock(&log.lock, "log"); 8010330f: 83 ec 08 sub $0x8,%esp 80103312: 68 5c 8f 10 80 push $0x80108f5c 80103317: 68 80 32 11 80 push $0x80113280 8010331c: e8 2d 22 00 00 call 8010554e <initlock> 80103321: 83 c4 10 add $0x10,%esp readsb(dev, &sb); 80103324: 83 ec 08 sub $0x8,%esp 80103327: 8d 45 dc lea -0x24(%ebp),%eax 8010332a: 50 push %eax 8010332b: ff 75 08 pushl 0x8(%ebp) 8010332e: e8 51 e0 ff ff call 80101384 <readsb> 80103333: 83 c4 10 add $0x10,%esp log.start = sb.logstart; 80103336: 8b 45 ec mov -0x14(%ebp),%eax 80103339: a3 b4 32 11 80 mov %eax,0x801132b4 log.size = sb.nlog; 8010333e: 8b 45 e8 mov -0x18(%ebp),%eax 80103341: a3 b8 32 11 80 mov %eax,0x801132b8 log.dev = dev; 80103346: 8b 45 08 mov 0x8(%ebp),%eax 80103349: a3 c4 32 11 80 mov %eax,0x801132c4 recover_from_log(); 8010334e: e8 b2 01 00 00 call 80103505 <recover_from_log> } 80103353: 90 nop 80103354: c9 leave 80103355: c3 ret 80103356 <install_trans>: // Copy committed blocks from log to their home location static void install_trans(void) { 80103356: 55 push %ebp 80103357: 89 e5 mov %esp,%ebp 80103359: 83 ec 18 sub $0x18,%esp int tail; for (tail = 0; tail < log.lh.n; tail++) { 8010335c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80103363: e9 95 00 00 00 jmp 801033fd <install_trans+0xa7> struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block 80103368: 8b 15 b4 32 11 80 mov 0x801132b4,%edx 8010336e: 8b 45 f4 mov -0xc(%ebp),%eax 80103371: 01 d0 add %edx,%eax 80103373: 83 c0 01 add $0x1,%eax 80103376: 89 c2 mov %eax,%edx 80103378: a1 c4 32 11 80 mov 0x801132c4,%eax 8010337d: 83 ec 08 sub $0x8,%esp 80103380: 52 push %edx 80103381: 50 push %eax 80103382: e8 2f ce ff ff call 801001b6 <bread> 80103387: 83 c4 10 add $0x10,%esp 8010338a: 89 45 f0 mov %eax,-0x10(%ebp) struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 8010338d: 8b 45 f4 mov -0xc(%ebp),%eax 80103390: 83 c0 10 add $0x10,%eax 80103393: 8b 04 85 8c 32 11 80 mov -0x7feecd74(,%eax,4),%eax 8010339a: 89 c2 mov %eax,%edx 8010339c: a1 c4 32 11 80 mov 0x801132c4,%eax 801033a1: 83 ec 08 sub $0x8,%esp 801033a4: 52 push %edx 801033a5: 50 push %eax 801033a6: e8 0b ce ff ff call 801001b6 <bread> 801033ab: 83 c4 10 add $0x10,%esp 801033ae: 89 45 ec mov %eax,-0x14(%ebp) memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 801033b1: 8b 45 f0 mov -0x10(%ebp),%eax 801033b4: 8d 50 18 lea 0x18(%eax),%edx 801033b7: 8b 45 ec mov -0x14(%ebp),%eax 801033ba: 83 c0 18 add $0x18,%eax 801033bd: 83 ec 04 sub $0x4,%esp 801033c0: 68 00 02 00 00 push $0x200 801033c5: 52 push %edx 801033c6: 50 push %eax 801033c7: e8 c6 24 00 00 call 80105892 <memmove> 801033cc: 83 c4 10 add $0x10,%esp bwrite(dbuf); // write dst to disk 801033cf: 83 ec 0c sub $0xc,%esp 801033d2: ff 75 ec pushl -0x14(%ebp) 801033d5: e8 15 ce ff ff call 801001ef <bwrite> 801033da: 83 c4 10 add $0x10,%esp brelse(lbuf); 801033dd: 83 ec 0c sub $0xc,%esp 801033e0: ff 75 f0 pushl -0x10(%ebp) 801033e3: e8 46 ce ff ff call 8010022e <brelse> 801033e8: 83 c4 10 add $0x10,%esp brelse(dbuf); 801033eb: 83 ec 0c sub $0xc,%esp 801033ee: ff 75 ec pushl -0x14(%ebp) 801033f1: e8 38 ce ff ff call 8010022e <brelse> 801033f6: 83 c4 10 add $0x10,%esp static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 801033f9: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801033fd: a1 c8 32 11 80 mov 0x801132c8,%eax 80103402: 3b 45 f4 cmp -0xc(%ebp),%eax 80103405: 0f 8f 5d ff ff ff jg 80103368 <install_trans+0x12> memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst bwrite(dbuf); // write dst to disk brelse(lbuf); brelse(dbuf); } } 8010340b: 90 nop 8010340c: c9 leave 8010340d: c3 ret 8010340e <read_head>: // Read the log header from disk into the in-memory log header static void read_head(void) { 8010340e: 55 push %ebp 8010340f: 89 e5 mov %esp,%ebp 80103411: 83 ec 18 sub $0x18,%esp struct buf *buf = bread(log.dev, log.start); 80103414: a1 b4 32 11 80 mov 0x801132b4,%eax 80103419: 89 c2 mov %eax,%edx 8010341b: a1 c4 32 11 80 mov 0x801132c4,%eax 80103420: 83 ec 08 sub $0x8,%esp 80103423: 52 push %edx 80103424: 50 push %eax 80103425: e8 8c cd ff ff call 801001b6 <bread> 8010342a: 83 c4 10 add $0x10,%esp 8010342d: 89 45 f0 mov %eax,-0x10(%ebp) struct logheader *lh = (struct logheader *) (buf->data); 80103430: 8b 45 f0 mov -0x10(%ebp),%eax 80103433: 83 c0 18 add $0x18,%eax 80103436: 89 45 ec mov %eax,-0x14(%ebp) int i; log.lh.n = lh->n; 80103439: 8b 45 ec mov -0x14(%ebp),%eax 8010343c: 8b 00 mov (%eax),%eax 8010343e: a3 c8 32 11 80 mov %eax,0x801132c8 for (i = 0; i < log.lh.n; i++) { 80103443: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010344a: eb 1b jmp 80103467 <read_head+0x59> log.lh.block[i] = lh->block[i]; 8010344c: 8b 45 ec mov -0x14(%ebp),%eax 8010344f: 8b 55 f4 mov -0xc(%ebp),%edx 80103452: 8b 44 90 04 mov 0x4(%eax,%edx,4),%eax 80103456: 8b 55 f4 mov -0xc(%ebp),%edx 80103459: 83 c2 10 add $0x10,%edx 8010345c: 89 04 95 8c 32 11 80 mov %eax,-0x7feecd74(,%edx,4) { struct buf *buf = bread(log.dev, log.start); struct logheader *lh = (struct logheader *) (buf->data); int i; log.lh.n = lh->n; for (i = 0; i < log.lh.n; i++) { 80103463: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80103467: a1 c8 32 11 80 mov 0x801132c8,%eax 8010346c: 3b 45 f4 cmp -0xc(%ebp),%eax 8010346f: 7f db jg 8010344c <read_head+0x3e> log.lh.block[i] = lh->block[i]; } brelse(buf); 80103471: 83 ec 0c sub $0xc,%esp 80103474: ff 75 f0 pushl -0x10(%ebp) 80103477: e8 b2 cd ff ff call 8010022e <brelse> 8010347c: 83 c4 10 add $0x10,%esp } 8010347f: 90 nop 80103480: c9 leave 80103481: c3 ret 80103482 <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) { 80103482: 55 push %ebp 80103483: 89 e5 mov %esp,%ebp 80103485: 83 ec 18 sub $0x18,%esp struct buf *buf = bread(log.dev, log.start); 80103488: a1 b4 32 11 80 mov 0x801132b4,%eax 8010348d: 89 c2 mov %eax,%edx 8010348f: a1 c4 32 11 80 mov 0x801132c4,%eax 80103494: 83 ec 08 sub $0x8,%esp 80103497: 52 push %edx 80103498: 50 push %eax 80103499: e8 18 cd ff ff call 801001b6 <bread> 8010349e: 83 c4 10 add $0x10,%esp 801034a1: 89 45 f0 mov %eax,-0x10(%ebp) struct logheader *hb = (struct logheader *) (buf->data); 801034a4: 8b 45 f0 mov -0x10(%ebp),%eax 801034a7: 83 c0 18 add $0x18,%eax 801034aa: 89 45 ec mov %eax,-0x14(%ebp) int i; hb->n = log.lh.n; 801034ad: 8b 15 c8 32 11 80 mov 0x801132c8,%edx 801034b3: 8b 45 ec mov -0x14(%ebp),%eax 801034b6: 89 10 mov %edx,(%eax) for (i = 0; i < log.lh.n; i++) { 801034b8: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801034bf: eb 1b jmp 801034dc <write_head+0x5a> hb->block[i] = log.lh.block[i]; 801034c1: 8b 45 f4 mov -0xc(%ebp),%eax 801034c4: 83 c0 10 add $0x10,%eax 801034c7: 8b 0c 85 8c 32 11 80 mov -0x7feecd74(,%eax,4),%ecx 801034ce: 8b 45 ec mov -0x14(%ebp),%eax 801034d1: 8b 55 f4 mov -0xc(%ebp),%edx 801034d4: 89 4c 90 04 mov %ecx,0x4(%eax,%edx,4) { struct buf *buf = bread(log.dev, log.start); struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; for (i = 0; i < log.lh.n; i++) { 801034d8: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801034dc: a1 c8 32 11 80 mov 0x801132c8,%eax 801034e1: 3b 45 f4 cmp -0xc(%ebp),%eax 801034e4: 7f db jg 801034c1 <write_head+0x3f> hb->block[i] = log.lh.block[i]; } bwrite(buf); 801034e6: 83 ec 0c sub $0xc,%esp 801034e9: ff 75 f0 pushl -0x10(%ebp) 801034ec: e8 fe cc ff ff call 801001ef <bwrite> 801034f1: 83 c4 10 add $0x10,%esp brelse(buf); 801034f4: 83 ec 0c sub $0xc,%esp 801034f7: ff 75 f0 pushl -0x10(%ebp) 801034fa: e8 2f cd ff ff call 8010022e <brelse> 801034ff: 83 c4 10 add $0x10,%esp } 80103502: 90 nop 80103503: c9 leave 80103504: c3 ret 80103505 <recover_from_log>: static void recover_from_log(void) { 80103505: 55 push %ebp 80103506: 89 e5 mov %esp,%ebp 80103508: 83 ec 08 sub $0x8,%esp read_head(); 8010350b: e8 fe fe ff ff call 8010340e <read_head> install_trans(); // if committed, copy from log to disk 80103510: e8 41 fe ff ff call 80103356 <install_trans> log.lh.n = 0; 80103515: c7 05 c8 32 11 80 00 movl $0x0,0x801132c8 8010351c: 00 00 00 write_head(); // clear the log 8010351f: e8 5e ff ff ff call 80103482 <write_head> } 80103524: 90 nop 80103525: c9 leave 80103526: c3 ret 80103527 <begin_op>: // called at the start of each FS system call. void begin_op(void) { 80103527: 55 push %ebp 80103528: 89 e5 mov %esp,%ebp 8010352a: 83 ec 08 sub $0x8,%esp acquire(&log.lock); 8010352d: 83 ec 0c sub $0xc,%esp 80103530: 68 80 32 11 80 push $0x80113280 80103535: e8 36 20 00 00 call 80105570 <acquire> 8010353a: 83 c4 10 add $0x10,%esp while(1){ if(log.committing){ 8010353d: a1 c0 32 11 80 mov 0x801132c0,%eax 80103542: 85 c0 test %eax,%eax 80103544: 74 17 je 8010355d <begin_op+0x36> sleep(&log, &log.lock); 80103546: 83 ec 08 sub $0x8,%esp 80103549: 68 80 32 11 80 push $0x80113280 8010354e: 68 80 32 11 80 push $0x80113280 80103553: e8 08 1d 00 00 call 80105260 <sleep> 80103558: 83 c4 10 add $0x10,%esp 8010355b: eb e0 jmp 8010353d <begin_op+0x16> } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ 8010355d: 8b 0d c8 32 11 80 mov 0x801132c8,%ecx 80103563: a1 bc 32 11 80 mov 0x801132bc,%eax 80103568: 8d 50 01 lea 0x1(%eax),%edx 8010356b: 89 d0 mov %edx,%eax 8010356d: c1 e0 02 shl $0x2,%eax 80103570: 01 d0 add %edx,%eax 80103572: 01 c0 add %eax,%eax 80103574: 01 c8 add %ecx,%eax 80103576: 83 f8 1e cmp $0x1e,%eax 80103579: 7e 17 jle 80103592 <begin_op+0x6b> // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); 8010357b: 83 ec 08 sub $0x8,%esp 8010357e: 68 80 32 11 80 push $0x80113280 80103583: 68 80 32 11 80 push $0x80113280 80103588: e8 d3 1c 00 00 call 80105260 <sleep> 8010358d: 83 c4 10 add $0x10,%esp 80103590: eb ab jmp 8010353d <begin_op+0x16> } else { log.outstanding += 1; 80103592: a1 bc 32 11 80 mov 0x801132bc,%eax 80103597: 83 c0 01 add $0x1,%eax 8010359a: a3 bc 32 11 80 mov %eax,0x801132bc release(&log.lock); 8010359f: 83 ec 0c sub $0xc,%esp 801035a2: 68 80 32 11 80 push $0x80113280 801035a7: e8 2b 20 00 00 call 801055d7 <release> 801035ac: 83 c4 10 add $0x10,%esp break; 801035af: 90 nop } } } 801035b0: 90 nop 801035b1: c9 leave 801035b2: c3 ret 801035b3 <end_op>: // called at the end of each FS system call. // commits if this was the last outstanding operation. void end_op(void) { 801035b3: 55 push %ebp 801035b4: 89 e5 mov %esp,%ebp 801035b6: 83 ec 18 sub $0x18,%esp int do_commit = 0; 801035b9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) acquire(&log.lock); 801035c0: 83 ec 0c sub $0xc,%esp 801035c3: 68 80 32 11 80 push $0x80113280 801035c8: e8 a3 1f 00 00 call 80105570 <acquire> 801035cd: 83 c4 10 add $0x10,%esp log.outstanding -= 1; 801035d0: a1 bc 32 11 80 mov 0x801132bc,%eax 801035d5: 83 e8 01 sub $0x1,%eax 801035d8: a3 bc 32 11 80 mov %eax,0x801132bc if(log.committing) 801035dd: a1 c0 32 11 80 mov 0x801132c0,%eax 801035e2: 85 c0 test %eax,%eax 801035e4: 74 0d je 801035f3 <end_op+0x40> panic("log.committing"); 801035e6: 83 ec 0c sub $0xc,%esp 801035e9: 68 60 8f 10 80 push $0x80108f60 801035ee: e8 73 cf ff ff call 80100566 <panic> if(log.outstanding == 0){ 801035f3: a1 bc 32 11 80 mov 0x801132bc,%eax 801035f8: 85 c0 test %eax,%eax 801035fa: 75 13 jne 8010360f <end_op+0x5c> do_commit = 1; 801035fc: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) log.committing = 1; 80103603: c7 05 c0 32 11 80 01 movl $0x1,0x801132c0 8010360a: 00 00 00 8010360d: eb 10 jmp 8010361f <end_op+0x6c> } else { // begin_op() may be waiting for log space. wakeup(&log); 8010360f: 83 ec 0c sub $0xc,%esp 80103612: 68 80 32 11 80 push $0x80113280 80103617: e8 32 1d 00 00 call 8010534e <wakeup> 8010361c: 83 c4 10 add $0x10,%esp } release(&log.lock); 8010361f: 83 ec 0c sub $0xc,%esp 80103622: 68 80 32 11 80 push $0x80113280 80103627: e8 ab 1f 00 00 call 801055d7 <release> 8010362c: 83 c4 10 add $0x10,%esp if(do_commit){ 8010362f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80103633: 74 3f je 80103674 <end_op+0xc1> // call commit w/o holding locks, since not allowed // to sleep with locks. commit(); 80103635: e8 f5 00 00 00 call 8010372f <commit> acquire(&log.lock); 8010363a: 83 ec 0c sub $0xc,%esp 8010363d: 68 80 32 11 80 push $0x80113280 80103642: e8 29 1f 00 00 call 80105570 <acquire> 80103647: 83 c4 10 add $0x10,%esp log.committing = 0; 8010364a: c7 05 c0 32 11 80 00 movl $0x0,0x801132c0 80103651: 00 00 00 wakeup(&log); 80103654: 83 ec 0c sub $0xc,%esp 80103657: 68 80 32 11 80 push $0x80113280 8010365c: e8 ed 1c 00 00 call 8010534e <wakeup> 80103661: 83 c4 10 add $0x10,%esp release(&log.lock); 80103664: 83 ec 0c sub $0xc,%esp 80103667: 68 80 32 11 80 push $0x80113280 8010366c: e8 66 1f 00 00 call 801055d7 <release> 80103671: 83 c4 10 add $0x10,%esp } } 80103674: 90 nop 80103675: c9 leave 80103676: c3 ret 80103677 <write_log>: // Copy modified blocks from cache to log. static void write_log(void) { 80103677: 55 push %ebp 80103678: 89 e5 mov %esp,%ebp 8010367a: 83 ec 18 sub $0x18,%esp int tail; for (tail = 0; tail < log.lh.n; tail++) { 8010367d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80103684: e9 95 00 00 00 jmp 8010371e <write_log+0xa7> struct buf *to = bread(log.dev, log.start+tail+1); // log block 80103689: 8b 15 b4 32 11 80 mov 0x801132b4,%edx 8010368f: 8b 45 f4 mov -0xc(%ebp),%eax 80103692: 01 d0 add %edx,%eax 80103694: 83 c0 01 add $0x1,%eax 80103697: 89 c2 mov %eax,%edx 80103699: a1 c4 32 11 80 mov 0x801132c4,%eax 8010369e: 83 ec 08 sub $0x8,%esp 801036a1: 52 push %edx 801036a2: 50 push %eax 801036a3: e8 0e cb ff ff call 801001b6 <bread> 801036a8: 83 c4 10 add $0x10,%esp 801036ab: 89 45 f0 mov %eax,-0x10(%ebp) struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 801036ae: 8b 45 f4 mov -0xc(%ebp),%eax 801036b1: 83 c0 10 add $0x10,%eax 801036b4: 8b 04 85 8c 32 11 80 mov -0x7feecd74(,%eax,4),%eax 801036bb: 89 c2 mov %eax,%edx 801036bd: a1 c4 32 11 80 mov 0x801132c4,%eax 801036c2: 83 ec 08 sub $0x8,%esp 801036c5: 52 push %edx 801036c6: 50 push %eax 801036c7: e8 ea ca ff ff call 801001b6 <bread> 801036cc: 83 c4 10 add $0x10,%esp 801036cf: 89 45 ec mov %eax,-0x14(%ebp) memmove(to->data, from->data, BSIZE); 801036d2: 8b 45 ec mov -0x14(%ebp),%eax 801036d5: 8d 50 18 lea 0x18(%eax),%edx 801036d8: 8b 45 f0 mov -0x10(%ebp),%eax 801036db: 83 c0 18 add $0x18,%eax 801036de: 83 ec 04 sub $0x4,%esp 801036e1: 68 00 02 00 00 push $0x200 801036e6: 52 push %edx 801036e7: 50 push %eax 801036e8: e8 a5 21 00 00 call 80105892 <memmove> 801036ed: 83 c4 10 add $0x10,%esp bwrite(to); // write the log 801036f0: 83 ec 0c sub $0xc,%esp 801036f3: ff 75 f0 pushl -0x10(%ebp) 801036f6: e8 f4 ca ff ff call 801001ef <bwrite> 801036fb: 83 c4 10 add $0x10,%esp brelse(from); 801036fe: 83 ec 0c sub $0xc,%esp 80103701: ff 75 ec pushl -0x14(%ebp) 80103704: e8 25 cb ff ff call 8010022e <brelse> 80103709: 83 c4 10 add $0x10,%esp brelse(to); 8010370c: 83 ec 0c sub $0xc,%esp 8010370f: ff 75 f0 pushl -0x10(%ebp) 80103712: e8 17 cb ff ff call 8010022e <brelse> 80103717: 83 c4 10 add $0x10,%esp static void write_log(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 8010371a: 83 45 f4 01 addl $0x1,-0xc(%ebp) 8010371e: a1 c8 32 11 80 mov 0x801132c8,%eax 80103723: 3b 45 f4 cmp -0xc(%ebp),%eax 80103726: 0f 8f 5d ff ff ff jg 80103689 <write_log+0x12> memmove(to->data, from->data, BSIZE); bwrite(to); // write the log brelse(from); brelse(to); } } 8010372c: 90 nop 8010372d: c9 leave 8010372e: c3 ret 8010372f <commit>: static void commit() { 8010372f: 55 push %ebp 80103730: 89 e5 mov %esp,%ebp 80103732: 83 ec 08 sub $0x8,%esp if (log.lh.n > 0) { 80103735: a1 c8 32 11 80 mov 0x801132c8,%eax 8010373a: 85 c0 test %eax,%eax 8010373c: 7e 1e jle 8010375c <commit+0x2d> write_log(); // Write modified blocks from cache to log 8010373e: e8 34 ff ff ff call 80103677 <write_log> write_head(); // Write header to disk -- the real commit 80103743: e8 3a fd ff ff call 80103482 <write_head> install_trans(); // Now install writes to home locations 80103748: e8 09 fc ff ff call 80103356 <install_trans> log.lh.n = 0; 8010374d: c7 05 c8 32 11 80 00 movl $0x0,0x801132c8 80103754: 00 00 00 write_head(); // Erase the transaction from the log 80103757: e8 26 fd ff ff call 80103482 <write_head> } } 8010375c: 90 nop 8010375d: c9 leave 8010375e: c3 ret 8010375f <log_write>: // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 8010375f: 55 push %ebp 80103760: 89 e5 mov %esp,%ebp 80103762: 83 ec 18 sub $0x18,%esp int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80103765: a1 c8 32 11 80 mov 0x801132c8,%eax 8010376a: 83 f8 1d cmp $0x1d,%eax 8010376d: 7f 12 jg 80103781 <log_write+0x22> 8010376f: a1 c8 32 11 80 mov 0x801132c8,%eax 80103774: 8b 15 b8 32 11 80 mov 0x801132b8,%edx 8010377a: 83 ea 01 sub $0x1,%edx 8010377d: 39 d0 cmp %edx,%eax 8010377f: 7c 0d jl 8010378e <log_write+0x2f> panic("too big a transaction"); 80103781: 83 ec 0c sub $0xc,%esp 80103784: 68 6f 8f 10 80 push $0x80108f6f 80103789: e8 d8 cd ff ff call 80100566 <panic> if (log.outstanding < 1) 8010378e: a1 bc 32 11 80 mov 0x801132bc,%eax 80103793: 85 c0 test %eax,%eax 80103795: 7f 0d jg 801037a4 <log_write+0x45> panic("log_write outside of trans"); 80103797: 83 ec 0c sub $0xc,%esp 8010379a: 68 85 8f 10 80 push $0x80108f85 8010379f: e8 c2 cd ff ff call 80100566 <panic> acquire(&log.lock); 801037a4: 83 ec 0c sub $0xc,%esp 801037a7: 68 80 32 11 80 push $0x80113280 801037ac: e8 bf 1d 00 00 call 80105570 <acquire> 801037b1: 83 c4 10 add $0x10,%esp for (i = 0; i < log.lh.n; i++) { 801037b4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801037bb: eb 1d jmp 801037da <log_write+0x7b> if (log.lh.block[i] == b->blockno) // log absorbtion 801037bd: 8b 45 f4 mov -0xc(%ebp),%eax 801037c0: 83 c0 10 add $0x10,%eax 801037c3: 8b 04 85 8c 32 11 80 mov -0x7feecd74(,%eax,4),%eax 801037ca: 89 c2 mov %eax,%edx 801037cc: 8b 45 08 mov 0x8(%ebp),%eax 801037cf: 8b 40 08 mov 0x8(%eax),%eax 801037d2: 39 c2 cmp %eax,%edx 801037d4: 74 10 je 801037e6 <log_write+0x87> 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++) { 801037d6: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801037da: a1 c8 32 11 80 mov 0x801132c8,%eax 801037df: 3b 45 f4 cmp -0xc(%ebp),%eax 801037e2: 7f d9 jg 801037bd <log_write+0x5e> 801037e4: eb 01 jmp 801037e7 <log_write+0x88> if (log.lh.block[i] == b->blockno) // log absorbtion break; 801037e6: 90 nop } log.lh.block[i] = b->blockno; 801037e7: 8b 45 08 mov 0x8(%ebp),%eax 801037ea: 8b 40 08 mov 0x8(%eax),%eax 801037ed: 89 c2 mov %eax,%edx 801037ef: 8b 45 f4 mov -0xc(%ebp),%eax 801037f2: 83 c0 10 add $0x10,%eax 801037f5: 89 14 85 8c 32 11 80 mov %edx,-0x7feecd74(,%eax,4) if (i == log.lh.n) 801037fc: a1 c8 32 11 80 mov 0x801132c8,%eax 80103801: 3b 45 f4 cmp -0xc(%ebp),%eax 80103804: 75 0d jne 80103813 <log_write+0xb4> log.lh.n++; 80103806: a1 c8 32 11 80 mov 0x801132c8,%eax 8010380b: 83 c0 01 add $0x1,%eax 8010380e: a3 c8 32 11 80 mov %eax,0x801132c8 b->flags |= B_DIRTY; // prevent eviction 80103813: 8b 45 08 mov 0x8(%ebp),%eax 80103816: 8b 00 mov (%eax),%eax 80103818: 83 c8 04 or $0x4,%eax 8010381b: 89 c2 mov %eax,%edx 8010381d: 8b 45 08 mov 0x8(%ebp),%eax 80103820: 89 10 mov %edx,(%eax) release(&log.lock); 80103822: 83 ec 0c sub $0xc,%esp 80103825: 68 80 32 11 80 push $0x80113280 8010382a: e8 a8 1d 00 00 call 801055d7 <release> 8010382f: 83 c4 10 add $0x10,%esp } 80103832: 90 nop 80103833: c9 leave 80103834: c3 ret 80103835 <v2p>: 80103835: 55 push %ebp 80103836: 89 e5 mov %esp,%ebp 80103838: 8b 45 08 mov 0x8(%ebp),%eax 8010383b: 05 00 00 00 80 add $0x80000000,%eax 80103840: 5d pop %ebp 80103841: c3 ret 80103842 <p2v>: static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); } 80103842: 55 push %ebp 80103843: 89 e5 mov %esp,%ebp 80103845: 8b 45 08 mov 0x8(%ebp),%eax 80103848: 05 00 00 00 80 add $0x80000000,%eax 8010384d: 5d pop %ebp 8010384e: c3 ret 8010384f <xchg>: asm volatile("sti"); } static inline uint xchg(volatile uint *addr, uint newval) { 8010384f: 55 push %ebp 80103850: 89 e5 mov %esp,%ebp 80103852: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 80103855: 8b 55 08 mov 0x8(%ebp),%edx 80103858: 8b 45 0c mov 0xc(%ebp),%eax 8010385b: 8b 4d 08 mov 0x8(%ebp),%ecx 8010385e: f0 87 02 lock xchg %eax,(%edx) 80103861: 89 45 fc mov %eax,-0x4(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 80103864: 8b 45 fc mov -0x4(%ebp),%eax } 80103867: c9 leave 80103868: c3 ret 80103869 <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) { 80103869: 8d 4c 24 04 lea 0x4(%esp),%ecx 8010386d: 83 e4 f0 and $0xfffffff0,%esp 80103870: ff 71 fc pushl -0x4(%ecx) 80103873: 55 push %ebp 80103874: 89 e5 mov %esp,%ebp 80103876: 51 push %ecx 80103877: 83 ec 04 sub $0x4,%esp kinit1(end, P2V(4*1024*1024)); // phys page allocator 8010387a: 83 ec 08 sub $0x8,%esp 8010387d: 68 00 00 40 80 push $0x80400000 80103882: 68 60 65 11 80 push $0x80116560 80103887: e8 59 f2 ff ff call 80102ae5 <kinit1> 8010388c: 83 c4 10 add $0x10,%esp kvmalloc(); // kernel page table 8010388f: e8 45 4c 00 00 call 801084d9 <kvmalloc> mpinit(); // collect info about this machine 80103894: e8 09 04 00 00 call 80103ca2 <mpinit> lapicinit(); 80103899: e8 ea f5 ff ff call 80102e88 <lapicinit> seginit(); // set up segments 8010389e: e8 c9 45 00 00 call 80107e6c <seginit> picinit(); // interrupt controller 801038a3: e8 50 06 00 00 call 80103ef8 <picinit> ioapicinit(); // another interrupt controller 801038a8: e8 2d f1 ff ff call 801029da <ioapicinit> consoleinit(); // I/O devices & their interrupts 801038ad: e8 67 d2 ff ff call 80100b19 <consoleinit> uartinit(); // serial port 801038b2: e8 3d 39 00 00 call 801071f4 <uartinit> pinit(); // process table 801038b7: e8 39 0b 00 00 call 801043f5 <pinit> tvinit(); // trap vectors 801038bc: e8 fd 34 00 00 call 80106dbe <tvinit> binit(); // buffer cache 801038c1: e8 6e c7 ff ff call 80100034 <binit> fileinit(); // file table 801038c6: e8 aa d6 ff ff call 80100f75 <fileinit> ideinit(); // disk 801038cb: e8 12 ed ff ff call 801025e2 <ideinit> if(!ismp) 801038d0: a1 64 33 11 80 mov 0x80113364,%eax 801038d5: 85 c0 test %eax,%eax 801038d7: 75 05 jne 801038de <main+0x75> timerinit(); // uniprocessor timer 801038d9: e8 3d 34 00 00 call 80106d1b <timerinit> startothers(); // start other processors 801038de: e8 62 00 00 00 call 80103945 <startothers> kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() 801038e3: 83 ec 08 sub $0x8,%esp 801038e6: 68 00 00 00 8e push $0x8e000000 801038eb: 68 00 00 40 80 push $0x80400000 801038f0: e8 29 f2 ff ff call 80102b1e <kinit2> 801038f5: 83 c4 10 add $0x10,%esp userinit(); // first user process 801038f8: e8 46 0c 00 00 call 80104543 <userinit> // Finish setting up this processor in mpmain. mpmain(); 801038fd: e8 1a 00 00 00 call 8010391c <mpmain> 80103902 <mpenter>: } // Other CPUs jump here from entryother.S. static void mpenter(void) { 80103902: 55 push %ebp 80103903: 89 e5 mov %esp,%ebp 80103905: 83 ec 08 sub $0x8,%esp switchkvm(); 80103908: e8 e4 4b 00 00 call 801084f1 <switchkvm> seginit(); 8010390d: e8 5a 45 00 00 call 80107e6c <seginit> lapicinit(); 80103912: e8 71 f5 ff ff call 80102e88 <lapicinit> mpmain(); 80103917: e8 00 00 00 00 call 8010391c <mpmain> 8010391c <mpmain>: } // Common CPU setup code. static void mpmain(void) { 8010391c: 55 push %ebp 8010391d: 89 e5 mov %esp,%ebp 8010391f: 83 ec 08 sub $0x8,%esp idtinit(); // load idt register 80103922: e8 0d 36 00 00 call 80106f34 <idtinit> xchg(&cpu->started, 1); // tell startothers() we're up 80103927: 65 a1 00 00 00 00 mov %gs:0x0,%eax 8010392d: 05 a8 00 00 00 add $0xa8,%eax 80103932: 83 ec 08 sub $0x8,%esp 80103935: 6a 01 push $0x1 80103937: 50 push %eax 80103938: e8 12 ff ff ff call 8010384f <xchg> 8010393d: 83 c4 10 add $0x10,%esp scheduler(); // start running processes 80103940: e8 36 17 00 00 call 8010507b <scheduler> 80103945 <startothers>: pde_t entrypgdir[]; // For entry.S // Start the non-boot (AP) processors. static void startothers(void) { 80103945: 55 push %ebp 80103946: 89 e5 mov %esp,%ebp 80103948: 53 push %ebx 80103949: 83 ec 14 sub $0x14,%esp char *stack; // Write entry code to unused memory at 0x7000. // The linker has placed the image of entryother.S in // _binary_entryother_start. code = p2v(0x7000); 8010394c: 68 00 70 00 00 push $0x7000 80103951: e8 ec fe ff ff call 80103842 <p2v> 80103956: 83 c4 04 add $0x4,%esp 80103959: 89 45 f0 mov %eax,-0x10(%ebp) memmove(code, _binary_entryother_start, (uint)_binary_entryother_size); 8010395c: b8 8a 00 00 00 mov $0x8a,%eax 80103961: 83 ec 04 sub $0x4,%esp 80103964: 50 push %eax 80103965: 68 30 c5 10 80 push $0x8010c530 8010396a: ff 75 f0 pushl -0x10(%ebp) 8010396d: e8 20 1f 00 00 call 80105892 <memmove> 80103972: 83 c4 10 add $0x10,%esp for(c = cpus; c < cpus+ncpu; c++){ 80103975: c7 45 f4 80 33 11 80 movl $0x80113380,-0xc(%ebp) 8010397c: e9 90 00 00 00 jmp 80103a11 <startothers+0xcc> if(c == cpus+cpunum()) // We've started already. 80103981: e8 20 f6 ff ff call 80102fa6 <cpunum> 80103986: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 8010398c: 05 80 33 11 80 add $0x80113380,%eax 80103991: 3b 45 f4 cmp -0xc(%ebp),%eax 80103994: 74 73 je 80103a09 <startothers+0xc4> 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(); 80103996: e8 8e f2 ff ff call 80102c29 <kalloc> 8010399b: 89 45 ec mov %eax,-0x14(%ebp) *(void**)(code-4) = stack + KSTACKSIZE; 8010399e: 8b 45 f0 mov -0x10(%ebp),%eax 801039a1: 83 e8 04 sub $0x4,%eax 801039a4: 8b 55 ec mov -0x14(%ebp),%edx 801039a7: 81 c2 00 10 00 00 add $0x1000,%edx 801039ad: 89 10 mov %edx,(%eax) *(void**)(code-8) = mpenter; 801039af: 8b 45 f0 mov -0x10(%ebp),%eax 801039b2: 83 e8 08 sub $0x8,%eax 801039b5: c7 00 02 39 10 80 movl $0x80103902,(%eax) *(int**)(code-12) = (void *) v2p(entrypgdir); 801039bb: 8b 45 f0 mov -0x10(%ebp),%eax 801039be: 8d 58 f4 lea -0xc(%eax),%ebx 801039c1: 83 ec 0c sub $0xc,%esp 801039c4: 68 00 b0 10 80 push $0x8010b000 801039c9: e8 67 fe ff ff call 80103835 <v2p> 801039ce: 83 c4 10 add $0x10,%esp 801039d1: 89 03 mov %eax,(%ebx) lapicstartap(c->id, v2p(code)); 801039d3: 83 ec 0c sub $0xc,%esp 801039d6: ff 75 f0 pushl -0x10(%ebp) 801039d9: e8 57 fe ff ff call 80103835 <v2p> 801039de: 83 c4 10 add $0x10,%esp 801039e1: 89 c2 mov %eax,%edx 801039e3: 8b 45 f4 mov -0xc(%ebp),%eax 801039e6: 0f b6 00 movzbl (%eax),%eax 801039e9: 0f b6 c0 movzbl %al,%eax 801039ec: 83 ec 08 sub $0x8,%esp 801039ef: 52 push %edx 801039f0: 50 push %eax 801039f1: e8 2a f6 ff ff call 80103020 <lapicstartap> 801039f6: 83 c4 10 add $0x10,%esp // wait for cpu to finish mpmain() while(c->started == 0) 801039f9: 90 nop 801039fa: 8b 45 f4 mov -0xc(%ebp),%eax 801039fd: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax 80103a03: 85 c0 test %eax,%eax 80103a05: 74 f3 je 801039fa <startothers+0xb5> 80103a07: eb 01 jmp 80103a0a <startothers+0xc5> code = p2v(0x7000); memmove(code, _binary_entryother_start, (uint)_binary_entryother_size); for(c = cpus; c < cpus+ncpu; c++){ if(c == cpus+cpunum()) // We've started already. continue; 80103a09: 90 nop // 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++){ 80103a0a: 81 45 f4 bc 00 00 00 addl $0xbc,-0xc(%ebp) 80103a11: a1 60 39 11 80 mov 0x80113960,%eax 80103a16: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 80103a1c: 05 80 33 11 80 add $0x80113380,%eax 80103a21: 3b 45 f4 cmp -0xc(%ebp),%eax 80103a24: 0f 87 57 ff ff ff ja 80103981 <startothers+0x3c> // wait for cpu to finish mpmain() while(c->started == 0) ; } } 80103a2a: 90 nop 80103a2b: 8b 5d fc mov -0x4(%ebp),%ebx 80103a2e: c9 leave 80103a2f: c3 ret 80103a30 <p2v>: 80103a30: 55 push %ebp 80103a31: 89 e5 mov %esp,%ebp 80103a33: 8b 45 08 mov 0x8(%ebp),%eax 80103a36: 05 00 00 00 80 add $0x80000000,%eax 80103a3b: 5d pop %ebp 80103a3c: c3 ret 80103a3d <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 80103a3d: 55 push %ebp 80103a3e: 89 e5 mov %esp,%ebp 80103a40: 83 ec 14 sub $0x14,%esp 80103a43: 8b 45 08 mov 0x8(%ebp),%eax 80103a46: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80103a4a: 0f b7 45 ec movzwl -0x14(%ebp),%eax 80103a4e: 89 c2 mov %eax,%edx 80103a50: ec in (%dx),%al 80103a51: 88 45 ff mov %al,-0x1(%ebp) return data; 80103a54: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 80103a58: c9 leave 80103a59: c3 ret 80103a5a <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 80103a5a: 55 push %ebp 80103a5b: 89 e5 mov %esp,%ebp 80103a5d: 83 ec 08 sub $0x8,%esp 80103a60: 8b 55 08 mov 0x8(%ebp),%edx 80103a63: 8b 45 0c mov 0xc(%ebp),%eax 80103a66: 66 89 55 fc mov %dx,-0x4(%ebp) 80103a6a: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80103a6d: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80103a71: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80103a75: ee out %al,(%dx) } 80103a76: 90 nop 80103a77: c9 leave 80103a78: c3 ret 80103a79 <mpbcpu>: int ncpu; uchar ioapicid; int mpbcpu(void) { 80103a79: 55 push %ebp 80103a7a: 89 e5 mov %esp,%ebp return bcpu-cpus; 80103a7c: a1 68 c6 10 80 mov 0x8010c668,%eax 80103a81: 89 c2 mov %eax,%edx 80103a83: b8 80 33 11 80 mov $0x80113380,%eax 80103a88: 29 c2 sub %eax,%edx 80103a8a: 89 d0 mov %edx,%eax 80103a8c: c1 f8 02 sar $0x2,%eax 80103a8f: 69 c0 cf 46 7d 67 imul $0x677d46cf,%eax,%eax } 80103a95: 5d pop %ebp 80103a96: c3 ret 80103a97 <sum>: static uchar sum(uchar *addr, int len) { 80103a97: 55 push %ebp 80103a98: 89 e5 mov %esp,%ebp 80103a9a: 83 ec 10 sub $0x10,%esp int i, sum; sum = 0; 80103a9d: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp) for(i=0; i<len; i++) 80103aa4: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 80103aab: eb 15 jmp 80103ac2 <sum+0x2b> sum += addr[i]; 80103aad: 8b 55 fc mov -0x4(%ebp),%edx 80103ab0: 8b 45 08 mov 0x8(%ebp),%eax 80103ab3: 01 d0 add %edx,%eax 80103ab5: 0f b6 00 movzbl (%eax),%eax 80103ab8: 0f b6 c0 movzbl %al,%eax 80103abb: 01 45 f8 add %eax,-0x8(%ebp) sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 80103abe: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80103ac2: 8b 45 fc mov -0x4(%ebp),%eax 80103ac5: 3b 45 0c cmp 0xc(%ebp),%eax 80103ac8: 7c e3 jl 80103aad <sum+0x16> sum += addr[i]; return sum; 80103aca: 8b 45 f8 mov -0x8(%ebp),%eax } 80103acd: c9 leave 80103ace: c3 ret 80103acf <mpsearch1>: // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { 80103acf: 55 push %ebp 80103ad0: 89 e5 mov %esp,%ebp 80103ad2: 83 ec 18 sub $0x18,%esp uchar *e, *p, *addr; addr = p2v(a); 80103ad5: ff 75 08 pushl 0x8(%ebp) 80103ad8: e8 53 ff ff ff call 80103a30 <p2v> 80103add: 83 c4 04 add $0x4,%esp 80103ae0: 89 45 f0 mov %eax,-0x10(%ebp) e = addr+len; 80103ae3: 8b 55 0c mov 0xc(%ebp),%edx 80103ae6: 8b 45 f0 mov -0x10(%ebp),%eax 80103ae9: 01 d0 add %edx,%eax 80103aeb: 89 45 ec mov %eax,-0x14(%ebp) for(p = addr; p < e; p += sizeof(struct mp)) 80103aee: 8b 45 f0 mov -0x10(%ebp),%eax 80103af1: 89 45 f4 mov %eax,-0xc(%ebp) 80103af4: eb 36 jmp 80103b2c <mpsearch1+0x5d> if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) 80103af6: 83 ec 04 sub $0x4,%esp 80103af9: 6a 04 push $0x4 80103afb: 68 a0 8f 10 80 push $0x80108fa0 80103b00: ff 75 f4 pushl -0xc(%ebp) 80103b03: e8 32 1d 00 00 call 8010583a <memcmp> 80103b08: 83 c4 10 add $0x10,%esp 80103b0b: 85 c0 test %eax,%eax 80103b0d: 75 19 jne 80103b28 <mpsearch1+0x59> 80103b0f: 83 ec 08 sub $0x8,%esp 80103b12: 6a 10 push $0x10 80103b14: ff 75 f4 pushl -0xc(%ebp) 80103b17: e8 7b ff ff ff call 80103a97 <sum> 80103b1c: 83 c4 10 add $0x10,%esp 80103b1f: 84 c0 test %al,%al 80103b21: 75 05 jne 80103b28 <mpsearch1+0x59> return (struct mp*)p; 80103b23: 8b 45 f4 mov -0xc(%ebp),%eax 80103b26: eb 11 jmp 80103b39 <mpsearch1+0x6a> { uchar *e, *p, *addr; addr = p2v(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) 80103b28: 83 45 f4 10 addl $0x10,-0xc(%ebp) 80103b2c: 8b 45 f4 mov -0xc(%ebp),%eax 80103b2f: 3b 45 ec cmp -0x14(%ebp),%eax 80103b32: 72 c2 jb 80103af6 <mpsearch1+0x27> if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) return (struct mp*)p; return 0; 80103b34: b8 00 00 00 00 mov $0x0,%eax } 80103b39: c9 leave 80103b3a: c3 ret 80103b3b <mpsearch>: // 1) in the first KB of the EBDA; // 2) in the last KB of system base memory; // 3) in the BIOS ROM between 0xE0000 and 0xFFFFF. static struct mp* mpsearch(void) { 80103b3b: 55 push %ebp 80103b3c: 89 e5 mov %esp,%ebp 80103b3e: 83 ec 18 sub $0x18,%esp uchar *bda; uint p; struct mp *mp; bda = (uchar *) P2V(0x400); 80103b41: c7 45 f4 00 04 00 80 movl $0x80000400,-0xc(%ebp) if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){ 80103b48: 8b 45 f4 mov -0xc(%ebp),%eax 80103b4b: 83 c0 0f add $0xf,%eax 80103b4e: 0f b6 00 movzbl (%eax),%eax 80103b51: 0f b6 c0 movzbl %al,%eax 80103b54: c1 e0 08 shl $0x8,%eax 80103b57: 89 c2 mov %eax,%edx 80103b59: 8b 45 f4 mov -0xc(%ebp),%eax 80103b5c: 83 c0 0e add $0xe,%eax 80103b5f: 0f b6 00 movzbl (%eax),%eax 80103b62: 0f b6 c0 movzbl %al,%eax 80103b65: 09 d0 or %edx,%eax 80103b67: c1 e0 04 shl $0x4,%eax 80103b6a: 89 45 f0 mov %eax,-0x10(%ebp) 80103b6d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80103b71: 74 21 je 80103b94 <mpsearch+0x59> if((mp = mpsearch1(p, 1024))) 80103b73: 83 ec 08 sub $0x8,%esp 80103b76: 68 00 04 00 00 push $0x400 80103b7b: ff 75 f0 pushl -0x10(%ebp) 80103b7e: e8 4c ff ff ff call 80103acf <mpsearch1> 80103b83: 83 c4 10 add $0x10,%esp 80103b86: 89 45 ec mov %eax,-0x14(%ebp) 80103b89: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80103b8d: 74 51 je 80103be0 <mpsearch+0xa5> return mp; 80103b8f: 8b 45 ec mov -0x14(%ebp),%eax 80103b92: eb 61 jmp 80103bf5 <mpsearch+0xba> } else { p = ((bda[0x14]<<8)|bda[0x13])*1024; 80103b94: 8b 45 f4 mov -0xc(%ebp),%eax 80103b97: 83 c0 14 add $0x14,%eax 80103b9a: 0f b6 00 movzbl (%eax),%eax 80103b9d: 0f b6 c0 movzbl %al,%eax 80103ba0: c1 e0 08 shl $0x8,%eax 80103ba3: 89 c2 mov %eax,%edx 80103ba5: 8b 45 f4 mov -0xc(%ebp),%eax 80103ba8: 83 c0 13 add $0x13,%eax 80103bab: 0f b6 00 movzbl (%eax),%eax 80103bae: 0f b6 c0 movzbl %al,%eax 80103bb1: 09 d0 or %edx,%eax 80103bb3: c1 e0 0a shl $0xa,%eax 80103bb6: 89 45 f0 mov %eax,-0x10(%ebp) if((mp = mpsearch1(p-1024, 1024))) 80103bb9: 8b 45 f0 mov -0x10(%ebp),%eax 80103bbc: 2d 00 04 00 00 sub $0x400,%eax 80103bc1: 83 ec 08 sub $0x8,%esp 80103bc4: 68 00 04 00 00 push $0x400 80103bc9: 50 push %eax 80103bca: e8 00 ff ff ff call 80103acf <mpsearch1> 80103bcf: 83 c4 10 add $0x10,%esp 80103bd2: 89 45 ec mov %eax,-0x14(%ebp) 80103bd5: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80103bd9: 74 05 je 80103be0 <mpsearch+0xa5> return mp; 80103bdb: 8b 45 ec mov -0x14(%ebp),%eax 80103bde: eb 15 jmp 80103bf5 <mpsearch+0xba> } return mpsearch1(0xF0000, 0x10000); 80103be0: 83 ec 08 sub $0x8,%esp 80103be3: 68 00 00 01 00 push $0x10000 80103be8: 68 00 00 0f 00 push $0xf0000 80103bed: e8 dd fe ff ff call 80103acf <mpsearch1> 80103bf2: 83 c4 10 add $0x10,%esp } 80103bf5: c9 leave 80103bf6: c3 ret 80103bf7 <mpconfig>: // Check for correct signature, calculate the checksum and, // if correct, check the version. // To do: check extended table checksum. static struct mpconf* mpconfig(struct mp **pmp) { 80103bf7: 55 push %ebp 80103bf8: 89 e5 mov %esp,%ebp 80103bfa: 83 ec 18 sub $0x18,%esp struct mpconf *conf; struct mp *mp; if((mp = mpsearch()) == 0 || mp->physaddr == 0) 80103bfd: e8 39 ff ff ff call 80103b3b <mpsearch> 80103c02: 89 45 f4 mov %eax,-0xc(%ebp) 80103c05: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80103c09: 74 0a je 80103c15 <mpconfig+0x1e> 80103c0b: 8b 45 f4 mov -0xc(%ebp),%eax 80103c0e: 8b 40 04 mov 0x4(%eax),%eax 80103c11: 85 c0 test %eax,%eax 80103c13: 75 0a jne 80103c1f <mpconfig+0x28> return 0; 80103c15: b8 00 00 00 00 mov $0x0,%eax 80103c1a: e9 81 00 00 00 jmp 80103ca0 <mpconfig+0xa9> conf = (struct mpconf*) p2v((uint) mp->physaddr); 80103c1f: 8b 45 f4 mov -0xc(%ebp),%eax 80103c22: 8b 40 04 mov 0x4(%eax),%eax 80103c25: 83 ec 0c sub $0xc,%esp 80103c28: 50 push %eax 80103c29: e8 02 fe ff ff call 80103a30 <p2v> 80103c2e: 83 c4 10 add $0x10,%esp 80103c31: 89 45 f0 mov %eax,-0x10(%ebp) if(memcmp(conf, "PCMP", 4) != 0) 80103c34: 83 ec 04 sub $0x4,%esp 80103c37: 6a 04 push $0x4 80103c39: 68 a5 8f 10 80 push $0x80108fa5 80103c3e: ff 75 f0 pushl -0x10(%ebp) 80103c41: e8 f4 1b 00 00 call 8010583a <memcmp> 80103c46: 83 c4 10 add $0x10,%esp 80103c49: 85 c0 test %eax,%eax 80103c4b: 74 07 je 80103c54 <mpconfig+0x5d> return 0; 80103c4d: b8 00 00 00 00 mov $0x0,%eax 80103c52: eb 4c jmp 80103ca0 <mpconfig+0xa9> if(conf->version != 1 && conf->version != 4) 80103c54: 8b 45 f0 mov -0x10(%ebp),%eax 80103c57: 0f b6 40 06 movzbl 0x6(%eax),%eax 80103c5b: 3c 01 cmp $0x1,%al 80103c5d: 74 12 je 80103c71 <mpconfig+0x7a> 80103c5f: 8b 45 f0 mov -0x10(%ebp),%eax 80103c62: 0f b6 40 06 movzbl 0x6(%eax),%eax 80103c66: 3c 04 cmp $0x4,%al 80103c68: 74 07 je 80103c71 <mpconfig+0x7a> return 0; 80103c6a: b8 00 00 00 00 mov $0x0,%eax 80103c6f: eb 2f jmp 80103ca0 <mpconfig+0xa9> if(sum((uchar*)conf, conf->length) != 0) 80103c71: 8b 45 f0 mov -0x10(%ebp),%eax 80103c74: 0f b7 40 04 movzwl 0x4(%eax),%eax 80103c78: 0f b7 c0 movzwl %ax,%eax 80103c7b: 83 ec 08 sub $0x8,%esp 80103c7e: 50 push %eax 80103c7f: ff 75 f0 pushl -0x10(%ebp) 80103c82: e8 10 fe ff ff call 80103a97 <sum> 80103c87: 83 c4 10 add $0x10,%esp 80103c8a: 84 c0 test %al,%al 80103c8c: 74 07 je 80103c95 <mpconfig+0x9e> return 0; 80103c8e: b8 00 00 00 00 mov $0x0,%eax 80103c93: eb 0b jmp 80103ca0 <mpconfig+0xa9> *pmp = mp; 80103c95: 8b 45 08 mov 0x8(%ebp),%eax 80103c98: 8b 55 f4 mov -0xc(%ebp),%edx 80103c9b: 89 10 mov %edx,(%eax) return conf; 80103c9d: 8b 45 f0 mov -0x10(%ebp),%eax } 80103ca0: c9 leave 80103ca1: c3 ret 80103ca2 <mpinit>: void mpinit(void) { 80103ca2: 55 push %ebp 80103ca3: 89 e5 mov %esp,%ebp 80103ca5: 83 ec 28 sub $0x28,%esp struct mp *mp; struct mpconf *conf; struct mpproc *proc; struct mpioapic *ioapic; bcpu = &cpus[0]; 80103ca8: c7 05 68 c6 10 80 80 movl $0x80113380,0x8010c668 80103caf: 33 11 80 if((conf = mpconfig(&mp)) == 0) 80103cb2: 83 ec 0c sub $0xc,%esp 80103cb5: 8d 45 e0 lea -0x20(%ebp),%eax 80103cb8: 50 push %eax 80103cb9: e8 39 ff ff ff call 80103bf7 <mpconfig> 80103cbe: 83 c4 10 add $0x10,%esp 80103cc1: 89 45 f0 mov %eax,-0x10(%ebp) 80103cc4: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80103cc8: 0f 84 96 01 00 00 je 80103e64 <mpinit+0x1c2> return; ismp = 1; 80103cce: c7 05 64 33 11 80 01 movl $0x1,0x80113364 80103cd5: 00 00 00 lapic = (uint*)conf->lapicaddr; 80103cd8: 8b 45 f0 mov -0x10(%ebp),%eax 80103cdb: 8b 40 24 mov 0x24(%eax),%eax 80103cde: a3 7c 32 11 80 mov %eax,0x8011327c for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 80103ce3: 8b 45 f0 mov -0x10(%ebp),%eax 80103ce6: 83 c0 2c add $0x2c,%eax 80103ce9: 89 45 f4 mov %eax,-0xc(%ebp) 80103cec: 8b 45 f0 mov -0x10(%ebp),%eax 80103cef: 0f b7 40 04 movzwl 0x4(%eax),%eax 80103cf3: 0f b7 d0 movzwl %ax,%edx 80103cf6: 8b 45 f0 mov -0x10(%ebp),%eax 80103cf9: 01 d0 add %edx,%eax 80103cfb: 89 45 ec mov %eax,-0x14(%ebp) 80103cfe: e9 f2 00 00 00 jmp 80103df5 <mpinit+0x153> switch(*p){ 80103d03: 8b 45 f4 mov -0xc(%ebp),%eax 80103d06: 0f b6 00 movzbl (%eax),%eax 80103d09: 0f b6 c0 movzbl %al,%eax 80103d0c: 83 f8 04 cmp $0x4,%eax 80103d0f: 0f 87 bc 00 00 00 ja 80103dd1 <mpinit+0x12f> 80103d15: 8b 04 85 e8 8f 10 80 mov -0x7fef7018(,%eax,4),%eax 80103d1c: ff e0 jmp *%eax case MPPROC: proc = (struct mpproc*)p; 80103d1e: 8b 45 f4 mov -0xc(%ebp),%eax 80103d21: 89 45 e8 mov %eax,-0x18(%ebp) if(ncpu != proc->apicid){ 80103d24: 8b 45 e8 mov -0x18(%ebp),%eax 80103d27: 0f b6 40 01 movzbl 0x1(%eax),%eax 80103d2b: 0f b6 d0 movzbl %al,%edx 80103d2e: a1 60 39 11 80 mov 0x80113960,%eax 80103d33: 39 c2 cmp %eax,%edx 80103d35: 74 2b je 80103d62 <mpinit+0xc0> cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid); 80103d37: 8b 45 e8 mov -0x18(%ebp),%eax 80103d3a: 0f b6 40 01 movzbl 0x1(%eax),%eax 80103d3e: 0f b6 d0 movzbl %al,%edx 80103d41: a1 60 39 11 80 mov 0x80113960,%eax 80103d46: 83 ec 04 sub $0x4,%esp 80103d49: 52 push %edx 80103d4a: 50 push %eax 80103d4b: 68 aa 8f 10 80 push $0x80108faa 80103d50: e8 71 c6 ff ff call 801003c6 <cprintf> 80103d55: 83 c4 10 add $0x10,%esp ismp = 0; 80103d58: c7 05 64 33 11 80 00 movl $0x0,0x80113364 80103d5f: 00 00 00 } if(proc->flags & MPBOOT) 80103d62: 8b 45 e8 mov -0x18(%ebp),%eax 80103d65: 0f b6 40 03 movzbl 0x3(%eax),%eax 80103d69: 0f b6 c0 movzbl %al,%eax 80103d6c: 83 e0 02 and $0x2,%eax 80103d6f: 85 c0 test %eax,%eax 80103d71: 74 15 je 80103d88 <mpinit+0xe6> bcpu = &cpus[ncpu]; 80103d73: a1 60 39 11 80 mov 0x80113960,%eax 80103d78: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 80103d7e: 05 80 33 11 80 add $0x80113380,%eax 80103d83: a3 68 c6 10 80 mov %eax,0x8010c668 cpus[ncpu].id = ncpu; 80103d88: a1 60 39 11 80 mov 0x80113960,%eax 80103d8d: 8b 15 60 39 11 80 mov 0x80113960,%edx 80103d93: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 80103d99: 05 80 33 11 80 add $0x80113380,%eax 80103d9e: 88 10 mov %dl,(%eax) ncpu++; 80103da0: a1 60 39 11 80 mov 0x80113960,%eax 80103da5: 83 c0 01 add $0x1,%eax 80103da8: a3 60 39 11 80 mov %eax,0x80113960 p += sizeof(struct mpproc); 80103dad: 83 45 f4 14 addl $0x14,-0xc(%ebp) continue; 80103db1: eb 42 jmp 80103df5 <mpinit+0x153> case MPIOAPIC: ioapic = (struct mpioapic*)p; 80103db3: 8b 45 f4 mov -0xc(%ebp),%eax 80103db6: 89 45 e4 mov %eax,-0x1c(%ebp) ioapicid = ioapic->apicno; 80103db9: 8b 45 e4 mov -0x1c(%ebp),%eax 80103dbc: 0f b6 40 01 movzbl 0x1(%eax),%eax 80103dc0: a2 60 33 11 80 mov %al,0x80113360 p += sizeof(struct mpioapic); 80103dc5: 83 45 f4 08 addl $0x8,-0xc(%ebp) continue; 80103dc9: eb 2a jmp 80103df5 <mpinit+0x153> case MPBUS: case MPIOINTR: case MPLINTR: p += 8; 80103dcb: 83 45 f4 08 addl $0x8,-0xc(%ebp) continue; 80103dcf: eb 24 jmp 80103df5 <mpinit+0x153> default: cprintf("mpinit: unknown config type %x\n", *p); 80103dd1: 8b 45 f4 mov -0xc(%ebp),%eax 80103dd4: 0f b6 00 movzbl (%eax),%eax 80103dd7: 0f b6 c0 movzbl %al,%eax 80103dda: 83 ec 08 sub $0x8,%esp 80103ddd: 50 push %eax 80103dde: 68 c8 8f 10 80 push $0x80108fc8 80103de3: e8 de c5 ff ff call 801003c6 <cprintf> 80103de8: 83 c4 10 add $0x10,%esp ismp = 0; 80103deb: c7 05 64 33 11 80 00 movl $0x0,0x80113364 80103df2: 00 00 00 bcpu = &cpus[0]; if((conf = mpconfig(&mp)) == 0) return; ismp = 1; lapic = (uint*)conf->lapicaddr; for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 80103df5: 8b 45 f4 mov -0xc(%ebp),%eax 80103df8: 3b 45 ec cmp -0x14(%ebp),%eax 80103dfb: 0f 82 02 ff ff ff jb 80103d03 <mpinit+0x61> default: cprintf("mpinit: unknown config type %x\n", *p); ismp = 0; } } if(!ismp){ 80103e01: a1 64 33 11 80 mov 0x80113364,%eax 80103e06: 85 c0 test %eax,%eax 80103e08: 75 1d jne 80103e27 <mpinit+0x185> // Didn't like what we found; fall back to no MP. ncpu = 1; 80103e0a: c7 05 60 39 11 80 01 movl $0x1,0x80113960 80103e11: 00 00 00 lapic = 0; 80103e14: c7 05 7c 32 11 80 00 movl $0x0,0x8011327c 80103e1b: 00 00 00 ioapicid = 0; 80103e1e: c6 05 60 33 11 80 00 movb $0x0,0x80113360 return; 80103e25: eb 3e jmp 80103e65 <mpinit+0x1c3> } if(mp->imcrp){ 80103e27: 8b 45 e0 mov -0x20(%ebp),%eax 80103e2a: 0f b6 40 0c movzbl 0xc(%eax),%eax 80103e2e: 84 c0 test %al,%al 80103e30: 74 33 je 80103e65 <mpinit+0x1c3> // Bochs doesn't support IMCR, so this doesn't run on Bochs. // But it would on real hardware. outb(0x22, 0x70); // Select IMCR 80103e32: 83 ec 08 sub $0x8,%esp 80103e35: 6a 70 push $0x70 80103e37: 6a 22 push $0x22 80103e39: e8 1c fc ff ff call 80103a5a <outb> 80103e3e: 83 c4 10 add $0x10,%esp outb(0x23, inb(0x23) | 1); // Mask external interrupts. 80103e41: 83 ec 0c sub $0xc,%esp 80103e44: 6a 23 push $0x23 80103e46: e8 f2 fb ff ff call 80103a3d <inb> 80103e4b: 83 c4 10 add $0x10,%esp 80103e4e: 83 c8 01 or $0x1,%eax 80103e51: 0f b6 c0 movzbl %al,%eax 80103e54: 83 ec 08 sub $0x8,%esp 80103e57: 50 push %eax 80103e58: 6a 23 push $0x23 80103e5a: e8 fb fb ff ff call 80103a5a <outb> 80103e5f: 83 c4 10 add $0x10,%esp 80103e62: eb 01 jmp 80103e65 <mpinit+0x1c3> struct mpproc *proc; struct mpioapic *ioapic; bcpu = &cpus[0]; if((conf = mpconfig(&mp)) == 0) return; 80103e64: 90 nop // 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. } } 80103e65: c9 leave 80103e66: c3 ret 80103e67 <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 80103e67: 55 push %ebp 80103e68: 89 e5 mov %esp,%ebp 80103e6a: 83 ec 08 sub $0x8,%esp 80103e6d: 8b 55 08 mov 0x8(%ebp),%edx 80103e70: 8b 45 0c mov 0xc(%ebp),%eax 80103e73: 66 89 55 fc mov %dx,-0x4(%ebp) 80103e77: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80103e7a: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80103e7e: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80103e82: ee out %al,(%dx) } 80103e83: 90 nop 80103e84: c9 leave 80103e85: c3 ret 80103e86 <picsetmask>: // Initial IRQ mask has interrupt 2 enabled (for slave 8259A). static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE); static void picsetmask(ushort mask) { 80103e86: 55 push %ebp 80103e87: 89 e5 mov %esp,%ebp 80103e89: 83 ec 04 sub $0x4,%esp 80103e8c: 8b 45 08 mov 0x8(%ebp),%eax 80103e8f: 66 89 45 fc mov %ax,-0x4(%ebp) irqmask = mask; 80103e93: 0f b7 45 fc movzwl -0x4(%ebp),%eax 80103e97: 66 a3 00 c0 10 80 mov %ax,0x8010c000 outb(IO_PIC1+1, mask); 80103e9d: 0f b7 45 fc movzwl -0x4(%ebp),%eax 80103ea1: 0f b6 c0 movzbl %al,%eax 80103ea4: 50 push %eax 80103ea5: 6a 21 push $0x21 80103ea7: e8 bb ff ff ff call 80103e67 <outb> 80103eac: 83 c4 08 add $0x8,%esp outb(IO_PIC2+1, mask >> 8); 80103eaf: 0f b7 45 fc movzwl -0x4(%ebp),%eax 80103eb3: 66 c1 e8 08 shr $0x8,%ax 80103eb7: 0f b6 c0 movzbl %al,%eax 80103eba: 50 push %eax 80103ebb: 68 a1 00 00 00 push $0xa1 80103ec0: e8 a2 ff ff ff call 80103e67 <outb> 80103ec5: 83 c4 08 add $0x8,%esp } 80103ec8: 90 nop 80103ec9: c9 leave 80103eca: c3 ret 80103ecb <picenable>: void picenable(int irq) { 80103ecb: 55 push %ebp 80103ecc: 89 e5 mov %esp,%ebp picsetmask(irqmask & ~(1<<irq)); 80103ece: 8b 45 08 mov 0x8(%ebp),%eax 80103ed1: ba 01 00 00 00 mov $0x1,%edx 80103ed6: 89 c1 mov %eax,%ecx 80103ed8: d3 e2 shl %cl,%edx 80103eda: 89 d0 mov %edx,%eax 80103edc: f7 d0 not %eax 80103ede: 89 c2 mov %eax,%edx 80103ee0: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax 80103ee7: 21 d0 and %edx,%eax 80103ee9: 0f b7 c0 movzwl %ax,%eax 80103eec: 50 push %eax 80103eed: e8 94 ff ff ff call 80103e86 <picsetmask> 80103ef2: 83 c4 04 add $0x4,%esp } 80103ef5: 90 nop 80103ef6: c9 leave 80103ef7: c3 ret 80103ef8 <picinit>: // Initialize the 8259A interrupt controllers. void picinit(void) { 80103ef8: 55 push %ebp 80103ef9: 89 e5 mov %esp,%ebp // mask all interrupts outb(IO_PIC1+1, 0xFF); 80103efb: 68 ff 00 00 00 push $0xff 80103f00: 6a 21 push $0x21 80103f02: e8 60 ff ff ff call 80103e67 <outb> 80103f07: 83 c4 08 add $0x8,%esp outb(IO_PIC2+1, 0xFF); 80103f0a: 68 ff 00 00 00 push $0xff 80103f0f: 68 a1 00 00 00 push $0xa1 80103f14: e8 4e ff ff ff call 80103e67 <outb> 80103f19: 83 c4 08 add $0x8,%esp // ICW1: 0001g0hi // g: 0 = edge triggering, 1 = level triggering // h: 0 = cascaded PICs, 1 = master only // i: 0 = no ICW4, 1 = ICW4 required outb(IO_PIC1, 0x11); 80103f1c: 6a 11 push $0x11 80103f1e: 6a 20 push $0x20 80103f20: e8 42 ff ff ff call 80103e67 <outb> 80103f25: 83 c4 08 add $0x8,%esp // ICW2: Vector offset outb(IO_PIC1+1, T_IRQ0); 80103f28: 6a 20 push $0x20 80103f2a: 6a 21 push $0x21 80103f2c: e8 36 ff ff ff call 80103e67 <outb> 80103f31: 83 c4 08 add $0x8,%esp // ICW3: (master PIC) bit mask of IR lines connected to slaves // (slave PIC) 3-bit # of slave's connection to master outb(IO_PIC1+1, 1<<IRQ_SLAVE); 80103f34: 6a 04 push $0x4 80103f36: 6a 21 push $0x21 80103f38: e8 2a ff ff ff call 80103e67 <outb> 80103f3d: 83 c4 08 add $0x8,%esp // m: 0 = slave PIC, 1 = master PIC // (ignored when b is 0, as the master/slave role // can be hardwired). // a: 1 = Automatic EOI mode // p: 0 = MCS-80/85 mode, 1 = intel x86 mode outb(IO_PIC1+1, 0x3); 80103f40: 6a 03 push $0x3 80103f42: 6a 21 push $0x21 80103f44: e8 1e ff ff ff call 80103e67 <outb> 80103f49: 83 c4 08 add $0x8,%esp // Set up slave (8259A-2) outb(IO_PIC2, 0x11); // ICW1 80103f4c: 6a 11 push $0x11 80103f4e: 68 a0 00 00 00 push $0xa0 80103f53: e8 0f ff ff ff call 80103e67 <outb> 80103f58: 83 c4 08 add $0x8,%esp outb(IO_PIC2+1, T_IRQ0 + 8); // ICW2 80103f5b: 6a 28 push $0x28 80103f5d: 68 a1 00 00 00 push $0xa1 80103f62: e8 00 ff ff ff call 80103e67 <outb> 80103f67: 83 c4 08 add $0x8,%esp outb(IO_PIC2+1, IRQ_SLAVE); // ICW3 80103f6a: 6a 02 push $0x2 80103f6c: 68 a1 00 00 00 push $0xa1 80103f71: e8 f1 fe ff ff call 80103e67 <outb> 80103f76: 83 c4 08 add $0x8,%esp // NB Automatic EOI mode doesn't tend to work on the slave. // Linux source code says it's "to be investigated". outb(IO_PIC2+1, 0x3); // ICW4 80103f79: 6a 03 push $0x3 80103f7b: 68 a1 00 00 00 push $0xa1 80103f80: e8 e2 fe ff ff call 80103e67 <outb> 80103f85: 83 c4 08 add $0x8,%esp // OCW3: 0ef01prs // ef: 0x = NOP, 10 = clear specific mask, 11 = set specific mask // p: 0 = no polling, 1 = polling mode // rs: 0x = NOP, 10 = read IRR, 11 = read ISR outb(IO_PIC1, 0x68); // clear specific mask 80103f88: 6a 68 push $0x68 80103f8a: 6a 20 push $0x20 80103f8c: e8 d6 fe ff ff call 80103e67 <outb> 80103f91: 83 c4 08 add $0x8,%esp outb(IO_PIC1, 0x0a); // read IRR by default 80103f94: 6a 0a push $0xa 80103f96: 6a 20 push $0x20 80103f98: e8 ca fe ff ff call 80103e67 <outb> 80103f9d: 83 c4 08 add $0x8,%esp outb(IO_PIC2, 0x68); // OCW3 80103fa0: 6a 68 push $0x68 80103fa2: 68 a0 00 00 00 push $0xa0 80103fa7: e8 bb fe ff ff call 80103e67 <outb> 80103fac: 83 c4 08 add $0x8,%esp outb(IO_PIC2, 0x0a); // OCW3 80103faf: 6a 0a push $0xa 80103fb1: 68 a0 00 00 00 push $0xa0 80103fb6: e8 ac fe ff ff call 80103e67 <outb> 80103fbb: 83 c4 08 add $0x8,%esp if(irqmask != 0xFFFF) 80103fbe: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax 80103fc5: 66 83 f8 ff cmp $0xffff,%ax 80103fc9: 74 13 je 80103fde <picinit+0xe6> picsetmask(irqmask); 80103fcb: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax 80103fd2: 0f b7 c0 movzwl %ax,%eax 80103fd5: 50 push %eax 80103fd6: e8 ab fe ff ff call 80103e86 <picsetmask> 80103fdb: 83 c4 04 add $0x4,%esp } 80103fde: 90 nop 80103fdf: c9 leave 80103fe0: c3 ret 80103fe1 <pipealloc>: int writeopen; // write fd is still open }; int pipealloc(struct file **f0, struct file **f1) { 80103fe1: 55 push %ebp 80103fe2: 89 e5 mov %esp,%ebp 80103fe4: 83 ec 18 sub $0x18,%esp struct pipe *p; p = 0; 80103fe7: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) *f0 = *f1 = 0; 80103fee: 8b 45 0c mov 0xc(%ebp),%eax 80103ff1: c7 00 00 00 00 00 movl $0x0,(%eax) 80103ff7: 8b 45 0c mov 0xc(%ebp),%eax 80103ffa: 8b 10 mov (%eax),%edx 80103ffc: 8b 45 08 mov 0x8(%ebp),%eax 80103fff: 89 10 mov %edx,(%eax) if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) 80104001: e8 8d cf ff ff call 80100f93 <filealloc> 80104006: 89 c2 mov %eax,%edx 80104008: 8b 45 08 mov 0x8(%ebp),%eax 8010400b: 89 10 mov %edx,(%eax) 8010400d: 8b 45 08 mov 0x8(%ebp),%eax 80104010: 8b 00 mov (%eax),%eax 80104012: 85 c0 test %eax,%eax 80104014: 0f 84 cb 00 00 00 je 801040e5 <pipealloc+0x104> 8010401a: e8 74 cf ff ff call 80100f93 <filealloc> 8010401f: 89 c2 mov %eax,%edx 80104021: 8b 45 0c mov 0xc(%ebp),%eax 80104024: 89 10 mov %edx,(%eax) 80104026: 8b 45 0c mov 0xc(%ebp),%eax 80104029: 8b 00 mov (%eax),%eax 8010402b: 85 c0 test %eax,%eax 8010402d: 0f 84 b2 00 00 00 je 801040e5 <pipealloc+0x104> goto bad; if((p = (struct pipe*)kalloc()) == 0) 80104033: e8 f1 eb ff ff call 80102c29 <kalloc> 80104038: 89 45 f4 mov %eax,-0xc(%ebp) 8010403b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010403f: 0f 84 9f 00 00 00 je 801040e4 <pipealloc+0x103> goto bad; p->readopen = 1; 80104045: 8b 45 f4 mov -0xc(%ebp),%eax 80104048: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) 8010404f: 00 00 00 p->writeopen = 1; 80104052: 8b 45 f4 mov -0xc(%ebp),%eax 80104055: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) 8010405c: 00 00 00 p->nwrite = 0; 8010405f: 8b 45 f4 mov -0xc(%ebp),%eax 80104062: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) 80104069: 00 00 00 p->nread = 0; 8010406c: 8b 45 f4 mov -0xc(%ebp),%eax 8010406f: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) 80104076: 00 00 00 initlock(&p->lock, "pipe"); 80104079: 8b 45 f4 mov -0xc(%ebp),%eax 8010407c: 83 ec 08 sub $0x8,%esp 8010407f: 68 fc 8f 10 80 push $0x80108ffc 80104084: 50 push %eax 80104085: e8 c4 14 00 00 call 8010554e <initlock> 8010408a: 83 c4 10 add $0x10,%esp (*f0)->type = FD_PIPE; 8010408d: 8b 45 08 mov 0x8(%ebp),%eax 80104090: 8b 00 mov (%eax),%eax 80104092: c7 00 01 00 00 00 movl $0x1,(%eax) (*f0)->readable = 1; 80104098: 8b 45 08 mov 0x8(%ebp),%eax 8010409b: 8b 00 mov (%eax),%eax 8010409d: c6 40 08 01 movb $0x1,0x8(%eax) (*f0)->writable = 0; 801040a1: 8b 45 08 mov 0x8(%ebp),%eax 801040a4: 8b 00 mov (%eax),%eax 801040a6: c6 40 09 00 movb $0x0,0x9(%eax) (*f0)->pipe = p; 801040aa: 8b 45 08 mov 0x8(%ebp),%eax 801040ad: 8b 00 mov (%eax),%eax 801040af: 8b 55 f4 mov -0xc(%ebp),%edx 801040b2: 89 50 0c mov %edx,0xc(%eax) (*f1)->type = FD_PIPE; 801040b5: 8b 45 0c mov 0xc(%ebp),%eax 801040b8: 8b 00 mov (%eax),%eax 801040ba: c7 00 01 00 00 00 movl $0x1,(%eax) (*f1)->readable = 0; 801040c0: 8b 45 0c mov 0xc(%ebp),%eax 801040c3: 8b 00 mov (%eax),%eax 801040c5: c6 40 08 00 movb $0x0,0x8(%eax) (*f1)->writable = 1; 801040c9: 8b 45 0c mov 0xc(%ebp),%eax 801040cc: 8b 00 mov (%eax),%eax 801040ce: c6 40 09 01 movb $0x1,0x9(%eax) (*f1)->pipe = p; 801040d2: 8b 45 0c mov 0xc(%ebp),%eax 801040d5: 8b 00 mov (%eax),%eax 801040d7: 8b 55 f4 mov -0xc(%ebp),%edx 801040da: 89 50 0c mov %edx,0xc(%eax) return 0; 801040dd: b8 00 00 00 00 mov $0x0,%eax 801040e2: eb 4e jmp 80104132 <pipealloc+0x151> p = 0; *f0 = *f1 = 0; if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) goto bad; if((p = (struct pipe*)kalloc()) == 0) goto bad; 801040e4: 90 nop (*f1)->pipe = p; return 0; //PAGEBREAK: 20 bad: if(p) 801040e5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801040e9: 74 0e je 801040f9 <pipealloc+0x118> kfree((char*)p); 801040eb: 83 ec 0c sub $0xc,%esp 801040ee: ff 75 f4 pushl -0xc(%ebp) 801040f1: e8 89 ea ff ff call 80102b7f <kfree> 801040f6: 83 c4 10 add $0x10,%esp if(*f0) 801040f9: 8b 45 08 mov 0x8(%ebp),%eax 801040fc: 8b 00 mov (%eax),%eax 801040fe: 85 c0 test %eax,%eax 80104100: 74 11 je 80104113 <pipealloc+0x132> fileclose(*f0); 80104102: 8b 45 08 mov 0x8(%ebp),%eax 80104105: 8b 00 mov (%eax),%eax 80104107: 83 ec 0c sub $0xc,%esp 8010410a: 50 push %eax 8010410b: e8 41 cf ff ff call 80101051 <fileclose> 80104110: 83 c4 10 add $0x10,%esp if(*f1) 80104113: 8b 45 0c mov 0xc(%ebp),%eax 80104116: 8b 00 mov (%eax),%eax 80104118: 85 c0 test %eax,%eax 8010411a: 74 11 je 8010412d <pipealloc+0x14c> fileclose(*f1); 8010411c: 8b 45 0c mov 0xc(%ebp),%eax 8010411f: 8b 00 mov (%eax),%eax 80104121: 83 ec 0c sub $0xc,%esp 80104124: 50 push %eax 80104125: e8 27 cf ff ff call 80101051 <fileclose> 8010412a: 83 c4 10 add $0x10,%esp return -1; 8010412d: b8 ff ff ff ff mov $0xffffffff,%eax } 80104132: c9 leave 80104133: c3 ret 80104134 <pipeclose>: void pipeclose(struct pipe *p, int writable) { 80104134: 55 push %ebp 80104135: 89 e5 mov %esp,%ebp 80104137: 83 ec 08 sub $0x8,%esp acquire(&p->lock); 8010413a: 8b 45 08 mov 0x8(%ebp),%eax 8010413d: 83 ec 0c sub $0xc,%esp 80104140: 50 push %eax 80104141: e8 2a 14 00 00 call 80105570 <acquire> 80104146: 83 c4 10 add $0x10,%esp if(writable){ 80104149: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 8010414d: 74 23 je 80104172 <pipeclose+0x3e> p->writeopen = 0; 8010414f: 8b 45 08 mov 0x8(%ebp),%eax 80104152: c7 80 40 02 00 00 00 movl $0x0,0x240(%eax) 80104159: 00 00 00 wakeup(&p->nread); 8010415c: 8b 45 08 mov 0x8(%ebp),%eax 8010415f: 05 34 02 00 00 add $0x234,%eax 80104164: 83 ec 0c sub $0xc,%esp 80104167: 50 push %eax 80104168: e8 e1 11 00 00 call 8010534e <wakeup> 8010416d: 83 c4 10 add $0x10,%esp 80104170: eb 21 jmp 80104193 <pipeclose+0x5f> } else { p->readopen = 0; 80104172: 8b 45 08 mov 0x8(%ebp),%eax 80104175: c7 80 3c 02 00 00 00 movl $0x0,0x23c(%eax) 8010417c: 00 00 00 wakeup(&p->nwrite); 8010417f: 8b 45 08 mov 0x8(%ebp),%eax 80104182: 05 38 02 00 00 add $0x238,%eax 80104187: 83 ec 0c sub $0xc,%esp 8010418a: 50 push %eax 8010418b: e8 be 11 00 00 call 8010534e <wakeup> 80104190: 83 c4 10 add $0x10,%esp } if(p->readopen == 0 && p->writeopen == 0){ 80104193: 8b 45 08 mov 0x8(%ebp),%eax 80104196: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax 8010419c: 85 c0 test %eax,%eax 8010419e: 75 2c jne 801041cc <pipeclose+0x98> 801041a0: 8b 45 08 mov 0x8(%ebp),%eax 801041a3: 8b 80 40 02 00 00 mov 0x240(%eax),%eax 801041a9: 85 c0 test %eax,%eax 801041ab: 75 1f jne 801041cc <pipeclose+0x98> release(&p->lock); 801041ad: 8b 45 08 mov 0x8(%ebp),%eax 801041b0: 83 ec 0c sub $0xc,%esp 801041b3: 50 push %eax 801041b4: e8 1e 14 00 00 call 801055d7 <release> 801041b9: 83 c4 10 add $0x10,%esp kfree((char*)p); 801041bc: 83 ec 0c sub $0xc,%esp 801041bf: ff 75 08 pushl 0x8(%ebp) 801041c2: e8 b8 e9 ff ff call 80102b7f <kfree> 801041c7: 83 c4 10 add $0x10,%esp 801041ca: eb 0f jmp 801041db <pipeclose+0xa7> } else release(&p->lock); 801041cc: 8b 45 08 mov 0x8(%ebp),%eax 801041cf: 83 ec 0c sub $0xc,%esp 801041d2: 50 push %eax 801041d3: e8 ff 13 00 00 call 801055d7 <release> 801041d8: 83 c4 10 add $0x10,%esp } 801041db: 90 nop 801041dc: c9 leave 801041dd: c3 ret 801041de <pipewrite>: //PAGEBREAK: 40 int pipewrite(struct pipe *p, char *addr, int n) { 801041de: 55 push %ebp 801041df: 89 e5 mov %esp,%ebp 801041e1: 83 ec 18 sub $0x18,%esp int i; acquire(&p->lock); 801041e4: 8b 45 08 mov 0x8(%ebp),%eax 801041e7: 83 ec 0c sub $0xc,%esp 801041ea: 50 push %eax 801041eb: e8 80 13 00 00 call 80105570 <acquire> 801041f0: 83 c4 10 add $0x10,%esp for(i = 0; i < n; i++){ 801041f3: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801041fa: e9 ad 00 00 00 jmp 801042ac <pipewrite+0xce> while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full if(p->readopen == 0 || proc->killed){ 801041ff: 8b 45 08 mov 0x8(%ebp),%eax 80104202: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax 80104208: 85 c0 test %eax,%eax 8010420a: 74 0d je 80104219 <pipewrite+0x3b> 8010420c: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104212: 8b 40 24 mov 0x24(%eax),%eax 80104215: 85 c0 test %eax,%eax 80104217: 74 19 je 80104232 <pipewrite+0x54> release(&p->lock); 80104219: 8b 45 08 mov 0x8(%ebp),%eax 8010421c: 83 ec 0c sub $0xc,%esp 8010421f: 50 push %eax 80104220: e8 b2 13 00 00 call 801055d7 <release> 80104225: 83 c4 10 add $0x10,%esp return -1; 80104228: b8 ff ff ff ff mov $0xffffffff,%eax 8010422d: e9 a8 00 00 00 jmp 801042da <pipewrite+0xfc> } wakeup(&p->nread); 80104232: 8b 45 08 mov 0x8(%ebp),%eax 80104235: 05 34 02 00 00 add $0x234,%eax 8010423a: 83 ec 0c sub $0xc,%esp 8010423d: 50 push %eax 8010423e: e8 0b 11 00 00 call 8010534e <wakeup> 80104243: 83 c4 10 add $0x10,%esp sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 80104246: 8b 45 08 mov 0x8(%ebp),%eax 80104249: 8b 55 08 mov 0x8(%ebp),%edx 8010424c: 81 c2 38 02 00 00 add $0x238,%edx 80104252: 83 ec 08 sub $0x8,%esp 80104255: 50 push %eax 80104256: 52 push %edx 80104257: e8 04 10 00 00 call 80105260 <sleep> 8010425c: 83 c4 10 add $0x10,%esp { int i; acquire(&p->lock); for(i = 0; i < n; i++){ while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 8010425f: 8b 45 08 mov 0x8(%ebp),%eax 80104262: 8b 90 38 02 00 00 mov 0x238(%eax),%edx 80104268: 8b 45 08 mov 0x8(%ebp),%eax 8010426b: 8b 80 34 02 00 00 mov 0x234(%eax),%eax 80104271: 05 00 02 00 00 add $0x200,%eax 80104276: 39 c2 cmp %eax,%edx 80104278: 74 85 je 801041ff <pipewrite+0x21> return -1; } wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; 8010427a: 8b 45 08 mov 0x8(%ebp),%eax 8010427d: 8b 80 38 02 00 00 mov 0x238(%eax),%eax 80104283: 8d 48 01 lea 0x1(%eax),%ecx 80104286: 8b 55 08 mov 0x8(%ebp),%edx 80104289: 89 8a 38 02 00 00 mov %ecx,0x238(%edx) 8010428f: 25 ff 01 00 00 and $0x1ff,%eax 80104294: 89 c1 mov %eax,%ecx 80104296: 8b 55 f4 mov -0xc(%ebp),%edx 80104299: 8b 45 0c mov 0xc(%ebp),%eax 8010429c: 01 d0 add %edx,%eax 8010429e: 0f b6 10 movzbl (%eax),%edx 801042a1: 8b 45 08 mov 0x8(%ebp),%eax 801042a4: 88 54 08 34 mov %dl,0x34(%eax,%ecx,1) pipewrite(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); for(i = 0; i < n; i++){ 801042a8: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801042ac: 8b 45 f4 mov -0xc(%ebp),%eax 801042af: 3b 45 10 cmp 0x10(%ebp),%eax 801042b2: 7c ab jl 8010425f <pipewrite+0x81> wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; } wakeup(&p->nread); //DOC: pipewrite-wakeup1 801042b4: 8b 45 08 mov 0x8(%ebp),%eax 801042b7: 05 34 02 00 00 add $0x234,%eax 801042bc: 83 ec 0c sub $0xc,%esp 801042bf: 50 push %eax 801042c0: e8 89 10 00 00 call 8010534e <wakeup> 801042c5: 83 c4 10 add $0x10,%esp release(&p->lock); 801042c8: 8b 45 08 mov 0x8(%ebp),%eax 801042cb: 83 ec 0c sub $0xc,%esp 801042ce: 50 push %eax 801042cf: e8 03 13 00 00 call 801055d7 <release> 801042d4: 83 c4 10 add $0x10,%esp return n; 801042d7: 8b 45 10 mov 0x10(%ebp),%eax } 801042da: c9 leave 801042db: c3 ret 801042dc <piperead>: int piperead(struct pipe *p, char *addr, int n) { 801042dc: 55 push %ebp 801042dd: 89 e5 mov %esp,%ebp 801042df: 53 push %ebx 801042e0: 83 ec 14 sub $0x14,%esp int i; acquire(&p->lock); 801042e3: 8b 45 08 mov 0x8(%ebp),%eax 801042e6: 83 ec 0c sub $0xc,%esp 801042e9: 50 push %eax 801042ea: e8 81 12 00 00 call 80105570 <acquire> 801042ef: 83 c4 10 add $0x10,%esp while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 801042f2: eb 3f jmp 80104333 <piperead+0x57> if(proc->killed){ 801042f4: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801042fa: 8b 40 24 mov 0x24(%eax),%eax 801042fd: 85 c0 test %eax,%eax 801042ff: 74 19 je 8010431a <piperead+0x3e> release(&p->lock); 80104301: 8b 45 08 mov 0x8(%ebp),%eax 80104304: 83 ec 0c sub $0xc,%esp 80104307: 50 push %eax 80104308: e8 ca 12 00 00 call 801055d7 <release> 8010430d: 83 c4 10 add $0x10,%esp return -1; 80104310: b8 ff ff ff ff mov $0xffffffff,%eax 80104315: e9 bf 00 00 00 jmp 801043d9 <piperead+0xfd> } sleep(&p->nread, &p->lock); //DOC: piperead-sleep 8010431a: 8b 45 08 mov 0x8(%ebp),%eax 8010431d: 8b 55 08 mov 0x8(%ebp),%edx 80104320: 81 c2 34 02 00 00 add $0x234,%edx 80104326: 83 ec 08 sub $0x8,%esp 80104329: 50 push %eax 8010432a: 52 push %edx 8010432b: e8 30 0f 00 00 call 80105260 <sleep> 80104330: 83 c4 10 add $0x10,%esp piperead(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 80104333: 8b 45 08 mov 0x8(%ebp),%eax 80104336: 8b 90 34 02 00 00 mov 0x234(%eax),%edx 8010433c: 8b 45 08 mov 0x8(%ebp),%eax 8010433f: 8b 80 38 02 00 00 mov 0x238(%eax),%eax 80104345: 39 c2 cmp %eax,%edx 80104347: 75 0d jne 80104356 <piperead+0x7a> 80104349: 8b 45 08 mov 0x8(%ebp),%eax 8010434c: 8b 80 40 02 00 00 mov 0x240(%eax),%eax 80104352: 85 c0 test %eax,%eax 80104354: 75 9e jne 801042f4 <piperead+0x18> release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 80104356: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010435d: eb 49 jmp 801043a8 <piperead+0xcc> if(p->nread == p->nwrite) 8010435f: 8b 45 08 mov 0x8(%ebp),%eax 80104362: 8b 90 34 02 00 00 mov 0x234(%eax),%edx 80104368: 8b 45 08 mov 0x8(%ebp),%eax 8010436b: 8b 80 38 02 00 00 mov 0x238(%eax),%eax 80104371: 39 c2 cmp %eax,%edx 80104373: 74 3d je 801043b2 <piperead+0xd6> break; addr[i] = p->data[p->nread++ % PIPESIZE]; 80104375: 8b 55 f4 mov -0xc(%ebp),%edx 80104378: 8b 45 0c mov 0xc(%ebp),%eax 8010437b: 8d 1c 02 lea (%edx,%eax,1),%ebx 8010437e: 8b 45 08 mov 0x8(%ebp),%eax 80104381: 8b 80 34 02 00 00 mov 0x234(%eax),%eax 80104387: 8d 48 01 lea 0x1(%eax),%ecx 8010438a: 8b 55 08 mov 0x8(%ebp),%edx 8010438d: 89 8a 34 02 00 00 mov %ecx,0x234(%edx) 80104393: 25 ff 01 00 00 and $0x1ff,%eax 80104398: 89 c2 mov %eax,%edx 8010439a: 8b 45 08 mov 0x8(%ebp),%eax 8010439d: 0f b6 44 10 34 movzbl 0x34(%eax,%edx,1),%eax 801043a2: 88 03 mov %al,(%ebx) release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 801043a4: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801043a8: 8b 45 f4 mov -0xc(%ebp),%eax 801043ab: 3b 45 10 cmp 0x10(%ebp),%eax 801043ae: 7c af jl 8010435f <piperead+0x83> 801043b0: eb 01 jmp 801043b3 <piperead+0xd7> if(p->nread == p->nwrite) break; 801043b2: 90 nop addr[i] = p->data[p->nread++ % PIPESIZE]; } wakeup(&p->nwrite); //DOC: piperead-wakeup 801043b3: 8b 45 08 mov 0x8(%ebp),%eax 801043b6: 05 38 02 00 00 add $0x238,%eax 801043bb: 83 ec 0c sub $0xc,%esp 801043be: 50 push %eax 801043bf: e8 8a 0f 00 00 call 8010534e <wakeup> 801043c4: 83 c4 10 add $0x10,%esp release(&p->lock); 801043c7: 8b 45 08 mov 0x8(%ebp),%eax 801043ca: 83 ec 0c sub $0xc,%esp 801043cd: 50 push %eax 801043ce: e8 04 12 00 00 call 801055d7 <release> 801043d3: 83 c4 10 add $0x10,%esp return i; 801043d6: 8b 45 f4 mov -0xc(%ebp),%eax } 801043d9: 8b 5d fc mov -0x4(%ebp),%ebx 801043dc: c9 leave 801043dd: c3 ret 801043de <readeflags>: asm volatile("ltr %0" : : "r" (sel)); } static inline uint readeflags(void) { 801043de: 55 push %ebp 801043df: 89 e5 mov %esp,%ebp 801043e1: 83 ec 10 sub $0x10,%esp uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 801043e4: 9c pushf 801043e5: 58 pop %eax 801043e6: 89 45 fc mov %eax,-0x4(%ebp) return eflags; 801043e9: 8b 45 fc mov -0x4(%ebp),%eax } 801043ec: c9 leave 801043ed: c3 ret 801043ee <sti>: asm volatile("cli"); } static inline void sti(void) { 801043ee: 55 push %ebp 801043ef: 89 e5 mov %esp,%ebp asm volatile("sti"); 801043f1: fb sti } 801043f2: 90 nop 801043f3: 5d pop %ebp 801043f4: c3 ret 801043f5 <pinit>: //int* exit_status; void pinit(void) { 801043f5: 55 push %ebp 801043f6: 89 e5 mov %esp,%ebp 801043f8: 83 ec 08 sub $0x8,%esp initlock(&ptable.lock, "ptable"); 801043fb: 83 ec 08 sub $0x8,%esp 801043fe: 68 01 90 10 80 push $0x80109001 80104403: 68 80 39 11 80 push $0x80113980 80104408: e8 41 11 00 00 call 8010554e <initlock> 8010440d: 83 c4 10 add $0x10,%esp } 80104410: 90 nop 80104411: c9 leave 80104412: c3 ret 80104413 <allocproc>: // If found, change state to EMBRYO and initialize // state required to run in the kernel. // Otherwise return 0. struct proc* allocproc(void) { 80104413: 55 push %ebp 80104414: 89 e5 mov %esp,%ebp 80104416: 83 ec 18 sub $0x18,%esp struct proc *p; char *sp; acquire(&ptable.lock); 80104419: 83 ec 0c sub $0xc,%esp 8010441c: 68 80 39 11 80 push $0x80113980 80104421: e8 4a 11 00 00 call 80105570 <acquire> 80104426: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104429: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp) 80104430: eb 11 jmp 80104443 <allocproc+0x30> if(p->state == UNUSED) 80104432: 8b 45 f4 mov -0xc(%ebp),%eax 80104435: 8b 40 0c mov 0xc(%eax),%eax 80104438: 85 c0 test %eax,%eax 8010443a: 74 2a je 80104466 <allocproc+0x53> { struct proc *p; char *sp; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 8010443c: 81 45 f4 8c 00 00 00 addl $0x8c,-0xc(%ebp) 80104443: 81 7d f4 b4 5c 11 80 cmpl $0x80115cb4,-0xc(%ebp) 8010444a: 72 e6 jb 80104432 <allocproc+0x1f> if(p->state == UNUSED) goto found; release(&ptable.lock); 8010444c: 83 ec 0c sub $0xc,%esp 8010444f: 68 80 39 11 80 push $0x80113980 80104454: e8 7e 11 00 00 call 801055d7 <release> 80104459: 83 c4 10 add $0x10,%esp return 0; 8010445c: b8 00 00 00 00 mov $0x0,%eax 80104461: e9 db 00 00 00 jmp 80104541 <allocproc+0x12e> char *sp; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) if(p->state == UNUSED) goto found; 80104466: 90 nop release(&ptable.lock); return 0; found: p->state = EMBRYO; 80104467: 8b 45 f4 mov -0xc(%ebp),%eax 8010446a: c7 40 0c 01 00 00 00 movl $0x1,0xc(%eax) p->pid = nextpid++; 80104471: a1 04 c0 10 80 mov 0x8010c004,%eax 80104476: 8d 50 01 lea 0x1(%eax),%edx 80104479: 89 15 04 c0 10 80 mov %edx,0x8010c004 8010447f: 8b 55 f4 mov -0xc(%ebp),%edx 80104482: 89 42 10 mov %eax,0x10(%edx) p->is_thread = 0; //thread_test 80104485: 8b 45 f4 mov -0xc(%ebp),%eax 80104488: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) 8010448f: 00 00 00 p->tid = 0; 80104492: 8b 45 f4 mov -0xc(%ebp),%eax 80104495: c7 80 84 00 00 00 00 movl $0x0,0x84(%eax) 8010449c: 00 00 00 p->numOfThread = 0 ; 8010449f: 8b 45 f4 mov -0xc(%ebp),%eax 801044a2: c7 80 88 00 00 00 00 movl $0x0,0x88(%eax) 801044a9: 00 00 00 release(&ptable.lock); 801044ac: 83 ec 0c sub $0xc,%esp 801044af: 68 80 39 11 80 push $0x80113980 801044b4: e8 1e 11 00 00 call 801055d7 <release> 801044b9: 83 c4 10 add $0x10,%esp // Allocate kernel stack. if((p->kstack = kalloc()) == 0){ 801044bc: e8 68 e7 ff ff call 80102c29 <kalloc> 801044c1: 89 c2 mov %eax,%edx 801044c3: 8b 45 f4 mov -0xc(%ebp),%eax 801044c6: 89 50 08 mov %edx,0x8(%eax) 801044c9: 8b 45 f4 mov -0xc(%ebp),%eax 801044cc: 8b 40 08 mov 0x8(%eax),%eax 801044cf: 85 c0 test %eax,%eax 801044d1: 75 11 jne 801044e4 <allocproc+0xd1> p->state = UNUSED; 801044d3: 8b 45 f4 mov -0xc(%ebp),%eax 801044d6: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) return 0; 801044dd: b8 00 00 00 00 mov $0x0,%eax 801044e2: eb 5d jmp 80104541 <allocproc+0x12e> } sp = p->kstack + KSTACKSIZE; 801044e4: 8b 45 f4 mov -0xc(%ebp),%eax 801044e7: 8b 40 08 mov 0x8(%eax),%eax 801044ea: 05 00 10 00 00 add $0x1000,%eax 801044ef: 89 45 f0 mov %eax,-0x10(%ebp) // Leave room for trap frame. sp -= sizeof *p->tf; 801044f2: 83 6d f0 4c subl $0x4c,-0x10(%ebp) p->tf = (struct trapframe*)sp; 801044f6: 8b 45 f4 mov -0xc(%ebp),%eax 801044f9: 8b 55 f0 mov -0x10(%ebp),%edx 801044fc: 89 50 18 mov %edx,0x18(%eax) // Set up new context to start executing at forkret, // which returns to trapret. sp -= 4; 801044ff: 83 6d f0 04 subl $0x4,-0x10(%ebp) *(uint*)sp = (uint)trapret; 80104503: ba 78 6d 10 80 mov $0x80106d78,%edx 80104508: 8b 45 f0 mov -0x10(%ebp),%eax 8010450b: 89 10 mov %edx,(%eax) sp -= sizeof *p->context; 8010450d: 83 6d f0 14 subl $0x14,-0x10(%ebp) p->context = (struct context*)sp; 80104511: 8b 45 f4 mov -0xc(%ebp),%eax 80104514: 8b 55 f0 mov -0x10(%ebp),%edx 80104517: 89 50 1c mov %edx,0x1c(%eax) memset(p->context, 0, sizeof *p->context); 8010451a: 8b 45 f4 mov -0xc(%ebp),%eax 8010451d: 8b 40 1c mov 0x1c(%eax),%eax 80104520: 83 ec 04 sub $0x4,%esp 80104523: 6a 14 push $0x14 80104525: 6a 00 push $0x0 80104527: 50 push %eax 80104528: e8 a6 12 00 00 call 801057d3 <memset> 8010452d: 83 c4 10 add $0x10,%esp p->context->eip = (uint)forkret; 80104530: 8b 45 f4 mov -0xc(%ebp),%eax 80104533: 8b 40 1c mov 0x1c(%eax),%eax 80104536: ba 1a 52 10 80 mov $0x8010521a,%edx 8010453b: 89 50 10 mov %edx,0x10(%eax) return p; 8010453e: 8b 45 f4 mov -0xc(%ebp),%eax } 80104541: c9 leave 80104542: c3 ret 80104543 <userinit>: //PAGEBREAK: 32 // Set up first user process. void userinit(void) { 80104543: 55 push %ebp 80104544: 89 e5 mov %esp,%ebp 80104546: 83 ec 18 sub $0x18,%esp struct proc *p; extern char _binary_initcode_start[], _binary_initcode_size[]; p = allocproc(); 80104549: e8 c5 fe ff ff call 80104413 <allocproc> 8010454e: 89 45 f4 mov %eax,-0xc(%ebp) initproc = p; 80104551: 8b 45 f4 mov -0xc(%ebp),%eax 80104554: a3 6c c6 10 80 mov %eax,0x8010c66c if((p->pgdir = setupkvm()) == 0) 80104559: e8 c9 3e 00 00 call 80108427 <setupkvm> 8010455e: 89 c2 mov %eax,%edx 80104560: 8b 45 f4 mov -0xc(%ebp),%eax 80104563: 89 50 04 mov %edx,0x4(%eax) 80104566: 8b 45 f4 mov -0xc(%ebp),%eax 80104569: 8b 40 04 mov 0x4(%eax),%eax 8010456c: 85 c0 test %eax,%eax 8010456e: 75 0d jne 8010457d <userinit+0x3a> panic("userinit: out of memory?"); 80104570: 83 ec 0c sub $0xc,%esp 80104573: 68 08 90 10 80 push $0x80109008 80104578: e8 e9 bf ff ff call 80100566 <panic> inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); 8010457d: ba 2c 00 00 00 mov $0x2c,%edx 80104582: 8b 45 f4 mov -0xc(%ebp),%eax 80104585: 8b 40 04 mov 0x4(%eax),%eax 80104588: 83 ec 04 sub $0x4,%esp 8010458b: 52 push %edx 8010458c: 68 04 c5 10 80 push $0x8010c504 80104591: 50 push %eax 80104592: e8 ea 40 00 00 call 80108681 <inituvm> 80104597: 83 c4 10 add $0x10,%esp p->sz = PGSIZE; 8010459a: 8b 45 f4 mov -0xc(%ebp),%eax 8010459d: c7 00 00 10 00 00 movl $0x1000,(%eax) memset(p->tf, 0, sizeof(*p->tf)); 801045a3: 8b 45 f4 mov -0xc(%ebp),%eax 801045a6: 8b 40 18 mov 0x18(%eax),%eax 801045a9: 83 ec 04 sub $0x4,%esp 801045ac: 6a 4c push $0x4c 801045ae: 6a 00 push $0x0 801045b0: 50 push %eax 801045b1: e8 1d 12 00 00 call 801057d3 <memset> 801045b6: 83 c4 10 add $0x10,%esp p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 801045b9: 8b 45 f4 mov -0xc(%ebp),%eax 801045bc: 8b 40 18 mov 0x18(%eax),%eax 801045bf: 66 c7 40 3c 23 00 movw $0x23,0x3c(%eax) p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 801045c5: 8b 45 f4 mov -0xc(%ebp),%eax 801045c8: 8b 40 18 mov 0x18(%eax),%eax 801045cb: 66 c7 40 2c 2b 00 movw $0x2b,0x2c(%eax) p->tf->es = p->tf->ds; 801045d1: 8b 45 f4 mov -0xc(%ebp),%eax 801045d4: 8b 40 18 mov 0x18(%eax),%eax 801045d7: 8b 55 f4 mov -0xc(%ebp),%edx 801045da: 8b 52 18 mov 0x18(%edx),%edx 801045dd: 0f b7 52 2c movzwl 0x2c(%edx),%edx 801045e1: 66 89 50 28 mov %dx,0x28(%eax) p->tf->ss = p->tf->ds; 801045e5: 8b 45 f4 mov -0xc(%ebp),%eax 801045e8: 8b 40 18 mov 0x18(%eax),%eax 801045eb: 8b 55 f4 mov -0xc(%ebp),%edx 801045ee: 8b 52 18 mov 0x18(%edx),%edx 801045f1: 0f b7 52 2c movzwl 0x2c(%edx),%edx 801045f5: 66 89 50 48 mov %dx,0x48(%eax) p->tf->eflags = FL_IF; 801045f9: 8b 45 f4 mov -0xc(%ebp),%eax 801045fc: 8b 40 18 mov 0x18(%eax),%eax 801045ff: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) p->tf->esp = PGSIZE; 80104606: 8b 45 f4 mov -0xc(%ebp),%eax 80104609: 8b 40 18 mov 0x18(%eax),%eax 8010460c: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) p->tf->eip = 0; // beginning of initcode.S 80104613: 8b 45 f4 mov -0xc(%ebp),%eax 80104616: 8b 40 18 mov 0x18(%eax),%eax 80104619: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) safestrcpy(p->name, "initcode", sizeof(p->name)); 80104620: 8b 45 f4 mov -0xc(%ebp),%eax 80104623: 83 c0 6c add $0x6c,%eax 80104626: 83 ec 04 sub $0x4,%esp 80104629: 6a 10 push $0x10 8010462b: 68 21 90 10 80 push $0x80109021 80104630: 50 push %eax 80104631: e8 a0 13 00 00 call 801059d6 <safestrcpy> 80104636: 83 c4 10 add $0x10,%esp p->cwd = namei("/"); 80104639: 83 ec 0c sub $0xc,%esp 8010463c: 68 2a 90 10 80 push $0x8010902a 80104641: e8 98 de ff ff call 801024de <namei> 80104646: 83 c4 10 add $0x10,%esp 80104649: 89 c2 mov %eax,%edx 8010464b: 8b 45 f4 mov -0xc(%ebp),%eax 8010464e: 89 50 68 mov %edx,0x68(%eax) p->state = RUNNABLE; 80104651: 8b 45 f4 mov -0xc(%ebp),%eax 80104654: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) } 8010465b: 90 nop 8010465c: c9 leave 8010465d: c3 ret 8010465e <growproc>: // Grow current process's memory by n bytes. // Return 0 on success, -1 on failure. int growproc(int n) { 8010465e: 55 push %ebp 8010465f: 89 e5 mov %esp,%ebp 80104661: 83 ec 18 sub $0x18,%esp uint sz; sz = proc->sz; 80104664: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010466a: 8b 00 mov (%eax),%eax 8010466c: 89 45 f4 mov %eax,-0xc(%ebp) if(n > 0){ 8010466f: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80104673: 7e 31 jle 801046a6 <growproc+0x48> if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0) 80104675: 8b 55 08 mov 0x8(%ebp),%edx 80104678: 8b 45 f4 mov -0xc(%ebp),%eax 8010467b: 01 c2 add %eax,%edx 8010467d: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104683: 8b 40 04 mov 0x4(%eax),%eax 80104686: 83 ec 04 sub $0x4,%esp 80104689: 52 push %edx 8010468a: ff 75 f4 pushl -0xc(%ebp) 8010468d: 50 push %eax 8010468e: e8 3b 41 00 00 call 801087ce <allocuvm> 80104693: 83 c4 10 add $0x10,%esp 80104696: 89 45 f4 mov %eax,-0xc(%ebp) 80104699: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010469d: 75 3e jne 801046dd <growproc+0x7f> return -1; 8010469f: b8 ff ff ff ff mov $0xffffffff,%eax 801046a4: eb 59 jmp 801046ff <growproc+0xa1> } else if(n < 0){ 801046a6: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 801046aa: 79 31 jns 801046dd <growproc+0x7f> if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0) 801046ac: 8b 55 08 mov 0x8(%ebp),%edx 801046af: 8b 45 f4 mov -0xc(%ebp),%eax 801046b2: 01 c2 add %eax,%edx 801046b4: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801046ba: 8b 40 04 mov 0x4(%eax),%eax 801046bd: 83 ec 04 sub $0x4,%esp 801046c0: 52 push %edx 801046c1: ff 75 f4 pushl -0xc(%ebp) 801046c4: 50 push %eax 801046c5: e8 cd 41 00 00 call 80108897 <deallocuvm> 801046ca: 83 c4 10 add $0x10,%esp 801046cd: 89 45 f4 mov %eax,-0xc(%ebp) 801046d0: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801046d4: 75 07 jne 801046dd <growproc+0x7f> return -1; 801046d6: b8 ff ff ff ff mov $0xffffffff,%eax 801046db: eb 22 jmp 801046ff <growproc+0xa1> } proc->sz = sz; 801046dd: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801046e3: 8b 55 f4 mov -0xc(%ebp),%edx 801046e6: 89 10 mov %edx,(%eax) switchuvm(proc); 801046e8: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801046ee: 83 ec 0c sub $0xc,%esp 801046f1: 50 push %eax 801046f2: e8 17 3e 00 00 call 8010850e <switchuvm> 801046f7: 83 c4 10 add $0x10,%esp return 0; 801046fa: b8 00 00 00 00 mov $0x0,%eax } 801046ff: c9 leave 80104700: c3 ret 80104701 <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) { 80104701: 55 push %ebp 80104702: 89 e5 mov %esp,%ebp 80104704: 57 push %edi 80104705: 56 push %esi 80104706: 53 push %ebx 80104707: 83 ec 1c sub $0x1c,%esp int i, pid; struct proc *np; // Allocate process. if((np = allocproc()) == 0) 8010470a: e8 04 fd ff ff call 80104413 <allocproc> 8010470f: 89 45 e0 mov %eax,-0x20(%ebp) 80104712: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80104716: 75 0a jne 80104722 <fork+0x21> return -1; 80104718: b8 ff ff ff ff mov $0xffffffff,%eax 8010471d: e9 7d 01 00 00 jmp 8010489f <fork+0x19e> // Copy process state from p. if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){ 80104722: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104728: 8b 10 mov (%eax),%edx 8010472a: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104730: 8b 40 04 mov 0x4(%eax),%eax 80104733: 83 ec 08 sub $0x8,%esp 80104736: 52 push %edx 80104737: 50 push %eax 80104738: e8 f8 42 00 00 call 80108a35 <copyuvm> 8010473d: 83 c4 10 add $0x10,%esp 80104740: 89 c2 mov %eax,%edx 80104742: 8b 45 e0 mov -0x20(%ebp),%eax 80104745: 89 50 04 mov %edx,0x4(%eax) 80104748: 8b 45 e0 mov -0x20(%ebp),%eax 8010474b: 8b 40 04 mov 0x4(%eax),%eax 8010474e: 85 c0 test %eax,%eax 80104750: 75 30 jne 80104782 <fork+0x81> kfree(np->kstack); 80104752: 8b 45 e0 mov -0x20(%ebp),%eax 80104755: 8b 40 08 mov 0x8(%eax),%eax 80104758: 83 ec 0c sub $0xc,%esp 8010475b: 50 push %eax 8010475c: e8 1e e4 ff ff call 80102b7f <kfree> 80104761: 83 c4 10 add $0x10,%esp np->kstack = 0; 80104764: 8b 45 e0 mov -0x20(%ebp),%eax 80104767: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) np->state = UNUSED; 8010476e: 8b 45 e0 mov -0x20(%ebp),%eax 80104771: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) return -1; 80104778: b8 ff ff ff ff mov $0xffffffff,%eax 8010477d: e9 1d 01 00 00 jmp 8010489f <fork+0x19e> } np->sz = proc->sz; 80104782: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104788: 8b 10 mov (%eax),%edx 8010478a: 8b 45 e0 mov -0x20(%ebp),%eax 8010478d: 89 10 mov %edx,(%eax) np->parent = proc; 8010478f: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 80104796: 8b 45 e0 mov -0x20(%ebp),%eax 80104799: 89 50 14 mov %edx,0x14(%eax) *np->tf = *proc->tf; 8010479c: 8b 45 e0 mov -0x20(%ebp),%eax 8010479f: 8b 50 18 mov 0x18(%eax),%edx 801047a2: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801047a8: 8b 40 18 mov 0x18(%eax),%eax 801047ab: 89 c3 mov %eax,%ebx 801047ad: b8 13 00 00 00 mov $0x13,%eax 801047b2: 89 d7 mov %edx,%edi 801047b4: 89 de mov %ebx,%esi 801047b6: 89 c1 mov %eax,%ecx 801047b8: f3 a5 rep movsl %ds:(%esi),%es:(%edi) np->is_thread = proc->is_thread; //thread test 801047ba: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801047c0: 8b 90 80 00 00 00 mov 0x80(%eax),%edx 801047c6: 8b 45 e0 mov -0x20(%ebp),%eax 801047c9: 89 90 80 00 00 00 mov %edx,0x80(%eax) // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; 801047cf: 8b 45 e0 mov -0x20(%ebp),%eax 801047d2: 8b 40 18 mov 0x18(%eax),%eax 801047d5: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) for(i = 0; i < NOFILE; i++) 801047dc: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 801047e3: eb 43 jmp 80104828 <fork+0x127> if(proc->ofile[i]) 801047e5: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801047eb: 8b 55 e4 mov -0x1c(%ebp),%edx 801047ee: 83 c2 08 add $0x8,%edx 801047f1: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 801047f5: 85 c0 test %eax,%eax 801047f7: 74 2b je 80104824 <fork+0x123> np->ofile[i] = filedup(proc->ofile[i]); 801047f9: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801047ff: 8b 55 e4 mov -0x1c(%ebp),%edx 80104802: 83 c2 08 add $0x8,%edx 80104805: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80104809: 83 ec 0c sub $0xc,%esp 8010480c: 50 push %eax 8010480d: e8 ee c7 ff ff call 80101000 <filedup> 80104812: 83 c4 10 add $0x10,%esp 80104815: 89 c1 mov %eax,%ecx 80104817: 8b 45 e0 mov -0x20(%ebp),%eax 8010481a: 8b 55 e4 mov -0x1c(%ebp),%edx 8010481d: 83 c2 08 add $0x8,%edx 80104820: 89 4c 90 08 mov %ecx,0x8(%eax,%edx,4) *np->tf = *proc->tf; np->is_thread = proc->is_thread; //thread test // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; for(i = 0; i < NOFILE; i++) 80104824: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 80104828: 83 7d e4 0f cmpl $0xf,-0x1c(%ebp) 8010482c: 7e b7 jle 801047e5 <fork+0xe4> if(proc->ofile[i]) np->ofile[i] = filedup(proc->ofile[i]); np->cwd = idup(proc->cwd); 8010482e: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104834: 8b 40 68 mov 0x68(%eax),%eax 80104837: 83 ec 0c sub $0xc,%esp 8010483a: 50 push %eax 8010483b: e8 a6 d0 ff ff call 801018e6 <idup> 80104840: 83 c4 10 add $0x10,%esp 80104843: 89 c2 mov %eax,%edx 80104845: 8b 45 e0 mov -0x20(%ebp),%eax 80104848: 89 50 68 mov %edx,0x68(%eax) safestrcpy(np->name, proc->name, sizeof(proc->name)); 8010484b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104851: 8d 50 6c lea 0x6c(%eax),%edx 80104854: 8b 45 e0 mov -0x20(%ebp),%eax 80104857: 83 c0 6c add $0x6c,%eax 8010485a: 83 ec 04 sub $0x4,%esp 8010485d: 6a 10 push $0x10 8010485f: 52 push %edx 80104860: 50 push %eax 80104861: e8 70 11 00 00 call 801059d6 <safestrcpy> 80104866: 83 c4 10 add $0x10,%esp pid = np->pid; 80104869: 8b 45 e0 mov -0x20(%ebp),%eax 8010486c: 8b 40 10 mov 0x10(%eax),%eax 8010486f: 89 45 dc mov %eax,-0x24(%ebp) // lock to force the compiler to emit the np->state write last. acquire(&ptable.lock); 80104872: 83 ec 0c sub $0xc,%esp 80104875: 68 80 39 11 80 push $0x80113980 8010487a: e8 f1 0c 00 00 call 80105570 <acquire> 8010487f: 83 c4 10 add $0x10,%esp np->state = RUNNABLE; 80104882: 8b 45 e0 mov -0x20(%ebp),%eax 80104885: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) release(&ptable.lock); 8010488c: 83 ec 0c sub $0xc,%esp 8010488f: 68 80 39 11 80 push $0x80113980 80104894: e8 3e 0d 00 00 call 801055d7 <release> 80104899: 83 c4 10 add $0x10,%esp return pid; 8010489c: 8b 45 dc mov -0x24(%ebp),%eax } 8010489f: 8d 65 f4 lea -0xc(%ebp),%esp 801048a2: 5b pop %ebx 801048a3: 5e pop %esi 801048a4: 5f pop %edi 801048a5: 5d pop %ebp 801048a6: c3 ret 801048a7 <clone>: int clone(void *(*function)(void*),void *arg,void* stack){ 801048a7: 55 push %ebp 801048a8: 89 e5 mov %esp,%ebp 801048aa: 57 push %edi 801048ab: 56 push %esi 801048ac: 53 push %ebx 801048ad: 83 ec 1c sub $0x1c,%esp int i;//, pid; struct proc *np; if(proc->numOfThread == 7) 801048b0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801048b6: 8b 80 88 00 00 00 mov 0x88(%eax),%eax 801048bc: 83 f8 07 cmp $0x7,%eax 801048bf: 75 0a jne 801048cb <clone+0x24> return -1; 801048c1: b8 ff ff ff ff mov $0xffffffff,%eax 801048c6: e9 21 02 00 00 jmp 80104aec <clone+0x245> if((np = allocproc()) == 0) 801048cb: e8 43 fb ff ff call 80104413 <allocproc> 801048d0: 89 45 d8 mov %eax,-0x28(%ebp) 801048d3: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 801048d7: 75 0a jne 801048e3 <clone+0x3c> return -1; 801048d9: b8 ff ff ff ff mov $0xffffffff,%eax 801048de: e9 09 02 00 00 jmp 80104aec <clone+0x245> int tid = proc->tid; 801048e3: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801048e9: 8b 80 84 00 00 00 mov 0x84(%eax),%eax 801048ef: 89 45 e0 mov %eax,-0x20(%ebp) //page는 똑같음 np->pgdir = proc->pgdir; 801048f2: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801048f8: 8b 50 04 mov 0x4(%eax),%edx 801048fb: 8b 45 d8 mov -0x28(%ebp),%eax 801048fe: 89 50 04 mov %edx,0x4(%eax) //stack 할당을 어떻게 해줘야할까> np->sz = proc->sz; 80104901: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104907: 8b 10 mov (%eax),%edx 80104909: 8b 45 d8 mov -0x28(%ebp),%eax 8010490c: 89 10 mov %edx,(%eax) np->parent = proc; 8010490e: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 80104915: 8b 45 d8 mov -0x28(%ebp),%eax 80104918: 89 50 14 mov %edx,0x14(%eax) np->is_thread = 1; 8010491b: 8b 45 d8 mov -0x28(%ebp),%eax 8010491e: c7 80 80 00 00 00 01 movl $0x1,0x80(%eax) 80104925: 00 00 00 //trap frame 도 위치가 같다. *np->tf = *proc->tf; 80104928: 8b 45 d8 mov -0x28(%ebp),%eax 8010492b: 8b 50 18 mov 0x18(%eax),%edx 8010492e: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104934: 8b 40 18 mov 0x18(%eax),%eax 80104937: 89 c3 mov %eax,%ebx 80104939: b8 13 00 00 00 mov $0x13,%eax 8010493e: 89 d7 mov %edx,%edi 80104940: 89 de mov %ebx,%esi 80104942: 89 c1 mov %eax,%ecx 80104944: f3 a5 rep movsl %ds:(%esi),%es:(%edi) // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; 80104946: 8b 45 d8 mov -0x28(%ebp),%eax 80104949: 8b 40 18 mov 0x18(%eax),%eax 8010494c: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) for(i = 0; i < NOFILE; i++) 80104953: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 8010495a: eb 43 jmp 8010499f <clone+0xf8> if(proc->ofile[i]) 8010495c: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104962: 8b 55 e4 mov -0x1c(%ebp),%edx 80104965: 83 c2 08 add $0x8,%edx 80104968: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 8010496c: 85 c0 test %eax,%eax 8010496e: 74 2b je 8010499b <clone+0xf4> np->ofile[i] = filedup(proc->ofile[i]); 80104970: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104976: 8b 55 e4 mov -0x1c(%ebp),%edx 80104979: 83 c2 08 add $0x8,%edx 8010497c: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80104980: 83 ec 0c sub $0xc,%esp 80104983: 50 push %eax 80104984: e8 77 c6 ff ff call 80101000 <filedup> 80104989: 83 c4 10 add $0x10,%esp 8010498c: 89 c1 mov %eax,%ecx 8010498e: 8b 45 d8 mov -0x28(%ebp),%eax 80104991: 8b 55 e4 mov -0x1c(%ebp),%edx 80104994: 83 c2 08 add $0x8,%edx 80104997: 89 4c 90 08 mov %ecx,0x8(%eax,%edx,4) *np->tf = *proc->tf; // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; for(i = 0; i < NOFILE; i++) 8010499b: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 8010499f: 83 7d e4 0f cmpl $0xf,-0x1c(%ebp) 801049a3: 7e b7 jle 8010495c <clone+0xb5> if(proc->ofile[i]) np->ofile[i] = filedup(proc->ofile[i]); np->cwd = idup(proc->cwd); 801049a5: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801049ab: 8b 40 68 mov 0x68(%eax),%eax 801049ae: 83 ec 0c sub $0xc,%esp 801049b1: 50 push %eax 801049b2: e8 2f cf ff ff call 801018e6 <idup> 801049b7: 83 c4 10 add $0x10,%esp 801049ba: 89 c2 mov %eax,%edx 801049bc: 8b 45 d8 mov -0x28(%ebp),%eax 801049bf: 89 50 68 mov %edx,0x68(%eax) // lock to force the compiler to emit the np->state write last. safestrcpy(np->name, proc->name, sizeof(proc->name)); 801049c2: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801049c8: 8d 50 6c lea 0x6c(%eax),%edx 801049cb: 8b 45 d8 mov -0x28(%ebp),%eax 801049ce: 83 c0 6c add $0x6c,%eax 801049d1: 83 ec 04 sub $0x4,%esp 801049d4: 6a 10 push $0x10 801049d6: 52 push %edx 801049d7: 50 push %eax 801049d8: e8 f9 0f 00 00 call 801059d6 <safestrcpy> 801049dd: 83 c4 10 add $0x10,%esp //int pid = np->pid; np->pid = proc->pid; 801049e0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801049e6: 8b 50 10 mov 0x10(%eax),%edx 801049e9: 8b 45 d8 mov -0x28(%ebp),%eax 801049ec: 89 50 10 mov %edx,0x10(%eax) nextpid--; 801049ef: a1 04 c0 10 80 mov 0x8010c004,%eax 801049f4: 83 e8 01 sub $0x1,%eax 801049f7: a3 04 c0 10 80 mov %eax,0x8010c004 //tid 찾기 struct proc *p; for(p = ptable.proc ; p < &ptable.proc[NPROC] ; p++){ 801049fc: c7 45 dc b4 39 11 80 movl $0x801139b4,-0x24(%ebp) 80104a03: eb 4a jmp 80104a4f <clone+0x1a8> if(p->pid == proc->pid && p->is_thread == 0){ 80104a05: 8b 45 dc mov -0x24(%ebp),%eax 80104a08: 8b 50 10 mov 0x10(%eax),%edx 80104a0b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104a11: 8b 40 10 mov 0x10(%eax),%eax 80104a14: 39 c2 cmp %eax,%edx 80104a16: 75 30 jne 80104a48 <clone+0x1a1> 80104a18: 8b 45 dc mov -0x24(%ebp),%eax 80104a1b: 8b 80 80 00 00 00 mov 0x80(%eax),%eax 80104a21: 85 c0 test %eax,%eax 80104a23: 75 23 jne 80104a48 <clone+0x1a1> tid = ++(p->numOfThread); 80104a25: 8b 45 dc mov -0x24(%ebp),%eax 80104a28: 8b 80 88 00 00 00 mov 0x88(%eax),%eax 80104a2e: 8d 50 01 lea 0x1(%eax),%edx 80104a31: 8b 45 dc mov -0x24(%ebp),%eax 80104a34: 89 90 88 00 00 00 mov %edx,0x88(%eax) 80104a3a: 8b 45 dc mov -0x24(%ebp),%eax 80104a3d: 8b 80 88 00 00 00 mov 0x88(%eax),%eax 80104a43: 89 45 e0 mov %eax,-0x20(%ebp) break; 80104a46: eb 10 jmp 80104a58 <clone+0x1b1> np->pid = proc->pid; nextpid--; //tid 찾기 struct proc *p; for(p = ptable.proc ; p < &ptable.proc[NPROC] ; p++){ 80104a48: 81 45 dc 8c 00 00 00 addl $0x8c,-0x24(%ebp) 80104a4f: 81 7d dc b4 5c 11 80 cmpl $0x80115cb4,-0x24(%ebp) 80104a56: 72 ad jb 80104a05 <clone+0x15e> tid = ++(p->numOfThread); break; } } np->tid = tid; 80104a58: 8b 45 d8 mov -0x28(%ebp),%eax 80104a5b: 8b 55 e0 mov -0x20(%ebp),%edx 80104a5e: 89 90 84 00 00 00 mov %edx,0x84(%eax) stack = stack - sizeof(void*); 80104a64: 83 6d 10 04 subl $0x4,0x10(%ebp) *(uint*)stack = (uint)arg; 80104a68: 8b 55 0c mov 0xc(%ebp),%edx 80104a6b: 8b 45 10 mov 0x10(%ebp),%eax 80104a6e: 89 10 mov %edx,(%eax) stack = stack - sizeof(void*); 80104a70: 83 6d 10 04 subl $0x4,0x10(%ebp) *(uint*)stack = 0xFFFFFFFF; 80104a74: 8b 45 10 mov 0x10(%ebp),%eax 80104a77: c7 00 ff ff ff ff movl $0xffffffff,(%eax) np->tf->eip = (uint)function; 80104a7d: 8b 45 d8 mov -0x28(%ebp),%eax 80104a80: 8b 40 18 mov 0x18(%eax),%eax 80104a83: 8b 55 08 mov 0x8(%ebp),%edx 80104a86: 89 50 38 mov %edx,0x38(%eax) np->tf->esp = (uint)stack; 80104a89: 8b 45 d8 mov -0x28(%ebp),%eax 80104a8c: 8b 40 18 mov 0x18(%eax),%eax 80104a8f: 8b 55 10 mov 0x10(%ebp),%edx 80104a92: 89 50 44 mov %edx,0x44(%eax) np->tf->ebp = np->tf ->esp; 80104a95: 8b 45 d8 mov -0x28(%ebp),%eax 80104a98: 8b 40 18 mov 0x18(%eax),%eax 80104a9b: 8b 55 d8 mov -0x28(%ebp),%edx 80104a9e: 8b 52 18 mov 0x18(%edx),%edx 80104aa1: 8b 52 44 mov 0x44(%edx),%edx 80104aa4: 89 50 08 mov %edx,0x8(%eax) acquire(&ptable.lock); 80104aa7: 83 ec 0c sub $0xc,%esp 80104aaa: 68 80 39 11 80 push $0x80113980 80104aaf: e8 bc 0a 00 00 call 80105570 <acquire> 80104ab4: 83 c4 10 add $0x10,%esp np->state = RUNNABLE; 80104ab7: 8b 45 d8 mov -0x28(%ebp),%eax 80104aba: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) //for test7 proc->state = RUNNABLE; 80104ac1: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104ac7: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) sched(); 80104ace: e8 50 06 00 00 call 80105123 <sched> release(&ptable.lock); 80104ad3: 83 ec 0c sub $0xc,%esp 80104ad6: 68 80 39 11 80 push $0x80113980 80104adb: e8 f7 0a 00 00 call 801055d7 <release> 80104ae0: 83 c4 10 add $0x10,%esp return np->tid; 80104ae3: 8b 45 d8 mov -0x28(%ebp),%eax 80104ae6: 8b 80 84 00 00 00 mov 0x84(%eax),%eax } 80104aec: 8d 65 f4 lea -0xc(%ebp),%esp 80104aef: 5b pop %ebx 80104af0: 5e pop %esi 80104af1: 5f pop %edi 80104af2: 5d pop %ebp 80104af3: c3 ret 80104af4 <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) { 80104af4: 55 push %ebp 80104af5: 89 e5 mov %esp,%ebp 80104af7: 83 ec 18 sub $0x18,%esp struct proc *p; int fd; if(proc == initproc) 80104afa: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 80104b01: a1 6c c6 10 80 mov 0x8010c66c,%eax 80104b06: 39 c2 cmp %eax,%edx 80104b08: 75 0d jne 80104b17 <exit+0x23> panic("init exiting"); 80104b0a: 83 ec 0c sub $0xc,%esp 80104b0d: 68 2c 90 10 80 push $0x8010902c 80104b12: e8 4f ba ff ff call 80100566 <panic> // Close all open files. for(fd = 0; fd < NOFILE; fd++){ 80104b17: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 80104b1e: eb 48 jmp 80104b68 <exit+0x74> if(proc->ofile[fd]){ 80104b20: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104b26: 8b 55 f0 mov -0x10(%ebp),%edx 80104b29: 83 c2 08 add $0x8,%edx 80104b2c: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80104b30: 85 c0 test %eax,%eax 80104b32: 74 30 je 80104b64 <exit+0x70> fileclose(proc->ofile[fd]); 80104b34: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104b3a: 8b 55 f0 mov -0x10(%ebp),%edx 80104b3d: 83 c2 08 add $0x8,%edx 80104b40: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80104b44: 83 ec 0c sub $0xc,%esp 80104b47: 50 push %eax 80104b48: e8 04 c5 ff ff call 80101051 <fileclose> 80104b4d: 83 c4 10 add $0x10,%esp proc->ofile[fd] = 0; 80104b50: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104b56: 8b 55 f0 mov -0x10(%ebp),%edx 80104b59: 83 c2 08 add $0x8,%edx 80104b5c: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4) 80104b63: 00 if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ 80104b64: 83 45 f0 01 addl $0x1,-0x10(%ebp) 80104b68: 83 7d f0 0f cmpl $0xf,-0x10(%ebp) 80104b6c: 7e b2 jle 80104b20 <exit+0x2c> fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } begin_op(); 80104b6e: e8 b4 e9 ff ff call 80103527 <begin_op> iput(proc->cwd); 80104b73: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104b79: 8b 40 68 mov 0x68(%eax),%eax 80104b7c: 83 ec 0c sub $0xc,%esp 80104b7f: 50 push %eax 80104b80: e8 6b cf ff ff call 80101af0 <iput> 80104b85: 83 c4 10 add $0x10,%esp end_op(); 80104b88: e8 26 ea ff ff call 801035b3 <end_op> proc->cwd = 0; 80104b8d: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104b93: c7 40 68 00 00 00 00 movl $0x0,0x68(%eax) acquire(&ptable.lock); 80104b9a: 83 ec 0c sub $0xc,%esp 80104b9d: 68 80 39 11 80 push $0x80113980 80104ba2: e8 c9 09 00 00 call 80105570 <acquire> 80104ba7: 83 c4 10 add $0x10,%esp // Parent might be sleeping in wait(). wakeup1(proc->parent); 80104baa: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104bb0: 8b 40 14 mov 0x14(%eax),%eax 80104bb3: 83 ec 0c sub $0xc,%esp 80104bb6: 50 push %eax 80104bb7: e8 50 07 00 00 call 8010530c <wakeup1> 80104bbc: 83 c4 10 add $0x10,%esp // Pass abandoned children to init. // thread 에서exit 해도 mainthread종료시키는거 같다. // thread 에서 exit 하면 mainthread 종료 if(proc->is_thread ==1){ 80104bbf: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104bc5: 8b 80 80 00 00 00 mov 0x80(%eax),%eax 80104bcb: 83 f8 01 cmp $0x1,%eax 80104bce: 0f 85 a2 00 00 00 jne 80104c76 <exit+0x182> for(p = ptable.proc ; p<&ptable.proc[NPROC];p++){ 80104bd4: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp) 80104bdb: eb 7a jmp 80104c57 <exit+0x163> if(p->pid == proc->pid && p->is_thread == 0){ 80104bdd: 8b 45 f4 mov -0xc(%ebp),%eax 80104be0: 8b 50 10 mov 0x10(%eax),%edx 80104be3: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104be9: 8b 40 10 mov 0x10(%eax),%eax 80104bec: 39 c2 cmp %eax,%edx 80104bee: 75 2b jne 80104c1b <exit+0x127> 80104bf0: 8b 45 f4 mov -0xc(%ebp),%eax 80104bf3: 8b 80 80 00 00 00 mov 0x80(%eax),%eax 80104bf9: 85 c0 test %eax,%eax 80104bfb: 75 1e jne 80104c1b <exit+0x127> p->state = ZOMBIE; 80104bfd: 8b 45 f4 mov -0xc(%ebp),%eax 80104c00: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax) wakeup1(p->parent); 80104c07: 8b 45 f4 mov -0xc(%ebp),%eax 80104c0a: 8b 40 14 mov 0x14(%eax),%eax 80104c0d: 83 ec 0c sub $0xc,%esp 80104c10: 50 push %eax 80104c11: e8 f6 06 00 00 call 8010530c <wakeup1> 80104c16: 83 c4 10 add $0x10,%esp 80104c19: eb 35 jmp 80104c50 <exit+0x15c> }else if (p->pid == proc->pid && p->is_thread ==1){ 80104c1b: 8b 45 f4 mov -0xc(%ebp),%eax 80104c1e: 8b 50 10 mov 0x10(%eax),%edx 80104c21: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104c27: 8b 40 10 mov 0x10(%eax),%eax 80104c2a: 39 c2 cmp %eax,%edx 80104c2c: 75 22 jne 80104c50 <exit+0x15c> 80104c2e: 8b 45 f4 mov -0xc(%ebp),%eax 80104c31: 8b 80 80 00 00 00 mov 0x80(%eax),%eax 80104c37: 83 f8 01 cmp $0x1,%eax 80104c3a: 75 14 jne 80104c50 <exit+0x15c> p->parent=0; 80104c3c: 8b 45 f4 mov -0xc(%ebp),%eax 80104c3f: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) p->state = ZOMBIE; 80104c46: 8b 45 f4 mov -0xc(%ebp),%eax 80104c49: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax) // Pass abandoned children to init. // thread 에서exit 해도 mainthread종료시키는거 같다. // thread 에서 exit 하면 mainthread 종료 if(proc->is_thread ==1){ for(p = ptable.proc ; p<&ptable.proc[NPROC];p++){ 80104c50: 81 45 f4 8c 00 00 00 addl $0x8c,-0xc(%ebp) 80104c57: 81 7d f4 b4 5c 11 80 cmpl $0x80115cb4,-0xc(%ebp) 80104c5e: 0f 82 79 ff ff ff jb 80104bdd <exit+0xe9> }else if (p->pid == proc->pid && p->is_thread ==1){ p->parent=0; p->state = ZOMBIE; } } proc->state = ZOMBIE; 80104c64: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104c6a: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax) sched(); 80104c71: e8 ad 04 00 00 call 80105123 <sched> } for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104c76: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp) 80104c7d: eb 68 jmp 80104ce7 <exit+0x1f3> if(p->parent == proc){ 80104c7f: 8b 45 f4 mov -0xc(%ebp),%eax 80104c82: 8b 50 14 mov 0x14(%eax),%edx 80104c85: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104c8b: 39 c2 cmp %eax,%edx 80104c8d: 75 51 jne 80104ce0 <exit+0x1ec> if(p->pgdir != proc->pgdir){ 80104c8f: 8b 45 f4 mov -0xc(%ebp),%eax 80104c92: 8b 50 04 mov 0x4(%eax),%edx 80104c95: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104c9b: 8b 40 04 mov 0x4(%eax),%eax 80104c9e: 39 c2 cmp %eax,%edx 80104ca0: 74 2a je 80104ccc <exit+0x1d8> p->parent = initproc; 80104ca2: 8b 15 6c c6 10 80 mov 0x8010c66c,%edx 80104ca8: 8b 45 f4 mov -0xc(%ebp),%eax 80104cab: 89 50 14 mov %edx,0x14(%eax) if(p->state == ZOMBIE) 80104cae: 8b 45 f4 mov -0xc(%ebp),%eax 80104cb1: 8b 40 0c mov 0xc(%eax),%eax 80104cb4: 83 f8 05 cmp $0x5,%eax 80104cb7: 75 27 jne 80104ce0 <exit+0x1ec> wakeup1(initproc); 80104cb9: a1 6c c6 10 80 mov 0x8010c66c,%eax 80104cbe: 83 ec 0c sub $0xc,%esp 80104cc1: 50 push %eax 80104cc2: e8 45 06 00 00 call 8010530c <wakeup1> 80104cc7: 83 c4 10 add $0x10,%esp 80104cca: eb 14 jmp 80104ce0 <exit+0x1ec> }else{ p->parent = 0; 80104ccc: 8b 45 f4 mov -0xc(%ebp),%eax 80104ccf: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) p->state = ZOMBIE; 80104cd6: 8b 45 f4 mov -0xc(%ebp),%eax 80104cd9: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax) proc->state = ZOMBIE; sched(); } for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104ce0: 81 45 f4 8c 00 00 00 addl $0x8c,-0xc(%ebp) 80104ce7: 81 7d f4 b4 5c 11 80 cmpl $0x80115cb4,-0xc(%ebp) 80104cee: 72 8f jb 80104c7f <exit+0x18b> } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; 80104cf0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104cf6: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax) sched(); 80104cfd: e8 21 04 00 00 call 80105123 <sched> panic("zombie exit"); 80104d02: 83 ec 0c sub $0xc,%esp 80104d05: 68 39 90 10 80 push $0x80109039 80104d0a: e8 57 b8 ff ff call 80100566 <panic> 80104d0f <exit_thread>: } void exit_thread(void* retval) { 80104d0f: 55 push %ebp 80104d10: 89 e5 mov %esp,%ebp 80104d12: 83 ec 18 sub $0x18,%esp struct proc *p; //process의 exit status 지정 proc->exit_status = retval; 80104d15: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104d1b: 8b 55 08 mov 0x8(%ebp),%edx 80104d1e: 89 50 7c mov %edx,0x7c(%eax) //main thread가 안끝나서 파일은 안지워야함. if(proc == initproc) 80104d21: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 80104d28: a1 6c c6 10 80 mov 0x8010c66c,%eax 80104d2d: 39 c2 cmp %eax,%edx 80104d2f: 75 0d jne 80104d3e <exit_thread+0x2f> panic("init exiting"); 80104d31: 83 ec 0c sub $0xc,%esp 80104d34: 68 2c 90 10 80 push $0x8010902c 80104d39: e8 28 b8 ff ff call 80100566 <panic> acquire(&ptable.lock); 80104d3e: 83 ec 0c sub $0xc,%esp 80104d41: 68 80 39 11 80 push $0x80113980 80104d46: e8 25 08 00 00 call 80105570 <acquire> 80104d4b: 83 c4 10 add $0x10,%esp // Parent might be sleeping in wait(). wakeup1(proc->parent); 80104d4e: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104d54: 8b 40 14 mov 0x14(%eax),%eax 80104d57: 83 ec 0c sub $0xc,%esp 80104d5a: 50 push %eax 80104d5b: e8 ac 05 00 00 call 8010530c <wakeup1> 80104d60: 83 c4 10 add $0x10,%esp // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104d63: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp) 80104d6a: eb 3f jmp 80104dab <exit_thread+0x9c> if(p->parent == proc){ 80104d6c: 8b 45 f4 mov -0xc(%ebp),%eax 80104d6f: 8b 50 14 mov 0x14(%eax),%edx 80104d72: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104d78: 39 c2 cmp %eax,%edx 80104d7a: 75 28 jne 80104da4 <exit_thread+0x95> p->parent = initproc; 80104d7c: 8b 15 6c c6 10 80 mov 0x8010c66c,%edx 80104d82: 8b 45 f4 mov -0xc(%ebp),%eax 80104d85: 89 50 14 mov %edx,0x14(%eax) if(p->state == ZOMBIE) 80104d88: 8b 45 f4 mov -0xc(%ebp),%eax 80104d8b: 8b 40 0c mov 0xc(%eax),%eax 80104d8e: 83 f8 05 cmp $0x5,%eax 80104d91: 75 11 jne 80104da4 <exit_thread+0x95> wakeup1(initproc); 80104d93: a1 6c c6 10 80 mov 0x8010c66c,%eax 80104d98: 83 ec 0c sub $0xc,%esp 80104d9b: 50 push %eax 80104d9c: e8 6b 05 00 00 call 8010530c <wakeup1> 80104da1: 83 c4 10 add $0x10,%esp // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104da4: 81 45 f4 8c 00 00 00 addl $0x8c,-0xc(%ebp) 80104dab: 81 7d f4 b4 5c 11 80 cmpl $0x80115cb4,-0xc(%ebp) 80104db2: 72 b8 jb 80104d6c <exit_thread+0x5d> } } // Jump into the scheduler, never to return. // proc->state = ZOMBIE; proc->state = ZOMBIE; 80104db4: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104dba: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax) sched(); 80104dc1: e8 5d 03 00 00 call 80105123 <sched> panic("zombie exit"); 80104dc6: 83 ec 0c sub $0xc,%esp 80104dc9: 68 39 90 10 80 push $0x80109039 80104dce: e8 93 b7 ff ff call 80100566 <panic> 80104dd3 <wait>: } // Wait for a child process to exit and return its pid. // Return -1 if this process has no children. int wait(void) { 80104dd3: 55 push %ebp 80104dd4: 89 e5 mov %esp,%ebp 80104dd6: 83 ec 18 sub $0x18,%esp struct proc *p; int havekids, pid; acquire(&ptable.lock); 80104dd9: 83 ec 0c sub $0xc,%esp 80104ddc: 68 80 39 11 80 push $0x80113980 80104de1: e8 8a 07 00 00 call 80105570 <acquire> 80104de6: 83 c4 10 add $0x10,%esp for(;;){ // Scan through table looking for zombie children. havekids = 0; 80104de9: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104df0: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp) 80104df7: e9 a9 00 00 00 jmp 80104ea5 <wait+0xd2> if(p->parent != proc) 80104dfc: 8b 45 f4 mov -0xc(%ebp),%eax 80104dff: 8b 50 14 mov 0x14(%eax),%edx 80104e02: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104e08: 39 c2 cmp %eax,%edx 80104e0a: 0f 85 8d 00 00 00 jne 80104e9d <wait+0xca> continue; havekids = 1; 80104e10: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) if(p->state == ZOMBIE){ 80104e17: 8b 45 f4 mov -0xc(%ebp),%eax 80104e1a: 8b 40 0c mov 0xc(%eax),%eax 80104e1d: 83 f8 05 cmp $0x5,%eax 80104e20: 75 7c jne 80104e9e <wait+0xcb> // Found one. pid = p->pid; 80104e22: 8b 45 f4 mov -0xc(%ebp),%eax 80104e25: 8b 40 10 mov 0x10(%eax),%eax 80104e28: 89 45 ec mov %eax,-0x14(%ebp) kfree(p->kstack); 80104e2b: 8b 45 f4 mov -0xc(%ebp),%eax 80104e2e: 8b 40 08 mov 0x8(%eax),%eax 80104e31: 83 ec 0c sub $0xc,%esp 80104e34: 50 push %eax 80104e35: e8 45 dd ff ff call 80102b7f <kfree> 80104e3a: 83 c4 10 add $0x10,%esp p->kstack = 0; 80104e3d: 8b 45 f4 mov -0xc(%ebp),%eax 80104e40: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) freevm(p->pgdir); 80104e47: 8b 45 f4 mov -0xc(%ebp),%eax 80104e4a: 8b 40 04 mov 0x4(%eax),%eax 80104e4d: 83 ec 0c sub $0xc,%esp 80104e50: 50 push %eax 80104e51: e8 fe 3a 00 00 call 80108954 <freevm> 80104e56: 83 c4 10 add $0x10,%esp p->state = UNUSED; 80104e59: 8b 45 f4 mov -0xc(%ebp),%eax 80104e5c: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) p->pid = 0; 80104e63: 8b 45 f4 mov -0xc(%ebp),%eax 80104e66: c7 40 10 00 00 00 00 movl $0x0,0x10(%eax) p->parent = 0; 80104e6d: 8b 45 f4 mov -0xc(%ebp),%eax 80104e70: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) p->name[0] = 0; 80104e77: 8b 45 f4 mov -0xc(%ebp),%eax 80104e7a: c6 40 6c 00 movb $0x0,0x6c(%eax) p->killed = 0; 80104e7e: 8b 45 f4 mov -0xc(%ebp),%eax 80104e81: c7 40 24 00 00 00 00 movl $0x0,0x24(%eax) release(&ptable.lock); 80104e88: 83 ec 0c sub $0xc,%esp 80104e8b: 68 80 39 11 80 push $0x80113980 80104e90: e8 42 07 00 00 call 801055d7 <release> 80104e95: 83 c4 10 add $0x10,%esp return pid; 80104e98: 8b 45 ec mov -0x14(%ebp),%eax 80104e9b: eb 5b jmp 80104ef8 <wait+0x125> for(;;){ // Scan through table looking for zombie children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent != proc) continue; 80104e9d: 90 nop acquire(&ptable.lock); for(;;){ // Scan through table looking for zombie children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104e9e: 81 45 f4 8c 00 00 00 addl $0x8c,-0xc(%ebp) 80104ea5: 81 7d f4 b4 5c 11 80 cmpl $0x80115cb4,-0xc(%ebp) 80104eac: 0f 82 4a ff ff ff jb 80104dfc <wait+0x29> return pid; } } // No point waiting if we don't have any children. if(!havekids || proc->killed){ 80104eb2: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80104eb6: 74 0d je 80104ec5 <wait+0xf2> 80104eb8: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104ebe: 8b 40 24 mov 0x24(%eax),%eax 80104ec1: 85 c0 test %eax,%eax 80104ec3: 74 17 je 80104edc <wait+0x109> release(&ptable.lock); 80104ec5: 83 ec 0c sub $0xc,%esp 80104ec8: 68 80 39 11 80 push $0x80113980 80104ecd: e8 05 07 00 00 call 801055d7 <release> 80104ed2: 83 c4 10 add $0x10,%esp return -1; 80104ed5: b8 ff ff ff ff mov $0xffffffff,%eax 80104eda: eb 1c jmp 80104ef8 <wait+0x125> } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(proc, &ptable.lock); //DOC: wait-sleep 80104edc: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104ee2: 83 ec 08 sub $0x8,%esp 80104ee5: 68 80 39 11 80 push $0x80113980 80104eea: 50 push %eax 80104eeb: e8 70 03 00 00 call 80105260 <sleep> 80104ef0: 83 c4 10 add $0x10,%esp } 80104ef3: e9 f1 fe ff ff jmp 80104de9 <wait+0x16> } 80104ef8: c9 leave 80104ef9: c3 ret 80104efa <wait_thread>: //기존의 wait은 child 가 다 없어질때까지 기다림 //여기서 wait은 exit가 들어올때까지 기다림 ( retval에 exit 값이 들어올때까지 기다림) int wait_thread(int tid,void** retval) { 80104efa: 55 push %ebp 80104efb: 89 e5 mov %esp,%ebp 80104efd: 83 ec 18 sub $0x18,%esp struct proc *p; int found = 0 ; 80104f00: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) acquire(&ptable.lock); 80104f07: 83 ec 0c sub $0xc,%esp 80104f0a: 68 80 39 11 80 push $0x80113980 80104f0f: e8 5c 06 00 00 call 80105570 <acquire> 80104f14: 83 c4 10 add $0x10,%esp // new: //이미 terminate 되어있으면 바로 return for(;;){ found=0; 80104f17: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104f1e: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp) 80104f25: e9 fc 00 00 00 jmp 80105026 <wait_thread+0x12c> if(p->parent !=proc) 80104f2a: 8b 45 f4 mov -0xc(%ebp),%eax 80104f2d: 8b 50 14 mov 0x14(%eax),%edx 80104f30: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104f36: 39 c2 cmp %eax,%edx 80104f38: 0f 85 dd 00 00 00 jne 8010501b <wait_thread+0x121> continue; if(p->tid !=tid || p->is_thread !=1) 80104f3e: 8b 45 f4 mov -0xc(%ebp),%eax 80104f41: 8b 80 84 00 00 00 mov 0x84(%eax),%eax 80104f47: 3b 45 08 cmp 0x8(%ebp),%eax 80104f4a: 0f 85 ce 00 00 00 jne 8010501e <wait_thread+0x124> 80104f50: 8b 45 f4 mov -0xc(%ebp),%eax 80104f53: 8b 80 80 00 00 00 mov 0x80(%eax),%eax 80104f59: 83 f8 01 cmp $0x1,%eax 80104f5c: 0f 85 bc 00 00 00 jne 8010501e <wait_thread+0x124> // else{ // found = 1; // break; // } // } found=1; 80104f62: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) // cprintf("p->pid : %d , p->tid: %d, p->exit_status : 0x%x\n",p->pid,p->tid,(int)p->exit_status); if(p->state == ZOMBIE){ 80104f69: 8b 45 f4 mov -0xc(%ebp),%eax 80104f6c: 8b 40 0c mov 0xc(%eax),%eax 80104f6f: 83 f8 05 cmp $0x5,%eax 80104f72: 0f 85 a7 00 00 00 jne 8010501f <wait_thread+0x125> // Found one. p->parent->numOfThread--; 80104f78: 8b 45 f4 mov -0xc(%ebp),%eax 80104f7b: 8b 40 14 mov 0x14(%eax),%eax 80104f7e: 8b 90 88 00 00 00 mov 0x88(%eax),%edx 80104f84: 83 ea 01 sub $0x1,%edx 80104f87: 89 90 88 00 00 00 mov %edx,0x88(%eax) tid = p->tid; 80104f8d: 8b 45 f4 mov -0xc(%ebp),%eax 80104f90: 8b 80 84 00 00 00 mov 0x84(%eax),%eax 80104f96: 89 45 08 mov %eax,0x8(%ebp) kfree(p->kstack); 80104f99: 8b 45 f4 mov -0xc(%ebp),%eax 80104f9c: 8b 40 08 mov 0x8(%eax),%eax 80104f9f: 83 ec 0c sub $0xc,%esp 80104fa2: 50 push %eax 80104fa3: e8 d7 db ff ff call 80102b7f <kfree> 80104fa8: 83 c4 10 add $0x10,%esp p->kstack = 0; 80104fab: 8b 45 f4 mov -0xc(%ebp),%eax 80104fae: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) p->state = UNUSED; 80104fb5: 8b 45 f4 mov -0xc(%ebp),%eax 80104fb8: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) p->pid = 0; 80104fbf: 8b 45 f4 mov -0xc(%ebp),%eax 80104fc2: c7 40 10 00 00 00 00 movl $0x0,0x10(%eax) p->parent = 0; 80104fc9: 8b 45 f4 mov -0xc(%ebp),%eax 80104fcc: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) p->name[0] = 0; 80104fd3: 8b 45 f4 mov -0xc(%ebp),%eax 80104fd6: c6 40 6c 00 movb $0x0,0x6c(%eax) p->killed = 0; 80104fda: 8b 45 f4 mov -0xc(%ebp),%eax 80104fdd: c7 40 24 00 00 00 00 movl $0x0,0x24(%eax) p->is_thread = 0; 80104fe4: 8b 45 f4 mov -0xc(%ebp),%eax 80104fe7: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) 80104fee: 00 00 00 // p->numOfThread--; // retval 을 exit_status로 바꿔주면 될듯? *retval = p->exit_status; 80104ff1: 8b 45 f4 mov -0xc(%ebp),%eax 80104ff4: 8b 50 7c mov 0x7c(%eax),%edx 80104ff7: 8b 45 0c mov 0xc(%ebp),%eax 80104ffa: 89 10 mov %edx,(%eax) p->exit_status=0; 80104ffc: 8b 45 f4 mov -0xc(%ebp),%eax 80104fff: c7 40 7c 00 00 00 00 movl $0x0,0x7c(%eax) release(&ptable.lock); 80105006: 83 ec 0c sub $0xc,%esp 80105009: 68 80 39 11 80 push $0x80113980 8010500e: e8 c4 05 00 00 call 801055d7 <release> 80105013: 83 c4 10 add $0x10,%esp return tid; 80105016: 8b 45 08 mov 0x8(%ebp),%eax 80105019: eb 5e jmp 80105079 <wait_thread+0x17f> for(;;){ found=0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent !=proc) continue; 8010501b: 90 nop 8010501c: eb 01 jmp 8010501f <wait_thread+0x125> if(p->tid !=tid || p->is_thread !=1) continue; 8010501e: 90 nop // new: //이미 terminate 되어있으면 바로 return for(;;){ found=0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 8010501f: 81 45 f4 8c 00 00 00 addl $0x8c,-0xc(%ebp) 80105026: 81 7d f4 b4 5c 11 80 cmpl $0x80115cb4,-0xc(%ebp) 8010502d: 0f 82 f7 fe ff ff jb 80104f2a <wait_thread+0x30> p->exit_status=0; release(&ptable.lock); return tid; } } if(!found || proc->killed){ 80105033: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80105037: 74 0d je 80105046 <wait_thread+0x14c> 80105039: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010503f: 8b 40 24 mov 0x24(%eax),%eax 80105042: 85 c0 test %eax,%eax 80105044: 74 17 je 8010505d <wait_thread+0x163> release(&ptable.lock); 80105046: 83 ec 0c sub $0xc,%esp 80105049: 68 80 39 11 80 push $0x80113980 8010504e: e8 84 05 00 00 call 801055d7 <release> 80105053: 83 c4 10 add $0x10,%esp return -1; 80105056: b8 ff ff ff ff mov $0xffffffff,%eax 8010505b: eb 1c jmp 80105079 <wait_thread+0x17f> } sleep(proc, &ptable.lock); //DOC: wait-sleep 8010505d: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105063: 83 ec 08 sub $0x8,%esp 80105066: 68 80 39 11 80 push $0x80113980 8010506b: 50 push %eax 8010506c: e8 ef 01 00 00 call 80105260 <sleep> 80105071: 83 c4 10 add $0x10,%esp } 80105074: e9 9e fe ff ff jmp 80104f17 <wait_thread+0x1d> // No point waiting if we don't have any children. // Wait for children to exit. (See wakeup1 call in proc_exit.) } 80105079: c9 leave 8010507a: c3 ret 8010507b <scheduler>: // - swtch to start running that process // - eventually that process transfers control // via swtch back to the scheduler. void scheduler(void) { 8010507b: 55 push %ebp 8010507c: 89 e5 mov %esp,%ebp 8010507e: 83 ec 18 sub $0x18,%esp struct proc *p; for(;;){ // Enable interrupts on this processor. sti(); 80105081: e8 68 f3 ff ff call 801043ee <sti> // Loop over process table looking for process to run. acquire(&ptable.lock); 80105086: 83 ec 0c sub $0xc,%esp 80105089: 68 80 39 11 80 push $0x80113980 8010508e: e8 dd 04 00 00 call 80105570 <acquire> 80105093: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80105096: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp) 8010509d: eb 66 jmp 80105105 <scheduler+0x8a> if(p->state != RUNNABLE) 8010509f: 8b 45 f4 mov -0xc(%ebp),%eax 801050a2: 8b 40 0c mov 0xc(%eax),%eax 801050a5: 83 f8 03 cmp $0x3,%eax 801050a8: 75 53 jne 801050fd <scheduler+0x82> // if(p->numOfThread !=0) // yield(); // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. proc = p; 801050aa: 8b 45 f4 mov -0xc(%ebp),%eax 801050ad: 65 a3 04 00 00 00 mov %eax,%gs:0x4 switchuvm(p); 801050b3: 83 ec 0c sub $0xc,%esp 801050b6: ff 75 f4 pushl -0xc(%ebp) 801050b9: e8 50 34 00 00 call 8010850e <switchuvm> 801050be: 83 c4 10 add $0x10,%esp p->state = RUNNING; 801050c1: 8b 45 f4 mov -0xc(%ebp),%eax 801050c4: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax) swtch(&cpu->scheduler, proc->context); 801050cb: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801050d1: 8b 40 1c mov 0x1c(%eax),%eax 801050d4: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 801050db: 83 c2 04 add $0x4,%edx 801050de: 83 ec 08 sub $0x8,%esp 801050e1: 50 push %eax 801050e2: 52 push %edx 801050e3: e8 5f 09 00 00 call 80105a47 <swtch> 801050e8: 83 c4 10 add $0x10,%esp switchkvm(); 801050eb: e8 01 34 00 00 call 801084f1 <switchkvm> // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; 801050f0: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4 801050f7: 00 00 00 00 801050fb: eb 01 jmp 801050fe <scheduler+0x83> // Loop over process table looking for process to run. acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->state != RUNNABLE) continue; 801050fd: 90 nop // 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++){ 801050fe: 81 45 f4 8c 00 00 00 addl $0x8c,-0xc(%ebp) 80105105: 81 7d f4 b4 5c 11 80 cmpl $0x80115cb4,-0xc(%ebp) 8010510c: 72 91 jb 8010509f <scheduler+0x24> // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; } release(&ptable.lock); 8010510e: 83 ec 0c sub $0xc,%esp 80105111: 68 80 39 11 80 push $0x80113980 80105116: e8 bc 04 00 00 call 801055d7 <release> 8010511b: 83 c4 10 add $0x10,%esp } 8010511e: e9 5e ff ff ff jmp 80105081 <scheduler+0x6> 80105123 <sched>: // Enter scheduler. Must hold only ptable.lock // and have changed proc->state. void sched(void) { 80105123: 55 push %ebp 80105124: 89 e5 mov %esp,%ebp 80105126: 83 ec 18 sub $0x18,%esp int intena; if(!holding(&ptable.lock)) 80105129: 83 ec 0c sub $0xc,%esp 8010512c: 68 80 39 11 80 push $0x80113980 80105131: e8 6d 05 00 00 call 801056a3 <holding> 80105136: 83 c4 10 add $0x10,%esp 80105139: 85 c0 test %eax,%eax 8010513b: 75 0d jne 8010514a <sched+0x27> panic("sched ptable.lock"); 8010513d: 83 ec 0c sub $0xc,%esp 80105140: 68 45 90 10 80 push $0x80109045 80105145: e8 1c b4 ff ff call 80100566 <panic> if(cpu->ncli != 1) 8010514a: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105150: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax 80105156: 83 f8 01 cmp $0x1,%eax 80105159: 74 0d je 80105168 <sched+0x45> panic("sched locks"); 8010515b: 83 ec 0c sub $0xc,%esp 8010515e: 68 57 90 10 80 push $0x80109057 80105163: e8 fe b3 ff ff call 80100566 <panic> if(proc->state == RUNNING) 80105168: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010516e: 8b 40 0c mov 0xc(%eax),%eax 80105171: 83 f8 04 cmp $0x4,%eax 80105174: 75 0d jne 80105183 <sched+0x60> panic("sched running"); 80105176: 83 ec 0c sub $0xc,%esp 80105179: 68 63 90 10 80 push $0x80109063 8010517e: e8 e3 b3 ff ff call 80100566 <panic> if(readeflags()&FL_IF) 80105183: e8 56 f2 ff ff call 801043de <readeflags> 80105188: 25 00 02 00 00 and $0x200,%eax 8010518d: 85 c0 test %eax,%eax 8010518f: 74 0d je 8010519e <sched+0x7b> panic("sched interruptible"); 80105191: 83 ec 0c sub $0xc,%esp 80105194: 68 71 90 10 80 push $0x80109071 80105199: e8 c8 b3 ff ff call 80100566 <panic> intena = cpu->intena; 8010519e: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801051a4: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax 801051aa: 89 45 f4 mov %eax,-0xc(%ebp) swtch(&proc->context, cpu->scheduler); 801051ad: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801051b3: 8b 40 04 mov 0x4(%eax),%eax 801051b6: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 801051bd: 83 c2 1c add $0x1c,%edx 801051c0: 83 ec 08 sub $0x8,%esp 801051c3: 50 push %eax 801051c4: 52 push %edx 801051c5: e8 7d 08 00 00 call 80105a47 <swtch> 801051ca: 83 c4 10 add $0x10,%esp cpu->intena = intena; 801051cd: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801051d3: 8b 55 f4 mov -0xc(%ebp),%edx 801051d6: 89 90 b0 00 00 00 mov %edx,0xb0(%eax) } 801051dc: 90 nop 801051dd: c9 leave 801051de: c3 ret 801051df <yield>: // Give up the CPU for one scheduling round. void yield(void) { 801051df: 55 push %ebp 801051e0: 89 e5 mov %esp,%ebp 801051e2: 83 ec 08 sub $0x8,%esp acquire(&ptable.lock); //DOC: yieldlock 801051e5: 83 ec 0c sub $0xc,%esp 801051e8: 68 80 39 11 80 push $0x80113980 801051ed: e8 7e 03 00 00 call 80105570 <acquire> 801051f2: 83 c4 10 add $0x10,%esp proc->state = RUNNABLE; 801051f5: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801051fb: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) sched(); 80105202: e8 1c ff ff ff call 80105123 <sched> release(&ptable.lock); 80105207: 83 ec 0c sub $0xc,%esp 8010520a: 68 80 39 11 80 push $0x80113980 8010520f: e8 c3 03 00 00 call 801055d7 <release> 80105214: 83 c4 10 add $0x10,%esp } 80105217: 90 nop 80105218: c9 leave 80105219: c3 ret 8010521a <forkret>: // A fork child's very first scheduling by scheduler() // will swtch here. "Return" to user space. void forkret(void) { 8010521a: 55 push %ebp 8010521b: 89 e5 mov %esp,%ebp 8010521d: 83 ec 08 sub $0x8,%esp static int first = 1; // Still holding ptable.lock from scheduler. release(&ptable.lock); 80105220: 83 ec 0c sub $0xc,%esp 80105223: 68 80 39 11 80 push $0x80113980 80105228: e8 aa 03 00 00 call 801055d7 <release> 8010522d: 83 c4 10 add $0x10,%esp if (first) { 80105230: a1 08 c0 10 80 mov 0x8010c008,%eax 80105235: 85 c0 test %eax,%eax 80105237: 74 24 je 8010525d <forkret+0x43> // 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; 80105239: c7 05 08 c0 10 80 00 movl $0x0,0x8010c008 80105240: 00 00 00 iinit(ROOTDEV); 80105243: 83 ec 0c sub $0xc,%esp 80105246: 6a 01 push $0x1 80105248: e8 f1 c3 ff ff call 8010163e <iinit> 8010524d: 83 c4 10 add $0x10,%esp initlog(ROOTDEV); 80105250: 83 ec 0c sub $0xc,%esp 80105253: 6a 01 push $0x1 80105255: e8 af e0 ff ff call 80103309 <initlog> 8010525a: 83 c4 10 add $0x10,%esp } // Return to "caller", actually trapret (see allocproc). } 8010525d: 90 nop 8010525e: c9 leave 8010525f: c3 ret 80105260 <sleep>: // Atomically release lock and sleep on chan. // Reacquires lock when awakened. void sleep(void *chan, struct spinlock *lk) { 80105260: 55 push %ebp 80105261: 89 e5 mov %esp,%ebp 80105263: 83 ec 08 sub $0x8,%esp if(proc == 0) 80105266: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010526c: 85 c0 test %eax,%eax 8010526e: 75 0d jne 8010527d <sleep+0x1d> panic("sleep"); 80105270: 83 ec 0c sub $0xc,%esp 80105273: 68 85 90 10 80 push $0x80109085 80105278: e8 e9 b2 ff ff call 80100566 <panic> if(lk == 0) 8010527d: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 80105281: 75 0d jne 80105290 <sleep+0x30> panic("sleep without lk"); 80105283: 83 ec 0c sub $0xc,%esp 80105286: 68 8b 90 10 80 push $0x8010908b 8010528b: e8 d6 b2 ff ff call 80100566 <panic> // change p->state and then call sched. // Once we hold ptable.lock, we can be // guaranteed that we won't miss any wakeup // (wakeup runs with ptable.lock locked), // so it's okay to release lk. if(lk != &ptable.lock){ //DOC: sleeplock0 80105290: 81 7d 0c 80 39 11 80 cmpl $0x80113980,0xc(%ebp) 80105297: 74 1e je 801052b7 <sleep+0x57> acquire(&ptable.lock); //DOC: sleeplock1 80105299: 83 ec 0c sub $0xc,%esp 8010529c: 68 80 39 11 80 push $0x80113980 801052a1: e8 ca 02 00 00 call 80105570 <acquire> 801052a6: 83 c4 10 add $0x10,%esp release(lk); 801052a9: 83 ec 0c sub $0xc,%esp 801052ac: ff 75 0c pushl 0xc(%ebp) 801052af: e8 23 03 00 00 call 801055d7 <release> 801052b4: 83 c4 10 add $0x10,%esp } // Go to sleep. proc->chan = chan; 801052b7: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801052bd: 8b 55 08 mov 0x8(%ebp),%edx 801052c0: 89 50 20 mov %edx,0x20(%eax) proc->state = SLEEPING; 801052c3: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801052c9: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax) sched(); 801052d0: e8 4e fe ff ff call 80105123 <sched> // Tidy up. proc->chan = 0; 801052d5: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801052db: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax) // Reacquire original lock. if(lk != &ptable.lock){ //DOC: sleeplock2 801052e2: 81 7d 0c 80 39 11 80 cmpl $0x80113980,0xc(%ebp) 801052e9: 74 1e je 80105309 <sleep+0xa9> release(&ptable.lock); 801052eb: 83 ec 0c sub $0xc,%esp 801052ee: 68 80 39 11 80 push $0x80113980 801052f3: e8 df 02 00 00 call 801055d7 <release> 801052f8: 83 c4 10 add $0x10,%esp acquire(lk); 801052fb: 83 ec 0c sub $0xc,%esp 801052fe: ff 75 0c pushl 0xc(%ebp) 80105301: e8 6a 02 00 00 call 80105570 <acquire> 80105306: 83 c4 10 add $0x10,%esp } } 80105309: 90 nop 8010530a: c9 leave 8010530b: c3 ret 8010530c <wakeup1>: //PAGEBREAK! // Wake up all processes sleeping on chan. // The ptable lock must be held. static void wakeup1(void *chan) { 8010530c: 55 push %ebp 8010530d: 89 e5 mov %esp,%ebp 8010530f: 83 ec 10 sub $0x10,%esp struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80105312: c7 45 fc b4 39 11 80 movl $0x801139b4,-0x4(%ebp) 80105319: eb 27 jmp 80105342 <wakeup1+0x36> if(p->state == SLEEPING && p->chan == chan) 8010531b: 8b 45 fc mov -0x4(%ebp),%eax 8010531e: 8b 40 0c mov 0xc(%eax),%eax 80105321: 83 f8 02 cmp $0x2,%eax 80105324: 75 15 jne 8010533b <wakeup1+0x2f> 80105326: 8b 45 fc mov -0x4(%ebp),%eax 80105329: 8b 40 20 mov 0x20(%eax),%eax 8010532c: 3b 45 08 cmp 0x8(%ebp),%eax 8010532f: 75 0a jne 8010533b <wakeup1+0x2f> p->state = RUNNABLE; 80105331: 8b 45 fc mov -0x4(%ebp),%eax 80105334: 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++) 8010533b: 81 45 fc 8c 00 00 00 addl $0x8c,-0x4(%ebp) 80105342: 81 7d fc b4 5c 11 80 cmpl $0x80115cb4,-0x4(%ebp) 80105349: 72 d0 jb 8010531b <wakeup1+0xf> if(p->state == SLEEPING && p->chan == chan) p->state = RUNNABLE; } 8010534b: 90 nop 8010534c: c9 leave 8010534d: c3 ret 8010534e <wakeup>: // Wake up all processes sleeping on chan. void wakeup(void *chan) { 8010534e: 55 push %ebp 8010534f: 89 e5 mov %esp,%ebp 80105351: 83 ec 08 sub $0x8,%esp acquire(&ptable.lock); 80105354: 83 ec 0c sub $0xc,%esp 80105357: 68 80 39 11 80 push $0x80113980 8010535c: e8 0f 02 00 00 call 80105570 <acquire> 80105361: 83 c4 10 add $0x10,%esp wakeup1(chan); 80105364: 83 ec 0c sub $0xc,%esp 80105367: ff 75 08 pushl 0x8(%ebp) 8010536a: e8 9d ff ff ff call 8010530c <wakeup1> 8010536f: 83 c4 10 add $0x10,%esp release(&ptable.lock); 80105372: 83 ec 0c sub $0xc,%esp 80105375: 68 80 39 11 80 push $0x80113980 8010537a: e8 58 02 00 00 call 801055d7 <release> 8010537f: 83 c4 10 add $0x10,%esp } 80105382: 90 nop 80105383: c9 leave 80105384: c3 ret 80105385 <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) { 80105385: 55 push %ebp 80105386: 89 e5 mov %esp,%ebp 80105388: 83 ec 18 sub $0x18,%esp struct proc *p; acquire(&ptable.lock); 8010538b: 83 ec 0c sub $0xc,%esp 8010538e: 68 80 39 11 80 push $0x80113980 80105393: e8 d8 01 00 00 call 80105570 <acquire> 80105398: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 8010539b: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp) 801053a2: eb 48 jmp 801053ec <kill+0x67> if(p->pid == pid){ 801053a4: 8b 45 f4 mov -0xc(%ebp),%eax 801053a7: 8b 40 10 mov 0x10(%eax),%eax 801053aa: 3b 45 08 cmp 0x8(%ebp),%eax 801053ad: 75 36 jne 801053e5 <kill+0x60> p->killed = 1; 801053af: 8b 45 f4 mov -0xc(%ebp),%eax 801053b2: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) // Wake process from sleep if necessary. if(p->state == SLEEPING) 801053b9: 8b 45 f4 mov -0xc(%ebp),%eax 801053bc: 8b 40 0c mov 0xc(%eax),%eax 801053bf: 83 f8 02 cmp $0x2,%eax 801053c2: 75 0a jne 801053ce <kill+0x49> p->state = RUNNABLE; 801053c4: 8b 45 f4 mov -0xc(%ebp),%eax 801053c7: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) release(&ptable.lock); 801053ce: 83 ec 0c sub $0xc,%esp 801053d1: 68 80 39 11 80 push $0x80113980 801053d6: e8 fc 01 00 00 call 801055d7 <release> 801053db: 83 c4 10 add $0x10,%esp return 0; 801053de: b8 00 00 00 00 mov $0x0,%eax 801053e3: eb 25 jmp 8010540a <kill+0x85> kill(int pid) { struct proc *p; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801053e5: 81 45 f4 8c 00 00 00 addl $0x8c,-0xc(%ebp) 801053ec: 81 7d f4 b4 5c 11 80 cmpl $0x80115cb4,-0xc(%ebp) 801053f3: 72 af jb 801053a4 <kill+0x1f> p->state = RUNNABLE; release(&ptable.lock); return 0; } } release(&ptable.lock); 801053f5: 83 ec 0c sub $0xc,%esp 801053f8: 68 80 39 11 80 push $0x80113980 801053fd: e8 d5 01 00 00 call 801055d7 <release> 80105402: 83 c4 10 add $0x10,%esp return -1; 80105405: b8 ff ff ff ff mov $0xffffffff,%eax } 8010540a: c9 leave 8010540b: c3 ret 8010540c <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) { 8010540c: 55 push %ebp 8010540d: 89 e5 mov %esp,%ebp 8010540f: 83 ec 48 sub $0x48,%esp int i; struct proc *p; char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80105412: c7 45 f0 b4 39 11 80 movl $0x801139b4,-0x10(%ebp) 80105419: e9 da 00 00 00 jmp 801054f8 <procdump+0xec> if(p->state == UNUSED) 8010541e: 8b 45 f0 mov -0x10(%ebp),%eax 80105421: 8b 40 0c mov 0xc(%eax),%eax 80105424: 85 c0 test %eax,%eax 80105426: 0f 84 c4 00 00 00 je 801054f0 <procdump+0xe4> continue; if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 8010542c: 8b 45 f0 mov -0x10(%ebp),%eax 8010542f: 8b 40 0c mov 0xc(%eax),%eax 80105432: 83 f8 05 cmp $0x5,%eax 80105435: 77 23 ja 8010545a <procdump+0x4e> 80105437: 8b 45 f0 mov -0x10(%ebp),%eax 8010543a: 8b 40 0c mov 0xc(%eax),%eax 8010543d: 8b 04 85 0c c0 10 80 mov -0x7fef3ff4(,%eax,4),%eax 80105444: 85 c0 test %eax,%eax 80105446: 74 12 je 8010545a <procdump+0x4e> state = states[p->state]; 80105448: 8b 45 f0 mov -0x10(%ebp),%eax 8010544b: 8b 40 0c mov 0xc(%eax),%eax 8010544e: 8b 04 85 0c c0 10 80 mov -0x7fef3ff4(,%eax,4),%eax 80105455: 89 45 ec mov %eax,-0x14(%ebp) 80105458: eb 07 jmp 80105461 <procdump+0x55> else state = "???"; 8010545a: c7 45 ec 9c 90 10 80 movl $0x8010909c,-0x14(%ebp) cprintf("%d %s %s", p->pid, state, p->name); 80105461: 8b 45 f0 mov -0x10(%ebp),%eax 80105464: 8d 50 6c lea 0x6c(%eax),%edx 80105467: 8b 45 f0 mov -0x10(%ebp),%eax 8010546a: 8b 40 10 mov 0x10(%eax),%eax 8010546d: 52 push %edx 8010546e: ff 75 ec pushl -0x14(%ebp) 80105471: 50 push %eax 80105472: 68 a0 90 10 80 push $0x801090a0 80105477: e8 4a af ff ff call 801003c6 <cprintf> 8010547c: 83 c4 10 add $0x10,%esp if(p->state == SLEEPING){ 8010547f: 8b 45 f0 mov -0x10(%ebp),%eax 80105482: 8b 40 0c mov 0xc(%eax),%eax 80105485: 83 f8 02 cmp $0x2,%eax 80105488: 75 54 jne 801054de <procdump+0xd2> getcallerpcs((uint*)p->context->ebp+2, pc); 8010548a: 8b 45 f0 mov -0x10(%ebp),%eax 8010548d: 8b 40 1c mov 0x1c(%eax),%eax 80105490: 8b 40 0c mov 0xc(%eax),%eax 80105493: 83 c0 08 add $0x8,%eax 80105496: 89 c2 mov %eax,%edx 80105498: 83 ec 08 sub $0x8,%esp 8010549b: 8d 45 c4 lea -0x3c(%ebp),%eax 8010549e: 50 push %eax 8010549f: 52 push %edx 801054a0: e8 84 01 00 00 call 80105629 <getcallerpcs> 801054a5: 83 c4 10 add $0x10,%esp for(i=0; i<10 && pc[i] != 0; i++) 801054a8: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801054af: eb 1c jmp 801054cd <procdump+0xc1> cprintf(" %p", pc[i]); 801054b1: 8b 45 f4 mov -0xc(%ebp),%eax 801054b4: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax 801054b8: 83 ec 08 sub $0x8,%esp 801054bb: 50 push %eax 801054bc: 68 a9 90 10 80 push $0x801090a9 801054c1: e8 00 af ff ff call 801003c6 <cprintf> 801054c6: 83 c4 10 add $0x10,%esp else state = "???"; cprintf("%d %s %s", p->pid, state, p->name); if(p->state == SLEEPING){ getcallerpcs((uint*)p->context->ebp+2, pc); for(i=0; i<10 && pc[i] != 0; i++) 801054c9: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801054cd: 83 7d f4 09 cmpl $0x9,-0xc(%ebp) 801054d1: 7f 0b jg 801054de <procdump+0xd2> 801054d3: 8b 45 f4 mov -0xc(%ebp),%eax 801054d6: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax 801054da: 85 c0 test %eax,%eax 801054dc: 75 d3 jne 801054b1 <procdump+0xa5> cprintf(" %p", pc[i]); } cprintf("\n"); 801054de: 83 ec 0c sub $0xc,%esp 801054e1: 68 ad 90 10 80 push $0x801090ad 801054e6: e8 db ae ff ff call 801003c6 <cprintf> 801054eb: 83 c4 10 add $0x10,%esp 801054ee: eb 01 jmp 801054f1 <procdump+0xe5> char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->state == UNUSED) continue; 801054f0: 90 nop int i; struct proc *p; char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801054f1: 81 45 f0 8c 00 00 00 addl $0x8c,-0x10(%ebp) 801054f8: 81 7d f0 b4 5c 11 80 cmpl $0x80115cb4,-0x10(%ebp) 801054ff: 0f 82 19 ff ff ff jb 8010541e <procdump+0x12> for(i=0; i<10 && pc[i] != 0; i++) cprintf(" %p", pc[i]); } cprintf("\n"); } } 80105505: 90 nop 80105506: c9 leave 80105507: c3 ret 80105508 <getpid>: int getpid(void){ 80105508: 55 push %ebp 80105509: 89 e5 mov %esp,%ebp return proc->pid; 8010550b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105511: 8b 40 10 mov 0x10(%eax),%eax } 80105514: 5d pop %ebp 80105515: c3 ret 80105516 <readeflags>: asm volatile("ltr %0" : : "r" (sel)); } static inline uint readeflags(void) { 80105516: 55 push %ebp 80105517: 89 e5 mov %esp,%ebp 80105519: 83 ec 10 sub $0x10,%esp uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 8010551c: 9c pushf 8010551d: 58 pop %eax 8010551e: 89 45 fc mov %eax,-0x4(%ebp) return eflags; 80105521: 8b 45 fc mov -0x4(%ebp),%eax } 80105524: c9 leave 80105525: c3 ret 80105526 <cli>: asm volatile("movw %0, %%gs" : : "r" (v)); } static inline void cli(void) { 80105526: 55 push %ebp 80105527: 89 e5 mov %esp,%ebp asm volatile("cli"); 80105529: fa cli } 8010552a: 90 nop 8010552b: 5d pop %ebp 8010552c: c3 ret 8010552d <sti>: static inline void sti(void) { 8010552d: 55 push %ebp 8010552e: 89 e5 mov %esp,%ebp asm volatile("sti"); 80105530: fb sti } 80105531: 90 nop 80105532: 5d pop %ebp 80105533: c3 ret 80105534 <xchg>: static inline uint xchg(volatile uint *addr, uint newval) { 80105534: 55 push %ebp 80105535: 89 e5 mov %esp,%ebp 80105537: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 8010553a: 8b 55 08 mov 0x8(%ebp),%edx 8010553d: 8b 45 0c mov 0xc(%ebp),%eax 80105540: 8b 4d 08 mov 0x8(%ebp),%ecx 80105543: f0 87 02 lock xchg %eax,(%edx) 80105546: 89 45 fc mov %eax,-0x4(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 80105549: 8b 45 fc mov -0x4(%ebp),%eax } 8010554c: c9 leave 8010554d: c3 ret 8010554e <initlock>: #include "proc.h" #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { 8010554e: 55 push %ebp 8010554f: 89 e5 mov %esp,%ebp lk->name = name; 80105551: 8b 45 08 mov 0x8(%ebp),%eax 80105554: 8b 55 0c mov 0xc(%ebp),%edx 80105557: 89 50 04 mov %edx,0x4(%eax) lk->locked = 0; 8010555a: 8b 45 08 mov 0x8(%ebp),%eax 8010555d: c7 00 00 00 00 00 movl $0x0,(%eax) lk->cpu = 0; 80105563: 8b 45 08 mov 0x8(%ebp),%eax 80105566: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 8010556d: 90 nop 8010556e: 5d pop %ebp 8010556f: c3 ret 80105570 <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) { 80105570: 55 push %ebp 80105571: 89 e5 mov %esp,%ebp 80105573: 83 ec 08 sub $0x8,%esp pushcli(); // disable interrupts to avoid deadlock. 80105576: e8 52 01 00 00 call 801056cd <pushcli> if(holding(lk)) 8010557b: 8b 45 08 mov 0x8(%ebp),%eax 8010557e: 83 ec 0c sub $0xc,%esp 80105581: 50 push %eax 80105582: e8 1c 01 00 00 call 801056a3 <holding> 80105587: 83 c4 10 add $0x10,%esp 8010558a: 85 c0 test %eax,%eax 8010558c: 74 0d je 8010559b <acquire+0x2b> panic("acquire"); 8010558e: 83 ec 0c sub $0xc,%esp 80105591: 68 d9 90 10 80 push $0x801090d9 80105596: e8 cb af ff ff call 80100566 <panic> // The xchg is atomic. // It also serializes, so that reads after acquire are not // reordered before it. while(xchg(&lk->locked, 1) != 0) 8010559b: 90 nop 8010559c: 8b 45 08 mov 0x8(%ebp),%eax 8010559f: 83 ec 08 sub $0x8,%esp 801055a2: 6a 01 push $0x1 801055a4: 50 push %eax 801055a5: e8 8a ff ff ff call 80105534 <xchg> 801055aa: 83 c4 10 add $0x10,%esp 801055ad: 85 c0 test %eax,%eax 801055af: 75 eb jne 8010559c <acquire+0x2c> ; // Record info about lock acquisition for debugging. lk->cpu = cpu; 801055b1: 8b 45 08 mov 0x8(%ebp),%eax 801055b4: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 801055bb: 89 50 08 mov %edx,0x8(%eax) getcallerpcs(&lk, lk->pcs); 801055be: 8b 45 08 mov 0x8(%ebp),%eax 801055c1: 83 c0 0c add $0xc,%eax 801055c4: 83 ec 08 sub $0x8,%esp 801055c7: 50 push %eax 801055c8: 8d 45 08 lea 0x8(%ebp),%eax 801055cb: 50 push %eax 801055cc: e8 58 00 00 00 call 80105629 <getcallerpcs> 801055d1: 83 c4 10 add $0x10,%esp } 801055d4: 90 nop 801055d5: c9 leave 801055d6: c3 ret 801055d7 <release>: // Release the lock. void release(struct spinlock *lk) { 801055d7: 55 push %ebp 801055d8: 89 e5 mov %esp,%ebp 801055da: 83 ec 08 sub $0x8,%esp if(!holding(lk)) 801055dd: 83 ec 0c sub $0xc,%esp 801055e0: ff 75 08 pushl 0x8(%ebp) 801055e3: e8 bb 00 00 00 call 801056a3 <holding> 801055e8: 83 c4 10 add $0x10,%esp 801055eb: 85 c0 test %eax,%eax 801055ed: 75 0d jne 801055fc <release+0x25> panic("release"); 801055ef: 83 ec 0c sub $0xc,%esp 801055f2: 68 e1 90 10 80 push $0x801090e1 801055f7: e8 6a af ff ff call 80100566 <panic> lk->pcs[0] = 0; 801055fc: 8b 45 08 mov 0x8(%ebp),%eax 801055ff: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) lk->cpu = 0; 80105606: 8b 45 08 mov 0x8(%ebp),%eax 80105609: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) // But the 2007 Intel 64 Architecture Memory Ordering White // Paper says that Intel 64 and IA-32 will not move a load // after a store. So lock->locked = 0 would work here. // The xchg being asm volatile ensures gcc emits it after // the above assignments (and after the critical section). xchg(&lk->locked, 0); 80105610: 8b 45 08 mov 0x8(%ebp),%eax 80105613: 83 ec 08 sub $0x8,%esp 80105616: 6a 00 push $0x0 80105618: 50 push %eax 80105619: e8 16 ff ff ff call 80105534 <xchg> 8010561e: 83 c4 10 add $0x10,%esp popcli(); 80105621: e8 ec 00 00 00 call 80105712 <popcli> } 80105626: 90 nop 80105627: c9 leave 80105628: c3 ret 80105629 <getcallerpcs>: // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 80105629: 55 push %ebp 8010562a: 89 e5 mov %esp,%ebp 8010562c: 83 ec 10 sub $0x10,%esp uint *ebp; int i; ebp = (uint*)v - 2; 8010562f: 8b 45 08 mov 0x8(%ebp),%eax 80105632: 83 e8 08 sub $0x8,%eax 80105635: 89 45 fc mov %eax,-0x4(%ebp) for(i = 0; i < 10; i++){ 80105638: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp) 8010563f: eb 38 jmp 80105679 <getcallerpcs+0x50> if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) 80105641: 83 7d fc 00 cmpl $0x0,-0x4(%ebp) 80105645: 74 53 je 8010569a <getcallerpcs+0x71> 80105647: 81 7d fc ff ff ff 7f cmpl $0x7fffffff,-0x4(%ebp) 8010564e: 76 4a jbe 8010569a <getcallerpcs+0x71> 80105650: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp) 80105654: 74 44 je 8010569a <getcallerpcs+0x71> break; pcs[i] = ebp[1]; // saved %eip 80105656: 8b 45 f8 mov -0x8(%ebp),%eax 80105659: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80105660: 8b 45 0c mov 0xc(%ebp),%eax 80105663: 01 c2 add %eax,%edx 80105665: 8b 45 fc mov -0x4(%ebp),%eax 80105668: 8b 40 04 mov 0x4(%eax),%eax 8010566b: 89 02 mov %eax,(%edx) ebp = (uint*)ebp[0]; // saved %ebp 8010566d: 8b 45 fc mov -0x4(%ebp),%eax 80105670: 8b 00 mov (%eax),%eax 80105672: 89 45 fc mov %eax,-0x4(%ebp) { uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 80105675: 83 45 f8 01 addl $0x1,-0x8(%ebp) 80105679: 83 7d f8 09 cmpl $0x9,-0x8(%ebp) 8010567d: 7e c2 jle 80105641 <getcallerpcs+0x18> if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) 8010567f: eb 19 jmp 8010569a <getcallerpcs+0x71> pcs[i] = 0; 80105681: 8b 45 f8 mov -0x8(%ebp),%eax 80105684: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 8010568b: 8b 45 0c mov 0xc(%ebp),%eax 8010568e: 01 d0 add %edx,%eax 80105690: c7 00 00 00 00 00 movl $0x0,(%eax) if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) 80105696: 83 45 f8 01 addl $0x1,-0x8(%ebp) 8010569a: 83 7d f8 09 cmpl $0x9,-0x8(%ebp) 8010569e: 7e e1 jle 80105681 <getcallerpcs+0x58> pcs[i] = 0; } 801056a0: 90 nop 801056a1: c9 leave 801056a2: c3 ret 801056a3 <holding>: // Check whether this cpu is holding the lock. int holding(struct spinlock *lock) { 801056a3: 55 push %ebp 801056a4: 89 e5 mov %esp,%ebp return lock->locked && lock->cpu == cpu; 801056a6: 8b 45 08 mov 0x8(%ebp),%eax 801056a9: 8b 00 mov (%eax),%eax 801056ab: 85 c0 test %eax,%eax 801056ad: 74 17 je 801056c6 <holding+0x23> 801056af: 8b 45 08 mov 0x8(%ebp),%eax 801056b2: 8b 50 08 mov 0x8(%eax),%edx 801056b5: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801056bb: 39 c2 cmp %eax,%edx 801056bd: 75 07 jne 801056c6 <holding+0x23> 801056bf: b8 01 00 00 00 mov $0x1,%eax 801056c4: eb 05 jmp 801056cb <holding+0x28> 801056c6: b8 00 00 00 00 mov $0x0,%eax } 801056cb: 5d pop %ebp 801056cc: c3 ret 801056cd <pushcli>: // it takes two popcli to undo two pushcli. Also, if interrupts // are off, then pushcli, popcli leaves them off. void pushcli(void) { 801056cd: 55 push %ebp 801056ce: 89 e5 mov %esp,%ebp 801056d0: 83 ec 10 sub $0x10,%esp int eflags; eflags = readeflags(); 801056d3: e8 3e fe ff ff call 80105516 <readeflags> 801056d8: 89 45 fc mov %eax,-0x4(%ebp) cli(); 801056db: e8 46 fe ff ff call 80105526 <cli> if(cpu->ncli++ == 0) 801056e0: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 801056e7: 8b 82 ac 00 00 00 mov 0xac(%edx),%eax 801056ed: 8d 48 01 lea 0x1(%eax),%ecx 801056f0: 89 8a ac 00 00 00 mov %ecx,0xac(%edx) 801056f6: 85 c0 test %eax,%eax 801056f8: 75 15 jne 8010570f <pushcli+0x42> cpu->intena = eflags & FL_IF; 801056fa: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105700: 8b 55 fc mov -0x4(%ebp),%edx 80105703: 81 e2 00 02 00 00 and $0x200,%edx 80105709: 89 90 b0 00 00 00 mov %edx,0xb0(%eax) } 8010570f: 90 nop 80105710: c9 leave 80105711: c3 ret 80105712 <popcli>: void popcli(void) { 80105712: 55 push %ebp 80105713: 89 e5 mov %esp,%ebp 80105715: 83 ec 08 sub $0x8,%esp if(readeflags()&FL_IF) 80105718: e8 f9 fd ff ff call 80105516 <readeflags> 8010571d: 25 00 02 00 00 and $0x200,%eax 80105722: 85 c0 test %eax,%eax 80105724: 74 0d je 80105733 <popcli+0x21> panic("popcli - interruptible"); 80105726: 83 ec 0c sub $0xc,%esp 80105729: 68 e9 90 10 80 push $0x801090e9 8010572e: e8 33 ae ff ff call 80100566 <panic> if(--cpu->ncli < 0) 80105733: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105739: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx 8010573f: 83 ea 01 sub $0x1,%edx 80105742: 89 90 ac 00 00 00 mov %edx,0xac(%eax) 80105748: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax 8010574e: 85 c0 test %eax,%eax 80105750: 79 0d jns 8010575f <popcli+0x4d> panic("popcli"); 80105752: 83 ec 0c sub $0xc,%esp 80105755: 68 00 91 10 80 push $0x80109100 8010575a: e8 07 ae ff ff call 80100566 <panic> if(cpu->ncli == 0 && cpu->intena) 8010575f: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105765: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax 8010576b: 85 c0 test %eax,%eax 8010576d: 75 15 jne 80105784 <popcli+0x72> 8010576f: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105775: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax 8010577b: 85 c0 test %eax,%eax 8010577d: 74 05 je 80105784 <popcli+0x72> sti(); 8010577f: e8 a9 fd ff ff call 8010552d <sti> } 80105784: 90 nop 80105785: c9 leave 80105786: c3 ret 80105787 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 80105787: 55 push %ebp 80105788: 89 e5 mov %esp,%ebp 8010578a: 57 push %edi 8010578b: 53 push %ebx asm volatile("cld; rep stosb" : 8010578c: 8b 4d 08 mov 0x8(%ebp),%ecx 8010578f: 8b 55 10 mov 0x10(%ebp),%edx 80105792: 8b 45 0c mov 0xc(%ebp),%eax 80105795: 89 cb mov %ecx,%ebx 80105797: 89 df mov %ebx,%edi 80105799: 89 d1 mov %edx,%ecx 8010579b: fc cld 8010579c: f3 aa rep stos %al,%es:(%edi) 8010579e: 89 ca mov %ecx,%edx 801057a0: 89 fb mov %edi,%ebx 801057a2: 89 5d 08 mov %ebx,0x8(%ebp) 801057a5: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 801057a8: 90 nop 801057a9: 5b pop %ebx 801057aa: 5f pop %edi 801057ab: 5d pop %ebp 801057ac: c3 ret 801057ad <stosl>: static inline void stosl(void *addr, int data, int cnt) { 801057ad: 55 push %ebp 801057ae: 89 e5 mov %esp,%ebp 801057b0: 57 push %edi 801057b1: 53 push %ebx asm volatile("cld; rep stosl" : 801057b2: 8b 4d 08 mov 0x8(%ebp),%ecx 801057b5: 8b 55 10 mov 0x10(%ebp),%edx 801057b8: 8b 45 0c mov 0xc(%ebp),%eax 801057bb: 89 cb mov %ecx,%ebx 801057bd: 89 df mov %ebx,%edi 801057bf: 89 d1 mov %edx,%ecx 801057c1: fc cld 801057c2: f3 ab rep stos %eax,%es:(%edi) 801057c4: 89 ca mov %ecx,%edx 801057c6: 89 fb mov %edi,%ebx 801057c8: 89 5d 08 mov %ebx,0x8(%ebp) 801057cb: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 801057ce: 90 nop 801057cf: 5b pop %ebx 801057d0: 5f pop %edi 801057d1: 5d pop %ebp 801057d2: c3 ret 801057d3 <memset>: #include "types.h" #include "x86.h" void* memset(void *dst, int c, uint n) { 801057d3: 55 push %ebp 801057d4: 89 e5 mov %esp,%ebp if ((int)dst%4 == 0 && n%4 == 0){ 801057d6: 8b 45 08 mov 0x8(%ebp),%eax 801057d9: 83 e0 03 and $0x3,%eax 801057dc: 85 c0 test %eax,%eax 801057de: 75 43 jne 80105823 <memset+0x50> 801057e0: 8b 45 10 mov 0x10(%ebp),%eax 801057e3: 83 e0 03 and $0x3,%eax 801057e6: 85 c0 test %eax,%eax 801057e8: 75 39 jne 80105823 <memset+0x50> c &= 0xFF; 801057ea: 81 65 0c ff 00 00 00 andl $0xff,0xc(%ebp) stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); 801057f1: 8b 45 10 mov 0x10(%ebp),%eax 801057f4: c1 e8 02 shr $0x2,%eax 801057f7: 89 c1 mov %eax,%ecx 801057f9: 8b 45 0c mov 0xc(%ebp),%eax 801057fc: c1 e0 18 shl $0x18,%eax 801057ff: 89 c2 mov %eax,%edx 80105801: 8b 45 0c mov 0xc(%ebp),%eax 80105804: c1 e0 10 shl $0x10,%eax 80105807: 09 c2 or %eax,%edx 80105809: 8b 45 0c mov 0xc(%ebp),%eax 8010580c: c1 e0 08 shl $0x8,%eax 8010580f: 09 d0 or %edx,%eax 80105811: 0b 45 0c or 0xc(%ebp),%eax 80105814: 51 push %ecx 80105815: 50 push %eax 80105816: ff 75 08 pushl 0x8(%ebp) 80105819: e8 8f ff ff ff call 801057ad <stosl> 8010581e: 83 c4 0c add $0xc,%esp 80105821: eb 12 jmp 80105835 <memset+0x62> } else stosb(dst, c, n); 80105823: 8b 45 10 mov 0x10(%ebp),%eax 80105826: 50 push %eax 80105827: ff 75 0c pushl 0xc(%ebp) 8010582a: ff 75 08 pushl 0x8(%ebp) 8010582d: e8 55 ff ff ff call 80105787 <stosb> 80105832: 83 c4 0c add $0xc,%esp return dst; 80105835: 8b 45 08 mov 0x8(%ebp),%eax } 80105838: c9 leave 80105839: c3 ret 8010583a <memcmp>: int memcmp(const void *v1, const void *v2, uint n) { 8010583a: 55 push %ebp 8010583b: 89 e5 mov %esp,%ebp 8010583d: 83 ec 10 sub $0x10,%esp const uchar *s1, *s2; s1 = v1; 80105840: 8b 45 08 mov 0x8(%ebp),%eax 80105843: 89 45 fc mov %eax,-0x4(%ebp) s2 = v2; 80105846: 8b 45 0c mov 0xc(%ebp),%eax 80105849: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0){ 8010584c: eb 30 jmp 8010587e <memcmp+0x44> if(*s1 != *s2) 8010584e: 8b 45 fc mov -0x4(%ebp),%eax 80105851: 0f b6 10 movzbl (%eax),%edx 80105854: 8b 45 f8 mov -0x8(%ebp),%eax 80105857: 0f b6 00 movzbl (%eax),%eax 8010585a: 38 c2 cmp %al,%dl 8010585c: 74 18 je 80105876 <memcmp+0x3c> return *s1 - *s2; 8010585e: 8b 45 fc mov -0x4(%ebp),%eax 80105861: 0f b6 00 movzbl (%eax),%eax 80105864: 0f b6 d0 movzbl %al,%edx 80105867: 8b 45 f8 mov -0x8(%ebp),%eax 8010586a: 0f b6 00 movzbl (%eax),%eax 8010586d: 0f b6 c0 movzbl %al,%eax 80105870: 29 c2 sub %eax,%edx 80105872: 89 d0 mov %edx,%eax 80105874: eb 1a jmp 80105890 <memcmp+0x56> s1++, s2++; 80105876: 83 45 fc 01 addl $0x1,-0x4(%ebp) 8010587a: 83 45 f8 01 addl $0x1,-0x8(%ebp) { const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ 8010587e: 8b 45 10 mov 0x10(%ebp),%eax 80105881: 8d 50 ff lea -0x1(%eax),%edx 80105884: 89 55 10 mov %edx,0x10(%ebp) 80105887: 85 c0 test %eax,%eax 80105889: 75 c3 jne 8010584e <memcmp+0x14> if(*s1 != *s2) return *s1 - *s2; s1++, s2++; } return 0; 8010588b: b8 00 00 00 00 mov $0x0,%eax } 80105890: c9 leave 80105891: c3 ret 80105892 <memmove>: void* memmove(void *dst, const void *src, uint n) { 80105892: 55 push %ebp 80105893: 89 e5 mov %esp,%ebp 80105895: 83 ec 10 sub $0x10,%esp const char *s; char *d; s = src; 80105898: 8b 45 0c mov 0xc(%ebp),%eax 8010589b: 89 45 fc mov %eax,-0x4(%ebp) d = dst; 8010589e: 8b 45 08 mov 0x8(%ebp),%eax 801058a1: 89 45 f8 mov %eax,-0x8(%ebp) if(s < d && s + n > d){ 801058a4: 8b 45 fc mov -0x4(%ebp),%eax 801058a7: 3b 45 f8 cmp -0x8(%ebp),%eax 801058aa: 73 54 jae 80105900 <memmove+0x6e> 801058ac: 8b 55 fc mov -0x4(%ebp),%edx 801058af: 8b 45 10 mov 0x10(%ebp),%eax 801058b2: 01 d0 add %edx,%eax 801058b4: 3b 45 f8 cmp -0x8(%ebp),%eax 801058b7: 76 47 jbe 80105900 <memmove+0x6e> s += n; 801058b9: 8b 45 10 mov 0x10(%ebp),%eax 801058bc: 01 45 fc add %eax,-0x4(%ebp) d += n; 801058bf: 8b 45 10 mov 0x10(%ebp),%eax 801058c2: 01 45 f8 add %eax,-0x8(%ebp) while(n-- > 0) 801058c5: eb 13 jmp 801058da <memmove+0x48> *--d = *--s; 801058c7: 83 6d f8 01 subl $0x1,-0x8(%ebp) 801058cb: 83 6d fc 01 subl $0x1,-0x4(%ebp) 801058cf: 8b 45 fc mov -0x4(%ebp),%eax 801058d2: 0f b6 10 movzbl (%eax),%edx 801058d5: 8b 45 f8 mov -0x8(%ebp),%eax 801058d8: 88 10 mov %dl,(%eax) s = src; d = dst; if(s < d && s + n > d){ s += n; d += n; while(n-- > 0) 801058da: 8b 45 10 mov 0x10(%ebp),%eax 801058dd: 8d 50 ff lea -0x1(%eax),%edx 801058e0: 89 55 10 mov %edx,0x10(%ebp) 801058e3: 85 c0 test %eax,%eax 801058e5: 75 e0 jne 801058c7 <memmove+0x35> const char *s; char *d; s = src; d = dst; if(s < d && s + n > d){ 801058e7: eb 24 jmp 8010590d <memmove+0x7b> d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) *d++ = *s++; 801058e9: 8b 45 f8 mov -0x8(%ebp),%eax 801058ec: 8d 50 01 lea 0x1(%eax),%edx 801058ef: 89 55 f8 mov %edx,-0x8(%ebp) 801058f2: 8b 55 fc mov -0x4(%ebp),%edx 801058f5: 8d 4a 01 lea 0x1(%edx),%ecx 801058f8: 89 4d fc mov %ecx,-0x4(%ebp) 801058fb: 0f b6 12 movzbl (%edx),%edx 801058fe: 88 10 mov %dl,(%eax) s += n; d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) 80105900: 8b 45 10 mov 0x10(%ebp),%eax 80105903: 8d 50 ff lea -0x1(%eax),%edx 80105906: 89 55 10 mov %edx,0x10(%ebp) 80105909: 85 c0 test %eax,%eax 8010590b: 75 dc jne 801058e9 <memmove+0x57> *d++ = *s++; return dst; 8010590d: 8b 45 08 mov 0x8(%ebp),%eax } 80105910: c9 leave 80105911: c3 ret 80105912 <memcpy>: // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { 80105912: 55 push %ebp 80105913: 89 e5 mov %esp,%ebp return memmove(dst, src, n); 80105915: ff 75 10 pushl 0x10(%ebp) 80105918: ff 75 0c pushl 0xc(%ebp) 8010591b: ff 75 08 pushl 0x8(%ebp) 8010591e: e8 6f ff ff ff call 80105892 <memmove> 80105923: 83 c4 0c add $0xc,%esp } 80105926: c9 leave 80105927: c3 ret 80105928 <strncmp>: int strncmp(const char *p, const char *q, uint n) { 80105928: 55 push %ebp 80105929: 89 e5 mov %esp,%ebp while(n > 0 && *p && *p == *q) 8010592b: eb 0c jmp 80105939 <strncmp+0x11> n--, p++, q++; 8010592d: 83 6d 10 01 subl $0x1,0x10(%ebp) 80105931: 83 45 08 01 addl $0x1,0x8(%ebp) 80105935: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strncmp(const char *p, const char *q, uint n) { while(n > 0 && *p && *p == *q) 80105939: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8010593d: 74 1a je 80105959 <strncmp+0x31> 8010593f: 8b 45 08 mov 0x8(%ebp),%eax 80105942: 0f b6 00 movzbl (%eax),%eax 80105945: 84 c0 test %al,%al 80105947: 74 10 je 80105959 <strncmp+0x31> 80105949: 8b 45 08 mov 0x8(%ebp),%eax 8010594c: 0f b6 10 movzbl (%eax),%edx 8010594f: 8b 45 0c mov 0xc(%ebp),%eax 80105952: 0f b6 00 movzbl (%eax),%eax 80105955: 38 c2 cmp %al,%dl 80105957: 74 d4 je 8010592d <strncmp+0x5> n--, p++, q++; if(n == 0) 80105959: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8010595d: 75 07 jne 80105966 <strncmp+0x3e> return 0; 8010595f: b8 00 00 00 00 mov $0x0,%eax 80105964: eb 16 jmp 8010597c <strncmp+0x54> return (uchar)*p - (uchar)*q; 80105966: 8b 45 08 mov 0x8(%ebp),%eax 80105969: 0f b6 00 movzbl (%eax),%eax 8010596c: 0f b6 d0 movzbl %al,%edx 8010596f: 8b 45 0c mov 0xc(%ebp),%eax 80105972: 0f b6 00 movzbl (%eax),%eax 80105975: 0f b6 c0 movzbl %al,%eax 80105978: 29 c2 sub %eax,%edx 8010597a: 89 d0 mov %edx,%eax } 8010597c: 5d pop %ebp 8010597d: c3 ret 8010597e <strncpy>: char* strncpy(char *s, const char *t, int n) { 8010597e: 55 push %ebp 8010597f: 89 e5 mov %esp,%ebp 80105981: 83 ec 10 sub $0x10,%esp char *os; os = s; 80105984: 8b 45 08 mov 0x8(%ebp),%eax 80105987: 89 45 fc mov %eax,-0x4(%ebp) while(n-- > 0 && (*s++ = *t++) != 0) 8010598a: 90 nop 8010598b: 8b 45 10 mov 0x10(%ebp),%eax 8010598e: 8d 50 ff lea -0x1(%eax),%edx 80105991: 89 55 10 mov %edx,0x10(%ebp) 80105994: 85 c0 test %eax,%eax 80105996: 7e 2c jle 801059c4 <strncpy+0x46> 80105998: 8b 45 08 mov 0x8(%ebp),%eax 8010599b: 8d 50 01 lea 0x1(%eax),%edx 8010599e: 89 55 08 mov %edx,0x8(%ebp) 801059a1: 8b 55 0c mov 0xc(%ebp),%edx 801059a4: 8d 4a 01 lea 0x1(%edx),%ecx 801059a7: 89 4d 0c mov %ecx,0xc(%ebp) 801059aa: 0f b6 12 movzbl (%edx),%edx 801059ad: 88 10 mov %dl,(%eax) 801059af: 0f b6 00 movzbl (%eax),%eax 801059b2: 84 c0 test %al,%al 801059b4: 75 d5 jne 8010598b <strncpy+0xd> ; while(n-- > 0) 801059b6: eb 0c jmp 801059c4 <strncpy+0x46> *s++ = 0; 801059b8: 8b 45 08 mov 0x8(%ebp),%eax 801059bb: 8d 50 01 lea 0x1(%eax),%edx 801059be: 89 55 08 mov %edx,0x8(%ebp) 801059c1: c6 00 00 movb $0x0,(%eax) char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) ; while(n-- > 0) 801059c4: 8b 45 10 mov 0x10(%ebp),%eax 801059c7: 8d 50 ff lea -0x1(%eax),%edx 801059ca: 89 55 10 mov %edx,0x10(%ebp) 801059cd: 85 c0 test %eax,%eax 801059cf: 7f e7 jg 801059b8 <strncpy+0x3a> *s++ = 0; return os; 801059d1: 8b 45 fc mov -0x4(%ebp),%eax } 801059d4: c9 leave 801059d5: c3 ret 801059d6 <safestrcpy>: // Like strncpy but guaranteed to NUL-terminate. char* safestrcpy(char *s, const char *t, int n) { 801059d6: 55 push %ebp 801059d7: 89 e5 mov %esp,%ebp 801059d9: 83 ec 10 sub $0x10,%esp char *os; os = s; 801059dc: 8b 45 08 mov 0x8(%ebp),%eax 801059df: 89 45 fc mov %eax,-0x4(%ebp) if(n <= 0) 801059e2: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 801059e6: 7f 05 jg 801059ed <safestrcpy+0x17> return os; 801059e8: 8b 45 fc mov -0x4(%ebp),%eax 801059eb: eb 31 jmp 80105a1e <safestrcpy+0x48> while(--n > 0 && (*s++ = *t++) != 0) 801059ed: 83 6d 10 01 subl $0x1,0x10(%ebp) 801059f1: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 801059f5: 7e 1e jle 80105a15 <safestrcpy+0x3f> 801059f7: 8b 45 08 mov 0x8(%ebp),%eax 801059fa: 8d 50 01 lea 0x1(%eax),%edx 801059fd: 89 55 08 mov %edx,0x8(%ebp) 80105a00: 8b 55 0c mov 0xc(%ebp),%edx 80105a03: 8d 4a 01 lea 0x1(%edx),%ecx 80105a06: 89 4d 0c mov %ecx,0xc(%ebp) 80105a09: 0f b6 12 movzbl (%edx),%edx 80105a0c: 88 10 mov %dl,(%eax) 80105a0e: 0f b6 00 movzbl (%eax),%eax 80105a11: 84 c0 test %al,%al 80105a13: 75 d8 jne 801059ed <safestrcpy+0x17> ; *s = 0; 80105a15: 8b 45 08 mov 0x8(%ebp),%eax 80105a18: c6 00 00 movb $0x0,(%eax) return os; 80105a1b: 8b 45 fc mov -0x4(%ebp),%eax } 80105a1e: c9 leave 80105a1f: c3 ret 80105a20 <strlen>: int strlen(const char *s) { 80105a20: 55 push %ebp 80105a21: 89 e5 mov %esp,%ebp 80105a23: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 80105a26: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 80105a2d: eb 04 jmp 80105a33 <strlen+0x13> 80105a2f: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80105a33: 8b 55 fc mov -0x4(%ebp),%edx 80105a36: 8b 45 08 mov 0x8(%ebp),%eax 80105a39: 01 d0 add %edx,%eax 80105a3b: 0f b6 00 movzbl (%eax),%eax 80105a3e: 84 c0 test %al,%al 80105a40: 75 ed jne 80105a2f <strlen+0xf> ; return n; 80105a42: 8b 45 fc mov -0x4(%ebp),%eax } 80105a45: c9 leave 80105a46: c3 ret 80105a47 <swtch>: # Save current register context in old # and then load register context from new. .globl swtch swtch: movl 4(%esp), %eax 80105a47: 8b 44 24 04 mov 0x4(%esp),%eax movl 8(%esp), %edx 80105a4b: 8b 54 24 08 mov 0x8(%esp),%edx # Save old callee-save registers pushl %ebp 80105a4f: 55 push %ebp pushl %ebx 80105a50: 53 push %ebx pushl %esi 80105a51: 56 push %esi pushl %edi 80105a52: 57 push %edi # Switch stacks movl %esp, (%eax) 80105a53: 89 20 mov %esp,(%eax) movl %edx, %esp 80105a55: 89 d4 mov %edx,%esp # Load new callee-save registers popl %edi 80105a57: 5f pop %edi popl %esi 80105a58: 5e pop %esi popl %ebx 80105a59: 5b pop %ebx popl %ebp 80105a5a: 5d pop %ebp ret 80105a5b: c3 ret 80105a5c <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) { 80105a5c: 55 push %ebp 80105a5d: 89 e5 mov %esp,%ebp if(addr >= proc->sz || addr+4 > proc->sz) 80105a5f: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105a65: 8b 00 mov (%eax),%eax 80105a67: 3b 45 08 cmp 0x8(%ebp),%eax 80105a6a: 76 12 jbe 80105a7e <fetchint+0x22> 80105a6c: 8b 45 08 mov 0x8(%ebp),%eax 80105a6f: 8d 50 04 lea 0x4(%eax),%edx 80105a72: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105a78: 8b 00 mov (%eax),%eax 80105a7a: 39 c2 cmp %eax,%edx 80105a7c: 76 07 jbe 80105a85 <fetchint+0x29> return -1; 80105a7e: b8 ff ff ff ff mov $0xffffffff,%eax 80105a83: eb 0f jmp 80105a94 <fetchint+0x38> *ip = *(int*)(addr); 80105a85: 8b 45 08 mov 0x8(%ebp),%eax 80105a88: 8b 10 mov (%eax),%edx 80105a8a: 8b 45 0c mov 0xc(%ebp),%eax 80105a8d: 89 10 mov %edx,(%eax) return 0; 80105a8f: b8 00 00 00 00 mov $0x0,%eax } 80105a94: 5d pop %ebp 80105a95: c3 ret 80105a96 <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) { 80105a96: 55 push %ebp 80105a97: 89 e5 mov %esp,%ebp 80105a99: 83 ec 10 sub $0x10,%esp char *s, *ep; if(addr >= proc->sz) 80105a9c: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105aa2: 8b 00 mov (%eax),%eax 80105aa4: 3b 45 08 cmp 0x8(%ebp),%eax 80105aa7: 77 07 ja 80105ab0 <fetchstr+0x1a> return -1; 80105aa9: b8 ff ff ff ff mov $0xffffffff,%eax 80105aae: eb 46 jmp 80105af6 <fetchstr+0x60> *pp = (char*)addr; 80105ab0: 8b 55 08 mov 0x8(%ebp),%edx 80105ab3: 8b 45 0c mov 0xc(%ebp),%eax 80105ab6: 89 10 mov %edx,(%eax) ep = (char*)proc->sz; 80105ab8: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105abe: 8b 00 mov (%eax),%eax 80105ac0: 89 45 f8 mov %eax,-0x8(%ebp) for(s = *pp; s < ep; s++) 80105ac3: 8b 45 0c mov 0xc(%ebp),%eax 80105ac6: 8b 00 mov (%eax),%eax 80105ac8: 89 45 fc mov %eax,-0x4(%ebp) 80105acb: eb 1c jmp 80105ae9 <fetchstr+0x53> if(*s == 0) 80105acd: 8b 45 fc mov -0x4(%ebp),%eax 80105ad0: 0f b6 00 movzbl (%eax),%eax 80105ad3: 84 c0 test %al,%al 80105ad5: 75 0e jne 80105ae5 <fetchstr+0x4f> return s - *pp; 80105ad7: 8b 55 fc mov -0x4(%ebp),%edx 80105ada: 8b 45 0c mov 0xc(%ebp),%eax 80105add: 8b 00 mov (%eax),%eax 80105adf: 29 c2 sub %eax,%edx 80105ae1: 89 d0 mov %edx,%eax 80105ae3: eb 11 jmp 80105af6 <fetchstr+0x60> if(addr >= proc->sz) return -1; *pp = (char*)addr; ep = (char*)proc->sz; for(s = *pp; s < ep; s++) 80105ae5: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80105ae9: 8b 45 fc mov -0x4(%ebp),%eax 80105aec: 3b 45 f8 cmp -0x8(%ebp),%eax 80105aef: 72 dc jb 80105acd <fetchstr+0x37> if(*s == 0) return s - *pp; return -1; 80105af1: b8 ff ff ff ff mov $0xffffffff,%eax } 80105af6: c9 leave 80105af7: c3 ret 80105af8 <argint>: // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { 80105af8: 55 push %ebp 80105af9: 89 e5 mov %esp,%ebp return fetchint(proc->tf->esp + 4 + 4*n, ip); 80105afb: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105b01: 8b 40 18 mov 0x18(%eax),%eax 80105b04: 8b 40 44 mov 0x44(%eax),%eax 80105b07: 8b 55 08 mov 0x8(%ebp),%edx 80105b0a: c1 e2 02 shl $0x2,%edx 80105b0d: 01 d0 add %edx,%eax 80105b0f: 83 c0 04 add $0x4,%eax 80105b12: ff 75 0c pushl 0xc(%ebp) 80105b15: 50 push %eax 80105b16: e8 41 ff ff ff call 80105a5c <fetchint> 80105b1b: 83 c4 08 add $0x8,%esp } 80105b1e: c9 leave 80105b1f: c3 ret 80105b20 <argptr>: // Fetch the nth word-sized system call argument as a pointer // to a block of memory of size n bytes. Check that the pointer // lies within the process address space. int argptr(int n, char **pp, int size) { 80105b20: 55 push %ebp 80105b21: 89 e5 mov %esp,%ebp 80105b23: 83 ec 10 sub $0x10,%esp int i; if(argint(n, &i) < 0) 80105b26: 8d 45 fc lea -0x4(%ebp),%eax 80105b29: 50 push %eax 80105b2a: ff 75 08 pushl 0x8(%ebp) 80105b2d: e8 c6 ff ff ff call 80105af8 <argint> 80105b32: 83 c4 08 add $0x8,%esp 80105b35: 85 c0 test %eax,%eax 80105b37: 79 07 jns 80105b40 <argptr+0x20> return -1; 80105b39: b8 ff ff ff ff mov $0xffffffff,%eax 80105b3e: eb 3b jmp 80105b7b <argptr+0x5b> if((uint)i >= proc->sz || (uint)i+size > proc->sz) 80105b40: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105b46: 8b 00 mov (%eax),%eax 80105b48: 8b 55 fc mov -0x4(%ebp),%edx 80105b4b: 39 d0 cmp %edx,%eax 80105b4d: 76 16 jbe 80105b65 <argptr+0x45> 80105b4f: 8b 45 fc mov -0x4(%ebp),%eax 80105b52: 89 c2 mov %eax,%edx 80105b54: 8b 45 10 mov 0x10(%ebp),%eax 80105b57: 01 c2 add %eax,%edx 80105b59: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105b5f: 8b 00 mov (%eax),%eax 80105b61: 39 c2 cmp %eax,%edx 80105b63: 76 07 jbe 80105b6c <argptr+0x4c> return -1; 80105b65: b8 ff ff ff ff mov $0xffffffff,%eax 80105b6a: eb 0f jmp 80105b7b <argptr+0x5b> *pp = (char*)i; 80105b6c: 8b 45 fc mov -0x4(%ebp),%eax 80105b6f: 89 c2 mov %eax,%edx 80105b71: 8b 45 0c mov 0xc(%ebp),%eax 80105b74: 89 10 mov %edx,(%eax) return 0; 80105b76: b8 00 00 00 00 mov $0x0,%eax } 80105b7b: c9 leave 80105b7c: c3 ret 80105b7d <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) { 80105b7d: 55 push %ebp 80105b7e: 89 e5 mov %esp,%ebp 80105b80: 83 ec 10 sub $0x10,%esp int addr; if(argint(n, &addr) < 0) 80105b83: 8d 45 fc lea -0x4(%ebp),%eax 80105b86: 50 push %eax 80105b87: ff 75 08 pushl 0x8(%ebp) 80105b8a: e8 69 ff ff ff call 80105af8 <argint> 80105b8f: 83 c4 08 add $0x8,%esp 80105b92: 85 c0 test %eax,%eax 80105b94: 79 07 jns 80105b9d <argstr+0x20> return -1; 80105b96: b8 ff ff ff ff mov $0xffffffff,%eax 80105b9b: eb 0f jmp 80105bac <argstr+0x2f> return fetchstr(addr, pp); 80105b9d: 8b 45 fc mov -0x4(%ebp),%eax 80105ba0: ff 75 0c pushl 0xc(%ebp) 80105ba3: 50 push %eax 80105ba4: e8 ed fe ff ff call 80105a96 <fetchstr> 80105ba9: 83 c4 08 add $0x8,%esp } 80105bac: c9 leave 80105bad: c3 ret 80105bae <syscall>: [SYS_clone] sys_clone, }; void syscall(void) { 80105bae: 55 push %ebp 80105baf: 89 e5 mov %esp,%ebp 80105bb1: 53 push %ebx 80105bb2: 83 ec 14 sub $0x14,%esp int num; num = proc->tf->eax; 80105bb5: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105bbb: 8b 40 18 mov 0x18(%eax),%eax 80105bbe: 8b 40 1c mov 0x1c(%eax),%eax 80105bc1: 89 45 f4 mov %eax,-0xc(%ebp) if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { 80105bc4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80105bc8: 7e 30 jle 80105bfa <syscall+0x4c> 80105bca: 8b 45 f4 mov -0xc(%ebp),%eax 80105bcd: 83 f8 1b cmp $0x1b,%eax 80105bd0: 77 28 ja 80105bfa <syscall+0x4c> 80105bd2: 8b 45 f4 mov -0xc(%ebp),%eax 80105bd5: 8b 04 85 40 c0 10 80 mov -0x7fef3fc0(,%eax,4),%eax 80105bdc: 85 c0 test %eax,%eax 80105bde: 74 1a je 80105bfa <syscall+0x4c> proc->tf->eax = syscalls[num](); 80105be0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105be6: 8b 58 18 mov 0x18(%eax),%ebx 80105be9: 8b 45 f4 mov -0xc(%ebp),%eax 80105bec: 8b 04 85 40 c0 10 80 mov -0x7fef3fc0(,%eax,4),%eax 80105bf3: ff d0 call *%eax 80105bf5: 89 43 1c mov %eax,0x1c(%ebx) 80105bf8: eb 34 jmp 80105c2e <syscall+0x80> } else { cprintf("%d %s: unknown sys call %d\n", proc->pid, proc->name, num); 80105bfa: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105c00: 8d 50 6c lea 0x6c(%eax),%edx 80105c03: 65 a1 04 00 00 00 mov %gs:0x4,%eax num = proc->tf->eax; if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { proc->tf->eax = syscalls[num](); } else { cprintf("%d %s: unknown sys call %d\n", 80105c09: 8b 40 10 mov 0x10(%eax),%eax 80105c0c: ff 75 f4 pushl -0xc(%ebp) 80105c0f: 52 push %edx 80105c10: 50 push %eax 80105c11: 68 07 91 10 80 push $0x80109107 80105c16: e8 ab a7 ff ff call 801003c6 <cprintf> 80105c1b: 83 c4 10 add $0x10,%esp proc->pid, proc->name, num); proc->tf->eax = -1; 80105c1e: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105c24: 8b 40 18 mov 0x18(%eax),%eax 80105c27: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) } } 80105c2e: 90 nop 80105c2f: 8b 5d fc mov -0x4(%ebp),%ebx 80105c32: c9 leave 80105c33: c3 ret 80105c34 <argfd>: // Fetch the nth word-sized system call argument as a file descriptor // and return both the descriptor and the corresponding struct file. static int argfd(int n, int *pfd, struct file **pf) { 80105c34: 55 push %ebp 80105c35: 89 e5 mov %esp,%ebp 80105c37: 83 ec 18 sub $0x18,%esp int fd; struct file *f; if(argint(n, &fd) < 0) 80105c3a: 83 ec 08 sub $0x8,%esp 80105c3d: 8d 45 f0 lea -0x10(%ebp),%eax 80105c40: 50 push %eax 80105c41: ff 75 08 pushl 0x8(%ebp) 80105c44: e8 af fe ff ff call 80105af8 <argint> 80105c49: 83 c4 10 add $0x10,%esp 80105c4c: 85 c0 test %eax,%eax 80105c4e: 79 07 jns 80105c57 <argfd+0x23> return -1; 80105c50: b8 ff ff ff ff mov $0xffffffff,%eax 80105c55: eb 50 jmp 80105ca7 <argfd+0x73> if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0) 80105c57: 8b 45 f0 mov -0x10(%ebp),%eax 80105c5a: 85 c0 test %eax,%eax 80105c5c: 78 21 js 80105c7f <argfd+0x4b> 80105c5e: 8b 45 f0 mov -0x10(%ebp),%eax 80105c61: 83 f8 0f cmp $0xf,%eax 80105c64: 7f 19 jg 80105c7f <argfd+0x4b> 80105c66: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105c6c: 8b 55 f0 mov -0x10(%ebp),%edx 80105c6f: 83 c2 08 add $0x8,%edx 80105c72: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80105c76: 89 45 f4 mov %eax,-0xc(%ebp) 80105c79: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80105c7d: 75 07 jne 80105c86 <argfd+0x52> return -1; 80105c7f: b8 ff ff ff ff mov $0xffffffff,%eax 80105c84: eb 21 jmp 80105ca7 <argfd+0x73> if(pfd) 80105c86: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 80105c8a: 74 08 je 80105c94 <argfd+0x60> *pfd = fd; 80105c8c: 8b 55 f0 mov -0x10(%ebp),%edx 80105c8f: 8b 45 0c mov 0xc(%ebp),%eax 80105c92: 89 10 mov %edx,(%eax) if(pf) 80105c94: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80105c98: 74 08 je 80105ca2 <argfd+0x6e> *pf = f; 80105c9a: 8b 45 10 mov 0x10(%ebp),%eax 80105c9d: 8b 55 f4 mov -0xc(%ebp),%edx 80105ca0: 89 10 mov %edx,(%eax) return 0; 80105ca2: b8 00 00 00 00 mov $0x0,%eax } 80105ca7: c9 leave 80105ca8: c3 ret 80105ca9 <fdalloc>: // Allocate a file descriptor for the given file. // Takes over file reference from caller on success. static int fdalloc(struct file *f) { 80105ca9: 55 push %ebp 80105caa: 89 e5 mov %esp,%ebp 80105cac: 83 ec 10 sub $0x10,%esp int fd; for(fd = 0; fd < NOFILE; fd++){ 80105caf: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 80105cb6: eb 30 jmp 80105ce8 <fdalloc+0x3f> if(proc->ofile[fd] == 0){ 80105cb8: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105cbe: 8b 55 fc mov -0x4(%ebp),%edx 80105cc1: 83 c2 08 add $0x8,%edx 80105cc4: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80105cc8: 85 c0 test %eax,%eax 80105cca: 75 18 jne 80105ce4 <fdalloc+0x3b> proc->ofile[fd] = f; 80105ccc: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105cd2: 8b 55 fc mov -0x4(%ebp),%edx 80105cd5: 8d 4a 08 lea 0x8(%edx),%ecx 80105cd8: 8b 55 08 mov 0x8(%ebp),%edx 80105cdb: 89 54 88 08 mov %edx,0x8(%eax,%ecx,4) return fd; 80105cdf: 8b 45 fc mov -0x4(%ebp),%eax 80105ce2: eb 0f jmp 80105cf3 <fdalloc+0x4a> static int fdalloc(struct file *f) { int fd; for(fd = 0; fd < NOFILE; fd++){ 80105ce4: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80105ce8: 83 7d fc 0f cmpl $0xf,-0x4(%ebp) 80105cec: 7e ca jle 80105cb8 <fdalloc+0xf> if(proc->ofile[fd] == 0){ proc->ofile[fd] = f; return fd; } } return -1; 80105cee: b8 ff ff ff ff mov $0xffffffff,%eax } 80105cf3: c9 leave 80105cf4: c3 ret 80105cf5 <sys_dup>: int sys_dup(void) { 80105cf5: 55 push %ebp 80105cf6: 89 e5 mov %esp,%ebp 80105cf8: 83 ec 18 sub $0x18,%esp struct file *f; int fd; if(argfd(0, 0, &f) < 0) 80105cfb: 83 ec 04 sub $0x4,%esp 80105cfe: 8d 45 f0 lea -0x10(%ebp),%eax 80105d01: 50 push %eax 80105d02: 6a 00 push $0x0 80105d04: 6a 00 push $0x0 80105d06: e8 29 ff ff ff call 80105c34 <argfd> 80105d0b: 83 c4 10 add $0x10,%esp 80105d0e: 85 c0 test %eax,%eax 80105d10: 79 07 jns 80105d19 <sys_dup+0x24> return -1; 80105d12: b8 ff ff ff ff mov $0xffffffff,%eax 80105d17: eb 31 jmp 80105d4a <sys_dup+0x55> if((fd=fdalloc(f)) < 0) 80105d19: 8b 45 f0 mov -0x10(%ebp),%eax 80105d1c: 83 ec 0c sub $0xc,%esp 80105d1f: 50 push %eax 80105d20: e8 84 ff ff ff call 80105ca9 <fdalloc> 80105d25: 83 c4 10 add $0x10,%esp 80105d28: 89 45 f4 mov %eax,-0xc(%ebp) 80105d2b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80105d2f: 79 07 jns 80105d38 <sys_dup+0x43> return -1; 80105d31: b8 ff ff ff ff mov $0xffffffff,%eax 80105d36: eb 12 jmp 80105d4a <sys_dup+0x55> filedup(f); 80105d38: 8b 45 f0 mov -0x10(%ebp),%eax 80105d3b: 83 ec 0c sub $0xc,%esp 80105d3e: 50 push %eax 80105d3f: e8 bc b2 ff ff call 80101000 <filedup> 80105d44: 83 c4 10 add $0x10,%esp return fd; 80105d47: 8b 45 f4 mov -0xc(%ebp),%eax } 80105d4a: c9 leave 80105d4b: c3 ret 80105d4c <sys_read>: int sys_read(void) { 80105d4c: 55 push %ebp 80105d4d: 89 e5 mov %esp,%ebp 80105d4f: 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) 80105d52: 83 ec 04 sub $0x4,%esp 80105d55: 8d 45 f4 lea -0xc(%ebp),%eax 80105d58: 50 push %eax 80105d59: 6a 00 push $0x0 80105d5b: 6a 00 push $0x0 80105d5d: e8 d2 fe ff ff call 80105c34 <argfd> 80105d62: 83 c4 10 add $0x10,%esp 80105d65: 85 c0 test %eax,%eax 80105d67: 78 2e js 80105d97 <sys_read+0x4b> 80105d69: 83 ec 08 sub $0x8,%esp 80105d6c: 8d 45 f0 lea -0x10(%ebp),%eax 80105d6f: 50 push %eax 80105d70: 6a 02 push $0x2 80105d72: e8 81 fd ff ff call 80105af8 <argint> 80105d77: 83 c4 10 add $0x10,%esp 80105d7a: 85 c0 test %eax,%eax 80105d7c: 78 19 js 80105d97 <sys_read+0x4b> 80105d7e: 8b 45 f0 mov -0x10(%ebp),%eax 80105d81: 83 ec 04 sub $0x4,%esp 80105d84: 50 push %eax 80105d85: 8d 45 ec lea -0x14(%ebp),%eax 80105d88: 50 push %eax 80105d89: 6a 01 push $0x1 80105d8b: e8 90 fd ff ff call 80105b20 <argptr> 80105d90: 83 c4 10 add $0x10,%esp 80105d93: 85 c0 test %eax,%eax 80105d95: 79 07 jns 80105d9e <sys_read+0x52> return -1; 80105d97: b8 ff ff ff ff mov $0xffffffff,%eax 80105d9c: eb 17 jmp 80105db5 <sys_read+0x69> return fileread(f, p, n); 80105d9e: 8b 4d f0 mov -0x10(%ebp),%ecx 80105da1: 8b 55 ec mov -0x14(%ebp),%edx 80105da4: 8b 45 f4 mov -0xc(%ebp),%eax 80105da7: 83 ec 04 sub $0x4,%esp 80105daa: 51 push %ecx 80105dab: 52 push %edx 80105dac: 50 push %eax 80105dad: e8 de b3 ff ff call 80101190 <fileread> 80105db2: 83 c4 10 add $0x10,%esp } 80105db5: c9 leave 80105db6: c3 ret 80105db7 <sys_write>: int sys_write(void) { 80105db7: 55 push %ebp 80105db8: 89 e5 mov %esp,%ebp 80105dba: 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){ 80105dbd: 83 ec 04 sub $0x4,%esp 80105dc0: 8d 45 f4 lea -0xc(%ebp),%eax 80105dc3: 50 push %eax 80105dc4: 6a 00 push $0x0 80105dc6: 6a 00 push $0x0 80105dc8: e8 67 fe ff ff call 80105c34 <argfd> 80105dcd: 83 c4 10 add $0x10,%esp 80105dd0: 85 c0 test %eax,%eax 80105dd2: 78 2e js 80105e02 <sys_write+0x4b> 80105dd4: 83 ec 08 sub $0x8,%esp 80105dd7: 8d 45 f0 lea -0x10(%ebp),%eax 80105dda: 50 push %eax 80105ddb: 6a 02 push $0x2 80105ddd: e8 16 fd ff ff call 80105af8 <argint> 80105de2: 83 c4 10 add $0x10,%esp 80105de5: 85 c0 test %eax,%eax 80105de7: 78 19 js 80105e02 <sys_write+0x4b> 80105de9: 8b 45 f0 mov -0x10(%ebp),%eax 80105dec: 83 ec 04 sub $0x4,%esp 80105def: 50 push %eax 80105df0: 8d 45 ec lea -0x14(%ebp),%eax 80105df3: 50 push %eax 80105df4: 6a 01 push $0x1 80105df6: e8 25 fd ff ff call 80105b20 <argptr> 80105dfb: 83 c4 10 add $0x10,%esp 80105dfe: 85 c0 test %eax,%eax 80105e00: 79 17 jns 80105e19 <sys_write+0x62> cprintf("this is a problem\n"); 80105e02: 83 ec 0c sub $0xc,%esp 80105e05: 68 23 91 10 80 push $0x80109123 80105e0a: e8 b7 a5 ff ff call 801003c6 <cprintf> 80105e0f: 83 c4 10 add $0x10,%esp return -1; 80105e12: b8 ff ff ff ff mov $0xffffffff,%eax 80105e17: eb 17 jmp 80105e30 <sys_write+0x79> } return filewrite(f, p, n); 80105e19: 8b 4d f0 mov -0x10(%ebp),%ecx 80105e1c: 8b 55 ec mov -0x14(%ebp),%edx 80105e1f: 8b 45 f4 mov -0xc(%ebp),%eax 80105e22: 83 ec 04 sub $0x4,%esp 80105e25: 51 push %ecx 80105e26: 52 push %edx 80105e27: 50 push %eax 80105e28: e8 1b b4 ff ff call 80101248 <filewrite> 80105e2d: 83 c4 10 add $0x10,%esp } 80105e30: c9 leave 80105e31: c3 ret 80105e32 <sys_close>: int sys_close(void) { 80105e32: 55 push %ebp 80105e33: 89 e5 mov %esp,%ebp 80105e35: 83 ec 18 sub $0x18,%esp int fd; struct file *f; if(argfd(0, &fd, &f) < 0) 80105e38: 83 ec 04 sub $0x4,%esp 80105e3b: 8d 45 f0 lea -0x10(%ebp),%eax 80105e3e: 50 push %eax 80105e3f: 8d 45 f4 lea -0xc(%ebp),%eax 80105e42: 50 push %eax 80105e43: 6a 00 push $0x0 80105e45: e8 ea fd ff ff call 80105c34 <argfd> 80105e4a: 83 c4 10 add $0x10,%esp 80105e4d: 85 c0 test %eax,%eax 80105e4f: 79 07 jns 80105e58 <sys_close+0x26> return -1; 80105e51: b8 ff ff ff ff mov $0xffffffff,%eax 80105e56: eb 28 jmp 80105e80 <sys_close+0x4e> proc->ofile[fd] = 0; 80105e58: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105e5e: 8b 55 f4 mov -0xc(%ebp),%edx 80105e61: 83 c2 08 add $0x8,%edx 80105e64: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4) 80105e6b: 00 fileclose(f); 80105e6c: 8b 45 f0 mov -0x10(%ebp),%eax 80105e6f: 83 ec 0c sub $0xc,%esp 80105e72: 50 push %eax 80105e73: e8 d9 b1 ff ff call 80101051 <fileclose> 80105e78: 83 c4 10 add $0x10,%esp return 0; 80105e7b: b8 00 00 00 00 mov $0x0,%eax } 80105e80: c9 leave 80105e81: c3 ret 80105e82 <sys_fstat>: int sys_fstat(void) { 80105e82: 55 push %ebp 80105e83: 89 e5 mov %esp,%ebp 80105e85: 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) 80105e88: 83 ec 04 sub $0x4,%esp 80105e8b: 8d 45 f4 lea -0xc(%ebp),%eax 80105e8e: 50 push %eax 80105e8f: 6a 00 push $0x0 80105e91: 6a 00 push $0x0 80105e93: e8 9c fd ff ff call 80105c34 <argfd> 80105e98: 83 c4 10 add $0x10,%esp 80105e9b: 85 c0 test %eax,%eax 80105e9d: 78 17 js 80105eb6 <sys_fstat+0x34> 80105e9f: 83 ec 04 sub $0x4,%esp 80105ea2: 6a 14 push $0x14 80105ea4: 8d 45 f0 lea -0x10(%ebp),%eax 80105ea7: 50 push %eax 80105ea8: 6a 01 push $0x1 80105eaa: e8 71 fc ff ff call 80105b20 <argptr> 80105eaf: 83 c4 10 add $0x10,%esp 80105eb2: 85 c0 test %eax,%eax 80105eb4: 79 07 jns 80105ebd <sys_fstat+0x3b> return -1; 80105eb6: b8 ff ff ff ff mov $0xffffffff,%eax 80105ebb: eb 13 jmp 80105ed0 <sys_fstat+0x4e> return filestat(f, st); 80105ebd: 8b 55 f0 mov -0x10(%ebp),%edx 80105ec0: 8b 45 f4 mov -0xc(%ebp),%eax 80105ec3: 83 ec 08 sub $0x8,%esp 80105ec6: 52 push %edx 80105ec7: 50 push %eax 80105ec8: e8 6c b2 ff ff call 80101139 <filestat> 80105ecd: 83 c4 10 add $0x10,%esp } 80105ed0: c9 leave 80105ed1: c3 ret 80105ed2 <sys_link>: // Create the path new as a link to the same inode as old. int sys_link(void) { 80105ed2: 55 push %ebp 80105ed3: 89 e5 mov %esp,%ebp 80105ed5: 83 ec 28 sub $0x28,%esp char name[DIRSIZ], *new, *old; struct inode *dp, *ip; if(argstr(0, &old) < 0 || argstr(1, &new) < 0) 80105ed8: 83 ec 08 sub $0x8,%esp 80105edb: 8d 45 d8 lea -0x28(%ebp),%eax 80105ede: 50 push %eax 80105edf: 6a 00 push $0x0 80105ee1: e8 97 fc ff ff call 80105b7d <argstr> 80105ee6: 83 c4 10 add $0x10,%esp 80105ee9: 85 c0 test %eax,%eax 80105eeb: 78 15 js 80105f02 <sys_link+0x30> 80105eed: 83 ec 08 sub $0x8,%esp 80105ef0: 8d 45 dc lea -0x24(%ebp),%eax 80105ef3: 50 push %eax 80105ef4: 6a 01 push $0x1 80105ef6: e8 82 fc ff ff call 80105b7d <argstr> 80105efb: 83 c4 10 add $0x10,%esp 80105efe: 85 c0 test %eax,%eax 80105f00: 79 0a jns 80105f0c <sys_link+0x3a> return -1; 80105f02: b8 ff ff ff ff mov $0xffffffff,%eax 80105f07: e9 68 01 00 00 jmp 80106074 <sys_link+0x1a2> begin_op(); 80105f0c: e8 16 d6 ff ff call 80103527 <begin_op> if((ip = namei(old)) == 0){ 80105f11: 8b 45 d8 mov -0x28(%ebp),%eax 80105f14: 83 ec 0c sub $0xc,%esp 80105f17: 50 push %eax 80105f18: e8 c1 c5 ff ff call 801024de <namei> 80105f1d: 83 c4 10 add $0x10,%esp 80105f20: 89 45 f4 mov %eax,-0xc(%ebp) 80105f23: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80105f27: 75 0f jne 80105f38 <sys_link+0x66> end_op(); 80105f29: e8 85 d6 ff ff call 801035b3 <end_op> return -1; 80105f2e: b8 ff ff ff ff mov $0xffffffff,%eax 80105f33: e9 3c 01 00 00 jmp 80106074 <sys_link+0x1a2> } ilock(ip); 80105f38: 83 ec 0c sub $0xc,%esp 80105f3b: ff 75 f4 pushl -0xc(%ebp) 80105f3e: e8 dd b9 ff ff call 80101920 <ilock> 80105f43: 83 c4 10 add $0x10,%esp if(ip->type == T_DIR){ 80105f46: 8b 45 f4 mov -0xc(%ebp),%eax 80105f49: 0f b7 40 10 movzwl 0x10(%eax),%eax 80105f4d: 66 83 f8 01 cmp $0x1,%ax 80105f51: 75 1d jne 80105f70 <sys_link+0x9e> iunlockput(ip); 80105f53: 83 ec 0c sub $0xc,%esp 80105f56: ff 75 f4 pushl -0xc(%ebp) 80105f59: e8 82 bc ff ff call 80101be0 <iunlockput> 80105f5e: 83 c4 10 add $0x10,%esp end_op(); 80105f61: e8 4d d6 ff ff call 801035b3 <end_op> return -1; 80105f66: b8 ff ff ff ff mov $0xffffffff,%eax 80105f6b: e9 04 01 00 00 jmp 80106074 <sys_link+0x1a2> } ip->nlink++; 80105f70: 8b 45 f4 mov -0xc(%ebp),%eax 80105f73: 0f b7 40 16 movzwl 0x16(%eax),%eax 80105f77: 83 c0 01 add $0x1,%eax 80105f7a: 89 c2 mov %eax,%edx 80105f7c: 8b 45 f4 mov -0xc(%ebp),%eax 80105f7f: 66 89 50 16 mov %dx,0x16(%eax) iupdate(ip); 80105f83: 83 ec 0c sub $0xc,%esp 80105f86: ff 75 f4 pushl -0xc(%ebp) 80105f89: e8 b8 b7 ff ff call 80101746 <iupdate> 80105f8e: 83 c4 10 add $0x10,%esp iunlock(ip); 80105f91: 83 ec 0c sub $0xc,%esp 80105f94: ff 75 f4 pushl -0xc(%ebp) 80105f97: e8 e2 ba ff ff call 80101a7e <iunlock> 80105f9c: 83 c4 10 add $0x10,%esp if((dp = nameiparent(new, name)) == 0) 80105f9f: 8b 45 dc mov -0x24(%ebp),%eax 80105fa2: 83 ec 08 sub $0x8,%esp 80105fa5: 8d 55 e2 lea -0x1e(%ebp),%edx 80105fa8: 52 push %edx 80105fa9: 50 push %eax 80105faa: e8 4b c5 ff ff call 801024fa <nameiparent> 80105faf: 83 c4 10 add $0x10,%esp 80105fb2: 89 45 f0 mov %eax,-0x10(%ebp) 80105fb5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80105fb9: 74 71 je 8010602c <sys_link+0x15a> goto bad; ilock(dp); 80105fbb: 83 ec 0c sub $0xc,%esp 80105fbe: ff 75 f0 pushl -0x10(%ebp) 80105fc1: e8 5a b9 ff ff call 80101920 <ilock> 80105fc6: 83 c4 10 add $0x10,%esp if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ 80105fc9: 8b 45 f0 mov -0x10(%ebp),%eax 80105fcc: 8b 10 mov (%eax),%edx 80105fce: 8b 45 f4 mov -0xc(%ebp),%eax 80105fd1: 8b 00 mov (%eax),%eax 80105fd3: 39 c2 cmp %eax,%edx 80105fd5: 75 1d jne 80105ff4 <sys_link+0x122> 80105fd7: 8b 45 f4 mov -0xc(%ebp),%eax 80105fda: 8b 40 04 mov 0x4(%eax),%eax 80105fdd: 83 ec 04 sub $0x4,%esp 80105fe0: 50 push %eax 80105fe1: 8d 45 e2 lea -0x1e(%ebp),%eax 80105fe4: 50 push %eax 80105fe5: ff 75 f0 pushl -0x10(%ebp) 80105fe8: e8 55 c2 ff ff call 80102242 <dirlink> 80105fed: 83 c4 10 add $0x10,%esp 80105ff0: 85 c0 test %eax,%eax 80105ff2: 79 10 jns 80106004 <sys_link+0x132> iunlockput(dp); 80105ff4: 83 ec 0c sub $0xc,%esp 80105ff7: ff 75 f0 pushl -0x10(%ebp) 80105ffa: e8 e1 bb ff ff call 80101be0 <iunlockput> 80105fff: 83 c4 10 add $0x10,%esp goto bad; 80106002: eb 29 jmp 8010602d <sys_link+0x15b> } iunlockput(dp); 80106004: 83 ec 0c sub $0xc,%esp 80106007: ff 75 f0 pushl -0x10(%ebp) 8010600a: e8 d1 bb ff ff call 80101be0 <iunlockput> 8010600f: 83 c4 10 add $0x10,%esp iput(ip); 80106012: 83 ec 0c sub $0xc,%esp 80106015: ff 75 f4 pushl -0xc(%ebp) 80106018: e8 d3 ba ff ff call 80101af0 <iput> 8010601d: 83 c4 10 add $0x10,%esp end_op(); 80106020: e8 8e d5 ff ff call 801035b3 <end_op> return 0; 80106025: b8 00 00 00 00 mov $0x0,%eax 8010602a: eb 48 jmp 80106074 <sys_link+0x1a2> ip->nlink++; iupdate(ip); iunlock(ip); if((dp = nameiparent(new, name)) == 0) goto bad; 8010602c: 90 nop end_op(); return 0; bad: ilock(ip); 8010602d: 83 ec 0c sub $0xc,%esp 80106030: ff 75 f4 pushl -0xc(%ebp) 80106033: e8 e8 b8 ff ff call 80101920 <ilock> 80106038: 83 c4 10 add $0x10,%esp ip->nlink--; 8010603b: 8b 45 f4 mov -0xc(%ebp),%eax 8010603e: 0f b7 40 16 movzwl 0x16(%eax),%eax 80106042: 83 e8 01 sub $0x1,%eax 80106045: 89 c2 mov %eax,%edx 80106047: 8b 45 f4 mov -0xc(%ebp),%eax 8010604a: 66 89 50 16 mov %dx,0x16(%eax) iupdate(ip); 8010604e: 83 ec 0c sub $0xc,%esp 80106051: ff 75 f4 pushl -0xc(%ebp) 80106054: e8 ed b6 ff ff call 80101746 <iupdate> 80106059: 83 c4 10 add $0x10,%esp iunlockput(ip); 8010605c: 83 ec 0c sub $0xc,%esp 8010605f: ff 75 f4 pushl -0xc(%ebp) 80106062: e8 79 bb ff ff call 80101be0 <iunlockput> 80106067: 83 c4 10 add $0x10,%esp end_op(); 8010606a: e8 44 d5 ff ff call 801035b3 <end_op> return -1; 8010606f: b8 ff ff ff ff mov $0xffffffff,%eax } 80106074: c9 leave 80106075: c3 ret 80106076 <isdirempty>: // Is the directory dp empty except for "." and ".." ? static int isdirempty(struct inode *dp) { 80106076: 55 push %ebp 80106077: 89 e5 mov %esp,%ebp 80106079: 83 ec 28 sub $0x28,%esp int off; struct dirent de; for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 8010607c: c7 45 f4 20 00 00 00 movl $0x20,-0xc(%ebp) 80106083: eb 40 jmp 801060c5 <isdirempty+0x4f> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80106085: 8b 45 f4 mov -0xc(%ebp),%eax 80106088: 6a 10 push $0x10 8010608a: 50 push %eax 8010608b: 8d 45 e4 lea -0x1c(%ebp),%eax 8010608e: 50 push %eax 8010608f: ff 75 08 pushl 0x8(%ebp) 80106092: e8 f7 bd ff ff call 80101e8e <readi> 80106097: 83 c4 10 add $0x10,%esp 8010609a: 83 f8 10 cmp $0x10,%eax 8010609d: 74 0d je 801060ac <isdirempty+0x36> panic("isdirempty: readi"); 8010609f: 83 ec 0c sub $0xc,%esp 801060a2: 68 36 91 10 80 push $0x80109136 801060a7: e8 ba a4 ff ff call 80100566 <panic> if(de.inum != 0) 801060ac: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax 801060b0: 66 85 c0 test %ax,%ax 801060b3: 74 07 je 801060bc <isdirempty+0x46> return 0; 801060b5: b8 00 00 00 00 mov $0x0,%eax 801060ba: eb 1b jmp 801060d7 <isdirempty+0x61> isdirempty(struct inode *dp) { int off; struct dirent de; for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 801060bc: 8b 45 f4 mov -0xc(%ebp),%eax 801060bf: 83 c0 10 add $0x10,%eax 801060c2: 89 45 f4 mov %eax,-0xc(%ebp) 801060c5: 8b 45 08 mov 0x8(%ebp),%eax 801060c8: 8b 50 18 mov 0x18(%eax),%edx 801060cb: 8b 45 f4 mov -0xc(%ebp),%eax 801060ce: 39 c2 cmp %eax,%edx 801060d0: 77 b3 ja 80106085 <isdirempty+0xf> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("isdirempty: readi"); if(de.inum != 0) return 0; } return 1; 801060d2: b8 01 00 00 00 mov $0x1,%eax } 801060d7: c9 leave 801060d8: c3 ret 801060d9 <sys_unlink>: //PAGEBREAK! int sys_unlink(void) { 801060d9: 55 push %ebp 801060da: 89 e5 mov %esp,%ebp 801060dc: 83 ec 38 sub $0x38,%esp struct inode *ip, *dp; struct dirent de; char name[DIRSIZ], *path; uint off; if(argstr(0, &path) < 0) 801060df: 83 ec 08 sub $0x8,%esp 801060e2: 8d 45 cc lea -0x34(%ebp),%eax 801060e5: 50 push %eax 801060e6: 6a 00 push $0x0 801060e8: e8 90 fa ff ff call 80105b7d <argstr> 801060ed: 83 c4 10 add $0x10,%esp 801060f0: 85 c0 test %eax,%eax 801060f2: 79 0a jns 801060fe <sys_unlink+0x25> return -1; 801060f4: b8 ff ff ff ff mov $0xffffffff,%eax 801060f9: e9 bc 01 00 00 jmp 801062ba <sys_unlink+0x1e1> begin_op(); 801060fe: e8 24 d4 ff ff call 80103527 <begin_op> if((dp = nameiparent(path, name)) == 0){ 80106103: 8b 45 cc mov -0x34(%ebp),%eax 80106106: 83 ec 08 sub $0x8,%esp 80106109: 8d 55 d2 lea -0x2e(%ebp),%edx 8010610c: 52 push %edx 8010610d: 50 push %eax 8010610e: e8 e7 c3 ff ff call 801024fa <nameiparent> 80106113: 83 c4 10 add $0x10,%esp 80106116: 89 45 f4 mov %eax,-0xc(%ebp) 80106119: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010611d: 75 0f jne 8010612e <sys_unlink+0x55> end_op(); 8010611f: e8 8f d4 ff ff call 801035b3 <end_op> return -1; 80106124: b8 ff ff ff ff mov $0xffffffff,%eax 80106129: e9 8c 01 00 00 jmp 801062ba <sys_unlink+0x1e1> } ilock(dp); 8010612e: 83 ec 0c sub $0xc,%esp 80106131: ff 75 f4 pushl -0xc(%ebp) 80106134: e8 e7 b7 ff ff call 80101920 <ilock> 80106139: 83 c4 10 add $0x10,%esp // Cannot unlink "." or "..". if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) 8010613c: 83 ec 08 sub $0x8,%esp 8010613f: 68 48 91 10 80 push $0x80109148 80106144: 8d 45 d2 lea -0x2e(%ebp),%eax 80106147: 50 push %eax 80106148: e8 20 c0 ff ff call 8010216d <namecmp> 8010614d: 83 c4 10 add $0x10,%esp 80106150: 85 c0 test %eax,%eax 80106152: 0f 84 4a 01 00 00 je 801062a2 <sys_unlink+0x1c9> 80106158: 83 ec 08 sub $0x8,%esp 8010615b: 68 4a 91 10 80 push $0x8010914a 80106160: 8d 45 d2 lea -0x2e(%ebp),%eax 80106163: 50 push %eax 80106164: e8 04 c0 ff ff call 8010216d <namecmp> 80106169: 83 c4 10 add $0x10,%esp 8010616c: 85 c0 test %eax,%eax 8010616e: 0f 84 2e 01 00 00 je 801062a2 <sys_unlink+0x1c9> goto bad; if((ip = dirlookup(dp, name, &off)) == 0) 80106174: 83 ec 04 sub $0x4,%esp 80106177: 8d 45 c8 lea -0x38(%ebp),%eax 8010617a: 50 push %eax 8010617b: 8d 45 d2 lea -0x2e(%ebp),%eax 8010617e: 50 push %eax 8010617f: ff 75 f4 pushl -0xc(%ebp) 80106182: e8 01 c0 ff ff call 80102188 <dirlookup> 80106187: 83 c4 10 add $0x10,%esp 8010618a: 89 45 f0 mov %eax,-0x10(%ebp) 8010618d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106191: 0f 84 0a 01 00 00 je 801062a1 <sys_unlink+0x1c8> goto bad; ilock(ip); 80106197: 83 ec 0c sub $0xc,%esp 8010619a: ff 75 f0 pushl -0x10(%ebp) 8010619d: e8 7e b7 ff ff call 80101920 <ilock> 801061a2: 83 c4 10 add $0x10,%esp if(ip->nlink < 1) 801061a5: 8b 45 f0 mov -0x10(%ebp),%eax 801061a8: 0f b7 40 16 movzwl 0x16(%eax),%eax 801061ac: 66 85 c0 test %ax,%ax 801061af: 7f 0d jg 801061be <sys_unlink+0xe5> panic("unlink: nlink < 1"); 801061b1: 83 ec 0c sub $0xc,%esp 801061b4: 68 4d 91 10 80 push $0x8010914d 801061b9: e8 a8 a3 ff ff call 80100566 <panic> if(ip->type == T_DIR && !isdirempty(ip)){ 801061be: 8b 45 f0 mov -0x10(%ebp),%eax 801061c1: 0f b7 40 10 movzwl 0x10(%eax),%eax 801061c5: 66 83 f8 01 cmp $0x1,%ax 801061c9: 75 25 jne 801061f0 <sys_unlink+0x117> 801061cb: 83 ec 0c sub $0xc,%esp 801061ce: ff 75 f0 pushl -0x10(%ebp) 801061d1: e8 a0 fe ff ff call 80106076 <isdirempty> 801061d6: 83 c4 10 add $0x10,%esp 801061d9: 85 c0 test %eax,%eax 801061db: 75 13 jne 801061f0 <sys_unlink+0x117> iunlockput(ip); 801061dd: 83 ec 0c sub $0xc,%esp 801061e0: ff 75 f0 pushl -0x10(%ebp) 801061e3: e8 f8 b9 ff ff call 80101be0 <iunlockput> 801061e8: 83 c4 10 add $0x10,%esp goto bad; 801061eb: e9 b2 00 00 00 jmp 801062a2 <sys_unlink+0x1c9> } memset(&de, 0, sizeof(de)); 801061f0: 83 ec 04 sub $0x4,%esp 801061f3: 6a 10 push $0x10 801061f5: 6a 00 push $0x0 801061f7: 8d 45 e0 lea -0x20(%ebp),%eax 801061fa: 50 push %eax 801061fb: e8 d3 f5 ff ff call 801057d3 <memset> 80106200: 83 c4 10 add $0x10,%esp if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80106203: 8b 45 c8 mov -0x38(%ebp),%eax 80106206: 6a 10 push $0x10 80106208: 50 push %eax 80106209: 8d 45 e0 lea -0x20(%ebp),%eax 8010620c: 50 push %eax 8010620d: ff 75 f4 pushl -0xc(%ebp) 80106210: e8 d0 bd ff ff call 80101fe5 <writei> 80106215: 83 c4 10 add $0x10,%esp 80106218: 83 f8 10 cmp $0x10,%eax 8010621b: 74 0d je 8010622a <sys_unlink+0x151> panic("unlink: writei"); 8010621d: 83 ec 0c sub $0xc,%esp 80106220: 68 5f 91 10 80 push $0x8010915f 80106225: e8 3c a3 ff ff call 80100566 <panic> if(ip->type == T_DIR){ 8010622a: 8b 45 f0 mov -0x10(%ebp),%eax 8010622d: 0f b7 40 10 movzwl 0x10(%eax),%eax 80106231: 66 83 f8 01 cmp $0x1,%ax 80106235: 75 21 jne 80106258 <sys_unlink+0x17f> dp->nlink--; 80106237: 8b 45 f4 mov -0xc(%ebp),%eax 8010623a: 0f b7 40 16 movzwl 0x16(%eax),%eax 8010623e: 83 e8 01 sub $0x1,%eax 80106241: 89 c2 mov %eax,%edx 80106243: 8b 45 f4 mov -0xc(%ebp),%eax 80106246: 66 89 50 16 mov %dx,0x16(%eax) iupdate(dp); 8010624a: 83 ec 0c sub $0xc,%esp 8010624d: ff 75 f4 pushl -0xc(%ebp) 80106250: e8 f1 b4 ff ff call 80101746 <iupdate> 80106255: 83 c4 10 add $0x10,%esp } iunlockput(dp); 80106258: 83 ec 0c sub $0xc,%esp 8010625b: ff 75 f4 pushl -0xc(%ebp) 8010625e: e8 7d b9 ff ff call 80101be0 <iunlockput> 80106263: 83 c4 10 add $0x10,%esp ip->nlink--; 80106266: 8b 45 f0 mov -0x10(%ebp),%eax 80106269: 0f b7 40 16 movzwl 0x16(%eax),%eax 8010626d: 83 e8 01 sub $0x1,%eax 80106270: 89 c2 mov %eax,%edx 80106272: 8b 45 f0 mov -0x10(%ebp),%eax 80106275: 66 89 50 16 mov %dx,0x16(%eax) iupdate(ip); 80106279: 83 ec 0c sub $0xc,%esp 8010627c: ff 75 f0 pushl -0x10(%ebp) 8010627f: e8 c2 b4 ff ff call 80101746 <iupdate> 80106284: 83 c4 10 add $0x10,%esp iunlockput(ip); 80106287: 83 ec 0c sub $0xc,%esp 8010628a: ff 75 f0 pushl -0x10(%ebp) 8010628d: e8 4e b9 ff ff call 80101be0 <iunlockput> 80106292: 83 c4 10 add $0x10,%esp end_op(); 80106295: e8 19 d3 ff ff call 801035b3 <end_op> return 0; 8010629a: b8 00 00 00 00 mov $0x0,%eax 8010629f: eb 19 jmp 801062ba <sys_unlink+0x1e1> // Cannot unlink "." or "..". if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) goto bad; if((ip = dirlookup(dp, name, &off)) == 0) goto bad; 801062a1: 90 nop end_op(); return 0; bad: iunlockput(dp); 801062a2: 83 ec 0c sub $0xc,%esp 801062a5: ff 75 f4 pushl -0xc(%ebp) 801062a8: e8 33 b9 ff ff call 80101be0 <iunlockput> 801062ad: 83 c4 10 add $0x10,%esp end_op(); 801062b0: e8 fe d2 ff ff call 801035b3 <end_op> return -1; 801062b5: b8 ff ff ff ff mov $0xffffffff,%eax } 801062ba: c9 leave 801062bb: c3 ret 801062bc <create>: static struct inode* create(char *path, short type, short major, short minor) { 801062bc: 55 push %ebp 801062bd: 89 e5 mov %esp,%ebp 801062bf: 83 ec 38 sub $0x38,%esp 801062c2: 8b 4d 0c mov 0xc(%ebp),%ecx 801062c5: 8b 55 10 mov 0x10(%ebp),%edx 801062c8: 8b 45 14 mov 0x14(%ebp),%eax 801062cb: 66 89 4d d4 mov %cx,-0x2c(%ebp) 801062cf: 66 89 55 d0 mov %dx,-0x30(%ebp) 801062d3: 66 89 45 cc mov %ax,-0x34(%ebp) uint off; struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) 801062d7: 83 ec 08 sub $0x8,%esp 801062da: 8d 45 de lea -0x22(%ebp),%eax 801062dd: 50 push %eax 801062de: ff 75 08 pushl 0x8(%ebp) 801062e1: e8 14 c2 ff ff call 801024fa <nameiparent> 801062e6: 83 c4 10 add $0x10,%esp 801062e9: 89 45 f4 mov %eax,-0xc(%ebp) 801062ec: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801062f0: 75 0a jne 801062fc <create+0x40> return 0; 801062f2: b8 00 00 00 00 mov $0x0,%eax 801062f7: e9 90 01 00 00 jmp 8010648c <create+0x1d0> ilock(dp); 801062fc: 83 ec 0c sub $0xc,%esp 801062ff: ff 75 f4 pushl -0xc(%ebp) 80106302: e8 19 b6 ff ff call 80101920 <ilock> 80106307: 83 c4 10 add $0x10,%esp if((ip = dirlookup(dp, name, &off)) != 0){ 8010630a: 83 ec 04 sub $0x4,%esp 8010630d: 8d 45 ec lea -0x14(%ebp),%eax 80106310: 50 push %eax 80106311: 8d 45 de lea -0x22(%ebp),%eax 80106314: 50 push %eax 80106315: ff 75 f4 pushl -0xc(%ebp) 80106318: e8 6b be ff ff call 80102188 <dirlookup> 8010631d: 83 c4 10 add $0x10,%esp 80106320: 89 45 f0 mov %eax,-0x10(%ebp) 80106323: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106327: 74 50 je 80106379 <create+0xbd> iunlockput(dp); 80106329: 83 ec 0c sub $0xc,%esp 8010632c: ff 75 f4 pushl -0xc(%ebp) 8010632f: e8 ac b8 ff ff call 80101be0 <iunlockput> 80106334: 83 c4 10 add $0x10,%esp ilock(ip); 80106337: 83 ec 0c sub $0xc,%esp 8010633a: ff 75 f0 pushl -0x10(%ebp) 8010633d: e8 de b5 ff ff call 80101920 <ilock> 80106342: 83 c4 10 add $0x10,%esp if(type == T_FILE && ip->type == T_FILE) 80106345: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp) 8010634a: 75 15 jne 80106361 <create+0xa5> 8010634c: 8b 45 f0 mov -0x10(%ebp),%eax 8010634f: 0f b7 40 10 movzwl 0x10(%eax),%eax 80106353: 66 83 f8 02 cmp $0x2,%ax 80106357: 75 08 jne 80106361 <create+0xa5> return ip; 80106359: 8b 45 f0 mov -0x10(%ebp),%eax 8010635c: e9 2b 01 00 00 jmp 8010648c <create+0x1d0> iunlockput(ip); 80106361: 83 ec 0c sub $0xc,%esp 80106364: ff 75 f0 pushl -0x10(%ebp) 80106367: e8 74 b8 ff ff call 80101be0 <iunlockput> 8010636c: 83 c4 10 add $0x10,%esp return 0; 8010636f: b8 00 00 00 00 mov $0x0,%eax 80106374: e9 13 01 00 00 jmp 8010648c <create+0x1d0> } if((ip = ialloc(dp->dev, type)) == 0) 80106379: 0f bf 55 d4 movswl -0x2c(%ebp),%edx 8010637d: 8b 45 f4 mov -0xc(%ebp),%eax 80106380: 8b 00 mov (%eax),%eax 80106382: 83 ec 08 sub $0x8,%esp 80106385: 52 push %edx 80106386: 50 push %eax 80106387: e8 e3 b2 ff ff call 8010166f <ialloc> 8010638c: 83 c4 10 add $0x10,%esp 8010638f: 89 45 f0 mov %eax,-0x10(%ebp) 80106392: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106396: 75 0d jne 801063a5 <create+0xe9> panic("create: ialloc"); 80106398: 83 ec 0c sub $0xc,%esp 8010639b: 68 6e 91 10 80 push $0x8010916e 801063a0: e8 c1 a1 ff ff call 80100566 <panic> ilock(ip); 801063a5: 83 ec 0c sub $0xc,%esp 801063a8: ff 75 f0 pushl -0x10(%ebp) 801063ab: e8 70 b5 ff ff call 80101920 <ilock> 801063b0: 83 c4 10 add $0x10,%esp ip->major = major; 801063b3: 8b 45 f0 mov -0x10(%ebp),%eax 801063b6: 0f b7 55 d0 movzwl -0x30(%ebp),%edx 801063ba: 66 89 50 12 mov %dx,0x12(%eax) ip->minor = minor; 801063be: 8b 45 f0 mov -0x10(%ebp),%eax 801063c1: 0f b7 55 cc movzwl -0x34(%ebp),%edx 801063c5: 66 89 50 14 mov %dx,0x14(%eax) ip->nlink = 1; 801063c9: 8b 45 f0 mov -0x10(%ebp),%eax 801063cc: 66 c7 40 16 01 00 movw $0x1,0x16(%eax) iupdate(ip); 801063d2: 83 ec 0c sub $0xc,%esp 801063d5: ff 75 f0 pushl -0x10(%ebp) 801063d8: e8 69 b3 ff ff call 80101746 <iupdate> 801063dd: 83 c4 10 add $0x10,%esp if(type == T_DIR){ // Create . and .. entries. 801063e0: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp) 801063e5: 75 6a jne 80106451 <create+0x195> dp->nlink++; // for ".." 801063e7: 8b 45 f4 mov -0xc(%ebp),%eax 801063ea: 0f b7 40 16 movzwl 0x16(%eax),%eax 801063ee: 83 c0 01 add $0x1,%eax 801063f1: 89 c2 mov %eax,%edx 801063f3: 8b 45 f4 mov -0xc(%ebp),%eax 801063f6: 66 89 50 16 mov %dx,0x16(%eax) iupdate(dp); 801063fa: 83 ec 0c sub $0xc,%esp 801063fd: ff 75 f4 pushl -0xc(%ebp) 80106400: e8 41 b3 ff ff call 80101746 <iupdate> 80106405: 83 c4 10 add $0x10,%esp // No ip->nlink++ for ".": avoid cyclic ref count. if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) 80106408: 8b 45 f0 mov -0x10(%ebp),%eax 8010640b: 8b 40 04 mov 0x4(%eax),%eax 8010640e: 83 ec 04 sub $0x4,%esp 80106411: 50 push %eax 80106412: 68 48 91 10 80 push $0x80109148 80106417: ff 75 f0 pushl -0x10(%ebp) 8010641a: e8 23 be ff ff call 80102242 <dirlink> 8010641f: 83 c4 10 add $0x10,%esp 80106422: 85 c0 test %eax,%eax 80106424: 78 1e js 80106444 <create+0x188> 80106426: 8b 45 f4 mov -0xc(%ebp),%eax 80106429: 8b 40 04 mov 0x4(%eax),%eax 8010642c: 83 ec 04 sub $0x4,%esp 8010642f: 50 push %eax 80106430: 68 4a 91 10 80 push $0x8010914a 80106435: ff 75 f0 pushl -0x10(%ebp) 80106438: e8 05 be ff ff call 80102242 <dirlink> 8010643d: 83 c4 10 add $0x10,%esp 80106440: 85 c0 test %eax,%eax 80106442: 79 0d jns 80106451 <create+0x195> panic("create dots"); 80106444: 83 ec 0c sub $0xc,%esp 80106447: 68 7d 91 10 80 push $0x8010917d 8010644c: e8 15 a1 ff ff call 80100566 <panic> } if(dirlink(dp, name, ip->inum) < 0) 80106451: 8b 45 f0 mov -0x10(%ebp),%eax 80106454: 8b 40 04 mov 0x4(%eax),%eax 80106457: 83 ec 04 sub $0x4,%esp 8010645a: 50 push %eax 8010645b: 8d 45 de lea -0x22(%ebp),%eax 8010645e: 50 push %eax 8010645f: ff 75 f4 pushl -0xc(%ebp) 80106462: e8 db bd ff ff call 80102242 <dirlink> 80106467: 83 c4 10 add $0x10,%esp 8010646a: 85 c0 test %eax,%eax 8010646c: 79 0d jns 8010647b <create+0x1bf> panic("create: dirlink"); 8010646e: 83 ec 0c sub $0xc,%esp 80106471: 68 89 91 10 80 push $0x80109189 80106476: e8 eb a0 ff ff call 80100566 <panic> iunlockput(dp); 8010647b: 83 ec 0c sub $0xc,%esp 8010647e: ff 75 f4 pushl -0xc(%ebp) 80106481: e8 5a b7 ff ff call 80101be0 <iunlockput> 80106486: 83 c4 10 add $0x10,%esp return ip; 80106489: 8b 45 f0 mov -0x10(%ebp),%eax } 8010648c: c9 leave 8010648d: c3 ret 8010648e <sys_open>: int sys_open(void) { 8010648e: 55 push %ebp 8010648f: 89 e5 mov %esp,%ebp 80106491: 83 ec 28 sub $0x28,%esp char *path; int fd, omode; struct file *f; struct inode *ip; if(argstr(0, &path) < 0 || argint(1, &omode) < 0) 80106494: 83 ec 08 sub $0x8,%esp 80106497: 8d 45 e8 lea -0x18(%ebp),%eax 8010649a: 50 push %eax 8010649b: 6a 00 push $0x0 8010649d: e8 db f6 ff ff call 80105b7d <argstr> 801064a2: 83 c4 10 add $0x10,%esp 801064a5: 85 c0 test %eax,%eax 801064a7: 78 15 js 801064be <sys_open+0x30> 801064a9: 83 ec 08 sub $0x8,%esp 801064ac: 8d 45 e4 lea -0x1c(%ebp),%eax 801064af: 50 push %eax 801064b0: 6a 01 push $0x1 801064b2: e8 41 f6 ff ff call 80105af8 <argint> 801064b7: 83 c4 10 add $0x10,%esp 801064ba: 85 c0 test %eax,%eax 801064bc: 79 0a jns 801064c8 <sys_open+0x3a> return -1; 801064be: b8 ff ff ff ff mov $0xffffffff,%eax 801064c3: e9 61 01 00 00 jmp 80106629 <sys_open+0x19b> begin_op(); 801064c8: e8 5a d0 ff ff call 80103527 <begin_op> if(omode & O_CREATE){ 801064cd: 8b 45 e4 mov -0x1c(%ebp),%eax 801064d0: 25 00 02 00 00 and $0x200,%eax 801064d5: 85 c0 test %eax,%eax 801064d7: 74 2a je 80106503 <sys_open+0x75> ip = create(path, T_FILE, 0, 0); 801064d9: 8b 45 e8 mov -0x18(%ebp),%eax 801064dc: 6a 00 push $0x0 801064de: 6a 00 push $0x0 801064e0: 6a 02 push $0x2 801064e2: 50 push %eax 801064e3: e8 d4 fd ff ff call 801062bc <create> 801064e8: 83 c4 10 add $0x10,%esp 801064eb: 89 45 f4 mov %eax,-0xc(%ebp) if(ip == 0){ 801064ee: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801064f2: 75 75 jne 80106569 <sys_open+0xdb> end_op(); 801064f4: e8 ba d0 ff ff call 801035b3 <end_op> return -1; 801064f9: b8 ff ff ff ff mov $0xffffffff,%eax 801064fe: e9 26 01 00 00 jmp 80106629 <sys_open+0x19b> } } else { if((ip = namei(path)) == 0){ 80106503: 8b 45 e8 mov -0x18(%ebp),%eax 80106506: 83 ec 0c sub $0xc,%esp 80106509: 50 push %eax 8010650a: e8 cf bf ff ff call 801024de <namei> 8010650f: 83 c4 10 add $0x10,%esp 80106512: 89 45 f4 mov %eax,-0xc(%ebp) 80106515: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106519: 75 0f jne 8010652a <sys_open+0x9c> end_op(); 8010651b: e8 93 d0 ff ff call 801035b3 <end_op> return -1; 80106520: b8 ff ff ff ff mov $0xffffffff,%eax 80106525: e9 ff 00 00 00 jmp 80106629 <sys_open+0x19b> } ilock(ip); 8010652a: 83 ec 0c sub $0xc,%esp 8010652d: ff 75 f4 pushl -0xc(%ebp) 80106530: e8 eb b3 ff ff call 80101920 <ilock> 80106535: 83 c4 10 add $0x10,%esp if(ip->type == T_DIR && omode != O_RDONLY){ 80106538: 8b 45 f4 mov -0xc(%ebp),%eax 8010653b: 0f b7 40 10 movzwl 0x10(%eax),%eax 8010653f: 66 83 f8 01 cmp $0x1,%ax 80106543: 75 24 jne 80106569 <sys_open+0xdb> 80106545: 8b 45 e4 mov -0x1c(%ebp),%eax 80106548: 85 c0 test %eax,%eax 8010654a: 74 1d je 80106569 <sys_open+0xdb> iunlockput(ip); 8010654c: 83 ec 0c sub $0xc,%esp 8010654f: ff 75 f4 pushl -0xc(%ebp) 80106552: e8 89 b6 ff ff call 80101be0 <iunlockput> 80106557: 83 c4 10 add $0x10,%esp end_op(); 8010655a: e8 54 d0 ff ff call 801035b3 <end_op> return -1; 8010655f: b8 ff ff ff ff mov $0xffffffff,%eax 80106564: e9 c0 00 00 00 jmp 80106629 <sys_open+0x19b> } } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ 80106569: e8 25 aa ff ff call 80100f93 <filealloc> 8010656e: 89 45 f0 mov %eax,-0x10(%ebp) 80106571: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106575: 74 17 je 8010658e <sys_open+0x100> 80106577: 83 ec 0c sub $0xc,%esp 8010657a: ff 75 f0 pushl -0x10(%ebp) 8010657d: e8 27 f7 ff ff call 80105ca9 <fdalloc> 80106582: 83 c4 10 add $0x10,%esp 80106585: 89 45 ec mov %eax,-0x14(%ebp) 80106588: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 8010658c: 79 2e jns 801065bc <sys_open+0x12e> if(f) 8010658e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106592: 74 0e je 801065a2 <sys_open+0x114> fileclose(f); 80106594: 83 ec 0c sub $0xc,%esp 80106597: ff 75 f0 pushl -0x10(%ebp) 8010659a: e8 b2 aa ff ff call 80101051 <fileclose> 8010659f: 83 c4 10 add $0x10,%esp iunlockput(ip); 801065a2: 83 ec 0c sub $0xc,%esp 801065a5: ff 75 f4 pushl -0xc(%ebp) 801065a8: e8 33 b6 ff ff call 80101be0 <iunlockput> 801065ad: 83 c4 10 add $0x10,%esp end_op(); 801065b0: e8 fe cf ff ff call 801035b3 <end_op> return -1; 801065b5: b8 ff ff ff ff mov $0xffffffff,%eax 801065ba: eb 6d jmp 80106629 <sys_open+0x19b> } iunlock(ip); 801065bc: 83 ec 0c sub $0xc,%esp 801065bf: ff 75 f4 pushl -0xc(%ebp) 801065c2: e8 b7 b4 ff ff call 80101a7e <iunlock> 801065c7: 83 c4 10 add $0x10,%esp end_op(); 801065ca: e8 e4 cf ff ff call 801035b3 <end_op> f->type = FD_INODE; 801065cf: 8b 45 f0 mov -0x10(%ebp),%eax 801065d2: c7 00 02 00 00 00 movl $0x2,(%eax) f->ip = ip; 801065d8: 8b 45 f0 mov -0x10(%ebp),%eax 801065db: 8b 55 f4 mov -0xc(%ebp),%edx 801065de: 89 50 10 mov %edx,0x10(%eax) f->off = 0; 801065e1: 8b 45 f0 mov -0x10(%ebp),%eax 801065e4: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) f->readable = !(omode & O_WRONLY); 801065eb: 8b 45 e4 mov -0x1c(%ebp),%eax 801065ee: 83 e0 01 and $0x1,%eax 801065f1: 85 c0 test %eax,%eax 801065f3: 0f 94 c0 sete %al 801065f6: 89 c2 mov %eax,%edx 801065f8: 8b 45 f0 mov -0x10(%ebp),%eax 801065fb: 88 50 08 mov %dl,0x8(%eax) f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 801065fe: 8b 45 e4 mov -0x1c(%ebp),%eax 80106601: 83 e0 01 and $0x1,%eax 80106604: 85 c0 test %eax,%eax 80106606: 75 0a jne 80106612 <sys_open+0x184> 80106608: 8b 45 e4 mov -0x1c(%ebp),%eax 8010660b: 83 e0 02 and $0x2,%eax 8010660e: 85 c0 test %eax,%eax 80106610: 74 07 je 80106619 <sys_open+0x18b> 80106612: b8 01 00 00 00 mov $0x1,%eax 80106617: eb 05 jmp 8010661e <sys_open+0x190> 80106619: b8 00 00 00 00 mov $0x0,%eax 8010661e: 89 c2 mov %eax,%edx 80106620: 8b 45 f0 mov -0x10(%ebp),%eax 80106623: 88 50 09 mov %dl,0x9(%eax) return fd; 80106626: 8b 45 ec mov -0x14(%ebp),%eax } 80106629: c9 leave 8010662a: c3 ret 8010662b <sys_mkdir>: int sys_mkdir(void) { 8010662b: 55 push %ebp 8010662c: 89 e5 mov %esp,%ebp 8010662e: 83 ec 18 sub $0x18,%esp char *path; struct inode *ip; begin_op(); 80106631: e8 f1 ce ff ff call 80103527 <begin_op> if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ 80106636: 83 ec 08 sub $0x8,%esp 80106639: 8d 45 f0 lea -0x10(%ebp),%eax 8010663c: 50 push %eax 8010663d: 6a 00 push $0x0 8010663f: e8 39 f5 ff ff call 80105b7d <argstr> 80106644: 83 c4 10 add $0x10,%esp 80106647: 85 c0 test %eax,%eax 80106649: 78 1b js 80106666 <sys_mkdir+0x3b> 8010664b: 8b 45 f0 mov -0x10(%ebp),%eax 8010664e: 6a 00 push $0x0 80106650: 6a 00 push $0x0 80106652: 6a 01 push $0x1 80106654: 50 push %eax 80106655: e8 62 fc ff ff call 801062bc <create> 8010665a: 83 c4 10 add $0x10,%esp 8010665d: 89 45 f4 mov %eax,-0xc(%ebp) 80106660: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106664: 75 0c jne 80106672 <sys_mkdir+0x47> end_op(); 80106666: e8 48 cf ff ff call 801035b3 <end_op> return -1; 8010666b: b8 ff ff ff ff mov $0xffffffff,%eax 80106670: eb 18 jmp 8010668a <sys_mkdir+0x5f> } iunlockput(ip); 80106672: 83 ec 0c sub $0xc,%esp 80106675: ff 75 f4 pushl -0xc(%ebp) 80106678: e8 63 b5 ff ff call 80101be0 <iunlockput> 8010667d: 83 c4 10 add $0x10,%esp end_op(); 80106680: e8 2e cf ff ff call 801035b3 <end_op> return 0; 80106685: b8 00 00 00 00 mov $0x0,%eax } 8010668a: c9 leave 8010668b: c3 ret 8010668c <sys_mknod>: int sys_mknod(void) { 8010668c: 55 push %ebp 8010668d: 89 e5 mov %esp,%ebp 8010668f: 83 ec 28 sub $0x28,%esp struct inode *ip; char *path; int len; int major, minor; begin_op(); 80106692: e8 90 ce ff ff call 80103527 <begin_op> if((len=argstr(0, &path)) < 0 || 80106697: 83 ec 08 sub $0x8,%esp 8010669a: 8d 45 ec lea -0x14(%ebp),%eax 8010669d: 50 push %eax 8010669e: 6a 00 push $0x0 801066a0: e8 d8 f4 ff ff call 80105b7d <argstr> 801066a5: 83 c4 10 add $0x10,%esp 801066a8: 89 45 f4 mov %eax,-0xc(%ebp) 801066ab: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801066af: 78 4f js 80106700 <sys_mknod+0x74> argint(1, &major) < 0 || 801066b1: 83 ec 08 sub $0x8,%esp 801066b4: 8d 45 e8 lea -0x18(%ebp),%eax 801066b7: 50 push %eax 801066b8: 6a 01 push $0x1 801066ba: e8 39 f4 ff ff call 80105af8 <argint> 801066bf: 83 c4 10 add $0x10,%esp char *path; int len; int major, minor; begin_op(); if((len=argstr(0, &path)) < 0 || 801066c2: 85 c0 test %eax,%eax 801066c4: 78 3a js 80106700 <sys_mknod+0x74> argint(1, &major) < 0 || argint(2, &minor) < 0 || 801066c6: 83 ec 08 sub $0x8,%esp 801066c9: 8d 45 e4 lea -0x1c(%ebp),%eax 801066cc: 50 push %eax 801066cd: 6a 02 push $0x2 801066cf: e8 24 f4 ff ff call 80105af8 <argint> 801066d4: 83 c4 10 add $0x10,%esp int len; int major, minor; begin_op(); if((len=argstr(0, &path)) < 0 || argint(1, &major) < 0 || 801066d7: 85 c0 test %eax,%eax 801066d9: 78 25 js 80106700 <sys_mknod+0x74> argint(2, &minor) < 0 || (ip = create(path, T_DEV, major, minor)) == 0){ 801066db: 8b 45 e4 mov -0x1c(%ebp),%eax 801066de: 0f bf c8 movswl %ax,%ecx 801066e1: 8b 45 e8 mov -0x18(%ebp),%eax 801066e4: 0f bf d0 movswl %ax,%edx 801066e7: 8b 45 ec mov -0x14(%ebp),%eax int major, minor; begin_op(); if((len=argstr(0, &path)) < 0 || argint(1, &major) < 0 || argint(2, &minor) < 0 || 801066ea: 51 push %ecx 801066eb: 52 push %edx 801066ec: 6a 03 push $0x3 801066ee: 50 push %eax 801066ef: e8 c8 fb ff ff call 801062bc <create> 801066f4: 83 c4 10 add $0x10,%esp 801066f7: 89 45 f0 mov %eax,-0x10(%ebp) 801066fa: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801066fe: 75 0c jne 8010670c <sys_mknod+0x80> (ip = create(path, T_DEV, major, minor)) == 0){ end_op(); 80106700: e8 ae ce ff ff call 801035b3 <end_op> return -1; 80106705: b8 ff ff ff ff mov $0xffffffff,%eax 8010670a: eb 18 jmp 80106724 <sys_mknod+0x98> } iunlockput(ip); 8010670c: 83 ec 0c sub $0xc,%esp 8010670f: ff 75 f0 pushl -0x10(%ebp) 80106712: e8 c9 b4 ff ff call 80101be0 <iunlockput> 80106717: 83 c4 10 add $0x10,%esp end_op(); 8010671a: e8 94 ce ff ff call 801035b3 <end_op> return 0; 8010671f: b8 00 00 00 00 mov $0x0,%eax } 80106724: c9 leave 80106725: c3 ret 80106726 <sys_chdir>: int sys_chdir(void) { 80106726: 55 push %ebp 80106727: 89 e5 mov %esp,%ebp 80106729: 83 ec 18 sub $0x18,%esp char *path; struct inode *ip; begin_op(); 8010672c: e8 f6 cd ff ff call 80103527 <begin_op> if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ 80106731: 83 ec 08 sub $0x8,%esp 80106734: 8d 45 f0 lea -0x10(%ebp),%eax 80106737: 50 push %eax 80106738: 6a 00 push $0x0 8010673a: e8 3e f4 ff ff call 80105b7d <argstr> 8010673f: 83 c4 10 add $0x10,%esp 80106742: 85 c0 test %eax,%eax 80106744: 78 18 js 8010675e <sys_chdir+0x38> 80106746: 8b 45 f0 mov -0x10(%ebp),%eax 80106749: 83 ec 0c sub $0xc,%esp 8010674c: 50 push %eax 8010674d: e8 8c bd ff ff call 801024de <namei> 80106752: 83 c4 10 add $0x10,%esp 80106755: 89 45 f4 mov %eax,-0xc(%ebp) 80106758: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010675c: 75 0c jne 8010676a <sys_chdir+0x44> end_op(); 8010675e: e8 50 ce ff ff call 801035b3 <end_op> return -1; 80106763: b8 ff ff ff ff mov $0xffffffff,%eax 80106768: eb 6e jmp 801067d8 <sys_chdir+0xb2> } ilock(ip); 8010676a: 83 ec 0c sub $0xc,%esp 8010676d: ff 75 f4 pushl -0xc(%ebp) 80106770: e8 ab b1 ff ff call 80101920 <ilock> 80106775: 83 c4 10 add $0x10,%esp if(ip->type != T_DIR){ 80106778: 8b 45 f4 mov -0xc(%ebp),%eax 8010677b: 0f b7 40 10 movzwl 0x10(%eax),%eax 8010677f: 66 83 f8 01 cmp $0x1,%ax 80106783: 74 1a je 8010679f <sys_chdir+0x79> iunlockput(ip); 80106785: 83 ec 0c sub $0xc,%esp 80106788: ff 75 f4 pushl -0xc(%ebp) 8010678b: e8 50 b4 ff ff call 80101be0 <iunlockput> 80106790: 83 c4 10 add $0x10,%esp end_op(); 80106793: e8 1b ce ff ff call 801035b3 <end_op> return -1; 80106798: b8 ff ff ff ff mov $0xffffffff,%eax 8010679d: eb 39 jmp 801067d8 <sys_chdir+0xb2> } iunlock(ip); 8010679f: 83 ec 0c sub $0xc,%esp 801067a2: ff 75 f4 pushl -0xc(%ebp) 801067a5: e8 d4 b2 ff ff call 80101a7e <iunlock> 801067aa: 83 c4 10 add $0x10,%esp iput(proc->cwd); 801067ad: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801067b3: 8b 40 68 mov 0x68(%eax),%eax 801067b6: 83 ec 0c sub $0xc,%esp 801067b9: 50 push %eax 801067ba: e8 31 b3 ff ff call 80101af0 <iput> 801067bf: 83 c4 10 add $0x10,%esp end_op(); 801067c2: e8 ec cd ff ff call 801035b3 <end_op> proc->cwd = ip; 801067c7: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801067cd: 8b 55 f4 mov -0xc(%ebp),%edx 801067d0: 89 50 68 mov %edx,0x68(%eax) return 0; 801067d3: b8 00 00 00 00 mov $0x0,%eax } 801067d8: c9 leave 801067d9: c3 ret 801067da <sys_exec>: int sys_exec(void) { 801067da: 55 push %ebp 801067db: 89 e5 mov %esp,%ebp 801067dd: 81 ec 98 00 00 00 sub $0x98,%esp char *path, *argv[MAXARG]; int i; uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ 801067e3: 83 ec 08 sub $0x8,%esp 801067e6: 8d 45 f0 lea -0x10(%ebp),%eax 801067e9: 50 push %eax 801067ea: 6a 00 push $0x0 801067ec: e8 8c f3 ff ff call 80105b7d <argstr> 801067f1: 83 c4 10 add $0x10,%esp 801067f4: 85 c0 test %eax,%eax 801067f6: 78 18 js 80106810 <sys_exec+0x36> 801067f8: 83 ec 08 sub $0x8,%esp 801067fb: 8d 85 6c ff ff ff lea -0x94(%ebp),%eax 80106801: 50 push %eax 80106802: 6a 01 push $0x1 80106804: e8 ef f2 ff ff call 80105af8 <argint> 80106809: 83 c4 10 add $0x10,%esp 8010680c: 85 c0 test %eax,%eax 8010680e: 79 0a jns 8010681a <sys_exec+0x40> return -1; 80106810: b8 ff ff ff ff mov $0xffffffff,%eax 80106815: e9 c6 00 00 00 jmp 801068e0 <sys_exec+0x106> } memset(argv, 0, sizeof(argv)); 8010681a: 83 ec 04 sub $0x4,%esp 8010681d: 68 80 00 00 00 push $0x80 80106822: 6a 00 push $0x0 80106824: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax 8010682a: 50 push %eax 8010682b: e8 a3 ef ff ff call 801057d3 <memset> 80106830: 83 c4 10 add $0x10,%esp for(i=0;; i++){ 80106833: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if(i >= NELEM(argv)) 8010683a: 8b 45 f4 mov -0xc(%ebp),%eax 8010683d: 83 f8 1f cmp $0x1f,%eax 80106840: 76 0a jbe 8010684c <sys_exec+0x72> return -1; 80106842: b8 ff ff ff ff mov $0xffffffff,%eax 80106847: e9 94 00 00 00 jmp 801068e0 <sys_exec+0x106> if(fetchint(uargv+4*i, (int*)&uarg) < 0) 8010684c: 8b 45 f4 mov -0xc(%ebp),%eax 8010684f: c1 e0 02 shl $0x2,%eax 80106852: 89 c2 mov %eax,%edx 80106854: 8b 85 6c ff ff ff mov -0x94(%ebp),%eax 8010685a: 01 c2 add %eax,%edx 8010685c: 83 ec 08 sub $0x8,%esp 8010685f: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax 80106865: 50 push %eax 80106866: 52 push %edx 80106867: e8 f0 f1 ff ff call 80105a5c <fetchint> 8010686c: 83 c4 10 add $0x10,%esp 8010686f: 85 c0 test %eax,%eax 80106871: 79 07 jns 8010687a <sys_exec+0xa0> return -1; 80106873: b8 ff ff ff ff mov $0xffffffff,%eax 80106878: eb 66 jmp 801068e0 <sys_exec+0x106> if(uarg == 0){ 8010687a: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax 80106880: 85 c0 test %eax,%eax 80106882: 75 27 jne 801068ab <sys_exec+0xd1> argv[i] = 0; 80106884: 8b 45 f4 mov -0xc(%ebp),%eax 80106887: c7 84 85 70 ff ff ff movl $0x0,-0x90(%ebp,%eax,4) 8010688e: 00 00 00 00 break; 80106892: 90 nop } if(fetchstr(uarg, &argv[i]) < 0) return -1; } return exec(path, argv); 80106893: 8b 45 f0 mov -0x10(%ebp),%eax 80106896: 83 ec 08 sub $0x8,%esp 80106899: 8d 95 70 ff ff ff lea -0x90(%ebp),%edx 8010689f: 52 push %edx 801068a0: 50 push %eax 801068a1: e8 cb a2 ff ff call 80100b71 <exec> 801068a6: 83 c4 10 add $0x10,%esp 801068a9: eb 35 jmp 801068e0 <sys_exec+0x106> return -1; if(uarg == 0){ argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) 801068ab: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax 801068b1: 8b 55 f4 mov -0xc(%ebp),%edx 801068b4: c1 e2 02 shl $0x2,%edx 801068b7: 01 c2 add %eax,%edx 801068b9: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax 801068bf: 83 ec 08 sub $0x8,%esp 801068c2: 52 push %edx 801068c3: 50 push %eax 801068c4: e8 cd f1 ff ff call 80105a96 <fetchstr> 801068c9: 83 c4 10 add $0x10,%esp 801068cc: 85 c0 test %eax,%eax 801068ce: 79 07 jns 801068d7 <sys_exec+0xfd> return -1; 801068d0: b8 ff ff ff ff mov $0xffffffff,%eax 801068d5: eb 09 jmp 801068e0 <sys_exec+0x106> if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ return -1; } memset(argv, 0, sizeof(argv)); for(i=0;; i++){ 801068d7: 83 45 f4 01 addl $0x1,-0xc(%ebp) argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) return -1; } 801068db: e9 5a ff ff ff jmp 8010683a <sys_exec+0x60> return exec(path, argv); } 801068e0: c9 leave 801068e1: c3 ret 801068e2 <sys_pipe>: int sys_pipe(void) { 801068e2: 55 push %ebp 801068e3: 89 e5 mov %esp,%ebp 801068e5: 83 ec 28 sub $0x28,%esp int *fd; struct file *rf, *wf; int fd0, fd1; if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) 801068e8: 83 ec 04 sub $0x4,%esp 801068eb: 6a 08 push $0x8 801068ed: 8d 45 ec lea -0x14(%ebp),%eax 801068f0: 50 push %eax 801068f1: 6a 00 push $0x0 801068f3: e8 28 f2 ff ff call 80105b20 <argptr> 801068f8: 83 c4 10 add $0x10,%esp 801068fb: 85 c0 test %eax,%eax 801068fd: 79 0a jns 80106909 <sys_pipe+0x27> return -1; 801068ff: b8 ff ff ff ff mov $0xffffffff,%eax 80106904: e9 af 00 00 00 jmp 801069b8 <sys_pipe+0xd6> if(pipealloc(&rf, &wf) < 0) 80106909: 83 ec 08 sub $0x8,%esp 8010690c: 8d 45 e4 lea -0x1c(%ebp),%eax 8010690f: 50 push %eax 80106910: 8d 45 e8 lea -0x18(%ebp),%eax 80106913: 50 push %eax 80106914: e8 c8 d6 ff ff call 80103fe1 <pipealloc> 80106919: 83 c4 10 add $0x10,%esp 8010691c: 85 c0 test %eax,%eax 8010691e: 79 0a jns 8010692a <sys_pipe+0x48> return -1; 80106920: b8 ff ff ff ff mov $0xffffffff,%eax 80106925: e9 8e 00 00 00 jmp 801069b8 <sys_pipe+0xd6> fd0 = -1; 8010692a: c7 45 f4 ff ff ff ff movl $0xffffffff,-0xc(%ebp) if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ 80106931: 8b 45 e8 mov -0x18(%ebp),%eax 80106934: 83 ec 0c sub $0xc,%esp 80106937: 50 push %eax 80106938: e8 6c f3 ff ff call 80105ca9 <fdalloc> 8010693d: 83 c4 10 add $0x10,%esp 80106940: 89 45 f4 mov %eax,-0xc(%ebp) 80106943: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106947: 78 18 js 80106961 <sys_pipe+0x7f> 80106949: 8b 45 e4 mov -0x1c(%ebp),%eax 8010694c: 83 ec 0c sub $0xc,%esp 8010694f: 50 push %eax 80106950: e8 54 f3 ff ff call 80105ca9 <fdalloc> 80106955: 83 c4 10 add $0x10,%esp 80106958: 89 45 f0 mov %eax,-0x10(%ebp) 8010695b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8010695f: 79 3f jns 801069a0 <sys_pipe+0xbe> if(fd0 >= 0) 80106961: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106965: 78 14 js 8010697b <sys_pipe+0x99> proc->ofile[fd0] = 0; 80106967: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010696d: 8b 55 f4 mov -0xc(%ebp),%edx 80106970: 83 c2 08 add $0x8,%edx 80106973: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4) 8010697a: 00 fileclose(rf); 8010697b: 8b 45 e8 mov -0x18(%ebp),%eax 8010697e: 83 ec 0c sub $0xc,%esp 80106981: 50 push %eax 80106982: e8 ca a6 ff ff call 80101051 <fileclose> 80106987: 83 c4 10 add $0x10,%esp fileclose(wf); 8010698a: 8b 45 e4 mov -0x1c(%ebp),%eax 8010698d: 83 ec 0c sub $0xc,%esp 80106990: 50 push %eax 80106991: e8 bb a6 ff ff call 80101051 <fileclose> 80106996: 83 c4 10 add $0x10,%esp return -1; 80106999: b8 ff ff ff ff mov $0xffffffff,%eax 8010699e: eb 18 jmp 801069b8 <sys_pipe+0xd6> } fd[0] = fd0; 801069a0: 8b 45 ec mov -0x14(%ebp),%eax 801069a3: 8b 55 f4 mov -0xc(%ebp),%edx 801069a6: 89 10 mov %edx,(%eax) fd[1] = fd1; 801069a8: 8b 45 ec mov -0x14(%ebp),%eax 801069ab: 8d 50 04 lea 0x4(%eax),%edx 801069ae: 8b 45 f0 mov -0x10(%ebp),%eax 801069b1: 89 02 mov %eax,(%edx) return 0; 801069b3: b8 00 00 00 00 mov $0x0,%eax } 801069b8: c9 leave 801069b9: c3 ret 801069ba <outw>: asm volatile("out %0,%1" : : "a" (data), "d" (port)); } static inline void outw(ushort port, ushort data) { 801069ba: 55 push %ebp 801069bb: 89 e5 mov %esp,%ebp 801069bd: 83 ec 08 sub $0x8,%esp 801069c0: 8b 55 08 mov 0x8(%ebp),%edx 801069c3: 8b 45 0c mov 0xc(%ebp),%eax 801069c6: 66 89 55 fc mov %dx,-0x4(%ebp) 801069ca: 66 89 45 f8 mov %ax,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801069ce: 0f b7 45 f8 movzwl -0x8(%ebp),%eax 801069d2: 0f b7 55 fc movzwl -0x4(%ebp),%edx 801069d6: 66 ef out %ax,(%dx) } 801069d8: 90 nop 801069d9: c9 leave 801069da: c3 ret 801069db <sys_fork>: #include "mmu.h" #include "proc.h" int sys_fork(void) { 801069db: 55 push %ebp 801069dc: 89 e5 mov %esp,%ebp 801069de: 83 ec 08 sub $0x8,%esp return fork(); 801069e1: e8 1b dd ff ff call 80104701 <fork> } 801069e6: c9 leave 801069e7: c3 ret 801069e8 <sys_exit>: int sys_exit(void) { 801069e8: 55 push %ebp 801069e9: 89 e5 mov %esp,%ebp 801069eb: 83 ec 08 sub $0x8,%esp exit(); 801069ee: e8 01 e1 ff ff call 80104af4 <exit> return 0; // not reached 801069f3: b8 00 00 00 00 mov $0x0,%eax } 801069f8: c9 leave 801069f9: c3 ret 801069fa <sys_wait>: int sys_wait(void) { 801069fa: 55 push %ebp 801069fb: 89 e5 mov %esp,%ebp 801069fd: 83 ec 08 sub $0x8,%esp return wait(); 80106a00: e8 ce e3 ff ff call 80104dd3 <wait> } 80106a05: c9 leave 80106a06: c3 ret 80106a07 <sys_kill>: int sys_kill(void) { 80106a07: 55 push %ebp 80106a08: 89 e5 mov %esp,%ebp 80106a0a: 83 ec 18 sub $0x18,%esp int pid; if(argint(0, &pid) < 0) 80106a0d: 83 ec 08 sub $0x8,%esp 80106a10: 8d 45 f4 lea -0xc(%ebp),%eax 80106a13: 50 push %eax 80106a14: 6a 00 push $0x0 80106a16: e8 dd f0 ff ff call 80105af8 <argint> 80106a1b: 83 c4 10 add $0x10,%esp 80106a1e: 85 c0 test %eax,%eax 80106a20: 79 07 jns 80106a29 <sys_kill+0x22> return -1; 80106a22: b8 ff ff ff ff mov $0xffffffff,%eax 80106a27: eb 0f jmp 80106a38 <sys_kill+0x31> return kill(pid); 80106a29: 8b 45 f4 mov -0xc(%ebp),%eax 80106a2c: 83 ec 0c sub $0xc,%esp 80106a2f: 50 push %eax 80106a30: e8 50 e9 ff ff call 80105385 <kill> 80106a35: 83 c4 10 add $0x10,%esp } 80106a38: c9 leave 80106a39: c3 ret 80106a3a <sys_getpid>: int sys_getpid(void) { 80106a3a: 55 push %ebp 80106a3b: 89 e5 mov %esp,%ebp 80106a3d: 83 ec 08 sub $0x8,%esp return getpid(); 80106a40: e8 c3 ea ff ff call 80105508 <getpid> } 80106a45: c9 leave 80106a46: c3 ret 80106a47 <sys_sbrk>: int sys_sbrk(void) { 80106a47: 55 push %ebp 80106a48: 89 e5 mov %esp,%ebp 80106a4a: 83 ec 18 sub $0x18,%esp int addr; int n; if(argint(0, &n) < 0) 80106a4d: 83 ec 08 sub $0x8,%esp 80106a50: 8d 45 f0 lea -0x10(%ebp),%eax 80106a53: 50 push %eax 80106a54: 6a 00 push $0x0 80106a56: e8 9d f0 ff ff call 80105af8 <argint> 80106a5b: 83 c4 10 add $0x10,%esp 80106a5e: 85 c0 test %eax,%eax 80106a60: 79 07 jns 80106a69 <sys_sbrk+0x22> return -1; 80106a62: b8 ff ff ff ff mov $0xffffffff,%eax 80106a67: eb 28 jmp 80106a91 <sys_sbrk+0x4a> addr = proc->sz; 80106a69: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106a6f: 8b 00 mov (%eax),%eax 80106a71: 89 45 f4 mov %eax,-0xc(%ebp) if(growproc(n) < 0) 80106a74: 8b 45 f0 mov -0x10(%ebp),%eax 80106a77: 83 ec 0c sub $0xc,%esp 80106a7a: 50 push %eax 80106a7b: e8 de db ff ff call 8010465e <growproc> 80106a80: 83 c4 10 add $0x10,%esp 80106a83: 85 c0 test %eax,%eax 80106a85: 79 07 jns 80106a8e <sys_sbrk+0x47> return -1; 80106a87: b8 ff ff ff ff mov $0xffffffff,%eax 80106a8c: eb 03 jmp 80106a91 <sys_sbrk+0x4a> return addr; 80106a8e: 8b 45 f4 mov -0xc(%ebp),%eax } 80106a91: c9 leave 80106a92: c3 ret 80106a93 <sys_sleep>: int sys_sleep(void) { 80106a93: 55 push %ebp 80106a94: 89 e5 mov %esp,%ebp 80106a96: 83 ec 18 sub $0x18,%esp int n; uint ticks0; if(argint(0, &n) < 0) 80106a99: 83 ec 08 sub $0x8,%esp 80106a9c: 8d 45 f0 lea -0x10(%ebp),%eax 80106a9f: 50 push %eax 80106aa0: 6a 00 push $0x0 80106aa2: e8 51 f0 ff ff call 80105af8 <argint> 80106aa7: 83 c4 10 add $0x10,%esp 80106aaa: 85 c0 test %eax,%eax 80106aac: 79 07 jns 80106ab5 <sys_sleep+0x22> return -1; 80106aae: b8 ff ff ff ff mov $0xffffffff,%eax 80106ab3: eb 77 jmp 80106b2c <sys_sleep+0x99> acquire(&tickslock); 80106ab5: 83 ec 0c sub $0xc,%esp 80106ab8: 68 c0 5c 11 80 push $0x80115cc0 80106abd: e8 ae ea ff ff call 80105570 <acquire> 80106ac2: 83 c4 10 add $0x10,%esp ticks0 = ticks; 80106ac5: a1 00 65 11 80 mov 0x80116500,%eax 80106aca: 89 45 f4 mov %eax,-0xc(%ebp) while(ticks - ticks0 < n){ 80106acd: eb 39 jmp 80106b08 <sys_sleep+0x75> if(proc->killed){ 80106acf: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106ad5: 8b 40 24 mov 0x24(%eax),%eax 80106ad8: 85 c0 test %eax,%eax 80106ada: 74 17 je 80106af3 <sys_sleep+0x60> release(&tickslock); 80106adc: 83 ec 0c sub $0xc,%esp 80106adf: 68 c0 5c 11 80 push $0x80115cc0 80106ae4: e8 ee ea ff ff call 801055d7 <release> 80106ae9: 83 c4 10 add $0x10,%esp return -1; 80106aec: b8 ff ff ff ff mov $0xffffffff,%eax 80106af1: eb 39 jmp 80106b2c <sys_sleep+0x99> } sleep(&ticks, &tickslock); 80106af3: 83 ec 08 sub $0x8,%esp 80106af6: 68 c0 5c 11 80 push $0x80115cc0 80106afb: 68 00 65 11 80 push $0x80116500 80106b00: e8 5b e7 ff ff call 80105260 <sleep> 80106b05: 83 c4 10 add $0x10,%esp if(argint(0, &n) < 0) return -1; acquire(&tickslock); ticks0 = ticks; while(ticks - ticks0 < n){ 80106b08: a1 00 65 11 80 mov 0x80116500,%eax 80106b0d: 2b 45 f4 sub -0xc(%ebp),%eax 80106b10: 8b 55 f0 mov -0x10(%ebp),%edx 80106b13: 39 d0 cmp %edx,%eax 80106b15: 72 b8 jb 80106acf <sys_sleep+0x3c> release(&tickslock); return -1; } sleep(&ticks, &tickslock); } release(&tickslock); 80106b17: 83 ec 0c sub $0xc,%esp 80106b1a: 68 c0 5c 11 80 push $0x80115cc0 80106b1f: e8 b3 ea ff ff call 801055d7 <release> 80106b24: 83 c4 10 add $0x10,%esp return 0; 80106b27: b8 00 00 00 00 mov $0x0,%eax } 80106b2c: c9 leave 80106b2d: c3 ret 80106b2e <sys_uptime>: // return how many clock tick interrupts have occurred // since start. int sys_uptime(void) { 80106b2e: 55 push %ebp 80106b2f: 89 e5 mov %esp,%ebp 80106b31: 83 ec 18 sub $0x18,%esp uint xticks; acquire(&tickslock); 80106b34: 83 ec 0c sub $0xc,%esp 80106b37: 68 c0 5c 11 80 push $0x80115cc0 80106b3c: e8 2f ea ff ff call 80105570 <acquire> 80106b41: 83 c4 10 add $0x10,%esp xticks = ticks; 80106b44: a1 00 65 11 80 mov 0x80116500,%eax 80106b49: 89 45 f4 mov %eax,-0xc(%ebp) release(&tickslock); 80106b4c: 83 ec 0c sub $0xc,%esp 80106b4f: 68 c0 5c 11 80 push $0x80115cc0 80106b54: e8 7e ea ff ff call 801055d7 <release> 80106b59: 83 c4 10 add $0x10,%esp return xticks; 80106b5c: 8b 45 f4 mov -0xc(%ebp),%eax } 80106b5f: c9 leave 80106b60: c3 ret 80106b61 <sys_halt>: int sys_halt(void) { 80106b61: 55 push %ebp 80106b62: 89 e5 mov %esp,%ebp outw(0xB004, 0x0|0x2000); 80106b64: 68 00 20 00 00 push $0x2000 80106b69: 68 04 b0 00 00 push $0xb004 80106b6e: e8 47 fe ff ff call 801069ba <outw> 80106b73: 83 c4 08 add $0x8,%esp return 0; 80106b76: b8 00 00 00 00 mov $0x0,%eax } 80106b7b: c9 leave 80106b7c: c3 ret 80106b7d <sys_thread_create>: int sys_thread_create(void){ 80106b7d: 55 push %ebp 80106b7e: 89 e5 mov %esp,%ebp 80106b80: 53 push %ebx 80106b81: 83 ec 14 sub $0x14,%esp int function, priority, arg, stack; if(argint(0, &function)<0 || argint(1, &priority)<0 || argint(2, &arg)<0 || argint(3, &stack)<0) 80106b84: 83 ec 08 sub $0x8,%esp 80106b87: 8d 45 f4 lea -0xc(%ebp),%eax 80106b8a: 50 push %eax 80106b8b: 6a 00 push $0x0 80106b8d: e8 66 ef ff ff call 80105af8 <argint> 80106b92: 83 c4 10 add $0x10,%esp 80106b95: 85 c0 test %eax,%eax 80106b97: 78 3f js 80106bd8 <sys_thread_create+0x5b> 80106b99: 83 ec 08 sub $0x8,%esp 80106b9c: 8d 45 f0 lea -0x10(%ebp),%eax 80106b9f: 50 push %eax 80106ba0: 6a 01 push $0x1 80106ba2: e8 51 ef ff ff call 80105af8 <argint> 80106ba7: 83 c4 10 add $0x10,%esp 80106baa: 85 c0 test %eax,%eax 80106bac: 78 2a js 80106bd8 <sys_thread_create+0x5b> 80106bae: 83 ec 08 sub $0x8,%esp 80106bb1: 8d 45 ec lea -0x14(%ebp),%eax 80106bb4: 50 push %eax 80106bb5: 6a 02 push $0x2 80106bb7: e8 3c ef ff ff call 80105af8 <argint> 80106bbc: 83 c4 10 add $0x10,%esp 80106bbf: 85 c0 test %eax,%eax 80106bc1: 78 15 js 80106bd8 <sys_thread_create+0x5b> 80106bc3: 83 ec 08 sub $0x8,%esp 80106bc6: 8d 45 e8 lea -0x18(%ebp),%eax 80106bc9: 50 push %eax 80106bca: 6a 03 push $0x3 80106bcc: e8 27 ef ff ff call 80105af8 <argint> 80106bd1: 83 c4 10 add $0x10,%esp 80106bd4: 85 c0 test %eax,%eax 80106bd6: 79 07 jns 80106bdf <sys_thread_create+0x62> return -1; 80106bd8: b8 ff ff ff ff mov $0xffffffff,%eax 80106bdd: eb 1c jmp 80106bfb <sys_thread_create+0x7e> return thread_create((void *(*)(void *))function, priority, (void *)arg, (void *)stack); 80106bdf: 8b 45 e8 mov -0x18(%ebp),%eax 80106be2: 89 c3 mov %eax,%ebx 80106be4: 8b 45 ec mov -0x14(%ebp),%eax 80106be7: 89 c1 mov %eax,%ecx 80106be9: 8b 45 f0 mov -0x10(%ebp),%eax 80106bec: 8b 55 f4 mov -0xc(%ebp),%edx 80106bef: 53 push %ebx 80106bf0: 51 push %ecx 80106bf1: 50 push %eax 80106bf2: 52 push %edx 80106bf3: e8 a1 20 00 00 call 80108c99 <thread_create> 80106bf8: 83 c4 10 add $0x10,%esp } 80106bfb: 8b 5d fc mov -0x4(%ebp),%ebx 80106bfe: c9 leave 80106bff: c3 ret 80106c00 <sys_thread_exit>: int sys_thread_exit(void){ 80106c00: 55 push %ebp 80106c01: 89 e5 mov %esp,%ebp 80106c03: 83 ec 18 sub $0x18,%esp int retval; if(argint(0, &retval)<0) 80106c06: 83 ec 08 sub $0x8,%esp 80106c09: 8d 45 f4 lea -0xc(%ebp),%eax 80106c0c: 50 push %eax 80106c0d: 6a 00 push $0x0 80106c0f: e8 e4 ee ff ff call 80105af8 <argint> 80106c14: 83 c4 10 add $0x10,%esp 80106c17: 85 c0 test %eax,%eax 80106c19: 79 07 jns 80106c22 <sys_thread_exit+0x22> return -1; 80106c1b: b8 ff ff ff ff mov $0xffffffff,%eax 80106c20: eb 14 jmp 80106c36 <sys_thread_exit+0x36> thread_exit((void *)retval); 80106c22: 8b 45 f4 mov -0xc(%ebp),%eax 80106c25: 83 ec 0c sub $0xc,%esp 80106c28: 50 push %eax 80106c29: e8 98 20 00 00 call 80108cc6 <thread_exit> 80106c2e: 83 c4 10 add $0x10,%esp return 0; 80106c31: b8 00 00 00 00 mov $0x0,%eax } 80106c36: c9 leave 80106c37: c3 ret 80106c38 <sys_thread_join>: int sys_thread_join(void){ 80106c38: 55 push %ebp 80106c39: 89 e5 mov %esp,%ebp 80106c3b: 83 ec 18 sub $0x18,%esp int tid, retval; if(argint(0, &tid)<0 || argint(1, &retval)<0) 80106c3e: 83 ec 08 sub $0x8,%esp 80106c41: 8d 45 f4 lea -0xc(%ebp),%eax 80106c44: 50 push %eax 80106c45: 6a 00 push $0x0 80106c47: e8 ac ee ff ff call 80105af8 <argint> 80106c4c: 83 c4 10 add $0x10,%esp 80106c4f: 85 c0 test %eax,%eax 80106c51: 78 15 js 80106c68 <sys_thread_join+0x30> 80106c53: 83 ec 08 sub $0x8,%esp 80106c56: 8d 45 f0 lea -0x10(%ebp),%eax 80106c59: 50 push %eax 80106c5a: 6a 01 push $0x1 80106c5c: e8 97 ee ff ff call 80105af8 <argint> 80106c61: 83 c4 10 add $0x10,%esp 80106c64: 85 c0 test %eax,%eax 80106c66: 79 07 jns 80106c6f <sys_thread_join+0x37> return -1; 80106c68: b8 ff ff ff ff mov $0xffffffff,%eax 80106c6d: eb 15 jmp 80106c84 <sys_thread_join+0x4c> return thread_join(tid, (void **)retval); 80106c6f: 8b 45 f0 mov -0x10(%ebp),%eax 80106c72: 89 c2 mov %eax,%edx 80106c74: 8b 45 f4 mov -0xc(%ebp),%eax 80106c77: 83 ec 08 sub $0x8,%esp 80106c7a: 52 push %edx 80106c7b: 50 push %eax 80106c7c: e8 5c 20 00 00 call 80108cdd <thread_join> 80106c81: 83 c4 10 add $0x10,%esp } 80106c84: c9 leave 80106c85: c3 ret 80106c86 <sys_gettid>: int sys_gettid(void){ 80106c86: 55 push %ebp 80106c87: 89 e5 mov %esp,%ebp 80106c89: 83 ec 08 sub $0x8,%esp return gettid(); 80106c8c: e8 92 20 00 00 call 80108d23 <gettid> } 80106c91: c9 leave 80106c92: c3 ret 80106c93 <sys_clone>: int sys_clone(void){ 80106c93: 55 push %ebp 80106c94: 89 e5 mov %esp,%ebp 80106c96: 83 ec 18 sub $0x18,%esp int function,arg, stack; if(argint(0, &function)<0 || argint(1, &arg)<0 || argint(2, &stack)<0) 80106c99: 83 ec 08 sub $0x8,%esp 80106c9c: 8d 45 f4 lea -0xc(%ebp),%eax 80106c9f: 50 push %eax 80106ca0: 6a 00 push $0x0 80106ca2: e8 51 ee ff ff call 80105af8 <argint> 80106ca7: 83 c4 10 add $0x10,%esp 80106caa: 85 c0 test %eax,%eax 80106cac: 78 2a js 80106cd8 <sys_clone+0x45> 80106cae: 83 ec 08 sub $0x8,%esp 80106cb1: 8d 45 f0 lea -0x10(%ebp),%eax 80106cb4: 50 push %eax 80106cb5: 6a 01 push $0x1 80106cb7: e8 3c ee ff ff call 80105af8 <argint> 80106cbc: 83 c4 10 add $0x10,%esp 80106cbf: 85 c0 test %eax,%eax 80106cc1: 78 15 js 80106cd8 <sys_clone+0x45> 80106cc3: 83 ec 08 sub $0x8,%esp 80106cc6: 8d 45 ec lea -0x14(%ebp),%eax 80106cc9: 50 push %eax 80106cca: 6a 02 push $0x2 80106ccc: e8 27 ee ff ff call 80105af8 <argint> 80106cd1: 83 c4 10 add $0x10,%esp 80106cd4: 85 c0 test %eax,%eax 80106cd6: 79 07 jns 80106cdf <sys_clone+0x4c> return -1; 80106cd8: b8 ff ff ff ff mov $0xffffffff,%eax 80106cdd: eb 1b jmp 80106cfa <sys_clone+0x67> // return 0; return clone((void *(*)(void*))function,(void*)arg,(void*)stack); 80106cdf: 8b 45 ec mov -0x14(%ebp),%eax 80106ce2: 89 c1 mov %eax,%ecx 80106ce4: 8b 45 f0 mov -0x10(%ebp),%eax 80106ce7: 89 c2 mov %eax,%edx 80106ce9: 8b 45 f4 mov -0xc(%ebp),%eax 80106cec: 83 ec 04 sub $0x4,%esp 80106cef: 51 push %ecx 80106cf0: 52 push %edx 80106cf1: 50 push %eax 80106cf2: e8 b0 db ff ff call 801048a7 <clone> 80106cf7: 83 c4 10 add $0x10,%esp } 80106cfa: c9 leave 80106cfb: c3 ret 80106cfc <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 80106cfc: 55 push %ebp 80106cfd: 89 e5 mov %esp,%ebp 80106cff: 83 ec 08 sub $0x8,%esp 80106d02: 8b 55 08 mov 0x8(%ebp),%edx 80106d05: 8b 45 0c mov 0xc(%ebp),%eax 80106d08: 66 89 55 fc mov %dx,-0x4(%ebp) 80106d0c: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80106d0f: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80106d13: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80106d17: ee out %al,(%dx) } 80106d18: 90 nop 80106d19: c9 leave 80106d1a: c3 ret 80106d1b <timerinit>: #define TIMER_RATEGEN 0x04 // mode 2, rate generator #define TIMER_16BIT 0x30 // r/w counter 16 bits, LSB first void timerinit(void) { 80106d1b: 55 push %ebp 80106d1c: 89 e5 mov %esp,%ebp 80106d1e: 83 ec 08 sub $0x8,%esp // Interrupt 100 times/sec. outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); 80106d21: 6a 34 push $0x34 80106d23: 6a 43 push $0x43 80106d25: e8 d2 ff ff ff call 80106cfc <outb> 80106d2a: 83 c4 08 add $0x8,%esp outb(IO_TIMER1, TIMER_DIV(100) % 256); 80106d2d: 68 9c 00 00 00 push $0x9c 80106d32: 6a 40 push $0x40 80106d34: e8 c3 ff ff ff call 80106cfc <outb> 80106d39: 83 c4 08 add $0x8,%esp outb(IO_TIMER1, TIMER_DIV(100) / 256); 80106d3c: 6a 2e push $0x2e 80106d3e: 6a 40 push $0x40 80106d40: e8 b7 ff ff ff call 80106cfc <outb> 80106d45: 83 c4 08 add $0x8,%esp picenable(IRQ_TIMER); 80106d48: 83 ec 0c sub $0xc,%esp 80106d4b: 6a 00 push $0x0 80106d4d: e8 79 d1 ff ff call 80103ecb <picenable> 80106d52: 83 c4 10 add $0x10,%esp } 80106d55: 90 nop 80106d56: c9 leave 80106d57: c3 ret 80106d58 <alltraps>: # vectors.S sends all traps here. .globl alltraps alltraps: # Build trap frame. pushl %ds 80106d58: 1e push %ds pushl %es 80106d59: 06 push %es pushl %fs 80106d5a: 0f a0 push %fs pushl %gs 80106d5c: 0f a8 push %gs pushal 80106d5e: 60 pusha # Set up data and per-cpu segments. movw $(SEG_KDATA<<3), %ax 80106d5f: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds 80106d63: 8e d8 mov %eax,%ds movw %ax, %es 80106d65: 8e c0 mov %eax,%es movw $(SEG_KCPU<<3), %ax 80106d67: 66 b8 18 00 mov $0x18,%ax movw %ax, %fs 80106d6b: 8e e0 mov %eax,%fs movw %ax, %gs 80106d6d: 8e e8 mov %eax,%gs # Call trap(tf), where tf=%esp pushl %esp 80106d6f: 54 push %esp call trap 80106d70: e8 d7 01 00 00 call 80106f4c <trap> addl $4, %esp 80106d75: 83 c4 04 add $0x4,%esp 80106d78 <trapret>: # Return falls through to trapret... .globl trapret trapret: popal 80106d78: 61 popa popl %gs 80106d79: 0f a9 pop %gs popl %fs 80106d7b: 0f a1 pop %fs popl %es 80106d7d: 07 pop %es popl %ds 80106d7e: 1f pop %ds addl $0x8, %esp # trapno and errcode 80106d7f: 83 c4 08 add $0x8,%esp iret 80106d82: cf iret 80106d83 <lidt>: struct gatedesc; static inline void lidt(struct gatedesc *p, int size) { 80106d83: 55 push %ebp 80106d84: 89 e5 mov %esp,%ebp 80106d86: 83 ec 10 sub $0x10,%esp volatile ushort pd[3]; pd[0] = size-1; 80106d89: 8b 45 0c mov 0xc(%ebp),%eax 80106d8c: 83 e8 01 sub $0x1,%eax 80106d8f: 66 89 45 fa mov %ax,-0x6(%ebp) pd[1] = (uint)p; 80106d93: 8b 45 08 mov 0x8(%ebp),%eax 80106d96: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 80106d9a: 8b 45 08 mov 0x8(%ebp),%eax 80106d9d: c1 e8 10 shr $0x10,%eax 80106da0: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile("lidt (%0)" : : "r" (pd)); 80106da4: 8d 45 fa lea -0x6(%ebp),%eax 80106da7: 0f 01 18 lidtl (%eax) } 80106daa: 90 nop 80106dab: c9 leave 80106dac: c3 ret 80106dad <rcr2>: return result; } static inline uint rcr2(void) { 80106dad: 55 push %ebp 80106dae: 89 e5 mov %esp,%ebp 80106db0: 83 ec 10 sub $0x10,%esp uint val; asm volatile("movl %%cr2,%0" : "=r" (val)); 80106db3: 0f 20 d0 mov %cr2,%eax 80106db6: 89 45 fc mov %eax,-0x4(%ebp) return val; 80106db9: 8b 45 fc mov -0x4(%ebp),%eax } 80106dbc: c9 leave 80106dbd: c3 ret 80106dbe <tvinit>: struct spinlock tickslock; uint ticks; void tvinit(void) { 80106dbe: 55 push %ebp 80106dbf: 89 e5 mov %esp,%ebp 80106dc1: 83 ec 18 sub $0x18,%esp int i; for(i = 0; i < 256; i++) 80106dc4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80106dcb: e9 c3 00 00 00 jmp 80106e93 <tvinit+0xd5> SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); 80106dd0: 8b 45 f4 mov -0xc(%ebp),%eax 80106dd3: 8b 04 85 b0 c0 10 80 mov -0x7fef3f50(,%eax,4),%eax 80106dda: 89 c2 mov %eax,%edx 80106ddc: 8b 45 f4 mov -0xc(%ebp),%eax 80106ddf: 66 89 14 c5 00 5d 11 mov %dx,-0x7feea300(,%eax,8) 80106de6: 80 80106de7: 8b 45 f4 mov -0xc(%ebp),%eax 80106dea: 66 c7 04 c5 02 5d 11 movw $0x8,-0x7feea2fe(,%eax,8) 80106df1: 80 08 00 80106df4: 8b 45 f4 mov -0xc(%ebp),%eax 80106df7: 0f b6 14 c5 04 5d 11 movzbl -0x7feea2fc(,%eax,8),%edx 80106dfe: 80 80106dff: 83 e2 e0 and $0xffffffe0,%edx 80106e02: 88 14 c5 04 5d 11 80 mov %dl,-0x7feea2fc(,%eax,8) 80106e09: 8b 45 f4 mov -0xc(%ebp),%eax 80106e0c: 0f b6 14 c5 04 5d 11 movzbl -0x7feea2fc(,%eax,8),%edx 80106e13: 80 80106e14: 83 e2 1f and $0x1f,%edx 80106e17: 88 14 c5 04 5d 11 80 mov %dl,-0x7feea2fc(,%eax,8) 80106e1e: 8b 45 f4 mov -0xc(%ebp),%eax 80106e21: 0f b6 14 c5 05 5d 11 movzbl -0x7feea2fb(,%eax,8),%edx 80106e28: 80 80106e29: 83 e2 f0 and $0xfffffff0,%edx 80106e2c: 83 ca 0e or $0xe,%edx 80106e2f: 88 14 c5 05 5d 11 80 mov %dl,-0x7feea2fb(,%eax,8) 80106e36: 8b 45 f4 mov -0xc(%ebp),%eax 80106e39: 0f b6 14 c5 05 5d 11 movzbl -0x7feea2fb(,%eax,8),%edx 80106e40: 80 80106e41: 83 e2 ef and $0xffffffef,%edx 80106e44: 88 14 c5 05 5d 11 80 mov %dl,-0x7feea2fb(,%eax,8) 80106e4b: 8b 45 f4 mov -0xc(%ebp),%eax 80106e4e: 0f b6 14 c5 05 5d 11 movzbl -0x7feea2fb(,%eax,8),%edx 80106e55: 80 80106e56: 83 e2 9f and $0xffffff9f,%edx 80106e59: 88 14 c5 05 5d 11 80 mov %dl,-0x7feea2fb(,%eax,8) 80106e60: 8b 45 f4 mov -0xc(%ebp),%eax 80106e63: 0f b6 14 c5 05 5d 11 movzbl -0x7feea2fb(,%eax,8),%edx 80106e6a: 80 80106e6b: 83 ca 80 or $0xffffff80,%edx 80106e6e: 88 14 c5 05 5d 11 80 mov %dl,-0x7feea2fb(,%eax,8) 80106e75: 8b 45 f4 mov -0xc(%ebp),%eax 80106e78: 8b 04 85 b0 c0 10 80 mov -0x7fef3f50(,%eax,4),%eax 80106e7f: c1 e8 10 shr $0x10,%eax 80106e82: 89 c2 mov %eax,%edx 80106e84: 8b 45 f4 mov -0xc(%ebp),%eax 80106e87: 66 89 14 c5 06 5d 11 mov %dx,-0x7feea2fa(,%eax,8) 80106e8e: 80 void tvinit(void) { int i; for(i = 0; i < 256; i++) 80106e8f: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80106e93: 81 7d f4 ff 00 00 00 cmpl $0xff,-0xc(%ebp) 80106e9a: 0f 8e 30 ff ff ff jle 80106dd0 <tvinit+0x12> SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); 80106ea0: a1 b0 c1 10 80 mov 0x8010c1b0,%eax 80106ea5: 66 a3 00 5f 11 80 mov %ax,0x80115f00 80106eab: 66 c7 05 02 5f 11 80 movw $0x8,0x80115f02 80106eb2: 08 00 80106eb4: 0f b6 05 04 5f 11 80 movzbl 0x80115f04,%eax 80106ebb: 83 e0 e0 and $0xffffffe0,%eax 80106ebe: a2 04 5f 11 80 mov %al,0x80115f04 80106ec3: 0f b6 05 04 5f 11 80 movzbl 0x80115f04,%eax 80106eca: 83 e0 1f and $0x1f,%eax 80106ecd: a2 04 5f 11 80 mov %al,0x80115f04 80106ed2: 0f b6 05 05 5f 11 80 movzbl 0x80115f05,%eax 80106ed9: 83 c8 0f or $0xf,%eax 80106edc: a2 05 5f 11 80 mov %al,0x80115f05 80106ee1: 0f b6 05 05 5f 11 80 movzbl 0x80115f05,%eax 80106ee8: 83 e0 ef and $0xffffffef,%eax 80106eeb: a2 05 5f 11 80 mov %al,0x80115f05 80106ef0: 0f b6 05 05 5f 11 80 movzbl 0x80115f05,%eax 80106ef7: 83 c8 60 or $0x60,%eax 80106efa: a2 05 5f 11 80 mov %al,0x80115f05 80106eff: 0f b6 05 05 5f 11 80 movzbl 0x80115f05,%eax 80106f06: 83 c8 80 or $0xffffff80,%eax 80106f09: a2 05 5f 11 80 mov %al,0x80115f05 80106f0e: a1 b0 c1 10 80 mov 0x8010c1b0,%eax 80106f13: c1 e8 10 shr $0x10,%eax 80106f16: 66 a3 06 5f 11 80 mov %ax,0x80115f06 initlock(&tickslock, "time"); 80106f1c: 83 ec 08 sub $0x8,%esp 80106f1f: 68 9c 91 10 80 push $0x8010919c 80106f24: 68 c0 5c 11 80 push $0x80115cc0 80106f29: e8 20 e6 ff ff call 8010554e <initlock> 80106f2e: 83 c4 10 add $0x10,%esp } 80106f31: 90 nop 80106f32: c9 leave 80106f33: c3 ret 80106f34 <idtinit>: void idtinit(void) { 80106f34: 55 push %ebp 80106f35: 89 e5 mov %esp,%ebp lidt(idt, sizeof(idt)); 80106f37: 68 00 08 00 00 push $0x800 80106f3c: 68 00 5d 11 80 push $0x80115d00 80106f41: e8 3d fe ff ff call 80106d83 <lidt> 80106f46: 83 c4 08 add $0x8,%esp } 80106f49: 90 nop 80106f4a: c9 leave 80106f4b: c3 ret 80106f4c <trap>: //PAGEBREAK: 41 void trap(struct trapframe *tf) { 80106f4c: 55 push %ebp 80106f4d: 89 e5 mov %esp,%ebp 80106f4f: 57 push %edi 80106f50: 56 push %esi 80106f51: 53 push %ebx 80106f52: 83 ec 1c sub $0x1c,%esp if(tf->trapno == T_SYSCALL){ 80106f55: 8b 45 08 mov 0x8(%ebp),%eax 80106f58: 8b 40 30 mov 0x30(%eax),%eax 80106f5b: 83 f8 40 cmp $0x40,%eax 80106f5e: 75 3e jne 80106f9e <trap+0x52> if(proc->killed) 80106f60: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106f66: 8b 40 24 mov 0x24(%eax),%eax 80106f69: 85 c0 test %eax,%eax 80106f6b: 74 05 je 80106f72 <trap+0x26> exit(); 80106f6d: e8 82 db ff ff call 80104af4 <exit> proc->tf = tf; 80106f72: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106f78: 8b 55 08 mov 0x8(%ebp),%edx 80106f7b: 89 50 18 mov %edx,0x18(%eax) syscall(); 80106f7e: e8 2b ec ff ff call 80105bae <syscall> if(proc->killed) 80106f83: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106f89: 8b 40 24 mov 0x24(%eax),%eax 80106f8c: 85 c0 test %eax,%eax 80106f8e: 0f 84 1b 02 00 00 je 801071af <trap+0x263> exit(); 80106f94: e8 5b db ff ff call 80104af4 <exit> return; 80106f99: e9 11 02 00 00 jmp 801071af <trap+0x263> } switch(tf->trapno){ 80106f9e: 8b 45 08 mov 0x8(%ebp),%eax 80106fa1: 8b 40 30 mov 0x30(%eax),%eax 80106fa4: 83 e8 20 sub $0x20,%eax 80106fa7: 83 f8 1f cmp $0x1f,%eax 80106faa: 0f 87 c0 00 00 00 ja 80107070 <trap+0x124> 80106fb0: 8b 04 85 44 92 10 80 mov -0x7fef6dbc(,%eax,4),%eax 80106fb7: ff e0 jmp *%eax case T_IRQ0 + IRQ_TIMER: if(cpu->id == 0){ 80106fb9: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80106fbf: 0f b6 00 movzbl (%eax),%eax 80106fc2: 84 c0 test %al,%al 80106fc4: 75 3d jne 80107003 <trap+0xb7> acquire(&tickslock); 80106fc6: 83 ec 0c sub $0xc,%esp 80106fc9: 68 c0 5c 11 80 push $0x80115cc0 80106fce: e8 9d e5 ff ff call 80105570 <acquire> 80106fd3: 83 c4 10 add $0x10,%esp ticks++; 80106fd6: a1 00 65 11 80 mov 0x80116500,%eax 80106fdb: 83 c0 01 add $0x1,%eax 80106fde: a3 00 65 11 80 mov %eax,0x80116500 wakeup(&ticks); 80106fe3: 83 ec 0c sub $0xc,%esp 80106fe6: 68 00 65 11 80 push $0x80116500 80106feb: e8 5e e3 ff ff call 8010534e <wakeup> 80106ff0: 83 c4 10 add $0x10,%esp release(&tickslock); 80106ff3: 83 ec 0c sub $0xc,%esp 80106ff6: 68 c0 5c 11 80 push $0x80115cc0 80106ffb: e8 d7 e5 ff ff call 801055d7 <release> 80107000: 83 c4 10 add $0x10,%esp } lapiceoi(); 80107003: e8 f7 bf ff ff call 80102fff <lapiceoi> break; 80107008: e9 1c 01 00 00 jmp 80107129 <trap+0x1dd> case T_IRQ0 + IRQ_IDE: ideintr(); 8010700d: e8 dc b7 ff ff call 801027ee <ideintr> lapiceoi(); 80107012: e8 e8 bf ff ff call 80102fff <lapiceoi> break; 80107017: e9 0d 01 00 00 jmp 80107129 <trap+0x1dd> case T_IRQ0 + IRQ_IDE+1: // Bochs generates spurious IDE1 interrupts. break; case T_IRQ0 + IRQ_KBD: kbdintr(); 8010701c: e8 e0 bd ff ff call 80102e01 <kbdintr> lapiceoi(); 80107021: e8 d9 bf ff ff call 80102fff <lapiceoi> break; 80107026: e9 fe 00 00 00 jmp 80107129 <trap+0x1dd> case T_IRQ0 + IRQ_COM1: uartintr(); 8010702b: e8 34 03 00 00 call 80107364 <uartintr> lapiceoi(); 80107030: e8 ca bf ff ff call 80102fff <lapiceoi> break; 80107035: e9 ef 00 00 00 jmp 80107129 <trap+0x1dd> case T_IRQ0 + 7: case T_IRQ0 + IRQ_SPURIOUS: cprintf("cpu%d: spurious interrupt at %x:%x\n", 8010703a: 8b 45 08 mov 0x8(%ebp),%eax 8010703d: 8b 48 38 mov 0x38(%eax),%ecx cpu->id, tf->cs, tf->eip); 80107040: 8b 45 08 mov 0x8(%ebp),%eax 80107043: 0f b7 40 3c movzwl 0x3c(%eax),%eax uartintr(); lapiceoi(); break; case T_IRQ0 + 7: case T_IRQ0 + IRQ_SPURIOUS: cprintf("cpu%d: spurious interrupt at %x:%x\n", 80107047: 0f b7 d0 movzwl %ax,%edx cpu->id, tf->cs, tf->eip); 8010704a: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80107050: 0f b6 00 movzbl (%eax),%eax uartintr(); lapiceoi(); break; case T_IRQ0 + 7: case T_IRQ0 + IRQ_SPURIOUS: cprintf("cpu%d: spurious interrupt at %x:%x\n", 80107053: 0f b6 c0 movzbl %al,%eax 80107056: 51 push %ecx 80107057: 52 push %edx 80107058: 50 push %eax 80107059: 68 a4 91 10 80 push $0x801091a4 8010705e: e8 63 93 ff ff call 801003c6 <cprintf> 80107063: 83 c4 10 add $0x10,%esp cpu->id, tf->cs, tf->eip); lapiceoi(); 80107066: e8 94 bf ff ff call 80102fff <lapiceoi> break; 8010706b: e9 b9 00 00 00 jmp 80107129 <trap+0x1dd> //PAGEBREAK: 13 default: if(proc == 0 || (tf->cs&3) == 0){ 80107070: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107076: 85 c0 test %eax,%eax 80107078: 74 11 je 8010708b <trap+0x13f> 8010707a: 8b 45 08 mov 0x8(%ebp),%eax 8010707d: 0f b7 40 3c movzwl 0x3c(%eax),%eax 80107081: 0f b7 c0 movzwl %ax,%eax 80107084: 83 e0 03 and $0x3,%eax 80107087: 85 c0 test %eax,%eax 80107089: 75 40 jne 801070cb <trap+0x17f> // In kernel, it must be our mistake. cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", 8010708b: e8 1d fd ff ff call 80106dad <rcr2> 80107090: 89 c3 mov %eax,%ebx 80107092: 8b 45 08 mov 0x8(%ebp),%eax 80107095: 8b 48 38 mov 0x38(%eax),%ecx tf->trapno, cpu->id, tf->eip, rcr2()); 80107098: 65 a1 00 00 00 00 mov %gs:0x0,%eax 8010709e: 0f b6 00 movzbl (%eax),%eax //PAGEBREAK: 13 default: if(proc == 0 || (tf->cs&3) == 0){ // In kernel, it must be our mistake. cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", 801070a1: 0f b6 d0 movzbl %al,%edx 801070a4: 8b 45 08 mov 0x8(%ebp),%eax 801070a7: 8b 40 30 mov 0x30(%eax),%eax 801070aa: 83 ec 0c sub $0xc,%esp 801070ad: 53 push %ebx 801070ae: 51 push %ecx 801070af: 52 push %edx 801070b0: 50 push %eax 801070b1: 68 c8 91 10 80 push $0x801091c8 801070b6: e8 0b 93 ff ff call 801003c6 <cprintf> 801070bb: 83 c4 20 add $0x20,%esp tf->trapno, cpu->id, tf->eip, rcr2()); panic("trap"); 801070be: 83 ec 0c sub $0xc,%esp 801070c1: 68 fa 91 10 80 push $0x801091fa 801070c6: e8 9b 94 ff ff call 80100566 <panic> } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 801070cb: e8 dd fc ff ff call 80106dad <rcr2> 801070d0: 89 45 e4 mov %eax,-0x1c(%ebp) 801070d3: 8b 45 08 mov 0x8(%ebp),%eax 801070d6: 8b 70 38 mov 0x38(%eax),%esi "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 801070d9: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801070df: 0f b6 00 movzbl (%eax),%eax cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpu->id, tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 801070e2: 0f b6 d8 movzbl %al,%ebx 801070e5: 8b 45 08 mov 0x8(%ebp),%eax 801070e8: 8b 48 34 mov 0x34(%eax),%ecx 801070eb: 8b 45 08 mov 0x8(%ebp),%eax 801070ee: 8b 50 30 mov 0x30(%eax),%edx "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 801070f1: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801070f7: 8d 78 6c lea 0x6c(%eax),%edi 801070fa: 65 a1 04 00 00 00 mov %gs:0x4,%eax cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpu->id, tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 80107100: 8b 40 10 mov 0x10(%eax),%eax 80107103: ff 75 e4 pushl -0x1c(%ebp) 80107106: 56 push %esi 80107107: 53 push %ebx 80107108: 51 push %ecx 80107109: 52 push %edx 8010710a: 57 push %edi 8010710b: 50 push %eax 8010710c: 68 00 92 10 80 push $0x80109200 80107111: e8 b0 92 ff ff call 801003c6 <cprintf> 80107116: 83 c4 20 add $0x20,%esp "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, rcr2()); proc->killed = 1; 80107119: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010711f: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) 80107126: eb 01 jmp 80107129 <trap+0x1dd> ideintr(); lapiceoi(); break; case T_IRQ0 + IRQ_IDE+1: // Bochs generates spurious IDE1 interrupts. break; 80107128: 90 nop } // Force process exit if it has been killed and is in user space. // (If it is still executing in the kernel, let it keep running // until it gets to the regular system call return.) if(proc && proc->killed && (tf->cs&3) == DPL_USER) 80107129: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010712f: 85 c0 test %eax,%eax 80107131: 74 24 je 80107157 <trap+0x20b> 80107133: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107139: 8b 40 24 mov 0x24(%eax),%eax 8010713c: 85 c0 test %eax,%eax 8010713e: 74 17 je 80107157 <trap+0x20b> 80107140: 8b 45 08 mov 0x8(%ebp),%eax 80107143: 0f b7 40 3c movzwl 0x3c(%eax),%eax 80107147: 0f b7 c0 movzwl %ax,%eax 8010714a: 83 e0 03 and $0x3,%eax 8010714d: 83 f8 03 cmp $0x3,%eax 80107150: 75 05 jne 80107157 <trap+0x20b> exit(); 80107152: e8 9d d9 ff ff call 80104af4 <exit> // Force process to give up CPU on clock tick. // If interrupts were on while locks held, would need to check nlock. if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER) 80107157: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010715d: 85 c0 test %eax,%eax 8010715f: 74 1e je 8010717f <trap+0x233> 80107161: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107167: 8b 40 0c mov 0xc(%eax),%eax 8010716a: 83 f8 04 cmp $0x4,%eax 8010716d: 75 10 jne 8010717f <trap+0x233> 8010716f: 8b 45 08 mov 0x8(%ebp),%eax 80107172: 8b 40 30 mov 0x30(%eax),%eax 80107175: 83 f8 20 cmp $0x20,%eax 80107178: 75 05 jne 8010717f <trap+0x233> yield(); 8010717a: e8 60 e0 ff ff call 801051df <yield> // Check if the process has been killed since we yielded if(proc && proc->killed && (tf->cs&3) == DPL_USER) 8010717f: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107185: 85 c0 test %eax,%eax 80107187: 74 27 je 801071b0 <trap+0x264> 80107189: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010718f: 8b 40 24 mov 0x24(%eax),%eax 80107192: 85 c0 test %eax,%eax 80107194: 74 1a je 801071b0 <trap+0x264> 80107196: 8b 45 08 mov 0x8(%ebp),%eax 80107199: 0f b7 40 3c movzwl 0x3c(%eax),%eax 8010719d: 0f b7 c0 movzwl %ax,%eax 801071a0: 83 e0 03 and $0x3,%eax 801071a3: 83 f8 03 cmp $0x3,%eax 801071a6: 75 08 jne 801071b0 <trap+0x264> exit(); 801071a8: e8 47 d9 ff ff call 80104af4 <exit> 801071ad: eb 01 jmp 801071b0 <trap+0x264> exit(); proc->tf = tf; syscall(); if(proc->killed) exit(); return; 801071af: 90 nop yield(); // Check if the process has been killed since we yielded if(proc && proc->killed && (tf->cs&3) == DPL_USER) exit(); } 801071b0: 8d 65 f4 lea -0xc(%ebp),%esp 801071b3: 5b pop %ebx 801071b4: 5e pop %esi 801071b5: 5f pop %edi 801071b6: 5d pop %ebp 801071b7: c3 ret 801071b8 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 801071b8: 55 push %ebp 801071b9: 89 e5 mov %esp,%ebp 801071bb: 83 ec 14 sub $0x14,%esp 801071be: 8b 45 08 mov 0x8(%ebp),%eax 801071c1: 66 89 45 ec mov %ax,-0x14(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801071c5: 0f b7 45 ec movzwl -0x14(%ebp),%eax 801071c9: 89 c2 mov %eax,%edx 801071cb: ec in (%dx),%al 801071cc: 88 45 ff mov %al,-0x1(%ebp) return data; 801071cf: 0f b6 45 ff movzbl -0x1(%ebp),%eax } 801071d3: c9 leave 801071d4: c3 ret 801071d5 <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 801071d5: 55 push %ebp 801071d6: 89 e5 mov %esp,%ebp 801071d8: 83 ec 08 sub $0x8,%esp 801071db: 8b 55 08 mov 0x8(%ebp),%edx 801071de: 8b 45 0c mov 0xc(%ebp),%eax 801071e1: 66 89 55 fc mov %dx,-0x4(%ebp) 801071e5: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801071e8: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 801071ec: 0f b7 55 fc movzwl -0x4(%ebp),%edx 801071f0: ee out %al,(%dx) } 801071f1: 90 nop 801071f2: c9 leave 801071f3: c3 ret 801071f4 <uartinit>: static int uart; // is there a uart? void uartinit(void) { 801071f4: 55 push %ebp 801071f5: 89 e5 mov %esp,%ebp 801071f7: 83 ec 08 sub $0x8,%esp // Turn off the FIFO outb(COM1+2, 0); 801071fa: 6a 00 push $0x0 801071fc: 68 fa 03 00 00 push $0x3fa 80107201: e8 cf ff ff ff call 801071d5 <outb> 80107206: 83 c4 08 add $0x8,%esp // 9600 baud, 8 data bits, 1 stop bit, parity off. outb(COM1+3, 0x80); // Unlock divisor 80107209: 68 80 00 00 00 push $0x80 8010720e: 68 fb 03 00 00 push $0x3fb 80107213: e8 bd ff ff ff call 801071d5 <outb> 80107218: 83 c4 08 add $0x8,%esp outb(COM1+0, 115200/9600); 8010721b: 6a 0c push $0xc 8010721d: 68 f8 03 00 00 push $0x3f8 80107222: e8 ae ff ff ff call 801071d5 <outb> 80107227: 83 c4 08 add $0x8,%esp outb(COM1+1, 0); 8010722a: 6a 00 push $0x0 8010722c: 68 f9 03 00 00 push $0x3f9 80107231: e8 9f ff ff ff call 801071d5 <outb> 80107236: 83 c4 08 add $0x8,%esp outb(COM1+3, 0x03); // Lock divisor, 8 data bits. 80107239: 6a 03 push $0x3 8010723b: 68 fb 03 00 00 push $0x3fb 80107240: e8 90 ff ff ff call 801071d5 <outb> 80107245: 83 c4 08 add $0x8,%esp outb(COM1+4, 0); 80107248: 6a 00 push $0x0 8010724a: 68 fc 03 00 00 push $0x3fc 8010724f: e8 81 ff ff ff call 801071d5 <outb> 80107254: 83 c4 08 add $0x8,%esp outb(COM1+1, 0x01); // Enable receive interrupts. 80107257: 6a 01 push $0x1 80107259: 68 f9 03 00 00 push $0x3f9 8010725e: e8 72 ff ff ff call 801071d5 <outb> 80107263: 83 c4 08 add $0x8,%esp // If status is 0xFF, no serial port. if(inb(COM1+5) == 0xFF) 80107266: 68 fd 03 00 00 push $0x3fd 8010726b: e8 48 ff ff ff call 801071b8 <inb> 80107270: 83 c4 04 add $0x4,%esp 80107273: 3c ff cmp $0xff,%al 80107275: 74 42 je 801072b9 <uartinit+0xc5> return; uart = 1; 80107277: c7 05 70 c6 10 80 01 movl $0x1,0x8010c670 8010727e: 00 00 00 // Acknowledge pre-existing interrupt conditions; // enable interrupts. inb(COM1+2); 80107281: 68 fa 03 00 00 push $0x3fa 80107286: e8 2d ff ff ff call 801071b8 <inb> 8010728b: 83 c4 04 add $0x4,%esp inb(COM1+0); 8010728e: 68 f8 03 00 00 push $0x3f8 80107293: e8 20 ff ff ff call 801071b8 <inb> 80107298: 83 c4 04 add $0x4,%esp picenable(IRQ_COM1); 8010729b: 83 ec 0c sub $0xc,%esp 8010729e: 6a 04 push $0x4 801072a0: e8 26 cc ff ff call 80103ecb <picenable> 801072a5: 83 c4 10 add $0x10,%esp ioapicenable(IRQ_COM1, 0); 801072a8: 83 ec 08 sub $0x8,%esp 801072ab: 6a 00 push $0x0 801072ad: 6a 04 push $0x4 801072af: e8 dc b7 ff ff call 80102a90 <ioapicenable> 801072b4: 83 c4 10 add $0x10,%esp 801072b7: eb 01 jmp 801072ba <uartinit+0xc6> outb(COM1+4, 0); outb(COM1+1, 0x01); // Enable receive interrupts. // If status is 0xFF, no serial port. if(inb(COM1+5) == 0xFF) return; 801072b9: 90 nop // enable interrupts. inb(COM1+2); inb(COM1+0); picenable(IRQ_COM1); ioapicenable(IRQ_COM1, 0); } 801072ba: c9 leave 801072bb: c3 ret 801072bc <uartputc>: void uartputc(int c) { 801072bc: 55 push %ebp 801072bd: 89 e5 mov %esp,%ebp 801072bf: 83 ec 18 sub $0x18,%esp int i; if(!uart) 801072c2: a1 70 c6 10 80 mov 0x8010c670,%eax 801072c7: 85 c0 test %eax,%eax 801072c9: 74 53 je 8010731e <uartputc+0x62> return; for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) 801072cb: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801072d2: eb 11 jmp 801072e5 <uartputc+0x29> microdelay(10); 801072d4: 83 ec 0c sub $0xc,%esp 801072d7: 6a 0a push $0xa 801072d9: e8 3c bd ff ff call 8010301a <microdelay> 801072de: 83 c4 10 add $0x10,%esp { int i; if(!uart) return; for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) 801072e1: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801072e5: 83 7d f4 7f cmpl $0x7f,-0xc(%ebp) 801072e9: 7f 1a jg 80107305 <uartputc+0x49> 801072eb: 83 ec 0c sub $0xc,%esp 801072ee: 68 fd 03 00 00 push $0x3fd 801072f3: e8 c0 fe ff ff call 801071b8 <inb> 801072f8: 83 c4 10 add $0x10,%esp 801072fb: 0f b6 c0 movzbl %al,%eax 801072fe: 83 e0 20 and $0x20,%eax 80107301: 85 c0 test %eax,%eax 80107303: 74 cf je 801072d4 <uartputc+0x18> microdelay(10); outb(COM1+0, c); 80107305: 8b 45 08 mov 0x8(%ebp),%eax 80107308: 0f b6 c0 movzbl %al,%eax 8010730b: 83 ec 08 sub $0x8,%esp 8010730e: 50 push %eax 8010730f: 68 f8 03 00 00 push $0x3f8 80107314: e8 bc fe ff ff call 801071d5 <outb> 80107319: 83 c4 10 add $0x10,%esp 8010731c: eb 01 jmp 8010731f <uartputc+0x63> uartputc(int c) { int i; if(!uart) return; 8010731e: 90 nop for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) microdelay(10); outb(COM1+0, c); } 8010731f: c9 leave 80107320: c3 ret 80107321 <uartgetc>: static int uartgetc(void) { 80107321: 55 push %ebp 80107322: 89 e5 mov %esp,%ebp if(!uart) 80107324: a1 70 c6 10 80 mov 0x8010c670,%eax 80107329: 85 c0 test %eax,%eax 8010732b: 75 07 jne 80107334 <uartgetc+0x13> return -1; 8010732d: b8 ff ff ff ff mov $0xffffffff,%eax 80107332: eb 2e jmp 80107362 <uartgetc+0x41> if(!(inb(COM1+5) & 0x01)) 80107334: 68 fd 03 00 00 push $0x3fd 80107339: e8 7a fe ff ff call 801071b8 <inb> 8010733e: 83 c4 04 add $0x4,%esp 80107341: 0f b6 c0 movzbl %al,%eax 80107344: 83 e0 01 and $0x1,%eax 80107347: 85 c0 test %eax,%eax 80107349: 75 07 jne 80107352 <uartgetc+0x31> return -1; 8010734b: b8 ff ff ff ff mov $0xffffffff,%eax 80107350: eb 10 jmp 80107362 <uartgetc+0x41> return inb(COM1+0); 80107352: 68 f8 03 00 00 push $0x3f8 80107357: e8 5c fe ff ff call 801071b8 <inb> 8010735c: 83 c4 04 add $0x4,%esp 8010735f: 0f b6 c0 movzbl %al,%eax } 80107362: c9 leave 80107363: c3 ret 80107364 <uartintr>: void uartintr(void) { 80107364: 55 push %ebp 80107365: 89 e5 mov %esp,%ebp 80107367: 83 ec 08 sub $0x8,%esp consoleintr(uartgetc); 8010736a: 83 ec 0c sub $0xc,%esp 8010736d: 68 21 73 10 80 push $0x80107321 80107372: e8 82 94 ff ff call 801007f9 <consoleintr> 80107377: 83 c4 10 add $0x10,%esp } 8010737a: 90 nop 8010737b: c9 leave 8010737c: c3 ret 8010737d <vector0>: # generated by vectors.pl - do not edit # handlers .globl alltraps .globl vector0 vector0: pushl $0 8010737d: 6a 00 push $0x0 pushl $0 8010737f: 6a 00 push $0x0 jmp alltraps 80107381: e9 d2 f9 ff ff jmp 80106d58 <alltraps> 80107386 <vector1>: .globl vector1 vector1: pushl $0 80107386: 6a 00 push $0x0 pushl $1 80107388: 6a 01 push $0x1 jmp alltraps 8010738a: e9 c9 f9 ff ff jmp 80106d58 <alltraps> 8010738f <vector2>: .globl vector2 vector2: pushl $0 8010738f: 6a 00 push $0x0 pushl $2 80107391: 6a 02 push $0x2 jmp alltraps 80107393: e9 c0 f9 ff ff jmp 80106d58 <alltraps> 80107398 <vector3>: .globl vector3 vector3: pushl $0 80107398: 6a 00 push $0x0 pushl $3 8010739a: 6a 03 push $0x3 jmp alltraps 8010739c: e9 b7 f9 ff ff jmp 80106d58 <alltraps> 801073a1 <vector4>: .globl vector4 vector4: pushl $0 801073a1: 6a 00 push $0x0 pushl $4 801073a3: 6a 04 push $0x4 jmp alltraps 801073a5: e9 ae f9 ff ff jmp 80106d58 <alltraps> 801073aa <vector5>: .globl vector5 vector5: pushl $0 801073aa: 6a 00 push $0x0 pushl $5 801073ac: 6a 05 push $0x5 jmp alltraps 801073ae: e9 a5 f9 ff ff jmp 80106d58 <alltraps> 801073b3 <vector6>: .globl vector6 vector6: pushl $0 801073b3: 6a 00 push $0x0 pushl $6 801073b5: 6a 06 push $0x6 jmp alltraps 801073b7: e9 9c f9 ff ff jmp 80106d58 <alltraps> 801073bc <vector7>: .globl vector7 vector7: pushl $0 801073bc: 6a 00 push $0x0 pushl $7 801073be: 6a 07 push $0x7 jmp alltraps 801073c0: e9 93 f9 ff ff jmp 80106d58 <alltraps> 801073c5 <vector8>: .globl vector8 vector8: pushl $8 801073c5: 6a 08 push $0x8 jmp alltraps 801073c7: e9 8c f9 ff ff jmp 80106d58 <alltraps> 801073cc <vector9>: .globl vector9 vector9: pushl $0 801073cc: 6a 00 push $0x0 pushl $9 801073ce: 6a 09 push $0x9 jmp alltraps 801073d0: e9 83 f9 ff ff jmp 80106d58 <alltraps> 801073d5 <vector10>: .globl vector10 vector10: pushl $10 801073d5: 6a 0a push $0xa jmp alltraps 801073d7: e9 7c f9 ff ff jmp 80106d58 <alltraps> 801073dc <vector11>: .globl vector11 vector11: pushl $11 801073dc: 6a 0b push $0xb jmp alltraps 801073de: e9 75 f9 ff ff jmp 80106d58 <alltraps> 801073e3 <vector12>: .globl vector12 vector12: pushl $12 801073e3: 6a 0c push $0xc jmp alltraps 801073e5: e9 6e f9 ff ff jmp 80106d58 <alltraps> 801073ea <vector13>: .globl vector13 vector13: pushl $13 801073ea: 6a 0d push $0xd jmp alltraps 801073ec: e9 67 f9 ff ff jmp 80106d58 <alltraps> 801073f1 <vector14>: .globl vector14 vector14: pushl $14 801073f1: 6a 0e push $0xe jmp alltraps 801073f3: e9 60 f9 ff ff jmp 80106d58 <alltraps> 801073f8 <vector15>: .globl vector15 vector15: pushl $0 801073f8: 6a 00 push $0x0 pushl $15 801073fa: 6a 0f push $0xf jmp alltraps 801073fc: e9 57 f9 ff ff jmp 80106d58 <alltraps> 80107401 <vector16>: .globl vector16 vector16: pushl $0 80107401: 6a 00 push $0x0 pushl $16 80107403: 6a 10 push $0x10 jmp alltraps 80107405: e9 4e f9 ff ff jmp 80106d58 <alltraps> 8010740a <vector17>: .globl vector17 vector17: pushl $17 8010740a: 6a 11 push $0x11 jmp alltraps 8010740c: e9 47 f9 ff ff jmp 80106d58 <alltraps> 80107411 <vector18>: .globl vector18 vector18: pushl $0 80107411: 6a 00 push $0x0 pushl $18 80107413: 6a 12 push $0x12 jmp alltraps 80107415: e9 3e f9 ff ff jmp 80106d58 <alltraps> 8010741a <vector19>: .globl vector19 vector19: pushl $0 8010741a: 6a 00 push $0x0 pushl $19 8010741c: 6a 13 push $0x13 jmp alltraps 8010741e: e9 35 f9 ff ff jmp 80106d58 <alltraps> 80107423 <vector20>: .globl vector20 vector20: pushl $0 80107423: 6a 00 push $0x0 pushl $20 80107425: 6a 14 push $0x14 jmp alltraps 80107427: e9 2c f9 ff ff jmp 80106d58 <alltraps> 8010742c <vector21>: .globl vector21 vector21: pushl $0 8010742c: 6a 00 push $0x0 pushl $21 8010742e: 6a 15 push $0x15 jmp alltraps 80107430: e9 23 f9 ff ff jmp 80106d58 <alltraps> 80107435 <vector22>: .globl vector22 vector22: pushl $0 80107435: 6a 00 push $0x0 pushl $22 80107437: 6a 16 push $0x16 jmp alltraps 80107439: e9 1a f9 ff ff jmp 80106d58 <alltraps> 8010743e <vector23>: .globl vector23 vector23: pushl $0 8010743e: 6a 00 push $0x0 pushl $23 80107440: 6a 17 push $0x17 jmp alltraps 80107442: e9 11 f9 ff ff jmp 80106d58 <alltraps> 80107447 <vector24>: .globl vector24 vector24: pushl $0 80107447: 6a 00 push $0x0 pushl $24 80107449: 6a 18 push $0x18 jmp alltraps 8010744b: e9 08 f9 ff ff jmp 80106d58 <alltraps> 80107450 <vector25>: .globl vector25 vector25: pushl $0 80107450: 6a 00 push $0x0 pushl $25 80107452: 6a 19 push $0x19 jmp alltraps 80107454: e9 ff f8 ff ff jmp 80106d58 <alltraps> 80107459 <vector26>: .globl vector26 vector26: pushl $0 80107459: 6a 00 push $0x0 pushl $26 8010745b: 6a 1a push $0x1a jmp alltraps 8010745d: e9 f6 f8 ff ff jmp 80106d58 <alltraps> 80107462 <vector27>: .globl vector27 vector27: pushl $0 80107462: 6a 00 push $0x0 pushl $27 80107464: 6a 1b push $0x1b jmp alltraps 80107466: e9 ed f8 ff ff jmp 80106d58 <alltraps> 8010746b <vector28>: .globl vector28 vector28: pushl $0 8010746b: 6a 00 push $0x0 pushl $28 8010746d: 6a 1c push $0x1c jmp alltraps 8010746f: e9 e4 f8 ff ff jmp 80106d58 <alltraps> 80107474 <vector29>: .globl vector29 vector29: pushl $0 80107474: 6a 00 push $0x0 pushl $29 80107476: 6a 1d push $0x1d jmp alltraps 80107478: e9 db f8 ff ff jmp 80106d58 <alltraps> 8010747d <vector30>: .globl vector30 vector30: pushl $0 8010747d: 6a 00 push $0x0 pushl $30 8010747f: 6a 1e push $0x1e jmp alltraps 80107481: e9 d2 f8 ff ff jmp 80106d58 <alltraps> 80107486 <vector31>: .globl vector31 vector31: pushl $0 80107486: 6a 00 push $0x0 pushl $31 80107488: 6a 1f push $0x1f jmp alltraps 8010748a: e9 c9 f8 ff ff jmp 80106d58 <alltraps> 8010748f <vector32>: .globl vector32 vector32: pushl $0 8010748f: 6a 00 push $0x0 pushl $32 80107491: 6a 20 push $0x20 jmp alltraps 80107493: e9 c0 f8 ff ff jmp 80106d58 <alltraps> 80107498 <vector33>: .globl vector33 vector33: pushl $0 80107498: 6a 00 push $0x0 pushl $33 8010749a: 6a 21 push $0x21 jmp alltraps 8010749c: e9 b7 f8 ff ff jmp 80106d58 <alltraps> 801074a1 <vector34>: .globl vector34 vector34: pushl $0 801074a1: 6a 00 push $0x0 pushl $34 801074a3: 6a 22 push $0x22 jmp alltraps 801074a5: e9 ae f8 ff ff jmp 80106d58 <alltraps> 801074aa <vector35>: .globl vector35 vector35: pushl $0 801074aa: 6a 00 push $0x0 pushl $35 801074ac: 6a 23 push $0x23 jmp alltraps 801074ae: e9 a5 f8 ff ff jmp 80106d58 <alltraps> 801074b3 <vector36>: .globl vector36 vector36: pushl $0 801074b3: 6a 00 push $0x0 pushl $36 801074b5: 6a 24 push $0x24 jmp alltraps 801074b7: e9 9c f8 ff ff jmp 80106d58 <alltraps> 801074bc <vector37>: .globl vector37 vector37: pushl $0 801074bc: 6a 00 push $0x0 pushl $37 801074be: 6a 25 push $0x25 jmp alltraps 801074c0: e9 93 f8 ff ff jmp 80106d58 <alltraps> 801074c5 <vector38>: .globl vector38 vector38: pushl $0 801074c5: 6a 00 push $0x0 pushl $38 801074c7: 6a 26 push $0x26 jmp alltraps 801074c9: e9 8a f8 ff ff jmp 80106d58 <alltraps> 801074ce <vector39>: .globl vector39 vector39: pushl $0 801074ce: 6a 00 push $0x0 pushl $39 801074d0: 6a 27 push $0x27 jmp alltraps 801074d2: e9 81 f8 ff ff jmp 80106d58 <alltraps> 801074d7 <vector40>: .globl vector40 vector40: pushl $0 801074d7: 6a 00 push $0x0 pushl $40 801074d9: 6a 28 push $0x28 jmp alltraps 801074db: e9 78 f8 ff ff jmp 80106d58 <alltraps> 801074e0 <vector41>: .globl vector41 vector41: pushl $0 801074e0: 6a 00 push $0x0 pushl $41 801074e2: 6a 29 push $0x29 jmp alltraps 801074e4: e9 6f f8 ff ff jmp 80106d58 <alltraps> 801074e9 <vector42>: .globl vector42 vector42: pushl $0 801074e9: 6a 00 push $0x0 pushl $42 801074eb: 6a 2a push $0x2a jmp alltraps 801074ed: e9 66 f8 ff ff jmp 80106d58 <alltraps> 801074f2 <vector43>: .globl vector43 vector43: pushl $0 801074f2: 6a 00 push $0x0 pushl $43 801074f4: 6a 2b push $0x2b jmp alltraps 801074f6: e9 5d f8 ff ff jmp 80106d58 <alltraps> 801074fb <vector44>: .globl vector44 vector44: pushl $0 801074fb: 6a 00 push $0x0 pushl $44 801074fd: 6a 2c push $0x2c jmp alltraps 801074ff: e9 54 f8 ff ff jmp 80106d58 <alltraps> 80107504 <vector45>: .globl vector45 vector45: pushl $0 80107504: 6a 00 push $0x0 pushl $45 80107506: 6a 2d push $0x2d jmp alltraps 80107508: e9 4b f8 ff ff jmp 80106d58 <alltraps> 8010750d <vector46>: .globl vector46 vector46: pushl $0 8010750d: 6a 00 push $0x0 pushl $46 8010750f: 6a 2e push $0x2e jmp alltraps 80107511: e9 42 f8 ff ff jmp 80106d58 <alltraps> 80107516 <vector47>: .globl vector47 vector47: pushl $0 80107516: 6a 00 push $0x0 pushl $47 80107518: 6a 2f push $0x2f jmp alltraps 8010751a: e9 39 f8 ff ff jmp 80106d58 <alltraps> 8010751f <vector48>: .globl vector48 vector48: pushl $0 8010751f: 6a 00 push $0x0 pushl $48 80107521: 6a 30 push $0x30 jmp alltraps 80107523: e9 30 f8 ff ff jmp 80106d58 <alltraps> 80107528 <vector49>: .globl vector49 vector49: pushl $0 80107528: 6a 00 push $0x0 pushl $49 8010752a: 6a 31 push $0x31 jmp alltraps 8010752c: e9 27 f8 ff ff jmp 80106d58 <alltraps> 80107531 <vector50>: .globl vector50 vector50: pushl $0 80107531: 6a 00 push $0x0 pushl $50 80107533: 6a 32 push $0x32 jmp alltraps 80107535: e9 1e f8 ff ff jmp 80106d58 <alltraps> 8010753a <vector51>: .globl vector51 vector51: pushl $0 8010753a: 6a 00 push $0x0 pushl $51 8010753c: 6a 33 push $0x33 jmp alltraps 8010753e: e9 15 f8 ff ff jmp 80106d58 <alltraps> 80107543 <vector52>: .globl vector52 vector52: pushl $0 80107543: 6a 00 push $0x0 pushl $52 80107545: 6a 34 push $0x34 jmp alltraps 80107547: e9 0c f8 ff ff jmp 80106d58 <alltraps> 8010754c <vector53>: .globl vector53 vector53: pushl $0 8010754c: 6a 00 push $0x0 pushl $53 8010754e: 6a 35 push $0x35 jmp alltraps 80107550: e9 03 f8 ff ff jmp 80106d58 <alltraps> 80107555 <vector54>: .globl vector54 vector54: pushl $0 80107555: 6a 00 push $0x0 pushl $54 80107557: 6a 36 push $0x36 jmp alltraps 80107559: e9 fa f7 ff ff jmp 80106d58 <alltraps> 8010755e <vector55>: .globl vector55 vector55: pushl $0 8010755e: 6a 00 push $0x0 pushl $55 80107560: 6a 37 push $0x37 jmp alltraps 80107562: e9 f1 f7 ff ff jmp 80106d58 <alltraps> 80107567 <vector56>: .globl vector56 vector56: pushl $0 80107567: 6a 00 push $0x0 pushl $56 80107569: 6a 38 push $0x38 jmp alltraps 8010756b: e9 e8 f7 ff ff jmp 80106d58 <alltraps> 80107570 <vector57>: .globl vector57 vector57: pushl $0 80107570: 6a 00 push $0x0 pushl $57 80107572: 6a 39 push $0x39 jmp alltraps 80107574: e9 df f7 ff ff jmp 80106d58 <alltraps> 80107579 <vector58>: .globl vector58 vector58: pushl $0 80107579: 6a 00 push $0x0 pushl $58 8010757b: 6a 3a push $0x3a jmp alltraps 8010757d: e9 d6 f7 ff ff jmp 80106d58 <alltraps> 80107582 <vector59>: .globl vector59 vector59: pushl $0 80107582: 6a 00 push $0x0 pushl $59 80107584: 6a 3b push $0x3b jmp alltraps 80107586: e9 cd f7 ff ff jmp 80106d58 <alltraps> 8010758b <vector60>: .globl vector60 vector60: pushl $0 8010758b: 6a 00 push $0x0 pushl $60 8010758d: 6a 3c push $0x3c jmp alltraps 8010758f: e9 c4 f7 ff ff jmp 80106d58 <alltraps> 80107594 <vector61>: .globl vector61 vector61: pushl $0 80107594: 6a 00 push $0x0 pushl $61 80107596: 6a 3d push $0x3d jmp alltraps 80107598: e9 bb f7 ff ff jmp 80106d58 <alltraps> 8010759d <vector62>: .globl vector62 vector62: pushl $0 8010759d: 6a 00 push $0x0 pushl $62 8010759f: 6a 3e push $0x3e jmp alltraps 801075a1: e9 b2 f7 ff ff jmp 80106d58 <alltraps> 801075a6 <vector63>: .globl vector63 vector63: pushl $0 801075a6: 6a 00 push $0x0 pushl $63 801075a8: 6a 3f push $0x3f jmp alltraps 801075aa: e9 a9 f7 ff ff jmp 80106d58 <alltraps> 801075af <vector64>: .globl vector64 vector64: pushl $0 801075af: 6a 00 push $0x0 pushl $64 801075b1: 6a 40 push $0x40 jmp alltraps 801075b3: e9 a0 f7 ff ff jmp 80106d58 <alltraps> 801075b8 <vector65>: .globl vector65 vector65: pushl $0 801075b8: 6a 00 push $0x0 pushl $65 801075ba: 6a 41 push $0x41 jmp alltraps 801075bc: e9 97 f7 ff ff jmp 80106d58 <alltraps> 801075c1 <vector66>: .globl vector66 vector66: pushl $0 801075c1: 6a 00 push $0x0 pushl $66 801075c3: 6a 42 push $0x42 jmp alltraps 801075c5: e9 8e f7 ff ff jmp 80106d58 <alltraps> 801075ca <vector67>: .globl vector67 vector67: pushl $0 801075ca: 6a 00 push $0x0 pushl $67 801075cc: 6a 43 push $0x43 jmp alltraps 801075ce: e9 85 f7 ff ff jmp 80106d58 <alltraps> 801075d3 <vector68>: .globl vector68 vector68: pushl $0 801075d3: 6a 00 push $0x0 pushl $68 801075d5: 6a 44 push $0x44 jmp alltraps 801075d7: e9 7c f7 ff ff jmp 80106d58 <alltraps> 801075dc <vector69>: .globl vector69 vector69: pushl $0 801075dc: 6a 00 push $0x0 pushl $69 801075de: 6a 45 push $0x45 jmp alltraps 801075e0: e9 73 f7 ff ff jmp 80106d58 <alltraps> 801075e5 <vector70>: .globl vector70 vector70: pushl $0 801075e5: 6a 00 push $0x0 pushl $70 801075e7: 6a 46 push $0x46 jmp alltraps 801075e9: e9 6a f7 ff ff jmp 80106d58 <alltraps> 801075ee <vector71>: .globl vector71 vector71: pushl $0 801075ee: 6a 00 push $0x0 pushl $71 801075f0: 6a 47 push $0x47 jmp alltraps 801075f2: e9 61 f7 ff ff jmp 80106d58 <alltraps> 801075f7 <vector72>: .globl vector72 vector72: pushl $0 801075f7: 6a 00 push $0x0 pushl $72 801075f9: 6a 48 push $0x48 jmp alltraps 801075fb: e9 58 f7 ff ff jmp 80106d58 <alltraps> 80107600 <vector73>: .globl vector73 vector73: pushl $0 80107600: 6a 00 push $0x0 pushl $73 80107602: 6a 49 push $0x49 jmp alltraps 80107604: e9 4f f7 ff ff jmp 80106d58 <alltraps> 80107609 <vector74>: .globl vector74 vector74: pushl $0 80107609: 6a 00 push $0x0 pushl $74 8010760b: 6a 4a push $0x4a jmp alltraps 8010760d: e9 46 f7 ff ff jmp 80106d58 <alltraps> 80107612 <vector75>: .globl vector75 vector75: pushl $0 80107612: 6a 00 push $0x0 pushl $75 80107614: 6a 4b push $0x4b jmp alltraps 80107616: e9 3d f7 ff ff jmp 80106d58 <alltraps> 8010761b <vector76>: .globl vector76 vector76: pushl $0 8010761b: 6a 00 push $0x0 pushl $76 8010761d: 6a 4c push $0x4c jmp alltraps 8010761f: e9 34 f7 ff ff jmp 80106d58 <alltraps> 80107624 <vector77>: .globl vector77 vector77: pushl $0 80107624: 6a 00 push $0x0 pushl $77 80107626: 6a 4d push $0x4d jmp alltraps 80107628: e9 2b f7 ff ff jmp 80106d58 <alltraps> 8010762d <vector78>: .globl vector78 vector78: pushl $0 8010762d: 6a 00 push $0x0 pushl $78 8010762f: 6a 4e push $0x4e jmp alltraps 80107631: e9 22 f7 ff ff jmp 80106d58 <alltraps> 80107636 <vector79>: .globl vector79 vector79: pushl $0 80107636: 6a 00 push $0x0 pushl $79 80107638: 6a 4f push $0x4f jmp alltraps 8010763a: e9 19 f7 ff ff jmp 80106d58 <alltraps> 8010763f <vector80>: .globl vector80 vector80: pushl $0 8010763f: 6a 00 push $0x0 pushl $80 80107641: 6a 50 push $0x50 jmp alltraps 80107643: e9 10 f7 ff ff jmp 80106d58 <alltraps> 80107648 <vector81>: .globl vector81 vector81: pushl $0 80107648: 6a 00 push $0x0 pushl $81 8010764a: 6a 51 push $0x51 jmp alltraps 8010764c: e9 07 f7 ff ff jmp 80106d58 <alltraps> 80107651 <vector82>: .globl vector82 vector82: pushl $0 80107651: 6a 00 push $0x0 pushl $82 80107653: 6a 52 push $0x52 jmp alltraps 80107655: e9 fe f6 ff ff jmp 80106d58 <alltraps> 8010765a <vector83>: .globl vector83 vector83: pushl $0 8010765a: 6a 00 push $0x0 pushl $83 8010765c: 6a 53 push $0x53 jmp alltraps 8010765e: e9 f5 f6 ff ff jmp 80106d58 <alltraps> 80107663 <vector84>: .globl vector84 vector84: pushl $0 80107663: 6a 00 push $0x0 pushl $84 80107665: 6a 54 push $0x54 jmp alltraps 80107667: e9 ec f6 ff ff jmp 80106d58 <alltraps> 8010766c <vector85>: .globl vector85 vector85: pushl $0 8010766c: 6a 00 push $0x0 pushl $85 8010766e: 6a 55 push $0x55 jmp alltraps 80107670: e9 e3 f6 ff ff jmp 80106d58 <alltraps> 80107675 <vector86>: .globl vector86 vector86: pushl $0 80107675: 6a 00 push $0x0 pushl $86 80107677: 6a 56 push $0x56 jmp alltraps 80107679: e9 da f6 ff ff jmp 80106d58 <alltraps> 8010767e <vector87>: .globl vector87 vector87: pushl $0 8010767e: 6a 00 push $0x0 pushl $87 80107680: 6a 57 push $0x57 jmp alltraps 80107682: e9 d1 f6 ff ff jmp 80106d58 <alltraps> 80107687 <vector88>: .globl vector88 vector88: pushl $0 80107687: 6a 00 push $0x0 pushl $88 80107689: 6a 58 push $0x58 jmp alltraps 8010768b: e9 c8 f6 ff ff jmp 80106d58 <alltraps> 80107690 <vector89>: .globl vector89 vector89: pushl $0 80107690: 6a 00 push $0x0 pushl $89 80107692: 6a 59 push $0x59 jmp alltraps 80107694: e9 bf f6 ff ff jmp 80106d58 <alltraps> 80107699 <vector90>: .globl vector90 vector90: pushl $0 80107699: 6a 00 push $0x0 pushl $90 8010769b: 6a 5a push $0x5a jmp alltraps 8010769d: e9 b6 f6 ff ff jmp 80106d58 <alltraps> 801076a2 <vector91>: .globl vector91 vector91: pushl $0 801076a2: 6a 00 push $0x0 pushl $91 801076a4: 6a 5b push $0x5b jmp alltraps 801076a6: e9 ad f6 ff ff jmp 80106d58 <alltraps> 801076ab <vector92>: .globl vector92 vector92: pushl $0 801076ab: 6a 00 push $0x0 pushl $92 801076ad: 6a 5c push $0x5c jmp alltraps 801076af: e9 a4 f6 ff ff jmp 80106d58 <alltraps> 801076b4 <vector93>: .globl vector93 vector93: pushl $0 801076b4: 6a 00 push $0x0 pushl $93 801076b6: 6a 5d push $0x5d jmp alltraps 801076b8: e9 9b f6 ff ff jmp 80106d58 <alltraps> 801076bd <vector94>: .globl vector94 vector94: pushl $0 801076bd: 6a 00 push $0x0 pushl $94 801076bf: 6a 5e push $0x5e jmp alltraps 801076c1: e9 92 f6 ff ff jmp 80106d58 <alltraps> 801076c6 <vector95>: .globl vector95 vector95: pushl $0 801076c6: 6a 00 push $0x0 pushl $95 801076c8: 6a 5f push $0x5f jmp alltraps 801076ca: e9 89 f6 ff ff jmp 80106d58 <alltraps> 801076cf <vector96>: .globl vector96 vector96: pushl $0 801076cf: 6a 00 push $0x0 pushl $96 801076d1: 6a 60 push $0x60 jmp alltraps 801076d3: e9 80 f6 ff ff jmp 80106d58 <alltraps> 801076d8 <vector97>: .globl vector97 vector97: pushl $0 801076d8: 6a 00 push $0x0 pushl $97 801076da: 6a 61 push $0x61 jmp alltraps 801076dc: e9 77 f6 ff ff jmp 80106d58 <alltraps> 801076e1 <vector98>: .globl vector98 vector98: pushl $0 801076e1: 6a 00 push $0x0 pushl $98 801076e3: 6a 62 push $0x62 jmp alltraps 801076e5: e9 6e f6 ff ff jmp 80106d58 <alltraps> 801076ea <vector99>: .globl vector99 vector99: pushl $0 801076ea: 6a 00 push $0x0 pushl $99 801076ec: 6a 63 push $0x63 jmp alltraps 801076ee: e9 65 f6 ff ff jmp 80106d58 <alltraps> 801076f3 <vector100>: .globl vector100 vector100: pushl $0 801076f3: 6a 00 push $0x0 pushl $100 801076f5: 6a 64 push $0x64 jmp alltraps 801076f7: e9 5c f6 ff ff jmp 80106d58 <alltraps> 801076fc <vector101>: .globl vector101 vector101: pushl $0 801076fc: 6a 00 push $0x0 pushl $101 801076fe: 6a 65 push $0x65 jmp alltraps 80107700: e9 53 f6 ff ff jmp 80106d58 <alltraps> 80107705 <vector102>: .globl vector102 vector102: pushl $0 80107705: 6a 00 push $0x0 pushl $102 80107707: 6a 66 push $0x66 jmp alltraps 80107709: e9 4a f6 ff ff jmp 80106d58 <alltraps> 8010770e <vector103>: .globl vector103 vector103: pushl $0 8010770e: 6a 00 push $0x0 pushl $103 80107710: 6a 67 push $0x67 jmp alltraps 80107712: e9 41 f6 ff ff jmp 80106d58 <alltraps> 80107717 <vector104>: .globl vector104 vector104: pushl $0 80107717: 6a 00 push $0x0 pushl $104 80107719: 6a 68 push $0x68 jmp alltraps 8010771b: e9 38 f6 ff ff jmp 80106d58 <alltraps> 80107720 <vector105>: .globl vector105 vector105: pushl $0 80107720: 6a 00 push $0x0 pushl $105 80107722: 6a 69 push $0x69 jmp alltraps 80107724: e9 2f f6 ff ff jmp 80106d58 <alltraps> 80107729 <vector106>: .globl vector106 vector106: pushl $0 80107729: 6a 00 push $0x0 pushl $106 8010772b: 6a 6a push $0x6a jmp alltraps 8010772d: e9 26 f6 ff ff jmp 80106d58 <alltraps> 80107732 <vector107>: .globl vector107 vector107: pushl $0 80107732: 6a 00 push $0x0 pushl $107 80107734: 6a 6b push $0x6b jmp alltraps 80107736: e9 1d f6 ff ff jmp 80106d58 <alltraps> 8010773b <vector108>: .globl vector108 vector108: pushl $0 8010773b: 6a 00 push $0x0 pushl $108 8010773d: 6a 6c push $0x6c jmp alltraps 8010773f: e9 14 f6 ff ff jmp 80106d58 <alltraps> 80107744 <vector109>: .globl vector109 vector109: pushl $0 80107744: 6a 00 push $0x0 pushl $109 80107746: 6a 6d push $0x6d jmp alltraps 80107748: e9 0b f6 ff ff jmp 80106d58 <alltraps> 8010774d <vector110>: .globl vector110 vector110: pushl $0 8010774d: 6a 00 push $0x0 pushl $110 8010774f: 6a 6e push $0x6e jmp alltraps 80107751: e9 02 f6 ff ff jmp 80106d58 <alltraps> 80107756 <vector111>: .globl vector111 vector111: pushl $0 80107756: 6a 00 push $0x0 pushl $111 80107758: 6a 6f push $0x6f jmp alltraps 8010775a: e9 f9 f5 ff ff jmp 80106d58 <alltraps> 8010775f <vector112>: .globl vector112 vector112: pushl $0 8010775f: 6a 00 push $0x0 pushl $112 80107761: 6a 70 push $0x70 jmp alltraps 80107763: e9 f0 f5 ff ff jmp 80106d58 <alltraps> 80107768 <vector113>: .globl vector113 vector113: pushl $0 80107768: 6a 00 push $0x0 pushl $113 8010776a: 6a 71 push $0x71 jmp alltraps 8010776c: e9 e7 f5 ff ff jmp 80106d58 <alltraps> 80107771 <vector114>: .globl vector114 vector114: pushl $0 80107771: 6a 00 push $0x0 pushl $114 80107773: 6a 72 push $0x72 jmp alltraps 80107775: e9 de f5 ff ff jmp 80106d58 <alltraps> 8010777a <vector115>: .globl vector115 vector115: pushl $0 8010777a: 6a 00 push $0x0 pushl $115 8010777c: 6a 73 push $0x73 jmp alltraps 8010777e: e9 d5 f5 ff ff jmp 80106d58 <alltraps> 80107783 <vector116>: .globl vector116 vector116: pushl $0 80107783: 6a 00 push $0x0 pushl $116 80107785: 6a 74 push $0x74 jmp alltraps 80107787: e9 cc f5 ff ff jmp 80106d58 <alltraps> 8010778c <vector117>: .globl vector117 vector117: pushl $0 8010778c: 6a 00 push $0x0 pushl $117 8010778e: 6a 75 push $0x75 jmp alltraps 80107790: e9 c3 f5 ff ff jmp 80106d58 <alltraps> 80107795 <vector118>: .globl vector118 vector118: pushl $0 80107795: 6a 00 push $0x0 pushl $118 80107797: 6a 76 push $0x76 jmp alltraps 80107799: e9 ba f5 ff ff jmp 80106d58 <alltraps> 8010779e <vector119>: .globl vector119 vector119: pushl $0 8010779e: 6a 00 push $0x0 pushl $119 801077a0: 6a 77 push $0x77 jmp alltraps 801077a2: e9 b1 f5 ff ff jmp 80106d58 <alltraps> 801077a7 <vector120>: .globl vector120 vector120: pushl $0 801077a7: 6a 00 push $0x0 pushl $120 801077a9: 6a 78 push $0x78 jmp alltraps 801077ab: e9 a8 f5 ff ff jmp 80106d58 <alltraps> 801077b0 <vector121>: .globl vector121 vector121: pushl $0 801077b0: 6a 00 push $0x0 pushl $121 801077b2: 6a 79 push $0x79 jmp alltraps 801077b4: e9 9f f5 ff ff jmp 80106d58 <alltraps> 801077b9 <vector122>: .globl vector122 vector122: pushl $0 801077b9: 6a 00 push $0x0 pushl $122 801077bb: 6a 7a push $0x7a jmp alltraps 801077bd: e9 96 f5 ff ff jmp 80106d58 <alltraps> 801077c2 <vector123>: .globl vector123 vector123: pushl $0 801077c2: 6a 00 push $0x0 pushl $123 801077c4: 6a 7b push $0x7b jmp alltraps 801077c6: e9 8d f5 ff ff jmp 80106d58 <alltraps> 801077cb <vector124>: .globl vector124 vector124: pushl $0 801077cb: 6a 00 push $0x0 pushl $124 801077cd: 6a 7c push $0x7c jmp alltraps 801077cf: e9 84 f5 ff ff jmp 80106d58 <alltraps> 801077d4 <vector125>: .globl vector125 vector125: pushl $0 801077d4: 6a 00 push $0x0 pushl $125 801077d6: 6a 7d push $0x7d jmp alltraps 801077d8: e9 7b f5 ff ff jmp 80106d58 <alltraps> 801077dd <vector126>: .globl vector126 vector126: pushl $0 801077dd: 6a 00 push $0x0 pushl $126 801077df: 6a 7e push $0x7e jmp alltraps 801077e1: e9 72 f5 ff ff jmp 80106d58 <alltraps> 801077e6 <vector127>: .globl vector127 vector127: pushl $0 801077e6: 6a 00 push $0x0 pushl $127 801077e8: 6a 7f push $0x7f jmp alltraps 801077ea: e9 69 f5 ff ff jmp 80106d58 <alltraps> 801077ef <vector128>: .globl vector128 vector128: pushl $0 801077ef: 6a 00 push $0x0 pushl $128 801077f1: 68 80 00 00 00 push $0x80 jmp alltraps 801077f6: e9 5d f5 ff ff jmp 80106d58 <alltraps> 801077fb <vector129>: .globl vector129 vector129: pushl $0 801077fb: 6a 00 push $0x0 pushl $129 801077fd: 68 81 00 00 00 push $0x81 jmp alltraps 80107802: e9 51 f5 ff ff jmp 80106d58 <alltraps> 80107807 <vector130>: .globl vector130 vector130: pushl $0 80107807: 6a 00 push $0x0 pushl $130 80107809: 68 82 00 00 00 push $0x82 jmp alltraps 8010780e: e9 45 f5 ff ff jmp 80106d58 <alltraps> 80107813 <vector131>: .globl vector131 vector131: pushl $0 80107813: 6a 00 push $0x0 pushl $131 80107815: 68 83 00 00 00 push $0x83 jmp alltraps 8010781a: e9 39 f5 ff ff jmp 80106d58 <alltraps> 8010781f <vector132>: .globl vector132 vector132: pushl $0 8010781f: 6a 00 push $0x0 pushl $132 80107821: 68 84 00 00 00 push $0x84 jmp alltraps 80107826: e9 2d f5 ff ff jmp 80106d58 <alltraps> 8010782b <vector133>: .globl vector133 vector133: pushl $0 8010782b: 6a 00 push $0x0 pushl $133 8010782d: 68 85 00 00 00 push $0x85 jmp alltraps 80107832: e9 21 f5 ff ff jmp 80106d58 <alltraps> 80107837 <vector134>: .globl vector134 vector134: pushl $0 80107837: 6a 00 push $0x0 pushl $134 80107839: 68 86 00 00 00 push $0x86 jmp alltraps 8010783e: e9 15 f5 ff ff jmp 80106d58 <alltraps> 80107843 <vector135>: .globl vector135 vector135: pushl $0 80107843: 6a 00 push $0x0 pushl $135 80107845: 68 87 00 00 00 push $0x87 jmp alltraps 8010784a: e9 09 f5 ff ff jmp 80106d58 <alltraps> 8010784f <vector136>: .globl vector136 vector136: pushl $0 8010784f: 6a 00 push $0x0 pushl $136 80107851: 68 88 00 00 00 push $0x88 jmp alltraps 80107856: e9 fd f4 ff ff jmp 80106d58 <alltraps> 8010785b <vector137>: .globl vector137 vector137: pushl $0 8010785b: 6a 00 push $0x0 pushl $137 8010785d: 68 89 00 00 00 push $0x89 jmp alltraps 80107862: e9 f1 f4 ff ff jmp 80106d58 <alltraps> 80107867 <vector138>: .globl vector138 vector138: pushl $0 80107867: 6a 00 push $0x0 pushl $138 80107869: 68 8a 00 00 00 push $0x8a jmp alltraps 8010786e: e9 e5 f4 ff ff jmp 80106d58 <alltraps> 80107873 <vector139>: .globl vector139 vector139: pushl $0 80107873: 6a 00 push $0x0 pushl $139 80107875: 68 8b 00 00 00 push $0x8b jmp alltraps 8010787a: e9 d9 f4 ff ff jmp 80106d58 <alltraps> 8010787f <vector140>: .globl vector140 vector140: pushl $0 8010787f: 6a 00 push $0x0 pushl $140 80107881: 68 8c 00 00 00 push $0x8c jmp alltraps 80107886: e9 cd f4 ff ff jmp 80106d58 <alltraps> 8010788b <vector141>: .globl vector141 vector141: pushl $0 8010788b: 6a 00 push $0x0 pushl $141 8010788d: 68 8d 00 00 00 push $0x8d jmp alltraps 80107892: e9 c1 f4 ff ff jmp 80106d58 <alltraps> 80107897 <vector142>: .globl vector142 vector142: pushl $0 80107897: 6a 00 push $0x0 pushl $142 80107899: 68 8e 00 00 00 push $0x8e jmp alltraps 8010789e: e9 b5 f4 ff ff jmp 80106d58 <alltraps> 801078a3 <vector143>: .globl vector143 vector143: pushl $0 801078a3: 6a 00 push $0x0 pushl $143 801078a5: 68 8f 00 00 00 push $0x8f jmp alltraps 801078aa: e9 a9 f4 ff ff jmp 80106d58 <alltraps> 801078af <vector144>: .globl vector144 vector144: pushl $0 801078af: 6a 00 push $0x0 pushl $144 801078b1: 68 90 00 00 00 push $0x90 jmp alltraps 801078b6: e9 9d f4 ff ff jmp 80106d58 <alltraps> 801078bb <vector145>: .globl vector145 vector145: pushl $0 801078bb: 6a 00 push $0x0 pushl $145 801078bd: 68 91 00 00 00 push $0x91 jmp alltraps 801078c2: e9 91 f4 ff ff jmp 80106d58 <alltraps> 801078c7 <vector146>: .globl vector146 vector146: pushl $0 801078c7: 6a 00 push $0x0 pushl $146 801078c9: 68 92 00 00 00 push $0x92 jmp alltraps 801078ce: e9 85 f4 ff ff jmp 80106d58 <alltraps> 801078d3 <vector147>: .globl vector147 vector147: pushl $0 801078d3: 6a 00 push $0x0 pushl $147 801078d5: 68 93 00 00 00 push $0x93 jmp alltraps 801078da: e9 79 f4 ff ff jmp 80106d58 <alltraps> 801078df <vector148>: .globl vector148 vector148: pushl $0 801078df: 6a 00 push $0x0 pushl $148 801078e1: 68 94 00 00 00 push $0x94 jmp alltraps 801078e6: e9 6d f4 ff ff jmp 80106d58 <alltraps> 801078eb <vector149>: .globl vector149 vector149: pushl $0 801078eb: 6a 00 push $0x0 pushl $149 801078ed: 68 95 00 00 00 push $0x95 jmp alltraps 801078f2: e9 61 f4 ff ff jmp 80106d58 <alltraps> 801078f7 <vector150>: .globl vector150 vector150: pushl $0 801078f7: 6a 00 push $0x0 pushl $150 801078f9: 68 96 00 00 00 push $0x96 jmp alltraps 801078fe: e9 55 f4 ff ff jmp 80106d58 <alltraps> 80107903 <vector151>: .globl vector151 vector151: pushl $0 80107903: 6a 00 push $0x0 pushl $151 80107905: 68 97 00 00 00 push $0x97 jmp alltraps 8010790a: e9 49 f4 ff ff jmp 80106d58 <alltraps> 8010790f <vector152>: .globl vector152 vector152: pushl $0 8010790f: 6a 00 push $0x0 pushl $152 80107911: 68 98 00 00 00 push $0x98 jmp alltraps 80107916: e9 3d f4 ff ff jmp 80106d58 <alltraps> 8010791b <vector153>: .globl vector153 vector153: pushl $0 8010791b: 6a 00 push $0x0 pushl $153 8010791d: 68 99 00 00 00 push $0x99 jmp alltraps 80107922: e9 31 f4 ff ff jmp 80106d58 <alltraps> 80107927 <vector154>: .globl vector154 vector154: pushl $0 80107927: 6a 00 push $0x0 pushl $154 80107929: 68 9a 00 00 00 push $0x9a jmp alltraps 8010792e: e9 25 f4 ff ff jmp 80106d58 <alltraps> 80107933 <vector155>: .globl vector155 vector155: pushl $0 80107933: 6a 00 push $0x0 pushl $155 80107935: 68 9b 00 00 00 push $0x9b jmp alltraps 8010793a: e9 19 f4 ff ff jmp 80106d58 <alltraps> 8010793f <vector156>: .globl vector156 vector156: pushl $0 8010793f: 6a 00 push $0x0 pushl $156 80107941: 68 9c 00 00 00 push $0x9c jmp alltraps 80107946: e9 0d f4 ff ff jmp 80106d58 <alltraps> 8010794b <vector157>: .globl vector157 vector157: pushl $0 8010794b: 6a 00 push $0x0 pushl $157 8010794d: 68 9d 00 00 00 push $0x9d jmp alltraps 80107952: e9 01 f4 ff ff jmp 80106d58 <alltraps> 80107957 <vector158>: .globl vector158 vector158: pushl $0 80107957: 6a 00 push $0x0 pushl $158 80107959: 68 9e 00 00 00 push $0x9e jmp alltraps 8010795e: e9 f5 f3 ff ff jmp 80106d58 <alltraps> 80107963 <vector159>: .globl vector159 vector159: pushl $0 80107963: 6a 00 push $0x0 pushl $159 80107965: 68 9f 00 00 00 push $0x9f jmp alltraps 8010796a: e9 e9 f3 ff ff jmp 80106d58 <alltraps> 8010796f <vector160>: .globl vector160 vector160: pushl $0 8010796f: 6a 00 push $0x0 pushl $160 80107971: 68 a0 00 00 00 push $0xa0 jmp alltraps 80107976: e9 dd f3 ff ff jmp 80106d58 <alltraps> 8010797b <vector161>: .globl vector161 vector161: pushl $0 8010797b: 6a 00 push $0x0 pushl $161 8010797d: 68 a1 00 00 00 push $0xa1 jmp alltraps 80107982: e9 d1 f3 ff ff jmp 80106d58 <alltraps> 80107987 <vector162>: .globl vector162 vector162: pushl $0 80107987: 6a 00 push $0x0 pushl $162 80107989: 68 a2 00 00 00 push $0xa2 jmp alltraps 8010798e: e9 c5 f3 ff ff jmp 80106d58 <alltraps> 80107993 <vector163>: .globl vector163 vector163: pushl $0 80107993: 6a 00 push $0x0 pushl $163 80107995: 68 a3 00 00 00 push $0xa3 jmp alltraps 8010799a: e9 b9 f3 ff ff jmp 80106d58 <alltraps> 8010799f <vector164>: .globl vector164 vector164: pushl $0 8010799f: 6a 00 push $0x0 pushl $164 801079a1: 68 a4 00 00 00 push $0xa4 jmp alltraps 801079a6: e9 ad f3 ff ff jmp 80106d58 <alltraps> 801079ab <vector165>: .globl vector165 vector165: pushl $0 801079ab: 6a 00 push $0x0 pushl $165 801079ad: 68 a5 00 00 00 push $0xa5 jmp alltraps 801079b2: e9 a1 f3 ff ff jmp 80106d58 <alltraps> 801079b7 <vector166>: .globl vector166 vector166: pushl $0 801079b7: 6a 00 push $0x0 pushl $166 801079b9: 68 a6 00 00 00 push $0xa6 jmp alltraps 801079be: e9 95 f3 ff ff jmp 80106d58 <alltraps> 801079c3 <vector167>: .globl vector167 vector167: pushl $0 801079c3: 6a 00 push $0x0 pushl $167 801079c5: 68 a7 00 00 00 push $0xa7 jmp alltraps 801079ca: e9 89 f3 ff ff jmp 80106d58 <alltraps> 801079cf <vector168>: .globl vector168 vector168: pushl $0 801079cf: 6a 00 push $0x0 pushl $168 801079d1: 68 a8 00 00 00 push $0xa8 jmp alltraps 801079d6: e9 7d f3 ff ff jmp 80106d58 <alltraps> 801079db <vector169>: .globl vector169 vector169: pushl $0 801079db: 6a 00 push $0x0 pushl $169 801079dd: 68 a9 00 00 00 push $0xa9 jmp alltraps 801079e2: e9 71 f3 ff ff jmp 80106d58 <alltraps> 801079e7 <vector170>: .globl vector170 vector170: pushl $0 801079e7: 6a 00 push $0x0 pushl $170 801079e9: 68 aa 00 00 00 push $0xaa jmp alltraps 801079ee: e9 65 f3 ff ff jmp 80106d58 <alltraps> 801079f3 <vector171>: .globl vector171 vector171: pushl $0 801079f3: 6a 00 push $0x0 pushl $171 801079f5: 68 ab 00 00 00 push $0xab jmp alltraps 801079fa: e9 59 f3 ff ff jmp 80106d58 <alltraps> 801079ff <vector172>: .globl vector172 vector172: pushl $0 801079ff: 6a 00 push $0x0 pushl $172 80107a01: 68 ac 00 00 00 push $0xac jmp alltraps 80107a06: e9 4d f3 ff ff jmp 80106d58 <alltraps> 80107a0b <vector173>: .globl vector173 vector173: pushl $0 80107a0b: 6a 00 push $0x0 pushl $173 80107a0d: 68 ad 00 00 00 push $0xad jmp alltraps 80107a12: e9 41 f3 ff ff jmp 80106d58 <alltraps> 80107a17 <vector174>: .globl vector174 vector174: pushl $0 80107a17: 6a 00 push $0x0 pushl $174 80107a19: 68 ae 00 00 00 push $0xae jmp alltraps 80107a1e: e9 35 f3 ff ff jmp 80106d58 <alltraps> 80107a23 <vector175>: .globl vector175 vector175: pushl $0 80107a23: 6a 00 push $0x0 pushl $175 80107a25: 68 af 00 00 00 push $0xaf jmp alltraps 80107a2a: e9 29 f3 ff ff jmp 80106d58 <alltraps> 80107a2f <vector176>: .globl vector176 vector176: pushl $0 80107a2f: 6a 00 push $0x0 pushl $176 80107a31: 68 b0 00 00 00 push $0xb0 jmp alltraps 80107a36: e9 1d f3 ff ff jmp 80106d58 <alltraps> 80107a3b <vector177>: .globl vector177 vector177: pushl $0 80107a3b: 6a 00 push $0x0 pushl $177 80107a3d: 68 b1 00 00 00 push $0xb1 jmp alltraps 80107a42: e9 11 f3 ff ff jmp 80106d58 <alltraps> 80107a47 <vector178>: .globl vector178 vector178: pushl $0 80107a47: 6a 00 push $0x0 pushl $178 80107a49: 68 b2 00 00 00 push $0xb2 jmp alltraps 80107a4e: e9 05 f3 ff ff jmp 80106d58 <alltraps> 80107a53 <vector179>: .globl vector179 vector179: pushl $0 80107a53: 6a 00 push $0x0 pushl $179 80107a55: 68 b3 00 00 00 push $0xb3 jmp alltraps 80107a5a: e9 f9 f2 ff ff jmp 80106d58 <alltraps> 80107a5f <vector180>: .globl vector180 vector180: pushl $0 80107a5f: 6a 00 push $0x0 pushl $180 80107a61: 68 b4 00 00 00 push $0xb4 jmp alltraps 80107a66: e9 ed f2 ff ff jmp 80106d58 <alltraps> 80107a6b <vector181>: .globl vector181 vector181: pushl $0 80107a6b: 6a 00 push $0x0 pushl $181 80107a6d: 68 b5 00 00 00 push $0xb5 jmp alltraps 80107a72: e9 e1 f2 ff ff jmp 80106d58 <alltraps> 80107a77 <vector182>: .globl vector182 vector182: pushl $0 80107a77: 6a 00 push $0x0 pushl $182 80107a79: 68 b6 00 00 00 push $0xb6 jmp alltraps 80107a7e: e9 d5 f2 ff ff jmp 80106d58 <alltraps> 80107a83 <vector183>: .globl vector183 vector183: pushl $0 80107a83: 6a 00 push $0x0 pushl $183 80107a85: 68 b7 00 00 00 push $0xb7 jmp alltraps 80107a8a: e9 c9 f2 ff ff jmp 80106d58 <alltraps> 80107a8f <vector184>: .globl vector184 vector184: pushl $0 80107a8f: 6a 00 push $0x0 pushl $184 80107a91: 68 b8 00 00 00 push $0xb8 jmp alltraps 80107a96: e9 bd f2 ff ff jmp 80106d58 <alltraps> 80107a9b <vector185>: .globl vector185 vector185: pushl $0 80107a9b: 6a 00 push $0x0 pushl $185 80107a9d: 68 b9 00 00 00 push $0xb9 jmp alltraps 80107aa2: e9 b1 f2 ff ff jmp 80106d58 <alltraps> 80107aa7 <vector186>: .globl vector186 vector186: pushl $0 80107aa7: 6a 00 push $0x0 pushl $186 80107aa9: 68 ba 00 00 00 push $0xba jmp alltraps 80107aae: e9 a5 f2 ff ff jmp 80106d58 <alltraps> 80107ab3 <vector187>: .globl vector187 vector187: pushl $0 80107ab3: 6a 00 push $0x0 pushl $187 80107ab5: 68 bb 00 00 00 push $0xbb jmp alltraps 80107aba: e9 99 f2 ff ff jmp 80106d58 <alltraps> 80107abf <vector188>: .globl vector188 vector188: pushl $0 80107abf: 6a 00 push $0x0 pushl $188 80107ac1: 68 bc 00 00 00 push $0xbc jmp alltraps 80107ac6: e9 8d f2 ff ff jmp 80106d58 <alltraps> 80107acb <vector189>: .globl vector189 vector189: pushl $0 80107acb: 6a 00 push $0x0 pushl $189 80107acd: 68 bd 00 00 00 push $0xbd jmp alltraps 80107ad2: e9 81 f2 ff ff jmp 80106d58 <alltraps> 80107ad7 <vector190>: .globl vector190 vector190: pushl $0 80107ad7: 6a 00 push $0x0 pushl $190 80107ad9: 68 be 00 00 00 push $0xbe jmp alltraps 80107ade: e9 75 f2 ff ff jmp 80106d58 <alltraps> 80107ae3 <vector191>: .globl vector191 vector191: pushl $0 80107ae3: 6a 00 push $0x0 pushl $191 80107ae5: 68 bf 00 00 00 push $0xbf jmp alltraps 80107aea: e9 69 f2 ff ff jmp 80106d58 <alltraps> 80107aef <vector192>: .globl vector192 vector192: pushl $0 80107aef: 6a 00 push $0x0 pushl $192 80107af1: 68 c0 00 00 00 push $0xc0 jmp alltraps 80107af6: e9 5d f2 ff ff jmp 80106d58 <alltraps> 80107afb <vector193>: .globl vector193 vector193: pushl $0 80107afb: 6a 00 push $0x0 pushl $193 80107afd: 68 c1 00 00 00 push $0xc1 jmp alltraps 80107b02: e9 51 f2 ff ff jmp 80106d58 <alltraps> 80107b07 <vector194>: .globl vector194 vector194: pushl $0 80107b07: 6a 00 push $0x0 pushl $194 80107b09: 68 c2 00 00 00 push $0xc2 jmp alltraps 80107b0e: e9 45 f2 ff ff jmp 80106d58 <alltraps> 80107b13 <vector195>: .globl vector195 vector195: pushl $0 80107b13: 6a 00 push $0x0 pushl $195 80107b15: 68 c3 00 00 00 push $0xc3 jmp alltraps 80107b1a: e9 39 f2 ff ff jmp 80106d58 <alltraps> 80107b1f <vector196>: .globl vector196 vector196: pushl $0 80107b1f: 6a 00 push $0x0 pushl $196 80107b21: 68 c4 00 00 00 push $0xc4 jmp alltraps 80107b26: e9 2d f2 ff ff jmp 80106d58 <alltraps> 80107b2b <vector197>: .globl vector197 vector197: pushl $0 80107b2b: 6a 00 push $0x0 pushl $197 80107b2d: 68 c5 00 00 00 push $0xc5 jmp alltraps 80107b32: e9 21 f2 ff ff jmp 80106d58 <alltraps> 80107b37 <vector198>: .globl vector198 vector198: pushl $0 80107b37: 6a 00 push $0x0 pushl $198 80107b39: 68 c6 00 00 00 push $0xc6 jmp alltraps 80107b3e: e9 15 f2 ff ff jmp 80106d58 <alltraps> 80107b43 <vector199>: .globl vector199 vector199: pushl $0 80107b43: 6a 00 push $0x0 pushl $199 80107b45: 68 c7 00 00 00 push $0xc7 jmp alltraps 80107b4a: e9 09 f2 ff ff jmp 80106d58 <alltraps> 80107b4f <vector200>: .globl vector200 vector200: pushl $0 80107b4f: 6a 00 push $0x0 pushl $200 80107b51: 68 c8 00 00 00 push $0xc8 jmp alltraps 80107b56: e9 fd f1 ff ff jmp 80106d58 <alltraps> 80107b5b <vector201>: .globl vector201 vector201: pushl $0 80107b5b: 6a 00 push $0x0 pushl $201 80107b5d: 68 c9 00 00 00 push $0xc9 jmp alltraps 80107b62: e9 f1 f1 ff ff jmp 80106d58 <alltraps> 80107b67 <vector202>: .globl vector202 vector202: pushl $0 80107b67: 6a 00 push $0x0 pushl $202 80107b69: 68 ca 00 00 00 push $0xca jmp alltraps 80107b6e: e9 e5 f1 ff ff jmp 80106d58 <alltraps> 80107b73 <vector203>: .globl vector203 vector203: pushl $0 80107b73: 6a 00 push $0x0 pushl $203 80107b75: 68 cb 00 00 00 push $0xcb jmp alltraps 80107b7a: e9 d9 f1 ff ff jmp 80106d58 <alltraps> 80107b7f <vector204>: .globl vector204 vector204: pushl $0 80107b7f: 6a 00 push $0x0 pushl $204 80107b81: 68 cc 00 00 00 push $0xcc jmp alltraps 80107b86: e9 cd f1 ff ff jmp 80106d58 <alltraps> 80107b8b <vector205>: .globl vector205 vector205: pushl $0 80107b8b: 6a 00 push $0x0 pushl $205 80107b8d: 68 cd 00 00 00 push $0xcd jmp alltraps 80107b92: e9 c1 f1 ff ff jmp 80106d58 <alltraps> 80107b97 <vector206>: .globl vector206 vector206: pushl $0 80107b97: 6a 00 push $0x0 pushl $206 80107b99: 68 ce 00 00 00 push $0xce jmp alltraps 80107b9e: e9 b5 f1 ff ff jmp 80106d58 <alltraps> 80107ba3 <vector207>: .globl vector207 vector207: pushl $0 80107ba3: 6a 00 push $0x0 pushl $207 80107ba5: 68 cf 00 00 00 push $0xcf jmp alltraps 80107baa: e9 a9 f1 ff ff jmp 80106d58 <alltraps> 80107baf <vector208>: .globl vector208 vector208: pushl $0 80107baf: 6a 00 push $0x0 pushl $208 80107bb1: 68 d0 00 00 00 push $0xd0 jmp alltraps 80107bb6: e9 9d f1 ff ff jmp 80106d58 <alltraps> 80107bbb <vector209>: .globl vector209 vector209: pushl $0 80107bbb: 6a 00 push $0x0 pushl $209 80107bbd: 68 d1 00 00 00 push $0xd1 jmp alltraps 80107bc2: e9 91 f1 ff ff jmp 80106d58 <alltraps> 80107bc7 <vector210>: .globl vector210 vector210: pushl $0 80107bc7: 6a 00 push $0x0 pushl $210 80107bc9: 68 d2 00 00 00 push $0xd2 jmp alltraps 80107bce: e9 85 f1 ff ff jmp 80106d58 <alltraps> 80107bd3 <vector211>: .globl vector211 vector211: pushl $0 80107bd3: 6a 00 push $0x0 pushl $211 80107bd5: 68 d3 00 00 00 push $0xd3 jmp alltraps 80107bda: e9 79 f1 ff ff jmp 80106d58 <alltraps> 80107bdf <vector212>: .globl vector212 vector212: pushl $0 80107bdf: 6a 00 push $0x0 pushl $212 80107be1: 68 d4 00 00 00 push $0xd4 jmp alltraps 80107be6: e9 6d f1 ff ff jmp 80106d58 <alltraps> 80107beb <vector213>: .globl vector213 vector213: pushl $0 80107beb: 6a 00 push $0x0 pushl $213 80107bed: 68 d5 00 00 00 push $0xd5 jmp alltraps 80107bf2: e9 61 f1 ff ff jmp 80106d58 <alltraps> 80107bf7 <vector214>: .globl vector214 vector214: pushl $0 80107bf7: 6a 00 push $0x0 pushl $214 80107bf9: 68 d6 00 00 00 push $0xd6 jmp alltraps 80107bfe: e9 55 f1 ff ff jmp 80106d58 <alltraps> 80107c03 <vector215>: .globl vector215 vector215: pushl $0 80107c03: 6a 00 push $0x0 pushl $215 80107c05: 68 d7 00 00 00 push $0xd7 jmp alltraps 80107c0a: e9 49 f1 ff ff jmp 80106d58 <alltraps> 80107c0f <vector216>: .globl vector216 vector216: pushl $0 80107c0f: 6a 00 push $0x0 pushl $216 80107c11: 68 d8 00 00 00 push $0xd8 jmp alltraps 80107c16: e9 3d f1 ff ff jmp 80106d58 <alltraps> 80107c1b <vector217>: .globl vector217 vector217: pushl $0 80107c1b: 6a 00 push $0x0 pushl $217 80107c1d: 68 d9 00 00 00 push $0xd9 jmp alltraps 80107c22: e9 31 f1 ff ff jmp 80106d58 <alltraps> 80107c27 <vector218>: .globl vector218 vector218: pushl $0 80107c27: 6a 00 push $0x0 pushl $218 80107c29: 68 da 00 00 00 push $0xda jmp alltraps 80107c2e: e9 25 f1 ff ff jmp 80106d58 <alltraps> 80107c33 <vector219>: .globl vector219 vector219: pushl $0 80107c33: 6a 00 push $0x0 pushl $219 80107c35: 68 db 00 00 00 push $0xdb jmp alltraps 80107c3a: e9 19 f1 ff ff jmp 80106d58 <alltraps> 80107c3f <vector220>: .globl vector220 vector220: pushl $0 80107c3f: 6a 00 push $0x0 pushl $220 80107c41: 68 dc 00 00 00 push $0xdc jmp alltraps 80107c46: e9 0d f1 ff ff jmp 80106d58 <alltraps> 80107c4b <vector221>: .globl vector221 vector221: pushl $0 80107c4b: 6a 00 push $0x0 pushl $221 80107c4d: 68 dd 00 00 00 push $0xdd jmp alltraps 80107c52: e9 01 f1 ff ff jmp 80106d58 <alltraps> 80107c57 <vector222>: .globl vector222 vector222: pushl $0 80107c57: 6a 00 push $0x0 pushl $222 80107c59: 68 de 00 00 00 push $0xde jmp alltraps 80107c5e: e9 f5 f0 ff ff jmp 80106d58 <alltraps> 80107c63 <vector223>: .globl vector223 vector223: pushl $0 80107c63: 6a 00 push $0x0 pushl $223 80107c65: 68 df 00 00 00 push $0xdf jmp alltraps 80107c6a: e9 e9 f0 ff ff jmp 80106d58 <alltraps> 80107c6f <vector224>: .globl vector224 vector224: pushl $0 80107c6f: 6a 00 push $0x0 pushl $224 80107c71: 68 e0 00 00 00 push $0xe0 jmp alltraps 80107c76: e9 dd f0 ff ff jmp 80106d58 <alltraps> 80107c7b <vector225>: .globl vector225 vector225: pushl $0 80107c7b: 6a 00 push $0x0 pushl $225 80107c7d: 68 e1 00 00 00 push $0xe1 jmp alltraps 80107c82: e9 d1 f0 ff ff jmp 80106d58 <alltraps> 80107c87 <vector226>: .globl vector226 vector226: pushl $0 80107c87: 6a 00 push $0x0 pushl $226 80107c89: 68 e2 00 00 00 push $0xe2 jmp alltraps 80107c8e: e9 c5 f0 ff ff jmp 80106d58 <alltraps> 80107c93 <vector227>: .globl vector227 vector227: pushl $0 80107c93: 6a 00 push $0x0 pushl $227 80107c95: 68 e3 00 00 00 push $0xe3 jmp alltraps 80107c9a: e9 b9 f0 ff ff jmp 80106d58 <alltraps> 80107c9f <vector228>: .globl vector228 vector228: pushl $0 80107c9f: 6a 00 push $0x0 pushl $228 80107ca1: 68 e4 00 00 00 push $0xe4 jmp alltraps 80107ca6: e9 ad f0 ff ff jmp 80106d58 <alltraps> 80107cab <vector229>: .globl vector229 vector229: pushl $0 80107cab: 6a 00 push $0x0 pushl $229 80107cad: 68 e5 00 00 00 push $0xe5 jmp alltraps 80107cb2: e9 a1 f0 ff ff jmp 80106d58 <alltraps> 80107cb7 <vector230>: .globl vector230 vector230: pushl $0 80107cb7: 6a 00 push $0x0 pushl $230 80107cb9: 68 e6 00 00 00 push $0xe6 jmp alltraps 80107cbe: e9 95 f0 ff ff jmp 80106d58 <alltraps> 80107cc3 <vector231>: .globl vector231 vector231: pushl $0 80107cc3: 6a 00 push $0x0 pushl $231 80107cc5: 68 e7 00 00 00 push $0xe7 jmp alltraps 80107cca: e9 89 f0 ff ff jmp 80106d58 <alltraps> 80107ccf <vector232>: .globl vector232 vector232: pushl $0 80107ccf: 6a 00 push $0x0 pushl $232 80107cd1: 68 e8 00 00 00 push $0xe8 jmp alltraps 80107cd6: e9 7d f0 ff ff jmp 80106d58 <alltraps> 80107cdb <vector233>: .globl vector233 vector233: pushl $0 80107cdb: 6a 00 push $0x0 pushl $233 80107cdd: 68 e9 00 00 00 push $0xe9 jmp alltraps 80107ce2: e9 71 f0 ff ff jmp 80106d58 <alltraps> 80107ce7 <vector234>: .globl vector234 vector234: pushl $0 80107ce7: 6a 00 push $0x0 pushl $234 80107ce9: 68 ea 00 00 00 push $0xea jmp alltraps 80107cee: e9 65 f0 ff ff jmp 80106d58 <alltraps> 80107cf3 <vector235>: .globl vector235 vector235: pushl $0 80107cf3: 6a 00 push $0x0 pushl $235 80107cf5: 68 eb 00 00 00 push $0xeb jmp alltraps 80107cfa: e9 59 f0 ff ff jmp 80106d58 <alltraps> 80107cff <vector236>: .globl vector236 vector236: pushl $0 80107cff: 6a 00 push $0x0 pushl $236 80107d01: 68 ec 00 00 00 push $0xec jmp alltraps 80107d06: e9 4d f0 ff ff jmp 80106d58 <alltraps> 80107d0b <vector237>: .globl vector237 vector237: pushl $0 80107d0b: 6a 00 push $0x0 pushl $237 80107d0d: 68 ed 00 00 00 push $0xed jmp alltraps 80107d12: e9 41 f0 ff ff jmp 80106d58 <alltraps> 80107d17 <vector238>: .globl vector238 vector238: pushl $0 80107d17: 6a 00 push $0x0 pushl $238 80107d19: 68 ee 00 00 00 push $0xee jmp alltraps 80107d1e: e9 35 f0 ff ff jmp 80106d58 <alltraps> 80107d23 <vector239>: .globl vector239 vector239: pushl $0 80107d23: 6a 00 push $0x0 pushl $239 80107d25: 68 ef 00 00 00 push $0xef jmp alltraps 80107d2a: e9 29 f0 ff ff jmp 80106d58 <alltraps> 80107d2f <vector240>: .globl vector240 vector240: pushl $0 80107d2f: 6a 00 push $0x0 pushl $240 80107d31: 68 f0 00 00 00 push $0xf0 jmp alltraps 80107d36: e9 1d f0 ff ff jmp 80106d58 <alltraps> 80107d3b <vector241>: .globl vector241 vector241: pushl $0 80107d3b: 6a 00 push $0x0 pushl $241 80107d3d: 68 f1 00 00 00 push $0xf1 jmp alltraps 80107d42: e9 11 f0 ff ff jmp 80106d58 <alltraps> 80107d47 <vector242>: .globl vector242 vector242: pushl $0 80107d47: 6a 00 push $0x0 pushl $242 80107d49: 68 f2 00 00 00 push $0xf2 jmp alltraps 80107d4e: e9 05 f0 ff ff jmp 80106d58 <alltraps> 80107d53 <vector243>: .globl vector243 vector243: pushl $0 80107d53: 6a 00 push $0x0 pushl $243 80107d55: 68 f3 00 00 00 push $0xf3 jmp alltraps 80107d5a: e9 f9 ef ff ff jmp 80106d58 <alltraps> 80107d5f <vector244>: .globl vector244 vector244: pushl $0 80107d5f: 6a 00 push $0x0 pushl $244 80107d61: 68 f4 00 00 00 push $0xf4 jmp alltraps 80107d66: e9 ed ef ff ff jmp 80106d58 <alltraps> 80107d6b <vector245>: .globl vector245 vector245: pushl $0 80107d6b: 6a 00 push $0x0 pushl $245 80107d6d: 68 f5 00 00 00 push $0xf5 jmp alltraps 80107d72: e9 e1 ef ff ff jmp 80106d58 <alltraps> 80107d77 <vector246>: .globl vector246 vector246: pushl $0 80107d77: 6a 00 push $0x0 pushl $246 80107d79: 68 f6 00 00 00 push $0xf6 jmp alltraps 80107d7e: e9 d5 ef ff ff jmp 80106d58 <alltraps> 80107d83 <vector247>: .globl vector247 vector247: pushl $0 80107d83: 6a 00 push $0x0 pushl $247 80107d85: 68 f7 00 00 00 push $0xf7 jmp alltraps 80107d8a: e9 c9 ef ff ff jmp 80106d58 <alltraps> 80107d8f <vector248>: .globl vector248 vector248: pushl $0 80107d8f: 6a 00 push $0x0 pushl $248 80107d91: 68 f8 00 00 00 push $0xf8 jmp alltraps 80107d96: e9 bd ef ff ff jmp 80106d58 <alltraps> 80107d9b <vector249>: .globl vector249 vector249: pushl $0 80107d9b: 6a 00 push $0x0 pushl $249 80107d9d: 68 f9 00 00 00 push $0xf9 jmp alltraps 80107da2: e9 b1 ef ff ff jmp 80106d58 <alltraps> 80107da7 <vector250>: .globl vector250 vector250: pushl $0 80107da7: 6a 00 push $0x0 pushl $250 80107da9: 68 fa 00 00 00 push $0xfa jmp alltraps 80107dae: e9 a5 ef ff ff jmp 80106d58 <alltraps> 80107db3 <vector251>: .globl vector251 vector251: pushl $0 80107db3: 6a 00 push $0x0 pushl $251 80107db5: 68 fb 00 00 00 push $0xfb jmp alltraps 80107dba: e9 99 ef ff ff jmp 80106d58 <alltraps> 80107dbf <vector252>: .globl vector252 vector252: pushl $0 80107dbf: 6a 00 push $0x0 pushl $252 80107dc1: 68 fc 00 00 00 push $0xfc jmp alltraps 80107dc6: e9 8d ef ff ff jmp 80106d58 <alltraps> 80107dcb <vector253>: .globl vector253 vector253: pushl $0 80107dcb: 6a 00 push $0x0 pushl $253 80107dcd: 68 fd 00 00 00 push $0xfd jmp alltraps 80107dd2: e9 81 ef ff ff jmp 80106d58 <alltraps> 80107dd7 <vector254>: .globl vector254 vector254: pushl $0 80107dd7: 6a 00 push $0x0 pushl $254 80107dd9: 68 fe 00 00 00 push $0xfe jmp alltraps 80107dde: e9 75 ef ff ff jmp 80106d58 <alltraps> 80107de3 <vector255>: .globl vector255 vector255: pushl $0 80107de3: 6a 00 push $0x0 pushl $255 80107de5: 68 ff 00 00 00 push $0xff jmp alltraps 80107dea: e9 69 ef ff ff jmp 80106d58 <alltraps> 80107def <lgdt>: struct segdesc; static inline void lgdt(struct segdesc *p, int size) { 80107def: 55 push %ebp 80107df0: 89 e5 mov %esp,%ebp 80107df2: 83 ec 10 sub $0x10,%esp volatile ushort pd[3]; pd[0] = size-1; 80107df5: 8b 45 0c mov 0xc(%ebp),%eax 80107df8: 83 e8 01 sub $0x1,%eax 80107dfb: 66 89 45 fa mov %ax,-0x6(%ebp) pd[1] = (uint)p; 80107dff: 8b 45 08 mov 0x8(%ebp),%eax 80107e02: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 80107e06: 8b 45 08 mov 0x8(%ebp),%eax 80107e09: c1 e8 10 shr $0x10,%eax 80107e0c: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile("lgdt (%0)" : : "r" (pd)); 80107e10: 8d 45 fa lea -0x6(%ebp),%eax 80107e13: 0f 01 10 lgdtl (%eax) } 80107e16: 90 nop 80107e17: c9 leave 80107e18: c3 ret 80107e19 <ltr>: asm volatile("lidt (%0)" : : "r" (pd)); } static inline void ltr(ushort sel) { 80107e19: 55 push %ebp 80107e1a: 89 e5 mov %esp,%ebp 80107e1c: 83 ec 04 sub $0x4,%esp 80107e1f: 8b 45 08 mov 0x8(%ebp),%eax 80107e22: 66 89 45 fc mov %ax,-0x4(%ebp) asm volatile("ltr %0" : : "r" (sel)); 80107e26: 0f b7 45 fc movzwl -0x4(%ebp),%eax 80107e2a: 0f 00 d8 ltr %ax } 80107e2d: 90 nop 80107e2e: c9 leave 80107e2f: c3 ret 80107e30 <loadgs>: return eflags; } static inline void loadgs(ushort v) { 80107e30: 55 push %ebp 80107e31: 89 e5 mov %esp,%ebp 80107e33: 83 ec 04 sub $0x4,%esp 80107e36: 8b 45 08 mov 0x8(%ebp),%eax 80107e39: 66 89 45 fc mov %ax,-0x4(%ebp) asm volatile("movw %0, %%gs" : : "r" (v)); 80107e3d: 0f b7 45 fc movzwl -0x4(%ebp),%eax 80107e41: 8e e8 mov %eax,%gs } 80107e43: 90 nop 80107e44: c9 leave 80107e45: c3 ret 80107e46 <lcr3>: return val; } static inline void lcr3(uint val) { 80107e46: 55 push %ebp 80107e47: 89 e5 mov %esp,%ebp asm volatile("movl %0,%%cr3" : : "r" (val)); 80107e49: 8b 45 08 mov 0x8(%ebp),%eax 80107e4c: 0f 22 d8 mov %eax,%cr3 } 80107e4f: 90 nop 80107e50: 5d pop %ebp 80107e51: c3 ret 80107e52 <v2p>: #define KERNBASE 0x80000000 // First kernel virtual address #define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked #ifndef __ASSEMBLER__ static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; } 80107e52: 55 push %ebp 80107e53: 89 e5 mov %esp,%ebp 80107e55: 8b 45 08 mov 0x8(%ebp),%eax 80107e58: 05 00 00 00 80 add $0x80000000,%eax 80107e5d: 5d pop %ebp 80107e5e: c3 ret 80107e5f <p2v>: static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); } 80107e5f: 55 push %ebp 80107e60: 89 e5 mov %esp,%ebp 80107e62: 8b 45 08 mov 0x8(%ebp),%eax 80107e65: 05 00 00 00 80 add $0x80000000,%eax 80107e6a: 5d pop %ebp 80107e6b: c3 ret 80107e6c <seginit>: // Set up CPU's kernel segment descriptors. // Run once on entry on each CPU. void seginit(void) { 80107e6c: 55 push %ebp 80107e6d: 89 e5 mov %esp,%ebp 80107e6f: 53 push %ebx 80107e70: 83 ec 14 sub $0x14,%esp // Map "logical" addresses to virtual addresses using identity map. // Cannot share a CODE descriptor for both kernel and user // because it would have to have DPL_USR, but the CPU forbids // an interrupt from CPL=0 to DPL=3. c = &cpus[cpunum()]; 80107e73: e8 2e b1 ff ff call 80102fa6 <cpunum> 80107e78: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 80107e7e: 05 80 33 11 80 add $0x80113380,%eax 80107e83: 89 45 f4 mov %eax,-0xc(%ebp) c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); 80107e86: 8b 45 f4 mov -0xc(%ebp),%eax 80107e89: 66 c7 40 78 ff ff movw $0xffff,0x78(%eax) 80107e8f: 8b 45 f4 mov -0xc(%ebp),%eax 80107e92: 66 c7 40 7a 00 00 movw $0x0,0x7a(%eax) 80107e98: 8b 45 f4 mov -0xc(%ebp),%eax 80107e9b: c6 40 7c 00 movb $0x0,0x7c(%eax) 80107e9f: 8b 45 f4 mov -0xc(%ebp),%eax 80107ea2: 0f b6 50 7d movzbl 0x7d(%eax),%edx 80107ea6: 83 e2 f0 and $0xfffffff0,%edx 80107ea9: 83 ca 0a or $0xa,%edx 80107eac: 88 50 7d mov %dl,0x7d(%eax) 80107eaf: 8b 45 f4 mov -0xc(%ebp),%eax 80107eb2: 0f b6 50 7d movzbl 0x7d(%eax),%edx 80107eb6: 83 ca 10 or $0x10,%edx 80107eb9: 88 50 7d mov %dl,0x7d(%eax) 80107ebc: 8b 45 f4 mov -0xc(%ebp),%eax 80107ebf: 0f b6 50 7d movzbl 0x7d(%eax),%edx 80107ec3: 83 e2 9f and $0xffffff9f,%edx 80107ec6: 88 50 7d mov %dl,0x7d(%eax) 80107ec9: 8b 45 f4 mov -0xc(%ebp),%eax 80107ecc: 0f b6 50 7d movzbl 0x7d(%eax),%edx 80107ed0: 83 ca 80 or $0xffffff80,%edx 80107ed3: 88 50 7d mov %dl,0x7d(%eax) 80107ed6: 8b 45 f4 mov -0xc(%ebp),%eax 80107ed9: 0f b6 50 7e movzbl 0x7e(%eax),%edx 80107edd: 83 ca 0f or $0xf,%edx 80107ee0: 88 50 7e mov %dl,0x7e(%eax) 80107ee3: 8b 45 f4 mov -0xc(%ebp),%eax 80107ee6: 0f b6 50 7e movzbl 0x7e(%eax),%edx 80107eea: 83 e2 ef and $0xffffffef,%edx 80107eed: 88 50 7e mov %dl,0x7e(%eax) 80107ef0: 8b 45 f4 mov -0xc(%ebp),%eax 80107ef3: 0f b6 50 7e movzbl 0x7e(%eax),%edx 80107ef7: 83 e2 df and $0xffffffdf,%edx 80107efa: 88 50 7e mov %dl,0x7e(%eax) 80107efd: 8b 45 f4 mov -0xc(%ebp),%eax 80107f00: 0f b6 50 7e movzbl 0x7e(%eax),%edx 80107f04: 83 ca 40 or $0x40,%edx 80107f07: 88 50 7e mov %dl,0x7e(%eax) 80107f0a: 8b 45 f4 mov -0xc(%ebp),%eax 80107f0d: 0f b6 50 7e movzbl 0x7e(%eax),%edx 80107f11: 83 ca 80 or $0xffffff80,%edx 80107f14: 88 50 7e mov %dl,0x7e(%eax) 80107f17: 8b 45 f4 mov -0xc(%ebp),%eax 80107f1a: c6 40 7f 00 movb $0x0,0x7f(%eax) c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 80107f1e: 8b 45 f4 mov -0xc(%ebp),%eax 80107f21: 66 c7 80 80 00 00 00 movw $0xffff,0x80(%eax) 80107f28: ff ff 80107f2a: 8b 45 f4 mov -0xc(%ebp),%eax 80107f2d: 66 c7 80 82 00 00 00 movw $0x0,0x82(%eax) 80107f34: 00 00 80107f36: 8b 45 f4 mov -0xc(%ebp),%eax 80107f39: c6 80 84 00 00 00 00 movb $0x0,0x84(%eax) 80107f40: 8b 45 f4 mov -0xc(%ebp),%eax 80107f43: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 80107f4a: 83 e2 f0 and $0xfffffff0,%edx 80107f4d: 83 ca 02 or $0x2,%edx 80107f50: 88 90 85 00 00 00 mov %dl,0x85(%eax) 80107f56: 8b 45 f4 mov -0xc(%ebp),%eax 80107f59: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 80107f60: 83 ca 10 or $0x10,%edx 80107f63: 88 90 85 00 00 00 mov %dl,0x85(%eax) 80107f69: 8b 45 f4 mov -0xc(%ebp),%eax 80107f6c: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 80107f73: 83 e2 9f and $0xffffff9f,%edx 80107f76: 88 90 85 00 00 00 mov %dl,0x85(%eax) 80107f7c: 8b 45 f4 mov -0xc(%ebp),%eax 80107f7f: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 80107f86: 83 ca 80 or $0xffffff80,%edx 80107f89: 88 90 85 00 00 00 mov %dl,0x85(%eax) 80107f8f: 8b 45 f4 mov -0xc(%ebp),%eax 80107f92: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 80107f99: 83 ca 0f or $0xf,%edx 80107f9c: 88 90 86 00 00 00 mov %dl,0x86(%eax) 80107fa2: 8b 45 f4 mov -0xc(%ebp),%eax 80107fa5: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 80107fac: 83 e2 ef and $0xffffffef,%edx 80107faf: 88 90 86 00 00 00 mov %dl,0x86(%eax) 80107fb5: 8b 45 f4 mov -0xc(%ebp),%eax 80107fb8: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 80107fbf: 83 e2 df and $0xffffffdf,%edx 80107fc2: 88 90 86 00 00 00 mov %dl,0x86(%eax) 80107fc8: 8b 45 f4 mov -0xc(%ebp),%eax 80107fcb: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 80107fd2: 83 ca 40 or $0x40,%edx 80107fd5: 88 90 86 00 00 00 mov %dl,0x86(%eax) 80107fdb: 8b 45 f4 mov -0xc(%ebp),%eax 80107fde: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 80107fe5: 83 ca 80 or $0xffffff80,%edx 80107fe8: 88 90 86 00 00 00 mov %dl,0x86(%eax) 80107fee: 8b 45 f4 mov -0xc(%ebp),%eax 80107ff1: c6 80 87 00 00 00 00 movb $0x0,0x87(%eax) c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); 80107ff8: 8b 45 f4 mov -0xc(%ebp),%eax 80107ffb: 66 c7 80 90 00 00 00 movw $0xffff,0x90(%eax) 80108002: ff ff 80108004: 8b 45 f4 mov -0xc(%ebp),%eax 80108007: 66 c7 80 92 00 00 00 movw $0x0,0x92(%eax) 8010800e: 00 00 80108010: 8b 45 f4 mov -0xc(%ebp),%eax 80108013: c6 80 94 00 00 00 00 movb $0x0,0x94(%eax) 8010801a: 8b 45 f4 mov -0xc(%ebp),%eax 8010801d: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 80108024: 83 e2 f0 and $0xfffffff0,%edx 80108027: 83 ca 0a or $0xa,%edx 8010802a: 88 90 95 00 00 00 mov %dl,0x95(%eax) 80108030: 8b 45 f4 mov -0xc(%ebp),%eax 80108033: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 8010803a: 83 ca 10 or $0x10,%edx 8010803d: 88 90 95 00 00 00 mov %dl,0x95(%eax) 80108043: 8b 45 f4 mov -0xc(%ebp),%eax 80108046: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 8010804d: 83 ca 60 or $0x60,%edx 80108050: 88 90 95 00 00 00 mov %dl,0x95(%eax) 80108056: 8b 45 f4 mov -0xc(%ebp),%eax 80108059: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 80108060: 83 ca 80 or $0xffffff80,%edx 80108063: 88 90 95 00 00 00 mov %dl,0x95(%eax) 80108069: 8b 45 f4 mov -0xc(%ebp),%eax 8010806c: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 80108073: 83 ca 0f or $0xf,%edx 80108076: 88 90 96 00 00 00 mov %dl,0x96(%eax) 8010807c: 8b 45 f4 mov -0xc(%ebp),%eax 8010807f: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 80108086: 83 e2 ef and $0xffffffef,%edx 80108089: 88 90 96 00 00 00 mov %dl,0x96(%eax) 8010808f: 8b 45 f4 mov -0xc(%ebp),%eax 80108092: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 80108099: 83 e2 df and $0xffffffdf,%edx 8010809c: 88 90 96 00 00 00 mov %dl,0x96(%eax) 801080a2: 8b 45 f4 mov -0xc(%ebp),%eax 801080a5: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 801080ac: 83 ca 40 or $0x40,%edx 801080af: 88 90 96 00 00 00 mov %dl,0x96(%eax) 801080b5: 8b 45 f4 mov -0xc(%ebp),%eax 801080b8: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 801080bf: 83 ca 80 or $0xffffff80,%edx 801080c2: 88 90 96 00 00 00 mov %dl,0x96(%eax) 801080c8: 8b 45 f4 mov -0xc(%ebp),%eax 801080cb: c6 80 97 00 00 00 00 movb $0x0,0x97(%eax) c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); 801080d2: 8b 45 f4 mov -0xc(%ebp),%eax 801080d5: 66 c7 80 98 00 00 00 movw $0xffff,0x98(%eax) 801080dc: ff ff 801080de: 8b 45 f4 mov -0xc(%ebp),%eax 801080e1: 66 c7 80 9a 00 00 00 movw $0x0,0x9a(%eax) 801080e8: 00 00 801080ea: 8b 45 f4 mov -0xc(%ebp),%eax 801080ed: c6 80 9c 00 00 00 00 movb $0x0,0x9c(%eax) 801080f4: 8b 45 f4 mov -0xc(%ebp),%eax 801080f7: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 801080fe: 83 e2 f0 and $0xfffffff0,%edx 80108101: 83 ca 02 or $0x2,%edx 80108104: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 8010810a: 8b 45 f4 mov -0xc(%ebp),%eax 8010810d: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 80108114: 83 ca 10 or $0x10,%edx 80108117: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 8010811d: 8b 45 f4 mov -0xc(%ebp),%eax 80108120: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 80108127: 83 ca 60 or $0x60,%edx 8010812a: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 80108130: 8b 45 f4 mov -0xc(%ebp),%eax 80108133: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 8010813a: 83 ca 80 or $0xffffff80,%edx 8010813d: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 80108143: 8b 45 f4 mov -0xc(%ebp),%eax 80108146: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 8010814d: 83 ca 0f or $0xf,%edx 80108150: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 80108156: 8b 45 f4 mov -0xc(%ebp),%eax 80108159: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 80108160: 83 e2 ef and $0xffffffef,%edx 80108163: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 80108169: 8b 45 f4 mov -0xc(%ebp),%eax 8010816c: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 80108173: 83 e2 df and $0xffffffdf,%edx 80108176: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 8010817c: 8b 45 f4 mov -0xc(%ebp),%eax 8010817f: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 80108186: 83 ca 40 or $0x40,%edx 80108189: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 8010818f: 8b 45 f4 mov -0xc(%ebp),%eax 80108192: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 80108199: 83 ca 80 or $0xffffff80,%edx 8010819c: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 801081a2: 8b 45 f4 mov -0xc(%ebp),%eax 801081a5: c6 80 9f 00 00 00 00 movb $0x0,0x9f(%eax) // Map cpu, and curproc c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0); 801081ac: 8b 45 f4 mov -0xc(%ebp),%eax 801081af: 05 b4 00 00 00 add $0xb4,%eax 801081b4: 89 c3 mov %eax,%ebx 801081b6: 8b 45 f4 mov -0xc(%ebp),%eax 801081b9: 05 b4 00 00 00 add $0xb4,%eax 801081be: c1 e8 10 shr $0x10,%eax 801081c1: 89 c2 mov %eax,%edx 801081c3: 8b 45 f4 mov -0xc(%ebp),%eax 801081c6: 05 b4 00 00 00 add $0xb4,%eax 801081cb: c1 e8 18 shr $0x18,%eax 801081ce: 89 c1 mov %eax,%ecx 801081d0: 8b 45 f4 mov -0xc(%ebp),%eax 801081d3: 66 c7 80 88 00 00 00 movw $0x0,0x88(%eax) 801081da: 00 00 801081dc: 8b 45 f4 mov -0xc(%ebp),%eax 801081df: 66 89 98 8a 00 00 00 mov %bx,0x8a(%eax) 801081e6: 8b 45 f4 mov -0xc(%ebp),%eax 801081e9: 88 90 8c 00 00 00 mov %dl,0x8c(%eax) 801081ef: 8b 45 f4 mov -0xc(%ebp),%eax 801081f2: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx 801081f9: 83 e2 f0 and $0xfffffff0,%edx 801081fc: 83 ca 02 or $0x2,%edx 801081ff: 88 90 8d 00 00 00 mov %dl,0x8d(%eax) 80108205: 8b 45 f4 mov -0xc(%ebp),%eax 80108208: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx 8010820f: 83 ca 10 or $0x10,%edx 80108212: 88 90 8d 00 00 00 mov %dl,0x8d(%eax) 80108218: 8b 45 f4 mov -0xc(%ebp),%eax 8010821b: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx 80108222: 83 e2 9f and $0xffffff9f,%edx 80108225: 88 90 8d 00 00 00 mov %dl,0x8d(%eax) 8010822b: 8b 45 f4 mov -0xc(%ebp),%eax 8010822e: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx 80108235: 83 ca 80 or $0xffffff80,%edx 80108238: 88 90 8d 00 00 00 mov %dl,0x8d(%eax) 8010823e: 8b 45 f4 mov -0xc(%ebp),%eax 80108241: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx 80108248: 83 e2 f0 and $0xfffffff0,%edx 8010824b: 88 90 8e 00 00 00 mov %dl,0x8e(%eax) 80108251: 8b 45 f4 mov -0xc(%ebp),%eax 80108254: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx 8010825b: 83 e2 ef and $0xffffffef,%edx 8010825e: 88 90 8e 00 00 00 mov %dl,0x8e(%eax) 80108264: 8b 45 f4 mov -0xc(%ebp),%eax 80108267: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx 8010826e: 83 e2 df and $0xffffffdf,%edx 80108271: 88 90 8e 00 00 00 mov %dl,0x8e(%eax) 80108277: 8b 45 f4 mov -0xc(%ebp),%eax 8010827a: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx 80108281: 83 ca 40 or $0x40,%edx 80108284: 88 90 8e 00 00 00 mov %dl,0x8e(%eax) 8010828a: 8b 45 f4 mov -0xc(%ebp),%eax 8010828d: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx 80108294: 83 ca 80 or $0xffffff80,%edx 80108297: 88 90 8e 00 00 00 mov %dl,0x8e(%eax) 8010829d: 8b 45 f4 mov -0xc(%ebp),%eax 801082a0: 88 88 8f 00 00 00 mov %cl,0x8f(%eax) lgdt(c->gdt, sizeof(c->gdt)); 801082a6: 8b 45 f4 mov -0xc(%ebp),%eax 801082a9: 83 c0 70 add $0x70,%eax 801082ac: 83 ec 08 sub $0x8,%esp 801082af: 6a 38 push $0x38 801082b1: 50 push %eax 801082b2: e8 38 fb ff ff call 80107def <lgdt> 801082b7: 83 c4 10 add $0x10,%esp loadgs(SEG_KCPU << 3); 801082ba: 83 ec 0c sub $0xc,%esp 801082bd: 6a 18 push $0x18 801082bf: e8 6c fb ff ff call 80107e30 <loadgs> 801082c4: 83 c4 10 add $0x10,%esp // Initialize cpu-local storage. cpu = c; 801082c7: 8b 45 f4 mov -0xc(%ebp),%eax 801082ca: 65 a3 00 00 00 00 mov %eax,%gs:0x0 proc = 0; 801082d0: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4 801082d7: 00 00 00 00 } 801082db: 90 nop 801082dc: 8b 5d fc mov -0x4(%ebp),%ebx 801082df: c9 leave 801082e0: c3 ret 801082e1 <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) { 801082e1: 55 push %ebp 801082e2: 89 e5 mov %esp,%ebp 801082e4: 83 ec 18 sub $0x18,%esp pde_t *pde; pte_t *pgtab; pde = &pgdir[PDX(va)]; 801082e7: 8b 45 0c mov 0xc(%ebp),%eax 801082ea: c1 e8 16 shr $0x16,%eax 801082ed: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 801082f4: 8b 45 08 mov 0x8(%ebp),%eax 801082f7: 01 d0 add %edx,%eax 801082f9: 89 45 f0 mov %eax,-0x10(%ebp) if(*pde & PTE_P){ 801082fc: 8b 45 f0 mov -0x10(%ebp),%eax 801082ff: 8b 00 mov (%eax),%eax 80108301: 83 e0 01 and $0x1,%eax 80108304: 85 c0 test %eax,%eax 80108306: 74 18 je 80108320 <walkpgdir+0x3f> pgtab = (pte_t*)p2v(PTE_ADDR(*pde)); 80108308: 8b 45 f0 mov -0x10(%ebp),%eax 8010830b: 8b 00 mov (%eax),%eax 8010830d: 25 00 f0 ff ff and $0xfffff000,%eax 80108312: 50 push %eax 80108313: e8 47 fb ff ff call 80107e5f <p2v> 80108318: 83 c4 04 add $0x4,%esp 8010831b: 89 45 f4 mov %eax,-0xc(%ebp) 8010831e: eb 48 jmp 80108368 <walkpgdir+0x87> } else { if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) 80108320: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80108324: 74 0e je 80108334 <walkpgdir+0x53> 80108326: e8 fe a8 ff ff call 80102c29 <kalloc> 8010832b: 89 45 f4 mov %eax,-0xc(%ebp) 8010832e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80108332: 75 07 jne 8010833b <walkpgdir+0x5a> return 0; 80108334: b8 00 00 00 00 mov $0x0,%eax 80108339: eb 44 jmp 8010837f <walkpgdir+0x9e> // Make sure all those PTE_P bits are zero. memset(pgtab, 0, PGSIZE); 8010833b: 83 ec 04 sub $0x4,%esp 8010833e: 68 00 10 00 00 push $0x1000 80108343: 6a 00 push $0x0 80108345: ff 75 f4 pushl -0xc(%ebp) 80108348: e8 86 d4 ff ff call 801057d3 <memset> 8010834d: 83 c4 10 add $0x10,%esp // The permissions here are overly generous, but they can // be further restricted by the permissions in the page table // entries, if necessary. *pde = v2p(pgtab) | PTE_P | PTE_W | PTE_U; 80108350: 83 ec 0c sub $0xc,%esp 80108353: ff 75 f4 pushl -0xc(%ebp) 80108356: e8 f7 fa ff ff call 80107e52 <v2p> 8010835b: 83 c4 10 add $0x10,%esp 8010835e: 83 c8 07 or $0x7,%eax 80108361: 89 c2 mov %eax,%edx 80108363: 8b 45 f0 mov -0x10(%ebp),%eax 80108366: 89 10 mov %edx,(%eax) } return &pgtab[PTX(va)]; 80108368: 8b 45 0c mov 0xc(%ebp),%eax 8010836b: c1 e8 0c shr $0xc,%eax 8010836e: 25 ff 03 00 00 and $0x3ff,%eax 80108373: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 8010837a: 8b 45 f4 mov -0xc(%ebp),%eax 8010837d: 01 d0 add %edx,%eax } 8010837f: c9 leave 80108380: c3 ret 80108381 <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) { 80108381: 55 push %ebp 80108382: 89 e5 mov %esp,%ebp 80108384: 83 ec 18 sub $0x18,%esp char *a, *last; pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); 80108387: 8b 45 0c mov 0xc(%ebp),%eax 8010838a: 25 00 f0 ff ff and $0xfffff000,%eax 8010838f: 89 45 f4 mov %eax,-0xc(%ebp) last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 80108392: 8b 55 0c mov 0xc(%ebp),%edx 80108395: 8b 45 10 mov 0x10(%ebp),%eax 80108398: 01 d0 add %edx,%eax 8010839a: 83 e8 01 sub $0x1,%eax 8010839d: 25 00 f0 ff ff and $0xfffff000,%eax 801083a2: 89 45 f0 mov %eax,-0x10(%ebp) for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) 801083a5: 83 ec 04 sub $0x4,%esp 801083a8: 6a 01 push $0x1 801083aa: ff 75 f4 pushl -0xc(%ebp) 801083ad: ff 75 08 pushl 0x8(%ebp) 801083b0: e8 2c ff ff ff call 801082e1 <walkpgdir> 801083b5: 83 c4 10 add $0x10,%esp 801083b8: 89 45 ec mov %eax,-0x14(%ebp) 801083bb: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 801083bf: 75 07 jne 801083c8 <mappages+0x47> return -1; 801083c1: b8 ff ff ff ff mov $0xffffffff,%eax 801083c6: eb 5d jmp 80108425 <mappages+0xa4> if(*pte) 801083c8: 8b 45 ec mov -0x14(%ebp),%eax 801083cb: 8b 00 mov (%eax),%eax 801083cd: 85 c0 test %eax,%eax 801083cf: 74 0d je 801083de <mappages+0x5d> panic("*pte is 0"); 801083d1: 83 ec 0c sub $0xc,%esp 801083d4: 68 c4 92 10 80 push $0x801092c4 801083d9: e8 88 81 ff ff call 80100566 <panic> if(*pte & PTE_P) 801083de: 8b 45 ec mov -0x14(%ebp),%eax 801083e1: 8b 00 mov (%eax),%eax 801083e3: 83 e0 01 and $0x1,%eax 801083e6: 85 c0 test %eax,%eax 801083e8: 74 0d je 801083f7 <mappages+0x76> panic("remap"); 801083ea: 83 ec 0c sub $0xc,%esp 801083ed: 68 ce 92 10 80 push $0x801092ce 801083f2: e8 6f 81 ff ff call 80100566 <panic> *pte = pa | perm | PTE_P; 801083f7: 8b 45 18 mov 0x18(%ebp),%eax 801083fa: 0b 45 14 or 0x14(%ebp),%eax 801083fd: 83 c8 01 or $0x1,%eax 80108400: 89 c2 mov %eax,%edx 80108402: 8b 45 ec mov -0x14(%ebp),%eax 80108405: 89 10 mov %edx,(%eax) if(a == last) 80108407: 8b 45 f4 mov -0xc(%ebp),%eax 8010840a: 3b 45 f0 cmp -0x10(%ebp),%eax 8010840d: 74 10 je 8010841f <mappages+0x9e> break; a += PGSIZE; 8010840f: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) pa += PGSIZE; 80108416: 81 45 14 00 10 00 00 addl $0x1000,0x14(%ebp) } 8010841d: eb 86 jmp 801083a5 <mappages+0x24> panic("*pte is 0"); if(*pte & PTE_P) panic("remap"); *pte = pa | perm | PTE_P; if(a == last) break; 8010841f: 90 nop a += PGSIZE; pa += PGSIZE; } return 0; 80108420: b8 00 00 00 00 mov $0x0,%eax } 80108425: c9 leave 80108426: c3 ret 80108427 <setupkvm>: }; // Set up kernel part of a page table. pde_t* setupkvm(void) { 80108427: 55 push %ebp 80108428: 89 e5 mov %esp,%ebp 8010842a: 53 push %ebx 8010842b: 83 ec 14 sub $0x14,%esp pde_t *pgdir; struct kmap *k; if((pgdir = (pde_t*)kalloc()) == 0) 8010842e: e8 f6 a7 ff ff call 80102c29 <kalloc> 80108433: 89 45 f0 mov %eax,-0x10(%ebp) 80108436: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8010843a: 75 0a jne 80108446 <setupkvm+0x1f> return 0; 8010843c: b8 00 00 00 00 mov $0x0,%eax 80108441: e9 8e 00 00 00 jmp 801084d4 <setupkvm+0xad> memset(pgdir, 0, PGSIZE); 80108446: 83 ec 04 sub $0x4,%esp 80108449: 68 00 10 00 00 push $0x1000 8010844e: 6a 00 push $0x0 80108450: ff 75 f0 pushl -0x10(%ebp) 80108453: e8 7b d3 ff ff call 801057d3 <memset> 80108458: 83 c4 10 add $0x10,%esp if (p2v(PHYSTOP) > (void*)DEVSPACE) 8010845b: 83 ec 0c sub $0xc,%esp 8010845e: 68 00 00 00 0e push $0xe000000 80108463: e8 f7 f9 ff ff call 80107e5f <p2v> 80108468: 83 c4 10 add $0x10,%esp 8010846b: 3d 00 00 00 fe cmp $0xfe000000,%eax 80108470: 76 0d jbe 8010847f <setupkvm+0x58> panic("PHYSTOP too high"); 80108472: 83 ec 0c sub $0xc,%esp 80108475: 68 d4 92 10 80 push $0x801092d4 8010847a: e8 e7 80 ff ff call 80100566 <panic> for(k = kmap; k < &kmap[NELEM(kmap)]; k++) 8010847f: c7 45 f4 c0 c4 10 80 movl $0x8010c4c0,-0xc(%ebp) 80108486: eb 40 jmp 801084c8 <setupkvm+0xa1> if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 80108488: 8b 45 f4 mov -0xc(%ebp),%eax 8010848b: 8b 48 0c mov 0xc(%eax),%ecx (uint)k->phys_start, k->perm) < 0) 8010848e: 8b 45 f4 mov -0xc(%ebp),%eax 80108491: 8b 50 04 mov 0x4(%eax),%edx return 0; memset(pgdir, 0, PGSIZE); 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, 80108494: 8b 45 f4 mov -0xc(%ebp),%eax 80108497: 8b 58 08 mov 0x8(%eax),%ebx 8010849a: 8b 45 f4 mov -0xc(%ebp),%eax 8010849d: 8b 40 04 mov 0x4(%eax),%eax 801084a0: 29 c3 sub %eax,%ebx 801084a2: 8b 45 f4 mov -0xc(%ebp),%eax 801084a5: 8b 00 mov (%eax),%eax 801084a7: 83 ec 0c sub $0xc,%esp 801084aa: 51 push %ecx 801084ab: 52 push %edx 801084ac: 53 push %ebx 801084ad: 50 push %eax 801084ae: ff 75 f0 pushl -0x10(%ebp) 801084b1: e8 cb fe ff ff call 80108381 <mappages> 801084b6: 83 c4 20 add $0x20,%esp 801084b9: 85 c0 test %eax,%eax 801084bb: 79 07 jns 801084c4 <setupkvm+0x9d> (uint)k->phys_start, k->perm) < 0) return 0; 801084bd: b8 00 00 00 00 mov $0x0,%eax 801084c2: eb 10 jmp 801084d4 <setupkvm+0xad> if((pgdir = (pde_t*)kalloc()) == 0) return 0; memset(pgdir, 0, PGSIZE); if (p2v(PHYSTOP) > (void*)DEVSPACE) panic("PHYSTOP too high"); for(k = kmap; k < &kmap[NELEM(kmap)]; k++) 801084c4: 83 45 f4 10 addl $0x10,-0xc(%ebp) 801084c8: 81 7d f4 00 c5 10 80 cmpl $0x8010c500,-0xc(%ebp) 801084cf: 72 b7 jb 80108488 <setupkvm+0x61> if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, (uint)k->phys_start, k->perm) < 0) return 0; return pgdir; 801084d1: 8b 45 f0 mov -0x10(%ebp),%eax } 801084d4: 8b 5d fc mov -0x4(%ebp),%ebx 801084d7: c9 leave 801084d8: c3 ret 801084d9 <kvmalloc>: // Allocate one page table for the machine for the kernel address // space for scheduler processes. void kvmalloc(void) { 801084d9: 55 push %ebp 801084da: 89 e5 mov %esp,%ebp 801084dc: 83 ec 08 sub $0x8,%esp kpgdir = setupkvm(); 801084df: e8 43 ff ff ff call 80108427 <setupkvm> 801084e4: a3 58 65 11 80 mov %eax,0x80116558 switchkvm(); 801084e9: e8 03 00 00 00 call 801084f1 <switchkvm> } 801084ee: 90 nop 801084ef: c9 leave 801084f0: c3 ret 801084f1 <switchkvm>: // Switch h/w page table register to the kernel-only page table, // for when no process is running. void switchkvm(void) { 801084f1: 55 push %ebp 801084f2: 89 e5 mov %esp,%ebp lcr3(v2p(kpgdir)); // switch to the kernel page table 801084f4: a1 58 65 11 80 mov 0x80116558,%eax 801084f9: 50 push %eax 801084fa: e8 53 f9 ff ff call 80107e52 <v2p> 801084ff: 83 c4 04 add $0x4,%esp 80108502: 50 push %eax 80108503: e8 3e f9 ff ff call 80107e46 <lcr3> 80108508: 83 c4 04 add $0x4,%esp } 8010850b: 90 nop 8010850c: c9 leave 8010850d: c3 ret 8010850e <switchuvm>: // Switch TSS and h/w page table to correspond to process p. void switchuvm(struct proc *p) { 8010850e: 55 push %ebp 8010850f: 89 e5 mov %esp,%ebp 80108511: 56 push %esi 80108512: 53 push %ebx pushcli(); 80108513: e8 b5 d1 ff ff call 801056cd <pushcli> cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0); 80108518: 65 a1 00 00 00 00 mov %gs:0x0,%eax 8010851e: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80108525: 83 c2 08 add $0x8,%edx 80108528: 89 d6 mov %edx,%esi 8010852a: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80108531: 83 c2 08 add $0x8,%edx 80108534: c1 ea 10 shr $0x10,%edx 80108537: 89 d3 mov %edx,%ebx 80108539: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80108540: 83 c2 08 add $0x8,%edx 80108543: c1 ea 18 shr $0x18,%edx 80108546: 89 d1 mov %edx,%ecx 80108548: 66 c7 80 a0 00 00 00 movw $0x67,0xa0(%eax) 8010854f: 67 00 80108551: 66 89 b0 a2 00 00 00 mov %si,0xa2(%eax) 80108558: 88 98 a4 00 00 00 mov %bl,0xa4(%eax) 8010855e: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80108565: 83 e2 f0 and $0xfffffff0,%edx 80108568: 83 ca 09 or $0x9,%edx 8010856b: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) 80108571: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80108578: 83 ca 10 or $0x10,%edx 8010857b: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) 80108581: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80108588: 83 e2 9f and $0xffffff9f,%edx 8010858b: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) 80108591: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80108598: 83 ca 80 or $0xffffff80,%edx 8010859b: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) 801085a1: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx 801085a8: 83 e2 f0 and $0xfffffff0,%edx 801085ab: 88 90 a6 00 00 00 mov %dl,0xa6(%eax) 801085b1: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx 801085b8: 83 e2 ef and $0xffffffef,%edx 801085bb: 88 90 a6 00 00 00 mov %dl,0xa6(%eax) 801085c1: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx 801085c8: 83 e2 df and $0xffffffdf,%edx 801085cb: 88 90 a6 00 00 00 mov %dl,0xa6(%eax) 801085d1: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx 801085d8: 83 ca 40 or $0x40,%edx 801085db: 88 90 a6 00 00 00 mov %dl,0xa6(%eax) 801085e1: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx 801085e8: 83 e2 7f and $0x7f,%edx 801085eb: 88 90 a6 00 00 00 mov %dl,0xa6(%eax) 801085f1: 88 88 a7 00 00 00 mov %cl,0xa7(%eax) cpu->gdt[SEG_TSS].s = 0; 801085f7: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801085fd: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80108604: 83 e2 ef and $0xffffffef,%edx 80108607: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) cpu->ts.ss0 = SEG_KDATA << 3; 8010860d: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80108613: 66 c7 40 10 10 00 movw $0x10,0x10(%eax) cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE; 80108619: 65 a1 00 00 00 00 mov %gs:0x0,%eax 8010861f: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 80108626: 8b 52 08 mov 0x8(%edx),%edx 80108629: 81 c2 00 10 00 00 add $0x1000,%edx 8010862f: 89 50 0c mov %edx,0xc(%eax) ltr(SEG_TSS << 3); 80108632: 83 ec 0c sub $0xc,%esp 80108635: 6a 30 push $0x30 80108637: e8 dd f7 ff ff call 80107e19 <ltr> 8010863c: 83 c4 10 add $0x10,%esp if(p->pgdir == 0) 8010863f: 8b 45 08 mov 0x8(%ebp),%eax 80108642: 8b 40 04 mov 0x4(%eax),%eax 80108645: 85 c0 test %eax,%eax 80108647: 75 0d jne 80108656 <switchuvm+0x148> panic("switchuvm: no pgdir"); 80108649: 83 ec 0c sub $0xc,%esp 8010864c: 68 e5 92 10 80 push $0x801092e5 80108651: e8 10 7f ff ff call 80100566 <panic> lcr3(v2p(p->pgdir)); // switch to new address space 80108656: 8b 45 08 mov 0x8(%ebp),%eax 80108659: 8b 40 04 mov 0x4(%eax),%eax 8010865c: 83 ec 0c sub $0xc,%esp 8010865f: 50 push %eax 80108660: e8 ed f7 ff ff call 80107e52 <v2p> 80108665: 83 c4 10 add $0x10,%esp 80108668: 83 ec 0c sub $0xc,%esp 8010866b: 50 push %eax 8010866c: e8 d5 f7 ff ff call 80107e46 <lcr3> 80108671: 83 c4 10 add $0x10,%esp popcli(); 80108674: e8 99 d0 ff ff call 80105712 <popcli> } 80108679: 90 nop 8010867a: 8d 65 f8 lea -0x8(%ebp),%esp 8010867d: 5b pop %ebx 8010867e: 5e pop %esi 8010867f: 5d pop %ebp 80108680: c3 ret 80108681 <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) { 80108681: 55 push %ebp 80108682: 89 e5 mov %esp,%ebp 80108684: 83 ec 18 sub $0x18,%esp char *mem; if(sz >= PGSIZE) 80108687: 81 7d 10 ff 0f 00 00 cmpl $0xfff,0x10(%ebp) 8010868e: 76 0d jbe 8010869d <inituvm+0x1c> panic("inituvm: more than a page"); 80108690: 83 ec 0c sub $0xc,%esp 80108693: 68 f9 92 10 80 push $0x801092f9 80108698: e8 c9 7e ff ff call 80100566 <panic> mem = kalloc(); 8010869d: e8 87 a5 ff ff call 80102c29 <kalloc> 801086a2: 89 45 f4 mov %eax,-0xc(%ebp) memset(mem, 0, PGSIZE); 801086a5: 83 ec 04 sub $0x4,%esp 801086a8: 68 00 10 00 00 push $0x1000 801086ad: 6a 00 push $0x0 801086af: ff 75 f4 pushl -0xc(%ebp) 801086b2: e8 1c d1 ff ff call 801057d3 <memset> 801086b7: 83 c4 10 add $0x10,%esp mappages(pgdir, 0, PGSIZE, v2p(mem), PTE_W|PTE_U); 801086ba: 83 ec 0c sub $0xc,%esp 801086bd: ff 75 f4 pushl -0xc(%ebp) 801086c0: e8 8d f7 ff ff call 80107e52 <v2p> 801086c5: 83 c4 10 add $0x10,%esp 801086c8: 83 ec 0c sub $0xc,%esp 801086cb: 6a 06 push $0x6 801086cd: 50 push %eax 801086ce: 68 00 10 00 00 push $0x1000 801086d3: 6a 00 push $0x0 801086d5: ff 75 08 pushl 0x8(%ebp) 801086d8: e8 a4 fc ff ff call 80108381 <mappages> 801086dd: 83 c4 20 add $0x20,%esp memmove(mem, init, sz); 801086e0: 83 ec 04 sub $0x4,%esp 801086e3: ff 75 10 pushl 0x10(%ebp) 801086e6: ff 75 0c pushl 0xc(%ebp) 801086e9: ff 75 f4 pushl -0xc(%ebp) 801086ec: e8 a1 d1 ff ff call 80105892 <memmove> 801086f1: 83 c4 10 add $0x10,%esp } 801086f4: 90 nop 801086f5: c9 leave 801086f6: c3 ret 801086f7 <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) { 801086f7: 55 push %ebp 801086f8: 89 e5 mov %esp,%ebp 801086fa: 53 push %ebx 801086fb: 83 ec 14 sub $0x14,%esp uint i, pa, n; pte_t *pte; if((uint) addr % PGSIZE != 0) 801086fe: 8b 45 0c mov 0xc(%ebp),%eax 80108701: 25 ff 0f 00 00 and $0xfff,%eax 80108706: 85 c0 test %eax,%eax 80108708: 74 0d je 80108717 <loaduvm+0x20> panic("loaduvm: addr must be page aligned"); 8010870a: 83 ec 0c sub $0xc,%esp 8010870d: 68 14 93 10 80 push $0x80109314 80108712: e8 4f 7e ff ff call 80100566 <panic> for(i = 0; i < sz; i += PGSIZE){ 80108717: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010871e: e9 95 00 00 00 jmp 801087b8 <loaduvm+0xc1> if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) 80108723: 8b 55 0c mov 0xc(%ebp),%edx 80108726: 8b 45 f4 mov -0xc(%ebp),%eax 80108729: 01 d0 add %edx,%eax 8010872b: 83 ec 04 sub $0x4,%esp 8010872e: 6a 00 push $0x0 80108730: 50 push %eax 80108731: ff 75 08 pushl 0x8(%ebp) 80108734: e8 a8 fb ff ff call 801082e1 <walkpgdir> 80108739: 83 c4 10 add $0x10,%esp 8010873c: 89 45 ec mov %eax,-0x14(%ebp) 8010873f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80108743: 75 0d jne 80108752 <loaduvm+0x5b> panic("loaduvm: address should exist"); 80108745: 83 ec 0c sub $0xc,%esp 80108748: 68 37 93 10 80 push $0x80109337 8010874d: e8 14 7e ff ff call 80100566 <panic> pa = PTE_ADDR(*pte); 80108752: 8b 45 ec mov -0x14(%ebp),%eax 80108755: 8b 00 mov (%eax),%eax 80108757: 25 00 f0 ff ff and $0xfffff000,%eax 8010875c: 89 45 e8 mov %eax,-0x18(%ebp) if(sz - i < PGSIZE) 8010875f: 8b 45 18 mov 0x18(%ebp),%eax 80108762: 2b 45 f4 sub -0xc(%ebp),%eax 80108765: 3d ff 0f 00 00 cmp $0xfff,%eax 8010876a: 77 0b ja 80108777 <loaduvm+0x80> n = sz - i; 8010876c: 8b 45 18 mov 0x18(%ebp),%eax 8010876f: 2b 45 f4 sub -0xc(%ebp),%eax 80108772: 89 45 f0 mov %eax,-0x10(%ebp) 80108775: eb 07 jmp 8010877e <loaduvm+0x87> else n = PGSIZE; 80108777: c7 45 f0 00 10 00 00 movl $0x1000,-0x10(%ebp) if(readi(ip, p2v(pa), offset+i, n) != n) 8010877e: 8b 55 14 mov 0x14(%ebp),%edx 80108781: 8b 45 f4 mov -0xc(%ebp),%eax 80108784: 8d 1c 02 lea (%edx,%eax,1),%ebx 80108787: 83 ec 0c sub $0xc,%esp 8010878a: ff 75 e8 pushl -0x18(%ebp) 8010878d: e8 cd f6 ff ff call 80107e5f <p2v> 80108792: 83 c4 10 add $0x10,%esp 80108795: ff 75 f0 pushl -0x10(%ebp) 80108798: 53 push %ebx 80108799: 50 push %eax 8010879a: ff 75 10 pushl 0x10(%ebp) 8010879d: e8 ec 96 ff ff call 80101e8e <readi> 801087a2: 83 c4 10 add $0x10,%esp 801087a5: 3b 45 f0 cmp -0x10(%ebp),%eax 801087a8: 74 07 je 801087b1 <loaduvm+0xba> return -1; 801087aa: b8 ff ff ff ff mov $0xffffffff,%eax 801087af: eb 18 jmp 801087c9 <loaduvm+0xd2> uint i, pa, n; pte_t *pte; if((uint) addr % PGSIZE != 0) panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ 801087b1: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 801087b8: 8b 45 f4 mov -0xc(%ebp),%eax 801087bb: 3b 45 18 cmp 0x18(%ebp),%eax 801087be: 0f 82 5f ff ff ff jb 80108723 <loaduvm+0x2c> else n = PGSIZE; if(readi(ip, p2v(pa), offset+i, n) != n) return -1; } return 0; 801087c4: b8 00 00 00 00 mov $0x0,%eax } 801087c9: 8b 5d fc mov -0x4(%ebp),%ebx 801087cc: c9 leave 801087cd: c3 ret 801087ce <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) { 801087ce: 55 push %ebp 801087cf: 89 e5 mov %esp,%ebp 801087d1: 83 ec 18 sub $0x18,%esp char *mem; uint a; if(newsz >= KERNBASE) 801087d4: 8b 45 10 mov 0x10(%ebp),%eax 801087d7: 85 c0 test %eax,%eax 801087d9: 79 0a jns 801087e5 <allocuvm+0x17> return 0; 801087db: b8 00 00 00 00 mov $0x0,%eax 801087e0: e9 b0 00 00 00 jmp 80108895 <allocuvm+0xc7> if(newsz < oldsz) 801087e5: 8b 45 10 mov 0x10(%ebp),%eax 801087e8: 3b 45 0c cmp 0xc(%ebp),%eax 801087eb: 73 08 jae 801087f5 <allocuvm+0x27> return oldsz; 801087ed: 8b 45 0c mov 0xc(%ebp),%eax 801087f0: e9 a0 00 00 00 jmp 80108895 <allocuvm+0xc7> a = PGROUNDUP(oldsz); 801087f5: 8b 45 0c mov 0xc(%ebp),%eax 801087f8: 05 ff 0f 00 00 add $0xfff,%eax 801087fd: 25 00 f0 ff ff and $0xfffff000,%eax 80108802: 89 45 f4 mov %eax,-0xc(%ebp) for(; a < newsz; a += PGSIZE){ 80108805: eb 7f jmp 80108886 <allocuvm+0xb8> mem = kalloc(); 80108807: e8 1d a4 ff ff call 80102c29 <kalloc> 8010880c: 89 45 f0 mov %eax,-0x10(%ebp) if(mem == 0){ 8010880f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80108813: 75 2b jne 80108840 <allocuvm+0x72> cprintf("allocuvm out of memory\n"); 80108815: 83 ec 0c sub $0xc,%esp 80108818: 68 55 93 10 80 push $0x80109355 8010881d: e8 a4 7b ff ff call 801003c6 <cprintf> 80108822: 83 c4 10 add $0x10,%esp deallocuvm(pgdir, newsz, oldsz); 80108825: 83 ec 04 sub $0x4,%esp 80108828: ff 75 0c pushl 0xc(%ebp) 8010882b: ff 75 10 pushl 0x10(%ebp) 8010882e: ff 75 08 pushl 0x8(%ebp) 80108831: e8 61 00 00 00 call 80108897 <deallocuvm> 80108836: 83 c4 10 add $0x10,%esp return 0; 80108839: b8 00 00 00 00 mov $0x0,%eax 8010883e: eb 55 jmp 80108895 <allocuvm+0xc7> } memset(mem, 0, PGSIZE); 80108840: 83 ec 04 sub $0x4,%esp 80108843: 68 00 10 00 00 push $0x1000 80108848: 6a 00 push $0x0 8010884a: ff 75 f0 pushl -0x10(%ebp) 8010884d: e8 81 cf ff ff call 801057d3 <memset> 80108852: 83 c4 10 add $0x10,%esp mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U); 80108855: 83 ec 0c sub $0xc,%esp 80108858: ff 75 f0 pushl -0x10(%ebp) 8010885b: e8 f2 f5 ff ff call 80107e52 <v2p> 80108860: 83 c4 10 add $0x10,%esp 80108863: 89 c2 mov %eax,%edx 80108865: 8b 45 f4 mov -0xc(%ebp),%eax 80108868: 83 ec 0c sub $0xc,%esp 8010886b: 6a 06 push $0x6 8010886d: 52 push %edx 8010886e: 68 00 10 00 00 push $0x1000 80108873: 50 push %eax 80108874: ff 75 08 pushl 0x8(%ebp) 80108877: e8 05 fb ff ff call 80108381 <mappages> 8010887c: 83 c4 20 add $0x20,%esp return 0; if(newsz < oldsz) return oldsz; a = PGROUNDUP(oldsz); for(; a < newsz; a += PGSIZE){ 8010887f: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80108886: 8b 45 f4 mov -0xc(%ebp),%eax 80108889: 3b 45 10 cmp 0x10(%ebp),%eax 8010888c: 0f 82 75 ff ff ff jb 80108807 <allocuvm+0x39> return 0; } memset(mem, 0, PGSIZE); mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U); } return newsz; 80108892: 8b 45 10 mov 0x10(%ebp),%eax } 80108895: c9 leave 80108896: c3 ret 80108897 <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) { 80108897: 55 push %ebp 80108898: 89 e5 mov %esp,%ebp 8010889a: 83 ec 18 sub $0x18,%esp pte_t *pte; uint a, pa; if(newsz >= oldsz) 8010889d: 8b 45 10 mov 0x10(%ebp),%eax 801088a0: 3b 45 0c cmp 0xc(%ebp),%eax 801088a3: 72 08 jb 801088ad <deallocuvm+0x16> return oldsz; 801088a5: 8b 45 0c mov 0xc(%ebp),%eax 801088a8: e9 a5 00 00 00 jmp 80108952 <deallocuvm+0xbb> a = PGROUNDUP(newsz); 801088ad: 8b 45 10 mov 0x10(%ebp),%eax 801088b0: 05 ff 0f 00 00 add $0xfff,%eax 801088b5: 25 00 f0 ff ff and $0xfffff000,%eax 801088ba: 89 45 f4 mov %eax,-0xc(%ebp) for(; a < oldsz; a += PGSIZE){ 801088bd: e9 81 00 00 00 jmp 80108943 <deallocuvm+0xac> pte = walkpgdir(pgdir, (char*)a, 0); 801088c2: 8b 45 f4 mov -0xc(%ebp),%eax 801088c5: 83 ec 04 sub $0x4,%esp 801088c8: 6a 00 push $0x0 801088ca: 50 push %eax 801088cb: ff 75 08 pushl 0x8(%ebp) 801088ce: e8 0e fa ff ff call 801082e1 <walkpgdir> 801088d3: 83 c4 10 add $0x10,%esp 801088d6: 89 45 f0 mov %eax,-0x10(%ebp) if(!pte) 801088d9: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801088dd: 75 09 jne 801088e8 <deallocuvm+0x51> a += (NPTENTRIES - 1) * PGSIZE; 801088df: 81 45 f4 00 f0 3f 00 addl $0x3ff000,-0xc(%ebp) 801088e6: eb 54 jmp 8010893c <deallocuvm+0xa5> else if((*pte & PTE_P) != 0){ 801088e8: 8b 45 f0 mov -0x10(%ebp),%eax 801088eb: 8b 00 mov (%eax),%eax 801088ed: 83 e0 01 and $0x1,%eax 801088f0: 85 c0 test %eax,%eax 801088f2: 74 48 je 8010893c <deallocuvm+0xa5> pa = PTE_ADDR(*pte); 801088f4: 8b 45 f0 mov -0x10(%ebp),%eax 801088f7: 8b 00 mov (%eax),%eax 801088f9: 25 00 f0 ff ff and $0xfffff000,%eax 801088fe: 89 45 ec mov %eax,-0x14(%ebp) if(pa == 0) 80108901: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80108905: 75 0d jne 80108914 <deallocuvm+0x7d> panic("kfree"); 80108907: 83 ec 0c sub $0xc,%esp 8010890a: 68 6d 93 10 80 push $0x8010936d 8010890f: e8 52 7c ff ff call 80100566 <panic> char *v = p2v(pa); 80108914: 83 ec 0c sub $0xc,%esp 80108917: ff 75 ec pushl -0x14(%ebp) 8010891a: e8 40 f5 ff ff call 80107e5f <p2v> 8010891f: 83 c4 10 add $0x10,%esp 80108922: 89 45 e8 mov %eax,-0x18(%ebp) kfree(v); 80108925: 83 ec 0c sub $0xc,%esp 80108928: ff 75 e8 pushl -0x18(%ebp) 8010892b: e8 4f a2 ff ff call 80102b7f <kfree> 80108930: 83 c4 10 add $0x10,%esp *pte = 0; 80108933: 8b 45 f0 mov -0x10(%ebp),%eax 80108936: c7 00 00 00 00 00 movl $0x0,(%eax) if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); for(; a < oldsz; a += PGSIZE){ 8010893c: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80108943: 8b 45 f4 mov -0xc(%ebp),%eax 80108946: 3b 45 0c cmp 0xc(%ebp),%eax 80108949: 0f 82 73 ff ff ff jb 801088c2 <deallocuvm+0x2b> char *v = p2v(pa); kfree(v); *pte = 0; } } return newsz; 8010894f: 8b 45 10 mov 0x10(%ebp),%eax } 80108952: c9 leave 80108953: c3 ret 80108954 <freevm>: // Free a page table and all the physical memory pages // in the user part. void freevm(pde_t *pgdir) { 80108954: 55 push %ebp 80108955: 89 e5 mov %esp,%ebp 80108957: 83 ec 18 sub $0x18,%esp uint i; if(pgdir == 0) 8010895a: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 8010895e: 75 0d jne 8010896d <freevm+0x19> panic("freevm: no pgdir"); 80108960: 83 ec 0c sub $0xc,%esp 80108963: 68 73 93 10 80 push $0x80109373 80108968: e8 f9 7b ff ff call 80100566 <panic> deallocuvm(pgdir, KERNBASE, 0); 8010896d: 83 ec 04 sub $0x4,%esp 80108970: 6a 00 push $0x0 80108972: 68 00 00 00 80 push $0x80000000 80108977: ff 75 08 pushl 0x8(%ebp) 8010897a: e8 18 ff ff ff call 80108897 <deallocuvm> 8010897f: 83 c4 10 add $0x10,%esp for(i = 0; i < NPDENTRIES; i++){ 80108982: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80108989: eb 4f jmp 801089da <freevm+0x86> if(pgdir[i] & PTE_P){ 8010898b: 8b 45 f4 mov -0xc(%ebp),%eax 8010898e: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80108995: 8b 45 08 mov 0x8(%ebp),%eax 80108998: 01 d0 add %edx,%eax 8010899a: 8b 00 mov (%eax),%eax 8010899c: 83 e0 01 and $0x1,%eax 8010899f: 85 c0 test %eax,%eax 801089a1: 74 33 je 801089d6 <freevm+0x82> char * v = p2v(PTE_ADDR(pgdir[i])); 801089a3: 8b 45 f4 mov -0xc(%ebp),%eax 801089a6: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 801089ad: 8b 45 08 mov 0x8(%ebp),%eax 801089b0: 01 d0 add %edx,%eax 801089b2: 8b 00 mov (%eax),%eax 801089b4: 25 00 f0 ff ff and $0xfffff000,%eax 801089b9: 83 ec 0c sub $0xc,%esp 801089bc: 50 push %eax 801089bd: e8 9d f4 ff ff call 80107e5f <p2v> 801089c2: 83 c4 10 add $0x10,%esp 801089c5: 89 45 f0 mov %eax,-0x10(%ebp) kfree(v); 801089c8: 83 ec 0c sub $0xc,%esp 801089cb: ff 75 f0 pushl -0x10(%ebp) 801089ce: e8 ac a1 ff ff call 80102b7f <kfree> 801089d3: 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++){ 801089d6: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801089da: 81 7d f4 ff 03 00 00 cmpl $0x3ff,-0xc(%ebp) 801089e1: 76 a8 jbe 8010898b <freevm+0x37> if(pgdir[i] & PTE_P){ char * v = p2v(PTE_ADDR(pgdir[i])); kfree(v); } } kfree((char*)pgdir); 801089e3: 83 ec 0c sub $0xc,%esp 801089e6: ff 75 08 pushl 0x8(%ebp) 801089e9: e8 91 a1 ff ff call 80102b7f <kfree> 801089ee: 83 c4 10 add $0x10,%esp } 801089f1: 90 nop 801089f2: c9 leave 801089f3: c3 ret 801089f4 <clearpteu>: // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { 801089f4: 55 push %ebp 801089f5: 89 e5 mov %esp,%ebp 801089f7: 83 ec 18 sub $0x18,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 801089fa: 83 ec 04 sub $0x4,%esp 801089fd: 6a 00 push $0x0 801089ff: ff 75 0c pushl 0xc(%ebp) 80108a02: ff 75 08 pushl 0x8(%ebp) 80108a05: e8 d7 f8 ff ff call 801082e1 <walkpgdir> 80108a0a: 83 c4 10 add $0x10,%esp 80108a0d: 89 45 f4 mov %eax,-0xc(%ebp) if(pte == 0) 80108a10: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80108a14: 75 0d jne 80108a23 <clearpteu+0x2f> panic("clearpteu"); 80108a16: 83 ec 0c sub $0xc,%esp 80108a19: 68 84 93 10 80 push $0x80109384 80108a1e: e8 43 7b ff ff call 80100566 <panic> *pte &= ~PTE_U; 80108a23: 8b 45 f4 mov -0xc(%ebp),%eax 80108a26: 8b 00 mov (%eax),%eax 80108a28: 83 e0 fb and $0xfffffffb,%eax 80108a2b: 89 c2 mov %eax,%edx 80108a2d: 8b 45 f4 mov -0xc(%ebp),%eax 80108a30: 89 10 mov %edx,(%eax) } 80108a32: 90 nop 80108a33: c9 leave 80108a34: c3 ret 80108a35 <copyuvm>: // Given a parent process's page table, create a copy // of it for a child. pde_t* copyuvm(pde_t *pgdir, uint sz) { 80108a35: 55 push %ebp 80108a36: 89 e5 mov %esp,%ebp 80108a38: 53 push %ebx 80108a39: 83 ec 24 sub $0x24,%esp pde_t *d; pte_t *pte; uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) 80108a3c: e8 e6 f9 ff ff call 80108427 <setupkvm> 80108a41: 89 45 f0 mov %eax,-0x10(%ebp) 80108a44: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80108a48: 75 0a jne 80108a54 <copyuvm+0x1f> return 0; 80108a4a: b8 00 00 00 00 mov $0x0,%eax 80108a4f: e9 f8 00 00 00 jmp 80108b4c <copyuvm+0x117> for(i = 0; i < sz; i += PGSIZE){ 80108a54: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80108a5b: e9 c4 00 00 00 jmp 80108b24 <copyuvm+0xef> if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) 80108a60: 8b 45 f4 mov -0xc(%ebp),%eax 80108a63: 83 ec 04 sub $0x4,%esp 80108a66: 6a 00 push $0x0 80108a68: 50 push %eax 80108a69: ff 75 08 pushl 0x8(%ebp) 80108a6c: e8 70 f8 ff ff call 801082e1 <walkpgdir> 80108a71: 83 c4 10 add $0x10,%esp 80108a74: 89 45 ec mov %eax,-0x14(%ebp) 80108a77: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80108a7b: 75 0d jne 80108a8a <copyuvm+0x55> panic("copyuvm: pte should exist"); 80108a7d: 83 ec 0c sub $0xc,%esp 80108a80: 68 8e 93 10 80 push $0x8010938e 80108a85: e8 dc 7a ff ff call 80100566 <panic> if(!(*pte & PTE_P)) 80108a8a: 8b 45 ec mov -0x14(%ebp),%eax 80108a8d: 8b 00 mov (%eax),%eax 80108a8f: 83 e0 01 and $0x1,%eax 80108a92: 85 c0 test %eax,%eax 80108a94: 75 0d jne 80108aa3 <copyuvm+0x6e> panic("copyuvm: page not present"); 80108a96: 83 ec 0c sub $0xc,%esp 80108a99: 68 a8 93 10 80 push $0x801093a8 80108a9e: e8 c3 7a ff ff call 80100566 <panic> pa = PTE_ADDR(*pte); 80108aa3: 8b 45 ec mov -0x14(%ebp),%eax 80108aa6: 8b 00 mov (%eax),%eax 80108aa8: 25 00 f0 ff ff and $0xfffff000,%eax 80108aad: 89 45 e8 mov %eax,-0x18(%ebp) flags = PTE_FLAGS(*pte); 80108ab0: 8b 45 ec mov -0x14(%ebp),%eax 80108ab3: 8b 00 mov (%eax),%eax 80108ab5: 25 ff 0f 00 00 and $0xfff,%eax 80108aba: 89 45 e4 mov %eax,-0x1c(%ebp) if((mem = kalloc()) == 0) 80108abd: e8 67 a1 ff ff call 80102c29 <kalloc> 80108ac2: 89 45 e0 mov %eax,-0x20(%ebp) 80108ac5: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80108ac9: 74 6a je 80108b35 <copyuvm+0x100> goto bad; memmove(mem, (char*)p2v(pa), PGSIZE); 80108acb: 83 ec 0c sub $0xc,%esp 80108ace: ff 75 e8 pushl -0x18(%ebp) 80108ad1: e8 89 f3 ff ff call 80107e5f <p2v> 80108ad6: 83 c4 10 add $0x10,%esp 80108ad9: 83 ec 04 sub $0x4,%esp 80108adc: 68 00 10 00 00 push $0x1000 80108ae1: 50 push %eax 80108ae2: ff 75 e0 pushl -0x20(%ebp) 80108ae5: e8 a8 cd ff ff call 80105892 <memmove> 80108aea: 83 c4 10 add $0x10,%esp if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0) 80108aed: 8b 5d e4 mov -0x1c(%ebp),%ebx 80108af0: 83 ec 0c sub $0xc,%esp 80108af3: ff 75 e0 pushl -0x20(%ebp) 80108af6: e8 57 f3 ff ff call 80107e52 <v2p> 80108afb: 83 c4 10 add $0x10,%esp 80108afe: 89 c2 mov %eax,%edx 80108b00: 8b 45 f4 mov -0xc(%ebp),%eax 80108b03: 83 ec 0c sub $0xc,%esp 80108b06: 53 push %ebx 80108b07: 52 push %edx 80108b08: 68 00 10 00 00 push $0x1000 80108b0d: 50 push %eax 80108b0e: ff 75 f0 pushl -0x10(%ebp) 80108b11: e8 6b f8 ff ff call 80108381 <mappages> 80108b16: 83 c4 20 add $0x20,%esp 80108b19: 85 c0 test %eax,%eax 80108b1b: 78 1b js 80108b38 <copyuvm+0x103> uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) return 0; for(i = 0; i < sz; i += PGSIZE){ 80108b1d: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80108b24: 8b 45 f4 mov -0xc(%ebp),%eax 80108b27: 3b 45 0c cmp 0xc(%ebp),%eax 80108b2a: 0f 82 30 ff ff ff jb 80108a60 <copyuvm+0x2b> goto bad; memmove(mem, (char*)p2v(pa), PGSIZE); if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0) goto bad; } return d; 80108b30: 8b 45 f0 mov -0x10(%ebp),%eax 80108b33: eb 17 jmp 80108b4c <copyuvm+0x117> if(!(*pte & PTE_P)) panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); flags = PTE_FLAGS(*pte); if((mem = kalloc()) == 0) goto bad; 80108b35: 90 nop 80108b36: eb 01 jmp 80108b39 <copyuvm+0x104> memmove(mem, (char*)p2v(pa), PGSIZE); if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0) goto bad; 80108b38: 90 nop } return d; bad: freevm(d); 80108b39: 83 ec 0c sub $0xc,%esp 80108b3c: ff 75 f0 pushl -0x10(%ebp) 80108b3f: e8 10 fe ff ff call 80108954 <freevm> 80108b44: 83 c4 10 add $0x10,%esp return 0; 80108b47: b8 00 00 00 00 mov $0x0,%eax } 80108b4c: 8b 5d fc mov -0x4(%ebp),%ebx 80108b4f: c9 leave 80108b50: c3 ret 80108b51 <uva2ka>: //PAGEBREAK! // Map user virtual address to kernel address. char* uva2ka(pde_t *pgdir, char *uva) { 80108b51: 55 push %ebp 80108b52: 89 e5 mov %esp,%ebp 80108b54: 83 ec 18 sub $0x18,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80108b57: 83 ec 04 sub $0x4,%esp 80108b5a: 6a 00 push $0x0 80108b5c: ff 75 0c pushl 0xc(%ebp) 80108b5f: ff 75 08 pushl 0x8(%ebp) 80108b62: e8 7a f7 ff ff call 801082e1 <walkpgdir> 80108b67: 83 c4 10 add $0x10,%esp 80108b6a: 89 45 f4 mov %eax,-0xc(%ebp) if((*pte & PTE_P) == 0) 80108b6d: 8b 45 f4 mov -0xc(%ebp),%eax 80108b70: 8b 00 mov (%eax),%eax 80108b72: 83 e0 01 and $0x1,%eax 80108b75: 85 c0 test %eax,%eax 80108b77: 75 07 jne 80108b80 <uva2ka+0x2f> return 0; 80108b79: b8 00 00 00 00 mov $0x0,%eax 80108b7e: eb 29 jmp 80108ba9 <uva2ka+0x58> if((*pte & PTE_U) == 0) 80108b80: 8b 45 f4 mov -0xc(%ebp),%eax 80108b83: 8b 00 mov (%eax),%eax 80108b85: 83 e0 04 and $0x4,%eax 80108b88: 85 c0 test %eax,%eax 80108b8a: 75 07 jne 80108b93 <uva2ka+0x42> return 0; 80108b8c: b8 00 00 00 00 mov $0x0,%eax 80108b91: eb 16 jmp 80108ba9 <uva2ka+0x58> return (char*)p2v(PTE_ADDR(*pte)); 80108b93: 8b 45 f4 mov -0xc(%ebp),%eax 80108b96: 8b 00 mov (%eax),%eax 80108b98: 25 00 f0 ff ff and $0xfffff000,%eax 80108b9d: 83 ec 0c sub $0xc,%esp 80108ba0: 50 push %eax 80108ba1: e8 b9 f2 ff ff call 80107e5f <p2v> 80108ba6: 83 c4 10 add $0x10,%esp } 80108ba9: c9 leave 80108baa: c3 ret 80108bab <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) { 80108bab: 55 push %ebp 80108bac: 89 e5 mov %esp,%ebp 80108bae: 83 ec 18 sub $0x18,%esp char *buf, *pa0; uint n, va0; buf = (char*)p; 80108bb1: 8b 45 10 mov 0x10(%ebp),%eax 80108bb4: 89 45 f4 mov %eax,-0xc(%ebp) while(len > 0){ 80108bb7: eb 7f jmp 80108c38 <copyout+0x8d> va0 = (uint)PGROUNDDOWN(va); 80108bb9: 8b 45 0c mov 0xc(%ebp),%eax 80108bbc: 25 00 f0 ff ff and $0xfffff000,%eax 80108bc1: 89 45 ec mov %eax,-0x14(%ebp) pa0 = uva2ka(pgdir, (char*)va0); 80108bc4: 8b 45 ec mov -0x14(%ebp),%eax 80108bc7: 83 ec 08 sub $0x8,%esp 80108bca: 50 push %eax 80108bcb: ff 75 08 pushl 0x8(%ebp) 80108bce: e8 7e ff ff ff call 80108b51 <uva2ka> 80108bd3: 83 c4 10 add $0x10,%esp 80108bd6: 89 45 e8 mov %eax,-0x18(%ebp) if(pa0 == 0) 80108bd9: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 80108bdd: 75 07 jne 80108be6 <copyout+0x3b> return -1; 80108bdf: b8 ff ff ff ff mov $0xffffffff,%eax 80108be4: eb 61 jmp 80108c47 <copyout+0x9c> n = PGSIZE - (va - va0); 80108be6: 8b 45 ec mov -0x14(%ebp),%eax 80108be9: 2b 45 0c sub 0xc(%ebp),%eax 80108bec: 05 00 10 00 00 add $0x1000,%eax 80108bf1: 89 45 f0 mov %eax,-0x10(%ebp) if(n > len) 80108bf4: 8b 45 f0 mov -0x10(%ebp),%eax 80108bf7: 3b 45 14 cmp 0x14(%ebp),%eax 80108bfa: 76 06 jbe 80108c02 <copyout+0x57> n = len; 80108bfc: 8b 45 14 mov 0x14(%ebp),%eax 80108bff: 89 45 f0 mov %eax,-0x10(%ebp) memmove(pa0 + (va - va0), buf, n); 80108c02: 8b 45 0c mov 0xc(%ebp),%eax 80108c05: 2b 45 ec sub -0x14(%ebp),%eax 80108c08: 89 c2 mov %eax,%edx 80108c0a: 8b 45 e8 mov -0x18(%ebp),%eax 80108c0d: 01 d0 add %edx,%eax 80108c0f: 83 ec 04 sub $0x4,%esp 80108c12: ff 75 f0 pushl -0x10(%ebp) 80108c15: ff 75 f4 pushl -0xc(%ebp) 80108c18: 50 push %eax 80108c19: e8 74 cc ff ff call 80105892 <memmove> 80108c1e: 83 c4 10 add $0x10,%esp len -= n; 80108c21: 8b 45 f0 mov -0x10(%ebp),%eax 80108c24: 29 45 14 sub %eax,0x14(%ebp) buf += n; 80108c27: 8b 45 f0 mov -0x10(%ebp),%eax 80108c2a: 01 45 f4 add %eax,-0xc(%ebp) va = va0 + PGSIZE; 80108c2d: 8b 45 ec mov -0x14(%ebp),%eax 80108c30: 05 00 10 00 00 add $0x1000,%eax 80108c35: 89 45 0c mov %eax,0xc(%ebp) { char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ 80108c38: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 80108c3c: 0f 85 77 ff ff ff jne 80108bb9 <copyout+0xe> memmove(pa0 + (va - va0), buf, n); len -= n; buf += n; va = va0 + PGSIZE; } return 0; 80108c42: b8 00 00 00 00 mov $0x0,%eax } 80108c47: c9 leave 80108c48: c3 ret 80108c49 <xchg>: asm volatile("sti"); } static inline uint xchg(volatile uint *addr, uint newval) { 80108c49: 55 push %ebp 80108c4a: 89 e5 mov %esp,%ebp 80108c4c: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 80108c4f: 8b 55 08 mov 0x8(%ebp),%edx 80108c52: 8b 45 0c mov 0xc(%ebp),%eax 80108c55: 8b 4d 08 mov 0x8(%ebp),%ecx 80108c58: f0 87 02 lock xchg %eax,(%edx) 80108c5b: 89 45 fc mov %eax,-0x4(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 80108c5e: 8b 45 fc mov -0x4(%ebp),%eax } 80108c61: c9 leave 80108c62: c3 ret 80108c63 <lockinit>: //lock typedef uint lock_t; lock_t lock = 1 ; void lockinit(volatile lock_t *lock){ 80108c63: 55 push %ebp 80108c64: 89 e5 mov %esp,%ebp *lock = 1 ; 80108c66: 8b 45 08 mov 0x8(%ebp),%eax 80108c69: c7 00 01 00 00 00 movl $0x1,(%eax) } 80108c6f: 90 nop 80108c70: 5d pop %ebp 80108c71: c3 ret 80108c72 <lock_acquire>: void lock_acquire(volatile lock_t *lock){ 80108c72: 55 push %ebp 80108c73: 89 e5 mov %esp,%ebp while(xchg(lock,0) ==0); 80108c75: 90 nop 80108c76: 6a 00 push $0x0 80108c78: ff 75 08 pushl 0x8(%ebp) 80108c7b: e8 c9 ff ff ff call 80108c49 <xchg> 80108c80: 83 c4 08 add $0x8,%esp 80108c83: 85 c0 test %eax,%eax 80108c85: 74 ef je 80108c76 <lock_acquire+0x4> } 80108c87: 90 nop 80108c88: c9 leave 80108c89: c3 ret 80108c8a <lock_release>: void lock_release(volatile lock_t *lock){ 80108c8a: 55 push %ebp 80108c8b: 89 e5 mov %esp,%ebp *lock = 1; 80108c8d: 8b 45 08 mov 0x8(%ebp),%eax 80108c90: c7 00 01 00 00 00 movl $0x1,(%eax) } 80108c96: 90 nop 80108c97: 5d pop %ebp 80108c98: c3 ret 80108c99 <thread_create>: int thread_create(void *(*function)(void *), int priority, void *arg, void *stack){ 80108c99: 55 push %ebp 80108c9a: 89 e5 mov %esp,%ebp 80108c9c: 83 ec 18 sub $0x18,%esp int tid; if((tid = clone(function,arg,(void*)stack))!=0) 80108c9f: 83 ec 04 sub $0x4,%esp 80108ca2: ff 75 14 pushl 0x14(%ebp) 80108ca5: ff 75 10 pushl 0x10(%ebp) 80108ca8: ff 75 08 pushl 0x8(%ebp) 80108cab: e8 f7 bb ff ff call 801048a7 <clone> 80108cb0: 83 c4 10 add $0x10,%esp 80108cb3: 89 45 f4 mov %eax,-0xc(%ebp) 80108cb6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80108cba: 74 05 je 80108cc1 <thread_create+0x28> return tid; 80108cbc: 8b 45 f4 mov -0xc(%ebp),%eax 80108cbf: eb 03 jmp 80108cc4 <thread_create+0x2b> return tid; 80108cc1: 8b 45 f4 mov -0xc(%ebp),%eax } 80108cc4: c9 leave 80108cc5: c3 ret 80108cc6 <thread_exit>: void thread_exit(void *retval){ 80108cc6: 55 push %ebp 80108cc7: 89 e5 mov %esp,%ebp 80108cc9: 83 ec 08 sub $0x8,%esp exit_thread((void*)retval); 80108ccc: 83 ec 0c sub $0xc,%esp 80108ccf: ff 75 08 pushl 0x8(%ebp) 80108cd2: e8 38 c0 ff ff call 80104d0f <exit_thread> 80108cd7: 83 c4 10 add $0x10,%esp } 80108cda: 90 nop 80108cdb: c9 leave 80108cdc: c3 ret 80108cdd <thread_join>: // exit의 retval 이면 join 가능 //**retval : retval 's pointer //thread_join 의 retval 에 exit의 retval을 저장하면 됨 //해당 tid 를 가진 thread가 종료되는걸 기다린다. int thread_join(int tid, void **retval){ 80108cdd: 55 push %ebp 80108cde: 89 e5 mov %esp,%ebp 80108ce0: 83 ec 08 sub $0x8,%esp //종료되면 메모리들을 반환해줌 //성공시 0 return 아니면 -1return lock_acquire(&lock); 80108ce3: 68 00 c5 10 80 push $0x8010c500 80108ce8: e8 85 ff ff ff call 80108c72 <lock_acquire> 80108ced: 83 c4 04 add $0x4,%esp if(wait_thread(tid,retval) <0) 80108cf0: 83 ec 08 sub $0x8,%esp 80108cf3: ff 75 0c pushl 0xc(%ebp) 80108cf6: ff 75 08 pushl 0x8(%ebp) 80108cf9: e8 fc c1 ff ff call 80104efa <wait_thread> 80108cfe: 83 c4 10 add $0x10,%esp 80108d01: 85 c0 test %eax,%eax 80108d03: 79 07 jns 80108d0c <thread_join+0x2f> return-1; 80108d05: b8 ff ff ff ff mov $0xffffffff,%eax 80108d0a: eb 15 jmp 80108d21 <thread_join+0x44> lock_release(&lock); 80108d0c: 83 ec 0c sub $0xc,%esp 80108d0f: 68 00 c5 10 80 push $0x8010c500 80108d14: e8 71 ff ff ff call 80108c8a <lock_release> 80108d19: 83 c4 10 add $0x10,%esp return 0; 80108d1c: b8 00 00 00 00 mov $0x0,%eax } 80108d21: c9 leave 80108d22: c3 ret 80108d23 <gettid>: int gettid(void){ 80108d23: 55 push %ebp 80108d24: 89 e5 mov %esp,%ebp //tid 0부터 시작해서 이미 있으면 ++ 해줘서 return 해줄듯? return proc->tid; 80108d26: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80108d2c: 8b 80 84 00 00 00 mov 0x84(%eax),%eax } 80108d32: 5d pop %ebp 80108d33: c3 ret
38.045485
116
0.527295
520be67eef3fad06aac8b7af9307f4dc2f02adf2
334
asm
Assembly
programs/oeis/040/A040208.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/040/A040208.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/040/A040208.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A040208: Continued fraction for sqrt(223). ; 14,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13,1,28,1,13 cal $0,10201 ; Continued fraction for sqrt(142). add $1,$0 div $0,8 add $1,$0 mul $1,32 div $1,27
33.4
189
0.628743
197a7e607dc74a27ab70e1487a85436a57ef32b8
406
asm
Assembly
programs/oeis/095/A095939.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/095/A095939.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/095/A095939.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A095939: a(n+2) = 5a(n+1) - 3a(n) (n >= 1); a(0) = 1, a(1) = 2, a(2) = 9. ; 1,2,9,39,168,723,3111,13386,57597,247827,1066344,4588239,19742163,84946098,365504001,1572681711,6766896552,29116437627,125281498479,539058179514,2319446402133,9980057472123,42941948154216,184769568354711,795021997310907,3420801281490402 mov $1,1 lpb $0 sub $0,1 add $2,$1 add $3,$1 add $2,$3 mov $1,$2 mul $2,2 lpe
31.230769
238
0.692118
3102a97541ac90f49f25412982fc9261b52fe280
391
asm
Assembly
oeis/114/A114201.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/114/A114201.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/114/A114201.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A114201: C(1+2*n,1+n)*C(6+2*n,0+n) ; Submitted by Jon Maiga ; 1,24,450,7700,126126,2018016,31855824,498841200,7773608700,120784604512,1873533922260,29034766346040,449790717967500,6967723880880000,107959904588606400,1673378521123399200,25949671331244477300,402629171550425820000,6250759024406391495000 mov $1,$0 mov $2,1 add $2,$0 add $0,$2 bin $0,$1 add $2,2 mul $2,2 bin $2,$1 mul $0,$2
27.928571
240
0.774936
687416114006773a0da64d27fe7ee3f54c6594e7
456
asm
Assembly
bfloat/debug_fmul.asm
DW0RKiN/Floating-point-Library-for-Z80
494add6bc20922f4a634fbbacb32d8bd4dd185a7
[ "MIT" ]
12
2020-02-17T09:07:02.000Z
2022-02-09T22:15:34.000Z
bfloat/debug_fmul.asm
DW0RKiN/Floating-point-Library-for-Z80
494add6bc20922f4a634fbbacb32d8bd4dd185a7
[ "MIT" ]
null
null
null
bfloat/debug_fmul.asm
DW0RKiN/Floating-point-Library-for-Z80
494add6bc20922f4a634fbbacb32d8bd4dd185a7
[ "MIT" ]
1
2021-06-21T23:30:28.000Z
2021-06-21T23:30:28.000Z
if not defined FMUL INCLUDE "print_fp.asm" ; HL = BC * DE DEBUG@FMUL: FMUL: CALL @FMUL ; 3:17 PUSH HL ; 1:11 LD HL, '*'+' ' * 256 ; 3:10 "* " LD A, COL_BLUE ; 2:7 JP PRINT_XFP ; 3:10 else if not defined DEBUG@FMUL .WARNING You must include the file: debug_fmul.asm before. endif endif
25.333333
66
0.421053
3a046527fa294806a5140f188e06f254a65b7169
921
asm
Assembly
2048/canvas.asm
ssebs/xos
8c50cb7753690ad67696131a8b9935947e1a8075
[ "MIT" ]
15
2020-05-02T22:04:24.000Z
2021-08-31T16:56:59.000Z
2048/canvas.asm
JamesLinus/xos
3fba0cb15e84b5f7cd08e0a29ed5f86087192d2e
[ "MIT" ]
null
null
null
2048/canvas.asm
JamesLinus/xos
3fba0cb15e84b5f7cd08e0a29ed5f86087192d2e
[ "MIT" ]
1
2019-07-20T10:10:36.000Z
2019-07-20T10:10:36.000Z
; 2048 Game Clone for xOS use32 ; fill_rect: ; Draws a rectangle ; In\ AX/BX = X/Y pos ; In\ SI/DI = Width/Height ; In\ EDX = Color ; Out\ Nothing fill_rect: mov [.color], edx mov [.width], si mov [.height], di mov [.current_line], 0 ; get offset in window canvas mov cx, ax mov dx, bx mov eax, [window_handle] mov ebp, XOS_WM_PIXEL_OFFSET int 0x60 mov edi, eax .loop: push edi movzx ecx, [.width] mov eax, [.color] rep stosd pop edi add edi, WINDOW_WIDTH * 4 inc [.current_line] mov cx, [.height] cmp [.current_line], cx jge .done jmp .loop .done: ;mov ebp, XOS_WM_REDRAW ;int 0x60 ; -- this redraw will be done manually ret align 4 .color dd 0 .width dw 0 .height dw 0 .current_line dw 0 ; draw_text: ; Draws text ; In\ ESI = String ; In\ EBX = Color ; In\ CX/DX = X/Y pos ; Out\ Nothing draw_text: mov eax, [window_handle] mov ebp, XOS_WM_DRAW_TEXT int 0x60 ret
12.791667
50
0.653637
a405b05348eb3e85386c9bf749471d93c68d9637
94,942
asm
Assembly
msx/apps/term/msx2ansi.asm
zoggins/yellow-msx-series-for-rc2014
dbc95fa1480bc7bc541fd985fb4a67aab6c8b0fd
[ "MIT" ]
19
2021-02-20T11:48:37.000Z
2022-03-14T21:02:14.000Z
msx/apps/term/msx2ansi.asm
zoggins/yellow-msx-series-for-rc2014
dbc95fa1480bc7bc541fd985fb4a67aab6c8b0fd
[ "MIT" ]
3
2021-06-11T06:07:16.000Z
2021-11-14T07:43:11.000Z
msx/apps/term/msx2ansi.asm
zoggins/yellow-msx-series-for-rc2014
dbc95fa1480bc7bc541fd985fb4a67aab6c8b0fd
[ "MIT" ]
2
2021-05-03T19:09:36.000Z
2021-11-13T19:16:52.000Z
; MSX2ANSI ANSI V9938 Library v_1_7 ; ; Original Code by Tobias Keizer (ANSI-DRV_BIN) ; Tobias has made this great piece of code and most of what is in it has been ; coded by him ; ; This version of code and conversion into SDCC library by Oduvaldo Pavan Junior ; ducasp@gmail.com ; ; Thanks to Piter Punk for his contribution on making this library also a great ; library to use for a remote terminal, he has fixed a few already implemented ; escape code behavior as well as adding several escape codes that are important ; for nCurses applications ; ; Comercial usage of this code or derivative works of this code are ; allowed ONLY upon agreement with the author. ; Non-comercial usage is free as long as you publish your code changes and give ; credits to the original authors ; ; Changelog: ; ; v1_7: ; OPJ - Minor improvments on unnecessary returns and unnecessary loading of ; parameters that do not change at all ; OPJ - Fix on LineFeed, the previous version would always return cursor column ; to 0 on LF which was not correct ; PK - Fix on Backspace behavior, when called as sub on the first column it was ; not behaving properly, causing the code to wander a print garbage ; PK - Fix on ErDis1, wrong opcodes used and it was not multiplying A contents ; PK - Fix on DO_HMMV, when doing a second pass, the second run would add the ; line offset again in DYL, being that the value was already adjusted ; OPJ - Ugly hack to fix Insert and Delete lines, work for now, beautyful code ; might come in another release :) ; OPJ - Synchronet started to send non ANSI escape sequences all over the place ; and as result, those codes are showing (as they should). I've disabled the ; output of unknown CSI sequences ; ; v1_6: ; OPJ - Changed the way HMMC is handled in the code, this resulted in 7% faster ; rendering of HISPAMSX MSX boot logo Ansi Art on a z80 at regular speeds_ ; OPJ - Changed the way HMMM is handled in the code, it should be faster but it ; is difficult to determine the performance increase, anyway, code is cleaner ; and easier to understand as well ; OPJ - Changed how AnsiPrint and AnsiPutChar work, which results in 8% faster ; rendering of HISPAMSXMSX boot logo Ansi Art on a z80 at regular speeds. Total ; is a 15% speed improvment! ; Piter Punk - Made a draft of Ansi Delete Lines and YMMM function, not working ; on some scroll situations ; OPJ - Reworked YMMM function to start faster not having to calculate on the ; fly, doing all calculations before sending can save some time if VDP still is ; processing a command ; OPJ - Reworked CopyBlock as CopyBlockDown and made it work calculating before ; calling YMMM ; OPJ - Reworked Delete Lines, it was not taking into consideration when you ; are at the last line or if deleted lines exceed line capability ; OPJ - Created Insert Lines and CopyBlockUp ; ; ; v1_5: ; Piter Punk - Added scrolling support (ESC[S and ESC[T) ; Piter Punk - Added Support to ESC[X (ANSI ECH) and SGR 8 (Concealed), ; SGR 39 (Default Foreground Color), SGR 49 (Default Background Color) ; Piter Punk - Added Support to ESC[d (ANSI VPA), ESC[e (ANSI VPR), ESC[G ; (ANSI CHA), ESC[I (ANSI CHT) and ESC[Z (ANSI CBT) ; Piter Punk - Added Support to ESC[nb, ANSI REP, which repeats the last char ; Piter Punk - Rewrite HorizontalTab routine to move cursor to a tabstop ; Piter Punk - Added back HorizontalTab (0x09) handling ; Piter Punk - Added save and restore cursor VT100 control codes ; OPJ - Fixed the issue with ESC[J, DO_HMMV was clearing memory that was not ; from its video page depending on the current line offset ; OPJ - Added the possibility of disabling cursor while putting text with ; AnsiPutChar through AnsiStartBuffer and AnsiEndBuffer, this might generate ; a more pleasant screen rendering without the cursor moving and also speed up ; certain operations like screen clearing and line deletions ; OPJ - Improved ESC[X to use VDP HMMV to delete as it is faster ; OPJ - Fixed Scroll Down, it was pushing the last line down and still visible ; OPJ - Fixed Scroll Up and Down and LineFeed, the line being excluded might be ; pushed into visible are, better have it in the border color than background ; color, as border color only changes when screen is cleared, using the ; same color as the background ; OPJ - Fixed quite a few characters below 0x20, those should be as faithful as ; 6x8 and my bad pixel art talent allows :D ; OPJ - Form Feed (12 or 0x0C) should clear screen and go to home, fixed that ; OPJ - Not all DO_HMMV commands were setting the desired color, causing that ; sometimes the color would be wrong after ANSI delete Commands ; OPJ - Added ESC[@ (Insert Chars) ; ; v1_4: ; OPJ - Control code BELL (7) now beeps ; ; v1_3: ; OPJ - Character code 16 was in code 18, fixed that ; Piter Punk - Fixed bad behavior of CSIm (no parameters) as well as a crash ; Piter Punk - Add support for reverse video mode ; ; v1_2: ; Added ESCx5 (turn off cursor) support ; Added ESCy5 (turn on cursor) support ; If a character is below 0x20 and not a screen control code, print it ; Fix characters code 16, 17, 24, 25, 26, 27, 30 and 31 ; Probably not all characters below 0x20 (32) are correct... ; ; v1_1: ; Added ESC[J behavior when no parameter / 0 was choosen (delete from cursor on) ; Added ESC[1J (delete from cursor up to top of screen) and fixed ESC[2J support ; Fixed behavior when no parameters were given (it was not always correct) ; Added ESC[nP support for Linux telnet daemons SECTION CODE ; ; C Functions area ; ; In this section, we handle the calls from C code ; ; AnsiInit needs no parameters ; ; Will set the proper screen mode, clear screen, set cursor stuff ; ; You MUST call it, otherwise results might be unpredictable and crash ; ; void AnsiInit() PUBLIC _AnsiInit _AnsiInit: PUSH IX ; Interslot call might mess with IX, IY and C expect it to be intact PUSH IY CALL V9938_Init ; Initialize screen mode, etc CALL V9938_InitCursor ; Initialize cursor and return CALL V9938_ClearScreen ; Clear screen POP IY POP IX ; Restore IX, IY so C won't have issues RET ; AnsiFinish needs no parameters ; ; Will restore MSX to Screen 0 and restore original palette ; ; You MUST call it before returning to MSX-DOS, otherwise user will face a ; static screen and think it has crashed (you can type MODE 80 and restore it ; manually). So MAKE SURE to handle CTRL+BREAK, CTRL+C, etc and call this function ; before returning_ ; ; void AnsiFinish() PUBLIC _AnsiFinish _AnsiFinish: PUSH IX ; Interslot call might mess with IX, IY and C expect it to be intact PUSH IY CALL V9938_Finish ; Restore POP IY POP IX ; Restore IX, IY so C won't have issues RET ; AnsiStartBuffer needs no parameters ; ; Will turn off sprite cursor if it is on, idea is to make rendering faster and ; there is no need to have the cursor enabled while rendering a live buffer. For ; some applications it is faster to use putchar than print, thus the need to indicate ; start and end of buffer printing ; ; void AnsiStartBuffer() PUBLIC _AnsiStartBuffer _AnsiStartBuffer: StartBuffer: LD A,(CursorOn) OR A RET Z CALL DisCursorSub XOR A LD (CursorUpdt),A RET ; AnsiEndBuffer needs no parameters ; ; Will turn sprite cursor back on if it was on, idea is to make rendering faster and ; there is no need to have the cursor enabled while rendering a live buffer. For ; some applications it is faster to use putchar than print, thus the need to indicate ; start and end of buffer printing ; ; void AnsiEndBuffer() PUBLIC _AnsiEndBuffer _AnsiEndBuffer: EndBuffer: LD A,1 LD (CursorUpdt),A CALL V9938_SetCursorX CALL V9938_SetCursorY ; Set cursor position LD A,(CursorOn) OR A RET Z CALL EnCursorSub RET ; AnsiCallBack - Will call a __z88dk_fastcall function with Column/Line as a parameter ; ; This is useful to handle quickly ESC[6n cursor position requests, as it is up to ; the user program to determine how to send that information_ ; ; void AnsiCallBack(unsigned int uiCallBackAddress) __z88dk_fastcall PUBLIC _AnsiCallBack _AnsiCallBack: LD (ANSI_CGP_CALL_VEC + 1),HL ; Load the callback function address LD A,0x01 LD (ANSI_CB),A ; Flag that have a callback function RET ; AnsiGetCursorPosition - Add possibility to get current cursor position ; unsigned int AnsiGetCursorPosition( ) ; LSB will be current Column ; MSB will be current Row _AnsiGetCursorPosition: LD A,(CursorCol) ; Get Current Cursor Column Position INC A ; Increment it (internally it is 0-79) LD L,A ; Place column in L LD A,(CursorRow) ; Get Current Cursor Row (line) Position INC A ; Increment it (internally it is 0-24) LD H,A ; Place row in H RET ; AnsiPutChar - will put the char in register L on screen or buffer if part of ; ANSI / VT sequence ; ; void AnsiPutChar(unsigned char ucChar) __z88dk_fastcall PUBLIC _AnsiPutChar _AnsiPutChar: LD A,L ; Parameter is in L BufferChar: OR A RET Z ; If 0, no need to print nor ANSI parameter LD C,A ; Save char in C LD A,(ANSI_M) OR A JR NZ,BufferChar_CNT ; Esc processing going on LD A,C CP 27 ; Is character ESC? JR Z,BufferChar_ESC ; Yes, so treat ESC buffer ; It is a printable character or control code, deal with it directly here CP 0x20 JR C,BufferChar_CCode ; If less than 0x20 (space), a control character BufferChar_NotCCode: LD (LastChar),A CALL V9938_PrintChar ; Call the print routine for our chip LD A,(CursorCol) ; Get Current Cursor Position INC A ; Increment it LD (CursorCol),A ; Save CP 80 ; Time to line feed? JR NC,BufferChar_LF ; If 80 or greater feed the line, and line feed will return to printtext loop ; Otherwise JP V9938_SetCursorX ; Set cursor on screen, it will return from there as it is done after this BufferChar_LF: XOR A LD (CursorCol),A ; Save new cursor position JP LFeedSub ; Feed the line and return from there BufferChar_CCode: ; Check if it is a control character and do the action, otherwise print it CP 13 JP Z,CarriageReturnSub CP 10 JP Z,LFeedSub CP 8 JP Z,BackSpaceSub CP 12 ; FF, clear screen and home JP Z,ANSI_ED_ED2Sub CP 9 JP Z,HTabSub CP 7 JP Z,BellSub JP BufferChar_NotCCode ; It is ESC BufferChar_ESC: LD (ANSI_M),A ; Indicate ESC is in progress LD HL,ANSI_S LD (HL),A ; Save in first buffer position INC HL ; Next buffer position LD (ANSI_P),HL ; Save in the pointer RET ; Done for now BufferChar_CNT: LD HL,(ANSI_P) ; Current buffer free position CP 27 ; was ESC last byte? JR Z,BufferChar_CH2 ; Yes, check position 2 ; No CP 'x' ; ESC x? JR Z,BufferChar_X ; Let's check if it is a parameter we know what to do CP 'y' ; ESC y? JR Z,BufferChar_Y ; Let's check if it is a parameter we know what to do LD A,C ; Restore character LD (HL),A ; Store in buffer INC HL LD (ANSI_P),HL ; new buffer position CP 48 JR C,BufferChar_END ; Character is less than '0', not a parameter I understand, so finished buffering code ; No, '0' or greater CP '@' JR NC,BufferChar_END ; If A > '@' not a parameter I understand, so finished buffering code ;Otherwise it is between 0 and ; so ESC command has not finished yet RET BufferChar_END: XOR A LD (HL),A LD (ANSI_M),A ; No longer processing BufferChar_RET: LD HL,ANSI_S JP PrintText_RLP ; Ok, print the buffer we did not process BufferChar_CH2: LD A,C ; Restore char LD (HL),A ; Store it INC HL ; Increment pointer CP '[' ; Just deal with ESC[ commands, other commands not supported at this moment JR NZ,BufferChar_XorY ; So if the second character is not [, check if it is x or y BufferChar_CH2a: LD (ANSI_M),A ; Ok, now we are gathering parameters for the command LD (ANSI_P),HL ; Save pointer RET ; Done BufferChar_XorY: CP 'x' ; modify cursor behavior / disable? JR Z,BufferChar_CH2a ; So if the second character is x, let's move on CP 'y' ; modify cursor behavior / enable? JR Z,BufferChar_CH2a ; So if the second character is not y won't jump ; print the ESC sequence and life goes on JR NZ,BufferChar_END ; So if the second character is not [, print the ESC sequence and life goes on BufferChar_X: LD A,C ; Restore character CP '5' ; ESC x5? LD A,0 ; Do not want to clear flag LD (ANSI_M),A ; No longer processing JP Z,VT52_DISCURSOR ; yes, disable cursor JR BufferChar_Y_END ; no, print the contents and end processing BufferChar_Y: LD A,C ; Restore character CP '5' ; ESC x5? LD A,0 ; Do not want to clear flag LD (ANSI_M),A ; No longer processing JP Z,VT52_ENCURSOR ; yes, enaable cursor BufferChar_Y_END: LD (HL),A ; Store in buffer INC HL LD (ANSI_P),HL ; new buffer position JR BufferChar_END ; not a parameter I understand, so print on the screen ; AnsiPrint - will proccess and print the string whose address is in HL (zero terminated) ; void __z88dk_fastcall AnsiPrint(unsigned char * ucString) PUBLIC _AnsiPrint _AnsiPrint: CALL StartBuffer ; Disable sprite to render faster, if needed BufferText: LD A,(HL) ; Load the character INC HL ; Increment pointer OR A ; 0? JP Z,EndBuffer ; Yes, end of string, endbuffer will return for us PUSH HL ; Save pointer CALL BufferChar ; Process or print it POP HL ; Restore pointer JP BufferText ; Continue ; PrintText - Will handle text in address pointed by HL, zero terminated PrintText: PrintText_RLP: LD A,(HL) ; Load the character INC HL ; Increment the pointer CP 0x20 JR C,PrintText_RLP_CC ; If less than 0x20 (space), a control character PrintText_RLP_NOCC: LD (LastChar),A PUSH HL ; Save Pointer CALL V9938_PrintChar ; Call the print routine for our chip POP HL ; Restore Pointer LD A,(CursorCol) ; Get Current Cursor Position INC A ; Increment it LD (CursorCol),A ; Save CP 80 ; Time to line feed? JR NC,PrintText_RLP_LFeed ; If 80 or greater feed the line, and line feed will return to printtext loop ; Otherwise CALL V9938_SetCursorX ; Set cursor on screen JP PrintText_RLP ; If up to position 80, done PrintText_RLP_LFeed: XOR A LD (CursorCol),A JP LineFeed PrintText_RLP_CC: ; Check if it is a control character and do the action, otherwise print it OR A RET Z ; If 0, done CP 13 JP Z,CarriageReturn CP 10 JP Z,LineFeed CP 8 JP Z,BackSpace CP 12 ; FF, clear screen and home JP Z,ANSI_ED_ED2 CP 27 JP Z,EscapeCode ; If an Escape code, let's check it CP 9 JP Z,HorizontalTab CP 7 JP Z,Bell JP PrintText_RLP_NOCC ; ; Internal Functions area ; ; In this section, functions for the rendering engine use ; Bell: CALL BellSub JP PrintText_RLP BellSub: PUSH HL PUSH AF PUSH BC PUSH DE PUSH IY PUSH IX LD IX,0x017D CALL CALSUB ; Interslot call to beep POP IX POP IY POP DE POP BC POP AF POP HL RET EscapeCode: LD A,(HL) INC HL CP '[' JP Z,Parameters CP 'A' JP Z,VT52_UP CP 'B' JP Z,VT52_DW CP 'C' JP Z,VT52_RI CP 'D' JP Z,VT52_LE CP 'H' JP Z,VT52_HOME CP '7' JP Z,VT100_SCP CP '8' JP Z,VT100_RCP JP PrintText_RLP Parameters: LD (OrgAddress),HL LD DE,Parameters_PRM LD (Parameters_PPT),DE XOR A LD (Parameters_PCT),A Parameters_RLP: LD DE,Parameters_PST ; PARAMETER STRING LD C,0 Parameters_SCN: LD A,(HL) INC HL CP ';' JR Z,Parameters_END CP '0' JR C,Parameters_END CP '@' JR NC,Parameters_END INC C LD (DE),A INC DE JR Parameters_SCN Parameters_END: LD (Parameters_TRM),A ; SAVE TERMINATING CHAR LD A,C OR A JR Z,Parameters_SETOMT CP 1 JR Z,Parameters_RD1 ; READ ONE DIGIT CP 2 JR Z,Parameters_RD2 ; READ TWO DIGITS CP 3 JR Z,Parameters_RD3 ; READ THREE DIGITS ; More than three digits, just ignore for now PUSH AF LD A,'?' ; A command we do not support to make sure this is ignored LD (Parameters_TRM),A ; TERMINATING CHARACTER POP AF JR Parameters_SET Parameters_ERR: LD HL,(EndAddress) ; Do not print sequences we do not handle XOR A JP PrintText_RLP Parameters_RD1: LD A,(Parameters_PST) SUB 48 JR Parameters_SET Parameters_RD2: LD A,(Parameters_PST) SUB 48 ADD A,A LD C,A ADD A,A ADD A,A ADD A,C LD C,A LD A,(Parameters_PST+1) SUB 48 ADD A,C JR Parameters_SET Parameters_RD3: LD A,(Parameters_PST) SUB 48 ADD A,A LD C,A ADD A,A ADD A,A ADD A,C LD C,A LD A,(Parameters_PST+1) SUB 48 ADD A,C ADD A,A LD C,A ADD A,A ADD A,A ADD A,C LD C,A LD A,(Parameters_PST+2) SUB 48 ADD A,C Parameters_SET: LD DE,(Parameters_PPT) ; PARAMETER POINTER LD (DE),A INC DE LD (Parameters_PPT),DE LD A,(Parameters_PCT) ; PARAMETER COUNT INC A Parameters_SETOMT: LD B,A LD (Parameters_PCT),A LD A,(Parameters_TRM) ; TERMINATING CHARACTER CP ';' JP Z,Parameters_RLP LD (EndAddress),HL CP 20 JP C,Parameters_ERR CP 'H' JP Z,ANSI_CUP CP 'f' JP Z,ANSI_CUP CP 'R' JP Z,ANSI_CUP CP 'A' JP Z,ANSI_CUU CP 'B' JP Z,ANSI_CUD CP 'C' JP Z,ANSI_CUF CP 'D' JP Z,ANSI_CUB CP 's' JP Z,ANSI_SCP CP 'u' JP Z,ANSI_RCP CP 'J' JP Z,ANSI_ED CP 'K' JP Z,ANSI_EL CP 'L' JP Z,ANSI_IL CP 'M' JP Z,ANSI_DL CP 'm' JP Z,ANSI_SGR CP 'n' JP Z,ANSI_CGP CP 'P' JP Z,ANSI_DCH CP 'b' JP Z,ANSI_REP CP 'd' JP Z,ANSI_VPA CP 'e' JP Z,ANSI_CUD CP 'G' JP Z,ANSI_CHA CP 'I' JP Z,ANSI_CHT CP 'Z' JP Z,ANSI_CBT CP 'X' JP Z,ANSI_ECH CP 'S' JP Z,ANSI_SU CP 'T' JP Z,ANSI_SD CP '@' JP Z,ANSI_ICH JP Parameters_ERR ; OPJ - Add possibility to current cursor position be sent to a callback function ANSI_CGP: ; ANSI Cursor Get Position LD A,B CP 1 JR NZ,ANSI_CGP_END ; Not only 1 parameter, not 6n, done LD A,(Parameters_PRM) CP 6 ; Is it 6? JR NZ,ANSI_CGP_END ; Not 6, so it is not 6N ; Ok, ESC[6n, do we have a callback to report cursor position? LD A,(ANSI_CB) ; Is there a callback programmed? OR A JR Z,ANSI_CGP_END ; Nope, sorry, nothing to do ; So, lets report the position LD A,(CursorCol) INC A LD L,A ; Column goes in L LD A,(CursorRow) INC A LD H,A ; Row goes in H ANSI_CGP_CALL_VEC: CALL 0 ; This address will change when someone wants to receive callbacks ANSI_CGP_END: LD HL,(EndAddress) JP PrintText_RLP ANSI_CUP: ; ANSI Cursor Position LD A,B OR A JR Z,ANSI_CUP_HOM DEC A JR Z,ANSI_CUP_ROW LD A,(Parameters_PRM+1) DEC A LD (CursorCol),A ANSI_CUP_ROW: LD A,(Parameters_PRM+0) ANSI_CUP_ROW1: DEC A LD (CursorRow),A JR ANSI_CUP_RET ANSI_CUP_HOM: XOR A LD (CursorRow),A LD (CursorCol),A ANSI_CUP_RET: CALL V9938_SetCursorX CALL V9938_SetCursorY LD HL,(EndAddress) JP PrintText_RLP ANSI_CUU: ; ANSI Cursor Up LD A,B LD B,1 OR A JR Z,ANSI_CUU_SET ANSI_CUU_GTC: LD A,(Parameters_PRM+0) LD B,A ANSI_CUU_SET: LD A,(CursorRow) SUB A,B JR NC,ANSI_CUU_SCP XOR A ANSI_CUU_SCP: LD (CursorRow),A CALL V9938_SetCursorY LD HL,(EndAddress) JP PrintText_RLP ANSI_VPA: ; ANSI Vertical Position Absolute LD A,255 LD (CursorRow),A ANSI_CUD: ; ANSI Cursor Down LD A,B LD B,1 OR A JR Z,ANSI_CUD_SET ANSI_CUD_GTC: LD A,(Parameters_PRM+0) ;OPJ - Fix for 255 so cursor row won't overlap and have a low value when it should be > 24 CP 26 JR C,ANSI_CUD_SAV LD A,25 ANSI_CUD_SAV: LD B,A ANSI_CUD_SET: LD A,(CursorRow) ADD A,B ; OPJ changes to allow 25 lines CP 25 JR C,ANSI_CUD_SCP LD A,24 ANSI_CUD_SCP: LD (CursorRow),A CALL V9938_SetCursorY LD HL,(EndAddress) JP PrintText_RLP ANSI_CHA: ; ANSI Cursor Horizontal Absolute LD A,255 LD (CursorCol),A ANSI_CUF: ; ANSI Cursor Forward LD A,B LD B,1 OR A JR Z,ANSI_CUF_SET ANSI_CUF_GTC: LD A,(Parameters_PRM+0) ;OPJ - Fix for 255 so cursor column won't overlap and have a low value when it should be > 24 CP 81 JR C,ANSI_CUF_SAV LD A,80 ANSI_CUF_SAV: LD B,A ANSI_CUF_SET: LD A,(CursorCol) ADD A,B CP 80 JR C,ANSI_CUF_SCP LD A,79 ANSI_CUF_SCP: LD (CursorCol),A CALL V9938_SetCursorX LD HL,(EndAddress) JP PrintText_RLP ANSI_CUB: ; ANSI Cursor Back LD A,B LD B,1 OR A JR Z,ANSI_CUB_SET ANSI_CUB_GTC: LD A,(Parameters_PRM+0) LD B,A ANSI_CUB_SET: LD A,(CursorCol) SUB A,B JR NC,ANSI_CUB_SCP XOR A ANSI_CUB_SCP: LD (CursorCol),A CALL V9938_SetCursorX LD HL,(EndAddress) JP PrintText_RLP ANSI_SCP: ; ANSI Save Cursor Position LD A,(CursorCol) LD (SavedCol),A LD A,(CursorRow) LD (SavedRow),A LD HL,(EndAddress) JP PrintText_RLP ANSI_RCP: ; ANSI Restore Cursor Position LD A,(SavedCol) LD (CursorCol),A LD A,(SavedRow) LD (CursorRow),A CALL V9938_SetCursorX CALL V9938_SetCursorY LD HL,(EndAddress) JP PrintText_RLP ANSI_DCH: ; ANSI Delelete Characters LD A,B OR A JR NZ,ANSI_DCH_GP ; Default is delete one char if no number is given INC A JP V9938_DelChr ANSI_DCH_GP: LD A,(Parameters_PRM+0) ; Load parameter, number of characters to delete JP V9938_DelChr ANSI_REP: ; ANSI Repeat Last Character LD A,B LD B,1 ; No parameter means repeat once OR A JR Z,ANSI_REP_RLP LD A,(Parameters_PRM) LD B,A ; Load the number of repeats ANSI_REP_RLP: LD A,(LastChar) PUSH BC PUSH HL CALL V9938_PrintChar ; Call the print routine for our chip LD A,(CursorCol) ; Get Current Cursor Position INC A ; Increment it LD (CursorCol),A ; Save PUSH AF CALL V9938_SetCursorX ; Set cursor on screen POP AF CP 80 JR C,ANSI_REP_ELP ; If up to position 80, done XOR A LD (CursorCol),A ; Otherwise cursor is back to position 0 CALL LFeedSub ; And feed the line ANSI_REP_ELP: POP HL POP BC DJNZ ANSI_REP_RLP ; It's the end? No? Repeat! JP PrintText_RLP ANSI_ED: ; ANSI Erase in display LD A,B OR A JR Z,ANSI_ED_ED0 ; Default is delete from current position on LD A,(Parameters_PRM+0) CP 0 JR Z,ANSI_ED_ED0 CP 1 JR Z,ANSI_ED_ED1 CP 2 JR Z,ANSI_ED_ED2 ANSI_ED_ED0: JP V9938_ErDis0 ANSI_ED_ED1: JP V9938_ErDis1 ANSI_ED_ED2: CALL ANSI_ED_ED2Sub LD HL,(EndAddress) JP PrintText_RLP ANSI_ED_ED2Sub: CALL V9938_ClearScreen ; Usually should end-up here, but MS-DOS ANSI_SYS legacy place cursor on top left after ED ; Norm is cursor should be where it was, but, no one follows it, thanks to MS :D XOR A LD (CursorRow),A LD (CursorCol),A CALL V9938_SetCursorX CALL V9938_SetCursorY RET ANSI_EL: ; ANSI Erase in Line LD A,B OR A JP Z,V9938_ErLin0 LD A,(Parameters_PRM+0) CP 1 JP Z,V9938_ErLin1 CP 2 JP Z,V9938_ErLin2 JP V9938_ErLin0 ANSI_IL: LD A,B LD B,1 ; No number is one Row OR A JR Z,ANSI_IL_RUN LD A,(Parameters_PRM) ; Read how many Rows LD B,A ANSI_IL_RUN: LD A,(CursorRow) LD C,A ; Copy Origin C (CursorRow) ADD A,B CP 25 JR C,ANSI_IL_CONTINUE ; If less than 25, mean we need to move data before inserting lines ; If number of lines to move reach the end of screen or more, set cursor to first column and Erase Display 0, then return cursor, it is faster LD A,(CursorCol) PUSH AF ; Save current Cursor Column XOR A LD (CursorCol),A ; For now in first column CALL V9938_ErDis0Sub ; Make ED0 POP AF ; Restore column LD (CursorCol),A ; Back to the right column JP ANSI_IL_END ; And done ANSI_IL_CONTINUE: ; Ok, so we will need to move, delete and clear PUSH BC ; Save B (how many rows) LD B,A ; Copy Destination B LD A,25 ; (CursorRow + Rows) SUB B ; RowsToCopy in A ; (25 - Destination Row) CALL V9938_CopyBlockYUp POP BC ; Load How many Rows LD C,B ; Put Rows in C LD B,0 ; Indicates to use background color LD A,(CursorRow) ; From current cursor row CALL V9938_ClearBlock ANSI_IL_END: LD HL,(EndAddress) JP PrintText_RLP ANSI_DL: ; ANSI Delete Lines LD A,B LD B,1 ; No number is one Row OR A JR Z,ANSI_DL_RUN LD A,(Parameters_PRM) ; Read how many Rows LD B,A ANSI_DL_RUN: LD A,(CursorRow) LD C,A ; CopyDestination C (CursorRow) ADD A,B CP 25 JR C,ANSI_DL_CONTINUE ; If number of lines to move cursor to first column and Erase Display 0, then return cursor LD A,(CursorCol) PUSH AF ; Save current Cursor Column XOR A LD (CursorCol),A ; For now in first column CALL V9938_ErDis0Sub ; Make ED0 POP AF ; Restore column LD (CursorCol),A ; Back to the right column JP ANSI_DL_END ; And done ANSI_DL_CONTINUE: ; Ok, so we will need to move, delete and clear PUSH BC ; Save B (how many rows) LD B,A ; Copy Source B LD A,26 ; (CursorRow + Rows) SUB B ; RowsToCopy A ; (26 - CopySource) CALL V9938_CopyBlockYDown POP BC ; Load How many Rows LD A,25 SUB B ; Clear from the End Of Screen LD C,B ; Put Rows in C LD B,0 ; Indicates to use background color CALL V9938_ClearBlock ANSI_DL_END: LD HL,(EndAddress) JP PrintText_RLP ANSI_CHT: ; ANSI Horizontal Tab LD A,B LD B,1 ; No number is one Tab OR A JR Z,ANSI_CHT_RLP LD A,(Parameters_PRM) LD B,A ; Load the number of repeats ANSI_CHT_RLP: PUSH BC PUSH HL CALL HTabSub POP HL POP BC DJNZ ANSI_CHT_RLP ; It's the end? No? Repeat! JP PrintText_RLP ANSI_CBT: ; ANSI Cursor Backwards Tabulation LD A,B LD B,1 ; No number is one Tab OR A JR Z,ANSI_CBT_RLP LD A,(Parameters_PRM) LD B,A ; Load the number of repeats ANSI_CBT_RLP: PUSH BC PUSH HL CALL CBTabSub POP HL POP BC DJNZ ANSI_CBT_RLP ; It's the end? No? Repeat! JP PrintText_RLP ANSI_ECH: ; ANSI Erase Character LD A,B LD C,1 ; No parameter means erase one character OR A JR Z,ANSI_ECH_DO ; No parameter, no need to calculate, just do it LD A,(CursorCol) LD C,A ; Cursor Position in C LD A,(Parameters_PRM) ; How many chars to delete in A ADD C ; CP 80 ; Let's check if it is lower than 80 (meaning is within our line) JR C,ANSI_ECH_SLP ; If carry, ok, within, so no need to adjust value LD A,80 ; Otherwise let's just say it is 80 to adjust value ANSI_ECH_SLP: SUB C ; Subtract cursor position, this will be original B or what would be the chars up to the 80th character to keep it in the same line LD C,A ; Characters to be erased in C ANSI_ECH_DO: JP V9938_ErChar0 ; Erase those characters ANSI_ICH: ; ANSI Insert Characters LD A,B LD C,1 ; No number is one char inserted OR A JR Z,ANSI_ICH_RLP LD A,(Parameters_PRM) LD C,A ANSI_ICH_RLP: JP V9938_InsertChars ANSI_SD: ; ANSI Scroll Down LD A,B LD B,1 ; No number is one line scroll OR A JR Z,ANSI_SD_RLP LD A,(Parameters_PRM) LD B,A ; Load the number of lines to scroll ANSI_SD_RLP: PUSH BC CALL V9938_ScrollDown POP BC DJNZ ANSI_SD_RLP ; It's the end? No? Repeat! LD HL,(EndAddress) JP PrintText_RLP ANSI_SU: ; ANSI Scroll Up LD A,B LD B,1 ; No number is one line scroll OR A JR Z,ANSI_SU_RLP LD A,(Parameters_PRM) LD B,A ; Load the number of lines to scroll ANSI_SU_RLP: PUSH BC CALL V9938_ScrollUp POP BC DJNZ ANSI_SU_RLP ; It's the end? No? Repeat! LD HL,(EndAddress) JP PrintText_RLP ANSI_SGR: ; ANSI Set Graphics Rendition LD A,B OR A LD DE,Parameters_PRM ; OPJ: Zero parameters -> Reset attributes, JR NZ,ANSI_SGR_RLP LD (DE),A LD B,0x01 ANSI_SGR_RLP: PUSH BC LD A,(DE) INC DE OR A JR Z,ANSI_SGR_RES ; RESET ATTRIBUTES CP 1 JR Z,ANSI_SGR_BLD ; SET FONT TO BOLD CP 7 JR Z,ANSI_SGR_REV ; REVERSE COLORS CP 8 JR Z,ANSI_SGR_CON ; CONCEALED (INVISIBLE) CP 27 JR Z,ANSI_SGR_URV ; UN-REVERSE COLORS CP 30 JR C,ANSI_SGR_UNK ; UNKNOWN / UNSUPPORTED CP 38 JR C,ANSI_SGR_SFC ; SET FOREGROUND COLOR CP 39 JR Z,ANSI_SGR_RFC ; RESET FOREGROUND COLOR CP 40 JR C,ANSI_SGR_UNK ; UNKNOWN / UNSUPPORTED CP 48 JR C,ANSI_SGR_SBC ; SET BACKGROUND COLOR CP 49 JR Z,ANSI_SGR_RBC ; RESET BACKGROUND COLOR ANSI_SGR_UNK: POP BC DJNZ ANSI_SGR_RLP ANSI_SGR_RET: LD HL,(EndAddress) JP PrintText_RLP ANSI_SGR_RES: ; RESET ATTRIBUTES ; PK: Reset text attributes, they ; are: ; 1 Bold ; 4 Underscore ; 5 Blink on ; 7 Reverse Video on ; 8 Concealed on ; By now, this library supports ; BOLD, CONCEALED and REVERSE XOR A LD (HiLighted),A LD (Reversed),A LD (Concealed),A ; PK: Some softwares expects that ; reset restore the text and ; background colors to a sane ; default LD (BackColor),A LD A,0x07 LD (ForeColor),A JR ANSI_SGR_CLR ANSI_SGR_BLD: LD A,0x01 LD (HiLighted),A JR ANSI_SGR_CLR ANSI_SGR_REV: LD A,(Reversed) OR A JR NZ,ANSI_SGR_CLR LD A,0x01 LD (Reversed),A JR ANSI_SGR_SWP ANSI_SGR_CON: LD A,0x01 LD (Concealed),A JR ANSI_SGR_CLR ANSI_SGR_URV: LD A,(Reversed) OR A JR Z,ANSI_SGR_CLR XOR A LD (Reversed),A JR ANSI_SGR_SWP ANSI_SGR_RFC: LD A,37 ANSI_SGR_SFC: SUB 30 LD (ForeColor),A JR ANSI_SGR_CLR ANSI_SGR_RBC: LD A,40 ANSI_SGR_SBC: SUB 40 LD (BackColor),A JR ANSI_SGR_CLR ANSI_SGR_CLR: CALL V9938_SetColors JR ANSI_SGR_UNK ANSI_SGR_SWP: LD A,(ForeColor) LD B,A LD A,(BackColor) LD (ForeColor),A LD A,B LD (BackColor),A JR ANSI_SGR_CLR VT52_ENCURSOR: LD A,(CursorOn) OR A RET NZ ; If already on, nothing to do INC A LD (CursorOn),A ; Other than 0, on LD (CursorUpdt),A ; Other than 0, update its position EnCursorSub: DI LD A,(VDP_08) ; Get a copy of register 8 AND 0b11111101 ; Clear bit to enable sprites LD (VDP_08),A ; Save our value OUT (0x99),A ; Send value to VDP LD A,0x80+8 OUT (0x99),A ; Write to register 8 EI RET VT52_DISCURSOR: LD A,(CursorOn) OR A RET Z ; If already off, nothing to do XOR A LD (CursorOn),A ; 0, off LD (CursorUpdt),A ; 0, do not update its position DisCursorSub: DI LD A,(VDP_08) ; Get a copy of register 8 OR 0b00000010 ; Set bit to disable sprites LD (VDP_08),A ; Save our value OUT (0x99),A ; Send value to VDP LD A,0x80+8 OUT (0x99),A ; Write to register 8 EI RET VT52_UP: LD A,(CursorRow) OR A JP Z,PrintText_RLP DEC A LD (CursorRow),A CALL V9938_SetCursorY JP PrintText_RLP VT52_DW: LD A,(CursorRow) CP 24 JP NC,PrintText_RLP INC A LD (CursorRow),A CALL V9938_SetCursorY JP PrintText_RLP VT52_LE: LD A,(CursorCol) OR A JP Z,PrintText_RLP DEC A LD (CursorCol),A CALL V9938_SetCursorX JP PrintText_RLP VT52_RI: LD A,(CursorCol) CP 79 JP NC,PrintText_RLP INC A LD (CursorCol),A CALL V9938_SetCursorX JP PrintText_RLP VT52_HOME: XOR A LD (CursorCol),A LD (CursorRow),A CALL V9938_SetCursorX CALL V9938_SetCursorY JP PrintText_RLP VT100_SCP: LD (EndAddress),HL JP ANSI_SCP VT100_RCP: LD (EndAddress),HL JP ANSI_RCP BackSpace: CALL BackSpaceSub JP PrintText_RLP BackSpaceSub: LD A,(CursorCol) OR A RET Z DEC A LD (CursorCol),A JP V9938_SetCursorX HorizontalTab: CALL HTabSub LD HL,(EndAddress) JP PrintText_RLP HTabSub: LD A,(CursorCol) ; Get the current column OR 7 ; Goes to the next tabstop ; Tabstops traditionally are ; in each 8th column CP 79 JP Z,HTabSub_SCP INC A ; Some adjusts here and there... HTabSub_SCP: LD (CursorCol),A CALL V9938_SetCursorX RET CBTabSub: LD A,(CursorCol) ; Get the current column DEC A AND 248 ; Goes to the previous tabstop ; Tabstops traditionally were ; in each 8th column CP 248 JP NZ,CBTabSub_SCP XOR A ; Positions belows 0 are 0 CBTabSub_SCP: JR HTabSub_SCP LineFeed: CALL LFeedSub JP PrintText_RLP LFeedSub: LD A,(CursorRow) INC A CP 25 JR C,LFeedSub_NNL CALL V9938_ScrollUp LD A,24 LFeedSub_NNL: LD (CursorRow),A CALL V9938_SetCursorX CALL V9938_SetCursorY RET CarriageReturn: CALL CarriageReturnSub; JP PrintText_RLP CarriageReturnSub: XOR A LD (CursorCol),A JP V9938_SetCursorX _BIOS_C: ; BIOS_C: [IX] LD IY,(0xFCC0) JP 0x001C ; ; V9938 Related Code ; ; This is where all V9938 (MSX2/2+) specific routines and defines are ; VDP_07 EQU 0xF3E6 VDP_08 EQU 0xFFE7 VDP_09 EQU 0xFFE8 VDP_23 EQU 0xFFF6 VDP_01 EQU 0xF3E0 VDP_06 EQU 0xF3E5 VDP_05 EQU 0xF3E4 VDP_11 EQU 0xFFEA VDP_14 EQU 0xFFED VDP_16 EQU 0xFFEF ; SUB-ROM entries ; iniPlt EQU 0x0141 rstPlt EQU 0x0145 ; CALSUB ; ; In: IX = address of routine in MSX2 SUBROM ; AF, HL, DE, BC = parameters for the routine ; ; Out: AF, HL, DE, BC = depending on the routine ; ; Changes: IX, IY, AF', BC', DE', HL' ; ; Call MSX2 subrom from MSXDOS. Should work with all versions of MSXDOS_ ; ; Notice: NMI hook will be changed. This should pose no problem as NMI is ; not supported on the MSX at all_ ; CALSLT EQU 0x001C NMI EQU 0x0066 EXTROM EQU 0x015F EXPTBL EQU 0xFCC1 H_NMI EQU 0xFDD6 ; CALSUB: EXX EX AF,AF' ; store all registers LD HL,EXTROM PUSH HL LD HL,0xC300 PUSH HL ; push NOP ; JP EXTROM PUSH IX LD HL,0x21DD PUSH HL ; push LD IX,<entry> LD HL,0x3333 PUSH HL ; push INC SP; INC SP LD HL,0 ADD HL,SP ; HL = offset of routine LD A,0xC3 LD (H_NMI),A LD (H_NMI+1),HL ; JP <routine> in NMI hook EX AF,AF' EXX ; restore all registers LD IX,NMI LD IY,(EXPTBL-1) CALL CALSLT ; call NMI-hook via NMI entry in ROMBIOS ; NMI-hook will call SUBROM EXX EX AF,AF' ; store all returned registers LD HL,10 ADD HL,SP LD SP,HL ; remove routine from stack EX AF,AF' EXX ; restore all returned registers RET V9938_Init: LD A,0x07 LD IX,0x005F CALL _BIOS_C ; Interslot call to set screen 7 ; Now let's set a lot of registers :) LD A,0x00 LD (VDP_23),A ; R23, first line to draw is 0 DI LD A,0xF0 ; Text1 and Text2 color 15, Border and Background color 0 LD (VDP_07),A ; R7 status OUT (0x99),A LD A,0x80+7 OUT (0x99),A ; Write to register 7 LD A,(VDP_08) ; Get a copy of register 8 OR 0b00100010 ; Set bit so color 0 is 0 in palette and disable sprites LD (VDP_08),A ; Save our value OUT (0x99),A ; Send value to VDP LD A,0x80+8 OUT (0x99),A ; Write to register 8 LD A,(VDP_09) ; Get a copy of register 9 OR 0b10000000 ; 212 Lines by seting 8th bit LD (VDP_09),A ; Save our new value OUT (0x99),A ; Send value to VDP LD A,0x80+9 OUT (0x99),A ; Write to register 9 LD A,0x00 ; Palette register pointer set to 0 LD (VDP_16),A ; Save R16 status OUT (0x99),A ; Send value to VDP LD A,0x80+16 OUT (0x99),A ; Write to register 16, new palette pointer EI ; Ok to have interrupts now LD HL,ANSI_PAL ; Address of our palette LD BC,0x209A ; 32 bytes to move to port 0x9a which will auto-increment palette registers OTIR ; Send it RET ; Done! V9938_Finish: DI LD A,0x00 OUT (0x99),A LD A,0x80+23 OUT (0x99),A ; Register 23 goes to 0 to reset vertical offset LD (VDP_23),A ; R23, first line to draw is 0 LD IX,0xD2 LD IY,(0xFCC0) ; Call TOTEXT bios function CALL CALSLT EI LD IX,iniPlt CALL CALSUB LD IX,rstPlt ; Restore the saved palette CALL CALSUB EI RET ; Done! ;OPJ - Sprite Cursor initialization V9938_InitCursor: DI ; First Set Pattern Table Address LD A,0b00111111 ; sprite pattern table = 1F800-1FFFF LD (VDP_06),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+6 OUT (0x99),A ; Write in register ; Now Set Sprite Attribute Table Address LD A,0b11101111 ; sprite attribute table = 1F600 / So Color Table will be 1F400 (14 - 10 and 3 1s) LD (VDP_05),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+5 OUT (0x99),A ; Write in register LD A,0b00000011 ; A16 - 1 And A15 - 1 LD (VDP_11),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+11 OUT (0x99),A ; Write in register ;SET VDP TO WRITE @ Color Table starting at Sprite 0 (1F400) LD A,0b00000111 ; A16, A15 and A14 set to 1 LD (VDP_14),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000000 ; Now A7 to A0, all 0's OUT (0x99),A ; Low Address LD A,0b01110100 ; Write (bit 6), A13/A12 to 1(1F) / A11 to 0 and A10 to 1 and A9-A8 to 0 (4) OUT (0x99),A ; High Address ;Colors for 2 sprites is 32 bytes long LD HL,SPRITE_COLORS LD BC,0x2098 V9938_InitCursor_COLRLOOP: OUTI NOP NOP JR NZ,V9938_InitCursor_COLRLOOP ;SET VDP TO WRITE @ Pattern Table starting at Sprite 0 (1F800) LD A,0b00000111 ; A16/15/14 set to 1 LD (VDP_14),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000000 ; Now A7 to A0, all 0's OUT (0x99),A ; Low Address LD A,0b01111000 ; Write (bit 6), A12 1 OUT (0x99),A ; High Address ;Patterns for 2 sprites is 16 bytes long LD HL,PATTERN_CURSOR LD BC,0x1098 V9938_InitCursor_PATRNLOOP: OUTI NOP NOP JR NZ,V9938_InitCursor_PATRNLOOP ;SET VDP TO WRITE @ Attribute Table starting at Sprite 0 (1F600) LD A,0b00000111 ; A16, A15 and A14 set to 1 LD (VDP_14),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000000 ; Now A7 to A0, all 0's OUT (0x99),A ; Low Address LD A,0b01110110 ; Write (bit 6), A13/A12 to 1(1F) / A11 to 0 and A10/A9 to 1 and A8 to 0 (6) OUT (0x99),A ; High Address ;Attributes for 2 sprites is 8 bytes long LD HL,SPRITE_TABLE LD BC,0x0898 V9938_InitCursor_ATTRLOOP: OUTI NOP NOP JR NZ,V9938_InitCursor_ATTRLOOP ; Done with setting DI LD A,(VDP_08) ; Get a copy of register 8 AND 0b11111101 ; Enable Sprites (cursor) LD (VDP_08),A ; Save our value OUT (0x99),A ; Send value to VDP LD A,0x80+8 OUT (0x99),A ; Write to register 8 EI LD (CursorOn),A ; Other than 0, on LD (CursorUpdt),A ; Other than 0, update it's position RET V9938_CursorColor: ;SET VDP TO WRITE @ Color Table starting at Sprite 0 Line 6 (1F405) LD A,0b00000111 ; A16, A15 and A14 set to 1 DI LD (VDP_14),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000101 ; Now A7 to A0 OUT (0x99),A ; Low Address LD A,0b01110100 ; Write (bit 6), A13/A12 to 1(1F) / A11 to 0 and A10 to 1 and A9-A8 to 0 (4) OUT (0x99),A ; High Address LD A,(HiLighted) OR A LD A,(ForeColor) JR Z,V9938_CursorColor_NHA ADD 0x08 V9938_CursorColor_NHA: OR 0x20 ; Color attribute LD B,2 V9938_CursorColor_CCLRLOOP: ;Update 1st line OUT (0x98),A NOP NOP DJNZ V9938_CursorColor_CCLRLOOP EI RET V9938_PrintChar: LD B,A LD A,(Concealed) OR A JR NZ,V9938_PrintChar_SPC ; Concealed = not visible -> space LD A,B CP 0x20 JR Z,V9938_PrintChar_SPC ; Space -> just blank / background color CP 0xDB JR Z,V9938_PrintChar_FIL ; Fill -> just filled / foreground color LD DE,FontData ; Otherwise, let's get from our font LD L,A LD H,0 ; Character in HL ADD HL,HL ADD HL,HL ADD HL,HL ; Each caracter is composed of 8 bytes, thus multiply by 8 ADD HL,DE ; Add to font table start address and we got our character LD DE,ColorTable ; Color Table address in DE LD A,(HL) ; First line of this character in A AND 0b11000000 ; Dealing with the 8th and 7th bits, we are going to print every two pixels, left to right RLCA RLCA ADD A,ColorTable & 255 ; Ok, so this is the base of color table (back/back, back/fore, fore/back, fore/fore) depending on each pixel LD E,A ; move it to E LD A,(DE) ; And A has the result of the two pixels LD (HMMC_CMD_CLR),A ; Move it to HMMC color pair (the first two pixels of HMMC operation) CALL DO_HMMC ; Move this to VDP LD BC,0x089B ; now going to do for the remaining 7 bytes JR V9938_PrintChar_BP1 V9938_PrintChar_BP0: LD A,(HL) AND 0b11000000 ; Dealing with the 8th and 7th bits, we are going to print every two pixels, left to right RLCA RLCA ADD A,ColorTable & 255 ; Ok, so this is the base of color table (back/back, back/fore, fore/back, fore/fore) depending on each pixel LD E,A ; move it to E LD A,(DE) ; And A has the result of the two pixels OUT (C),A ; Send it V9938_PrintChar_BP1: LD A,(HL) AND 0b00110000 ; Now we are dealing with the 5th and 6th bits RRCA RRCA RRCA RRCA ADD A,ColorTable & 255 ; Ok, so this is the base of color table (back/back, back/fore, fore/back, fore/fore) depending on each pixel LD E,A ; move it to E LD A,(DE) ; And A has the result of the two pixels OUT (C),A ; Send it V9938_PrintChar_BP2: LD A,(HL) AND 0b00001100 ; Now we are dealing with the 3rd and 4th bits RRCA RRCA ADD A,ColorTable & 255 ; Ok, so this is the base of color table (back/back, back/fore, fore/back, fore/fore) depending on each pixel LD E,A ; move it to E LD A,(DE) ; And A has the result of the two pixels OUT (C),A ; Send it (characters are contained in bits 8 to 3 (including), bits 1 and 2 are not used, 6 bits wide font V9938_PrintChar_RLP: INC HL ; Next row of pixels for this character DJNZ V9938_PrintChar_BP0 ; If not fineshed, let's start for the next row of pixels (B has the count) RET ; Otherwise, finished printing all 8 rows V9938_PrintChar_SPC: LD A,(ColorTable+0) LD (HMMC_CMD_CLR),A ; Space is background and background CALL DO_HMMC ; setup HMMC and do the first two pixels LD A,(ColorTable+0) ; Again, background on background V9938_PrintChar_OUT: LD BC,0x179B ; 8*3 (double pixels) = 24, lets do the reamaining 23 V9938_PrintChar_SPL: OUT (C),A ; Send it DJNZ V9938_PrintChar_SPL ; Decrement counter, if not zero, do it again RET ; Done V9938_PrintChar_FIL: LD A,(ColorTable+3) LD (HMMC_CMD_CLR),A ; Fill is foreground and foreground CALL DO_HMMC ; setup HMMC and do the first two pixels LD A,(ColorTable+3) ; Again foreground and foreground JR V9938_PrintChar_OUT ; Repeat the remaining pixels V9938_ScrollUp: PUSH HL LD A,25 LD B,0 ;Indicates to use background color CALL V9938_ClearLine ; OPJ - To avoid previous lines to show in the bottom when rolling multiple lines LD B,1 ;Indicates to use border color CALL V9938_ClearTop POP HL LD A,(VDP_23) ADD 0x08 LD (VDP_23),A DI OUT (0x99),A LD A,0x80+23 OUT (0x99),A EI RET V9938_ScrollDown: PUSH HL LD A,24 LD B,1 ;Indicates to use border color CALL V9938_ClearLine POP HL LD A,(VDP_23) SUB 0x08 LD (VDP_23),A DI OUT (0x99),A LD A,0x80+23 OUT (0x99),A EI ; Make sure the first line now has the correct color attribute LD B,0 ;Indicates to use background color CALL V9938_ClearTop RET V9938_SetCursorX: LD A,(CursorCol) LD B,A ADD A,A ADD A,B ADD A,8 ; Border offset 16 pixels LD (SPRITEPOS_X),A ADD A,A ; HMMC work with real pixel count, not double pixels LD (HMMC_CMD_DXL),A LD A,0 ; Do not want to change carry JR NC,V9938_SetCursorX_SETDXH INC A ; If carry it is 1 V9938_SetCursorX_SETDXH: LD (HMMC_CMD_DXH),A LD A,(CursorUpdt) ; If cursor is being updated, update its position in the table OR A RET Z ;SET VDP TO WRITE @ 0x1F601 - Attribute Table LD A,0b00000111 ; A16, A15 and A14 set to 1 LD (VDP_14),A ; Save our value DI OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000001 ; Now A7 to A0, all 0's OUT (0x99),A ; Low Address LD A,0b01110110 ; Write (bit 6), A13/A12 to 1(1F) / A11 to 0 and A10/A9 to 1 and A8 to 0 (6) OUT (0x99),A ; High Address ; X Position LD A,(SPRITEPOS_X) OUT (0x98),A ; Set X EI RET V9938_SetCursorY: LD A,(CursorRow) ADD A,A ADD A,A ADD A,A LD B,A ; Copy IYL to B LD A,(VDP_23) ; Get current vertical offset ADD A,B ; Add our IYL to it LD (HMMC_CMD_DYL),A LD A,(CursorUpdt) ; If cursor is being updated, update its position in the table OR A RET Z ;SET VDP TO WRITE @ 0x1F600 - Attribute Table LD A,0b00000111 ; A16, A15 and A14 set to 1 LD (VDP_14),A ; Save our value DI OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000000 ; Now A7 to A0, all 0's OUT (0x99),A ; Low Address LD A,0b01110110 ; Write (bit 6), A13/A12 to 1(1F) / A11 to 0 and A10/A9 to 1 and A8 to 0 (6) OUT (0x99),A ; High Address ; Y Position LD A,(HMMC_CMD_DYL) LD B,A ; Copy IYL to B OUT (0x98),A ; Set Y EI RET V9938_ClearLine: LD C,1 V9938_ClearBlock: ; ; A <- SourceRow ; B <- 0 fill w/ back color otherwise fill w/ border color ; C <- Rows ; ADD A,A ADD A,A ADD A,A LD (HMMV_CMD_DYL),A ; Number of lines * 8 = position of the last line LD A,C ADD A,A ADD A,A ADD A,A LD (HMMV_CMD_NYL),A ; Will paint a rectangle with C*8 pixels on the Y axys XOR A LD (HMMV_CMD_DXL),A LD A,0xE0 LD (HMMV_CMD_NXL),A LD A,0x01 LD (HMMV_CMD_NXH),A ; The rectangle is 480 pixels on the X axis LD A,B OR A LD A,(BackColor) JR Z,V9938_ClearBlock_Cont LD A,(BorderColor) V9938_ClearBlock_Cont: LD (ClearColor),A ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(ClearColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle JP DO_HMMV ; OPJ - To avoid previous lines to show in the bottom when rolling multiple lines V9938_ClearTop: XOR A LD (HMMV_CMD_DYL),A ; position of the first line LD A,0x08 LD (HMMV_CMD_NYL),A ; Will paint a rectangle with 8 pixels on the Y axys XOR A LD (HMMV_CMD_DXL),A LD A,0xE0 LD (HMMV_CMD_NXL),A LD A,0x01 LD (HMMV_CMD_NXH),A ; The rectangle is 480 pixels on the X axis LD A,B OR A LD A,(BackColor) JR Z,V9938_ClearTop_Cont LD A,(BorderColor) V9938_ClearTop_Cont: LD (ClearColor),A ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(ClearColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle JP DO_HMMV V9938_ClearScreen: CALL V9938_WaitCmd ; Make sure VDP is not processing any command DI ;OPJ - Set border color same as back color LD A,(BackColor) ; Text1 and Text2 color 15, Border and Background color 0 LD (BorderColor),A ; Save the new border color LD (VDP_07),A OUT (0x99),A LD A,0x80+7 OUT (0x99),A ; Write to register 7 ;OPJ - End LD A,0x24 OUT (0x99),A LD A,0x91 OUT (0x99),A ; Indirect access to registers, starting at 36 EI LD C,0x9B ;Now indirect writes starting at register 36 XOR A OUT (C),A ; DXL = 0 NOP OUT (C),A ; DXH = 0 NOP OUT (C),A ; DYL = 0 NOP OUT (C),A ; DYH = 0 NOP OUT (C),A ; NXL = 0 LD A,0x02 OUT (C),A ; NXH = 2 (512 dots) XOR A OUT (C),A ; NYL = 0 INC A OUT (C),A ; NYH = 1 (256 dots) LD A,(BackColor) ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(BackColor) OR B OUT (C),A ; CLR LD A,0x00 OUT (C),A ; ARG LD A,0xC0 OUT (C),A ; CMD RET V9938_InsertChars: ; Number of characters to insert in C LD A,(CursorCol) ; LD B,A ; Cursor column in B ADD A,C ; Lets Check if cursor pos + inserted characters equals or exceed a line limit CP 79 ; So, if 79 (80 columns) or less, will carry JP NC,V9938_ErLin0 ; If no carry, no need to move blocks, we can just use a line deletion that will be way faster ; If here cursor pos + inserted characters less than a line, so we need to do the following: ; - Calculate the size of the block to move (End of screen - (Cursor Position + Inserted Chars)) ; - Move the block (it should be a move to the left, from right edge - inserted chars ; - Erase of Inserted Chars beginning in the cursor position LD A,79 SUB A,B ; Ok, how many characters do we have including the one in cursor? SUB A,C ; And this is how many characters we need to move to cursor position + inserted chars INC A LD B,A ; B contains character width of block being moved ADD A,A ADD A,B ; Multiply it by 3, number of "double pixels" (6 pixel width, 3 double pixels width) ADD A,A ; And now double it to adjust, length is in pixels LD (HMMM_CMD_NXL),A ; Store as NX lower byte LD A,0x00 ; Probably will be 0 NX higher byte JR NC,V9938_InsChr_NXH ; But if carry, means it is 1 INC A ; If carry, NXh is 1 V9938_InsChr_NXH: LD (HMMM_CMD_NXH),A ; Store it LD A,0x08 LD (HMMM_CMD_NYL),A ; A line has 8 pixels, so NYL is 8 ; No need to change NYH, always 0 LD A,C ADD A,A ADD A,C LD D,A ; Number of chars to insert *3 in D LD A,0xEE ; Rightmost edge in pixels is 0x01DE LD (HMMM_CMD_DXL),A ; Now destination is rightmost edge LD A,0x01 ; Rightmost edge in pixels is 0x01DE LD (HMMM_CMD_DXH),A ; Now destination is rightmost edge LD A,247 ; Rightmost edge in double pixels 239 + 8 pixels from the border = 247 SUB A,D ; This is our source, rightmost edge - number of chars to insert ADD A,A ; Multiply by 2 LD (HMMM_CMD_SXL),A ; Save source LD A,0x00 ; XH could be 0 JR NC,V9938_InsChr_SXH ; If no carry, it is 0 INC A ; Otherwise it is 1 V9938_InsChr_SXH: LD (HMMM_CMD_SXH),A ; Save XH LD A,(CursorRow) ; Current cursor line ADD A,A ADD A,A ADD A,A ; Multiply it by 8, it is the first line of that character line (8 pixels high character) LD B,A ; Copy Y to B LD A,(VDP_23) ; Get current vertical offset ADD A,B ; Add our Y to it LD (HMMM_CMD_DYL),A ; This is the Y destination LD (HMMM_CMD_SYL),A ; As well as the Y source LD A,0x04 ; We need the direction of move to be to the left, otherwise it won't work properly LD (HMMM_CMD_ARG),A ; PUSH BC ; Save Number of chars to insert CALL DO_HMMM ; All set, let's move POP BC ; Restore Number of chars to insert ; Number of chars to erase (where characters will be inserted) is in C, ErChar will do the rest and return JP V9938_ErChar0 ; Observing Windows 10 terminal behavior as well as XTERM, Del Char only deletes characters in the same line ; Lines below are left untouched even if of chars to delete surpass the of chars in the line, and it does ; not shift lines below up_ V9938_DelChr: LD C,A ; Number of characters to delete in C LD A,(CursorCol) ; LD B,A ; Cursor column in B ADD A,C ; Lets Check if cursor pos + deleted characters equals or exceed a line limit CP 79 ; So, if 78 (79 columns) or less, will carry JP NC,V9938_ErLin0 ; If no carry, no need to move blocks, we can just use a line deletion that will be way faster ; If here cursor pos + deleted characters less than a line, so we need to do the following: ; - Calculate the size of the block to move (End of screen - (Cursor Position + Deleted Chars)) ; - Move the block ; - Erase of Deleted Chars after the end of the block LD A,80 SUB A,B ; Ok, how many characters do we have including the one in cursor? SUB A,C ; And this is how many characters we need to copy to cursor position INC A ; PUSH AF ; Save this, we will use it later to delete characters by fake positioning cursor @ cursor pos + moved characters +1 and deleting from there to the end of line :) LD B,A ; B contains character width of block being moved ADD A,A ADD A,B ; Multiply it by 3, number of "double pixels" (6 pixel width, 3 double pixels width) ADD A,A ; And now double it to adjust lsb not considered LD (HMMM_CMD_NXL),A ; Store as NX lower byte LD A,0x00 ; Probably will be 0 NX higher byte LD (HMMM_CMD_ARG),A ; Take this chance to load CMD ARG we need for this operation (00) JR NC,V9938_DelChr_NXH ; But if carry, means it is 1 INC A ; If carry, NXh is 1 V9938_DelChr_NXH: LD (HMMM_CMD_NXH),A ; Store it LD A,0x08 LD (HMMM_CMD_NYL),A ; No need to change NYH, always 0 LD A,(CursorCol) LD B,A ADD A,A ADD A,B ; Just adjust to count of "double pixels", HMMM function will handle DXH and shifting it LD D,A ; Save A in D ADD 0x08 ; Add 8 to X (A) - Border of 16 pixels ADD A,A ; Multiply by 2 LD (HMMM_CMD_DXL),A ; Destination is current cursor position LD A,0x00 ; XH could be 0 JR NC,V9938_DelChr_DXH ; If no carry, it is 0 INC A ; Otherwise it is 1 V9938_DelChr_DXH: LD (HMMM_CMD_DXH),A ; Save XH LD A,C ; Now source is what is in D + 3 times what is in C ADD A,A ADD A,C ; A contains 3xdeleted characters ADD A,D ; + cursor position, this is the position of source X :D ADD 0x08 ; Add 8 to X (A) - Border of 16 pixels ADD A,A ; Multiply by 2 LD (HMMM_CMD_SXL),A ; Source is current cursor position + deleted characters LD A,0x00 ; XH could be 0 JR NC,V9938_DelChr_SXH ; If no carry, it is 0 INC A ; Otherwise it is 1 V9938_DelChr_SXH: LD (HMMM_CMD_SXH),A ; Save XH LD A,(CursorRow) ; Current cursor line ADD A,A ADD A,A ADD A,A ; Multiply it by 8, it is the first line of that character line (8 pixels high character) LD B,A ; Copy Y to B LD A,(VDP_23) ; Get current vertical offset ADD A,B ; Add our Y to it LD (HMMM_CMD_DYL),A ; This is the Y destination LD (HMMM_CMD_SYL),A ; As well as the Y source CALL DO_HMMM ; All set, let's move POP BC ; What we need to Add to Cursor is restored in B LD A,(CursorCol) ; Current Cursor Column ADD A,B ; Our fake cursor position JP V9938_ErLin0_1 ; Erase Line, but using what is in A, our fake cursor position, and return to processing after done V9938_DelChr_SL: LD HL,(EndAddress) JP PrintText_RLP V9938_ErDis0: CALL V9938_ErDis0Sub LD HL,(EndAddress) JP PrintText_RLP V9938_ErDis0Sub: LD A,(CursorCol) LD B,A ADD A,A ADD A,B LD (HMMV_CMD_DXL),A ; DX = Number of column * 3 (this mode has doubled pixels in X axis) LD B,A LD A,240 ; We draw up to 240 double-pixels (6 pixels wide characters * 80 columns) SUB A,B ; Except the pixels data up to the cursor position ADD A,A ; And now double it LD (HMMV_CMD_NXL),A ; Store as NX lower byte LD A,0x00 ; Probably will be 0 NX higher byte JR NC,V9938_ErDis0_NXH ; But if carry, means it is 1 INC A ; If carry, NXh is 1 V9938_ErDis0_NXH: LD (HMMV_CMD_NXH),A ; Store it LD A,(CursorRow) ; Now get the row / line ADD A,A ; 8 pixels height each character, multiply it per 8 ADD A,A ADD A,A LD (HMMV_CMD_DYL),A ; This is the Y axys start LD A,0x08 LD (HMMV_CMD_NYL),A ; To clear a single line it is 8 pixels height number of dots height LD A,(BackColor) ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(BackColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle CALL DO_HMMV ; Aaaand.... Clear! ; Now, do we need to clear below cursor? LD A,(CursorRow) ; Let's see how many pixels we need to fill LD B,A ; Now get the row / line in B LD A,24 ; Up to 25 lines, 0 is first, 24 is the 25th line SUB A,B ; Let's check how many extra lines need to be cleared RET Z ; If last line, done ; Not last, so multiply it per 8 ADD A,A ADD A,A ADD A,A LD (HMMV_CMD_NYL),A ; To clear remaining lines it is 8 pixels height multiplied by number of lines XOR A LD (HMMV_CMD_DXL),A ; DXL 0 LD A,0xE0 ; We draw 240 double-pixels (6 pixels wide characters * 80 columns), 480 pixels, 0x01E0 LD (HMMV_CMD_NXL),A ; Store as NX lower byte LD A,1 LD (HMMV_CMD_NXH),A ; Store NX higher byte LD A,(CursorRow) ; Now get the row / line INC A ; Next line ADD A,A ; 8 pixels height each character, multiply it per 8 ADD A,A ADD A,A LD (HMMV_CMD_DYL),A ; This is the Y axys start CALL DO_HMMV ; Aaaand.... Clear! RET V9938_ErDis1: XOR A LD (HMMV_CMD_DXL),A ; DX = Beginning of line, 0 LD (HMMV_CMD_DXH),A ; DX = Beginning of line, 0 LD A,(CursorCol) LD B,A ADD A,A ADD A,B ; Column * 6 = X coordinate of current cursor position ADD A,A ; And now double it LD (HMMV_CMD_NXL),A ; Store as NX lower byte LD A,0x00 ; Probably will be 0 NX higher byte JR NC,V9938_ErDis1_NXH ; But if carry, means it is 1 INC A ; If carry, NXh is 1 V9938_ErDis1_NXH: LD (HMMV_CMD_NXH),A ; Store it LD A,(CursorRow) ; Now get the row / line ADD A,A ; 8 pixels height each character, multiply it per 8 ADD A,A ADD A,A LD (HMMV_CMD_DYL),A ; This is the Y axys start LD A,0x08 LD (HMMV_CMD_NYL),A ; To clear a single line it is 8 pixels height number of dots height LD A,(BackColor) ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(BackColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle CALL DO_HMMV ; Aaaand.... Clear! ; Now, do we need to clear above cursor? LD A,(CursorRow) ; Let's see how many pixels we need to fill OR A ; First row/line? JR Z,V9938_ErDis1_SL ; If first line, done ; Not first, so multiply it per 8 ADD A,A ADD A,A ADD A,A LD (HMMV_CMD_NYL),A ; To clear remaining lines it is 8 pixels height multiplied by number of lines - 1 (which is cursor row) XOR A LD (HMMV_CMD_DYL),A ; DYL, DXL ,DXH 0 LD (HMMV_CMD_DXL),A LD (HMMV_CMD_DXH),A LD A,0xE0 ; We draw 240 double-pixels (6 pixels wide characters * 80 columns), 480 pixels, 0x01E0 LD (HMMV_CMD_NXL),A ; Store as NX lower byte LD A,1 LD (HMMV_CMD_NXH),A ; Store NX higher byte CALL DO_HMMV ; Aaaand.... Clear! V9938_ErDis1_SL: LD HL,(EndAddress) JP PrintText_RLP V9938_ErChar0: LD A,(CursorCol) ; Will start from current column LD B,A ADD A,A ADD A,B ; A has column * 3 LD (HMMV_CMD_DXL),A ; Store in the destination X LD A,C ; Characters to delete in C ADD A,A ADD A,C ADD A,A ; And now double it, chars * 6 LD (HMMV_CMD_NXL),A ; This is the number of pixels to erase LD A,0x00 ; High byte could be 0 JR NC,V9938_ErChar0_NXH ; If did not carry, it is INC A ; Otherwise it is 1 V9938_ErChar0_NXH: LD (HMMV_CMD_NXH),A ; High Byte number of pixels to erase LD A,(CursorRow) ; Now calculate destination Y ADD A,A ADD A,A ADD A,A LD (HMMV_CMD_DYL),A ; Row * 8 is the Y position LD A,0x08 LD (HMMV_CMD_NYL),A ; And delete 8 pixels in Y direction, one line LD A,(BackColor) ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(BackColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle CALL DO_HMMV ; And erase this LD HL,(EndAddress) JP PrintText_RLP V9938_ErLin0: LD A,(CursorCol) ; Will start from current column V9938_ErLin0_1: LD B,A ; Cursor column in B ADD A,A ADD A,B ; A has column * 3 LD (HMMV_CMD_DXL),A ; Store in the destination X LD B,A ; Save it in B (this is a value in double pixels) LD A,240 ; 240 double pixels is a line width (80x6) SUB A,B ; Subtract the total width from the current width ADD A,A ; Now this information is need in real pixels, so double it LD (HMMV_CMD_NXL),A ; And this the X axys lenght of the command LD A,0x00 ; High Byte could be 0 JR NC,V9938_ErLin0_NXH ; And it is zero if no carry INC A ; Ok, carry, so it is 1 V9938_ErLin0_NXH: LD (HMMV_CMD_NXH),A ; High Byte of X axys lenght LD A,(CursorRow) ; Now get the current line ADD A,A ADD A,A ADD A,A ; Multiply per 8 as each line is 8 pixelslarge LD (HMMV_CMD_DYL),A ; This is the destination Y LD A,0x08 LD (HMMV_CMD_NYL),A ; a line is 8 pixes, so this the Y axys lenght of the command LD A,(BackColor) ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(BackColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle CALL DO_HMMV ; and perform the HMMV command to delete it LD HL,(EndAddress) JP PrintText_RLP V9938_ErLin1: XOR A LD (HMMV_CMD_DXL),A LD (HMMV_CMD_DXH),A LD A,(CursorCol) LD B,A ADD A,A ADD A,B LD C,0 ADD A,A JR NC,V9938_ErLin1_CNT INC C V9938_ErLin1_CNT: LD (HMMV_CMD_NXL),A LD A,C JP V9938_ErLin0_NXH V9938_ErLin2: LD A,(CursorRow) ; Clear Entire Line LD B,0 ; Background color CALL V9938_ClearLine XOR A LD (CursorCol),A CALL V9938_SetCursorX LD HL,(EndAddress) JP PrintText_RLP V9938_SetColors: LD A,(HiLighted) ; Let's check if HiLighted OR A LD A,(ForeColor) ; And get the foreground color JR Z,V9938_SetColors_NHA ; If not HiLighted, move on ADD 0x08 ; Otherwise, different color, add 8 to get colors 9 to 16 of our pallete V9938_SetColors_NHA: LD B,A ; Ok, palete color index in B ADD A,A ADD A,A ADD A,A ADD A,A ; Multiply by 16 -> Shift left 4 times -> Value in MSB OR B ; And value now in LSB as well, colors are pairs for G6 LD (FontColor),A ; And this is our font color (Fore / Fore) LD A,(BackColor) ; Do the same to background color ADD A,A ADD A,A ADD A,A ADD A,A ; Multiply by 16 -> Shift left 4 times -> Value in MSB LD B,A ; B has background color in MSB and 0 in LSB LD A,(BackColor) ; A has background color in LSB OR B ; And value now in LSB as well, colors are pairs for G6 LD (ColorTable+00),A ; ColorTable 0 -> Background and BackGround LD A,(FontColor) AND 0x0F ; Foreground color on LSB OR B ; Background color on MSB LD (ColorTable+01),A ; Color table 1 ->Background and Foreground LD A,(FontColor) AND 0xF0 ; Foreground color on MSB LD B,A ; Move it to B LD A,(BackColor) ; Background color on LSC OR B LD (ColorTable+02),A ; Color table 2 -> Foreground and Background LD A,(FontColor) LD (ColorTable+03),A ; Color table 3 -> Foreground and Foreground ;OPJ - Sprite Cursor added JP V9938_CursorColor V9938_CopyBlockYUp: ; ; A <- HowManyRows ; B <- DestinationRow ; C <- SourceRow ; ; Not really proud of this code, but gonna do for this moment ; There is a possibility of two splits on YMMM of large blocks, one for destination and other ; for source. When both occur at the same time, YMMM code is not handling it properly. And it ; might take a while until I figure out a sane way to do this, so, for the moment, we do it ; every line, as this guarantees that only one of them will cross boundaries, not beautiful ; but it works PUSH DE ; Save it, we are gonna mess w/ it and not sure if other code depends on it DEC A ; As it is up, we need to adjust source and dest to figure out the last of each one LD D,A ; Save as we are going to re-use it ADD A,B ; A now has the last destination row LD B,A ; and save it back to B LD A,D ; Back with the value in A ADD A,C ; A now has the last source row LD C,A ; and save it back to C LD A,D ; Back wit how many rows - 1 INC A ; How many rows again POP DE ; Restore DE V9938_CopyBlockYUp_1: PUSH AF ; Save registers, those are going to be messed in CopyBlockYUpLine PUSH BC LD A,1 ; We are going to do line per line CALL V9938_CopyBlockYUpLine POP BC ; Restore Dest and Source POP AF ; Restore how many lines DEC A ; Decrease how many lines RET Z ; If no more lines, done DEC B ; Otherwise, next destination line DEC C ; Next source line to copy JP V9938_CopyBlockYUp_1 ; Wash, Rinse and repeat.... :-P V9938_CopyBlockYUpLine: ADD A,A ADD A,A ADD A,A LD (YMMM_CMD_NYL),A ; Will copy a rectangle with A*8 pixels on the Y axis LD D,A ; Save NYL in D DEC D ; Adjust for our math LD A,C ; Get Source Row ADD A,A ADD A,A ADD A,A LD HL,(VDP_23) ; Get current vertical offset ADD A,L ; Add it ADD A,D ; And add how many lines, as we are going from bottom to top, start at the last line LD (YMMM_CMD_SYL),A ; Source Y coordinate LD H,A ; Save SYL in H LD A,B ADD A,A ADD A,A ADD A,A ADD A,L ; Add current vertical offset to it ADD A,D ; And add how many lines, as we are going from bottom to top, start at the last line LD (YMMM_CMD_DYL),A ; To ; There are three possible splits here: ; 1st - SY - NY carry.... Then we have to split in two operations with different SY, DY and NY ; 1st operation will be: SY and DY as is with NY being the NY - remainder after carry ; 2nd operation will be: SY as 0, DY as DY - 1st NY and NY being the remainder after carry ; ; 2nd - DY - NY carry.... Then we have to split in two operations with different SY, DY and NY ; 1st operation will be: SY and DY as is with NY being the NY - remainder after carry ; 2nd operation will be: DY as 0, SY as SY - 1st NY and NY being the remainder after carry ; ; 3rd - 1st and 2nd at the same time.... Then we have to split in three operations with different SY, DY and NY ; First need to figure out which operation will overlap first, DY or NY ; ; 1st operation will be: SY and DY as is with NY being the NY - remainder after carry ; 2nd operation will be: DY as 0, SY as SY - 1st NY and NY being the remainder after carry ; ; Need to test the 1st hypothesis LD A,H ; Source Y coordinate in A SUB A,D ; SY - NY JR C,V9938_CopyBlockYUp_DO1; If Carry, this is split case 1,do it LD A,(YMMM_CMD_DYL) ; DY SUB A,D ; NY - DY ; If Carry, this is split case 2,do it JR C,V9938_CopyBlockYUp_DO2 ; Otherwise, it is a single operation so... LD A,8 LD (YMMM_CMD_ARG),A ; Direction is Up LD (YMMM_CMD_DXL),A ; And this is our X starting source point as well JP DO_YMMM ; Do the single operation and YMMM will return for us V9938_CopyBlockYUp_DO1: ; Here we are, source - number of lines will overflow ; Whatever is in A now is how much SY we need to do the second time LD B,A ; Save this in B for now LD A,D ; NYL in A SUB A,B ; This is our first NYL LD (YMMM_CMD_NYL),A ; First rectangle of split operation LD A,B ; Restore the overflow of lines LD (YMMM_CMD_NYL2),A ; Second rectangle of split operation LD A,8 ; Direction is Up LD (YMMM_CMD_ARG),A LD (YMMM_CMD_DXL),A ; And this is our X starting source point as well CALL DO_YMMM ; Do the first operation XOR A LD (YMMM_CMD_SYL),A ; Second round Source LD A,(YMMM_CMD_NYL) ; of lines of 1st operation in A LD B,A ; Save it in B LD A,(YMMM_CMD_DYL) ; line of 1st operation destination SUB A,B ; Subtract first SYL to it LD (YMMM_CMD_DYL),A ; line of 2nd operation destination LD A,(YMMM_CMD_NYL2) ; Second rectangle of split operation in A OR A ; Check if zero RET Z ; If it is, dones LD (YMMM_CMD_NYL),A ; Save it for next YMMM, so it will be done with DY as 0, SY added w/ of lines already copied and NYL with the remaining lines to copy JP DO_YMMM ; Do the second operation and then done, so return from there V9938_CopyBlockYUp_DO2: ; Here we are, destination - number of lines will overflow ; Whatever is in A now is how much NY we need to do the second time LD B,A ; Save this in B for now LD A,D ; NYL in A SUB A,B ; This is our first NYL LD (YMMM_CMD_NYL),A ; First rectangle of split operation LD A,B ; Restore the overflow of lines LD (YMMM_CMD_NYL2),A ; Second rectangle of split operation LD A,8 ; Direction is Up LD (YMMM_CMD_ARG),A LD (YMMM_CMD_DXL),A ; And this is our X starting source point as well CALL DO_YMMM ; Do the first operation XOR A LD (YMMM_CMD_DYL),A ; Second round To LD A,(YMMM_CMD_NYL) ; of lines of 1st operation in A LD B,A ; Save it in B LD A,(YMMM_CMD_SYL) ; of starting source lines of 1st operation in A SUB A,B ; Subtract both LD (YMMM_CMD_SYL),A ; of starting source lines of 2nd operation LD A,(YMMM_CMD_NYL2) ; Second rectangle of split operation in A OR A ; Check if zero RET Z ; If it is, dones LD (YMMM_CMD_NYL),A ; Save it for next YMMM, so it will be done with DY as 0, SY added w/ of lines already copied and NYL with the remaining lines to copy JP DO_YMMM ; Do the second operation and then done, so return from there V9938_CopyBlockYDown: ; ; A <- HowManyRows ; B <- SourceRow ; C <- DestinationRow ; ; ; Not really proud of this code, but gonna do for this moment ; There is a possibility of two splits on YMMM of large blocks, one for destination and other ; for source. When both occur at the same time, YMMM code is not handling it properly. And it ; might take a while until I figure out a sane way to do this, so, for the moment, we do it ; every line, as this guarantees that only one of them will cross boundaries, not beautiful ; but it works PUSH AF ; Save registers, those are going to be messed in CopyBlockYUpLine PUSH BC LD A,1 ; We are going to do line per line CALL V9938_CopyBlockYDownLine POP BC ; Restore Dest and Source POP AF ; Restore how many lines DEC A ; Decrease how many lines RET Z ; If no more lines, done INC B ; Otherwise, next destination line INC C ; Next source line to copy JP V9938_CopyBlockYDown ; Wash, Rinse and repeat.... :-P V9938_CopyBlockYDownLine: ADD A,A ADD A,A ADD A,A LD (YMMM_CMD_NYL),A ; Will copy a rectangle with A*8 pixels on the Y axis LD D,A ; Save NYL in D LD A,B ADD A,A ADD A,A ADD A,A LD HL,(VDP_23) ; Get current vertical offset ADD A,L ; Add it LD (YMMM_CMD_SYL),A ; Source Y coordinate LD E,A ; Save SYL in E LD A,C ADD A,A ADD A,A ADD A,A ADD A,L ; Add current vertical offset to it LD (YMMM_CMD_DYL),A ; To ; There are two possible splits here: ; 1st - SY + NY carry.... Then we have to split in two operations with different SY, DY and NY ; 1st operation will be: SY and DY as is with NY being the NY - remainder after carry ; 2nd operation will be: SY as 0, DY as DY + 1st NY and NY being the remainder after carry ; ; 2nd - DY + NY carry.... Then we have to split in two operations with different SY, DY and NY ; 1st operation will be: SY and DY as is with NY being the NY - remainder after carry ; 2nd operation will be: DY as 0, SY as SY + 1st NY and NY being the remainder after carry ; Need to test the 1s hypothesis LD A,E ; Source Y coordinate in A ADD A,D ; SY + NY JR C,V9938_CopyBlockYDown_DO1 ; If Carry, this is split case 1,do it LD A,(YMMM_CMD_DYL) ; DY ADD A,D ; NY + DY JR C,V9938_CopyBlockYDown_DO2 ; If Carry, this is split case 2,do it ; Otherwise, it is a single operation so... XOR A LD (YMMM_CMD_ARG),A ; Direction is down LD A,8 ; Skip the first 16 pixels as those do not matter (our border) LD (YMMM_CMD_DXL),A ; And this is our X starting source point JP DO_YMMM ; Do the single operation and YMMM will return for us V9938_CopyBlockYDown_DO1: ; Here we are, source + number of lines will overflow ; Whatever is in A now is how much SY we need to do the second time LD B,A ; Save this in B for now LD A,D ; NYL in A SUB A,B ; This is our first NYL LD (YMMM_CMD_NYL),A ; First rectangle of split operation LD A,B ; Restore the overflow of lines LD (YMMM_CMD_NYL2),A ; Second rectangle of split operation XOR A LD (YMMM_CMD_ARG),A ; Direction is down LD A,8 ; Skip the first 16 pixels as those do not matter (our border) LD (YMMM_CMD_DXL),A ; And this is our X starting source point CALL DO_YMMM ; Do the first operation XOR A LD (YMMM_CMD_SYL),A ; Second round Source LD A,(YMMM_CMD_NYL) ; of lines of 1st operation in A LD B,A ; Save it in B LD A,(YMMM_CMD_DYL) ; line of 1st operation destination ADD A,B ; Add first SYL to it LD (YMMM_CMD_DYL),A ; line of 2nd operation destination LD A,(YMMM_CMD_NYL2) ; Second rectangle of split operation in A OR A ; Check if zero RET Z ; If it is, dones LD (YMMM_CMD_NYL),A ; Save it for next YMMM, so it will be done with DY as 0, SY added w/ of lines already copied and NYL with the remaining lines to copy JP DO_YMMM ; Do the second operation and then done, so return from there V9938_CopyBlockYDown_DO2: ; Here we are, destination + number of lines will overflow ; Whatever is in A now is how much NY we need to do the second time LD B,A ; Save this in B for now LD A,D ; NYL in A SUB A,B ; This is our first NYL LD (YMMM_CMD_NYL),A ; First rectangle of split operation LD A,B ; Restore the overflow of lines LD (YMMM_CMD_NYL2),A ; Second rectangle of split operation XOR A LD (YMMM_CMD_ARG),A ; Direction is down LD A,8 ; Skip the first 16 pixels as those do not matter (our border) LD (YMMM_CMD_DXL),A ; And this is our X starting source point CALL DO_YMMM ; Do the first operation XOR A LD (YMMM_CMD_DYL),A ; Second round To LD A,(YMMM_CMD_NYL) ; of lines of 1st operation in A LD B,A ; Save it in B LD A,(YMMM_CMD_SYL) ; of starting source lines of 1st operation in A ADD A,B ; Add both LD (YMMM_CMD_SYL),A ; of starting source lines of 2nd operation LD A,(YMMM_CMD_NYL2) ; Second rectangle of split operation in A OR A ; Check if zero RET Z ; If it is, dones LD (YMMM_CMD_NYL),A ; Save it for next YMMM, so it will be done with DY as 0, SY added w/ of lines already copied and NYL with the remaining lines to copy JP DO_YMMM ; Do the second operation and then done, so return from there V9938_WaitCmd: LD A,0x02 DI OUT (0x99),A LD A,0x80+15 OUT (0x99),A IN A,(0x99) RRA LD A,0x00 OUT (0x99),A LD A,0x80+15 OUT (0x99),A EI RET NC JR V9938_WaitCmd DO_HMMC: EXX DI LD A,0x24 ; Register 36 as value for... OUT (0x99),A LD A,0x91 ; Register 17 (indirect register access auto increment) OUT (0x99),A EI LD HL,HMMC_CMD ; The HMMC buffer LD C,0x9B ; And port for indirect access CALL V9938_WaitCmd ; Wait if any command is pending OUTI ; And now send the buffer OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI DI LD A,0xAC OUT (0x99),A LD A,0x91 OUT (0x99),A ; Write to register 17 disabling auto incrementing and pointing to 44 (color register), next pixels are sent through R44 EI EXX RET DO_HMMV: CALL V9938_WaitCmd ; Wait if any command is pending DI LD A,0x24 ; Register 36 as value for... OUT (0x99),A LD A,0x91 ; Register 17 (indirect register access auto increment) OUT (0x99),A LD HL,HMMV_CMD ; The HMMV buffer LD C,0x9B ; And port for indirect access LD A,(HL) ; LD DXL in A INC HL INC HL ; HL pointing to DYL ADD 0x08 ; Add 8 to DXL (A) - Border of 16 pixels ADD A,A ; Multiply by 2 OUT (C),A ; And send DXL to 36 LD A,0x00 ; DXH could be 0 JR NC,DO_HMMV_DXH ; If no carry, it is 0 INC A ; Otherwise it is 1 DO_HMMV_DXH: OUT (C),A ; And send DXH to 37 LD A,(HL) ; Load DYL in A INC HL INC HL ; HL pointing @ NXL LD B,A ; Copy DYL to B LD A,(HMMV_CMD_NYL2) ; It's the second step? OR A LD A,(VDP_23) ; Get current vertical offset JR Z,DO_HMMV_FIRST XOR A DO_HMMV_FIRST: ADD A,B ; Add our DYL to it OUT (C),A ; Send it to 38 LD B,A ; Copy adjusted DYL to B LD A,(HMMV_CMD_NYL) ; NYL ADD A,B ; Ok, now let's check if there is an overflow LD (HMMV_CMD_NYL2),A ; Save just in case it is a split operation :D JR NC,DO_HMMV_ONESTEP ; If not carry, last line is within the page constraints so it is a single step JR Z,DO_HMMV_ONESTEP ; If zero, no second step LD B,A ; This is the remainder LD A,(HMMV_CMD_NYL) ; NYL SUB A,B ; First step length LD (HMMV_CMD_NYL),A ; New NYL ;Now finish first step here, and follow-up with a second step XOR A ; DYH always 0 OUT (C),A ; Send it OUTI ; And now send the rest of buffer OUTI OUTI OUTI OUTI OUTI OUTI EI ; Ok, so now for the second step XOR A ; So DY went up to 255, it will now start at 0 LD (HMMV_CMD_DYL),A ; New DYL LD A,(HMMV_CMD_NYL2) ; The remaining lenght at Y LD (HMMV_CMD_NYL),A ; Now at NYL JP DO_HMMV ; And go execute the second step, that won't overflow and will exit cleanly :) DO_HMMV_ONESTEP: XOR A ; DYH always 0 OUT (C),A ; Send it OUTI ; And now send the rest of buffer OUTI OUTI OUTI OUTI OUTI OUTI EI LD (HMMV_CMD_NYL2),A ; Clear NYL2 RET ; This function is safe for a single line only, if spanning over more than one line, it might potentially miss data DO_HMMM: DI LD A,0x20 ; Register 32 as value for... OUT (0x99),A LD A,0x91 ; Register 17 (indirect register access auto increment) OUT (0x99),A EI LD HL,HMMM_CMD ; The HMMC buffer LD C,0x9B ; And port for indirect access CALL V9938_WaitCmd ; Wait if any command is pending OUTI ; And now send the buffer OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI RET DO_YMMM: DI LD A,0x22 ; Register 34 as value for... OUT (0x99),A LD A,0x91 ; Register 17 (indirect register access auto increment) OUT (0x99),A EI LD HL,YMMM_CMD ; The YMMM buffer LD C,0x9B ; And port for indirect access CALL V9938_WaitCmd ; Wait if any command is pending OUTI ; And now send the buffer OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI RET ; ; DATA Portion ; ; This is where our data is defined ; OrgAddress: DW 0x0000 EndAddress: DW 0x0000 SavedCol: DB 0x00 SavedRow: DB 0x00 CursorCol: DB 0x00 CursorRow: DB 0x00 CursorOn: DB 0x00 CursorUpdt: DB 0x00 BackColor: DB 0x00 BorderColor:DB 0x00 ClearColor: DB 0x00 ForeColor: DB 0x07 FontColor: DB 0x07 HiLighted: DB 0x00 Reversed: DB 0x00 Concealed: DB 0x00 LastChar: DB 0x65 ANSI_M: DB 0x00 ; If ESC was the previous character will hold ESC, if processing ESC command, will hold [, otherwise 00 ANSI_P: DW ANSI_S ; Point the next free position in buffer ANSI_S: DS 0x10 ; Buffer to hold the ANSI command or data received to print ANSI_CB: DB 0x00 ; Wheter we have a callback for cursor position requests or not Parameters_PST: DB "0123456789ABCDEF0123456789ABCDEF" Parameters_TRM: DB 0x00 Parameters_PCT: DB 0x00 Parameters_PPT: DW Parameters_PRM Parameters_PRM: DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ColorTable: DB 0x00,0x0F,0xF0,0xFF SPRITEPOS_X: DB 0x00 HMMC_CMD: HMMC_CMD_DXL: DB 0x10 HMMC_CMD_DXH: DB 0x00 HMMC_CMD_DYL: DB 0x00 HMMC_CMD_DYH: DB 0x00 HMMC_CMD_NXL: DB 0x06 HMMC_CMD_NXH: DB 0x00 HMMC_CMD_NYL: DB 0x08 HMMC_CMD_NYH: DB 0x00 HMMC_CMD_CLR: DB 0x00 HMMC_CMD_ARG: DB 0x00 HMMC_CMD_CMD: DB 0xF0 HMMV_CMD: HMMV_CMD_DXL: DB 0x00 HMMV_CMD_DXH: DB 0x00 HMMV_CMD_DYL: DB 0x00 HMMV_CMD_DYH: DB 0x00 HMMV_CMD_NXL: DB 0x00 HMMV_CMD_NXH: DB 0x00 HMMV_CMD_NYL: DB 0x00 HMMV_CMD_NYH: DB 0x00 HMMV_CMD_CLR: DB 0x00 HMMV_CMD_ARG: DB 0x00 HMMV_CMD_CMD: DB 0xC0 HMMV_CMD_NYL2: DB 0x00 HMMM_CMD: HMMM_CMD_SXL: DB 0x00 HMMM_CMD_SXH: DB 0x00 HMMM_CMD_SYL: DB 0x00 HMMM_CMD_SYH: DB 0x00 HMMM_CMD_DXL: DB 0x00 HMMM_CMD_DXH: DB 0x00 HMMM_CMD_DYL: DB 0x00 HMMM_CMD_DYH: DB 0x00 HMMM_CMD_NXL: DB 0x00 HMMM_CMD_NXH: DB 0x00 HMMM_CMD_NYL: DB 0x00 HMMM_CMD_NYH: DB 0x00 HMMM_CMD_CLR: DB 0x00 ; HMMM doesn't use it, but it is faster to send 0 here and not stop sending incremental registers, two outs total, vs 3 outs to skip color and write inc on ARG HMMM_CMD_ARG: DB 0x00 HMMM_CMD_CMD: DB 0xD0 YMMM_CMD: YMMM_CMD_SYL: DB 0x00 ; R34 YMMM_CMD_SYH: DB 0x00 ; R35 YMMM_CMD_DXL: DB 0x00 ; R36 YMMM_CMD_DXH: DB 0x00 ; R37 YMMM_CMD_DYL: DB 0x00 ; R38 YMMM_CMD_DYH: DB 0x00 ; R39 YMMM_CMD_NXL: DB 0x00 ; R40, YMMM doesn't use but it is faster to send 0 here YMMM_CMD_NXH: DB 0x00 ; R41, YMMM doesn't use but it is faster to send 0 here YMMM_CMD_NYL: DB 0x00 ; R42 YMMM_CMD_NYH: DB 0x00 ; R43 YMMM_CMD_CLR: DB 0x00 ; R44, YMMM doesn't use but it is faster to send 0 here YMMM_CMD_ARG: DB 0x00 ; R45 YMMM_CMD_CMD: DB 0xE0 ; R46 YMMM_CMD_NYL2: DB 0x00 ; R42 for split operation second step ANSI_PAL: DB 0x00,0x00,0x50,0x00,0x00,0x05,0x50,0x02,0x05,0x00,0x55,0x00,0x05,0x05,0x55,0x05 DB 0x22,0x02,0x72,0x02,0x22,0x07,0x72,0x07,0x27,0x02,0x77,0x02,0x27,0x07,0x77,0x07 SPRITE_TABLE: DB 0x00,0x00,0x00,0x00 ; Cursor is first, start at line 0, colum 0, uses pattern 0 reserved byte whatever DB 0xD8,0x00,0x01,0x00 ; Next line D8 to make invisible, use pattern 1 (all 0) PATTERN_CURSOR: DB 0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0x00 PATTERN_INVISIBLE: DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 SPRITE_COLORS: DB 0x20,0x20,0x20,0x20,0x20,0x27,0x27,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20 DB 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20 FontData: DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;000 / 0x00 - NUL - Not printable DB 0x3C,0x40,0xA4,0x80,0xA4,0x98,0x40,0x3C ;001 / 0x01 - Smile face DB 0x78,0xFC,0xB4,0xFC,0xB4,0xCC,0xFC,0x00 ;002 / 0x02 - Dark Smile Face DB 0x6C,0xFC,0xFC,0xFC,0x7C,0x38,0x10,0x00 ;003 / 0x03 - Heart DB 0x10,0x38,0x7C,0xFC,0x7C,0x38,0x10,0x00 ;004 / 0x04 - Diamond DB 0x10,0x38,0x54,0xFC,0x54,0x10,0x38,0x00 ;005 / 0x05 - Club DB 0x10,0x38,0x7C,0xFC,0xFC,0x10,0x38,0x00 ;006 / 0x06 - Spade DB 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00 ;007 / 0x07 - Bell, not printable DB 0xFC,0xFC,0xFC,0xE4,0xE4,0xFC,0xFC,0xFC ;008 / 0x08 - Backspace, not printable DB 0x38,0x44,0x80,0x80,0x80,0x44,0x38,0x00 ;009 / 0x09 - Tab, not printable DB 0xC4,0xB8,0x7C,0x7C,0x7C,0xB8,0xC4,0xFC ;010 / 0x0A - Line Feed, not printable DB 0x38,0x08,0x28,0x70,0x88,0x88,0x88,0x70 ;011 / 0x0B - Male Sign DB 0x38,0x44,0x44,0x44,0x38,0x10,0x7C,0x10 ;012 / 0x0C - Form Feed, not printable, clear screen DB 0x30,0x28,0x24,0x24,0x28,0x20,0xE0,0xC0 ;013 / 0x0D - Carriage Return, not printable DB 0x3C,0x24,0x3C,0x24,0x24,0xE4,0xDC,0x18 ;014 / 0x0E - Beamed note DB 0x10,0x54,0x38,0xEC,0x38,0x54,0x10,0x00 ;015 / 0x0F - Sun Ray DB 0x40,0x60,0x70,0x78,0x70,0x60,0x40,0x00 ;016 / 0x10 - Arrow tip to right DB 0x10,0x30,0x70,0xF0,0x70,0x30,0x10,0x00 ;017 / 0x11 - Arrow tip to left DB 0x20,0x70,0xA8,0x20,0x20,0xA8,0x70,0x20 ;018 / 0x12 - UpDown arrow DB 0x48,0x48,0x48,0x48,0x00,0x48,0x48,0x00 ;019 / 0x13 - Double Exclamation Mark DB 0x7C,0xE1,0xE1,0x28,0x28,0x28,0x28,0x00 ;020 / 0x14 - Pilcrow DB 0x18,0x24,0x30,0x48,0x48,0x30,0x90,0x60 ;021 / 0x15 - Section Sign DB 0x00,0x00,0x00,0xFC,0xFC,0x00,0x00,0x00 ;022 / 0x16 - Black Rectangle DB 0x20,0x70,0xA8,0x20,0x20,0xA8,0x70,0xFC ;023 / 0x17 - UpDown arrow with base DB 0x20,0x70,0xA8,0x20,0x20,0x20,0x20,0x00 ;024 / 0x18 - Arrow Up DB 0x20,0x20,0x20,0x20,0xA8,0x70,0x20,0x00 ;025 / 0x19 - Arrow Down DB 0x00,0xC0,0x30,0xF8,0x30,0xC0,0x00,0x00 ;026 / 0x1A - Arrow Right DB 0x00,0x18,0x60,0xF8,0x60,0x18,0x00,0x00 ;027 / 0x1B - ESC, not printables DB 0x00,0x40,0x40,0x40,0x40,0x7C,0x00,0x00 ;028 / 0x1C - Right Angle DB 0x00,0x00,0x20,0x48,0xFC,0x48,0x10,0x00 ;029 / 0x1D - Left-Right Arrow DB 0x20,0x20,0x70,0x70,0xF8,0xF8,0x00,0x00 ;030 / 0x1E - Arrow tip up DB 0xF8,0xF8,0x70,0x70,0x20,0x20,0x00,0x00 ;031 / 0x1F - Arrow tip down DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;032 / 0x20 - Space DB 0x20,0x20,0x20,0x20,0x00,0x00,0x20,0x00 ;033 / 0x21 - DB 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00 ;034 / 0x22 - DB 0x50,0x50,0xF8,0x50,0xF8,0x50,0x50,0x00 ;035 / 0x23 - DB 0x20,0x78,0xA0,0x70,0x28,0xF0,0x20,0x00 ;036 / 0x24 - DB 0xC0,0xC8,0x10,0x20,0x40,0x98,0x18,0x00 ;037 / 0x25 - DB 0x40,0xA0,0x40,0xA8,0x90,0x98,0x60,0x00 ;038 / 0x26 - DB 0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00 ;039 / 0x27 - DB 0x10,0x20,0x40,0x40,0x40,0x20,0x10,0x00 ;040 / 0x28 - DB 0x40,0x20,0x10,0x10,0x10,0x20,0x40,0x00 ;041 / 0x29 - DB 0x20,0xA8,0x70,0x20,0x70,0xA8,0x20,0x00 ;042 / 0x2A - DB 0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00 ;043 / 0x2B - DB 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40 ;044 / 0x2C - DB 0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00 ;045 / 0x2D - DB 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00 ;046 / 0x2E - DB 0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00 ;047 / 0x2F - DB 0x70,0x88,0x98,0xA8,0xC8,0x88,0x70,0x00 ;048 / 0x30 - DB 0x20,0x60,0xA0,0x20,0x20,0x20,0xF8,0x00 ;049 / 0x31 - DB 0x70,0x88,0x08,0x10,0x60,0x80,0xF8,0x00 ;050 / 0x32 - DB 0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00 ;051 / 0x33 - DB 0x10,0x30,0x50,0x90,0xF8,0x10,0x10,0x00 ;052 / 0x34 - DB 0xF8,0x80,0xE0,0x10,0x08,0x10,0xE0,0x00 ;053 / 0x35 - DB 0x30,0x40,0x80,0xF0,0x88,0x88,0x70,0x00 ;054 / 0x36 - DB 0xF8,0x88,0x10,0x20,0x20,0x20,0x20,0x00 ;055 / 0x37 - DB 0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00 ;056 / 0x38 - DB 0x70,0x88,0x88,0x78,0x08,0x10,0x60,0x00 ;057 / 0x39 - DB 0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00 ;058 / 0x3A - DB 0x00,0x00,0x20,0x00,0x00,0x20,0x20,0x40 ;059 / 0x3B - DB 0x18,0x30,0x60,0xC0,0x60,0x30,0x18,0x00 ;060 / 0x3C - DB 0x00,0x00,0xF8,0x00,0xF8,0x00,0x00,0x00 ;061 / 0x3D - DB 0xC0,0x60,0x30,0x18,0x30,0x60,0xC0,0x00 ;062 / 0x3E - DB 0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00 ;063 / 0x3F - DB 0x70,0x88,0x08,0x68,0xA8,0xA8,0x70,0x00 ;064 / 0x40 - DB 0x20,0x50,0x88,0x88,0xF8,0x88,0x88,0x00 ;065 / 0x41 - DB 0xF0,0x48,0x48,0x70,0x48,0x48,0xF0,0x00 ;066 / 0x42 - DB 0x30,0x48,0x80,0x80,0x80,0x48,0x30,0x00 ;067 / 0x43 - DB 0xE0,0x50,0x48,0x48,0x48,0x50,0xE0,0x00 ;068 / 0x44 - DB 0xF8,0x80,0x80,0xF0,0x80,0x80,0xF8,0x00 ;069 / 0x45 - DB 0xF8,0x80,0x80,0xF0,0x80,0x80,0x80,0x00 ;070 / 0x46 - DB 0x70,0x88,0x80,0xB8,0x88,0x88,0x70,0x00 ;071 / 0x47 - DB 0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x00 ;072 / 0x48 - DB 0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00 ;073 / 0x49 - DB 0x38,0x10,0x10,0x10,0x90,0x90,0x60,0x00 ;074 / 0x4A - DB 0x88,0x90,0xA0,0xC0,0xA0,0x90,0x88,0x00 ;075 / 0x4B - DB 0x80,0x80,0x80,0x80,0x80,0x80,0xF8,0x00 ;076 / 0x4C - DB 0x88,0xD8,0xA8,0xA8,0x88,0x88,0x88,0x00 ;077 / 0x4D - DB 0x88,0xC8,0xC8,0xA8,0x98,0x98,0x88,0x00 ;078 / 0x4E - DB 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00 ;079 / 0x4F - DB 0xF0,0x88,0x88,0xF0,0x80,0x80,0x80,0x00 ;080 / 0x50 - DB 0x70,0x88,0x88,0x88,0xA8,0x90,0x68,0x00 ;081 / 0x51 - DB 0xF0,0x88,0x88,0xF0,0xA0,0x90,0x88,0x00 ;082 / 0x52 - DB 0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00 ;083 / 0x53 - DB 0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x00 ;084 / 0x54 - DB 0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00 ;085 / 0x55 - DB 0x88,0x88,0x88,0x88,0x50,0x50,0x20,0x00 ;086 / 0x56 - DB 0x88,0x88,0x88,0xA8,0xA8,0xD8,0x88,0x00 ;087 / 0x57 - DB 0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00 ;088 / 0x58 - DB 0x88,0x88,0x88,0x70,0x20,0x20,0x20,0x00 ;089 / 0x59 - DB 0xF8,0x08,0x10,0x20,0x40,0x80,0xF8,0x00 ;090 / 0x5A - DB 0x70,0x40,0x40,0x40,0x40,0x40,0x70,0x00 ;091 / 0x5B - DB 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00 ;092 / 0x5C - DB 0x70,0x10,0x10,0x10,0x10,0x10,0x70,0x00 ;093 / 0x5D - DB 0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00 ;094 / 0x5E - DB 0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00 ;095 / 0x5F - DB 0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00 ;096 / 0x60 - DB 0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00 ;097 / 0x61 - DB 0x80,0x80,0xB0,0xC8,0x88,0xC8,0xB0,0x00 ;098 / 0x62 - DB 0x00,0x00,0x70,0x88,0x80,0x88,0x70,0x00 ;099 / 0x63 - DB 0x08,0x08,0x68,0x98,0x88,0x98,0x68,0x00 ;100 / 0x64 - DB 0x00,0x00,0x70,0x88,0xF8,0x80,0x70,0x00 ;101 / 0x65 - DB 0x10,0x28,0x20,0xF8,0x20,0x20,0x20,0x00 ;102 / 0x66 - DB 0x00,0x00,0x68,0x98,0x98,0x68,0x08,0x70 ;103 / 0x67 - DB 0x80,0x80,0xF0,0x88,0x88,0x88,0x88,0x00 ;104 / 0x68 - DB 0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00 ;105 / 0x69 - DB 0x10,0x00,0x30,0x10,0x10,0x10,0x90,0x60 ;106 / 0x6A - DB 0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00 ;107 / 0x6B - DB 0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00 ;108 / 0x6C - DB 0x00,0x00,0xD0,0xA8,0xA8,0xA8,0xA8,0x00 ;109 / 0x6D - DB 0x00,0x00,0xB0,0xC8,0x88,0x88,0x88,0x00 ;110 / 0x6E - DB 0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00 ;111 / 0x6F - DB 0x00,0x00,0xB0,0xC8,0xC8,0xB0,0x80,0x80 ;112 / 0x70 - DB 0x00,0x00,0x68,0x98,0x98,0x68,0x08,0x08 ;113 / 0x71 - DB 0x00,0x00,0xB0,0xC8,0x80,0x80,0x80,0x00 ;114 / 0x72 - DB 0x00,0x00,0x78,0x80,0xF0,0x08,0xF0,0x00 ;115 / 0x73 - DB 0x40,0x40,0xF0,0x40,0x40,0x48,0x30,0x00 ;116 / 0x74 - DB 0x00,0x00,0x90,0x90,0x90,0x90,0x68,0x00 ;117 / 0x75 - DB 0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00 ;118 / 0x76 - DB 0x00,0x00,0x88,0xA8,0xA8,0xA8,0x50,0x00 ;119 / 0x77 - DB 0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00 ;120 / 0x78 - DB 0x00,0x00,0x88,0x88,0x98,0x68,0x08,0x70 ;121 / 0x79 - DB 0x00,0x00,0xF8,0x10,0x20,0x40,0xF8,0x00 ;122 / 0x7A - DB 0x18,0x20,0x20,0x40,0x20,0x20,0x18,0x00 ;123 / 0x7B - DB 0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00 ;124 / 0x7C - DB 0xC0,0x20,0x20,0x10,0x20,0x20,0xC0,0x00 ;125 / 0x7D - DB 0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00 ;126 / 0x7E - DB 0x00,0x20,0x50,0x88,0x88,0x88,0xF8,0x00 ;127 / 0x7F - DB 0x70,0x88,0x80,0x80,0x88,0x70,0x20,0x60 ;128 / 0x80 - DB 0x90,0x00,0x00,0x90,0x90,0x90,0x68,0x00 ;129 / 0x81 - DB 0x10,0x20,0x70,0x88,0xF8,0x80,0x70,0x00 ;130 / 0x82 - DB 0x20,0x50,0x70,0x08,0x78,0x88,0x78,0x00 ;131 / 0x83 - DB 0x48,0x00,0x70,0x08,0x78,0x88,0x78,0x00 ;132 / 0x84 - DB 0x20,0x10,0x70,0x08,0x78,0x88,0x78,0x00 ;133 / 0x85 - DB 0x20,0x00,0x70,0x08,0x78,0x88,0x78,0x00 ;134 / 0x86 - DB 0x00,0x70,0x80,0x80,0x80,0x70,0x10,0x60 ;135 / 0x87 - DB 0x20,0x50,0x70,0x88,0xF8,0x80,0x70,0x00 ;136 / 0x88 - DB 0x50,0x00,0x70,0x88,0xF8,0x80,0x70,0x00 ;137 / 0x89 - DB 0x20,0x10,0x70,0x88,0xF8,0x80,0x70,0x00 ;138 / 0x8A - DB 0x50,0x00,0x00,0x60,0x20,0x20,0x70,0x00 ;139 / 0x8B - DB 0x20,0x50,0x00,0x60,0x20,0x20,0x70,0x00 ;140 / 0x8C - DB 0x40,0x20,0x00,0x60,0x20,0x20,0x70,0x00 ;141 / 0x8D - DB 0x50,0x00,0x20,0x50,0x88,0xF8,0x88,0x00 ;142 / 0x8E - DB 0x20,0x00,0x20,0x50,0x88,0xF8,0x88,0x00 ;143 / 0x8F - DB 0x10,0x20,0xF8,0x80,0xF0,0x80,0xF8,0x00 ;144 / 0x90 - DB 0x00,0x00,0x6C,0x10,0x7C,0x90,0x6C,0x00 ;145 / 0x91 - DB 0x3C,0x50,0x90,0x9C,0xF0,0x90,0x9C,0x00 ;146 / 0x92 - DB 0x60,0x90,0x00,0x60,0x90,0x90,0x60,0x00 ;147 / 0x93 - DB 0x90,0x00,0x00,0x60,0x90,0x90,0x60,0x00 ;148 / 0x94 - DB 0x40,0x20,0x00,0x60,0x90,0x90,0x60,0x00 ;149 / 0x95 - DB 0x40,0xA0,0x00,0xA0,0xA0,0xA0,0x50,0x00 ;150 / 0x96 - DB 0x40,0x20,0x00,0xA0,0xA0,0xA0,0x50,0x00 ;151 / 0x97 - DB 0x90,0x00,0x90,0x90,0xB0,0x50,0x10,0xE0 ;152 / 0x98 - DB 0x50,0x00,0x70,0x88,0x88,0x88,0x70,0x00 ;153 / 0x99 - DB 0x50,0x00,0x88,0x88,0x88,0x88,0x70,0x00 ;154 / 0x9A - DB 0x20,0x20,0x78,0x80,0x80,0x78,0x20,0x20 ;155 / 0x9B - DB 0x18,0x24,0x20,0xF8,0x20,0xE0,0x5C,0x00 ;156 / 0x9C - DB 0x88,0x50,0x20,0xF8,0x20,0xF8,0x20,0x00 ;157 / 0x9D - DB 0xC0,0xA0,0xA0,0xC8,0x9C,0x88,0x88,0x8C ;158 / 0x9E - DB 0x18,0x20,0x20,0xF8,0x20,0x20,0x20,0x40 ;159 / 0x9F - DB 0x10,0x20,0x70,0x08,0x78,0x88,0x78,0x00 ;160 / 0xA0 - DB 0x10,0x20,0x00,0x60,0x20,0x20,0x70,0x00 ;161 / 0xA1 - DB 0x20,0x40,0x00,0x60,0x90,0x90,0x60,0x00 ;162 / 0xA2 - DB 0x20,0x40,0x00,0x90,0x90,0x90,0x68,0x00 ;163 / 0xA3 - DB 0x50,0xA0,0x00,0xA0,0xD0,0x90,0x90,0x00 ;164 / 0xA4 - DB 0x28,0x50,0x00,0xC8,0xA8,0x98,0x88,0x00 ;165 / 0xA5 - DB 0x00,0x70,0x08,0x78,0x88,0x78,0x00,0xF8 ;166 / 0xA6 - DB 0x00,0x60,0x90,0x90,0x90,0x60,0x00,0xF0 ;167 / 0xA7 - DB 0x20,0x00,0x20,0x40,0x80,0x88,0x70,0x00 ;168 / 0xA8 - DB 0x00,0x00,0x00,0xF8,0x80,0x80,0x00,0x00 ;169 / 0xA9 - DB 0x00,0x00,0x00,0xF8,0x08,0x08,0x00,0x00 ;170 / 0xAA - DB 0x84,0x88,0x90,0xA8,0x54,0x84,0x08,0x1C ;171 / 0xAB - DB 0x84,0x88,0x90,0xA8,0x58,0xA8,0x3C,0x08 ;172 / 0xAC - DB 0x20,0x00,0x00,0x20,0x20,0x20,0x20,0x00 ;173 / 0xAD - DB 0x00,0x00,0x24,0x48,0x90,0x48,0x24,0x00 ;174 / 0xAE - DB 0x00,0x00,0x90,0x48,0x24,0x48,0x90,0x00 ;175 / 0xAF - DB 0x90,0x48,0x24,0x90,0x48,0x24,0x90,0x48 ;176 / 0xB0 - DB 0xA8,0x54,0xA8,0x54,0xA8,0x54,0xA8,0x54 ;177 / 0xB1 - DB 0x6C,0xB4,0xD8,0x6C,0xB4,0xD8,0x6C,0xB4 ;178 / 0xB2 - DB 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20 ;179 / 0xB3 - DB 0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x20 ;180 / 0xB4 - DB 0x20,0x20,0xE0,0x20,0xE0,0x20,0x20,0x20 ;181 / 0xB5 - DB 0x50,0x50,0x50,0xD0,0x50,0x50,0x50,0x50 ;182 / 0xB6 - DB 0x00,0x00,0x00,0xF0,0x50,0x50,0x50,0x50 ;183 / 0xB7 - DB 0x00,0x00,0xE0,0x20,0xE0,0x20,0x20,0x20 ;184 / 0xB8 - DB 0x50,0x50,0xD0,0x10,0xD0,0x50,0x50,0x50 ;185 / 0xB9 - DB 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50 ;186 / 0xBA - DB 0x00,0x00,0xF0,0x10,0xD0,0x50,0x50,0x50 ;187 / 0xBB - DB 0x50,0x50,0xD0,0x10,0xF0,0x00,0x00,0x00 ;188 / 0xBC - DB 0x50,0x50,0x50,0xF0,0x00,0x00,0x00,0x00 ;189 / 0xBD - DB 0x20,0x20,0xE0,0x20,0xE0,0x00,0x00,0x00 ;190 / 0xBE - DB 0x00,0x00,0x00,0xE0,0x20,0x20,0x20,0x20 ;191 / 0xBF - DB 0x20,0x20,0x20,0x3C,0x00,0x00,0x00,0x00 ;192 / 0xC0 - DB 0x20,0x20,0x20,0xFC,0x00,0x00,0x00,0x00 ;193 / 0xC1 - DB 0x00,0x00,0x00,0xFC,0x20,0x20,0x20,0x20 ;194 / 0xC2 - DB 0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20 ;195 / 0xC3 - DB 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00 ;196 / 0xC4 - DB 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20 ;197 / 0xC5 - DB 0x20,0x20,0x3C,0x20,0x3C,0x20,0x20,0x20 ;198 / 0xC6 - DB 0x50,0x50,0x50,0x5C,0x50,0x50,0x50,0x50 ;199 / 0xC7 - DB 0x50,0x50,0x5C,0x40,0x7C,0x00,0x00,0x00 ;200 / 0xC8 - DB 0x00,0x00,0x7C,0x40,0x5C,0x50,0x50,0x50 ;201 / 0xC9 - DB 0x50,0x50,0xDC,0x00,0xFC,0x00,0x00,0x00 ;202 / 0xCA - DB 0x00,0x00,0xFC,0x00,0xDC,0x50,0x50,0x50 ;203 / 0xCB - DB 0x50,0x50,0x5C,0x40,0x5C,0x50,0x50,0x50 ;204 / 0xCC - DB 0x00,0x00,0xFC,0x00,0xFC,0x00,0x00,0x00 ;205 / 0xCD - DB 0x50,0x50,0xDC,0x00,0xDC,0x50,0x50,0x50 ;206 / 0xCE - DB 0x20,0x20,0xFC,0x00,0xFC,0x00,0x00,0x00 ;207 / 0xCF - DB 0x50,0x50,0x50,0xFC,0x00,0x00,0x00,0x00 ;208 / 0xD0 - DB 0x00,0x00,0xFC,0x00,0xFC,0x20,0x20,0x20 ;209 / 0xD1 - DB 0x00,0x00,0x00,0xFC,0x50,0x50,0x50,0x50 ;210 / 0xD2 - DB 0x50,0x50,0x50,0x7C,0x00,0x00,0x00,0x00 ;211 / 0xD3 - DB 0x20,0x20,0x3C,0x20,0x3C,0x00,0x00,0x00 ;212 / 0xD4 - DB 0x00,0x00,0x3C,0x20,0x3C,0x20,0x20,0x20 ;213 / 0xD5 - DB 0x00,0x00,0x00,0x7C,0x50,0x50,0x50,0x50 ;214 / 0xD6 - DB 0x50,0x50,0x50,0xFC,0x50,0x50,0x50,0x50 ;215 / 0xD7 - DB 0x20,0x20,0xFC,0x20,0xFC,0x20,0x20,0x20 ;216 / 0xD8 - DB 0x20,0x20,0x20,0xE0,0x00,0x00,0x00,0x00 ;217 / 0xD9 - DB 0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20 ;218 / 0xDA - DB 0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC ;219 / 0xDB - DB 0x00,0x00,0x00,0x00,0xFC,0xFC,0xFC,0xFC ;220 / 0xDC - DB 0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0 ;221 / 0xDD - DB 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C ;222 / 0xDE - DB 0xFC,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00 ;223 / 0xDF - DB 0x00,0x00,0x68,0x90,0x90,0x90,0x68,0x00 ;224 / 0xE0 - DB 0x30,0x48,0x48,0x70,0x48,0x48,0x70,0xC0 ;225 / 0xE1 - DB 0xF8,0x88,0x80,0x80,0x80,0x80,0x80,0x00 ;226 / 0xE2 - DB 0xF8,0x50,0x50,0x50,0x50,0x50,0x98,0x00 ;227 / 0xE3 - DB 0xF8,0x88,0x40,0x20,0x40,0x88,0xF8,0x00 ;228 / 0xE4 - DB 0x00,0x00,0x78,0x90,0x90,0x90,0x60,0x00 ;229 / 0xE5 - DB 0x00,0x50,0x50,0x50,0x50,0x68,0x80,0x80 ;230 / 0xE6 - DB 0x00,0x50,0xA0,0x20,0x20,0x20,0x20,0x00 ;231 / 0xE7 - DB 0xF8,0x20,0x70,0xA8,0xA8,0x70,0x20,0xF8 ;232 / 0xE8 - DB 0x20,0x50,0x88,0xF8,0x88,0x50,0x20,0x00 ;233 / 0xE9 - DB 0x70,0x88,0x88,0x88,0x50,0x50,0xD8,0x00 ;234 / 0xEA - DB 0x30,0x40,0x40,0x20,0x50,0x50,0x50,0x20 ;235 / 0xEB - DB 0x00,0x00,0x00,0x50,0xA8,0xA8,0x50,0x00 ;236 / 0xEC - DB 0x08,0x70,0xA8,0xA8,0xA8,0x70,0x80,0x00 ;237 / 0xED - DB 0x38,0x40,0x80,0xF8,0x80,0x40,0x38,0x00 ;238 / 0xEE - DB 0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x00 ;239 / 0xEF - DB 0x00,0xF8,0x00,0xF8,0x00,0xF8,0x00,0x00 ;240 / 0xF0 - DB 0x20,0x20,0xF8,0x20,0x20,0x00,0xF8,0x00 ;241 / 0xF1 - DB 0xC0,0x30,0x08,0x30,0xC0,0x00,0xF8,0x00 ;242 / 0xF2 - DB 0x18,0x60,0x80,0x60,0x18,0x00,0xF8,0x00 ;243 / 0xF3 - DB 0x10,0x28,0x20,0x20,0x20,0x20,0x20,0x20 ;244 / 0xF4 - DB 0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40 ;245 / 0xF5 - DB 0x00,0x20,0x00,0xF8,0x00,0x20,0x00,0x00 ;246 / 0xF6 - DB 0x00,0x50,0xA0,0x00,0x50,0xA0,0x00,0x00 ;247 / 0xF7 - DB 0x00,0x18,0x24,0x24,0x18,0x00,0x00,0x00 ;248 / 0xF8 - DB 0x00,0x30,0x78,0x78,0x30,0x00,0x00,0x00 ;249 / 0xF9 - DB 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00 ;250 / 0xFA - DB 0x04,0x04,0x08,0x08,0x90,0x70,0x20,0x00 ;251 / 0xFB - DB 0xA0,0x50,0x50,0x50,0x00,0x00,0x00,0x00 ;252 / 0xFC - DB 0x40,0xA0,0x20,0x40,0xE0,0x00,0x00,0x00 ;253 / 0xFD - DB 0x00,0x00,0x30,0x30,0x30,0x30,0x00,0x00 ;254 / 0xFE - DB 0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC ;255 / 0xFF -
30.586985
182
0.698669
0861f612e579ae46dcaa8ecec551b03273d1e811
351
asm
Assembly
programs/oeis/249/A249911.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/249/A249911.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/249/A249911.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A249911: 60-gonal (hexacontagonal) numbers: a(n) = n(29n - 28). ; 0,1,60,177,352,585,876,1225,1632,2097,2620,3201,3840,4537,5292,6105,6976,7905,8892,9937,11040,12201,13420,14697,16032,17425,18876,20385,21952,23577,25260,27001,28800,30657,32572,34545,36576,38665,40812,43017,45280 mov $1,7 mul $1,$0 mul $1,4 add $1,$0 sub $1,28 mul $1,$0 mov $0,$1
31.909091
215
0.717949
6407afd17fe3d07d459049a44107889d9ae76ad5
904
asm
Assembly
Virus.Win32.Fga/payload.asm
010001111/Vx-Suites
6b4b90a60512cce48aa7b87aec5e5ac1c4bb9a79
[ "MIT" ]
2
2021-02-04T06:47:45.000Z
2021-07-28T10:02:10.000Z
Virus.Win32.Fga/payload.asm
010001111/Vx-Suites
6b4b90a60512cce48aa7b87aec5e5ac1c4bb9a79
[ "MIT" ]
null
null
null
Virus.Win32.Fga/payload.asm
010001111/Vx-Suites
6b4b90a60512cce48aa7b87aec5e5ac1c4bb9a79
[ "MIT" ]
null
null
null
payload__: ;dnt bther seeing it! jmp pcode datestring dd 0 dateformat db "d M y",0 pcode: push 512 push [ebp+offset buffer] ;using the same buffer mov eax,offset dateformat add eax,ebp push eax push 0 push 0 push 0 call [ebp+offset AGetDateFormatF] mov edx,[ebp+offset buffer] cmp byte ptr [edx],'9' je pay__ ret pay__: cmp byte ptr [edx+2],'4' je continue__p ret continue__p: mov eax,[ebp+offset buffer] mov dword ptr [eax],'gnoc' mov dword ptr [eax+4],'star' mov word ptr [eax+8],'u!' mov word ptr [eax+10],'h ' mov dword ptr [eax+12],' eva' mov dword ptr [eax+16],'neeb' mov dword ptr [eax+20],'cuf ' mov word ptr [eax+24],'ek' mov word ptr [eax+26],'!d' mov dword ptr [eax+28],'a yb' mov dword ptr [eax+32],'gaf ' mov eax,offset s_g add eax,ebp push 0 push eax mov eax,[ebp+offset buffer] push eax push 0 call [ebp+offset MessageBoxAd] push 5000 call dword ptr [ebp+offset ASleepF] ret
15.859649
49
0.702434
253d517d257ab1e5ff96db2180094b803275884a
886
asm
Assembly
programs/oeis/089/A089898.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/089/A089898.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/089/A089898.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A089898: Product of (digits of n each incremented by 1). ; 1,2,3,4,5,6,7,8,9,10,2,4,6,8,10,12,14,16,18,20,3,6,9,12,15,18,21,24,27,30,4,8,12,16,20,24,28,32,36,40,5,10,15,20,25,30,35,40,45,50,6,12,18,24,30,36,42,48,54,60,7,14,21,28,35,42,49,56,63,70,8,16,24,32,40,48,56,64,72,80,9,18,27,36,45,54,63,72,81,90,10,20,30,40,50,60,70,80,90,100,2,4,6,8,10,12,14,16,18,20,4,8,12,16,20,24,28,32,36,40,6,12,18,24,30,36,42,48,54,60,8,16,24,32,40,48,56,64,72,80,10,20,30,40,50,60,70,80,90,100,12,24,36,48,60,72,84,96,108,120,14,28,42,56,70,84,98,112,126,140,16,32,48,64,80,96,112,128,144,160,18,36,54,72,90,108,126,144,162,180,20,40,60,80,100,120,140,160,180,200,3,6,9,12,15,18,21,24,27,30,6,12,18,24,30,36,42,48,54,60,9,18,27,36,45,54,63,72,81,90,12,24,36,48,60,72,84,96,108,120,15,30,45,60,75,90,105,120,135,150 mov $1,1 lpb $0,1 mov $2,$0 div $0,10 mod $2,10 mul $2,$1 add $1,$2 lpe
73.833333
743
0.648984
93b41dc6ad56f38e742cf5124f7c31d593dc9f28
104,457
asm
Assembly
oslab6/obj/user/fairness.asm
jasha64/OperatingSystems-lab
25a473adb754171d5c10c6bde391e0e07a2a43de
[ "MIT" ]
null
null
null
oslab6/obj/user/fairness.asm
jasha64/OperatingSystems-lab
25a473adb754171d5c10c6bde391e0e07a2a43de
[ "MIT" ]
null
null
null
oslab6/obj/user/fairness.asm
jasha64/OperatingSystems-lab
25a473adb754171d5c10c6bde391e0e07a2a43de
[ "MIT" ]
null
null
null
obj/user/fairness.debug: 文件格式 elf32-i386 Disassembly of section .text: 00800020 <_start>: // starts us running when we are initially loaded into a new environment. .text .globl _start _start: // See if we were started with arguments on the stack cmpl $USTACKTOP, %esp 800020: 81 fc 00 e0 bf ee cmp $0xeebfe000,%esp jne args_exist 800026: 75 04 jne 80002c <args_exist> // If not, push dummy argc/argv arguments. // This happens when we are loaded by the kernel, // because the kernel does not know about passing arguments. pushl $0 800028: 6a 00 push $0x0 pushl $0 80002a: 6a 00 push $0x0 0080002c <args_exist>: args_exist: call libmain 80002c: e8 70 00 00 00 call 8000a1 <libmain> 1: jmp 1b 800031: eb fe jmp 800031 <args_exist+0x5> 00800033 <umain>: #include <inc/lib.h> void umain(int argc, char **argv) { 800033: 55 push %ebp 800034: 89 e5 mov %esp,%ebp 800036: 56 push %esi 800037: 53 push %ebx 800038: 83 ec 10 sub $0x10,%esp envid_t who, id; id = sys_getenvid(); 80003b: e8 28 0b 00 00 call 800b68 <sys_getenvid> 800040: 89 c3 mov %eax,%ebx if (thisenv == &envs[1]) { 800042: 81 3d 04 20 80 00 7c cmpl $0xeec0007c,0x802004 800049: 00 c0 ee 80004c: 75 26 jne 800074 <umain+0x41> while (1) { ipc_recv(&who, 0, 0); 80004e: 8d 75 f4 lea -0xc(%ebp),%esi 800051: 83 ec 04 sub $0x4,%esp 800054: 6a 00 push $0x0 800056: 6a 00 push $0x0 800058: 56 push %esi 800059: e8 39 0d 00 00 call 800d97 <ipc_recv> cprintf("%x recv from %x\n", id, who); 80005e: 83 c4 0c add $0xc,%esp 800061: ff 75 f4 pushl -0xc(%ebp) 800064: 53 push %ebx 800065: 68 20 11 80 00 push $0x801120 80006a: e8 1f 01 00 00 call 80018e <cprintf> 80006f: 83 c4 10 add $0x10,%esp 800072: eb dd jmp 800051 <umain+0x1e> } } else { cprintf("%x loop sending to %x\n", id, envs[1].env_id); 800074: a1 c4 00 c0 ee mov 0xeec000c4,%eax 800079: 83 ec 04 sub $0x4,%esp 80007c: 50 push %eax 80007d: 53 push %ebx 80007e: 68 31 11 80 00 push $0x801131 800083: e8 06 01 00 00 call 80018e <cprintf> 800088: 83 c4 10 add $0x10,%esp while (1) ipc_send(envs[1].env_id, 0, 0, 0); 80008b: a1 c4 00 c0 ee mov 0xeec000c4,%eax 800090: 6a 00 push $0x0 800092: 6a 00 push $0x0 800094: 6a 00 push $0x0 800096: 50 push %eax 800097: e8 64 0d 00 00 call 800e00 <ipc_send> 80009c: 83 c4 10 add $0x10,%esp 80009f: eb ea jmp 80008b <umain+0x58> 008000a1 <libmain>: const volatile struct Env *thisenv; const char *binaryname = "<unknown>"; void libmain(int argc, char **argv) { 8000a1: 55 push %ebp 8000a2: 89 e5 mov %esp,%ebp 8000a4: 56 push %esi 8000a5: 53 push %ebx 8000a6: 8b 5d 08 mov 0x8(%ebp),%ebx 8000a9: 8b 75 0c mov 0xc(%ebp),%esi // set thisenv to point at our Env structure in envs[]. // LAB 3: Your code here. envid_t envid = sys_getenvid(); 8000ac: e8 b7 0a 00 00 call 800b68 <sys_getenvid> thisenv = envs + ENVX(envid); 8000b1: 25 ff 03 00 00 and $0x3ff,%eax 8000b6: 6b c0 7c imul $0x7c,%eax,%eax 8000b9: 05 00 00 c0 ee add $0xeec00000,%eax 8000be: a3 04 20 80 00 mov %eax,0x802004 // save the name of the program so that panic() can use it if (argc > 0) 8000c3: 85 db test %ebx,%ebx 8000c5: 7e 07 jle 8000ce <libmain+0x2d> binaryname = argv[0]; 8000c7: 8b 06 mov (%esi),%eax 8000c9: a3 00 20 80 00 mov %eax,0x802000 // call user main routine umain(argc, argv); 8000ce: 83 ec 08 sub $0x8,%esp 8000d1: 56 push %esi 8000d2: 53 push %ebx 8000d3: e8 5b ff ff ff call 800033 <umain> // exit gracefully exit(); 8000d8: e8 0a 00 00 00 call 8000e7 <exit> } 8000dd: 83 c4 10 add $0x10,%esp 8000e0: 8d 65 f8 lea -0x8(%ebp),%esp 8000e3: 5b pop %ebx 8000e4: 5e pop %esi 8000e5: 5d pop %ebp 8000e6: c3 ret 008000e7 <exit>: #include <inc/lib.h> void exit(void) { 8000e7: 55 push %ebp 8000e8: 89 e5 mov %esp,%ebp 8000ea: 83 ec 14 sub $0x14,%esp // close_all(); sys_env_destroy(0); 8000ed: 6a 00 push $0x0 8000ef: e8 33 0a 00 00 call 800b27 <sys_env_destroy> } 8000f4: 83 c4 10 add $0x10,%esp 8000f7: c9 leave 8000f8: c3 ret 008000f9 <putch>: }; static void putch(int ch, struct printbuf *b) { 8000f9: 55 push %ebp 8000fa: 89 e5 mov %esp,%ebp 8000fc: 53 push %ebx 8000fd: 83 ec 04 sub $0x4,%esp 800100: 8b 5d 0c mov 0xc(%ebp),%ebx b->buf[b->idx++] = ch; 800103: 8b 13 mov (%ebx),%edx 800105: 8d 42 01 lea 0x1(%edx),%eax 800108: 89 03 mov %eax,(%ebx) 80010a: 8b 4d 08 mov 0x8(%ebp),%ecx 80010d: 88 4c 13 08 mov %cl,0x8(%ebx,%edx,1) if (b->idx == 256-1) { 800111: 3d ff 00 00 00 cmp $0xff,%eax 800116: 74 09 je 800121 <putch+0x28> sys_cputs(b->buf, b->idx); b->idx = 0; } b->cnt++; 800118: 83 43 04 01 addl $0x1,0x4(%ebx) } 80011c: 8b 5d fc mov -0x4(%ebp),%ebx 80011f: c9 leave 800120: c3 ret sys_cputs(b->buf, b->idx); 800121: 83 ec 08 sub $0x8,%esp 800124: 68 ff 00 00 00 push $0xff 800129: 8d 43 08 lea 0x8(%ebx),%eax 80012c: 50 push %eax 80012d: e8 b8 09 00 00 call 800aea <sys_cputs> b->idx = 0; 800132: c7 03 00 00 00 00 movl $0x0,(%ebx) 800138: 83 c4 10 add $0x10,%esp 80013b: eb db jmp 800118 <putch+0x1f> 0080013d <vcprintf>: int vcprintf(const char *fmt, va_list ap) { 80013d: 55 push %ebp 80013e: 89 e5 mov %esp,%ebp 800140: 81 ec 18 01 00 00 sub $0x118,%esp struct printbuf b; b.idx = 0; 800146: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 80014d: 00 00 00 b.cnt = 0; 800150: c7 85 f4 fe ff ff 00 movl $0x0,-0x10c(%ebp) 800157: 00 00 00 vprintfmt((void*)putch, &b, fmt, ap); 80015a: ff 75 0c pushl 0xc(%ebp) 80015d: ff 75 08 pushl 0x8(%ebp) 800160: 8d 85 f0 fe ff ff lea -0x110(%ebp),%eax 800166: 50 push %eax 800167: 68 f9 00 80 00 push $0x8000f9 80016c: e8 1a 01 00 00 call 80028b <vprintfmt> sys_cputs(b.buf, b.idx); 800171: 83 c4 08 add $0x8,%esp 800174: ff b5 f0 fe ff ff pushl -0x110(%ebp) 80017a: 8d 85 f8 fe ff ff lea -0x108(%ebp),%eax 800180: 50 push %eax 800181: e8 64 09 00 00 call 800aea <sys_cputs> return b.cnt; } 800186: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax 80018c: c9 leave 80018d: c3 ret 0080018e <cprintf>: int cprintf(const char *fmt, ...) { 80018e: 55 push %ebp 80018f: 89 e5 mov %esp,%ebp 800191: 83 ec 10 sub $0x10,%esp va_list ap; int cnt; va_start(ap, fmt); 800194: 8d 45 0c lea 0xc(%ebp),%eax cnt = vcprintf(fmt, ap); 800197: 50 push %eax 800198: ff 75 08 pushl 0x8(%ebp) 80019b: e8 9d ff ff ff call 80013d <vcprintf> va_end(ap); return cnt; } 8001a0: c9 leave 8001a1: c3 ret 008001a2 <printnum>: * using specified putch function and associated pointer putdat. */ static void printnum(void (*putch)(int, void*), void *putdat, unsigned long long num, unsigned base, int width, int padc) { 8001a2: 55 push %ebp 8001a3: 89 e5 mov %esp,%ebp 8001a5: 57 push %edi 8001a6: 56 push %esi 8001a7: 53 push %ebx 8001a8: 83 ec 1c sub $0x1c,%esp 8001ab: 89 c7 mov %eax,%edi 8001ad: 89 d6 mov %edx,%esi 8001af: 8b 45 08 mov 0x8(%ebp),%eax 8001b2: 8b 55 0c mov 0xc(%ebp),%edx 8001b5: 89 45 d8 mov %eax,-0x28(%ebp) 8001b8: 89 55 dc mov %edx,-0x24(%ebp) // first recursively print all preceding (more significant) digits if (num >= base) { 8001bb: 8b 4d 10 mov 0x10(%ebp),%ecx 8001be: bb 00 00 00 00 mov $0x0,%ebx 8001c3: 89 4d e0 mov %ecx,-0x20(%ebp) 8001c6: 89 5d e4 mov %ebx,-0x1c(%ebp) 8001c9: 39 d3 cmp %edx,%ebx 8001cb: 72 05 jb 8001d2 <printnum+0x30> 8001cd: 39 45 10 cmp %eax,0x10(%ebp) 8001d0: 77 7a ja 80024c <printnum+0xaa> printnum(putch, putdat, num / base, base, width - 1, padc); 8001d2: 83 ec 0c sub $0xc,%esp 8001d5: ff 75 18 pushl 0x18(%ebp) 8001d8: 8b 45 14 mov 0x14(%ebp),%eax 8001db: 8d 58 ff lea -0x1(%eax),%ebx 8001de: 53 push %ebx 8001df: ff 75 10 pushl 0x10(%ebp) 8001e2: 83 ec 08 sub $0x8,%esp 8001e5: ff 75 e4 pushl -0x1c(%ebp) 8001e8: ff 75 e0 pushl -0x20(%ebp) 8001eb: ff 75 dc pushl -0x24(%ebp) 8001ee: ff 75 d8 pushl -0x28(%ebp) 8001f1: e8 ea 0c 00 00 call 800ee0 <__udivdi3> 8001f6: 83 c4 18 add $0x18,%esp 8001f9: 52 push %edx 8001fa: 50 push %eax 8001fb: 89 f2 mov %esi,%edx 8001fd: 89 f8 mov %edi,%eax 8001ff: e8 9e ff ff ff call 8001a2 <printnum> 800204: 83 c4 20 add $0x20,%esp 800207: eb 13 jmp 80021c <printnum+0x7a> } else { // print any needed pad characters before first digit while (--width > 0) putch(padc, putdat); 800209: 83 ec 08 sub $0x8,%esp 80020c: 56 push %esi 80020d: ff 75 18 pushl 0x18(%ebp) 800210: ff d7 call *%edi 800212: 83 c4 10 add $0x10,%esp while (--width > 0) 800215: 83 eb 01 sub $0x1,%ebx 800218: 85 db test %ebx,%ebx 80021a: 7f ed jg 800209 <printnum+0x67> } // then print this (the least significant) digit putch("0123456789abcdef"[num % base], putdat); 80021c: 83 ec 08 sub $0x8,%esp 80021f: 56 push %esi 800220: 83 ec 04 sub $0x4,%esp 800223: ff 75 e4 pushl -0x1c(%ebp) 800226: ff 75 e0 pushl -0x20(%ebp) 800229: ff 75 dc pushl -0x24(%ebp) 80022c: ff 75 d8 pushl -0x28(%ebp) 80022f: e8 cc 0d 00 00 call 801000 <__umoddi3> 800234: 83 c4 14 add $0x14,%esp 800237: 0f be 80 52 11 80 00 movsbl 0x801152(%eax),%eax 80023e: 50 push %eax 80023f: ff d7 call *%edi } 800241: 83 c4 10 add $0x10,%esp 800244: 8d 65 f4 lea -0xc(%ebp),%esp 800247: 5b pop %ebx 800248: 5e pop %esi 800249: 5f pop %edi 80024a: 5d pop %ebp 80024b: c3 ret 80024c: 8b 5d 14 mov 0x14(%ebp),%ebx 80024f: eb c4 jmp 800215 <printnum+0x73> 00800251 <sprintputch>: int cnt; }; static void sprintputch(int ch, struct sprintbuf *b) { 800251: 55 push %ebp 800252: 89 e5 mov %esp,%ebp 800254: 8b 45 0c mov 0xc(%ebp),%eax b->cnt++; 800257: 83 40 08 01 addl $0x1,0x8(%eax) if (b->buf < b->ebuf) 80025b: 8b 10 mov (%eax),%edx 80025d: 3b 50 04 cmp 0x4(%eax),%edx 800260: 73 0a jae 80026c <sprintputch+0x1b> *b->buf++ = ch; 800262: 8d 4a 01 lea 0x1(%edx),%ecx 800265: 89 08 mov %ecx,(%eax) 800267: 8b 45 08 mov 0x8(%ebp),%eax 80026a: 88 02 mov %al,(%edx) } 80026c: 5d pop %ebp 80026d: c3 ret 0080026e <printfmt>: { 80026e: 55 push %ebp 80026f: 89 e5 mov %esp,%ebp 800271: 83 ec 08 sub $0x8,%esp va_start(ap, fmt); 800274: 8d 45 14 lea 0x14(%ebp),%eax vprintfmt(putch, putdat, fmt, ap); 800277: 50 push %eax 800278: ff 75 10 pushl 0x10(%ebp) 80027b: ff 75 0c pushl 0xc(%ebp) 80027e: ff 75 08 pushl 0x8(%ebp) 800281: e8 05 00 00 00 call 80028b <vprintfmt> } 800286: 83 c4 10 add $0x10,%esp 800289: c9 leave 80028a: c3 ret 0080028b <vprintfmt>: { 80028b: 55 push %ebp 80028c: 89 e5 mov %esp,%ebp 80028e: 57 push %edi 80028f: 56 push %esi 800290: 53 push %ebx 800291: 83 ec 2c sub $0x2c,%esp 800294: 8b 75 08 mov 0x8(%ebp),%esi 800297: 8b 5d 0c mov 0xc(%ebp),%ebx 80029a: 8b 7d 10 mov 0x10(%ebp),%edi 80029d: e9 c1 03 00 00 jmp 800663 <vprintfmt+0x3d8> padc = ' '; 8002a2: c6 45 d4 20 movb $0x20,-0x2c(%ebp) altflag = 0; 8002a6: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp) precision = -1; 8002ad: c7 45 d0 ff ff ff ff movl $0xffffffff,-0x30(%ebp) width = -1; 8002b4: c7 45 e0 ff ff ff ff movl $0xffffffff,-0x20(%ebp) lflag = 0; 8002bb: b9 00 00 00 00 mov $0x0,%ecx switch (ch = *(unsigned char *) fmt++) { 8002c0: 8d 47 01 lea 0x1(%edi),%eax 8002c3: 89 45 e4 mov %eax,-0x1c(%ebp) 8002c6: 0f b6 17 movzbl (%edi),%edx 8002c9: 8d 42 dd lea -0x23(%edx),%eax 8002cc: 3c 55 cmp $0x55,%al 8002ce: 0f 87 12 04 00 00 ja 8006e6 <vprintfmt+0x45b> 8002d4: 0f b6 c0 movzbl %al,%eax 8002d7: ff 24 85 a0 12 80 00 jmp *0x8012a0(,%eax,4) 8002de: 8b 7d e4 mov -0x1c(%ebp),%edi padc = '-'; 8002e1: c6 45 d4 2d movb $0x2d,-0x2c(%ebp) 8002e5: eb d9 jmp 8002c0 <vprintfmt+0x35> switch (ch = *(unsigned char *) fmt++) { 8002e7: 8b 7d e4 mov -0x1c(%ebp),%edi padc = '0'; 8002ea: c6 45 d4 30 movb $0x30,-0x2c(%ebp) 8002ee: eb d0 jmp 8002c0 <vprintfmt+0x35> switch (ch = *(unsigned char *) fmt++) { 8002f0: 0f b6 d2 movzbl %dl,%edx 8002f3: 8b 7d e4 mov -0x1c(%ebp),%edi for (precision = 0; ; ++fmt) { 8002f6: b8 00 00 00 00 mov $0x0,%eax 8002fb: 89 4d e4 mov %ecx,-0x1c(%ebp) precision = precision * 10 + ch - '0'; 8002fe: 8d 04 80 lea (%eax,%eax,4),%eax 800301: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax ch = *fmt; 800305: 0f be 17 movsbl (%edi),%edx if (ch < '0' || ch > '9') 800308: 8d 4a d0 lea -0x30(%edx),%ecx 80030b: 83 f9 09 cmp $0x9,%ecx 80030e: 77 55 ja 800365 <vprintfmt+0xda> for (precision = 0; ; ++fmt) { 800310: 83 c7 01 add $0x1,%edi precision = precision * 10 + ch - '0'; 800313: eb e9 jmp 8002fe <vprintfmt+0x73> precision = va_arg(ap, int); 800315: 8b 45 14 mov 0x14(%ebp),%eax 800318: 8b 00 mov (%eax),%eax 80031a: 89 45 d0 mov %eax,-0x30(%ebp) 80031d: 8b 45 14 mov 0x14(%ebp),%eax 800320: 8d 40 04 lea 0x4(%eax),%eax 800323: 89 45 14 mov %eax,0x14(%ebp) switch (ch = *(unsigned char *) fmt++) { 800326: 8b 7d e4 mov -0x1c(%ebp),%edi if (width < 0) 800329: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80032d: 79 91 jns 8002c0 <vprintfmt+0x35> width = precision, precision = -1; 80032f: 8b 45 d0 mov -0x30(%ebp),%eax 800332: 89 45 e0 mov %eax,-0x20(%ebp) 800335: c7 45 d0 ff ff ff ff movl $0xffffffff,-0x30(%ebp) 80033c: eb 82 jmp 8002c0 <vprintfmt+0x35> 80033e: 8b 45 e0 mov -0x20(%ebp),%eax 800341: 85 c0 test %eax,%eax 800343: ba 00 00 00 00 mov $0x0,%edx 800348: 0f 49 d0 cmovns %eax,%edx 80034b: 89 55 e0 mov %edx,-0x20(%ebp) switch (ch = *(unsigned char *) fmt++) { 80034e: 8b 7d e4 mov -0x1c(%ebp),%edi 800351: e9 6a ff ff ff jmp 8002c0 <vprintfmt+0x35> 800356: 8b 7d e4 mov -0x1c(%ebp),%edi altflag = 1; 800359: c7 45 d8 01 00 00 00 movl $0x1,-0x28(%ebp) goto reswitch; 800360: e9 5b ff ff ff jmp 8002c0 <vprintfmt+0x35> 800365: 8b 4d e4 mov -0x1c(%ebp),%ecx 800368: 89 45 d0 mov %eax,-0x30(%ebp) 80036b: eb bc jmp 800329 <vprintfmt+0x9e> lflag++; 80036d: 83 c1 01 add $0x1,%ecx switch (ch = *(unsigned char *) fmt++) { 800370: 8b 7d e4 mov -0x1c(%ebp),%edi goto reswitch; 800373: e9 48 ff ff ff jmp 8002c0 <vprintfmt+0x35> putch(va_arg(ap, int), putdat); 800378: 8b 45 14 mov 0x14(%ebp),%eax 80037b: 8d 78 04 lea 0x4(%eax),%edi 80037e: 83 ec 08 sub $0x8,%esp 800381: 53 push %ebx 800382: ff 30 pushl (%eax) 800384: ff d6 call *%esi break; 800386: 83 c4 10 add $0x10,%esp putch(va_arg(ap, int), putdat); 800389: 89 7d 14 mov %edi,0x14(%ebp) break; 80038c: e9 cf 02 00 00 jmp 800660 <vprintfmt+0x3d5> err = va_arg(ap, int); 800391: 8b 45 14 mov 0x14(%ebp),%eax 800394: 8d 78 04 lea 0x4(%eax),%edi 800397: 8b 00 mov (%eax),%eax 800399: 99 cltd 80039a: 31 d0 xor %edx,%eax 80039c: 29 d0 sub %edx,%eax if (err >= MAXERROR || (p = error_string[err]) == NULL) 80039e: 83 f8 0f cmp $0xf,%eax 8003a1: 7f 23 jg 8003c6 <vprintfmt+0x13b> 8003a3: 8b 14 85 00 14 80 00 mov 0x801400(,%eax,4),%edx 8003aa: 85 d2 test %edx,%edx 8003ac: 74 18 je 8003c6 <vprintfmt+0x13b> printfmt(putch, putdat, "%s", p); 8003ae: 52 push %edx 8003af: 68 73 11 80 00 push $0x801173 8003b4: 53 push %ebx 8003b5: 56 push %esi 8003b6: e8 b3 fe ff ff call 80026e <printfmt> 8003bb: 83 c4 10 add $0x10,%esp err = va_arg(ap, int); 8003be: 89 7d 14 mov %edi,0x14(%ebp) 8003c1: e9 9a 02 00 00 jmp 800660 <vprintfmt+0x3d5> printfmt(putch, putdat, "error %d", err); 8003c6: 50 push %eax 8003c7: 68 6a 11 80 00 push $0x80116a 8003cc: 53 push %ebx 8003cd: 56 push %esi 8003ce: e8 9b fe ff ff call 80026e <printfmt> 8003d3: 83 c4 10 add $0x10,%esp err = va_arg(ap, int); 8003d6: 89 7d 14 mov %edi,0x14(%ebp) printfmt(putch, putdat, "error %d", err); 8003d9: e9 82 02 00 00 jmp 800660 <vprintfmt+0x3d5> if ((p = va_arg(ap, char *)) == NULL) 8003de: 8b 45 14 mov 0x14(%ebp),%eax 8003e1: 83 c0 04 add $0x4,%eax 8003e4: 89 45 cc mov %eax,-0x34(%ebp) 8003e7: 8b 45 14 mov 0x14(%ebp),%eax 8003ea: 8b 38 mov (%eax),%edi p = "(null)"; 8003ec: 85 ff test %edi,%edi 8003ee: b8 63 11 80 00 mov $0x801163,%eax 8003f3: 0f 44 f8 cmove %eax,%edi if (width > 0 && padc != '-') 8003f6: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 8003fa: 0f 8e bd 00 00 00 jle 8004bd <vprintfmt+0x232> 800400: 80 7d d4 2d cmpb $0x2d,-0x2c(%ebp) 800404: 75 0e jne 800414 <vprintfmt+0x189> 800406: 89 75 08 mov %esi,0x8(%ebp) 800409: 8b 75 d0 mov -0x30(%ebp),%esi 80040c: 89 5d 0c mov %ebx,0xc(%ebp) 80040f: 8b 5d e0 mov -0x20(%ebp),%ebx 800412: eb 6d jmp 800481 <vprintfmt+0x1f6> for (width -= strnlen(p, precision); width > 0; width--) 800414: 83 ec 08 sub $0x8,%esp 800417: ff 75 d0 pushl -0x30(%ebp) 80041a: 57 push %edi 80041b: e8 6e 03 00 00 call 80078e <strnlen> 800420: 8b 4d e0 mov -0x20(%ebp),%ecx 800423: 29 c1 sub %eax,%ecx 800425: 89 4d c8 mov %ecx,-0x38(%ebp) 800428: 83 c4 10 add $0x10,%esp putch(padc, putdat); 80042b: 0f be 45 d4 movsbl -0x2c(%ebp),%eax 80042f: 89 45 e0 mov %eax,-0x20(%ebp) 800432: 89 7d d4 mov %edi,-0x2c(%ebp) 800435: 89 cf mov %ecx,%edi for (width -= strnlen(p, precision); width > 0; width--) 800437: eb 0f jmp 800448 <vprintfmt+0x1bd> putch(padc, putdat); 800439: 83 ec 08 sub $0x8,%esp 80043c: 53 push %ebx 80043d: ff 75 e0 pushl -0x20(%ebp) 800440: ff d6 call *%esi for (width -= strnlen(p, precision); width > 0; width--) 800442: 83 ef 01 sub $0x1,%edi 800445: 83 c4 10 add $0x10,%esp 800448: 85 ff test %edi,%edi 80044a: 7f ed jg 800439 <vprintfmt+0x1ae> 80044c: 8b 7d d4 mov -0x2c(%ebp),%edi 80044f: 8b 4d c8 mov -0x38(%ebp),%ecx 800452: 85 c9 test %ecx,%ecx 800454: b8 00 00 00 00 mov $0x0,%eax 800459: 0f 49 c1 cmovns %ecx,%eax 80045c: 29 c1 sub %eax,%ecx 80045e: 89 75 08 mov %esi,0x8(%ebp) 800461: 8b 75 d0 mov -0x30(%ebp),%esi 800464: 89 5d 0c mov %ebx,0xc(%ebp) 800467: 89 cb mov %ecx,%ebx 800469: eb 16 jmp 800481 <vprintfmt+0x1f6> if (altflag && (ch < ' ' || ch > '~')) 80046b: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 80046f: 75 31 jne 8004a2 <vprintfmt+0x217> putch(ch, putdat); 800471: 83 ec 08 sub $0x8,%esp 800474: ff 75 0c pushl 0xc(%ebp) 800477: 50 push %eax 800478: ff 55 08 call *0x8(%ebp) 80047b: 83 c4 10 add $0x10,%esp for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--) 80047e: 83 eb 01 sub $0x1,%ebx 800481: 83 c7 01 add $0x1,%edi 800484: 0f b6 57 ff movzbl -0x1(%edi),%edx 800488: 0f be c2 movsbl %dl,%eax 80048b: 85 c0 test %eax,%eax 80048d: 74 59 je 8004e8 <vprintfmt+0x25d> 80048f: 85 f6 test %esi,%esi 800491: 78 d8 js 80046b <vprintfmt+0x1e0> 800493: 83 ee 01 sub $0x1,%esi 800496: 79 d3 jns 80046b <vprintfmt+0x1e0> 800498: 89 df mov %ebx,%edi 80049a: 8b 75 08 mov 0x8(%ebp),%esi 80049d: 8b 5d 0c mov 0xc(%ebp),%ebx 8004a0: eb 37 jmp 8004d9 <vprintfmt+0x24e> if (altflag && (ch < ' ' || ch > '~')) 8004a2: 0f be d2 movsbl %dl,%edx 8004a5: 83 ea 20 sub $0x20,%edx 8004a8: 83 fa 5e cmp $0x5e,%edx 8004ab: 76 c4 jbe 800471 <vprintfmt+0x1e6> putch('?', putdat); 8004ad: 83 ec 08 sub $0x8,%esp 8004b0: ff 75 0c pushl 0xc(%ebp) 8004b3: 6a 3f push $0x3f 8004b5: ff 55 08 call *0x8(%ebp) 8004b8: 83 c4 10 add $0x10,%esp 8004bb: eb c1 jmp 80047e <vprintfmt+0x1f3> 8004bd: 89 75 08 mov %esi,0x8(%ebp) 8004c0: 8b 75 d0 mov -0x30(%ebp),%esi 8004c3: 89 5d 0c mov %ebx,0xc(%ebp) 8004c6: 8b 5d e0 mov -0x20(%ebp),%ebx 8004c9: eb b6 jmp 800481 <vprintfmt+0x1f6> putch(' ', putdat); 8004cb: 83 ec 08 sub $0x8,%esp 8004ce: 53 push %ebx 8004cf: 6a 20 push $0x20 8004d1: ff d6 call *%esi for (; width > 0; width--) 8004d3: 83 ef 01 sub $0x1,%edi 8004d6: 83 c4 10 add $0x10,%esp 8004d9: 85 ff test %edi,%edi 8004db: 7f ee jg 8004cb <vprintfmt+0x240> if ((p = va_arg(ap, char *)) == NULL) 8004dd: 8b 45 cc mov -0x34(%ebp),%eax 8004e0: 89 45 14 mov %eax,0x14(%ebp) 8004e3: e9 78 01 00 00 jmp 800660 <vprintfmt+0x3d5> 8004e8: 89 df mov %ebx,%edi 8004ea: 8b 75 08 mov 0x8(%ebp),%esi 8004ed: 8b 5d 0c mov 0xc(%ebp),%ebx 8004f0: eb e7 jmp 8004d9 <vprintfmt+0x24e> if (lflag >= 2) 8004f2: 83 f9 01 cmp $0x1,%ecx 8004f5: 7e 3f jle 800536 <vprintfmt+0x2ab> return va_arg(*ap, long long); 8004f7: 8b 45 14 mov 0x14(%ebp),%eax 8004fa: 8b 50 04 mov 0x4(%eax),%edx 8004fd: 8b 00 mov (%eax),%eax 8004ff: 89 45 d8 mov %eax,-0x28(%ebp) 800502: 89 55 dc mov %edx,-0x24(%ebp) 800505: 8b 45 14 mov 0x14(%ebp),%eax 800508: 8d 40 08 lea 0x8(%eax),%eax 80050b: 89 45 14 mov %eax,0x14(%ebp) if ((long long) num < 0) { 80050e: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) 800512: 79 5c jns 800570 <vprintfmt+0x2e5> putch('-', putdat); 800514: 83 ec 08 sub $0x8,%esp 800517: 53 push %ebx 800518: 6a 2d push $0x2d 80051a: ff d6 call *%esi num = -(long long) num; 80051c: 8b 55 d8 mov -0x28(%ebp),%edx 80051f: 8b 4d dc mov -0x24(%ebp),%ecx 800522: f7 da neg %edx 800524: 83 d1 00 adc $0x0,%ecx 800527: f7 d9 neg %ecx 800529: 83 c4 10 add $0x10,%esp base = 10; 80052c: b8 0a 00 00 00 mov $0xa,%eax 800531: e9 10 01 00 00 jmp 800646 <vprintfmt+0x3bb> else if (lflag) 800536: 85 c9 test %ecx,%ecx 800538: 75 1b jne 800555 <vprintfmt+0x2ca> return va_arg(*ap, int); 80053a: 8b 45 14 mov 0x14(%ebp),%eax 80053d: 8b 00 mov (%eax),%eax 80053f: 89 45 d8 mov %eax,-0x28(%ebp) 800542: 89 c1 mov %eax,%ecx 800544: c1 f9 1f sar $0x1f,%ecx 800547: 89 4d dc mov %ecx,-0x24(%ebp) 80054a: 8b 45 14 mov 0x14(%ebp),%eax 80054d: 8d 40 04 lea 0x4(%eax),%eax 800550: 89 45 14 mov %eax,0x14(%ebp) 800553: eb b9 jmp 80050e <vprintfmt+0x283> return va_arg(*ap, long); 800555: 8b 45 14 mov 0x14(%ebp),%eax 800558: 8b 00 mov (%eax),%eax 80055a: 89 45 d8 mov %eax,-0x28(%ebp) 80055d: 89 c1 mov %eax,%ecx 80055f: c1 f9 1f sar $0x1f,%ecx 800562: 89 4d dc mov %ecx,-0x24(%ebp) 800565: 8b 45 14 mov 0x14(%ebp),%eax 800568: 8d 40 04 lea 0x4(%eax),%eax 80056b: 89 45 14 mov %eax,0x14(%ebp) 80056e: eb 9e jmp 80050e <vprintfmt+0x283> num = getint(&ap, lflag); 800570: 8b 55 d8 mov -0x28(%ebp),%edx 800573: 8b 4d dc mov -0x24(%ebp),%ecx base = 10; 800576: b8 0a 00 00 00 mov $0xa,%eax 80057b: e9 c6 00 00 00 jmp 800646 <vprintfmt+0x3bb> if (lflag >= 2) 800580: 83 f9 01 cmp $0x1,%ecx 800583: 7e 18 jle 80059d <vprintfmt+0x312> return va_arg(*ap, unsigned long long); 800585: 8b 45 14 mov 0x14(%ebp),%eax 800588: 8b 10 mov (%eax),%edx 80058a: 8b 48 04 mov 0x4(%eax),%ecx 80058d: 8d 40 08 lea 0x8(%eax),%eax 800590: 89 45 14 mov %eax,0x14(%ebp) base = 10; 800593: b8 0a 00 00 00 mov $0xa,%eax 800598: e9 a9 00 00 00 jmp 800646 <vprintfmt+0x3bb> else if (lflag) 80059d: 85 c9 test %ecx,%ecx 80059f: 75 1a jne 8005bb <vprintfmt+0x330> return va_arg(*ap, unsigned int); 8005a1: 8b 45 14 mov 0x14(%ebp),%eax 8005a4: 8b 10 mov (%eax),%edx 8005a6: b9 00 00 00 00 mov $0x0,%ecx 8005ab: 8d 40 04 lea 0x4(%eax),%eax 8005ae: 89 45 14 mov %eax,0x14(%ebp) base = 10; 8005b1: b8 0a 00 00 00 mov $0xa,%eax 8005b6: e9 8b 00 00 00 jmp 800646 <vprintfmt+0x3bb> return va_arg(*ap, unsigned long); 8005bb: 8b 45 14 mov 0x14(%ebp),%eax 8005be: 8b 10 mov (%eax),%edx 8005c0: b9 00 00 00 00 mov $0x0,%ecx 8005c5: 8d 40 04 lea 0x4(%eax),%eax 8005c8: 89 45 14 mov %eax,0x14(%ebp) base = 10; 8005cb: b8 0a 00 00 00 mov $0xa,%eax 8005d0: eb 74 jmp 800646 <vprintfmt+0x3bb> if (lflag >= 2) 8005d2: 83 f9 01 cmp $0x1,%ecx 8005d5: 7e 15 jle 8005ec <vprintfmt+0x361> return va_arg(*ap, unsigned long long); 8005d7: 8b 45 14 mov 0x14(%ebp),%eax 8005da: 8b 10 mov (%eax),%edx 8005dc: 8b 48 04 mov 0x4(%eax),%ecx 8005df: 8d 40 08 lea 0x8(%eax),%eax 8005e2: 89 45 14 mov %eax,0x14(%ebp) base = 8; 8005e5: b8 08 00 00 00 mov $0x8,%eax 8005ea: eb 5a jmp 800646 <vprintfmt+0x3bb> else if (lflag) 8005ec: 85 c9 test %ecx,%ecx 8005ee: 75 17 jne 800607 <vprintfmt+0x37c> return va_arg(*ap, unsigned int); 8005f0: 8b 45 14 mov 0x14(%ebp),%eax 8005f3: 8b 10 mov (%eax),%edx 8005f5: b9 00 00 00 00 mov $0x0,%ecx 8005fa: 8d 40 04 lea 0x4(%eax),%eax 8005fd: 89 45 14 mov %eax,0x14(%ebp) base = 8; 800600: b8 08 00 00 00 mov $0x8,%eax 800605: eb 3f jmp 800646 <vprintfmt+0x3bb> return va_arg(*ap, unsigned long); 800607: 8b 45 14 mov 0x14(%ebp),%eax 80060a: 8b 10 mov (%eax),%edx 80060c: b9 00 00 00 00 mov $0x0,%ecx 800611: 8d 40 04 lea 0x4(%eax),%eax 800614: 89 45 14 mov %eax,0x14(%ebp) base = 8; 800617: b8 08 00 00 00 mov $0x8,%eax 80061c: eb 28 jmp 800646 <vprintfmt+0x3bb> putch('0', putdat); 80061e: 83 ec 08 sub $0x8,%esp 800621: 53 push %ebx 800622: 6a 30 push $0x30 800624: ff d6 call *%esi putch('x', putdat); 800626: 83 c4 08 add $0x8,%esp 800629: 53 push %ebx 80062a: 6a 78 push $0x78 80062c: ff d6 call *%esi num = (unsigned long long) 80062e: 8b 45 14 mov 0x14(%ebp),%eax 800631: 8b 10 mov (%eax),%edx 800633: b9 00 00 00 00 mov $0x0,%ecx goto number; 800638: 83 c4 10 add $0x10,%esp (uintptr_t) va_arg(ap, void *); 80063b: 8d 40 04 lea 0x4(%eax),%eax 80063e: 89 45 14 mov %eax,0x14(%ebp) base = 16; 800641: b8 10 00 00 00 mov $0x10,%eax printnum(putch, putdat, num, base, width, padc); 800646: 83 ec 0c sub $0xc,%esp 800649: 0f be 7d d4 movsbl -0x2c(%ebp),%edi 80064d: 57 push %edi 80064e: ff 75 e0 pushl -0x20(%ebp) 800651: 50 push %eax 800652: 51 push %ecx 800653: 52 push %edx 800654: 89 da mov %ebx,%edx 800656: 89 f0 mov %esi,%eax 800658: e8 45 fb ff ff call 8001a2 <printnum> break; 80065d: 83 c4 20 add $0x20,%esp err = va_arg(ap, int); 800660: 8b 7d e4 mov -0x1c(%ebp),%edi while ((ch = *(unsigned char *) fmt++) != '%') { //先将非格式化字符输出到控制台。 800663: 83 c7 01 add $0x1,%edi 800666: 0f b6 47 ff movzbl -0x1(%edi),%eax 80066a: 83 f8 25 cmp $0x25,%eax 80066d: 0f 84 2f fc ff ff je 8002a2 <vprintfmt+0x17> if (ch == '\0') //如果没有格式化字符直接返回 800673: 85 c0 test %eax,%eax 800675: 0f 84 8b 00 00 00 je 800706 <vprintfmt+0x47b> putch(ch, putdat); 80067b: 83 ec 08 sub $0x8,%esp 80067e: 53 push %ebx 80067f: 50 push %eax 800680: ff d6 call *%esi 800682: 83 c4 10 add $0x10,%esp 800685: eb dc jmp 800663 <vprintfmt+0x3d8> if (lflag >= 2) 800687: 83 f9 01 cmp $0x1,%ecx 80068a: 7e 15 jle 8006a1 <vprintfmt+0x416> return va_arg(*ap, unsigned long long); 80068c: 8b 45 14 mov 0x14(%ebp),%eax 80068f: 8b 10 mov (%eax),%edx 800691: 8b 48 04 mov 0x4(%eax),%ecx 800694: 8d 40 08 lea 0x8(%eax),%eax 800697: 89 45 14 mov %eax,0x14(%ebp) base = 16; 80069a: b8 10 00 00 00 mov $0x10,%eax 80069f: eb a5 jmp 800646 <vprintfmt+0x3bb> else if (lflag) 8006a1: 85 c9 test %ecx,%ecx 8006a3: 75 17 jne 8006bc <vprintfmt+0x431> return va_arg(*ap, unsigned int); 8006a5: 8b 45 14 mov 0x14(%ebp),%eax 8006a8: 8b 10 mov (%eax),%edx 8006aa: b9 00 00 00 00 mov $0x0,%ecx 8006af: 8d 40 04 lea 0x4(%eax),%eax 8006b2: 89 45 14 mov %eax,0x14(%ebp) base = 16; 8006b5: b8 10 00 00 00 mov $0x10,%eax 8006ba: eb 8a jmp 800646 <vprintfmt+0x3bb> return va_arg(*ap, unsigned long); 8006bc: 8b 45 14 mov 0x14(%ebp),%eax 8006bf: 8b 10 mov (%eax),%edx 8006c1: b9 00 00 00 00 mov $0x0,%ecx 8006c6: 8d 40 04 lea 0x4(%eax),%eax 8006c9: 89 45 14 mov %eax,0x14(%ebp) base = 16; 8006cc: b8 10 00 00 00 mov $0x10,%eax 8006d1: e9 70 ff ff ff jmp 800646 <vprintfmt+0x3bb> putch(ch, putdat); 8006d6: 83 ec 08 sub $0x8,%esp 8006d9: 53 push %ebx 8006da: 6a 25 push $0x25 8006dc: ff d6 call *%esi break; 8006de: 83 c4 10 add $0x10,%esp 8006e1: e9 7a ff ff ff jmp 800660 <vprintfmt+0x3d5> putch('%', putdat); 8006e6: 83 ec 08 sub $0x8,%esp 8006e9: 53 push %ebx 8006ea: 6a 25 push $0x25 8006ec: ff d6 call *%esi for (fmt--; fmt[-1] != '%'; fmt--) 8006ee: 83 c4 10 add $0x10,%esp 8006f1: 89 f8 mov %edi,%eax 8006f3: eb 03 jmp 8006f8 <vprintfmt+0x46d> 8006f5: 83 e8 01 sub $0x1,%eax 8006f8: 80 78 ff 25 cmpb $0x25,-0x1(%eax) 8006fc: 75 f7 jne 8006f5 <vprintfmt+0x46a> 8006fe: 89 45 e4 mov %eax,-0x1c(%ebp) 800701: e9 5a ff ff ff jmp 800660 <vprintfmt+0x3d5> } 800706: 8d 65 f4 lea -0xc(%ebp),%esp 800709: 5b pop %ebx 80070a: 5e pop %esi 80070b: 5f pop %edi 80070c: 5d pop %ebp 80070d: c3 ret 0080070e <vsnprintf>: int vsnprintf(char *buf, int n, const char *fmt, va_list ap) { 80070e: 55 push %ebp 80070f: 89 e5 mov %esp,%ebp 800711: 83 ec 18 sub $0x18,%esp 800714: 8b 45 08 mov 0x8(%ebp),%eax 800717: 8b 55 0c mov 0xc(%ebp),%edx struct sprintbuf b = {buf, buf+n-1, 0}; 80071a: 89 45 ec mov %eax,-0x14(%ebp) 80071d: 8d 4c 10 ff lea -0x1(%eax,%edx,1),%ecx 800721: 89 4d f0 mov %ecx,-0x10(%ebp) 800724: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if (buf == NULL || n < 1) 80072b: 85 c0 test %eax,%eax 80072d: 74 26 je 800755 <vsnprintf+0x47> 80072f: 85 d2 test %edx,%edx 800731: 7e 22 jle 800755 <vsnprintf+0x47> return -E_INVAL; // print the string to the buffer vprintfmt((void*)sprintputch, &b, fmt, ap); 800733: ff 75 14 pushl 0x14(%ebp) 800736: ff 75 10 pushl 0x10(%ebp) 800739: 8d 45 ec lea -0x14(%ebp),%eax 80073c: 50 push %eax 80073d: 68 51 02 80 00 push $0x800251 800742: e8 44 fb ff ff call 80028b <vprintfmt> // null terminate the buffer *b.buf = '\0'; 800747: 8b 45 ec mov -0x14(%ebp),%eax 80074a: c6 00 00 movb $0x0,(%eax) return b.cnt; 80074d: 8b 45 f4 mov -0xc(%ebp),%eax 800750: 83 c4 10 add $0x10,%esp } 800753: c9 leave 800754: c3 ret return -E_INVAL; 800755: b8 fd ff ff ff mov $0xfffffffd,%eax 80075a: eb f7 jmp 800753 <vsnprintf+0x45> 0080075c <snprintf>: int snprintf(char *buf, int n, const char *fmt, ...) { 80075c: 55 push %ebp 80075d: 89 e5 mov %esp,%ebp 80075f: 83 ec 08 sub $0x8,%esp va_list ap; int rc; va_start(ap, fmt); 800762: 8d 45 14 lea 0x14(%ebp),%eax rc = vsnprintf(buf, n, fmt, ap); 800765: 50 push %eax 800766: ff 75 10 pushl 0x10(%ebp) 800769: ff 75 0c pushl 0xc(%ebp) 80076c: ff 75 08 pushl 0x8(%ebp) 80076f: e8 9a ff ff ff call 80070e <vsnprintf> va_end(ap); return rc; } 800774: c9 leave 800775: c3 ret 00800776 <strlen>: // Primespipe runs 3x faster this way. #define ASM 1 int strlen(const char *s) { 800776: 55 push %ebp 800777: 89 e5 mov %esp,%ebp 800779: 8b 55 08 mov 0x8(%ebp),%edx int n; for (n = 0; *s != '\0'; s++) 80077c: b8 00 00 00 00 mov $0x0,%eax 800781: eb 03 jmp 800786 <strlen+0x10> n++; 800783: 83 c0 01 add $0x1,%eax for (n = 0; *s != '\0'; s++) 800786: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) 80078a: 75 f7 jne 800783 <strlen+0xd> return n; } 80078c: 5d pop %ebp 80078d: c3 ret 0080078e <strnlen>: int strnlen(const char *s, size_t size) { 80078e: 55 push %ebp 80078f: 89 e5 mov %esp,%ebp 800791: 8b 4d 08 mov 0x8(%ebp),%ecx 800794: 8b 55 0c mov 0xc(%ebp),%edx int n; for (n = 0; size > 0 && *s != '\0'; s++, size--) 800797: b8 00 00 00 00 mov $0x0,%eax 80079c: eb 03 jmp 8007a1 <strnlen+0x13> n++; 80079e: 83 c0 01 add $0x1,%eax for (n = 0; size > 0 && *s != '\0'; s++, size--) 8007a1: 39 d0 cmp %edx,%eax 8007a3: 74 06 je 8007ab <strnlen+0x1d> 8007a5: 80 3c 01 00 cmpb $0x0,(%ecx,%eax,1) 8007a9: 75 f3 jne 80079e <strnlen+0x10> return n; } 8007ab: 5d pop %ebp 8007ac: c3 ret 008007ad <strcpy>: char * strcpy(char *dst, const char *src) { 8007ad: 55 push %ebp 8007ae: 89 e5 mov %esp,%ebp 8007b0: 53 push %ebx 8007b1: 8b 45 08 mov 0x8(%ebp),%eax 8007b4: 8b 4d 0c mov 0xc(%ebp),%ecx char *ret; ret = dst; while ((*dst++ = *src++) != '\0') 8007b7: 89 c2 mov %eax,%edx 8007b9: 83 c1 01 add $0x1,%ecx 8007bc: 83 c2 01 add $0x1,%edx 8007bf: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 8007c3: 88 5a ff mov %bl,-0x1(%edx) 8007c6: 84 db test %bl,%bl 8007c8: 75 ef jne 8007b9 <strcpy+0xc> /* do nothing */; return ret; } 8007ca: 5b pop %ebx 8007cb: 5d pop %ebp 8007cc: c3 ret 008007cd <strcat>: char * strcat(char *dst, const char *src) { 8007cd: 55 push %ebp 8007ce: 89 e5 mov %esp,%ebp 8007d0: 53 push %ebx 8007d1: 8b 5d 08 mov 0x8(%ebp),%ebx int len = strlen(dst); 8007d4: 53 push %ebx 8007d5: e8 9c ff ff ff call 800776 <strlen> 8007da: 83 c4 04 add $0x4,%esp strcpy(dst + len, src); 8007dd: ff 75 0c pushl 0xc(%ebp) 8007e0: 01 d8 add %ebx,%eax 8007e2: 50 push %eax 8007e3: e8 c5 ff ff ff call 8007ad <strcpy> return dst; } 8007e8: 89 d8 mov %ebx,%eax 8007ea: 8b 5d fc mov -0x4(%ebp),%ebx 8007ed: c9 leave 8007ee: c3 ret 008007ef <strncpy>: char * strncpy(char *dst, const char *src, size_t size) { 8007ef: 55 push %ebp 8007f0: 89 e5 mov %esp,%ebp 8007f2: 56 push %esi 8007f3: 53 push %ebx 8007f4: 8b 75 08 mov 0x8(%ebp),%esi 8007f7: 8b 4d 0c mov 0xc(%ebp),%ecx 8007fa: 89 f3 mov %esi,%ebx 8007fc: 03 5d 10 add 0x10(%ebp),%ebx size_t i; char *ret; ret = dst; for (i = 0; i < size; i++) { 8007ff: 89 f2 mov %esi,%edx 800801: eb 0f jmp 800812 <strncpy+0x23> *dst++ = *src; 800803: 83 c2 01 add $0x1,%edx 800806: 0f b6 01 movzbl (%ecx),%eax 800809: 88 42 ff mov %al,-0x1(%edx) // If strlen(src) < size, null-pad 'dst' out to 'size' chars if (*src != '\0') src++; 80080c: 80 39 01 cmpb $0x1,(%ecx) 80080f: 83 d9 ff sbb $0xffffffff,%ecx for (i = 0; i < size; i++) { 800812: 39 da cmp %ebx,%edx 800814: 75 ed jne 800803 <strncpy+0x14> } return ret; } 800816: 89 f0 mov %esi,%eax 800818: 5b pop %ebx 800819: 5e pop %esi 80081a: 5d pop %ebp 80081b: c3 ret 0080081c <strlcpy>: size_t strlcpy(char *dst, const char *src, size_t size) { 80081c: 55 push %ebp 80081d: 89 e5 mov %esp,%ebp 80081f: 56 push %esi 800820: 53 push %ebx 800821: 8b 75 08 mov 0x8(%ebp),%esi 800824: 8b 55 0c mov 0xc(%ebp),%edx 800827: 8b 4d 10 mov 0x10(%ebp),%ecx 80082a: 89 f0 mov %esi,%eax 80082c: 8d 5c 0e ff lea -0x1(%esi,%ecx,1),%ebx char *dst_in; dst_in = dst; if (size > 0) { 800830: 85 c9 test %ecx,%ecx 800832: 75 0b jne 80083f <strlcpy+0x23> 800834: eb 17 jmp 80084d <strlcpy+0x31> while (--size > 0 && *src != '\0') *dst++ = *src++; 800836: 83 c2 01 add $0x1,%edx 800839: 83 c0 01 add $0x1,%eax 80083c: 88 48 ff mov %cl,-0x1(%eax) while (--size > 0 && *src != '\0') 80083f: 39 d8 cmp %ebx,%eax 800841: 74 07 je 80084a <strlcpy+0x2e> 800843: 0f b6 0a movzbl (%edx),%ecx 800846: 84 c9 test %cl,%cl 800848: 75 ec jne 800836 <strlcpy+0x1a> *dst = '\0'; 80084a: c6 00 00 movb $0x0,(%eax) } return dst - dst_in; 80084d: 29 f0 sub %esi,%eax } 80084f: 5b pop %ebx 800850: 5e pop %esi 800851: 5d pop %ebp 800852: c3 ret 00800853 <strcmp>: int strcmp(const char *p, const char *q) { 800853: 55 push %ebp 800854: 89 e5 mov %esp,%ebp 800856: 8b 4d 08 mov 0x8(%ebp),%ecx 800859: 8b 55 0c mov 0xc(%ebp),%edx while (*p && *p == *q) 80085c: eb 06 jmp 800864 <strcmp+0x11> p++, q++; 80085e: 83 c1 01 add $0x1,%ecx 800861: 83 c2 01 add $0x1,%edx while (*p && *p == *q) 800864: 0f b6 01 movzbl (%ecx),%eax 800867: 84 c0 test %al,%al 800869: 74 04 je 80086f <strcmp+0x1c> 80086b: 3a 02 cmp (%edx),%al 80086d: 74 ef je 80085e <strcmp+0xb> return (int) ((unsigned char) *p - (unsigned char) *q); 80086f: 0f b6 c0 movzbl %al,%eax 800872: 0f b6 12 movzbl (%edx),%edx 800875: 29 d0 sub %edx,%eax } 800877: 5d pop %ebp 800878: c3 ret 00800879 <strncmp>: int strncmp(const char *p, const char *q, size_t n) { 800879: 55 push %ebp 80087a: 89 e5 mov %esp,%ebp 80087c: 53 push %ebx 80087d: 8b 45 08 mov 0x8(%ebp),%eax 800880: 8b 55 0c mov 0xc(%ebp),%edx 800883: 89 c3 mov %eax,%ebx 800885: 03 5d 10 add 0x10(%ebp),%ebx while (n > 0 && *p && *p == *q) 800888: eb 06 jmp 800890 <strncmp+0x17> n--, p++, q++; 80088a: 83 c0 01 add $0x1,%eax 80088d: 83 c2 01 add $0x1,%edx while (n > 0 && *p && *p == *q) 800890: 39 d8 cmp %ebx,%eax 800892: 74 16 je 8008aa <strncmp+0x31> 800894: 0f b6 08 movzbl (%eax),%ecx 800897: 84 c9 test %cl,%cl 800899: 74 04 je 80089f <strncmp+0x26> 80089b: 3a 0a cmp (%edx),%cl 80089d: 74 eb je 80088a <strncmp+0x11> if (n == 0) return 0; else return (int) ((unsigned char) *p - (unsigned char) *q); 80089f: 0f b6 00 movzbl (%eax),%eax 8008a2: 0f b6 12 movzbl (%edx),%edx 8008a5: 29 d0 sub %edx,%eax } 8008a7: 5b pop %ebx 8008a8: 5d pop %ebp 8008a9: c3 ret return 0; 8008aa: b8 00 00 00 00 mov $0x0,%eax 8008af: eb f6 jmp 8008a7 <strncmp+0x2e> 008008b1 <strchr>: // Return a pointer to the first occurrence of 'c' in 's', // or a null pointer if the string has no 'c'. char * strchr(const char *s, char c) { 8008b1: 55 push %ebp 8008b2: 89 e5 mov %esp,%ebp 8008b4: 8b 45 08 mov 0x8(%ebp),%eax 8008b7: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for (; *s; s++) 8008bb: 0f b6 10 movzbl (%eax),%edx 8008be: 84 d2 test %dl,%dl 8008c0: 74 09 je 8008cb <strchr+0x1a> if (*s == c) 8008c2: 38 ca cmp %cl,%dl 8008c4: 74 0a je 8008d0 <strchr+0x1f> for (; *s; s++) 8008c6: 83 c0 01 add $0x1,%eax 8008c9: eb f0 jmp 8008bb <strchr+0xa> return (char *) s; return 0; 8008cb: b8 00 00 00 00 mov $0x0,%eax } 8008d0: 5d pop %ebp 8008d1: c3 ret 008008d2 <strfind>: // Return a pointer to the first occurrence of 'c' in 's', // or a pointer to the string-ending null character if the string has no 'c'. char * strfind(const char *s, char c) { 8008d2: 55 push %ebp 8008d3: 89 e5 mov %esp,%ebp 8008d5: 8b 45 08 mov 0x8(%ebp),%eax 8008d8: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for (; *s; s++) 8008dc: eb 03 jmp 8008e1 <strfind+0xf> 8008de: 83 c0 01 add $0x1,%eax 8008e1: 0f b6 10 movzbl (%eax),%edx if (*s == c) 8008e4: 38 ca cmp %cl,%dl 8008e6: 74 04 je 8008ec <strfind+0x1a> 8008e8: 84 d2 test %dl,%dl 8008ea: 75 f2 jne 8008de <strfind+0xc> break; return (char *) s; } 8008ec: 5d pop %ebp 8008ed: c3 ret 008008ee <memset>: #if ASM void * memset(void *v, int c, size_t n) { 8008ee: 55 push %ebp 8008ef: 89 e5 mov %esp,%ebp 8008f1: 57 push %edi 8008f2: 56 push %esi 8008f3: 53 push %ebx 8008f4: 8b 7d 08 mov 0x8(%ebp),%edi 8008f7: 8b 4d 10 mov 0x10(%ebp),%ecx char *p; if (n == 0) 8008fa: 85 c9 test %ecx,%ecx 8008fc: 74 13 je 800911 <memset+0x23> return v; if ((int)v%4 == 0 && n%4 == 0) { 8008fe: f7 c7 03 00 00 00 test $0x3,%edi 800904: 75 05 jne 80090b <memset+0x1d> 800906: f6 c1 03 test $0x3,%cl 800909: 74 0d je 800918 <memset+0x2a> c = (c<<24)|(c<<16)|(c<<8)|c; asm volatile("cld; rep stosl\n" :: "D" (v), "a" (c), "c" (n/4) : "cc", "memory"); } else asm volatile("cld; rep stosb\n" 80090b: 8b 45 0c mov 0xc(%ebp),%eax 80090e: fc cld 80090f: f3 aa rep stos %al,%es:(%edi) :: "D" (v), "a" (c), "c" (n) : "cc", "memory"); return v; } 800911: 89 f8 mov %edi,%eax 800913: 5b pop %ebx 800914: 5e pop %esi 800915: 5f pop %edi 800916: 5d pop %ebp 800917: c3 ret c &= 0xFF; 800918: 0f b6 55 0c movzbl 0xc(%ebp),%edx c = (c<<24)|(c<<16)|(c<<8)|c; 80091c: 89 d3 mov %edx,%ebx 80091e: c1 e3 08 shl $0x8,%ebx 800921: 89 d0 mov %edx,%eax 800923: c1 e0 18 shl $0x18,%eax 800926: 89 d6 mov %edx,%esi 800928: c1 e6 10 shl $0x10,%esi 80092b: 09 f0 or %esi,%eax 80092d: 09 c2 or %eax,%edx 80092f: 09 da or %ebx,%edx :: "D" (v), "a" (c), "c" (n/4) 800931: c1 e9 02 shr $0x2,%ecx asm volatile("cld; rep stosl\n" 800934: 89 d0 mov %edx,%eax 800936: fc cld 800937: f3 ab rep stos %eax,%es:(%edi) 800939: eb d6 jmp 800911 <memset+0x23> 0080093b <memmove>: void * memmove(void *dst, const void *src, size_t n) { 80093b: 55 push %ebp 80093c: 89 e5 mov %esp,%ebp 80093e: 57 push %edi 80093f: 56 push %esi 800940: 8b 45 08 mov 0x8(%ebp),%eax 800943: 8b 75 0c mov 0xc(%ebp),%esi 800946: 8b 4d 10 mov 0x10(%ebp),%ecx const char *s; char *d; s = src; d = dst; if (s < d && s + n > d) { 800949: 39 c6 cmp %eax,%esi 80094b: 73 35 jae 800982 <memmove+0x47> 80094d: 8d 14 0e lea (%esi,%ecx,1),%edx 800950: 39 c2 cmp %eax,%edx 800952: 76 2e jbe 800982 <memmove+0x47> s += n; d += n; 800954: 8d 3c 08 lea (%eax,%ecx,1),%edi if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 800957: 89 d6 mov %edx,%esi 800959: 09 fe or %edi,%esi 80095b: f7 c6 03 00 00 00 test $0x3,%esi 800961: 74 0c je 80096f <memmove+0x34> asm volatile("std; rep movsl\n" :: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory"); else asm volatile("std; rep movsb\n" :: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory"); 800963: 83 ef 01 sub $0x1,%edi 800966: 8d 72 ff lea -0x1(%edx),%esi asm volatile("std; rep movsb\n" 800969: fd std 80096a: f3 a4 rep movsb %ds:(%esi),%es:(%edi) // Some versions of GCC rely on DF being clear asm volatile("cld" ::: "cc"); 80096c: fc cld 80096d: eb 21 jmp 800990 <memmove+0x55> if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 80096f: f6 c1 03 test $0x3,%cl 800972: 75 ef jne 800963 <memmove+0x28> :: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory"); 800974: 83 ef 04 sub $0x4,%edi 800977: 8d 72 fc lea -0x4(%edx),%esi 80097a: c1 e9 02 shr $0x2,%ecx asm volatile("std; rep movsl\n" 80097d: fd std 80097e: f3 a5 rep movsl %ds:(%esi),%es:(%edi) 800980: eb ea jmp 80096c <memmove+0x31> } else { if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 800982: 89 f2 mov %esi,%edx 800984: 09 c2 or %eax,%edx 800986: f6 c2 03 test $0x3,%dl 800989: 74 09 je 800994 <memmove+0x59> asm volatile("cld; rep movsl\n" :: "D" (d), "S" (s), "c" (n/4) : "cc", "memory"); else asm volatile("cld; rep movsb\n" 80098b: 89 c7 mov %eax,%edi 80098d: fc cld 80098e: f3 a4 rep movsb %ds:(%esi),%es:(%edi) :: "D" (d), "S" (s), "c" (n) : "cc", "memory"); } return dst; } 800990: 5e pop %esi 800991: 5f pop %edi 800992: 5d pop %ebp 800993: c3 ret if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 800994: f6 c1 03 test $0x3,%cl 800997: 75 f2 jne 80098b <memmove+0x50> :: "D" (d), "S" (s), "c" (n/4) : "cc", "memory"); 800999: c1 e9 02 shr $0x2,%ecx asm volatile("cld; rep movsl\n" 80099c: 89 c7 mov %eax,%edi 80099e: fc cld 80099f: f3 a5 rep movsl %ds:(%esi),%es:(%edi) 8009a1: eb ed jmp 800990 <memmove+0x55> 008009a3 <memcpy>: } #endif void * memcpy(void *dst, const void *src, size_t n) { 8009a3: 55 push %ebp 8009a4: 89 e5 mov %esp,%ebp return memmove(dst, src, n); 8009a6: ff 75 10 pushl 0x10(%ebp) 8009a9: ff 75 0c pushl 0xc(%ebp) 8009ac: ff 75 08 pushl 0x8(%ebp) 8009af: e8 87 ff ff ff call 80093b <memmove> } 8009b4: c9 leave 8009b5: c3 ret 008009b6 <memcmp>: int memcmp(const void *v1, const void *v2, size_t n) { 8009b6: 55 push %ebp 8009b7: 89 e5 mov %esp,%ebp 8009b9: 56 push %esi 8009ba: 53 push %ebx 8009bb: 8b 45 08 mov 0x8(%ebp),%eax 8009be: 8b 55 0c mov 0xc(%ebp),%edx 8009c1: 89 c6 mov %eax,%esi 8009c3: 03 75 10 add 0x10(%ebp),%esi const uint8_t *s1 = (const uint8_t *) v1; const uint8_t *s2 = (const uint8_t *) v2; while (n-- > 0) { 8009c6: 39 f0 cmp %esi,%eax 8009c8: 74 1c je 8009e6 <memcmp+0x30> if (*s1 != *s2) 8009ca: 0f b6 08 movzbl (%eax),%ecx 8009cd: 0f b6 1a movzbl (%edx),%ebx 8009d0: 38 d9 cmp %bl,%cl 8009d2: 75 08 jne 8009dc <memcmp+0x26> return (int) *s1 - (int) *s2; s1++, s2++; 8009d4: 83 c0 01 add $0x1,%eax 8009d7: 83 c2 01 add $0x1,%edx 8009da: eb ea jmp 8009c6 <memcmp+0x10> return (int) *s1 - (int) *s2; 8009dc: 0f b6 c1 movzbl %cl,%eax 8009df: 0f b6 db movzbl %bl,%ebx 8009e2: 29 d8 sub %ebx,%eax 8009e4: eb 05 jmp 8009eb <memcmp+0x35> } return 0; 8009e6: b8 00 00 00 00 mov $0x0,%eax } 8009eb: 5b pop %ebx 8009ec: 5e pop %esi 8009ed: 5d pop %ebp 8009ee: c3 ret 008009ef <memfind>: void * memfind(const void *s, int c, size_t n) { 8009ef: 55 push %ebp 8009f0: 89 e5 mov %esp,%ebp 8009f2: 8b 45 08 mov 0x8(%ebp),%eax 8009f5: 8b 4d 0c mov 0xc(%ebp),%ecx const void *ends = (const char *) s + n; 8009f8: 89 c2 mov %eax,%edx 8009fa: 03 55 10 add 0x10(%ebp),%edx for (; s < ends; s++) 8009fd: 39 d0 cmp %edx,%eax 8009ff: 73 09 jae 800a0a <memfind+0x1b> if (*(const unsigned char *) s == (unsigned char) c) 800a01: 38 08 cmp %cl,(%eax) 800a03: 74 05 je 800a0a <memfind+0x1b> for (; s < ends; s++) 800a05: 83 c0 01 add $0x1,%eax 800a08: eb f3 jmp 8009fd <memfind+0xe> break; return (void *) s; } 800a0a: 5d pop %ebp 800a0b: c3 ret 00800a0c <strtol>: long strtol(const char *s, char **endptr, int base) { 800a0c: 55 push %ebp 800a0d: 89 e5 mov %esp,%ebp 800a0f: 57 push %edi 800a10: 56 push %esi 800a11: 53 push %ebx 800a12: 8b 4d 08 mov 0x8(%ebp),%ecx 800a15: 8b 5d 10 mov 0x10(%ebp),%ebx int neg = 0; long val = 0; // gobble initial whitespace while (*s == ' ' || *s == '\t') 800a18: eb 03 jmp 800a1d <strtol+0x11> s++; 800a1a: 83 c1 01 add $0x1,%ecx while (*s == ' ' || *s == '\t') 800a1d: 0f b6 01 movzbl (%ecx),%eax 800a20: 3c 20 cmp $0x20,%al 800a22: 74 f6 je 800a1a <strtol+0xe> 800a24: 3c 09 cmp $0x9,%al 800a26: 74 f2 je 800a1a <strtol+0xe> // plus/minus sign if (*s == '+') 800a28: 3c 2b cmp $0x2b,%al 800a2a: 74 2e je 800a5a <strtol+0x4e> int neg = 0; 800a2c: bf 00 00 00 00 mov $0x0,%edi s++; else if (*s == '-') 800a31: 3c 2d cmp $0x2d,%al 800a33: 74 2f je 800a64 <strtol+0x58> s++, neg = 1; // hex or octal base prefix if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) 800a35: f7 c3 ef ff ff ff test $0xffffffef,%ebx 800a3b: 75 05 jne 800a42 <strtol+0x36> 800a3d: 80 39 30 cmpb $0x30,(%ecx) 800a40: 74 2c je 800a6e <strtol+0x62> s += 2, base = 16; else if (base == 0 && s[0] == '0') 800a42: 85 db test %ebx,%ebx 800a44: 75 0a jne 800a50 <strtol+0x44> s++, base = 8; else if (base == 0) base = 10; 800a46: bb 0a 00 00 00 mov $0xa,%ebx else if (base == 0 && s[0] == '0') 800a4b: 80 39 30 cmpb $0x30,(%ecx) 800a4e: 74 28 je 800a78 <strtol+0x6c> base = 10; 800a50: b8 00 00 00 00 mov $0x0,%eax 800a55: 89 5d 10 mov %ebx,0x10(%ebp) 800a58: eb 50 jmp 800aaa <strtol+0x9e> s++; 800a5a: 83 c1 01 add $0x1,%ecx int neg = 0; 800a5d: bf 00 00 00 00 mov $0x0,%edi 800a62: eb d1 jmp 800a35 <strtol+0x29> s++, neg = 1; 800a64: 83 c1 01 add $0x1,%ecx 800a67: bf 01 00 00 00 mov $0x1,%edi 800a6c: eb c7 jmp 800a35 <strtol+0x29> if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) 800a6e: 80 79 01 78 cmpb $0x78,0x1(%ecx) 800a72: 74 0e je 800a82 <strtol+0x76> else if (base == 0 && s[0] == '0') 800a74: 85 db test %ebx,%ebx 800a76: 75 d8 jne 800a50 <strtol+0x44> s++, base = 8; 800a78: 83 c1 01 add $0x1,%ecx 800a7b: bb 08 00 00 00 mov $0x8,%ebx 800a80: eb ce jmp 800a50 <strtol+0x44> s += 2, base = 16; 800a82: 83 c1 02 add $0x2,%ecx 800a85: bb 10 00 00 00 mov $0x10,%ebx 800a8a: eb c4 jmp 800a50 <strtol+0x44> while (1) { int dig; if (*s >= '0' && *s <= '9') dig = *s - '0'; else if (*s >= 'a' && *s <= 'z') 800a8c: 8d 72 9f lea -0x61(%edx),%esi 800a8f: 89 f3 mov %esi,%ebx 800a91: 80 fb 19 cmp $0x19,%bl 800a94: 77 29 ja 800abf <strtol+0xb3> dig = *s - 'a' + 10; 800a96: 0f be d2 movsbl %dl,%edx 800a99: 83 ea 57 sub $0x57,%edx else if (*s >= 'A' && *s <= 'Z') dig = *s - 'A' + 10; else break; if (dig >= base) 800a9c: 3b 55 10 cmp 0x10(%ebp),%edx 800a9f: 7d 30 jge 800ad1 <strtol+0xc5> break; s++, val = (val * base) + dig; 800aa1: 83 c1 01 add $0x1,%ecx 800aa4: 0f af 45 10 imul 0x10(%ebp),%eax 800aa8: 01 d0 add %edx,%eax if (*s >= '0' && *s <= '9') 800aaa: 0f b6 11 movzbl (%ecx),%edx 800aad: 8d 72 d0 lea -0x30(%edx),%esi 800ab0: 89 f3 mov %esi,%ebx 800ab2: 80 fb 09 cmp $0x9,%bl 800ab5: 77 d5 ja 800a8c <strtol+0x80> dig = *s - '0'; 800ab7: 0f be d2 movsbl %dl,%edx 800aba: 83 ea 30 sub $0x30,%edx 800abd: eb dd jmp 800a9c <strtol+0x90> else if (*s >= 'A' && *s <= 'Z') 800abf: 8d 72 bf lea -0x41(%edx),%esi 800ac2: 89 f3 mov %esi,%ebx 800ac4: 80 fb 19 cmp $0x19,%bl 800ac7: 77 08 ja 800ad1 <strtol+0xc5> dig = *s - 'A' + 10; 800ac9: 0f be d2 movsbl %dl,%edx 800acc: 83 ea 37 sub $0x37,%edx 800acf: eb cb jmp 800a9c <strtol+0x90> // we don't properly detect overflow! } if (endptr) 800ad1: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 800ad5: 74 05 je 800adc <strtol+0xd0> *endptr = (char *) s; 800ad7: 8b 75 0c mov 0xc(%ebp),%esi 800ada: 89 0e mov %ecx,(%esi) return (neg ? -val : val); 800adc: 89 c2 mov %eax,%edx 800ade: f7 da neg %edx 800ae0: 85 ff test %edi,%edi 800ae2: 0f 45 c2 cmovne %edx,%eax } 800ae5: 5b pop %ebx 800ae6: 5e pop %esi 800ae7: 5f pop %edi 800ae8: 5d pop %ebp 800ae9: c3 ret 00800aea <sys_cputs>: return ret; } void sys_cputs(const char *s, size_t len) { 800aea: 55 push %ebp 800aeb: 89 e5 mov %esp,%ebp 800aed: 57 push %edi 800aee: 56 push %esi 800aef: 53 push %ebx asm volatile("int %1\n" //执行int T_SYSCALL指令 800af0: b8 00 00 00 00 mov $0x0,%eax 800af5: 8b 55 08 mov 0x8(%ebp),%edx 800af8: 8b 4d 0c mov 0xc(%ebp),%ecx 800afb: 89 c3 mov %eax,%ebx 800afd: 89 c7 mov %eax,%edi 800aff: 89 c6 mov %eax,%esi 800b01: cd 30 int $0x30 syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0); } 800b03: 5b pop %ebx 800b04: 5e pop %esi 800b05: 5f pop %edi 800b06: 5d pop %ebp 800b07: c3 ret 00800b08 <sys_cgetc>: int sys_cgetc(void) { 800b08: 55 push %ebp 800b09: 89 e5 mov %esp,%ebp 800b0b: 57 push %edi 800b0c: 56 push %esi 800b0d: 53 push %ebx asm volatile("int %1\n" //执行int T_SYSCALL指令 800b0e: ba 00 00 00 00 mov $0x0,%edx 800b13: b8 01 00 00 00 mov $0x1,%eax 800b18: 89 d1 mov %edx,%ecx 800b1a: 89 d3 mov %edx,%ebx 800b1c: 89 d7 mov %edx,%edi 800b1e: 89 d6 mov %edx,%esi 800b20: cd 30 int $0x30 return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0); } 800b22: 5b pop %ebx 800b23: 5e pop %esi 800b24: 5f pop %edi 800b25: 5d pop %ebp 800b26: c3 ret 00800b27 <sys_env_destroy>: int sys_env_destroy(envid_t envid) { 800b27: 55 push %ebp 800b28: 89 e5 mov %esp,%ebp 800b2a: 57 push %edi 800b2b: 56 push %esi 800b2c: 53 push %ebx 800b2d: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800b30: b9 00 00 00 00 mov $0x0,%ecx 800b35: 8b 55 08 mov 0x8(%ebp),%edx 800b38: b8 03 00 00 00 mov $0x3,%eax 800b3d: 89 cb mov %ecx,%ebx 800b3f: 89 cf mov %ecx,%edi 800b41: 89 ce mov %ecx,%esi 800b43: cd 30 int $0x30 if(check && ret > 0) 800b45: 85 c0 test %eax,%eax 800b47: 7f 08 jg 800b51 <sys_env_destroy+0x2a> return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0); } 800b49: 8d 65 f4 lea -0xc(%ebp),%esp 800b4c: 5b pop %ebx 800b4d: 5e pop %esi 800b4e: 5f pop %edi 800b4f: 5d pop %ebp 800b50: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800b51: 83 ec 0c sub $0xc,%esp 800b54: 50 push %eax 800b55: 6a 03 push $0x3 800b57: 68 5f 14 80 00 push $0x80145f 800b5c: 6a 23 push $0x23 800b5e: 68 7c 14 80 00 push $0x80147c 800b63: e8 25 03 00 00 call 800e8d <_panic> 00800b68 <sys_getenvid>: envid_t sys_getenvid(void) { 800b68: 55 push %ebp 800b69: 89 e5 mov %esp,%ebp 800b6b: 57 push %edi 800b6c: 56 push %esi 800b6d: 53 push %ebx asm volatile("int %1\n" //执行int T_SYSCALL指令 800b6e: ba 00 00 00 00 mov $0x0,%edx 800b73: b8 02 00 00 00 mov $0x2,%eax 800b78: 89 d1 mov %edx,%ecx 800b7a: 89 d3 mov %edx,%ebx 800b7c: 89 d7 mov %edx,%edi 800b7e: 89 d6 mov %edx,%esi 800b80: cd 30 int $0x30 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0); } 800b82: 5b pop %ebx 800b83: 5e pop %esi 800b84: 5f pop %edi 800b85: 5d pop %ebp 800b86: c3 ret 00800b87 <sys_yield>: void sys_yield(void) { 800b87: 55 push %ebp 800b88: 89 e5 mov %esp,%ebp 800b8a: 57 push %edi 800b8b: 56 push %esi 800b8c: 53 push %ebx asm volatile("int %1\n" //执行int T_SYSCALL指令 800b8d: ba 00 00 00 00 mov $0x0,%edx 800b92: b8 0b 00 00 00 mov $0xb,%eax 800b97: 89 d1 mov %edx,%ecx 800b99: 89 d3 mov %edx,%ebx 800b9b: 89 d7 mov %edx,%edi 800b9d: 89 d6 mov %edx,%esi 800b9f: cd 30 int $0x30 syscall(SYS_yield, 0, 0, 0, 0, 0, 0); } 800ba1: 5b pop %ebx 800ba2: 5e pop %esi 800ba3: 5f pop %edi 800ba4: 5d pop %ebp 800ba5: c3 ret 00800ba6 <sys_page_alloc>: int sys_page_alloc(envid_t envid, void *va, int perm) { 800ba6: 55 push %ebp 800ba7: 89 e5 mov %esp,%ebp 800ba9: 57 push %edi 800baa: 56 push %esi 800bab: 53 push %ebx 800bac: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800baf: be 00 00 00 00 mov $0x0,%esi 800bb4: 8b 55 08 mov 0x8(%ebp),%edx 800bb7: 8b 4d 0c mov 0xc(%ebp),%ecx 800bba: b8 04 00 00 00 mov $0x4,%eax 800bbf: 8b 5d 10 mov 0x10(%ebp),%ebx 800bc2: 89 f7 mov %esi,%edi 800bc4: cd 30 int $0x30 if(check && ret > 0) 800bc6: 85 c0 test %eax,%eax 800bc8: 7f 08 jg 800bd2 <sys_page_alloc+0x2c> return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0); } 800bca: 8d 65 f4 lea -0xc(%ebp),%esp 800bcd: 5b pop %ebx 800bce: 5e pop %esi 800bcf: 5f pop %edi 800bd0: 5d pop %ebp 800bd1: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800bd2: 83 ec 0c sub $0xc,%esp 800bd5: 50 push %eax 800bd6: 6a 04 push $0x4 800bd8: 68 5f 14 80 00 push $0x80145f 800bdd: 6a 23 push $0x23 800bdf: 68 7c 14 80 00 push $0x80147c 800be4: e8 a4 02 00 00 call 800e8d <_panic> 00800be9 <sys_page_map>: int sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm) { 800be9: 55 push %ebp 800bea: 89 e5 mov %esp,%ebp 800bec: 57 push %edi 800bed: 56 push %esi 800bee: 53 push %ebx 800bef: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800bf2: 8b 55 08 mov 0x8(%ebp),%edx 800bf5: 8b 4d 0c mov 0xc(%ebp),%ecx 800bf8: b8 05 00 00 00 mov $0x5,%eax 800bfd: 8b 5d 10 mov 0x10(%ebp),%ebx 800c00: 8b 7d 14 mov 0x14(%ebp),%edi 800c03: 8b 75 18 mov 0x18(%ebp),%esi 800c06: cd 30 int $0x30 if(check && ret > 0) 800c08: 85 c0 test %eax,%eax 800c0a: 7f 08 jg 800c14 <sys_page_map+0x2b> return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm); } 800c0c: 8d 65 f4 lea -0xc(%ebp),%esp 800c0f: 5b pop %ebx 800c10: 5e pop %esi 800c11: 5f pop %edi 800c12: 5d pop %ebp 800c13: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800c14: 83 ec 0c sub $0xc,%esp 800c17: 50 push %eax 800c18: 6a 05 push $0x5 800c1a: 68 5f 14 80 00 push $0x80145f 800c1f: 6a 23 push $0x23 800c21: 68 7c 14 80 00 push $0x80147c 800c26: e8 62 02 00 00 call 800e8d <_panic> 00800c2b <sys_page_unmap>: int sys_page_unmap(envid_t envid, void *va) { 800c2b: 55 push %ebp 800c2c: 89 e5 mov %esp,%ebp 800c2e: 57 push %edi 800c2f: 56 push %esi 800c30: 53 push %ebx 800c31: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800c34: bb 00 00 00 00 mov $0x0,%ebx 800c39: 8b 55 08 mov 0x8(%ebp),%edx 800c3c: 8b 4d 0c mov 0xc(%ebp),%ecx 800c3f: b8 06 00 00 00 mov $0x6,%eax 800c44: 89 df mov %ebx,%edi 800c46: 89 de mov %ebx,%esi 800c48: cd 30 int $0x30 if(check && ret > 0) 800c4a: 85 c0 test %eax,%eax 800c4c: 7f 08 jg 800c56 <sys_page_unmap+0x2b> return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0); } 800c4e: 8d 65 f4 lea -0xc(%ebp),%esp 800c51: 5b pop %ebx 800c52: 5e pop %esi 800c53: 5f pop %edi 800c54: 5d pop %ebp 800c55: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800c56: 83 ec 0c sub $0xc,%esp 800c59: 50 push %eax 800c5a: 6a 06 push $0x6 800c5c: 68 5f 14 80 00 push $0x80145f 800c61: 6a 23 push $0x23 800c63: 68 7c 14 80 00 push $0x80147c 800c68: e8 20 02 00 00 call 800e8d <_panic> 00800c6d <sys_env_set_status>: // sys_exofork is inlined in lib.h int sys_env_set_status(envid_t envid, int status) { 800c6d: 55 push %ebp 800c6e: 89 e5 mov %esp,%ebp 800c70: 57 push %edi 800c71: 56 push %esi 800c72: 53 push %ebx 800c73: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800c76: bb 00 00 00 00 mov $0x0,%ebx 800c7b: 8b 55 08 mov 0x8(%ebp),%edx 800c7e: 8b 4d 0c mov 0xc(%ebp),%ecx 800c81: b8 08 00 00 00 mov $0x8,%eax 800c86: 89 df mov %ebx,%edi 800c88: 89 de mov %ebx,%esi 800c8a: cd 30 int $0x30 if(check && ret > 0) 800c8c: 85 c0 test %eax,%eax 800c8e: 7f 08 jg 800c98 <sys_env_set_status+0x2b> return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0); } 800c90: 8d 65 f4 lea -0xc(%ebp),%esp 800c93: 5b pop %ebx 800c94: 5e pop %esi 800c95: 5f pop %edi 800c96: 5d pop %ebp 800c97: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800c98: 83 ec 0c sub $0xc,%esp 800c9b: 50 push %eax 800c9c: 6a 08 push $0x8 800c9e: 68 5f 14 80 00 push $0x80145f 800ca3: 6a 23 push $0x23 800ca5: 68 7c 14 80 00 push $0x80147c 800caa: e8 de 01 00 00 call 800e8d <_panic> 00800caf <sys_env_set_trapframe>: int sys_env_set_trapframe(envid_t envid, struct Trapframe *tf) { 800caf: 55 push %ebp 800cb0: 89 e5 mov %esp,%ebp 800cb2: 57 push %edi 800cb3: 56 push %esi 800cb4: 53 push %ebx 800cb5: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800cb8: bb 00 00 00 00 mov $0x0,%ebx 800cbd: 8b 55 08 mov 0x8(%ebp),%edx 800cc0: 8b 4d 0c mov 0xc(%ebp),%ecx 800cc3: b8 09 00 00 00 mov $0x9,%eax 800cc8: 89 df mov %ebx,%edi 800cca: 89 de mov %ebx,%esi 800ccc: cd 30 int $0x30 if(check && ret > 0) 800cce: 85 c0 test %eax,%eax 800cd0: 7f 08 jg 800cda <sys_env_set_trapframe+0x2b> return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0); } 800cd2: 8d 65 f4 lea -0xc(%ebp),%esp 800cd5: 5b pop %ebx 800cd6: 5e pop %esi 800cd7: 5f pop %edi 800cd8: 5d pop %ebp 800cd9: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800cda: 83 ec 0c sub $0xc,%esp 800cdd: 50 push %eax 800cde: 6a 09 push $0x9 800ce0: 68 5f 14 80 00 push $0x80145f 800ce5: 6a 23 push $0x23 800ce7: 68 7c 14 80 00 push $0x80147c 800cec: e8 9c 01 00 00 call 800e8d <_panic> 00800cf1 <sys_env_set_pgfault_upcall>: int sys_env_set_pgfault_upcall(envid_t envid, void *upcall) { 800cf1: 55 push %ebp 800cf2: 89 e5 mov %esp,%ebp 800cf4: 57 push %edi 800cf5: 56 push %esi 800cf6: 53 push %ebx 800cf7: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800cfa: bb 00 00 00 00 mov $0x0,%ebx 800cff: 8b 55 08 mov 0x8(%ebp),%edx 800d02: 8b 4d 0c mov 0xc(%ebp),%ecx 800d05: b8 0a 00 00 00 mov $0xa,%eax 800d0a: 89 df mov %ebx,%edi 800d0c: 89 de mov %ebx,%esi 800d0e: cd 30 int $0x30 if(check && ret > 0) 800d10: 85 c0 test %eax,%eax 800d12: 7f 08 jg 800d1c <sys_env_set_pgfault_upcall+0x2b> return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0); } 800d14: 8d 65 f4 lea -0xc(%ebp),%esp 800d17: 5b pop %ebx 800d18: 5e pop %esi 800d19: 5f pop %edi 800d1a: 5d pop %ebp 800d1b: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800d1c: 83 ec 0c sub $0xc,%esp 800d1f: 50 push %eax 800d20: 6a 0a push $0xa 800d22: 68 5f 14 80 00 push $0x80145f 800d27: 6a 23 push $0x23 800d29: 68 7c 14 80 00 push $0x80147c 800d2e: e8 5a 01 00 00 call 800e8d <_panic> 00800d33 <sys_ipc_try_send>: int sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm) { 800d33: 55 push %ebp 800d34: 89 e5 mov %esp,%ebp 800d36: 57 push %edi 800d37: 56 push %esi 800d38: 53 push %ebx asm volatile("int %1\n" //执行int T_SYSCALL指令 800d39: 8b 55 08 mov 0x8(%ebp),%edx 800d3c: 8b 4d 0c mov 0xc(%ebp),%ecx 800d3f: b8 0c 00 00 00 mov $0xc,%eax 800d44: be 00 00 00 00 mov $0x0,%esi 800d49: 8b 5d 10 mov 0x10(%ebp),%ebx 800d4c: 8b 7d 14 mov 0x14(%ebp),%edi 800d4f: cd 30 int $0x30 return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0); } 800d51: 5b pop %ebx 800d52: 5e pop %esi 800d53: 5f pop %edi 800d54: 5d pop %ebp 800d55: c3 ret 00800d56 <sys_ipc_recv>: int sys_ipc_recv(void *dstva) { 800d56: 55 push %ebp 800d57: 89 e5 mov %esp,%ebp 800d59: 57 push %edi 800d5a: 56 push %esi 800d5b: 53 push %ebx 800d5c: 83 ec 0c sub $0xc,%esp asm volatile("int %1\n" //执行int T_SYSCALL指令 800d5f: b9 00 00 00 00 mov $0x0,%ecx 800d64: 8b 55 08 mov 0x8(%ebp),%edx 800d67: b8 0d 00 00 00 mov $0xd,%eax 800d6c: 89 cb mov %ecx,%ebx 800d6e: 89 cf mov %ecx,%edi 800d70: 89 ce mov %ecx,%esi 800d72: cd 30 int $0x30 if(check && ret > 0) 800d74: 85 c0 test %eax,%eax 800d76: 7f 08 jg 800d80 <sys_ipc_recv+0x2a> return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0); } 800d78: 8d 65 f4 lea -0xc(%ebp),%esp 800d7b: 5b pop %ebx 800d7c: 5e pop %esi 800d7d: 5f pop %edi 800d7e: 5d pop %ebp 800d7f: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800d80: 83 ec 0c sub $0xc,%esp 800d83: 50 push %eax 800d84: 6a 0d push $0xd 800d86: 68 5f 14 80 00 push $0x80145f 800d8b: 6a 23 push $0x23 800d8d: 68 7c 14 80 00 push $0x80147c 800d92: e8 f6 00 00 00 call 800e8d <_panic> 00800d97 <ipc_recv>: // If 'pg' is null, pass sys_ipc_recv a value that it will understand // as meaning "no page". (Zero is not the right value, since that's // a perfectly valid place to map a page.) int32_t ipc_recv(envid_t *from_env_store, void *pg, int *perm_store) { 800d97: 55 push %ebp 800d98: 89 e5 mov %esp,%ebp 800d9a: 56 push %esi 800d9b: 53 push %ebx 800d9c: 8b 75 08 mov 0x8(%ebp),%esi 800d9f: 8b 45 0c mov 0xc(%ebp),%eax 800da2: 8b 5d 10 mov 0x10(%ebp),%ebx // LAB 4: Your code here. if (pg == NULL) { 800da5: 85 c0 test %eax,%eax pg = (void *)-1; 800da7: ba ff ff ff ff mov $0xffffffff,%edx 800dac: 0f 44 c2 cmove %edx,%eax } int r = sys_ipc_recv(pg); 800daf: 83 ec 0c sub $0xc,%esp 800db2: 50 push %eax 800db3: e8 9e ff ff ff call 800d56 <sys_ipc_recv> if (r < 0) { //系统调用失败 800db8: 83 c4 10 add $0x10,%esp 800dbb: 85 c0 test %eax,%eax 800dbd: 78 2b js 800dea <ipc_recv+0x53> if (from_env_store) *from_env_store = 0; if (perm_store) *perm_store = 0; return r; } if (from_env_store) 800dbf: 85 f6 test %esi,%esi 800dc1: 74 0a je 800dcd <ipc_recv+0x36> *from_env_store = thisenv->env_ipc_from; 800dc3: a1 04 20 80 00 mov 0x802004,%eax 800dc8: 8b 40 74 mov 0x74(%eax),%eax 800dcb: 89 06 mov %eax,(%esi) if (perm_store) 800dcd: 85 db test %ebx,%ebx 800dcf: 74 0a je 800ddb <ipc_recv+0x44> *perm_store = thisenv->env_ipc_perm; 800dd1: a1 04 20 80 00 mov 0x802004,%eax 800dd6: 8b 40 78 mov 0x78(%eax),%eax 800dd9: 89 03 mov %eax,(%ebx) return thisenv->env_ipc_value; 800ddb: a1 04 20 80 00 mov 0x802004,%eax 800de0: 8b 40 70 mov 0x70(%eax),%eax } 800de3: 8d 65 f8 lea -0x8(%ebp),%esp 800de6: 5b pop %ebx 800de7: 5e pop %esi 800de8: 5d pop %ebp 800de9: c3 ret if (from_env_store) *from_env_store = 0; 800dea: 85 f6 test %esi,%esi 800dec: 74 06 je 800df4 <ipc_recv+0x5d> 800dee: c7 06 00 00 00 00 movl $0x0,(%esi) if (perm_store) *perm_store = 0; 800df4: 85 db test %ebx,%ebx 800df6: 74 eb je 800de3 <ipc_recv+0x4c> 800df8: c7 03 00 00 00 00 movl $0x0,(%ebx) 800dfe: eb e3 jmp 800de3 <ipc_recv+0x4c> 00800e00 <ipc_send>: // Use sys_yield() to be CPU-friendly. // If 'pg' is null, pass sys_ipc_try_send a value that it will understand // as meaning "no page". (Zero is not the right value.) void ipc_send(envid_t to_env, uint32_t val, void *pg, int perm) { 800e00: 55 push %ebp 800e01: 89 e5 mov %esp,%ebp 800e03: 57 push %edi 800e04: 56 push %esi 800e05: 53 push %ebx 800e06: 83 ec 0c sub $0xc,%esp 800e09: 8b 7d 08 mov 0x8(%ebp),%edi 800e0c: 8b 75 0c mov 0xc(%ebp),%esi 800e0f: 8b 5d 10 mov 0x10(%ebp),%ebx // LAB 4: Your code here. if (pg == NULL) { 800e12: 85 db test %ebx,%ebx pg = (void *)-1; 800e14: b8 ff ff ff ff mov $0xffffffff,%eax 800e19: 0f 44 d8 cmove %eax,%ebx } int r; while(1) { r = sys_ipc_try_send(to_env, val, pg, perm); 800e1c: ff 75 14 pushl 0x14(%ebp) 800e1f: 53 push %ebx 800e20: 56 push %esi 800e21: 57 push %edi 800e22: e8 0c ff ff ff call 800d33 <sys_ipc_try_send> if (r == 0) { //发送成功 800e27: 83 c4 10 add $0x10,%esp 800e2a: 85 c0 test %eax,%eax 800e2c: 74 1e je 800e4c <ipc_send+0x4c> return; } else if (r == -E_IPC_NOT_RECV) { //接收进程没有准备好 800e2e: 83 f8 f9 cmp $0xfffffff9,%eax 800e31: 75 07 jne 800e3a <ipc_send+0x3a> sys_yield(); 800e33: e8 4f fd ff ff call 800b87 <sys_yield> r = sys_ipc_try_send(to_env, val, pg, perm); 800e38: eb e2 jmp 800e1c <ipc_send+0x1c> } else { //其它错误 panic("ipc_send():%e", r); 800e3a: 50 push %eax 800e3b: 68 8a 14 80 00 push $0x80148a 800e40: 6a 41 push $0x41 800e42: 68 98 14 80 00 push $0x801498 800e47: e8 41 00 00 00 call 800e8d <_panic> } } } 800e4c: 8d 65 f4 lea -0xc(%ebp),%esp 800e4f: 5b pop %ebx 800e50: 5e pop %esi 800e51: 5f pop %edi 800e52: 5d pop %ebp 800e53: c3 ret 00800e54 <ipc_find_env>: // Find the first environment of the given type. We'll use this to // find special environments. // Returns 0 if no such environment exists. envid_t ipc_find_env(enum EnvType type) { 800e54: 55 push %ebp 800e55: 89 e5 mov %esp,%ebp 800e57: 8b 4d 08 mov 0x8(%ebp),%ecx int i; for (i = 0; i < NENV; i++) 800e5a: b8 00 00 00 00 mov $0x0,%eax if (envs[i].env_type == type) 800e5f: 6b d0 7c imul $0x7c,%eax,%edx 800e62: 81 c2 00 00 c0 ee add $0xeec00000,%edx 800e68: 8b 52 50 mov 0x50(%edx),%edx 800e6b: 39 ca cmp %ecx,%edx 800e6d: 74 11 je 800e80 <ipc_find_env+0x2c> for (i = 0; i < NENV; i++) 800e6f: 83 c0 01 add $0x1,%eax 800e72: 3d 00 04 00 00 cmp $0x400,%eax 800e77: 75 e6 jne 800e5f <ipc_find_env+0xb> return envs[i].env_id; return 0; 800e79: b8 00 00 00 00 mov $0x0,%eax 800e7e: eb 0b jmp 800e8b <ipc_find_env+0x37> return envs[i].env_id; 800e80: 6b c0 7c imul $0x7c,%eax,%eax 800e83: 05 00 00 c0 ee add $0xeec00000,%eax 800e88: 8b 40 48 mov 0x48(%eax),%eax } 800e8b: 5d pop %ebp 800e8c: c3 ret 00800e8d <_panic>: * It prints "panic: <message>", then causes a breakpoint exception, * which causes JOS to enter the JOS kernel monitor. */ void _panic(const char *file, int line, const char *fmt, ...) { 800e8d: 55 push %ebp 800e8e: 89 e5 mov %esp,%ebp 800e90: 56 push %esi 800e91: 53 push %ebx va_list ap; va_start(ap, fmt); 800e92: 8d 5d 14 lea 0x14(%ebp),%ebx // Print the panic message cprintf("[%08x] user panic in %s at %s:%d: ", 800e95: 8b 35 00 20 80 00 mov 0x802000,%esi 800e9b: e8 c8 fc ff ff call 800b68 <sys_getenvid> 800ea0: 83 ec 0c sub $0xc,%esp 800ea3: ff 75 0c pushl 0xc(%ebp) 800ea6: ff 75 08 pushl 0x8(%ebp) 800ea9: 56 push %esi 800eaa: 50 push %eax 800eab: 68 a4 14 80 00 push $0x8014a4 800eb0: e8 d9 f2 ff ff call 80018e <cprintf> sys_getenvid(), binaryname, file, line); vcprintf(fmt, ap); 800eb5: 83 c4 18 add $0x18,%esp 800eb8: 53 push %ebx 800eb9: ff 75 10 pushl 0x10(%ebp) 800ebc: e8 7c f2 ff ff call 80013d <vcprintf> cprintf("\n"); 800ec1: c7 04 24 2f 11 80 00 movl $0x80112f,(%esp) 800ec8: e8 c1 f2 ff ff call 80018e <cprintf> 800ecd: 83 c4 10 add $0x10,%esp // Cause a breakpoint exception while (1) asm volatile("int3"); 800ed0: cc int3 800ed1: eb fd jmp 800ed0 <_panic+0x43> 800ed3: 66 90 xchg %ax,%ax 800ed5: 66 90 xchg %ax,%ax 800ed7: 66 90 xchg %ax,%ax 800ed9: 66 90 xchg %ax,%ax 800edb: 66 90 xchg %ax,%ax 800edd: 66 90 xchg %ax,%ax 800edf: 90 nop 00800ee0 <__udivdi3>: 800ee0: 55 push %ebp 800ee1: 57 push %edi 800ee2: 56 push %esi 800ee3: 53 push %ebx 800ee4: 83 ec 1c sub $0x1c,%esp 800ee7: 8b 54 24 3c mov 0x3c(%esp),%edx 800eeb: 8b 6c 24 30 mov 0x30(%esp),%ebp 800eef: 8b 74 24 34 mov 0x34(%esp),%esi 800ef3: 8b 5c 24 38 mov 0x38(%esp),%ebx 800ef7: 85 d2 test %edx,%edx 800ef9: 75 35 jne 800f30 <__udivdi3+0x50> 800efb: 39 f3 cmp %esi,%ebx 800efd: 0f 87 bd 00 00 00 ja 800fc0 <__udivdi3+0xe0> 800f03: 85 db test %ebx,%ebx 800f05: 89 d9 mov %ebx,%ecx 800f07: 75 0b jne 800f14 <__udivdi3+0x34> 800f09: b8 01 00 00 00 mov $0x1,%eax 800f0e: 31 d2 xor %edx,%edx 800f10: f7 f3 div %ebx 800f12: 89 c1 mov %eax,%ecx 800f14: 31 d2 xor %edx,%edx 800f16: 89 f0 mov %esi,%eax 800f18: f7 f1 div %ecx 800f1a: 89 c6 mov %eax,%esi 800f1c: 89 e8 mov %ebp,%eax 800f1e: 89 f7 mov %esi,%edi 800f20: f7 f1 div %ecx 800f22: 89 fa mov %edi,%edx 800f24: 83 c4 1c add $0x1c,%esp 800f27: 5b pop %ebx 800f28: 5e pop %esi 800f29: 5f pop %edi 800f2a: 5d pop %ebp 800f2b: c3 ret 800f2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 800f30: 39 f2 cmp %esi,%edx 800f32: 77 7c ja 800fb0 <__udivdi3+0xd0> 800f34: 0f bd fa bsr %edx,%edi 800f37: 83 f7 1f xor $0x1f,%edi 800f3a: 0f 84 98 00 00 00 je 800fd8 <__udivdi3+0xf8> 800f40: 89 f9 mov %edi,%ecx 800f42: b8 20 00 00 00 mov $0x20,%eax 800f47: 29 f8 sub %edi,%eax 800f49: d3 e2 shl %cl,%edx 800f4b: 89 54 24 08 mov %edx,0x8(%esp) 800f4f: 89 c1 mov %eax,%ecx 800f51: 89 da mov %ebx,%edx 800f53: d3 ea shr %cl,%edx 800f55: 8b 4c 24 08 mov 0x8(%esp),%ecx 800f59: 09 d1 or %edx,%ecx 800f5b: 89 f2 mov %esi,%edx 800f5d: 89 4c 24 08 mov %ecx,0x8(%esp) 800f61: 89 f9 mov %edi,%ecx 800f63: d3 e3 shl %cl,%ebx 800f65: 89 c1 mov %eax,%ecx 800f67: d3 ea shr %cl,%edx 800f69: 89 f9 mov %edi,%ecx 800f6b: 89 5c 24 0c mov %ebx,0xc(%esp) 800f6f: d3 e6 shl %cl,%esi 800f71: 89 eb mov %ebp,%ebx 800f73: 89 c1 mov %eax,%ecx 800f75: d3 eb shr %cl,%ebx 800f77: 09 de or %ebx,%esi 800f79: 89 f0 mov %esi,%eax 800f7b: f7 74 24 08 divl 0x8(%esp) 800f7f: 89 d6 mov %edx,%esi 800f81: 89 c3 mov %eax,%ebx 800f83: f7 64 24 0c mull 0xc(%esp) 800f87: 39 d6 cmp %edx,%esi 800f89: 72 0c jb 800f97 <__udivdi3+0xb7> 800f8b: 89 f9 mov %edi,%ecx 800f8d: d3 e5 shl %cl,%ebp 800f8f: 39 c5 cmp %eax,%ebp 800f91: 73 5d jae 800ff0 <__udivdi3+0x110> 800f93: 39 d6 cmp %edx,%esi 800f95: 75 59 jne 800ff0 <__udivdi3+0x110> 800f97: 8d 43 ff lea -0x1(%ebx),%eax 800f9a: 31 ff xor %edi,%edi 800f9c: 89 fa mov %edi,%edx 800f9e: 83 c4 1c add $0x1c,%esp 800fa1: 5b pop %ebx 800fa2: 5e pop %esi 800fa3: 5f pop %edi 800fa4: 5d pop %ebp 800fa5: c3 ret 800fa6: 8d 76 00 lea 0x0(%esi),%esi 800fa9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 800fb0: 31 ff xor %edi,%edi 800fb2: 31 c0 xor %eax,%eax 800fb4: 89 fa mov %edi,%edx 800fb6: 83 c4 1c add $0x1c,%esp 800fb9: 5b pop %ebx 800fba: 5e pop %esi 800fbb: 5f pop %edi 800fbc: 5d pop %ebp 800fbd: c3 ret 800fbe: 66 90 xchg %ax,%ax 800fc0: 31 ff xor %edi,%edi 800fc2: 89 e8 mov %ebp,%eax 800fc4: 89 f2 mov %esi,%edx 800fc6: f7 f3 div %ebx 800fc8: 89 fa mov %edi,%edx 800fca: 83 c4 1c add $0x1c,%esp 800fcd: 5b pop %ebx 800fce: 5e pop %esi 800fcf: 5f pop %edi 800fd0: 5d pop %ebp 800fd1: c3 ret 800fd2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 800fd8: 39 f2 cmp %esi,%edx 800fda: 72 06 jb 800fe2 <__udivdi3+0x102> 800fdc: 31 c0 xor %eax,%eax 800fde: 39 eb cmp %ebp,%ebx 800fe0: 77 d2 ja 800fb4 <__udivdi3+0xd4> 800fe2: b8 01 00 00 00 mov $0x1,%eax 800fe7: eb cb jmp 800fb4 <__udivdi3+0xd4> 800fe9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 800ff0: 89 d8 mov %ebx,%eax 800ff2: 31 ff xor %edi,%edi 800ff4: eb be jmp 800fb4 <__udivdi3+0xd4> 800ff6: 66 90 xchg %ax,%ax 800ff8: 66 90 xchg %ax,%ax 800ffa: 66 90 xchg %ax,%ax 800ffc: 66 90 xchg %ax,%ax 800ffe: 66 90 xchg %ax,%ax 00801000 <__umoddi3>: 801000: 55 push %ebp 801001: 57 push %edi 801002: 56 push %esi 801003: 53 push %ebx 801004: 83 ec 1c sub $0x1c,%esp 801007: 8b 6c 24 3c mov 0x3c(%esp),%ebp 80100b: 8b 74 24 30 mov 0x30(%esp),%esi 80100f: 8b 5c 24 34 mov 0x34(%esp),%ebx 801013: 8b 7c 24 38 mov 0x38(%esp),%edi 801017: 85 ed test %ebp,%ebp 801019: 89 f0 mov %esi,%eax 80101b: 89 da mov %ebx,%edx 80101d: 75 19 jne 801038 <__umoddi3+0x38> 80101f: 39 df cmp %ebx,%edi 801021: 0f 86 b1 00 00 00 jbe 8010d8 <__umoddi3+0xd8> 801027: f7 f7 div %edi 801029: 89 d0 mov %edx,%eax 80102b: 31 d2 xor %edx,%edx 80102d: 83 c4 1c add $0x1c,%esp 801030: 5b pop %ebx 801031: 5e pop %esi 801032: 5f pop %edi 801033: 5d pop %ebp 801034: c3 ret 801035: 8d 76 00 lea 0x0(%esi),%esi 801038: 39 dd cmp %ebx,%ebp 80103a: 77 f1 ja 80102d <__umoddi3+0x2d> 80103c: 0f bd cd bsr %ebp,%ecx 80103f: 83 f1 1f xor $0x1f,%ecx 801042: 89 4c 24 04 mov %ecx,0x4(%esp) 801046: 0f 84 b4 00 00 00 je 801100 <__umoddi3+0x100> 80104c: b8 20 00 00 00 mov $0x20,%eax 801051: 89 c2 mov %eax,%edx 801053: 8b 44 24 04 mov 0x4(%esp),%eax 801057: 29 c2 sub %eax,%edx 801059: 89 c1 mov %eax,%ecx 80105b: 89 f8 mov %edi,%eax 80105d: d3 e5 shl %cl,%ebp 80105f: 89 d1 mov %edx,%ecx 801061: 89 54 24 0c mov %edx,0xc(%esp) 801065: d3 e8 shr %cl,%eax 801067: 09 c5 or %eax,%ebp 801069: 8b 44 24 04 mov 0x4(%esp),%eax 80106d: 89 c1 mov %eax,%ecx 80106f: d3 e7 shl %cl,%edi 801071: 89 d1 mov %edx,%ecx 801073: 89 7c 24 08 mov %edi,0x8(%esp) 801077: 89 df mov %ebx,%edi 801079: d3 ef shr %cl,%edi 80107b: 89 c1 mov %eax,%ecx 80107d: 89 f0 mov %esi,%eax 80107f: d3 e3 shl %cl,%ebx 801081: 89 d1 mov %edx,%ecx 801083: 89 fa mov %edi,%edx 801085: d3 e8 shr %cl,%eax 801087: 0f b6 4c 24 04 movzbl 0x4(%esp),%ecx 80108c: 09 d8 or %ebx,%eax 80108e: f7 f5 div %ebp 801090: d3 e6 shl %cl,%esi 801092: 89 d1 mov %edx,%ecx 801094: f7 64 24 08 mull 0x8(%esp) 801098: 39 d1 cmp %edx,%ecx 80109a: 89 c3 mov %eax,%ebx 80109c: 89 d7 mov %edx,%edi 80109e: 72 06 jb 8010a6 <__umoddi3+0xa6> 8010a0: 75 0e jne 8010b0 <__umoddi3+0xb0> 8010a2: 39 c6 cmp %eax,%esi 8010a4: 73 0a jae 8010b0 <__umoddi3+0xb0> 8010a6: 2b 44 24 08 sub 0x8(%esp),%eax 8010aa: 19 ea sbb %ebp,%edx 8010ac: 89 d7 mov %edx,%edi 8010ae: 89 c3 mov %eax,%ebx 8010b0: 89 ca mov %ecx,%edx 8010b2: 0f b6 4c 24 0c movzbl 0xc(%esp),%ecx 8010b7: 29 de sub %ebx,%esi 8010b9: 19 fa sbb %edi,%edx 8010bb: 8b 5c 24 04 mov 0x4(%esp),%ebx 8010bf: 89 d0 mov %edx,%eax 8010c1: d3 e0 shl %cl,%eax 8010c3: 89 d9 mov %ebx,%ecx 8010c5: d3 ee shr %cl,%esi 8010c7: d3 ea shr %cl,%edx 8010c9: 09 f0 or %esi,%eax 8010cb: 83 c4 1c add $0x1c,%esp 8010ce: 5b pop %ebx 8010cf: 5e pop %esi 8010d0: 5f pop %edi 8010d1: 5d pop %ebp 8010d2: c3 ret 8010d3: 90 nop 8010d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010d8: 85 ff test %edi,%edi 8010da: 89 f9 mov %edi,%ecx 8010dc: 75 0b jne 8010e9 <__umoddi3+0xe9> 8010de: b8 01 00 00 00 mov $0x1,%eax 8010e3: 31 d2 xor %edx,%edx 8010e5: f7 f7 div %edi 8010e7: 89 c1 mov %eax,%ecx 8010e9: 89 d8 mov %ebx,%eax 8010eb: 31 d2 xor %edx,%edx 8010ed: f7 f1 div %ecx 8010ef: 89 f0 mov %esi,%eax 8010f1: f7 f1 div %ecx 8010f3: e9 31 ff ff ff jmp 801029 <__umoddi3+0x29> 8010f8: 90 nop 8010f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801100: 39 dd cmp %ebx,%ebp 801102: 72 08 jb 80110c <__umoddi3+0x10c> 801104: 39 f7 cmp %esi,%edi 801106: 0f 87 21 ff ff ff ja 80102d <__umoddi3+0x2d> 80110c: 89 da mov %ebx,%edx 80110e: 89 f0 mov %esi,%eax 801110: 29 f8 sub %edi,%eax 801112: 19 ea sbb %ebp,%edx 801114: e9 14 ff ff ff jmp 80102d <__umoddi3+0x2d>
40.676402
91
0.458122
ee16f4a8aebb2c1b5633145e36ff56043b0f0ae0
3,144
asm
Assembly
scores.asm
wiebow/tetris.c64
d15f86f62060d09323a7c30c20a422d58f6ed3a4
[ "Unlicense", "MIT" ]
79
2015-03-03T03:41:44.000Z
2022-01-17T13:09:59.000Z
scores.asm
wiebow/tetris.c64
d15f86f62060d09323a7c30c20a422d58f6ed3a4
[ "Unlicense", "MIT" ]
null
null
null
scores.asm
wiebow/tetris.c64
d15f86f62060d09323a7c30c20a422d58f6ed3a4
[ "Unlicense", "MIT" ]
10
2015-04-13T06:52:25.000Z
2021-11-13T19:10:56.000Z
// resets player score and total lines made. ResetScore: lda #$00 sta score+0 sta score+1 sta score+2 rts // this adds the score that is put in the // addition bytes. // we start at the rightmost byte (LSB) AddScore: sed // set decimal mode clc // clear the carry bit lda score+2 // get this score adc addition+2 // add the first byte sta score+2 // store it. lda score+1 // and the 2nd byte adc addition+1 sta score+1 lda score+0 // and the 3rd byte adc addition+0 sta score+0 cld // clear decimal mode rts // prints the score into the playing field PrintScore: // set cursor position clc // clear carry bit so we set cursor ldx #4 // row 4 ldy #24 // column 24 jsr PLOT // move cursor so we can use PRINT ldx #0 // start with left most byte (MSB) !loop: lda score,x // get value pha // push to stack lsr // shift 4 times to right lsr lsr lsr clc adc #$30 // add #$30 to it to get a screencode jsr PRINT // print it pla // restore value and #%00001111 // get rid of leftmost bits clc adc #$30 // create a screen code jsr PRINT // print it inx // update counter cpx #3 bne !loop- // continue rts // this looks at the made lines amount, and the current // level, and adds the appropriate score: (level+1) * line score AddLineValue: ldy linesMade // get made lines amount dey // minus 1 to get currect offset to lineValue array lda lineValue1,y // get 1st byte sta addition+0 // put in addition lda lineValue2,y // same for middle byte sta addition+1 lda lineValue3,y // and last byte sta addition+2 ldx currentLevel // get the current player level // this is how many times the score is added !loop: jsr AddScore // add the score dex bpl !loop- // keep doing this until all levels have been added rts //prints the current play level on the screen PrintLevel: clc // position cursor at 26,8 ldx #8 ldy #26 jsr PLOT // do 1st byte. // only do the first 4 bits of this byte lda gameLevel+1 and #%00001111 // get rid of leftmost bits clc adc #$30 // create a screen code jsr PRINT // print it // do 2nd byte lda gameLevel+0 pha // push to stack lsr // shift 4 times to right lsr lsr lsr clc adc #$30 // add #$30 to it to get a screencode jsr PRINT // print it pla // restore value and #%00001111 // get rid of leftmost bits clc adc #$30 // create a screen code jsr PRINT // print it rts // --------------------------- score: .byte 0,0,0 // 24 bits score value, MSB first. addition: .byte 0,0,0 // score to add goes here // http://tetris.wikia.com/wiki/Scoring // lines: 1 2 3 4 lineValue1: .byte 00, 00, 00, 00 // right most byte of scores (LSB) lineValue2: .byte 00, 01, 03,$12 // middle byte lineValue3: .byte $40, 00, 00, 00 // left most byte of score (MSB)
23.818182
69
0.592875
ee6c3496a174b71198554d05b6fe0c92a36b4a5e
732
asm
Assembly
asm/curidealproc.asm
gregzakh/sketches
acbc573b9e67228dac21a94b597d89e2ea5cd755
[ "MIT" ]
1
2022-01-07T13:18:51.000Z
2022-01-07T13:18:51.000Z
asm/curidealproc.asm
gregzakh/sketches
acbc573b9e67228dac21a94b597d89e2ea5cd755
[ "MIT" ]
null
null
null
asm/curidealproc.asm
gregzakh/sketches
acbc573b9e67228dac21a94b597d89e2ea5cd755
[ "MIT" ]
4
2020-02-11T01:00:11.000Z
2022-01-07T14:24:38.000Z
global main extern printf section .bss struc PROCESSOR_NUMBER .Group: resw 1 .Number: resb 1 .Reserved: resb 1 endstruc section .data fmt: db "Group: %u, Number: %u", 0xA, 0 ; TEB->CurrentIdealProcessor section .text main: push rdi sub rsp, 30h lea rax, [rsp+PROCESSOR_NUMBER] mov rdi, rax xor eax, eax mov ecx, 4 rep stosb mov rax, qword [gs:abs 30h] mov eax, dword [rax+1744h] mov dword [rsp+PROCESSOR_NUMBER], eax movzx eax, byte [rsp+PROCESSOR_NUMBER.Number] movzx ecx, word [rsp+PROCESSOR_NUMBER.Group] mov r8d, eax mov edx, ecx lea rcx, [rel fmt] call printf xor eax, eax add rsp, 30h pop rdi ret
19.783784
49
0.613388
326d4fa5bae20ba6c9b7fd68f6899d1393f50a66
400
asm
Assembly
ffight/lcs/enemy/12.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
6
2020-10-14T15:29:10.000Z
2022-02-12T18:58:54.000Z
ffight/lcs/enemy/12.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
null
null
null
ffight/lcs/enemy/12.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
1
2020-12-17T08:59:10.000Z
2020-12-17T08:59:10.000Z
copyright zengfr site:http://github.com/zengfr/romhack 003848 movea.l ($4f12,A5), A1 [enemy+12] 003A0A movem.l D0-D3, -(A6) 003A0E movem.l D0-D3, -(A6) 005EE6 move.l ($8,A3), ($12,A4) [enemy+ A] 005EEC move.b ($c,A3), ($36,A4) [enemy+12, enemy+14] 009ACA dbra D5, $9ac8 009AD2 movea.l A0, A1 [container+12, enemy+12, weapon+12] copyright zengfr site:http://github.com/zengfr/romhack
33.333333
58
0.6675
f5554964e5f2331a2e716a4f284654b17e2fa67c
374
asm
Assembly
programs/oeis/165/A165453.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/165/A165453.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/165/A165453.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A165453: Linear interpolation of the sequence that maps an entry of A002378 to the corresponding entry of A006331. ; 0,1,2,4,6,8,10,13,16,19,22,25,28,32,36,40,44,48,52,56,60,65,70,75,80,85,90,95,100,105,110,116,122,128,134,140,146,152,158,164,170,176,182,189,196,203,210,217,224,231,238,245,252,259,266,273,280,288,296,304 lpb $0,1 add $1,$0 add $2,2 trn $0,$2 lpe
41.555556
207
0.705882
8d8354b80cbf43875d514176423293342f9f7aae
1,920
asm
Assembly
MP/Assignment_7/a7.asm
pratt3000/PICT_SE-Labs
e720414549fe07351055f2075d45755ba181876a
[ "MIT" ]
3
2019-10-15T08:18:52.000Z
2020-02-16T09:34:45.000Z
MP/Assignment_7/a7.asm
pratt3000/PICT_SE-Labs
e720414549fe07351055f2075d45755ba181876a
[ "MIT" ]
null
null
null
MP/Assignment_7/a7.asm
pratt3000/PICT_SE-Labs
e720414549fe07351055f2075d45755ba181876a
[ "MIT" ]
2
2019-10-18T15:06:46.000Z
2020-01-16T06:29:26.000Z
%include "macro.asm" section .data message : db "~Sorting completed" lenMessage : equ $-message reqFile : db "File Name: " lenReqFile : equ $-reqFile space : db " " newline : db 10d errMsg : db "Error!" lenErrMsg : equ $-errMsg section .bss fileName : resb 64 buffer : resb 8192 lenbuffer : equ $-buffer fileDescriptor : resq 1 lenText : resq 1 array : resb 20 section .text global _start _start : print reqFile,lenReqFile read fileName,64 dec rax ;extra bit gets added mov byte[fileName+rax], 0 ;0 is appended for EOF fopen fileName cmp rax, -1d jle error ;for file DNE mov [fileDescriptor],rax ;fileName is stored fread [fileDescriptor], buffer, lenbuffer mov [lenText], rax ;file content length call processBuffer call bubbleSort call processArray print buffer,[lenText] fwrite [fileDescriptor],buffer,[lenText]; jmp exit error: print errMsg, lenErrMsg exit: fclose [fileDescriptor] mov rax, 60 mov rdi, 0 syscall processBuffer: mov rcx, [lenText] mov rsi, buffer mov rdi, array start0:; <<-------\ mov al, [rsi]; | mov [rdi], al; | ; | update0:; | inc rsi; | inc rdi; | dec rcx; | jnz start0; --------/ ret bubbleSort: mov rsi, 0h ;i = 0 mov rcx, [lenText] dec rcx outerLoop: mov rdi, 0h ;j = 0 innerLoop: mov rax, rdi ;j inc rax ;j+1 mov bl, byte[array + rdi] ;array[j] mov dl, byte[array + rax] ;array[j+1] cmp bl, dl ;main compare jnc skip0 mov byte[array + rdi], dl ;swap mov byte[array + rax], bl ;swap skip0: inc rdi cmp rdi, rcx jb innerLoop inc rsi cmp rsi, rcx jb outerLoop ret processArray: mov rsi,array; mov rdi,buffer; mov rcx,[lenText]; begin1: mov al,[rsi]; mov [rdi],al; update1: inc rsi; inc rdi; dec rcx; jnz begin1 ret
16
50
0.609375
54be631610e952a32bbefbcaec49a83cd9741e9e
493
asm
Assembly
smsq/qxl/comm/queue.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
smsq/qxl/comm/queue.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
smsq/qxl/comm/queue.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
; SMS (QXL) Set up comms queue  1998 Tony Tebby section comm xdef qxl_queue_set include 'dev8_keys_qu' ;+++ ; This routine sets up queue ; ; a0 c u base of queue header, base of queue ; a1 s ; a2 c p top of queue ; ; no error return, condition codes arbitrary ;--- qxl_queue_set clr.l (a0)+ ; no link or eoff move.l a2,(a0)+ ; set end of queue lea qu_strtq-8(a0),a1 ; ... back to start move.l a1,(a0)+ ; set in pointer move.l a1,(a0)+ ; and out pointer rts end
18.961538
51
0.643002
9d5f338551a158ccd98fe1b5e0298f6fdae253ad
146
asm
Assembly
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_gmap.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_gmap.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_gmap.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
Name: zel_gmap.asm Type: file Size: 67436 Last-Modified: '2016-05-13T04:36:32Z' SHA-1: C933FFABA953B70A364E2BCBF40C08FF0A7C2710 Description: null
20.857143
47
0.815068
5f879f8344a2741eae358e3e2ebe5204a6e33b24
541
asm
Assembly
programs/oeis/219/A219029.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/219/A219029.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/219/A219029.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A219029: a(n) = n - 1 - phi(phi(n)). ; -1,0,1,2,2,4,4,5,6,7,6,9,8,11,10,11,8,15,12,15,16,17,12,19,16,21,20,23,16,25,22,23,24,25,26,31,24,31,30,31,24,37,30,35,36,35,24,39,36,41,34,43,28,47,38,47,44,45,30,51,44,53,50,47,48,57,46,51,48,61,46,63,48,61,58,63,60,69,54,63,62,65,42,75,52,73,62,71,48,81,66,71,76,71,70,79,64,85,82,83 mov $1,$0 sub $0,1 mov $3,$1 lpb $1 add $1,$3 mov $3,$1 div $3,2 seq $3,10554 ; a(n) = phi(phi(n)), where phi is the Euler totient function. add $0,$3 sub $1,$0 sub $1,1 mov $0,$1 mov $1,$2 lpe
30.055556
288
0.585952
543753875993018979d019ca23e202f9d0efae8b
597
asm
Assembly
audio/sfx/cry03_2.asm
AmateurPanda92/pokemon-rby-dx
f7ba1cc50b22d93ed176571e074a52d73360da93
[ "MIT" ]
9
2020-07-12T19:44:21.000Z
2022-03-03T23:32:40.000Z
audio/sfx/cry03_2.asm
JStar-debug2020/pokemon-rby-dx
c2fdd8145d96683addbd8d9075f946a68d1527a1
[ "MIT" ]
7
2020-07-16T10:48:52.000Z
2021-01-28T18:32:02.000Z
audio/sfx/cry03_2.asm
JStar-debug2020/pokemon-rby-dx
c2fdd8145d96683addbd8d9075f946a68d1527a1
[ "MIT" ]
2
2021-03-28T18:33:43.000Z
2021-05-06T13:12:09.000Z
SFX_Cry03_2_Ch4: dutycycle 240 squarenote 4, 15, 7, 1544 squarenote 6, 14, 6, 1536 squarenote 6, 13, 7, 1520 squarenote 6, 12, 4, 1504 squarenote 5, 13, 3, 1472 squarenote 4, 13, 3, 1440 squarenote 8, 14, 1, 1408 endchannel SFX_Cry03_2_Ch5: dutycycle 10 squarenote 4, 12, 7, 1284 squarenote 6, 10, 6, 1282 squarenote 6, 9, 7, 1265 squarenote 4, 11, 4, 1249 squarenote 5, 10, 3, 1218 squarenote 4, 11, 3, 1187 squarenote 8, 12, 1, 1154 endchannel SFX_Cry03_2_Ch7: noisenote 12, 14, 4, 76 noisenote 10, 12, 7, 92 noisenote 12, 11, 6, 76 noisenote 15, 10, 2, 92 endchannel
19.258065
26
0.691792
ea6beeaf4161d4fc27fb22421703a1d13d2e385c
2,206
asm
Assembly
src/init.asm
Lui37/lttphack
700aedee447b0e0063015d75e25bed6d0bfc9533
[ "MIT" ]
null
null
null
src/init.asm
Lui37/lttphack
700aedee447b0e0063015d75e25bed6d0bfc9533
[ "MIT" ]
null
null
null
src/init.asm
Lui37/lttphack
700aedee447b0e0063015d75e25bed6d0bfc9533
[ "MIT" ]
null
null
null
pushpc ; Code that is run once after the game has been powered on. ; Overrides the following: ; LDA.b #$81 : STA $4200 org $00802F JSL init_hook NOP ; need to fix a small buffer myself since it empties to 0 not in init org $0CC1FF JSL ClearWatchBuffer_pre org $008829 JSL ClearBank7F pullpc ClearBank7F: STA.b $13 INC.b $15 STZ $2181 STZ $2182 LDA.b #$01 STA $2183 LDA.b #.zero>>0 STA $4302 LDA.b #.zero>>8 STA $4303 LDA.b #.zero>>16 STA $4304 LDA #$FF ; fill the whole thing STA $4305 STA $4306 LDA #$08 STA $4300 LDA #$80 STA $4301 LDA #$01 STA $420B ; can't write bank 7F yet STZ $2180 ; last byte RTL .zero dw 0 ClearWatchBuffer: PHX PHA PHP REP #$20 SEP #$10 LDA #$207F LDX #$3E -- STA.l !dg_buffer_r0, X STA.l !dg_buffer_r1, X STA.l !dg_buffer_r2, X STA.l !dg_buffer_r3, X STA.l !dg_buffer_r4, X DEX : DEX : BPL -- PLP PLA PLX RTL .pre STA.b $CA ; vanilla code SEP #$30 BRA ClearWatchBuffer init_hook: JSL init_expand %ai8() LDA #$81 : STA $4200 RTL init_expand: LDA #$01 : STA $420D ; enable fast rom ; enters AI=8 ; If user holds Start+Select, we reinitialize. ; we need some manual joypad reading LDA #$01 : STA $4016 : STZ $4016 ; pulse controller STZ $00 : STZ $01 LDY #$10 ; reading 16 bits -- LDA $4016 ; if the last bit is on, carry will be set, otherwise, it won't; A is still 1 LSR ROL $00 : ROL $01 ; roll carry from A and then from $00 DEY : BNE -- ; decrement %a16() LDA $00 AND #$FF00 : CMP #$3000 : BEQ .forcereset LDA !ram_ctrl_prachack_menu : CMP #$1010 : BEQ .noforcereset .forcereset JSR init_initialize_all BRA .sram_initialized .noforcereset LDA !ram_sram_initialized : CMP #!SRAM_VERSION : BEQ .sram_initialized .reinitialize JSR init_initialize .sram_initialized ; Some features probably should be turned off after a reset %a8() STZ !lowram_oob_toggle LDA #$00 STA.l !ram_superwatch STA.l !ram_superwatch+1 LDA.l !ram_feature_music : BNE + JSL mute_music + .done RTL init_initialize_all: !PERM_INIT init_initialize: !INIT_ASSEMBLY LDA #!SRAM_VERSION : STA !ram_sram_initialized %i16() LDA #$0000 LDX #$00FE .loop STA !sram_movies, X DEX #2 : BPL .loop %i8() RTS
15.319444
90
0.685857
519a50fac395930927b80c50c050c751e58a9554
418
asm
Assembly
lab3/rwarray.asm
samdsk/lab_arch2
45ac71c5647b2a7985f2391686f22ebab685ba67
[ "MIT" ]
null
null
null
lab3/rwarray.asm
samdsk/lab_arch2
45ac71c5647b2a7985f2391686f22ebab685ba67
[ "MIT" ]
null
null
null
lab3/rwarray.asm
samdsk/lab_arch2
45ac71c5647b2a7985f2391686f22ebab685ba67
[ "MIT" ]
null
null
null
.data arr: .space 13 msg_a: .asciiz "Inserisci A: " msg_b: .asciiz "Inserisci B: " msg_c: .asciiz "Inserisci C: " .text .globl main main: #A li $v0 4 la $a0 msg_a syscall li $v0 5 syscall add $s0 $zero $v0 #B li $v0 4 la $a0 msg_b syscall li $v0 5 syscall add $s1 $zero $v0 #C li $v0 4 la $a0 msg_c syscall li $v0 5 syscall add $s2 $zero $v0 #exit li $v0 10 syscall
8.36
30
0.588517
15fb605c46552802f1c5c96723b9d1903b6ae314
7,026
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_67.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_67.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_67.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x14324, %r12 add %r14, %r14 mov (%r12), %r13w nop nop nop nop xor $52515, %rax lea addresses_normal_ht+0x1cea4, %rsi lea addresses_WT_ht+0x3ca4, %rdi nop nop add $8374, %r14 mov $88, %rcx rep movsw nop and $27342, %rdi lea addresses_UC_ht+0x1a574, %rsi lea addresses_normal_ht+0x8058, %rdi nop nop and %rdx, %rdx mov $99, %rcx rep movsq nop nop nop nop nop dec %rcx lea addresses_UC_ht+0x1d044, %r14 nop nop nop add %rdi, %rdi mov $0x6162636465666768, %rdx movq %rdx, %xmm7 movups %xmm7, (%r14) nop inc %rsi lea addresses_normal_ht+0x6084, %rsi lea addresses_D_ht+0x16044, %rdi dec %r12 mov $38, %rcx rep movsb nop nop nop nop nop cmp $45579, %rdx lea addresses_normal_ht+0x1c642, %rcx nop nop dec %rax mov (%rcx), %r12w cmp %rcx, %rcx lea addresses_WT_ht+0xba68, %rdi and $7062, %rcx movb (%rdi), %dl dec %rdx lea addresses_D_ht+0xa1a4, %rcx nop nop cmp %r14, %r14 mov $0x6162636465666768, %r13 movq %r13, %xmm1 movups %xmm1, (%rcx) nop nop nop nop add $18961, %r13 lea addresses_WC_ht+0x13044, %r12 nop nop sub %rax, %rax vmovups (%r12), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $0, %xmm2, %rsi nop nop nop nop nop cmp %rdi, %rdi lea addresses_WT_ht+0x1ea44, %rcx clflush (%rcx) nop nop nop inc %rax movups (%rcx), %xmm1 vpextrq $1, %xmm1, %rdi nop nop nop add %rax, %rax pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r8 push %rax push %rbp push %rbx push %rcx push %rdx // Store lea addresses_WC+0x6044, %rbx cmp $4392, %rcx mov $0x5152535455565758, %rax movq %rax, %xmm3 vmovups %ymm3, (%rbx) nop nop nop nop nop sub %r8, %r8 // Store lea addresses_WT+0x3bc4, %r10 nop nop nop sub $58199, %rbp movl $0x51525354, (%r10) nop nop cmp %rbp, %rbp // Faulty Load lea addresses_D+0x5844, %r10 nop nop nop nop nop add $61205, %rax mov (%r10), %rcx lea oracles, %rbx and $0xff, %rcx shlq $12, %rcx mov (%rbx,%rcx,1), %rcx pop %rdx pop %rcx pop %rbx pop %rbp pop %rax pop %r8 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC', 'congruent': 9}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT', 'congruent': 7}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_D', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D_ht', 'congruent': 4}} {'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}} {'dst': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 8}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}} {'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal_ht', 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 2}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 3}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 11}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT_ht', 'congruent': 9}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
35.664975
2,999
0.657985
29684d40a492a54ffa918e11f6d2600809b81faa
723
asm
Assembly
progs/chap05h05-fact.asm
HKhademian/AssemblyDandamudi
b4d4ccbb7e585953a8d2d22b47d815a3f45f9129
[ "Unlicense" ]
1
2020-05-07T14:20:09.000Z
2020-05-07T14:20:09.000Z
progs/chap05h05-fact.asm
HKhademian/AssemblyDandamudi
b4d4ccbb7e585953a8d2d22b47d815a3f45f9129
[ "Unlicense" ]
null
null
null
progs/chap05h05-fact.asm
HKhademian/AssemblyDandamudi
b4d4ccbb7e585953a8d2d22b47d815a3f45f9129
[ "Unlicense" ]
null
null
null
%include "lib.asm" extern ExitProcess global _start section .text section .bss buffer resb 25 section .data section .code _start: fgets buffer, 12 a2i 12, buffer ;push EAX ;call facStack ;pop EAX call facReg i2a EAX, buffer putstr buffer jmp _end facReg: %define n EAX cmp n, 1 jg facReg_rec mov n, 1 jmp facReg_done facReg_rec: push n dec n call facReg imul n, DWORD [ESP] add ESP, 4 facReg_done: ret facStack: %define n DWORD [EBP+8] enter 0, 0 push EAX mov EAX, n cmp EAX, 1 jg facStack_rec mov n, 1 jmp facStack_done facStack_rec: dec EAX push EAX call facStack pop EAX imul EAX, n mov n, EAX facStack_done: pop EAX leave ret _end: push 0 call ExitProcess
9.64
24
0.697095
9f3647dbdd5d20efb1884d8d2012f2fb3183a876
621
asm
Assembly
programs/oeis/158/A158002.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/158/A158002.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/158/A158002.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A158002: a(n) = 392*n + 1. ; 1,393,785,1177,1569,1961,2353,2745,3137,3529,3921,4313,4705,5097,5489,5881,6273,6665,7057,7449,7841,8233,8625,9017,9409,9801,10193,10585,10977,11369,11761,12153,12545,12937,13329,13721,14113,14505,14897,15289,15681,16073,16465,16857,17249,17641,18033,18425,18817,19209,19601,19993,20385,20777,21169,21561,21953,22345,22737,23129,23521,23913,24305,24697,25089,25481,25873,26265,26657,27049,27441,27833,28225,28617,29009,29401,29793,30185,30577,30969,31361,31753,32145,32537,32929,33321,33713,34105,34497,34889,35281,35673,36065,36457,36849,37241,37633,38025,38417,38809 mul $0,392 add $0,1
103.5
570
0.797101
e363fe3c59f7e8443bb47a28a0260ef25768976a
149
asm
Assembly
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/risc.lzh/risc/mak/kart-main-p.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/risc.lzh/risc/mak/kart-main-p.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/risc.lzh/risc/mak/kart-main-p.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
Name: kart-main-p.asm Type: file Size: 18794 Last-Modified: '1992-08-06T06:35:52Z' SHA-1: 3245C308906FE40A2D7C3F9492D79C83D95A4678 Description: null
21.285714
47
0.805369
36d07c9828ad171eb1e37538c9a83ac4bc1e1780
513
asm
Assembly
programs/oeis/096/A096182.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/096/A096182.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/096/A096182.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A096182: Index of first occurrence of n in A095773. ; 1,2,4,6,8,10,13,16,19,22,26,30,34,38,42,46,51,56,61,66,71,76,82,88,94,100,106,112,118,124,130,136,142,148,155,162,169,176,183,190,197,204,211,218,225,232,240,248,256,264,272,280,288,296,304,312,320,328,336 mov $7,$0 mov $9,$0 add $9,1 lpb $9,1 clr $0,7 mov $0,$7 sub $9,1 sub $0,$9 add $6,2 lpb $0,1 div $0,2 add $1,3 add $0,$1 mov $6,$1 sub $1,1 lpe div $0,2 add $6,$0 add $6,1 div $6,2 add $8,$6 lpe mov $1,$8
19
207
0.582846
352529ba0d310ed700d85e018ff3ee9360fedf11
282
asm
Assembly
programs/oeis/101/A101000.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/101/A101000.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/101/A101000.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A101000: Periodic sequence with period 3. ; 0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3,0,1,3 mov $1,$0 mod $1,3 mul $1,2 trn $1,1
35.25
199
0.542553
7ac17ef73b7d66d1450d814b3a5efa7d412b2fad
6,289
asm
Assembly
source/assembler/subgroup.asm
paulscottrobson/6502-basic
d4c360041bfa49427a506465e58bb0ef94beaa44
[ "MIT" ]
3
2021-09-30T19:34:11.000Z
2021-10-31T06:55:50.000Z
source/assembler/subgroup.asm
paulscottrobson/6502-Basic
d4c360041bfa49427a506465e58bb0ef94beaa44
[ "MIT" ]
null
null
null
source/assembler/subgroup.asm
paulscottrobson/6502-Basic
d4c360041bfa49427a506465e58bb0ef94beaa44
[ "MIT" ]
1
2021-12-07T21:58:44.000Z
2021-12-07T21:58:44.000Z
; ************************************************************************************************ ; ************************************************************************************************ ; ; Name: subgroup.asm ; Purpose: Handle the five sub-sections ; Created: 15th March 2021 ; Reviewed: 6th April 2021 ; Author: Paul Robson (paul@robsons.org.uk) ; ; ************************************************************************************************ ; ************************************************************************************************ .section code ; ************************************************************************************************ ; ; Group 1 ; ; Group 1 is the and,adc,sbc,lda,sta group and is perfectly orthogonal except for STA # which ; does not make sense (and is BIT #) ; ; ************************************************************************************************ AssembleGroup1: lda asmToken ; firstly, we throw out STA immediate cmp #TKW_STA bne _AG1NotStoreImm lda asmMode cmp #AMD_IMM beq AG1ModeError ; _AG1NotStoreImm: ldx asmMode ; get mode into X. lda AMDOperandSize,X ; get the size of the operand and push on stack pha beq AG1ModeError ; if the size is zero, the mode must be Accumulator ; cpx #0 ; if the mode is zero, e.g. immediate bne _AG1NotImmediate ldx #2 ; then we use offset 2 here. This is how the 6502 _AG1NotImmediate: ; does it, rather illogically. cpx #AMD_ZEROINDX ; (zero,x) uses slot 0. bne _AG1NotZX ldx #0 _AG1NotZX: pla ; restore length cpx #9 ; anything > 8 fails. bcs AG1Fail ; AG1ReturnValue: sta tempShort ; save size of operand clc lda AMDOffsetFromBase,X ; get the offset for the address mode. adc asmBaseOpcode ; add the base opcode. ldx tempShort ; length in X jsr AsmWriteInstruction ; output instruction. sec rts AG1Fail: clc rts AG1ModeError: .throw Assembler ; ; Operand size of each mode (unmodified) ; AMDOperandSize: .byte 1,1,0,2 .byte 1,1,2,2 .byte 1,1,2,2 .byte 1,1 ; ; Offset for each mode (unmodified) (after 8, which is (ZP,X) all are for specific cases) ; AMDOffsetFromBase: .byte 0,4,8,12 .byte 16,20,24,28 .byte 17,0,0,0 .byte 0,0 ; ************************************************************************************************ ; ; Group 2 ; ; Group 2 are most of the rest with an operand - LDX INC ROL and so on. They follow a standard ; pattern closely but not all address mode variations are present for these instructions. ; (the main variation is that LDX and STX indexing uses Y not X) ; ; A table (Group2OpcodeAvailability) uses bits to indicate which mode is available for each ; token. ; ; ************************************************************************************************ AssembleGroup2: lda asmMode ; get the mode; if >= 8 cannot be a legit group 2 cmp #8 bcs _AG2Fail sta temp0 ; save in temp9 ; ldx asmToken ; get token in X, then get the availability flags for it lda Group2OpcodeAvailability-TKA_GROUP2,x _AG2Shift: ; do Y+1 shifts, so availability bit will be in C lsr a dec temp0 bpl _AG2Shift bcc _AG2Fail ; cannot do that instruction w/that opcode. ; ldx asmMode ; mode in X lda AMDOperandSize,X ; get the size of the operand in A jmp AG1ReturnValue ; and use that with Group 1's exit code _AG2Fail: clc rts ; ************************************************************************************************ ; ; Group 3 ; ; Group 3 are the branch operations, which are all identical (to the assembler !) ; ; ************************************************************************************************ AssembleGroup3: lda SingleLetterVar+("O"-"A")*4 ; check bit 0 (pass) of O lsr a lda #0 ; if clear, e.g. pass 1, use default zero. bcc _AG3Default sec ; calculate branch offset lda esInt0 sbc SingleLetterVar+("P"-"A")*4 tax lda esInt1 sbc SingleLetterVar+("P"-"A")*4+1 sta esInt1 ; txa ; add 126, now 128 too many. clc ; we can use this to check the range adc #126 sta esInt0 bcc _AG3NoCarry inc esInt1 _AG3NoCarry: lda esInt1 ; check in range. bne _AG3Range lda esInt0 ; fix up branch distance sec sbc #128 _AG3Default: sta esInt0 _AG3ExitOk: ldx #1 ; one opcode, use AG4 Code bne AG4Write _AG3Range: .throw Branch ; ************************************************************************************************ ; ; Group 4 ; ; Group 4 are the stand alone opcodes. ; ; ************************************************************************************************ AssembleGroup4: ldx #0 ; no parameters in the opcode. AG4Write: lda asmBaseOpcode ; the opcode is the opcode base. jsr AsmWriteInstruction ; output instruction. sec rts ; ************************************************************************************************ ; ; Group 5 / Specials ; ; These are the special cases. It is a table (AssemblerSpecialCases) of token/mode/opcode ; triplets, one for each case where the opcode does not fit the pattern. This either the ; LDX/STX indices, oddities like jmp (aaaa,x) or opcodes like STZ which were added to the ; 65C02 and cannot use the standard pattern. ; ; ************************************************************************************************ AssembleSpecialCase: ldx #0 _ASCScan: lda AssemblerSpecialCases,x ; scan token and mode for match cmp asmToken bne _ASCNext lda AssemblerSpecialCases+1,x cmp asmMode beq _ASCFound _ASCNext: inx ; next entry inx inx lda AssemblerSpecialCases,x ; until table ends bne _ASCScan clc rts _ASCFound: lda AssemblerSpecialCases+2,x ; get the new opcode. pha ldx asmMode ; mode in X lda AMDOperandSize,X ; get the size of the operand in X tax pla ; opcode back jsr AsmWriteInstruction ; output instruction. sec rts .send code
28.848624
98
0.509461
621dc7ea9c369cf19826b077c16fa7735a021a0f
4,063
asm
Assembly
Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21_1833.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21_1833.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21_1833.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r8 push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0xfdf3, %r8 nop add $38431, %rdi movw $0x6162, (%r8) nop nop nop nop add $65118, %r11 lea addresses_D_ht+0x4733, %rdx clflush (%rdx) nop nop nop nop cmp %rsi, %rsi mov (%rdx), %r8 cmp $46636, %rdi lea addresses_WT_ht+0x7ef3, %rsi lea addresses_A_ht+0x15713, %rdi clflush (%rdi) nop nop and %r12, %r12 mov $101, %rcx rep movsb nop nop nop nop sub %rcx, %rcx lea addresses_WT_ht+0x1af93, %rdi nop nop nop nop and %rdx, %rdx and $0xffffffffffffffc0, %rdi vmovaps (%rdi), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %rcx nop nop dec %r12 lea addresses_A_ht+0x134b3, %r12 nop nop nop sub $35988, %rcx mov $0x6162636465666768, %r8 movq %r8, %xmm5 vmovups %ymm5, (%r12) nop nop nop nop nop and %r12, %r12 lea addresses_WT_ht+0xb723, %r11 nop nop nop nop nop cmp %rsi, %rsi movw $0x6162, (%r11) nop nop nop inc %r11 pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r8 push %r9 push %rax push %rbx push %rdi // Load mov $0x13d96b0000000ce5, %rdi nop and $42025, %rax mov (%rdi), %r9d nop nop nop inc %rax // Store lea addresses_WT+0x4df3, %rax nop inc %rbx mov $0x5152535455565758, %r9 movq %r9, %xmm1 and $0xffffffffffffffc0, %rax movaps %xmm1, (%rax) nop nop nop nop nop xor $9576, %r8 // Store lea addresses_D+0x14df3, %rdi sub $3701, %r14 mov $0x5152535455565758, %rbx movq %rbx, (%rdi) nop nop nop nop nop cmp %r12, %r12 // Store lea addresses_normal+0x61f3, %r14 clflush (%r14) add %rdi, %rdi mov $0x5152535455565758, %r9 movq %r9, (%r14) nop nop nop nop sub $32699, %rax // Store mov $0x243e1b0000000793, %rbx nop nop add $35497, %r8 movl $0x51525354, (%rbx) nop nop nop nop nop add %r14, %r14 // Store lea addresses_UC+0x1ed23, %r9 nop nop nop nop add %r14, %r14 mov $0x5152535455565758, %rbx movq %rbx, (%r9) nop inc %rbx // Faulty Load lea addresses_D+0x14df3, %r14 and $16546, %rdi mov (%r14), %ebx lea oracles, %r12 and $0xff, %rbx shlq $12, %rbx mov (%r12,%rbx,1), %rbx pop %rdi pop %rbx pop %rax pop %r9 pop %r8 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_NC', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_NC', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_D', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'58': 21} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
19.165094
147
0.645336
05cb56c3ee809d37490b39997b418fdcb3330e29
625
asm
Assembly
libsrc/tiki100/gr_scroll.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
null
null
null
libsrc/tiki100/gr_scroll.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
null
null
null
libsrc/tiki100/gr_scroll.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
null
null
null
; ; More TIKI-100 graphics routines ; by Frode van der Meeren ; ; void __FASTCALL__ gr_vscroll(int lines) ; void __FASTCALL__ gr_vscroll_abs(int lines) ; ; Scroll display any number of lines, or set it to ; an absolute line number. ; ; Changelog: ; ; v1.0 - FrodeM ; * Added relative and absolute vertical positioning/scroll ; ; $Id: gr_scroll.asm,v 1.1 2015/11/03 20:03:37 stefano Exp $ ; PUBLIC gr_vscroll PUBLIC gr_vscroll_abs gr_vscroll: ld b,a ld a,$0E out ($16),a in a,($17) sub b out ($17),a RET gr_vscroll_abs: ld b,a ld a,$0E out ($16),a ld a,b out ($17),a RET
16.891892
64
0.648
815c8692acff9eda3ea78802a8e2a4abb78fce97
1,842
asm
Assembly
programs/oeis/013/A013957.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/013/A013957.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/013/A013957.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A013957: sigma_9(n), the sum of the 9th powers of the divisors of n. ; 1,513,19684,262657,1953126,10097892,40353608,134480385,387440173,1001953638,2357947692,5170140388,10604499374,20701400904,38445332184,68853957121,118587876498,198756808749,322687697780,513002215782,794320419872,1209627165996,1801152661464,2647111898340,3814699218751,5440108178862,7625984925160,10599157616456,14507145975870,19722455410392,26439622160672,35253226045953,46413842369328,60835580643474,78815680978608,101763873519661,129961739795078,165538788961140,208738965677816,262657136433510,327381934393962,407486375394336,502592611936844,619331466937644,756719475330798,923991315331032,1119130473102768,1355321291969764,1628413638264057,1956940699219263,2334283760986632,2785345992076718,3299763591802134,3912130266607080,4605368943885192,5426768739979080,6351784643101520,7442165885621310,8662995818654940,10097935615452888,11694146092834142,13563526168424736,15634608864694184,18049651735527937,20711923444343124,23810301135465264,27206534396294948,31147935877335186,35453888988257376,40432444342025904,45848500718449032,52103103629506605,58871586708267914,66670372514875014,75088539421894684,84756182635801460,95151696847472736,107083089392719608,119851595982618320,134480453855910246,150102261281924281,167946932344102506,186940255267540404,208633818522319904,231617064873032748,257830009923600972,285558661389025080,317097713430021420,350356403707485210,388197090844699374,427929810774641392,473085354602149848,520437522610667648,574113932701719984,630249732414260280,693924501488538852,760231058654565218,835376196429461241,913563661713430716,1001957452699481407 add $0,1 mov $2,$0 mov $3,8 lpb $0 pow $3,9 add $1,$3 mov $3,$2 mov $4,$0 cmp $4,0 add $0,$4 dif $3,$0 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 lpe sub $1,134217727 mov $0,$1
83.727273
1,575
0.879479
0ee493e09805cbde267e569ee9a2a1081befbf0a
15,227
asm
Assembly
monitor/string_library.asm
mfkiwl/QNICE-FPGA-hyperRAM
aabc8291ac1e0c4666c51f84acddf599d7521e53
[ "BSD-3-Clause" ]
53
2016-04-12T07:22:49.000Z
2022-03-25T09:24:48.000Z
monitor/string_library.asm
mfkiwl/QNICE-FPGA-hyperRAM
aabc8291ac1e0c4666c51f84acddf599d7521e53
[ "BSD-3-Clause" ]
196
2020-06-05T04:59:50.000Z
2021-03-13T21:27:11.000Z
monitor/string_library.asm
mfkiwl/QNICE-FPGA-hyperRAM
aabc8291ac1e0c4666c51f84acddf599d7521e53
[ "BSD-3-Clause" ]
15
2017-07-31T11:26:56.000Z
2022-02-22T14:22:46.000Z
; ;;======================================================================================= ;; The collection of string related functions starts here ;;======================================================================================= ; ;*************************************************************************************** ;* CHR$TO_UPPER expects a character to be converted to upper case in R8 ;*************************************************************************************** ; CHR$TO_UPPER INCRB MOVE R8, R0 ; Save character SUB 'a', R0 ; Less than 'a'? RBRA _CHR$TO_UPPER_EXIT, N ; Yes - nothing to do MOVE 'z', R0 ; Check if greater than 'z' SUB R8, R0 RBRA _CHR$TO_UPPER_EXIT, N ; Yes - nothing to do SUB 'a', R8 ; Perform the conversion ADD 'A', R8 _CHR$TO_UPPER_EXIT DECRB RET ; ;*************************************************************************************** ;* CHR$TO_LOWER expects a character to be converted to lower case in R8 ;*************************************************************************************** ; CHR$TO_LOWER INCRB CMP R8, '@' ; Is it "@" or less than that? RBRA _CHR$TO_LOWER_EXIT, !N ; Yes: nothing to do CMP R8, 'Z' ; Is it greater than 'Z' RBRA _CHR$TO_LOWER_EXIT, N ; Yes: nothing to do ADD 0x0020, R8 ; Perform the conversion _CHR$TO_LOWER_EXIT DECRB RET ; ;*************************************************************************************** ;* STR$TO_UPPER expects the address of a string to be converted to upper case in R8 ;*************************************************************************************** ; STR$TO_UPPER INCRB ; Get a new scratch register page MOVE R8, R0 ; Do not destroy parameters _STR$TO_UPPER_LOOP MOVE @R0, R1 ; Null terminator found? RBRA _STR$TO_UPPER_END, Z ; Yes - that is it MOVE R1, R2 SUB 'a', R2 ; Less than 'a'? RBRA _STR$TO_UPPER_NEXT, N ; Yes MOVE 'z', R2 ; Greater than 'z'? SUB R1, R2 RBRA _STR$TO_UPPER_NEXT, N ; Yes SUB 'a', R1 ; Now convert the LC char to UC ADD 'A', R1 MOVE R1, @R0 ; Store it back into the string _STR$TO_UPPER_NEXT ADD 0x001, R0 RBRA _STR$TO_UPPER_LOOP, 1 ; Process next character _STR$TO_UPPER_END DECRB ; Restore old register page RET ; ;*************************************************************************************** ;* STR$LEN expects the address of a string in R8 and returns its length in R9 ;*************************************************************************************** ; STR$LEN INCRB ; Get a new scratch register page MOVE R8, R0 ; Do not work with the original pointer MOVE 0xFFFF, R9 ; R9 = -1 _STR$LEN_LOOP ADD 0x0001, R9 ; One character found MOVE @R0++, R1 ; Was it the terminating null word? RBRA _STR$LEN_LOOP, !Z ; No? DECRB RET ; ;*************************************************************************************** ;* STR$CHOMP removes a trailing LF/CR from a string pointed to by R8 ;*************************************************************************************** ; STR$CHOMP INCRB ; Get a new register page MOVE R8, R0 ; Save the start address of the string MOVE R9, R1 ; R9 will be used later MOVE R8, R2 ; R2 will be used as a working pointer RSUB STR$LEN, 1 ; Determine the length of the string MOVE R9, R9 ; Is the string empty? RBRA _STR$CHOMP_EXIT, Z ; Yes ADD R9, R2 ; R2 now points to the last string character MOVE @--R2, R3 ; Get a character SUB 0x000D, R3 ; Is it a CR (we are working from right!) RBRA _STR$CHOMP_1, !Z ; No, so nothing to do so far MOVE 0x0000, @R2 ; Yes, replace it with a null word SUB 0x0001, R2 ; Proceed to second last character _STR$CHOMP_1 MOVE @R2, R3 ; Now test for a line feed SUB 0x000A, R3 RBRA _STR$CHOMP_EXIT, !Z ; Nothing to do MOVE 0x0000, @R2 ; Replace the LF with a null word _STR$CHOMP_EXIT MOVE R1, R9 ; Restore R9 DECRB ; Restore register bank RET ; ;*************************************************************************************** ;* STR$CMP compares two strings ;* ;* R8: Pointer to the first string (S0), ;* R9: Pointer to the second string (S1), ;* ;* R10: negative if (S0 < S1), zero if (S0 == S1), positive if (S0 > S1) ; ;* The contents of R8 and R9 are being preserved during the run of this function ;*************************************************************************************** ; STR$CMP INCRB ; Get a new register page MOVE R8, R0 ; Save arguments MOVE R9, R1 _STR$CMP_LOOP MOVE @R0, R10 ; while (*s1 == *s2++) MOVE @R1++, R2 SUB R10, R2 RBRA _STR$CMP_END, !Z MOVE @R0++, R10 ; if (*s1++ == 0) RBRA _STR$CMP_EXIT, Z ; return 0; RBRA _STR$CMP_LOOP, 1 ; end-of-while-loop _STR$CMP_END MOVE @--R1, R2 ; return (*s1 - (--*s2)); SUB R2, R10 _STR$CMP_EXIT DECRB ; Restore previous register page RET ; ;*************************************************************************************** ;* STR$STRCHR seaches for the first occurrence of the character stored in R8 in a ;* string pointed to by R9. ;* ;* R8: Character to be searched ;* R9: Pointer to the string ;* ;* R10: Zero if the character has not been found, otherwise it contains a pointer ;* to the first occurrence of the character in the string ; ;* The contents of R8 and R9 are being preserved during the run of this function ;*************************************************************************************** ; STR$STRCHR INCRB MOVE R9, R0 XOR R10, R10 _STR$STRCHR_LOOP CMP 0x0000, @R0 ; while (*string) RBRA _STR$STRCHR_EXIT, Z CMP R8, @R0 ; if (*string == R8) RBRA _STR$STRCHR_NEXT, !Z MOVE R0, R10 RBRA _STR$STRCHR_EXIT, 1 _STR$STRCHR_NEXT ADD 0x0001, R0 ; string++ RBRA _STR$STRCHR_LOOP, 1 _STR$STRCHR_EXIT DECRB RET ; ;*************************************************************************************** ;* STR$SPLIT splits a string into substrings using a delimiter char ;* ;* Returns the substrings on the stack, i.e. after being done, you need to ;* add the amount of words returned in R9 to the stack pointer to clean ;* it up again and not leaving "memory leaks". ;* ;* The memory layout of the returned area is: ;* <size of string incl. zero terminator><string><zero terminator> ;* ;* The strings are returned in positive order, i.e. you just need to add ;* the length of the previous string to the returned string pointer ;* (i.e. stack pointer) to jump to the next substring from left to right. ;* ;* INPUT: R8: pointer to zero terminated string ;* R9: delimiter char ;* OUTPUT: SP: stack pointer pointer to the first string ;* R8: amount of strings ;* R9: amount of words to add to the stack pointer to restore it ;*************************************************************************************** ; STR$SPLIT INCRB MOVE @SP++, R0 ; save return address and ; delete it by adding 1 ; find the end of the string, R1 will point to it MOVE 1, R2 MOVE R8, R1 _STR$SPLIT_FE CMP @R1, 0 RBRA _STR$SPLIT_FE2, Z ADD R2, R1 RBRA _STR$SPLIT_FE, 1 _STR$SPLIT_FE2 MOVE R1, R2 ; R2 = end of current substr XOR R6, R6 ; R6 = amount of strings XOR R7, R7 ; R7 = amount of words for R9 ; skip empty string CMP R8, R1 RBRA _STR$SPLIT_END, Z ; find the first occurrence of the delimiter _STR$SPLIT_FD CMP @--R1, R9 ; check for delimiter, mv left RBRA _STR$SPLIT_SS, Z ; yes, delimiter found CMP R1, R8 ; beginning of string reached? RBRA _STR$SPLIT_SS, Z RBRA _STR$SPLIT_FD, 1 ; copy substring on the stack, if it is at least one ; non-delimiter character _STR$SPLIT_SS MOVE R2, R3 SUB R1, R3 ; length of substring w/o zero CMP R3, 1 ; only one character? RBRA _STR$SPLIT_SSB, !Z ; no: go on CMP @R1, R9 ; only one char and char=delim RBRA _STR$SPLIT_SSSK, Z ; yes: skip _STR$SPLIT_SSB ADD 1, R6 ; one more string SUB R3, SP ; reserve memory on the stack SUB 2, SP ; size word & zero terminator ADD R3, R7 ; adjust amount of words .. ADD 2, R7 ; .. equally to stack usage CMP @R1, R9 ; first char delimiter? RBRA _STR$SPLIT_SSBG, !Z ; no: go on ADD 1, SP ; yes: adjust stack usage .. SUB 1, R7 ; .. and word counter .. SUB 1, R3 ; .. and reduce length .. ADD 1, R1 ; .. and change start _STR$SPLIT_SSBG MOVE R1, R4 ; R4 = cur. char of substring MOVE SP, R5 ; R5 = target memory of char MOVE R3, @R5 ; save size w/o zero term. ADD 1, @R5++ ; adjust for zero term. _STR$SPLIT_SSCP MOVE @R4++, @R5++ ; copy char SUB 1, R3 ; R3 = amount to be copied RBRA _STR$SPLIT_SSCP, !Z MOVE 0, @R5 ; add zero terminator _STR$SPLIT_SSSK MOVE R1, R2 ; current index = new end CMP R1, R8 ; beginning of string reached? RBRA _STR$SPLIT_FD, !Z _STR$SPLIT_END MOVE R6, R8 ; return amount of strings MOVE R7, R9 ; return amount of bytes MOVE R0, @--SP ; put return address on stack DECRB RET ; ;*************************************************************************************** ;* STR$H2D converts a 32bit value to a decimal representation in ASCII; ;* leading zeros are replaced by spaces (ASCII 0x20); zero terminator is added ;* ;* INPUT: R8/R9 = LO/HI of the 32bit value ;* R10 = pointer to a free memory area that is 11 words long ;* OUTPUT: R10 = the function fills the given memory space with the ;* decimal representation and adds a zero terminator ;* this includes leading white spaces ;* R11 = pointer to string without leading white spaces ;* R12 = amount of digits/characters that the actual number has, ;* without the leading spaces ;*************************************************************************************** ; STR$H2D INCRB MOVE R8, R0 ; save original values MOVE R9, R1 MOVE R10, R2 MOVE R10, R3 ; R3: working pointer XOR R4, R4 ; R4: digit counter ; add zero terminator ADD 10, R3 MOVE 0, @R3 ; extract decimals by repeatedly dividing the 32bit value ; by 10; the modulus is the decimal that is converted to ; ASCII by adding the ASCII code of zero which is 0x0030 XOR R11, R11 ; high word = 0 _STR$H2D_ML MOVE 10, R10 ; divide by 10 RSUB MTH$DIVU32, 1 ; perform division ADD 0x0030, R10 ; R10 = digit => ASCII conv. MOVE R10, @--R3 ; store digit ADD 1, R4 ; increase digit counter CMP R8, 0 ; quotient = 0? (are we done?) RBRA _STR$H2D_TS, Z ; yes: add trailing spaces RBRA _STR$H2D_ML, 1 ; next digit, R8/R9 has result _STR$H2D_TS CMP R3, R2 ; working pntr = memory start RBRA _STR$H2D_DONE, Z ; yes: then done MOVE 0x0020, @--R3 ; no: add trailing space RBRA _STR$H2D_TS, 1 ; next digit _STR$H2D_DONE MOVE R0, R8 ; restore original values MOVE R1, R9 MOVE R2, R10 MOVE R10, R11 ; return pointer to string .. MOVE 10, R7 ; .. without white spaces SUB R4, R7 ADD R7, R11 MOVE R4, R12 ; return digit counter DECRB RET
51.792517
90
0.404216
590ba5e947c89fc786ebeaa12ff8665afd48f408
47,019
asm
Assembly
Opus/asm/fetchn3.asm
Computer-history-Museum/MS-Word-for-Windows-v1.1
549a2a32e930694df7b91e3273b886d735fa9151
[ "MIT" ]
2
2018-01-22T14:38:52.000Z
2019-02-25T02:16:30.000Z
Microsoft DOS/Word 1.1a CHM Distribution/Opus/asm/fetchn3.asm
mindcont/Open-Source
416917cbe3d4469cc036d05e7c858b05b8081ded
[ "CC0-1.0" ]
null
null
null
Microsoft DOS/Word 1.1a CHM Distribution/Opus/asm/fetchn3.asm
mindcont/Open-Source
416917cbe3d4469cc036d05e7c858b05b8081ded
[ "CC0-1.0" ]
1
2021-06-25T17:34:43.000Z
2021-06-25T17:34:43.000Z
include w2.inc include noxport.inc include consts.inc include structs.inc createSeg _FETCH,fetch,byte,public,CODE ; DEBUGGING DECLARATIONS ifdef DEBUG midFetchn3 equ 14 ; module ID, for native asserts endif ; EXPORTED LABELS ; EXTERNAL FUNCTIONS externFP <IbpReadFilePage> externFP <HpsAlter,ApplySprm> externFP <AnsiLower,MapStcStandard> externFP <IInPlcRef> externFP <IInPlcCheck> externFP <N_FetchCp> externFP <N_CachePara> externFP <IbpLoadFn> externNP <LN_IcpInRgcp> externNP <LN_LprgcpForPlc> externNP <LN_PdodOrNilFromDoc> externNP <LN_ReloadSb> externNP <LN_CpFromPlcIcp> externNP <LN_FInCa> externFP <CpMacDocEdit> externFP <CpFirstTap> ifdef DEBUG externFP <AssertProcForNative> externFP <S_CachePara,S_FetchCp> externFP <S_ApplyPrlSgc> externFP <CpMacDoc> externFP <FInCa> endif ; EXTERNAL DATA sBegin data externW vchpStc ; extern struct CHP vchpStc; externW vhpchFetch ; extern HUGE *vhpchFetch; externW mpfnhfcb ; extern struct FCB **mpfnhfcb[]; externW vsab ; extern struct SAB vsab; externW vibp ; extern int vibp; externW vbptbExt ; extern struct BPTB vbptbExt; externW vstcpMapStc ; extern int vstcpMapStc; externW dnsprm ; extern struct ESPRM dnsprm[]; externW vfnPreload ; extern int vfnPreload; externW vpapFetch ; extern struct PAP vpapFetch; externW caPara ; extern struct CA caPara; externW vdocFetch ; extern int vdocFetch; externD vcpFetch ; extern CP vcpFetch; externW fcmFetch ; extern int fcmFetch; externW vcaCell ; extern struct CA vcaCell; externD vcpFirstTablePara ; extern CP vcpFirstTablePara; externD vcpFirstTableCell ; extern CP vcpFirstTableCell; externW vdocTemp ; extern int vdocTemp; externD vmpitccp ; extern CP vmpitccp[]; externW caTap ; extern struct CA caTap; externW vtapFetch ; extern struct TAP vtapFetch; ifdef DEBUG externW wFillBlock endif sEnd data ; CODE SEGMENT _FETCH sBegin fetch assumes cs,fetch assumes ds,dgroup assumes ss,dgroup ;------------------------------------------------------------------------- ; BFromFc(hpfkp,fc,pfcFirst,pfcLim,pifc) ;------------------------------------------------------------------------- ; %%Function:N_BFromFc %%Owner:BRADV cProc N_BFromFc,<PUBLIC,FAR>,<si,di> ParmD hpfkp ParmD fc ParmW pfcFirst ParmW pfcLim ParmW pifc ifdef DEBUG LocalW diSave endif ;DEBUG ; /* B F R O M F C */ ; /* Return the b, fcFirst & fcLim for the first run with fcLim > fc. */ ; native int BFromFc(hpfkp, fc, pfcFirst, pfcLim, pifc) ; struct FKP HUGE *hpfkp; ; FC fc, *pfcFirst, *pfcLim; ; { cBegin mov bx,[SEG_hpfkp] ;LN_ReloadSb takes an sb in bx and set es to the corresponding value. ;Only es and bx are altered. call LN_ReloadSb mov di,[OFF_hpfkp] mov ax,[OFF_fc] mov dx,[SEG_fc] call LN_BFromFcCore mov di,[pfcFirst] movsw movsw mov di,[pfcLim] movsw movsw push ss pop ds mov bx,[pifc] mov [bx],cx ; } cEnd ; LN_BFromFcCore takes qfkp in es:di, fc in dx:ax. ; The result is returned in ax. ifc is returned in cx. ; Upon exit ds == es upon input, es == psDds, ; and ds:si points to (qfkp->rgfc[ifc]) ; %%Function:LN_BFromFcCore %%Owner:BRADV PUBLIC LN_BFromFcCore LN_BFromFcCore: ; struct RUN *prun, *rgrun; ; int crun, ifc; ; ; crun = hpfkp->crun; ; *pifc = ifc = IcpInRgcp(LpFromHp(hpfkp->rgfc), crun, (CP) fc); errnz <(rgfcFkp)> mov cl,es:[di.crunFkp] xor ch,ch push cx ;save crun ; LN_IcpInRgcp expects lprgcp in es:di, icpLim in cx, and cp in ax:dx. ; bx and di are not altered. cCall LN_IcpInRgcp pop cx ;restore crun ; *pfcFirst = (hpfkp->rgfc)[ifc]; ; *pfcLim = (hpfkp->rgfc)[ifc + 1]; ; ax = ifc, es:di = pfkp, cx = crun push es pop ds push ss pop es mov si,ax shl si,1 shl si,1 add si,di push si mov si,di ; return (((char *)&((hpfkp->rgfc)[hpfkp->crun + 1]))[ifc]) << 1); ; ax = ifc ; cx = crun errnz <(rgfcFkp)> inc cx shl cx,1 shl cx,1 add si,cx add si,ax mov cx,ax ; NOTE: we know ah is zero because ifc < (cbFkp / 4) lodsb shl ax,1 pop si ret ;------------------------------------------------------------------------- ; MapStc(pdod, stc, pchp, ppap) ;------------------------------------------------------------------------- ; %%Function:N_MapStc %%Owner:BRADV cProc N_MapStc,<PUBLIC,FAR>,<si,di> ParmW pdod ParmW stcArg ParmW pchp ParmW ppap ; /* M A P S T C */ ; /* maps pdod, stc into ; *pchp ; *ppap ; */ ; native MapStc(pdod, stc, pchp, ppap) ; struct DOD *pdod; int stc; struct CHP *pchp; struct PAP *ppap; ; { ; int cch, stcpT; ; CHAR HUGE *hpchpe, HUGE *hppape; ; cBegin mov bx,pdod mov cx,stcArg mov dx,pchp mov di,ppap cCall LN_MapStc,<> ; } cEnd ; LN_MapStc takes pdod in bx, stc in cx, pchp in dx, ppap in di. ; ax, bx, cx, dx, si, di are altered. ; %%Function:LN_MapStc %%Owner:BRADV PUBLIC LN_MapStc LN_MapStc: ; #ifdef DEBUG ; int cMothers = 0; ; #endif /* DEBUG */ ifdef DEBUG push cx ;save stc xor cx,cx ;cMothers = 0; endif ;DEBUG ; while (!pdod->fMother || pdod->fMotherStsh) ; { MS01: cmp [bx.FMotherDod],fFalse je MS015 test [bx.FMotherStshDod],maskFMotherStshDod je MS02 MS015: ifdef DEBUG ; /* Assert (cMothers ++ < 5 && pdod->doc != docNil) with a call ; so as not to mess up short jumps */ call MS07 endif ;/* DEBUG */ ; pdod = PdodDoc(pdod->doc); ; PdodOrNilFromDoc takes a doc in bx, and returns hNil in ax and bx ; if mpdochdod[doc] == hNil. Otherwise it returns doc in ax ; and pdod = *mpdochdod[doc] in bx. The zero flag is set according ; to the value of bx upon return. Only ax and bx are altered. mov bx,[bx.docDod] call LN_PdodOrNilFromDoc jmp short MS01 ; } MS02: ifdef DEBUG pop cx ;restore stc endif ;DEBUG ; cx = stc, dx = pchp, bx = pdod, di = ppap ; if (pdod == PdodDoc(docScrap) && vsab.docStsh != docNil) push bx ;save pdod mov bx,docScrap ; PdodOrNilFromDoc takes a doc in bx, and returns hNil in ax and bx ; if mpdochdod[doc] == hNil. Otherwise it returns doc in ax ; and pdod = *mpdochdod[doc] in bx. The zero flag is set according ; to the value of bx upon return. Only ax and bx are altered. call LN_PdodOrNilFromDoc pop ax ;restore pdod xchg ax,bx cmp ax,bx jne MS03 cmp [vsab.docStshSab],docNil je MS03 ; pdod = PdodDoc(vsab.docStsh); mov bx,[vsab.docStshSab] ; PdodOrNilFromDoc takes a doc in bx, and returns hNil in ax and bx ; if mpdochdod[doc] == hNil. Otherwise it returns doc in ax ; and pdod = *mpdochdod[doc] in bx. The zero flag is set according ; to the value of bx upon return. Only ax and bx are altered. call LN_PdodOrNilFromDoc MS03: ifdef DEBUG ; /* Assert (pdod->hsttbChpe && ppap != 0) with a call ; so as not to mess up short jumps */ call MS10 endif ;/* DEBUG */ ; psttbChpe = *pdod->hsttbChpe; mov si,[bx.hsttbChpeDod] mov si,[si] push si ;save psttbChpe ; si = [sp] = psttbChpe, cx = stc, dx = pchp, bx = pdod, di = ppap ; vstcpMapStc = (stc + pdod->stsh.cstcStd) & 0377; mov al,cl add al,bptr ([bx.stshDod.cstcStdStsh]) xor ah,ah ; si = [sp] = psttbChpe, cx = stc, dx = pchp, bx = pdod, ax = vstcpMapStc ; di = ppap ; if (vstcpMapStc >= psttbChpe->ibstMac) ; { cmp ax,[si.ibstMacSttb] jl MS04 ; vstcpMapStc = pdod->stsh.cstcStd; mov ax,[bx.stshDod.cstcStdStsh] ; if (stc >= stcStdMin) goto LStcStandard; cmp cx,stcStdMin jl MS04 mov [vstcpMapStc],ax ; si = [sp] = psttbChpe, cx = stc, dx = pchp, bx = pdod, ax = vstcpMapStc ; di = ppap jmp short LStcStandard ; } ; si = [sp] = psttbChpe, cx = stc, dx = pchp, bx = pdod, ax = vstcpMapStc ; di = ppap MS04: ifdef DEBUG ; /* Assert (pdod->hsttbPape) with a call ; so as not to mess up short jumps */ call MS13 endif ;/* DEBUG */ ; psttbPape = *pdod->hsttbPape; mov si,[bx.hsttbPapeDod] mov si,[si] ; [sp] = psttbChpe, cx = stc, dx = pchp, bx = pdod, ax = vstcpMapStc ; di = ppap, si = psttbPape ifdef DEBUG ; /* Assert (psttbPape->ibstMac > vstcpMapStc) with a call ; so as not to mess up short jumps */ call MS15 endif ;/* DEBUG */ ; hppape = HpstFromSttb(pdod->hsttbPape,vstcpMapStc); mov [vstcpMapStc],ax ;LN_LpstFromSttb takes a psttb in si, an ibst in ax, and returns an ;lpst in es:si, Only ax, bx, si, es are altered. push bx ;save pdod in case we goto LStcStandard call LN_LpstFromSttb pop bx ;restore pdod ; [sp] = psttbChpe, cx = stc, dx = pchp, bx = pdod ; di = ppap, es:si = hppape ; if ((cch = *hppape++) == 0377) goto LStcStandard; lods byte ptr es:[si] cmp al,0377O je LStcStandard push cx ;save stc push di ;save ppap ; bltbh(hppape, ppap, cch); push ss push es pop ds pop es xor ah,ah mov cx,ax rep movsb push ss pop ds ;restore ds ; SetBytes(((char *)ppap) + cch, 0, ; ((cch < cbPAPBase) ? ; cbPAPBase : cbPAP) - cch); ; dx = pchp, di = ppap+cch, ax = cch mov cx,cbPAPBase cmp ax,cx jl MS05 mov cx,cbPAP MS05: sub cx,ax xor ax,ax rep stosb pop si ;restore ppap pop cx ;restore stc ; ppap->stc = stc; /* return proper stc even if we faked the style */ mov [si.stcPap],cl pop si ;restore psttbChpe ; si = psttbChpe, cx = stc, dx = pchp ; if (pchp) ; { or dx,dx jz MS06 ifdef DEBUG ; /* Assert (psttbChpe->ibstMac > vstcpMapStc) with a call ; so as not to mess up short jumps */ call MS17 endif ;/* DEBUG */ ; hpchpe = HpstFromSttb(pdod->hsttbChpe, vstcpMapStc); mov ax,[vstcpMapStc] ;LN_LpstFromSttb takes a psttb in si, an ibst in ax, and returns an ;lpst in es:si, Only ax, bx, si, es are altered. call LN_LpstFromSttb ; es:si = hpchpe, cx = stc, dx = pchp ; cch = *hpchpe++; push ss push es pop ds pop es lodsb ; bltbh(hpchpe, pchp, cch); cbw mov di,dx mov cx,ax rep movsb push ss pop ds ;restore ds ; SetBytes(((char *)pchp) + cch, 0, cwCHP*sizeof(int)-cch); ; assumes di = pchp + cch mov cx,cbCHP sub cx,ax xor ax,ax rep stosb ; } ; return; jmp short MS06 ; LStcStandard: ; [sp] = psttbChpe, cx = stc, dx = pchp, bx = pdod, di = ppap LStcStandard: pop ax ;remove psttbChpe from the stack. ; stcpT = vstcpMapStc; push [vstcpMapStc] ; MapStc(pdod, 0, pchp, ppap); ; MapStcStandard(stc, pchp, ppap); push cx ;stc argument for MapStcStandard push dx ;pchp argument for MapStcStandard push di ;ppap argument for MapStcStandard xor cx,cx ; LN_MapStc takes pdod in bx, stc in cx, pchp in dx, ppap in di. ; ax, bx, cx, dx, si, di are altered. call LN_MapStc cCall MapStcStandard,<> ; vstcpMapStc = stcpT; pop [vstcpMapStc] MS06: ; } ret ifdef DEBUG MS07: ; Assert (cMothers++ < 5);/* avoid a loop */ inc cx cmp cx,6 jl MS08 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,250 cCall AssertProcForNative,<ax, bx> pop dx pop cx pop bx pop ax push ds pop es MS08: ; Assert (pdod->doc != docNil); cmp [bx.docDod],docNil jne MS09 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,251 cCall AssertProcForNative,<ax, bx> pop dx pop cx pop bx pop ax push ds pop es MS09: ret endif ;DEBUG ifdef DEBUG ; Assert(pdod->hsttbChpe); MS10: cmp [bx.hsttbChpeDod],0 jnz MS11 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,252 cCall AssertProcForNative,<ax, bx> pop dx pop cx pop bx pop ax push ds pop es MS11: ; Assert(ppap != 0); cmp di,0 jne MS12 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,253 cCall AssertProcForNative,<ax, bx> pop dx pop cx pop bx pop ax push ds pop es MS12: ret endif ;DEBUG ifdef DEBUG ; Assert(pdod->hsttbPape); MS13: cmp [bx.hsttbPapeDod],0 jnz MS14 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,254 cCall AssertProcForNative,<ax, bx> pop dx pop cx pop bx pop ax push ds pop es MS14: ret endif ;DEBUG ifdef DEBUG ; Assert(psttbPape->ibstMac > vstcpMapStc); MS15: ; assumes ax = vstcpMapStc cmp ax,[si.ibstMacSttb] jl MS16 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,255 cCall AssertProcForNative,<ax, bx> pop dx pop cx pop bx pop ax push ds pop es MS16: ret endif ;DEBUG ifdef DEBUG ; Assert(psttbChpe->ibstMac > vstcpMapStc); MS17: push ax mov ax,[si.ibstMacSttb] cmp ax,[vstcpMapStc] pop ax jg MS18 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,256 cCall AssertProcForNative,<ax, bx> pop dx pop cx pop bx pop ax push ds pop es MS18: ret endif ;DEBUG ;LN_LpstFromSttb takes a psttb in si, an ibst in ax, and returns an ;lpst in es:si, Only ax, bx, si, es are altered. LN_LpstFromSttb: ifdef DEBUG mov bx,[wFillBlock] endif ;DEBUG push ss pop es add si,([rgbstSttb]) ;default es:si for !fExternal sttb test [si.fExternalSttb - (rgbstSttb)],maskFExternalSttb je LN_LFS01 mov bx,[si.SB_hqrgbstSttb - (rgbstSttb)] ;LN_ReloadSb takes an sb in bx and set es to the corresponding value. ;Only es and bx are altered. call LN_ReloadSb mov si,[si.OFF_hqrgbstSttb - (rgbstSttb)] mov si,es:[si] LN_LFS01: xchg ax,bx shl bx,1 add si,es:[bx+si] ret ;------------------------------------------------------------------------- ; LowerRgch(pch, cch) GregC ;------------------------------------------------------------------------- ; %%Function:LowerRgch %%Owner:BRADV cProc LowerRgch,<PUBLIC,FAR>,<si,di> ParmW pch ParmW cch ; /* L O W E R R G C H */ ; /* converts characters to lower case */ ; native LowerRgch(pch, cch) ; char *pch; ; int cch; ; { cBegin ; for (; cch-- > 0; pch++) xor bx,bx mov di,[cch] mov si,[pch] or di,di jz LowerRgch4 ; *pch = AnsiLower(*pch); LowerRgch2: lodsb cCall AnsiLower,<bx,ax> mov [si-1],al sub di,1 jnz LowerRgch2 LowerRgch4: ; } cEnd ;------------------------------------------------------------------------- ; HpchFromFc(fn, fc) ;------------------------------------------------------------------------- ; %%Function:N_HpchFromFc %%Owner:BRADV cProc N_HpchFromFc,<PUBLIC,FAR>,<si,di> ParmW fn ParmD fc ; /* H P C H F R O M F C */ ; /* Returns pch to ch at fc in fn. ; Buffer number is left in vibp so that the buffer may be set dirty by caller. ; */ ; native char HUGE *HpchFromFc(fn, fc) ; int fn; ; FC fc; ; { cBegin mov bx,[OFF_fc] mov dx,[SEG_fc] mov ax,[fn] call LN_HpchFromFc ; } cEnd ; LN_HpchFromFc takes fn in ax, and fc in dx:bx. ; The result is returned in dx:ax. ; ax, bx, cx, dx, si, di are altered. ; %%Function:LN_HpchFromFc %%Owner:BRADV PUBLIC LN_HpchFromFc LN_HpchFromFc: ; Assert(fn >= fnScratch && mpfnhfcb[fn] != hNil && fn < fnMax); ; Assert(fc < fcMax); ifdef DEBUG push ax push bx push cx push dx cmp ax,fnScratch jl HFF01 push bx mov bx,ax shl bx,1 cmp mpfnhfcb[bx],hNil pop bx je HFF01 cmp ax,fnMax jge HFF01 sub bx,LO_fcMax sbb dx,HI_fcMax jl HFF02 HFF01: mov ax,midFetchn3 mov bx,1032 cCall AssertProcForNative,<ax, bx> HFF02: pop dx pop cx pop bx pop ax endif ;DEBUG ; vibp = IbpCacheFilePage(fn, (PN)(fc >> shftSector)); errnz <shftSector - 9> push bx ;save low fc xchg dl,dh xchg bh,dl shr bh,1 rcr dx,1 ; LN_IbpCacheFilePage takes fn in ax, pn in dx. ; The result is returned in ax. ax, bx, cx, dx, di are altered. call LN_IbpCacheFilePage mov [vibp],ax ; bOffset = (int)fc & maskSector; /* beware native compiler bug */ ; hpch = HpBaseForIbp(vibp) + bOffset; ; return (hpch); ;***Begin in line HpBaseForIbp xor dx,dx div [vbptbExt.cbpChunkBptb] ; ax = result, dx = remainder add ax,[vbptbExt.SB_hprgbpExtBptb] xchg ax,dx errnz <cbSector - 512> mov cl,9 shl ax,cl ;***End in line HpBaseForIbp pop bx ;restore low fc errnz <maskSector - 001FFh> and bh,(maskSector SHR 8) add ax,bx ret ;------------------------------------------------------------------------- ; HpchGetPn(fn, pn) ;------------------------------------------------------------------------- ; %%Function:N_HpchGetPn %%Owner:BRADV cProc N_HpchGetPn,<PUBLIC,FAR>,<si,di> ParmW fn ParmW pn ; /* H P C H G E T P N */ ; /* Returns pch to start of buffer page containing page pn in file fn. ; Buffer number is left in vibp so that the buffer may be set dirty by caller. ; */ ; native char HUGE *HpchGetPn(fn, pn) ; int fn; ; PN pn; ; { cBegin mov ax,[fn] mov dx,[pn] call LN_HpchGetPn ; } cEnd ; LN_HpchGetPn takes fn in ax, and pn in dx. ; The result is returned in bx:ax. ax, bx, cx, dx, si, di are altered. ; %%Function:LN_HpGetPn %%Owner:BRADV PUBLIC LN_HpchGetPn LN_HpchGetPn: ; Assert(fn >= fnScratch && mpfnhfcb[fn] != hNil && fn < fnMax); ; Assert(pn >= 0 && pn <= 0x7fff); ifdef DEBUG push ax push bx push cx push dx cmp ax,fnScratch jl HGP01 mov bx,ax shl bx,1 cmp mpfnhfcb[bx],hNil je HGP01 cmp ax,fnMax jge HGP01 or dx,dx jge HGP02 HGP01: mov ax,midFetchn3 mov bx,1033 cCall AssertProcForNative,<ax, bx> HGP02: pop dx pop cx pop bx pop ax endif ;DEBUG ; vibp = IbpCacheFilePage(fn, pn); ; LN_IbpCacheFilePage takes fn in ax, pn in dx. ; The result is returned in ax. ax, bx, cx, dx, di are altered. call LN_IbpCacheFilePage mov [vibp],ax ; hpch = HpBaseForIbp(vibp); /* possible compiler problem */ ; return(hpch); ;***Begin in line HpBaseForIbp xor dx,dx div [vbptbExt.cbpChunkBptb] ; ax = result, dx = remainder add ax,[vbptbExt.SB_hprgbpExtBptb] xchg ax,dx errnz <cbSector - 512> mov cl,9 shl ax,cl ;***End in line HpBaseForIbp mov bx,dx ret ;------------------------------------------------------------------------- ; SetDirty(ibp) ;------------------------------------------------------------------------- ; /* S E T D I R T Y */ ; /* ibp in internal cache */ ; native SetDirty(ibp) ; int ibp; ; { ; %%Function:SetDirty %%Owner:BRADV PUBLIC SetDirty SetDirty: ; struct BPS HUGE *hpbps; ; hpbps = &((struct BPS HUGE *)vbptbExt.hpmpibpbps)[ibp]; ; hpbps->fDirty = fTrue; mov bx,[vbptbExt.SB_hpmpibpbpsBptb] ;LN_ReloadSb takes an sb in bx and set es to the corresponding value. ;Only es and bx are altered. call LN_ReloadSb mov bx,sp mov bx,[bx+4] errnz <cbBpsMin - 8> shl bx,1 shl bx,1 shl bx,1 add bx,[vbptbExt.OFF_hpmpibpbpsBptb] mov es:[bx.fDirtyBps],fTrue ; Assert(hpbps->fn != fnNil); ifdef DEBUG cmp es:[bx.fnBps],fnNil jnz SD01 inc bp push bp mov bp,sp push bx mov ax,midFetchn3 mov bx,1001 cCall AssertProcForNative,<ax,bx> pop bx pop bp dec bp SD01: endif ;DEBUG ; PfcbFn(hpbps->fn)->fDirty = fTrue; mov bl,es:[bx.fnBps] xor bh,bh shl bx,1 mov bx,[bx.mpfnhfcb] mov bx,[bx] or [bx.fDirtyFcb],maskfDirtyFcb ; } db 0CAh, 002h, 000h ;far ret, pop 2 bytes ;/* ;REVIEW(robho): Possible improvements to IbpCacheFilePage swapping strategy ;robho 3/29/85: Would be nice some day to incorporate a list of the easily ;accessable volumes (disks currently in the drives) into the file page cache ;swapping out algorithm - try to avoid swaps that involve the user changing ;disks. ;*/ ;------------------------------------------------------------------------- ; IbpCacheFilePage(fn, pn) ;------------------------------------------------------------------------- ;/* I B P C A C H E F I L E P A G E */ ;/* Get page pn of file fn into file cache pbptb. ;Return ibp. ;See w2.rules for disk emergencies. ;*/ ;native int IbpCacheFilePage(fn, pn) ;int fn; ;PN pn; ;{ ; int ibp, iibp; ;/* NOTE: IibpHash macro has changed */ ; %%Function:N_IbpCacheFilePage %%Owner:BRADV cProc N_IbpCacheFilePage,<PUBLIC,FAR>,<si,di> ParmW fn ParmW pn cBegin mov ax,fn mov dx,pn call LN_IbpCacheFilePage cEnd ;End of IbpCacheFilePage ; LN_IbpCacheFilePage takes fn in ax, pn in dx. ; The result is returned in ax. ax, bx, cx, dx, di are altered. ; %%Function:LN_IbpCacheFilePage %%Owner:BRADV PUBLIC LN_IbpCacheFilePage LN_IbpCacheFilePage: ; Assert(fn >= fnScratch && mpfnhfcb[fn] != hNil && fn < fnMax); ; Assert(pn >= 0 && pn <= 0x7fff); ifdef DEBUG push ax push bx push cx push dx cmp ax,fnScratch jl ICFP01 mov bx,ax shl bx,1 cmp mpfnhfcb[bx],hNil je ICFP01 cmp ax,fnMax jge ICFP01 or dx,dx jge ICFP02 ICFP01: mov ax,midFetchn3 mov bx,1000 cCall AssertProcForNative,<ax, bx> ICFP02: pop dx pop cx pop bx pop ax endif ;DEBUG ; iibp = IibpHash(fn, pn, vbptbExt.iibpHashMax); ;#define IibpHash(fn, pn, iibpHashMax) (((fn) * 33 + (pn) * 5) & ((iibpHashMax) - 1)) mov di,ax mov cl,5 shl di,cl add di,ax xchg ax,cx mov ax,dx add di,ax shl ax,1 shl ax,1 add di,ax mov ax,[vbptbExt.iibpHashMaxBptb] dec ax and di,ax ; ibp = ((int far *)LpFromHp(vbptbExt.hprgibpHash))[iibp]; mov bx,[vbptbExt.SB_hprgibpHashBptb] ;LN_ReloadSb takes an sb in bx and set es to the corresponding value. ;Only es and bx are altered. call LN_ReloadSb mov bx,[vbptbExt.OFF_hprgibpHashBptb] shl di,1 mov ax,es:[bx+di] ICFP04: ;/* search list of buffers with the same hash code */ ; while (ibp != ibpNil) ; { cmp ax,ibpNil je ICFP07 ; qbps = QbpsHpIbp(vbptbExt.hpmpibpbps, ibp); ;#define QbpsHpIbp(hpmpibpbps, ibp) \ ; (&((struct BPS far *)LpFromHp(hpmpibpbps))[ibp]) ;Assert ([vbptbExt.SB_hpmpibpbpsBptb] == [vbptbExt.SB_hprgibpHashBptb]) ;with a call so as not to mess up short jumps. ifdef DEBUG call ICFP11 endif ;DEBUG errnz <cbBpsMin - 8> mov bx,ax shl bx,1 shl bx,1 shl bx,1 add bx,[vbptbExt.OFF_hpmpibpbpsBptb] ; if (qbps->pn == pn && qbps->fn == fn) ; { cmp dx,es:[bx.pnBps] jne ICFP06 cmp cl,es:[bx.fnBps] jne ICFP06 ;/* page found in the cache */ ; qbps->ts = ++(vbptbExt.tsMruBps); inc [vbptbExt.tsMruBpsBptb] mov cx,[vbptbExt.tsMruBpsBptb] mov es:[bx.tsBps],cx ; vbptbExt.hpmpispnts[(ibp << 2) / vbptbExt.cqbpspn] ; = vbptbExt.tsMruBps; ;Assert ([vbptbExt.SB_hpmpispnts] == [vbptbExt.SB_hprgibpHash]) ;with a call so as not to mess up short jumps. ifdef DEBUG call ICFP13 endif ;DEBUG push ax ;save ibp shl ax,1 shl ax,1 cwd div [vbptbExt.cqbpspnBptb] mov bx,ax pop ax ;restore ibp shl bx,1 add bx,[vbptbExt.OFF_hpmpispntsBptb] mov es:[bx],cx ; return(ibp); ; } jmp short ICFP10 ; ibp = qbps->ibpHashNext; ; } ICFP06: mov ax,es:[bx.ibpHashNextBps] jmp short ICFP04 ICFP07: ; if (fn == vfnPreload) ; { /* Read in big chunks! */ ; if ((ibp = IbpLoadFn(fn,pn)) != ibpNil) ; return ibp; ; } cmp cx,[vfnPreload] jnz ICFP09 push cx ;save fn push dx ;save pn cCall IbpLoadFn,<cx,dx> pop dx ;restore pn pop cx ;restore fn cmp ax,ibpNil jne ICFP10 ICFP09: ;/* page not found, read page into cache */ ; return IbpReadFilePage(fn, pn, iibp); shr di,1 cCall IbpReadFilePage,<cx, dx, di> ICFP10: ;} ret ifdef DEBUG ;Assert ([vbptbExt.SB_hpmpibpbps] == [vbptbExt.SB_hprgibpHash]); ICFP11: push ax push bx push cx push dx mov ax,[vbptbExt.SB_hpmpibpbpsBptb] cmp ax,[vbptbExt.SB_hprgibpHashBptb] je ICFP12 mov ax,midFetchn3 mov bx,1030 cCall AssertProcForNative,<ax, bx> ICFP12: pop dx pop cx pop bx pop ax ret endif ;DEBUG ifdef DEBUG ;Assert ([vbptbExt.SB_hpmpispnts] == [vbptbExt.SB_hprgibpHash]); ICFP13: push ax push bx push cx push dx mov ax,[vbptbExt.SB_hpmpispntsBptb] cmp ax,[vbptbExt.SB_hprgibpHashBptb] je ICFP14 mov ax,midFetchn3 mov bx,1031 cCall AssertProcForNative,<ax, bx> ICFP14: pop dx pop cx pop bx pop ax ret endif ;DEBUG ;------------------------------------------------------------------------- ; DoPrmSgc(prm, prgbProps, sgc) ;------------------------------------------------------------------------- ; %%Function:N_DoPrmSgc %%Owner:BRADV cProc N_DoPrmSgc,<PUBLIC,FAR>,<si,di> ParmW prm ParmW prgbProps ParmW sgc ; /* D O P R M S G C */ ; /* apply prm to prgbProps that is of type sgc */ ; native DoPrmSgc(prm, prgbProps, sgc) ; struct PRM prm; int sgc; char *prgbProps; ; { ; int cch; ; char *pprl; ; char grpprl[2]; cBegin mov cx,[prm] mov di,[prgbProps] mov dx,[sgc] cCall LN_DoPrmSgc,<> ; } cEnd ; LN_DoPrmSgc takes prm in cx, ; prgbProps in di, sgc in dx. ; ax, bx, cx, dx, si, di are altered. ; %%Function:LN_DoPrmSgc %%Owner:BRADV PUBLIC LN_DoPrmSgc LN_DoPrmSgc: ; if (prm.fComplex) mov bx,cx errnz <maskfComplexPrm-1> test bl,maskfComplexPrm jz DPS01 ; { ; struct PRC *pprc; ; ; pprc = *HprcFromPprmComplex(&prm); ;#define HprcFromPprmComplex(pprm) ((struct PRC **)((pprm)->cfgrPrc<<1)) errnz <maskcfgrPrcPrm - 0FFFEh> and bl,0FEh mov bx,[bx] ; cch = pprc->bprlMac; mov cx,[bx.bprlMacPrc] ; pprl = pprc->grpprl; lea si,[bx.grpprlPrc] push ax ;room for grpprl (not used by complex prms) ; } jmp short DPS02 DPS01: ; else ; { ; /* cch = 1 will pick up one sprm, no matter what its length */ ; cch = 1; mov cx,1 ; grpprl[0] = prm.sprm; ; grpprl[1] = prm.val; ; assumed bx = prm errnz <(sprmPrm) - 0> errnz <masksprmPrm - 000FEh> errnz <(valPrm) - 1> shr bl,1 push bx ; pprl = grpprl; mov si,sp ; } DPS02: ; ApplyPrlSgc((char HUGE *)pprl, cch, prgbProps, sgc); mov ax,sbDds push ax push si push cx push di push dx ifdef DEBUG cCall S_ApplyPrlSgc,<> else ;not DEBUG call far ptr N_ApplyPrlSgc endif ;DEBUG pop dx ;remove "grpprl" from stack ; } ret APS_CALL label word dw APS_spraBit dw APS_spraByte dw APS_spraWord dw APS_spraCPlain dw APS_spraCFtc dw APS_spraCKul dw APS_spraCSizePos dw APS_spraSpec dw APS_spraIco dw APS_spraCHpsInc dw APS_spraCHpsPosAdj ;------------------------------------------------------------------------- ; N_ApplyPrlSgc(hpprlFirst, cch, prgbProps, sgc) ;------------------------------------------------------------------------- ; %%Function:N_ApplyPrlSgc %%Owner:BRADV cProc N_ApplyPrlSgc,<PUBLIC,FAR>,<si,di> ParmD hpprlFirst ParmW cch ParmW prgbProps ParmW sgc ; /* A P P L Y P R L S G C */ ; /* apply sprms of type sgc in grpprl of length cch to prgbProps */ ; native ApplyPrlSgc(pprl, cch, prgbProps, sgc) ; char *pprl; struct CHP *prgbProps; int cch, sgc; ; { ; int val, val2; ; struct SIAP siap; ; CHAR HUGE *hpprl = hpprlFirst; cBegin mov si,[OFF_hpprlFirst] mov di,[prgbProps] mov dx,[sgc] mov cl,ibitSgcEsprm shl dl,cl mov cx,[cch] ;APS16 performs ReloadSb for hpprlFirst. bx, es are altered. call APS16 ; cx = cch, dl = sgc shl ibitsgcEsprm, es:si = qprl, di = prgbProps ; while (cch > 0) ; { or cx,cx jle APS04 APS01: ; int cchSprm; ; struct ESPRM esprm; ; ; Assert(*qprl < sprmMax); ifdef DEBUG ; /* Assert (*qprl < sprmMax) with a call ; so as not to mess up short jumps */ call APS11 endif ;/* DEBUG */ ; esprm = dnsprm[*qprl]; ;/* if we encounter a pad character at the end of a grpprl of a PAPX we ; set the length to 1 and continue. */ ; if (sprm == 0) ; { ; cchSprm = 1; ; goto LNext; ; } mov al,es:[si] inc si ; es:si = qprl + 1 xor ah,ah mov bx,ax inc ax or bl,bl je APS03 errnz <cbEsprmMin - 4> shl bx,1 shl bx,1 errnz <maskCchEsprm AND 0FF00h> mov al,[bx.dnsprm.cchEsprm] mov bx,[bx.dnsprm] ; bx = esprm ; if ((cchSprm = esprm.cch) == 0) ; { and ax,maskCchEsprm errnz <ibitcchEsprm - 0> jnz APS02 ; if (sprm == sprmTDefTable) ; bltbh(hpprl + 1, &cchSprm, sizeof(int)); mov ax,es:[si] cmp bptr es:[si-1],sprmTDefTable je APS015 ; else ; { ; cchSprm = val; xor ah,ah ; if (cchSprm == 255 && sprm == sprmPChgTabs) ; { cmp bptr es:[si-1],sprmPChgTabs jne APS015 ; char HUGE *hpprlT; ; cchSprm = (*(hpprlT = hpprl + 2) * 4) + 1; ; cchSprm += (*(hpprlT + cchSprm) * 3) + 1; ; } ; } ; Assert (cchSprm > 255 || cchSprm == esprm.cch); ifdef DEBUG ; /* Assert (cchSprm > 255 || cchSprm == esprm.cch) with a call ; so as not to mess up short jumps */ call APS17 endif ;/* DEBUG */ push bx mov bl,es:[si+1] xor bh,bh shl bx,1 shl bx,1 mov al,es:[bx+si+2] add bx,ax inc ax shl ax,1 add ax,bx pop bx ; cchSprm += 2; ; } APS015: add ax,2 ; } APS02: ; ax = cchSprm, bx = esprm, cx = cch, dl = sgc shl ibitsgcEsprm, ; es:si = qprl+1, di = prgbProps ; if (esprm.sgc == sgc) errnz <(sgcEsprm) - 1> xor bh,dl test bh,masksgcEsprm jne APS03 push ax ;save cchSprm push cx ;save cch push dx ;save sgc ; val = *(qprl + 1); mov dh,es:[si] ; ch = val ; { ; switch (esprm.spra) mov ax,bx errnz <(spraEsprm) - 1> mov bl,bh and bx,maskspraEsprm errnz <ibitSpraEsprm> shl bx,1 ; Assert (spra < 11); ifdef DEBUG ; /* Assert (spra < 11) with a call ; so as not to mess up short jumps */ call APS13 endif ;/* DEBUG */ ; all of the switch cases return to APS03 ; ax = esprm, dh = val, si = qprl+1, di = prgbProps call [bx.APS_CALL] pop dx ;restore sgc pop cx ;restore cch pop ax ;restore cchSprm ; { ;LNext: APS03: ; This code from after the switch is performed below in the C version. ; qprl += cchSprm; ; ax = cchSprm, cx = cch, dl = sgc shl ibitsgcEsprm, es:si = qprl+1 ; di = prgbProps add si,ax dec si ; cch -= cchSprm; sub cx,ax jg APS01 ; } APS04: ; } cEnd ; ax = esprm, dh = val, es:si = qprl+1, di = prgbProps APS_spraWord: ; case spraWord: ; /* sprm has a word parameter that is to be stored at b */ ; bltbx(LpFromHp(pprl+1), (CHAR *)prgbProps + esprm.b, 2); xchg ax,bx and bx,maskbEsprm errnz <maskbEsprm - 0FEh> errnz <(bEsprm) - 0> shr bx,1 mov ax,es:[si] mov [bx.di],ax ; break; ret ; ax = esprm, dh = val, es:si = qprl+1, di = prgbProps APS_spraByte: ; case spraByte: ; /* sprm has a byte parameter that is to be stored at b */ ; *((char *)prgbProps + esprm.b) = val; xchg ax,bx and bx,maskbEsprm errnz <maskbEsprm - 0FEh> errnz <(bEsprm) - 0> shr bx,1 mov [bx.di],dh ; break; ret ; ax = esprm, dh = val, es:si = qprl+1, di = prgbProps APS_spraBit: ; case spraBit: ; maskBit = (1<<(shftBit = esprm.b)); mov cl,al and cl,maskbEsprm errnz <ibitbEsprm-1> errnz <(bEsprm) - 0> shr cl,1 ; cl = shftBit mov bx,1 shl bx,cl ;/* if the high bit of the operand is on and the low bit of the operand is off ; we will make prop to be same as vchpStc prop. if the high operand bit is on ; and the low operand bit is on, we will set the prop to the negation of the ; vchpStc prop. */ ; if (val & 0x80) ; { ; *((int *)prgbProps) &= ~maskBit; ; *((int *)prgbProps) |= ; (((*(int *)&vchpStc) & maskBit) ^ ; ((val & 0x01)<<shftBit)); ; } ; else if (val == 0) ; *((int *)prgbProps) &= ~(maskBit); ; else ; *((int *)prgbProps) |= maskBit; ; break; ; ax = esprm, dh = val, es:si = qprl+1, di = prgbProps, ; cl = shftBit, bx = maskBit or dh,dh js APS045 jnz APS05 APS045: not bx and [di],bx or dh,dh jns APS06 not bx and bx,wptr ([vchpStc]) xor ax,ax shr dh,1 inc cx rcl ax,cl xor bx,ax APS05: or [di],bx APS06: ; break; ret ; ax = esprm, dh = val, es:si = qprl+1, di = prgbProps APS_spraCPlain: ; case spraCPlain: ; /* fSpec and fFldVanish are properties that ; the user is not allowed to modify! */ ; val = (*(int *)prgbProps) & maskFNonUser; mov dx,wptr [di] and dx,maskfNonUser ; blt(&vchpStc, prgbProps, cwCHPBase); push di push es push ds pop es mov ax,dataOffset vchpStc xchg ax,si errnz <cwCHPBase - 4> movsw movsw movsw movsw xchg ax,si pop es pop di ; Assert((*(int *)&vchpStc & maskFNonUser) == 0); ifdef DEBUG test wptr [vchpStc],maskfNonUser je APS063 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,701 cCall AssertProcForNative,<ax, bx> ;APS16 performs ReloadSb for hpprlFirst. bx, es are altered. call APS16 pop dx pop cx pop bx pop ax APS063: endif ;/* DEBUG */ ; (*(int *)prgbProps) |= val; or wptr [di],dx ; break; ret ; ax = esprm, dh = val, es:si = qprl+1, di = prgbProps APS_spraCFtc: ; case spraCFtc: ; bltb(LpFromHp(pprl+1), &val, 2); mov ax,es:[si] ; prgbProps->ftc = val; mov [di.ftcChp],ax ; break; ret ; ax = esprm, dh = val, es:si = qprl+1, di = prgbProps APS_spraCKul: ; case spraCKul: ; Assert(val <= 7); /* hand native assumption */ ifdef DEBUG cmp dh,7 jbe APS067 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,702 cCall AssertProcForNative,<ax, bx> ;APS16 performs ReloadSb for hpprlFirst. bx, es are altered. call APS16 pop dx pop cx pop bx pop ax APS067: endif ;/* DEBUG */ ; prgbProps->kul = val; mov cl,ibitKulChp shl dh,cl and [di.kulChp],NOT maskKulChp or [di.kulChp],dh ; break; ret ; ax = esprm, dh = val, es:si = qprl+1, di = prgbProps APS_spraCSizePos: ; case spraCSizePos: ; bltb(LpFromHp(pprl+1), &siap, cbSIAP); ; if ((val = siap.hpsSize) != 0) mov al,es:[si.hpsSizeSiap] or al,al jz APS07 ; prgbProps->hps = val; mov [di.hpsChp],al APS07: ; if ((val = siap.cInc) != 0) mov al,es:[si.cIncSiap] errnz <maskcIncSiap - 0007Fh> shl al,1 jz APS08 ; prgbProps->hps = HpsAlter(prgbProps->hps, ; val >= 64 ? val - 128 : val); mov cl,1 ;APS15 performs prgbProps->hps ;= HpsAlter(prgbProps->hps, (al >= 128 ? al - 256 : al) >> cl); ;ax, bx, cx, dx are altered. call APS15 APS08: ; if ((val = siap.hpsPos) != hpsPosNil) errnz <(hpsPosSiap) - (fAdjSiap) - 1) mov ax,wptr (es:[si.fAdjSiap]) cmp ah,hpsPosNil je APS10 ; { ; if (siap.fAdj) push ax ;save val test al,maskfAdjSiap jz APS09 ; { ; if (val != 0) ; { /* Setting pos to super/sub */ ; if (prgbProps->hpsPos == 0) ; prgbProps->hps = HpsAlter(prgbProps->hps, -1); ; } ; else ; { /* Restoring pos to normal */ ; if (prgbProps->hpsPos != 0) ; prgbProps->hps = HpsAlter(prgbProps->hps, 1); ; } APS085: cmp ah,1 rcr al,1 cmp [di.hpsPosChp],0 rcr ah,1 xor al,ah ; do nothing if ((val == 0) ^ (prgbProps->hpsPos) == 0) == fFalse jns APS09 cwd ;dx = (prgbProps->hpsPos == 0 ? -1 : 0) shl dx,1 inc dx ;dx = (prgbProps->hpsPos == 0 ? -1 : 1) mov al,[di.hpsChp] xor ah,ah cCall HpsAlter,<ax,dx> ;APS16 performs ReloadSb for hpprlFirst. bx, es are altered. call APS16 mov [di.hpsChp],al APS09: ; prgbProps->hpsPos = val; pop ax ;restore val mov [di.hpsPosChp],ah ; } APS10: ; break; ret ; case spraCHpsInc: ; val &= 255; ; prgbProps->hps = HpsAlter(prgbProps->hps, ; val >= 128 ? val - 256 : val); ; break; APS_spraCHpsInc: mov al,dh mov cl,0 ;APS15 performs prgbProps->hps ;= HpsAlter(prgbProps->hps, (al >= 128 ? al - 256 : al) >> cl); ;ax, bx, cx, dx are altered. call APS15 ret ; case spraCHpsPosAdj: ; if (val != 0) ; { /* Setting pos to super/sub */ ; ; if (prgbProps->hpsPos == 0) ; prgbProps->hps = HpsAlter(prgbProps->hps, -1); ; } ; else ; { /* Restoring pos to normal */ ; if (prgbProps->hpsPos != 0) ; prgbProps->hps = HpsAlter(prgbProps->hps, 1); ; } ; prgbProps->hpsPos = val; ; break; APS_spraCHpsPosAdj: mov ah,dh push ax ;save val jmp short APS085 ; ax = esprm, dh = val, es:si = qprl+1, di = prgbProps APS_spraIco: ; case spraCIco: ; prgbProps->ico = val; errnz <maskIcoChp - 00Fh> and dh,maskIcoChp and [di.icoChp],NOT maskIcoChp or [di.icoChp],dh ; break; ret ; #ifdef DEBUG ; default:Assert(fFalse); /* hand native assumption */ ; #endif ; /* other special actions */ ; ax = esprm, dh = val, es:si = qprl+1, di = prgbProps APS_spraSpec: ; case spraSpec: ;/* if sprmPStcPermute is the first sprm of a grpprl, it would have been ; interpreted in CachePara before the papx grpprl was applied. */ ; if (hpprl != hpprlFirst || sprm != sprmPStcPermute) ; ApplySprm(hpprl, sprm, val, prgbProps); dec si mov bx,si lods bptr es:[si] cmp bx,[OFF_hpprlFirst] jne APS103 cmp al,sprmPStcPermute je APS107 APS103: push [SEG_hpprlFirst] push bx xor ah,ah push ax mov al,dh push ax push di cCall ApplySprm,<> ;APS16 performs ReloadSb for hpprlFirst. bx, es are altered. call APS16 APS107: ret ; } ; } ; The following code is done above in the assembler version ; at APS03 ; cch -= cchSprm; ; pprl += cchSprm; ; } ; } ifdef DEBUG ; Assert(*qprl < sprmMax); APS11: cmp byte ptr es:[si],sprmMax jb APS12 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,700 cCall AssertProcForNative,<ax, bx> ;APS16 performs ReloadSb for hpprlFirst. bx, es are altered. call APS16 pop dx pop cx pop bx pop ax APS12: ret endif ;DEBUG ifdef DEBUG ; Assert(spra < 11); APS13: cmp bx,11 SHL 1 jb APS14 push ax push bx push cx push dx mov ax,midFetchn3 mov bx,1021 cCall AssertProcForNative,<ax, bx> ;APS16 performs ReloadSb for hpprlFirst. bx, es are altered. call APS16 pop dx pop cx pop bx pop ax APS14: ret endif ;DEBUG ;APS15 performs prgbProps->hps ;= HpsAlter(prgbProps->hps, (al >= 128 ? al - 256 : al) >> cl); ;ax, bx, cx, dx are altered. APS15: mov bl,[di.hpsChp] xor bh,bh cbw sar ax,cl cCall HpsAlter,<bx,ax> ;APS16 performs ReloadSb for hpprlFirst. bx, es are altered. call APS16 mov [di.hpsChp],al ret ;APS16 performs ReloadSb for hpprlFirst. bx, es are altered. APS16: mov bx,[SEG_hpprlFirst] ;LN_ReloadSb takes an sb in bx and set es to the corresponding value. ;Only es and bx are altered. call LN_ReloadSb ret ifdef DEBUG ; Assert (cchSprm > 255 || cchSprm == esprm.cch); APS17: push ax push bx push cx push dx mov cx,ax ;save old cchSprm mov bl,es:[si+1] xor bh,bh shl bx,1 shl bx,1 mov al,es:[bx+si+2] add bx,ax inc ax shl ax,1 add ax,bx cmp ax,255 ja APS18 cmp ax,cx je APS18 mov ax,midFetchn3 mov bx,1024 cCall AssertProcForNative,<ax, bx> APS18: ;APS16 performs ReloadSb for hpprlFirst. bx, es are altered. call APS16 pop dx pop cx pop bx pop ax ret endif ;DEBUG ; ; ;------------------------------------------------------------------------- ; FetchCpAndPara(doc, cp, fcm) GregC ;------------------------------------------------------------------------- ; %%Function:FetchCpAndPara %%Owner:BRADV cProc FetchCpAndPara,<PUBLIC,FAR>,<> ParmW doc ParmD cp ParmW fcm ; /* F E T C H C P A N D P A R A */ ; native FetchCpAndPara( doc, cp, fcm ) ; int doc; ; CP cp; ; int fcm; ; { cBegin ; CachePara( doc, cp ); ; FetchCp( doc, cp, fcm ); mov bx,[doc] mov ax,[OFF_cp] mov dx,[SEG_cp] push bx push dx push ax push [fcm] push bx push dx push ax ifdef DEBUG cCall S_CachePara,<> cCall S_FetchCp,<> else ;not DEBUG cCall N_CachePara,<> cCall N_FetchCp,<> endif ;DEBUG ; } cEnd ; ;------------------------------------------------------------------------- ; FetchCpAndParaCa(pca,fcm) ;------------------------------------------------------------------------- ; %%Function:FetchCpAndParaCa %%Owner:BRADV cProc FetchCpAndParaCa,<PUBLIC,FAR>,<si> ParmW pca ParmW fcm ;/* F E T C H C P A N D P A R A C A */ ;native FetchCpAndParaCa( pca, fcm ) ;struct CA *pca; ;int fcm; ;{ cBegin ; CacheParaCa(pca); ; FetchCp(pca->doc, pca->cpFirst, fcm); mov si,[pca] errnz <(cpFirstCa) - 0> lodsw xchg ax,dx lodsw mov cx,[si.docCa-4] push cx push ax push dx push [fcm] push cx push ax push dx ifdef DEBUG cCall S_CachePara,<> cCall S_FetchCp,<> else ;not DEBUG cCall N_CachePara,<> cCall N_FetchCp,<> endif ;DEBUG ;} cEnd ;------------------------------------------------------------------------- ; CacheParaCa(pca) ;------------------------------------------------------------------------- ; %%Function:CacheParaCa %%Owner:BRADV cProc CacheParaCa,<PUBLIC,FAR>,<> ParmW pca ;/* C A C H E P A R A C A */ ;/* alternative entry point */ ;CacheParaCa(pca) ;struct CA *pca; ;{ cBegin ; CachePara(pca->doc, pca->cpFirst); mov bx,[pca] ifdef DEBUG cCall S_CachePara,<[bx.docCa],[bx.HI_cpFirstCa],[bx.LO_cpFirstCa]> else ;not DEBUG cCall N_CachePara,<[bx.docCa],[bx.HI_cpFirstCa],[bx.LO_cpFirstCa]> endif ;DEBUG ;} cEnd ;------------------------------------------------------------------------- ; ChFetch(pca) ;------------------------------------------------------------------------- ; %%Function:ChFetch %%Owner:BRADV cProc ChFetch,<PUBLIC,FAR>,<> ParmW doc ParmD cp ParmW fcm ;/* C H F E T C H */ ;NATIVE ChFetch(doc, cp, fcm) ;int doc; ;CP cp; ;int fcm; ;{ ; int ch; cBegin ; if (fcm != fcmChars) mov ax,[fcm] mov bx,[OFF_cp] mov cx,[SEG_cp] mov dx,[doc] push dx push cx push bx push ax ;args for FetchCp cmp ax,fcmChars je CF01 ; CachePara(doc, cp); ifdef DEBUG cCall S_CachePara,<dx,cx,bx> else ;not DEBUG cCall N_CachePara,<dx,cx,bx> endif ;DEBUG CF01: ; FetchCp(doc, cp, fcm); ifdef DEBUG cCall S_FetchCp,<> else ;not DEBUG cCall N_FetchCp,<> endif ;DEBUG ; ch = *vhpchFetch; mov bx,whi ([vhpchFetch]) ;LN_ReloadSb takes an sb in bx and set es to the corresponding value. ;Only es and bx are altered. call LN_ReloadSb mov bx,wlo ([vhpchFetch]) ; return (ch); xor ax,ax mov al,es:[bx] ;} cEnd ;------------------------------------------------------------------------- ; FAbsPap(doc,ppap) ;------------------------------------------------------------------------- ; %%Function:FAbsPap %%Owner:BRADV PUBLIC FAbsPap FAbsPap: ;/*********************/ ;/* F A b s P a p */ ;NATIVE int FAbsPap(doc, ppap) ;int doc; ;struct PAP *ppap; ;{ ;/* returns fTrue if pap describes an absolutely positioned object */ ; struct DOD *pdod = PdodDoc(doc); ; mov bx,sp mov dx,[bx+4] mov bx,[bx+6] ;doc in bx, ppap in dx ; PdodOrNilFromDoc takes a doc in bx, and returns hNil in ax and bx ; if mpdochdod[doc] == hNil. Otherwise it returns doc in ax ; and pdod = *mpdochdod[doc] in bx. The zero flag is set according ; to the value of bx upon return. Only ax and bx are altered. call LN_PdodOrNilFromDoc ifdef DEBUG jnz FAP01 inc bp push bp mov bp,sp ;set up bp chain for call push ax push bx push cx push dx mov ax,midFetchn3 mov bx,1022 cCall AssertProcForNative,<ax, bx> pop dx pop cx pop bx pop ax pop bp ;restore old bp chain dec bp FAP01: endif ;DEBUG ; int fAbs = doc != vdocTemp && !pdod->fFtn Win (&& !pdod->fAtn) && ; (ppap->dxaAbs != 0 || ppap->dyaAbs != 0 || ; ppap->pcHorz != pcHColumn || ppap->dxaWidth != 0); ; ; return(fAbs); errnz <fFalse> mov ax,[vdocTemp] sub ax,[doc] jz FAP02 xor ax,ax ;return fFalse errnz <(fFtnDod) - (fAtnDod)> test [bx.fFtnDod],maskfFtnDod+maskfAtnDod jnz FAP02 mov bx,dx mov cl,[bx.pcHorzPap] errnz <pcHColumn - 0> and cx,maskPcHorzPap or cx,[bx.dxaAbsPap] or cx,[bx.dyaAbsPap] or cx,[bx.dxaWidthPap] jz FAP02 errnz <fTrue - fFalse - 1> inc ax FAP02: ; } db 0CAh, 004h, 000h ;far ret, pop 4 bytes ;------------------------------------------------------------------------- ; FInTableDocCp(doc, cp) ;------------------------------------------------------------------------- ;/* F I N T A B L E D O C C P */ ;/* Returns whether a doc,cp is in a table according to field structures. ; vcpFirstTablePara is set to the cpFirst of the table in this paragraph. ; vcpFirstCellPara is set to the cpFirst of the table cell. ;*/ ;/* %%Function:FInTableDocCp %%Owner:davidlu */ ;HANDNATIVE BOOL C_FInTableDocCp(doc, cp) ;int doc; ;CP cp; ;{ ; extern struct CA caPara; ; extern struct PAP vpapFetch; ; extern CP vcpFirstTablePara; ; extern CP vcpFirstTableCell; ; extern CP vmpitccp[]; ; int icp; ; CP cpFirstCell, cpLimCell; ; int docFetchSav; ; CP cpFetchSav; ; int fcmFetchSav; Ltemp001: jmp FITDC09 ; %%Function:N_FInTableDocCp %%Owner:BRADV cProc N_FInTableDocCp,<PUBLIC,FAR>,<si,di> ParmW doc ParmD cp cBegin ; CachePara(doc, cp); ifdef DEBUG cCall S_CachePara,<[doc], [SEG_cp], [OFF_cp]> else ;not DEBUG cCall N_CachePara,<[doc], [SEG_cp], [OFF_cp]> endif ;DEBUG ; vcpFirstTableCell = vcpFirstTablePara = caPara.cpFirst; mov cx,[caPara.LO_cpFirstCa] mov dx,[caPara.HI_cpFirstCa] ; if (!vpapFetch.fInTable) ; return fFalse; errnz <fFalse> xor ax,ax mov bx,fTrue ;Do this to allow code sharing at FITDC09 cmp [vpapFetch.fInTablePap],al je Ltemp001 ; if (!vtapFetch.fCaFull || !FInCa(doc, caPara.cpLim - 1, &caTap)) ; { mov si,dataoffset [caTap] mov di,[doc] mov cx,0FFFFh mov dx,cx add cx,[caPara.LO_cpLimCa] adc dx,[caPara.HI_cpLimCa] ;LN_FInCa takes a doc in di, a cp in dx:cx and a pca in si and ;returns the result in bx. ax, bx, cx and dx are altered. push dx push cx ;save caPara.cpLim - 1; call LN_FInCa pop cx pop dx ;restore caPara.cpLim - 1; or bx,bx je FITDC005 test [vtapFetch.fCaFullTap],maskFCaFullTap jne FITDC05 FITDC005: ; docFetchSav = vdocFetch; ; cpFetchSav = vcpFetch; ; fcmFetchSav = fcmFetch; push [fcmFetch] ;fcmFetchSav push whi [vcpFetch] push wlo [vcpFetch] ;cpFetchSav push [vdocFetch] ;docFetchSav ; /* Optimization to reduce time spent by CpFirstTap looking for ; the beginning of the row. */ ; if (CpFirstTap(doc, caPara.cpFirst) == cpNil) push dx push cx ;save caPara.cpLim - 1 cCall CpFirstTap,<di,[caPara.HI_cpFirstCa],[caPara.LO_cpFirstCa]> and ax,dx ;returned cpNil if it failed inc ax pop cx pop dx jne FITDC008 ; CpFirstTap(doc, caPara.cpLim - 1); cCall CpFirstTap,<di, dx, cx> ; if (docFetchSav != docNil && cpFetchSav <= CpMacDocEdit(docFetchSav)) ; FetchCpAndPara(docFetchSav, cpFetchSav, fcmFetchSav); ; else ; vdocFetch = docNil; FITDC008: pop si ;docFetchSav or si,si je FITDC01 cCall CpMacDocEdit,<si> FITDC01: pop bx pop cx ;cx:bx = cpFetchSav pop di ;fcmFetchSav errnz <docNil> or si,si je FITDC02 sub ax,bx sbb dx,cx jge FITDC03 FITDC02: mov [vdocFetch],docNil jmp short FITDC04 FITDC03: cCall FetchCpAndPara,<si,cx,bx,di> FITDC04: ; CachePara(doc, cp); ifdef DEBUG cCall S_CachePara,<[doc], [SEG_cp], [OFF_cp]> else ;not DEBUG cCall N_CachePara,<[doc], [SEG_cp], [OFF_cp]> endif ;DEBUG ; } FITDC05: ; Assert(FInCa(doc, caPara.cpLim - 1, &caTap)); ; Assert(caTap.cpFirst == vmpitccp[0]); ifdef DEBUG push ax push bx push cx push dx mov ax,-1 cwd add ax,[caPara.LO_cpLimCa] adc dx,[caPara.HI_cpLimCa] mov bx,dataoffset [caTap] cCall FInCa,<[doc],dx,ax,bx> or ax,ax jne FITDC06 mov ax,midFetchn3 mov bx,1023 cCall AssertProcForNative,<ax, bx> FITDC06: mov ax,[caTap.LO_cpFirstCa] mov dx,[caTap.HI_cpFirstCa] sub ax,wlo [vmpitccp] sbb dx,whi [vmpitccp] or ax,dx je FITDC07 mov ax,midFetchn3 mov bx,1024 cCall AssertProcForNative,<ax, bx> FITDC07: pop dx pop cx pop bx pop ax endif ;DEBUG ; for (icp = 0; cp >= vmpitccp[icp+1]; icp++); mov bx,dataoffset [vmpitccp] mov cx,[OFF_cp] mov dx,[SEG_cp] FITDC08: add bx,4 cmp cx,[bx] mov ax,dx sbb ax,[bx+2] jge FITDC08 ;Assembler note: compute fResult = (cp >= caTap.cpFirst) now because ;we have cp handy. sub cx,[caTap.LO_cpFirstCa] sbb dx,[caTap.HI_cpFirstCa] cmc sbb ax,ax ; vcpFirstTableCell = vmpitccp[icp]; mov cx,[bx-4] mov dx,[bx-2] ; vcpFirstTablePara = FInCa(doc, vcpFirstTableCell, &caPara) ; ? vcpFirstTableCell : caPara.cpFirst; mov si,dataoffset [caPara] mov di,[doc] ;LN_FInCa takes a doc in di, a cp in dx:cx and a pca in si and ;returns the result in bx. ax, bx, cx and dx are altered. push dx push cx ;save vcpFirstTableCell; push ax ;save fResult call LN_FInCa pop ax ;restore fResult pop cx pop dx ;restore vcpFirstTableCell; FITDC09: mov wlo [vcpFirstTableCell],cx mov whi [vcpFirstTableCell],dx or bx,bx jne FITDC10 mov cx,[caPara.LO_cpFirstCa] mov dx,[caPara.HI_cpFirstCa] FITDC10: mov wlo [vcpFirstTablePara],cx mov whi [vcpFirstTablePara],dx ; return (cp >= caTap.cpFirst); ;} cEnd sEnd fetch end
20.381014
85
0.634786
f42b9a0dfd5525c33732dee37b65fa0840ea40d6
14,259
asm
Assembly
rom/ints.asm
hisahi/ellipse1100
930588825d8cc3ad3b069269ff9d596022f84d02
[ "Zlib" ]
null
null
null
rom/ints.asm
hisahi/ellipse1100
930588825d8cc3ad3b069269ff9d596022f84d02
[ "Zlib" ]
null
null
null
rom/ints.asm
hisahi/ellipse1100
930588825d8cc3ad3b069269ff9d596022f84d02
[ "Zlib" ]
null
null
null
; Ellipse Workstation 1100 (fictitious computer) ; ROM code (interrupt handlers) ; ; Copyright (c) 2020 Sampo Hippeläinen (hisahi) ; ; Permission is hereby granted, free of charge, to any person obtaining a copy ; of this software and associated documentation files (the "Software"), to deal ; in the Software without restriction, including without limitation the rights ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the Software is ; furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included in all ; copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ; SOFTWARE. ; ; Written for the WLA-DX assembler ; .DEFINE IN_SWAPBRK $0E80 .DEFINE IN_SWAPIRQ $0E82 .DEFINE IN_SWAPNMI $0E84 .DEFINE IN_SWAPBRKL $800E80 .DEFINE IN_SWAPIRQL $800E82 .DEFINE IN_SWAPNMIL $800E84 .DEFINE ISBRKEMUL $800E86 INTH_RET: AXY16 PLD PLB PLY PLX PLA INTH_RTI: RTI INTH_RET_PLA: ACC16 PLA RTI INTH_BRK: ; BRK native handler, jump to SW handler CLD ACC16 PHA ACC8 LDA IN_SWAPBRK.W BMI INTH_RET_PLA AXY16 PHX PHY PHB PHD ; A is zero if we were in native mode, otherwise <>0 LDA ISBRKEMUL.L JML SWRAMBRK-1 ; jump to trampoline INTH_NMI: ; NMI native handler, jump to SW handler CLD ACC16 PHA ACC8 LDA IN_SWAPNMI.W BMI INTH_RET_PLA AXY16 PHX PHY PHB PHD LDA $700002 ; load interrupt device number AND #$FF.W JML SWRAMNMI-1 ; jump to trampoline INTH_IRQ: ; IRQ native handler, jump to SW handler CLD ACC16 PHA ACC8 LDA IN_SWAPIRQ.W BMI INTH_RET_PLA AXY16 PHX PHY PHB PHD LDA $700002 ; load interrupt device number AND #$FF.W JML SWRAMIRQ-1 ; jump to trampoline INTH_COP: ; COP native handler, ignore INTH_E_COP: ; COP emulation handler, ignore INTH_ABORT: ; ABORT native handler, ignore INTH_E_ABORT: ; ABORT emulation handler, ignore RTI INTH_E_BRK: ; BRK emulation handler CLD CLC XCE ; jump to native after disabling E PHK PEA INTH_E_NMI_RET PHP ACC8 PHA LDA #0 ADC #0 STA ISBRKEMUL.L PLA JMP INTH_BRK INTH_E_NMI: ; NMI emulation handler CLD CLC XCE ; jump to native after disabling E PHK PEA INTH_E_NMI_RET PHP JMP INTH_NMI INTH_E_NMI_RET: SEC XCE RTI INTH_E_IRQ: ; IRQ emulation handler CLD CLC XCE ; jump to native after disabling E PHK PEA INTH_E_NMI_RET PHP JMP INTH_IRQ .org $FC00 ; A = 16-bit addr to interrupt handler Y = bank ; X = 16-bit addr to where the previous interrupt handler B = bank ; address will be stored ; A, X, Y clobbered ; NEW INT ROUTINE MUST JMP [...] INTO WHEREVER X POINTS, UNLESS ; it has no intention to return back to original code SWAPBRK: PHP ; save old P SEI ; disable IRQs just in case ACC8 ; 8-bit accumulator SEC ; \ ROR A ; | STA IN_SWAPBRKL.L ; / set SWAPBRK latch to >=$80 ROL A ; restore old A XY8 ; 8-bit index registers PHY ; save old Y AXY16 ; 16-bit A, X, Y TAY ; move A to Y, we will need that value CMP SWRAMBRK.L ; same as current int handler? BNE @DIFFADDR ; if not, just store as before ACC8 ; 8-bit acc to check bank PLA ; restore original Y to A CMP SWRAMBRK+2.L ; same as old bank? BEQ @EXIT ; if so, just exit PHA ; else push it back as we'll PLA later ACC16 ; 16-bit acc to continue @DIFFADDR: LDA SWRAMBRK.L ; get old 16-bit int handler addr STA $0000.W,X ; store at B:(X) TYA ; restore old A value STA SWRAMBRK.L ; set new 16-bit int handler addr ACC8 ; 8-bit A again LDA SWRAMBRK+2.L ; get old int handler bank STA $0002.W,X ; store at B:(X+2) PLA ; restore original Y to A STA SWRAMBRK+2.L ; set new int handler bank @EXIT LDA #0 ; \ STA IN_SWAPBRKL.L ; / zero SWAPBRK latch PLP ; restore old P RTL ; return .org $FCC0 ; restore old BRK handler from B:X UNSWAPBRK: PHP ; save old P SEI ; disable IRQs just in case ACC8 ; 8-bit accumulator SEC ; \ ROR A ; | STA IN_SWAPBRKL.L ; / set SWAPBRK latch to >=$80 ROL A ; restore old A AXY16 ; 16-bit A, X, Y LDA $0000.W,X ; get addr at B:X STA SWRAMBRK.L ; set new int handler address ACC8 ; 8-bit A to get/set bank LDA $0002.W,X ; get bank at B:(X+2) STA SWRAMBRK+2.L ; set new int handler bank LDA #0 ; \ STA IN_SWAPBRKL.L ; / zero SWAPBRK latch PLP ; restore old P RTL ; return .org $FD00 ; A = 16-bit addr to interrupt handler Y = bank ; X = 16-bit addr to where the previous interrupt handler B = bank ; address will be stored ; A, X, Y clobbered ; NEW INT ROUTINE MUST JMP [...] INTO WHEREVER X POINTS!!! SWAPNMI: PHP ; save old P SEI ; disable IRQs just in case ACC8 ; 8-bit accumulator SEC ; \ ROR A ; | STA IN_SWAPNMIL.L ; / set SWAPNMI latch to >=$80 ROL A ; restore old A XY8 ; 8-bit index registers PHY ; save old Y AXY16 ; 16-bit A, X, Y TAY ; move A to Y, we will need that value CMP SWRAMNMI.L ; same as current int handler? BNE @DIFFADDR ; if not, just store as before ACC8 ; 8-bit acc to check bank PLA ; restore original Y to A CMP SWRAMNMI+2.L ; same as old bank? BEQ @EXIT ; if so, just exit PHA ; else push it back as we'll PLA later ACC16 ; 16-bit acc to continue @DIFFADDR: LDA SWRAMNMI.L ; get old 16-bit int handler addr STA $0000.W,X ; store at B:(X) TYA ; restore old A value STA SWRAMNMI.L ; set new 16-bit int handler addr ACC8 ; 8-bit A again LDA SWRAMNMI+2.L ; get old int handler bank STA $0002.W,X ; store at B:(X+2) PLA ; restore original Y to A STA SWRAMNMI+2.L ; set new int handler bank @EXIT LDA #0 ; \ STA IN_SWAPNMIL.L ; / zero SWAPNMI latch PLP ; restore old P RTL ; return .org $FDC0 ; restore old NMI handler from B:X UNSWAPNMI: PHP ; save old P SEI ; disable IRQs just in case ACC8 ; 8-bit accumulator SEC ; \ ROR A ; | STA IN_SWAPNMIL.L ; / set SWAPNMI latch to >=$80 ROL A ; restore old A AXY16 ; 16-bit A, X, Y LDA $0000.W,X ; get addr at B:X STA SWRAMNMI.L ; set new int handler address ACC8 ; 8-bit A to get/set bank LDA $0002.W,X ; get bank at B:(X+2) STA SWRAMNMI+2.L ; set new int handler bank LDA #0 ; \ STA IN_SWAPNMIL.L ; / zero SWAPNMI latch PLP ; restore old P RTL ; return .org $FE00 ; A = 16-bit addr to interrupt handler Y = bank ; X = 16-bit addr to where the previous interrupt handler B = bank ; address will be stored ; A, X, Y clobbered ; NEW INT ROUTINE MUST JMP [...] INTO WHEREVER X POINTS!!! SWAPIRQ: PHP ; save old P SEI ; disable IRQs just in case ACC8 ; 8-bit accumulator SEC ; \ ROR A ; | STA IN_SWAPIRQL.L ; / set SWAPIRQ latch to >=$80 ROL A ; restore old A XY8 ; 8-bit index registers PHY ; save old Y AXY16 ; 16-bit A, X, Y TAY ; move A to Y, we will need that value CMP SWRAMIRQ.L ; same as current int handler? BNE @DIFFADDR ; if not, just store as before ACC8 ; 8-bit acc to check bank PLA ; restore original Y to A CMP SWRAMIRQ+2.L ; same as old bank? BEQ @EXIT ; if so, just exit PHA ; else push it back as we'll PLA later ACC16 ; 16-bit acc to continue @DIFFADDR: LDA SWRAMIRQ.L ; get old 16-bit int handler addr STA $0000.W,X ; store at B:(X) TYA ; restore old A value STA SWRAMIRQ.L ; set new 16-bit int handler addr ACC8 ; 8-bit A again LDA SWRAMIRQ+2.L ; get old int handler bank STA $0002.W,X ; store at B:(X+2) PLA ; restore original Y to A STA SWRAMIRQ+2.L ; set new int handler bank @EXIT LDA #0 ; \ STA IN_SWAPIRQL.L ; / zero SWAPIRQ latch PLP ; restore old P RTL ; return .org $FEC0 ; restore old IRQ handler from B:X UNSWAPIRQ: PHP ; save old P SEI ; disable IRQs just in case ACC8 ; 8-bit accumulator SEC ; \ ROR A ; | STA IN_SWAPIRQL.L ; / set SWAPIRQ latch to >=$80 ROL A ; restore old A AXY16 ; 16-bit A, X, Y LDA $0000.W,X ; get addr at B:X STA SWRAMIRQ.L ; set new int handler address ACC8 ; 8-bit A to get/set bank LDA $0002.W,X ; get bank at B:(X+2) STA SWRAMIRQ+2.L ; set new int handler bank LDA #0 ; \ STA IN_SWAPIRQL.L ; / zero SWAPIRQ latch PLP ; restore old P RTL ; return
43.605505
81
0.41167
74d03b8c9cf3632c002647cc5f01872b530c3a5b
1,464
asm
Assembly
programs/oeis/023/A023536.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/023/A023536.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/023/A023536.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A023536: Convolution of natural numbers with A023532. ; 1,2,4,7,10,14,19,25,31,38,46,55,65,75,86,98,111,125,140,155,171,188,206,225,245,266,287,309,332,356,381,407,434,462,490,519,549,580,612,645,679,714,750,786,823,861,900,940,981,1023,1066,1110,1155,1200,1246,1293,1341,1390,1440,1491,1543,1596,1650,1705,1760,1816,1873,1931,1990,2050,2111,2173,2236,2300,2365,2431,2497,2564,2632,2701,2771,2842,2914,2987,3061,3136,3212,3289,3367,3445,3524,3604,3685,3767,3850,3934,4019,4105,4192,4280,4369,4459,4550,4641,4733,4826,4920,5015,5111,5208,5306,5405,5505,5606,5708,5811,5915,6020,6125,6231,6338,6446,6555,6665,6776,6888,7001,7115,7230,7346,7463,7581,7700,7820,7940,8061,8183,8306,8430,8555,8681,8808,8936,9065,9195,9326,9458,9591,9725,9860,9996,10132,10269,10407,10546,10686,10827,10969,11112,11256,11401,11547,11694,11842,11991,12141,12292,12444,12597,12750,12904,13059,13215,13372,13530,13689,13849,14010,14172,14335,14499,14664,14830,14997,15165,15334,15504,15675,15846,16018,16191,16365,16540,16716,16893,17071,17250,17430,17611,17793,17976,18160,18345,18531,18718,18906,19095,19285,19475,19666,19858,20051,20245,20440,20636,20833,21031,21230,21430,21631,21833,22036,22240,22445,22651,22858,23066,23275,23485,23695,23906,24118,24331,24545,24760,24976,25193,25411,25630,25850,26071,26293,26516,26740,26965,27191,27418,27646,27875,28105 mov $1,1 mov $4,$0 lpb $0,1 add $1,$0 sub $0,1 add $2,3 add $3,$4 trn $3,$2 trn $4,$1 sub $1,$3 sub $2,2 lpe
91.5
1,281
0.773907
c09d6109d619dd072c48d71ffdd5248163e202e4
842
asm
Assembly
oeis/228/A228016.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/228/A228016.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/228/A228016.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A228016: a(1) = least k such that 1/1+1/2+1/3+1/4+1/5 < H(k) - H(5); a(2) = least k such that H(a(1)) - H(5) < H(k) -H(a(1)), and for n > 2, a(n) = least k such that H(a(n-1)) - H(a(n-2) > H(k) - H(a(n-1)), where H = harmonic number. ; Submitted by Jamie Morken(s3) ; 54,539,5340,52865,523314,5180279,51279480,507614525,5024865774,49741043219,492385566420,4874114620985,48248760643434,477613491813359,4727886157490160,46801248083088245,463284594673392294,4586044698650834699,45397162391834954700,449385579219698712305,4448458629805152168354,44035200718831822971239,435903548558513077544040,4315000284866298952469165,42714099300104476447147614,422825992716178465519006979,4185545827861680178742922180,41432632285900623321910214825,410140777031144553040359226074 add $0,2 seq $0,54320 ; Expansion of g.f.: (1 + x)/(1 - 10*x + x^2). div $0,2
105.25
494
0.770784
5e75e738b95682dc40ba8f36d5c901540a3d9c27
312
asm
Assembly
T4P1/teste_novas_func_hdl.asm
cggewehr/Projeto-De-Processadores
a7e0735342b83b3524152060162330423b3672c5
[ "CC0-1.0" ]
null
null
null
T4P1/teste_novas_func_hdl.asm
cggewehr/Projeto-De-Processadores
a7e0735342b83b3524152060162330423b3672c5
[ "CC0-1.0" ]
null
null
null
T4P1/teste_novas_func_hdl.asm
cggewehr/Projeto-De-Processadores
a7e0735342b83b3524152060162330423b3672c5
[ "CC0-1.0" ]
null
null
null
.org #0000h .code xor r0, r0, r0 ldh r1, #00h ldl r1, #0ah ldh r2, #00h ldl r2, #02h div r1, r2 mfh r3 mfl r4 div r3, r2 mfh r5 mfl r6 xor r1, r1, r1 addi r1, #FFh mul r1 r1 mfh r7 mfl r8 halt .endcode
9.75
19
0.426282
557ac004c4c39f40cb4d93b76121efaa4025e661
573
asm
Assembly
programs/oeis/313/A313928.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/313/A313928.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/313/A313928.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A313928: Coordination sequence Gal.5.302.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,5,10,16,22,28,34,40,46,51,56,61,66,72,78,84,90,96,102,107,112,117,122,128,134,140,146,152,158,163,168,173,178,184,190,196,202,208,214,219,224,229,234,240,246,252,258,264,270,275 mov $2,$0 cal $0,312143 ; Coordination sequence Gal.5.55.2 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. add $0,$2 mov $1,$0
71.625
181
0.745201
82d7235a4def76a477cfaaad11f60bb3643631dd
3,682
asm
Assembly
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_937.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_937.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_937.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %rdi push %rsi // Faulty Load lea addresses_UC+0xdb5a, %r11 nop nop nop nop nop add %r12, %r12 mov (%r11), %rdi lea oracles, %r15 and $0xff, %rdi shlq $12, %rdi mov (%r15,%rdi,1), %rdi pop %rsi pop %rdi pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 0, 'size': 4, 'same': False, 'NT': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'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 */
85.627907
2,999
0.663498
a82dcee7d5d50fa30e31ab5a1b298288beaad15a
932
asm
Assembly
samples/tmacro.asm
wilsonpilon/msx-menu
21110eb2e93ed033ed95d80f282b869c09f3714b
[ "Apache-2.0" ]
null
null
null
samples/tmacro.asm
wilsonpilon/msx-menu
21110eb2e93ed033ed95d80f282b869c09f3714b
[ "Apache-2.0" ]
null
null
null
samples/tmacro.asm
wilsonpilon/msx-menu
21110eb2e93ed033ed95d80f282b869c09f3714b
[ "Apache-2.0" ]
null
null
null
; tmacro.asm ; Some tests of macro usage. org 100h ; To run in cp/m start: macro bdos, function ld c, function call 5 endm lineend macro ld e, 0Dh bdos 2 ld e, 0Ah bdos 2 endm macro pushall push af push bc push de push hl endm popall macro pop hl pop de pop bc pop af endm ; Another way. pall macro operation irp reg, af, bc, de, hl local i1 operation reg endm endm pushall2 macro pall push endm popall2 macro irp reg, af, bc, de, hl pop reg endm endm ; Yet another way pushmany macro reg rept -1 if nul reg exitm endif push reg .shift endm endm pushall3 macro pushmany af, bc, de, hl endm ; Main program ; pushall ; pushall2 pushall3 ld de, hello i1 bdos 9 i2: lineend ;popall popall2 bdos 0 hello db 'Hello, world.$' end start ; End of tmacro.asm
9.048544
29
0.597639
f3d9a9b21aa87018185f8e2ce6299e1ed87f0524
466
asm
Assembly
oeis/256/A256008.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/256/A256008.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/256/A256008.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A256008: Self-inverse permutation of positive integers: 4k+1 is swapped with 4k+3, and 4k+2 with 4k+4. ; 3,4,1,2,7,8,5,6,11,12,9,10,15,16,13,14,19,20,17,18,23,24,21,22,27,28,25,26,31,32,29,30,35,36,33,34,39,40,37,38,43,44,41,42,47,48,45,46,51,52,49,50,55,56,53,54,59,60,57,58,63,64,61,62,67,68,65,66,71,72,69,70,75,76,73,74,79,80,77,78,83,84,81,82,87,88,85,86,91,92,89,90,95,96,93,94,99,100,97,98 mov $1,$0 div $0,2 gcd $0,2 add $1,$0 pow $0,2 add $0,$1 sub $0,3
42.363636
293
0.656652
9e9515b757bd342e07920d2004da1032f6c93fe4
5,443
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_952.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_952.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_952.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x1237e, %rax nop nop nop nop inc %rdx mov (%rax), %ebp nop and $61795, %rdx lea addresses_normal_ht+0x45fe, %rsi lea addresses_A_ht+0x2a3e, %rdi nop nop nop nop nop xor $60325, %r15 mov $84, %rcx rep movsq nop nop nop cmp $47889, %rbp lea addresses_A_ht+0x39fe, %rsi lea addresses_WT_ht+0xf4be, %rdi nop nop add %r11, %r11 mov $50, %rcx rep movsw add %rdi, %rdi lea addresses_UC_ht+0x66c5, %rax clflush (%rax) nop nop nop and $31078, %r15 mov $0x6162636465666768, %rsi movq %rsi, (%rax) nop nop nop nop sub $2288, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r14 push %r9 push %rax // Store lea addresses_UC+0x1bc58, %r10 clflush (%r10) nop nop xor %r9, %r9 movl $0x51525354, (%r10) nop nop and %r10, %r10 // Store lea addresses_normal+0x1debe, %r10 and %r13, %r13 movw $0x5152, (%r10) nop nop inc %r13 // Faulty Load lea addresses_WC+0x134be, %r10 xor $16257, %r14 movups (%r10), %xmm5 vpextrq $1, %xmm5, %r12 lea oracles, %r10 and $0xff, %r12 shlq $12, %r12 mov (%r10,%r12,1), %r12 pop %rax pop %r9 pop %r14 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC', 'congruent': 0}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal', 'congruent': 9}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 6}} {'dst': {'same': True, 'congruent': 5, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 6, 'type': 'addresses_normal_ht'}} {'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC_ht', 'congruent': 0}, 'OP': 'STOR'} {'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 */
42.523438
2,999
0.659563
765ac192df7a5f88b92675736732b728edf52bc3
2,004
asm
Assembly
libsrc/graphics/attache/plot_setup.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/graphics/attache/plot_setup.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/graphics/attache/plot_setup.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; ; Otrona Attachè graphics routines ; direct video HW access ; ; Internal use code to prepare SMC instructions ; ; Stefano Bodrato 2018 ; ; ; ; $Id: plot_setup.asm $ ; INCLUDE "graphics/grafix.inc" SECTION smc_clib PUBLIC plot_setup EXTERN __gfx_coords .plot_setup ld (__gfx_coords),hl ; store X ld (__gfx_coords+2),de ; store Y: COORDS must be 2 bytes wider DI ;STOP VALET ;LD A,(GRFBIT+1) ; SMC, initially $C7 (SET 0,A), changed to $87 (RES 0,A) to unplot ;LD (PIXBIT),A ;CALL LINDSP ; INVERT Y ;LD A,(GRY) push hl ld a,e ;ADD A,16 ;FIND OUT WHICH NIBBLE ;CPL ;LD HL,PIXBIT LD HL,PIXBIT+1 ; wow... here we do SMC on the SMC code ! RES 5,(HL) BIT 0,A JR NZ,LNDSP1 SET 5,(HL) LNDSP1: SRL A LD B,-1 ;AND WHICH LINE LNDSP2: INC B ADD A,-5 JR C,LNDSP2 ADD A,5 RRCA RRCA RRCA ; When accessing graphics, the display status register uses ; the three high order bits to select one of the five gfx scan pairs (segments) ; and the five low order bits to select one of the 24 lines. LD C,A ;LD A,(LINOFS) ; $DAA4 on earlier BIOSES, but address changes :( ... ;PUSH AF ;SAVE LINOFS ;ADD A,B ld a,b ; .. so we assume line offset to be zero CP 24 ;LINES JR C,LNDSP3 ADD A,-24 ;-LINES LNDSP3: OR C ;POP BC ;IN B FOR EXTERNAL USE OUT (0EEH),A ; DISPLAY COMMAND/STATUS ;LD HL,(GRX) pop hl ;CALL SETBIT ; GET X LD A,L ; FIND OUT WHICH BIT.. RLCA RLCA ; ..IN THE NIBBLE RLCA AND 18H ; @11000: mask for the the 2 changed bits LD B,A ;LD A,(PIXBIT) PIXBIT: LD A,$87 ; SMC: $C7 for "SET n,A" or $87 for "RES n,A".. RET
22.021978
93
0.521956
cf989411d4265f4f517b972a3d8550f15ae93de7
1,671
asm
Assembly
programs/oeis/102/A102083.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/102/A102083.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/102/A102083.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A102083: a(n) = 8*n^2 + 4*n + 1. ; 1,13,41,85,145,221,313,421,545,685,841,1013,1201,1405,1625,1861,2113,2381,2665,2965,3281,3613,3961,4325,4705,5101,5513,5941,6385,6845,7321,7813,8321,8845,9385,9941,10513,11101,11705,12325,12961,13613,14281,14965,15665,16381,17113,17861,18625,19405,20201,21013,21841,22685,23545,24421,25313,26221,27145,28085,29041,30013,31001,32005,33025,34061,35113,36181,37265,38365,39481,40613,41761,42925,44105,45301,46513,47741,48985,50245,51521,52813,54121,55445,56785,58141,59513,60901,62305,63725,65161,66613,68081,69565,71065,72581,74113,75661,77225,78805,80401,82013,83641,85285,86945,88621,90313,92021,93745,95485,97241,99013,100801,102605,104425,106261,108113,109981,111865,113765,115681,117613,119561,121525,123505,125501,127513,129541,131585,133645,135721,137813,139921,142045,144185,146341,148513,150701,152905,155125,157361,159613,161881,164165,166465,168781,171113,173461,175825,178205,180601,183013,185441,187885,190345,192821,195313,197821,200345,202885,205441,208013,210601,213205,215825,218461,221113,223781,226465,229165,231881,234613,237361,240125,242905,245701,248513,251341,254185,257045,259921,262813,265721,268645,271585,274541,277513,280501,283505,286525,289561,292613,295681,298765,301865,304981,308113,311261,314425,317605,320801,324013,327241,330485,333745,337021,340313,343621,346945,350285,353641,357013,360401,363805,367225,370661,374113,377581,381065,384565,388081,391613,395161,398725,402305,405901,409513,413141,416785,420445,424121,427813,431521,435245,438985,442741,446513,450301,454105,457925,461761,465613,469481,473365,477265,481181,485113,489061,493025,497005 mov $1,8 mul $1,$0 add $1,4 mul $1,$0 add $1,1
185.666667
1,587
0.823459
f036519f7bdc6d96ee38a94cff4815f7bf8db952
656
asm
Assembly
src/util/sprite/cg.asm
olifink/qspread
d6403d210bdad9966af5d2a0358d4eed3f1e1c02
[ "MIT" ]
null
null
null
src/util/sprite/cg.asm
olifink/qspread
d6403d210bdad9966af5d2a0358d4eed3f1e1c02
[ "MIT" ]
null
null
null
src/util/sprite/cg.asm
olifink/qspread
d6403d210bdad9966af5d2a0358d4eed3f1e1c02
[ "MIT" ]
null
null
null
* Sprite cg * * Mode 4 * +|-----------+ * - gg g ggg g- * |g g g g| * |g g | * |g g gg | * |g g g | * |g g g | * | gg ggg | * +|-----------+ * section sprite xdef mes_cg xref mes_zero mes_cg dc.w $0100,$0000 dc.w 12,7,0,0 dc.l sc4_cg-* dc.l mes_zero-* dc.l 0 sc4_cg dc.w $6900,$D000 dc.w $8A00,$1000 dc.w $8200,$0000 dc.w $8200,$C000 dc.w $8200,$4000 dc.w $8200,$4000 dc.w $6100,$C000 * end
19.878788
27
0.321646
59bab80d993f53529b21de025a92f862cbc00dd0
234
asm
Assembly
libsrc/_DEVELOPMENT/adt/bv_priority_queue/c/sdcc_iy/bv_priority_queue_clear.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/adt/bv_priority_queue/c/sdcc_iy/bv_priority_queue_clear.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/adt/bv_priority_queue/c/sdcc_iy/bv_priority_queue_clear.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; void bv_priority_queue_clear(bv_priority_queue_t *q) SECTION code_clib SECTION code_adt_bv_priority_queue PUBLIC _bv_priority_queue_clear EXTERN _ba_priority_queue_clear defc _bv_priority_queue_clear = _ba_priority_queue_clear
19.5
56
0.888889
62221da0db35ba27fd9e417dcb22130bf4a3c51a
467
asm
Assembly
programs/oeis/038/A038587.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/038/A038587.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/038/A038587.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A038587: Sizes of successive clusters in hexagonal lattice A_2 centered at deep hole. ; 3,6,12,12,18,21,27,27,30,36,42,42,48,48,54,54,63,69,69,69,75,78,84,84,90,96,102,102,102,102,114,114,120,123,129,129,135,141,141,141,144,150,156,156,168,168,174,174,174 mov $2,$0 add $2,1 mov $4,$0 lpb $2,1 mov $0,$4 sub $2,1 sub $0,$2 mul $0,3 cal $0,84301 ; a(n) = sigma(n) mod 6. add $0,9 mov $3,$0 mul $3,2 sub $3,18 div $3,2 mul $3,3 add $1,$3 lpe
22.238095
169
0.620985
2f7c97f4c36d26901af6725c68968eb375c63919
14,102
asm
Assembly
Driver/Mouse/LogiBus/logibus.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Driver/Mouse/LogiBus/logibus.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Driver/Mouse/LogiBus/logibus.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
73
2018-11-19T20:46:53.000Z
2022-03-29T00:59:26.000Z
COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1988 -- All Rights Reserved PROJECT: PC GEOS MODULE: MOUSE DRIVER -- Logitech Bus Mouse device-dependent code FILE: logibus.asm AUTHOR: Adam de Boor ROUTINES: Name Description ---- ----------- MouseDevInit Initialize device MouseDevExit Exit device REVISION HISTORY: Name Date Description ---- ---- ----------- Adam 3/89 Initial version Adam 3/24/89 Converted to new driver format DESCRIPTION: Input for the Logitech Bus Mouse. Accesses the device directly every clock tick, reading the state of the counters and generating an event if they're non-zero. $Id: logibus.asm,v 1.1 97/04/18 11:47:56 newdeal Exp $ ------------------------------------------------------------------------------@ MOUSE_NUM_BUTTONS = 3 MOUSE_SEPARATE_INIT = 1 ; We use a separate Init resource include ../mouseCommon.asm include localize.def include timer.def ; ; Additional error code(s) ; MOUSE_REPORT_RATE_ZERO enum FatalErrors ;------------------------------------------------------------------------------ ; ; BUS MOUSE CONSTANTS ; ;------------------------------------------------------------------------------ MOUSE_CONFIG_PORT = 23fh ; Configuration for 8255 MOUSE_CONFIG_BYTE = 91h ; From technical spec. I don't know what ; it means. MOUSE_CTRL_PORT = 23eh ; Control port. Bits are: ; 0-3 unused ; 4 Interrupt enable (active low(?)) ; 5 High/Low nibble selector ; 6 X/Y counter selector ; 7 Counter latch (active high) MOUSE_HC = 80h MOUSE_X = 00h MOUSE_Y = 40h MOUSE_HIGH = 20h MOUSE_LOW = 00h MOUSE_NO_INT = 10h MOUSE_IEN = 00h MOUSE_SIG_PORT = 23dh ; Signature port. Usually a5, but can be ; altered. MOUSE_STANDARD_SIG = 0xa5 ; Standard signature. MOUSE_DATA_PORT = 23ch ; Data port. Low four bits are a nibble from ; one of the counters (selected by <5:6> in ; the CTRL_PORT). High four bits are button ; state with a 0 indicating the button is ; pressed. ;------------------------------------------------------------------------------ ; DEVICE STRINGS ;------------------------------------------------------------------------------ MouseExtendedInfoSeg segment lmem LMEM_TYPE_GENERAL mouseExtendedInfo DriverExtendedInfoTable < {}, ; lmem header added by Esp length mouseNameTable, ; Number of supported devices offset mouseNameTable, offset mouseInfoTable > mouseNameTable lptr.char logiBus, oldMSBus, logiBusTM, otherBM, logiBusHR, atiWonder lptr.char 0 ; null-terminator LocalDefString logiBus, <'Logitech Bus Mouse', 0> LocalDefString oldMSBus, <'Microsoft Bus Mouse (large 9-pin plug)', 0> LocalDefString logiBusTM, <'Logitech Bus Trackball', 0> LocalDefString otherBM, <'Other Bus Mouse', 0> LocalDefString logiBusHR, <'Logitech Hi-Rez Bus Mouse', 0> LocalDefString atiWonder, <'ATI VGA Wonder+ Bus Mouse', 0> ; no special flags for these, as they're not serial, and we don't need an ; interrupt for them... mouseInfoTable MouseExtendedInfo \ 0, ; logiBus 0, ; oldMSBus 0, ; logibusTM 0, ; otherBM 0, ; logibusHR 0 ; atiWonder MouseExtendedInfoSeg ends ;------------------------------------------------------------------------------ ; Variables ;------------------------------------------------------------------------------ idata segment ; ; Store the handle of the timer used to get calls every tick ; timerHandle word reentrantFlag byte 1 ; Kind of like a semaphore. If ; 1, we can go ahead & poll the ; mouse. If not, we skip the poll. ; Is decremented on entry to ; MouseDevHandler, inc'd on exit. ; Used to keep us from performing ; reentrant reads of the mouse. ; ; Table of available rates. Must be in ascending order. ; mouseRates byte 10, 12, 15, 20, 30, 60, 255 MOUSE_NUM_RATES equ size mouseRates ; ; Clock ticks for timer corresponding to each rate. note that "continuous" ; is still 60 times/second only. ; mouseTicks byte 6, 5, 4, 3, 2, 1, 1 idata ends MOUSE_DELAY = 1 ; # ticks between polls Init segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MouseDevInit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initialize the device CALLED BY: MouseInit PASS: es=ds=dgroup RETURN: carry - set on error DESTROYED: di PSEUDO CODE/STRATEGY: Initialize the mouse (turning off interrupts from it) Start our polling timer KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- adam 3/10/89 Initial Revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ MouseDevInit proc far uses dx, ax, cx, si, bx .enter INT_OFF ; ; Turn off interrupts from the mouse -- we'll do it ourselves ; based on the clock. ; mov dx, MOUSE_CTRL_PORT mov al, MOUSE_NO_INT out dx, al ; ; Turn on the timer so we read the mouse... ; mov ax,TIMER_ROUTINE_CONTINUAL mov bx, segment Resident mov si,offset Resident:MouseDevHandler mov cx,MOUSE_DELAY mov di,cx call TimerStart mov ds:[timerHandle],bx ; ; Change ownership to us so the timer stays around while ; we do... ; mov ax, handle 0 call HandleModifyOwner clc ; no error INT_ON ; All set -- reenable .leave ret MouseDevInit endp Init ends Resident segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MouseDevExit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Clean up after ourselves CALLED BY: MouseExit PASS: Nothing RETURN: carry - set on error DESTROYED: Nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- adam 6/8/88 Initial Revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ MouseDevExit proc far clr bx xchg bx,ds:[timerHandle] tst bx ; were we initialized? jz done ; no clr ax ; 0 => continual call TimerStop ; ; The LogiTech driver apparently assumes that once it's ; enabled the interrupts for the mouse, they'll never be ; turned off. To make sure the mouse works when we leave ; PC GEOS, turn the interrupts back on... ; INT_OFF mov dx, MOUSE_CTRL_PORT mov al, MOUSE_IEN out dx, al INT_ON done: clc ; No errors ret MouseDevExit endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MouseSetDevice %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Turn on the device. CALLED BY: DRE_SET_DEVICE PASS: dx:si = pointer to null-terminated device name string RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: Just call the device-initialization routine in Init KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/27/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ MouseSetDevice proc near .enter call MouseDevInit .leave ret MouseSetDevice endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MouseTestDevice %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: See if the device specified is present. CALLED BY: DRE_TEST_DEVICE PASS: dx:si = null-terminated name of device (ignored, here) RETURN: ax = DevicePresent enum carry set if string invalid, clear otherwise DESTROYED: di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/27/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ MouseTestDevice proc near uses dx .enter INT_OFF ; INTS off while we configure... ; ; Send configuration byte to configuration port. These are ; constant and their meaning is unknown. I think this needs ; to be done before the signature port is mangled so the ; poor chip knows what port is what... ; mov dx, MOUSE_CONFIG_PORT mov al, MOUSE_CONFIG_BYTE out dx, al ; ; Make sure the thing is *not* a microsoft bus mouse. That mouse ; uses MOUSE_SIG_PORT as the data port for its register file. Since ; it usually leaves the file pointing to its control register, writing ; random stuff there is an unhappy thing to do. To detect a microsoft ; bus mouse, just try writing a 0 to 23c. If the 0 stays, it's ; most likely not a logibus... ; mov dx, MOUSE_DATA_PORT clr al out dx, al jmp $+2 in al, dx tst al jz absent ; ; Make sure the thing actually is out there. ; mov dx, MOUSE_SIG_PORT mov al, MOUSE_STANDARD_SIG out dx, al jmp $+2 in al, dx cmp al, MOUSE_STANDARD_SIG jne absent mov ax, DP_PRESENT done: clc INT_ON .leave ret absent: mov ax, DP_NOT_PRESENT jmp done MouseTestDevice endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MouseDevSetRate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the report rate for the mouse. For the bus mouse, running off the timer interrupt, this can't be more than 60 reports a second. There's not a whole lot of point in doing this, of course, since we can only do things like 60, 30, 20, 15, 12... All but 60 produce a strange double-mouse effect (sort of like a binary star). CALLED BY: MouseSetRate PASS: DS = dgroup CX = index of desired rate RETURN: Nothing DESTROYED: AX PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/12/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ MouseDevSetRate proc far push bx, si, cx, dx ; ; Shut off the timer first so we can restart it with the ; (potentially) different rate. ; mov bx, ds:[timerHandle] clr ax ; 0 => continual call TimerStop ; ; Set the interval into CX (initial delay) and DX (interval), ; point BX:SI at the handler and start the timer going again. ; mov si, cx mov cl, ds:mouseTicks[si] mov dx, cx mov bx, segment Resident mov si, offset Resident:MouseDevHandler mov ax, TIMER_ROUTINE_CONTINUAL call TimerStart ; ; Change ownership to us so the timer stays around while ; we do... ; mov ax, handle 0 call HandleModifyOwner ; ; Save the handle for exit etc. ; mov ds:[timerHandle], bx pop bx, si, cx, dx clc ret MouseDevSetRate endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MouseDevHandler %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: mouse handler routine CALLED BY: Timer interrupt PASS: RETURN: Nothing DESTROYED: May nuke AX, BX, CX, DX PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Adam 3/10/89 Initial Revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ MouseDevHandler proc far push si, di, ds ; Needed for event sending mov si, dgroup mov ds, si dec ds:[reentrantFlag] ; enter "semaphore" js MDH_exit ; as long as we aren't ; re-entering this code, ; continue. ; ; Faster to mov dx, si than mov dx, MOUSE_CTRL_PORT. Since ; we need to preserve SI and DI anyway, might as well use them ; for something... ; mov si, MOUSE_CTRL_PORT mov di, MOUSE_DATA_PORT control_port equ <si> data_port equ <di> ; ; Latch the counters and set up to fetch high nibble of deltaX. ; Also clears AH. ; mov dx, control_port mov ax, MOUSE_HC OR MOUSE_X OR MOUSE_HIGH OR MOUSE_NO_INT out dx, al ; ; Fetch buttons and high nibble of X ; mov dx, data_port in al, dx ; ; Nibble-swap ; mov cl, 4 shl ax, cl ; Get button state in AH, ; high nibble in high nibble ; of AL mov bx, ax ; Preserve both ; ; Fetch the low nibble ; mov dx, control_port mov al, MOUSE_HC OR MOUSE_X OR MOUSE_LOW OR MOUSE_NO_INT out dx, al mov dx, data_port in al, dx and al, 0fh ; Clear high nibble or bl, al ; Merge in with high nibble ; ; Set to read high nibble of deltaY ; mov dx, control_port mov al, MOUSE_HC OR MOUSE_Y OR MOUSE_HIGH OR MOUSE_NO_INT out dx, al mov dx, data_port in al, dx ; ; Shift high nibble into high nibble of AH. Since high nibble ; of AH is clear (button state only in low nibble and we ; cleared AH up above), we don't need to clear anything. ; CL still contains 4. ; ror ax, cl ; ; Fetch low nibble ; mov dx, control_port mov al, MOUSE_HC OR MOUSE_Y OR MOUSE_LOW OR MOUSE_NO_INT out dx, al mov dx, data_port in al, dx and al, 0fh or ah, al ; ; Release the latches but keep interrupts off ; mov dx, control_port mov al, MOUSE_NO_INT out dx, al ; ; Shift buttons into proper position (starting at b0, not b1) ; shr bh, 1 or bh, NOT 111b ; Make sure unsupported buttons are UP ; ; Sign-extend deltaY (in AH) and transfer to DX for M.S.E. ; mov al, ah cbw mov dx, ax ; ; Sign-extend deltaX (in BL) and place in CX for M.S.E. ; mov al, bl cbw mov cx, ax call MouseSendEvents MDH_exit: inc ds:[reentrantFlag] ; we're out of here pop si, di, ds ret MouseDevHandler endp Resident ends end
23.901695
80
0.569636
fb3e4f952e1708168b15e70c0186a29ecf3d87b3
9,299
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_st_zr_/i9-9900K_12_0xa0_notsx.log_21829_1320.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_st_zr_/i9-9900K_12_0xa0_notsx.log_21829_1320.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_st_zr_/i9-9900K_12_0xa0_notsx.log_21829_1320.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_WC_ht+0x4041, %r9 sub %r15, %r15 mov $0x6162636465666768, %rax movq %rax, %xmm2 vmovups %ymm2, (%r9) and $57931, %r14 lea addresses_normal_ht+0x177, %rsi lea addresses_UC_ht+0xeb77, %rdi clflush (%rdi) nop nop and %r13, %r13 mov $88, %rcx rep movsw nop nop nop nop and %r15, %r15 lea addresses_A_ht+0x6141, %r14 nop nop nop nop and %rdi, %rdi vmovups (%r14), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %r15 nop nop xor %r13, %r13 lea addresses_D_ht+0x1c037, %rsi nop nop nop nop cmp $23710, %r15 movw $0x6162, (%rsi) nop nop dec %r14 lea addresses_UC_ht+0x538e, %rsi lea addresses_WC_ht+0x16fbe, %rdi sub $51134, %r13 mov $41, %rcx rep movsl nop nop xor $47767, %rsi lea addresses_normal_ht+0x2b77, %rsi lea addresses_WC_ht+0x13ff3, %rdi sub $26933, %r15 mov $39, %rcx rep movsw nop nop nop add $23853, %r15 lea addresses_WT_ht+0x15007, %r15 nop nop nop sub $9692, %rdi vmovups (%r15), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $1, %xmm4, %rcx xor $15440, %r15 lea addresses_normal_ht+0xfe57, %rsi lea addresses_D_ht+0xf377, %rdi nop nop nop sub $47959, %r13 mov $55, %rcx rep movsl nop and $30657, %r15 lea addresses_D_ht+0x1e037, %rsi lea addresses_D_ht+0xf2f, %rdi nop nop nop nop and %r15, %r15 mov $72, %rcx rep movsl nop cmp $47171, %r9 lea addresses_WT_ht+0x9377, %r14 nop nop and %r13, %r13 mov (%r14), %r15d nop nop nop inc %r14 lea addresses_WC_ht+0x5377, %rsi lea addresses_UC_ht+0x12f77, %rdi nop nop inc %rax mov $115, %rcx rep movsl add %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r8 push %rax push %rcx push %rdi push %rsi // REPMOV lea addresses_PSE+0x10377, %rsi lea addresses_WC+0x4377, %rdi nop nop nop nop cmp $18473, %r8 mov $75, %rcx rep movsb nop and $16663, %r8 // Load lea addresses_WC+0x4377, %rcx nop nop nop sub $41759, %r13 movups (%rcx), %xmm2 vpextrq $0, %xmm2, %rax nop nop cmp %r8, %r8 // Store lea addresses_A+0x55b7, %r8 nop and %rcx, %rcx mov $0x5152535455565758, %rax movq %rax, %xmm7 movups %xmm7, (%r8) nop nop nop nop cmp $52453, %rcx // Store lea addresses_A+0x1f277, %r13 clflush (%r13) nop nop nop nop nop add $5984, %r14 mov $0x5152535455565758, %rcx movq %rcx, %xmm1 vmovups %ymm1, (%r13) nop nop nop nop dec %r8 // Store lea addresses_WC+0xe96f, %r14 cmp $16133, %rsi movl $0x51525354, (%r14) sub $46888, %r8 // Load mov $0x417, %r14 clflush (%r14) nop nop nop add $12532, %rdi movb (%r14), %al and %r13, %r13 // Store lea addresses_WC+0x15f77, %r13 nop nop nop nop and %r14, %r14 movb $0x51, (%r13) nop nop nop nop and %rcx, %rcx // Load lea addresses_A+0x1a3b3, %r8 clflush (%r8) sub %rcx, %rcx vmovntdqa (%r8), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %r13 nop nop nop nop nop add $17518, %r14 // Store lea addresses_A+0x15877, %rdi nop nop nop cmp $9126, %rcx mov $0x5152535455565758, %rax movq %rax, %xmm2 vmovups %ymm2, (%rdi) inc %r13 // Faulty Load lea addresses_WC+0x4377, %rax cmp %r14, %r14 movntdqa (%rax), %xmm2 vpextrq $0, %xmm2, %rdi lea oracles, %r13 and $0xff, %rdi shlq $12, %rdi mov (%r13,%rdi,1), %rdi pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_PSE', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC', 'congruent': 0, 'same': True}} {'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 3}} {'src': {'type': 'addresses_P', 'AVXalign': False, 'size': 1, 'NT': True, 'same': False, 'congruent': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 8}} {'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 8}} [Faulty Load] {'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 16, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}} {'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 2}} {'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': True}} {'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': True}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': True}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'33': 1, '00': 21828} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
31.522034
2,999
0.652328
046889cb5a07f505735ca8b163c1a323223beb7e
26,283
asm
Assembly
third_party/boringssl/win-x86_64/crypto/sha/sha512-x86_64.asm
aranajhonny/chromium
caf5bcb822f79b8997720e589334266551a50a13
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2019-01-16T03:57:39.000Z
2019-01-16T03:57:39.000Z
third_party/boringssl/win-x86_64/crypto/sha/sha512-x86_64.asm
aranajhonny/chromium
caf5bcb822f79b8997720e589334266551a50a13
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2018-02-10T21:00:08.000Z
2018-03-20T05:09:50.000Z
third_party/boringssl/win-x86_64/crypto/sha/sha512-x86_64.asm
aranajhonny/chromium
caf5bcb822f79b8997720e589334266551a50a13
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
OPTION DOTNAME .text$ SEGMENT ALIGN(64) 'CODE' EXTERN OPENSSL_ia32cap_P:NEAR PUBLIC sha512_block_data_order ALIGN 16 sha512_block_data_order PROC PUBLIC mov QWORD PTR[8+rsp],rdi ;WIN64 prologue mov QWORD PTR[16+rsp],rsi mov rax,rsp $L$SEH_begin_sha512_block_data_order:: mov rdi,rcx mov rsi,rdx mov rdx,r8 push rbx push rbp push r12 push r13 push r14 push r15 mov r11,rsp shl rdx,4 sub rsp,16*8+4*8 lea rdx,QWORD PTR[rdx*8+rsi] and rsp,-64 mov QWORD PTR[((128+0))+rsp],rdi mov QWORD PTR[((128+8))+rsp],rsi mov QWORD PTR[((128+16))+rsp],rdx mov QWORD PTR[((128+24))+rsp],r11 $L$prologue:: mov rax,QWORD PTR[rdi] mov rbx,QWORD PTR[8+rdi] mov rcx,QWORD PTR[16+rdi] mov rdx,QWORD PTR[24+rdi] mov r8,QWORD PTR[32+rdi] mov r9,QWORD PTR[40+rdi] mov r10,QWORD PTR[48+rdi] mov r11,QWORD PTR[56+rdi] jmp $L$loop ALIGN 16 $L$loop:: mov rdi,rbx lea rbp,QWORD PTR[K512] xor rdi,rcx mov r12,QWORD PTR[rsi] mov r13,r8 mov r14,rax bswap r12 ror r13,23 mov r15,r9 xor r13,r8 ror r14,5 xor r15,r10 mov QWORD PTR[rsp],r12 xor r14,rax and r15,r8 ror r13,4 add r12,r11 xor r15,r10 ror r14,6 xor r13,r8 add r12,r15 mov r15,rax add r12,QWORD PTR[rbp] xor r14,rax xor r15,rbx ror r13,14 mov r11,rbx and rdi,r15 ror r14,28 add r12,r13 xor r11,rdi add rdx,r12 add r11,r12 lea rbp,QWORD PTR[8+rbp] add r11,r14 mov r12,QWORD PTR[8+rsi] mov r13,rdx mov r14,r11 bswap r12 ror r13,23 mov rdi,r8 xor r13,rdx ror r14,5 xor rdi,r9 mov QWORD PTR[8+rsp],r12 xor r14,r11 and rdi,rdx ror r13,4 add r12,r10 xor rdi,r9 ror r14,6 xor r13,rdx add r12,rdi mov rdi,r11 add r12,QWORD PTR[rbp] xor r14,r11 xor rdi,rax ror r13,14 mov r10,rax and r15,rdi ror r14,28 add r12,r13 xor r10,r15 add rcx,r12 add r10,r12 lea rbp,QWORD PTR[24+rbp] add r10,r14 mov r12,QWORD PTR[16+rsi] mov r13,rcx mov r14,r10 bswap r12 ror r13,23 mov r15,rdx xor r13,rcx ror r14,5 xor r15,r8 mov QWORD PTR[16+rsp],r12 xor r14,r10 and r15,rcx ror r13,4 add r12,r9 xor r15,r8 ror r14,6 xor r13,rcx add r12,r15 mov r15,r10 add r12,QWORD PTR[rbp] xor r14,r10 xor r15,r11 ror r13,14 mov r9,r11 and rdi,r15 ror r14,28 add r12,r13 xor r9,rdi add rbx,r12 add r9,r12 lea rbp,QWORD PTR[8+rbp] add r9,r14 mov r12,QWORD PTR[24+rsi] mov r13,rbx mov r14,r9 bswap r12 ror r13,23 mov rdi,rcx xor r13,rbx ror r14,5 xor rdi,rdx mov QWORD PTR[24+rsp],r12 xor r14,r9 and rdi,rbx ror r13,4 add r12,r8 xor rdi,rdx ror r14,6 xor r13,rbx add r12,rdi mov rdi,r9 add r12,QWORD PTR[rbp] xor r14,r9 xor rdi,r10 ror r13,14 mov r8,r10 and r15,rdi ror r14,28 add r12,r13 xor r8,r15 add rax,r12 add r8,r12 lea rbp,QWORD PTR[24+rbp] add r8,r14 mov r12,QWORD PTR[32+rsi] mov r13,rax mov r14,r8 bswap r12 ror r13,23 mov r15,rbx xor r13,rax ror r14,5 xor r15,rcx mov QWORD PTR[32+rsp],r12 xor r14,r8 and r15,rax ror r13,4 add r12,rdx xor r15,rcx ror r14,6 xor r13,rax add r12,r15 mov r15,r8 add r12,QWORD PTR[rbp] xor r14,r8 xor r15,r9 ror r13,14 mov rdx,r9 and rdi,r15 ror r14,28 add r12,r13 xor rdx,rdi add r11,r12 add rdx,r12 lea rbp,QWORD PTR[8+rbp] add rdx,r14 mov r12,QWORD PTR[40+rsi] mov r13,r11 mov r14,rdx bswap r12 ror r13,23 mov rdi,rax xor r13,r11 ror r14,5 xor rdi,rbx mov QWORD PTR[40+rsp],r12 xor r14,rdx and rdi,r11 ror r13,4 add r12,rcx xor rdi,rbx ror r14,6 xor r13,r11 add r12,rdi mov rdi,rdx add r12,QWORD PTR[rbp] xor r14,rdx xor rdi,r8 ror r13,14 mov rcx,r8 and r15,rdi ror r14,28 add r12,r13 xor rcx,r15 add r10,r12 add rcx,r12 lea rbp,QWORD PTR[24+rbp] add rcx,r14 mov r12,QWORD PTR[48+rsi] mov r13,r10 mov r14,rcx bswap r12 ror r13,23 mov r15,r11 xor r13,r10 ror r14,5 xor r15,rax mov QWORD PTR[48+rsp],r12 xor r14,rcx and r15,r10 ror r13,4 add r12,rbx xor r15,rax ror r14,6 xor r13,r10 add r12,r15 mov r15,rcx add r12,QWORD PTR[rbp] xor r14,rcx xor r15,rdx ror r13,14 mov rbx,rdx and rdi,r15 ror r14,28 add r12,r13 xor rbx,rdi add r9,r12 add rbx,r12 lea rbp,QWORD PTR[8+rbp] add rbx,r14 mov r12,QWORD PTR[56+rsi] mov r13,r9 mov r14,rbx bswap r12 ror r13,23 mov rdi,r10 xor r13,r9 ror r14,5 xor rdi,r11 mov QWORD PTR[56+rsp],r12 xor r14,rbx and rdi,r9 ror r13,4 add r12,rax xor rdi,r11 ror r14,6 xor r13,r9 add r12,rdi mov rdi,rbx add r12,QWORD PTR[rbp] xor r14,rbx xor rdi,rcx ror r13,14 mov rax,rcx and r15,rdi ror r14,28 add r12,r13 xor rax,r15 add r8,r12 add rax,r12 lea rbp,QWORD PTR[24+rbp] add rax,r14 mov r12,QWORD PTR[64+rsi] mov r13,r8 mov r14,rax bswap r12 ror r13,23 mov r15,r9 xor r13,r8 ror r14,5 xor r15,r10 mov QWORD PTR[64+rsp],r12 xor r14,rax and r15,r8 ror r13,4 add r12,r11 xor r15,r10 ror r14,6 xor r13,r8 add r12,r15 mov r15,rax add r12,QWORD PTR[rbp] xor r14,rax xor r15,rbx ror r13,14 mov r11,rbx and rdi,r15 ror r14,28 add r12,r13 xor r11,rdi add rdx,r12 add r11,r12 lea rbp,QWORD PTR[8+rbp] add r11,r14 mov r12,QWORD PTR[72+rsi] mov r13,rdx mov r14,r11 bswap r12 ror r13,23 mov rdi,r8 xor r13,rdx ror r14,5 xor rdi,r9 mov QWORD PTR[72+rsp],r12 xor r14,r11 and rdi,rdx ror r13,4 add r12,r10 xor rdi,r9 ror r14,6 xor r13,rdx add r12,rdi mov rdi,r11 add r12,QWORD PTR[rbp] xor r14,r11 xor rdi,rax ror r13,14 mov r10,rax and r15,rdi ror r14,28 add r12,r13 xor r10,r15 add rcx,r12 add r10,r12 lea rbp,QWORD PTR[24+rbp] add r10,r14 mov r12,QWORD PTR[80+rsi] mov r13,rcx mov r14,r10 bswap r12 ror r13,23 mov r15,rdx xor r13,rcx ror r14,5 xor r15,r8 mov QWORD PTR[80+rsp],r12 xor r14,r10 and r15,rcx ror r13,4 add r12,r9 xor r15,r8 ror r14,6 xor r13,rcx add r12,r15 mov r15,r10 add r12,QWORD PTR[rbp] xor r14,r10 xor r15,r11 ror r13,14 mov r9,r11 and rdi,r15 ror r14,28 add r12,r13 xor r9,rdi add rbx,r12 add r9,r12 lea rbp,QWORD PTR[8+rbp] add r9,r14 mov r12,QWORD PTR[88+rsi] mov r13,rbx mov r14,r9 bswap r12 ror r13,23 mov rdi,rcx xor r13,rbx ror r14,5 xor rdi,rdx mov QWORD PTR[88+rsp],r12 xor r14,r9 and rdi,rbx ror r13,4 add r12,r8 xor rdi,rdx ror r14,6 xor r13,rbx add r12,rdi mov rdi,r9 add r12,QWORD PTR[rbp] xor r14,r9 xor rdi,r10 ror r13,14 mov r8,r10 and r15,rdi ror r14,28 add r12,r13 xor r8,r15 add rax,r12 add r8,r12 lea rbp,QWORD PTR[24+rbp] add r8,r14 mov r12,QWORD PTR[96+rsi] mov r13,rax mov r14,r8 bswap r12 ror r13,23 mov r15,rbx xor r13,rax ror r14,5 xor r15,rcx mov QWORD PTR[96+rsp],r12 xor r14,r8 and r15,rax ror r13,4 add r12,rdx xor r15,rcx ror r14,6 xor r13,rax add r12,r15 mov r15,r8 add r12,QWORD PTR[rbp] xor r14,r8 xor r15,r9 ror r13,14 mov rdx,r9 and rdi,r15 ror r14,28 add r12,r13 xor rdx,rdi add r11,r12 add rdx,r12 lea rbp,QWORD PTR[8+rbp] add rdx,r14 mov r12,QWORD PTR[104+rsi] mov r13,r11 mov r14,rdx bswap r12 ror r13,23 mov rdi,rax xor r13,r11 ror r14,5 xor rdi,rbx mov QWORD PTR[104+rsp],r12 xor r14,rdx and rdi,r11 ror r13,4 add r12,rcx xor rdi,rbx ror r14,6 xor r13,r11 add r12,rdi mov rdi,rdx add r12,QWORD PTR[rbp] xor r14,rdx xor rdi,r8 ror r13,14 mov rcx,r8 and r15,rdi ror r14,28 add r12,r13 xor rcx,r15 add r10,r12 add rcx,r12 lea rbp,QWORD PTR[24+rbp] add rcx,r14 mov r12,QWORD PTR[112+rsi] mov r13,r10 mov r14,rcx bswap r12 ror r13,23 mov r15,r11 xor r13,r10 ror r14,5 xor r15,rax mov QWORD PTR[112+rsp],r12 xor r14,rcx and r15,r10 ror r13,4 add r12,rbx xor r15,rax ror r14,6 xor r13,r10 add r12,r15 mov r15,rcx add r12,QWORD PTR[rbp] xor r14,rcx xor r15,rdx ror r13,14 mov rbx,rdx and rdi,r15 ror r14,28 add r12,r13 xor rbx,rdi add r9,r12 add rbx,r12 lea rbp,QWORD PTR[8+rbp] add rbx,r14 mov r12,QWORD PTR[120+rsi] mov r13,r9 mov r14,rbx bswap r12 ror r13,23 mov rdi,r10 xor r13,r9 ror r14,5 xor rdi,r11 mov QWORD PTR[120+rsp],r12 xor r14,rbx and rdi,r9 ror r13,4 add r12,rax xor rdi,r11 ror r14,6 xor r13,r9 add r12,rdi mov rdi,rbx add r12,QWORD PTR[rbp] xor r14,rbx xor rdi,rcx ror r13,14 mov rax,rcx and r15,rdi ror r14,28 add r12,r13 xor rax,r15 add r8,r12 add rax,r12 lea rbp,QWORD PTR[24+rbp] jmp $L$rounds_16_xx ALIGN 16 $L$rounds_16_xx:: mov r13,QWORD PTR[8+rsp] mov r15,QWORD PTR[112+rsp] mov r12,r13 ror r13,7 add rax,r14 mov r14,r15 ror r15,42 xor r13,r12 shr r12,7 ror r13,1 xor r15,r14 shr r14,6 ror r15,19 xor r12,r13 xor r15,r14 add r12,QWORD PTR[72+rsp] add r12,QWORD PTR[rsp] mov r13,r8 add r12,r15 mov r14,rax ror r13,23 mov r15,r9 xor r13,r8 ror r14,5 xor r15,r10 mov QWORD PTR[rsp],r12 xor r14,rax and r15,r8 ror r13,4 add r12,r11 xor r15,r10 ror r14,6 xor r13,r8 add r12,r15 mov r15,rax add r12,QWORD PTR[rbp] xor r14,rax xor r15,rbx ror r13,14 mov r11,rbx and rdi,r15 ror r14,28 add r12,r13 xor r11,rdi add rdx,r12 add r11,r12 lea rbp,QWORD PTR[8+rbp] mov r13,QWORD PTR[16+rsp] mov rdi,QWORD PTR[120+rsp] mov r12,r13 ror r13,7 add r11,r14 mov r14,rdi ror rdi,42 xor r13,r12 shr r12,7 ror r13,1 xor rdi,r14 shr r14,6 ror rdi,19 xor r12,r13 xor rdi,r14 add r12,QWORD PTR[80+rsp] add r12,QWORD PTR[8+rsp] mov r13,rdx add r12,rdi mov r14,r11 ror r13,23 mov rdi,r8 xor r13,rdx ror r14,5 xor rdi,r9 mov QWORD PTR[8+rsp],r12 xor r14,r11 and rdi,rdx ror r13,4 add r12,r10 xor rdi,r9 ror r14,6 xor r13,rdx add r12,rdi mov rdi,r11 add r12,QWORD PTR[rbp] xor r14,r11 xor rdi,rax ror r13,14 mov r10,rax and r15,rdi ror r14,28 add r12,r13 xor r10,r15 add rcx,r12 add r10,r12 lea rbp,QWORD PTR[24+rbp] mov r13,QWORD PTR[24+rsp] mov r15,QWORD PTR[rsp] mov r12,r13 ror r13,7 add r10,r14 mov r14,r15 ror r15,42 xor r13,r12 shr r12,7 ror r13,1 xor r15,r14 shr r14,6 ror r15,19 xor r12,r13 xor r15,r14 add r12,QWORD PTR[88+rsp] add r12,QWORD PTR[16+rsp] mov r13,rcx add r12,r15 mov r14,r10 ror r13,23 mov r15,rdx xor r13,rcx ror r14,5 xor r15,r8 mov QWORD PTR[16+rsp],r12 xor r14,r10 and r15,rcx ror r13,4 add r12,r9 xor r15,r8 ror r14,6 xor r13,rcx add r12,r15 mov r15,r10 add r12,QWORD PTR[rbp] xor r14,r10 xor r15,r11 ror r13,14 mov r9,r11 and rdi,r15 ror r14,28 add r12,r13 xor r9,rdi add rbx,r12 add r9,r12 lea rbp,QWORD PTR[8+rbp] mov r13,QWORD PTR[32+rsp] mov rdi,QWORD PTR[8+rsp] mov r12,r13 ror r13,7 add r9,r14 mov r14,rdi ror rdi,42 xor r13,r12 shr r12,7 ror r13,1 xor rdi,r14 shr r14,6 ror rdi,19 xor r12,r13 xor rdi,r14 add r12,QWORD PTR[96+rsp] add r12,QWORD PTR[24+rsp] mov r13,rbx add r12,rdi mov r14,r9 ror r13,23 mov rdi,rcx xor r13,rbx ror r14,5 xor rdi,rdx mov QWORD PTR[24+rsp],r12 xor r14,r9 and rdi,rbx ror r13,4 add r12,r8 xor rdi,rdx ror r14,6 xor r13,rbx add r12,rdi mov rdi,r9 add r12,QWORD PTR[rbp] xor r14,r9 xor rdi,r10 ror r13,14 mov r8,r10 and r15,rdi ror r14,28 add r12,r13 xor r8,r15 add rax,r12 add r8,r12 lea rbp,QWORD PTR[24+rbp] mov r13,QWORD PTR[40+rsp] mov r15,QWORD PTR[16+rsp] mov r12,r13 ror r13,7 add r8,r14 mov r14,r15 ror r15,42 xor r13,r12 shr r12,7 ror r13,1 xor r15,r14 shr r14,6 ror r15,19 xor r12,r13 xor r15,r14 add r12,QWORD PTR[104+rsp] add r12,QWORD PTR[32+rsp] mov r13,rax add r12,r15 mov r14,r8 ror r13,23 mov r15,rbx xor r13,rax ror r14,5 xor r15,rcx mov QWORD PTR[32+rsp],r12 xor r14,r8 and r15,rax ror r13,4 add r12,rdx xor r15,rcx ror r14,6 xor r13,rax add r12,r15 mov r15,r8 add r12,QWORD PTR[rbp] xor r14,r8 xor r15,r9 ror r13,14 mov rdx,r9 and rdi,r15 ror r14,28 add r12,r13 xor rdx,rdi add r11,r12 add rdx,r12 lea rbp,QWORD PTR[8+rbp] mov r13,QWORD PTR[48+rsp] mov rdi,QWORD PTR[24+rsp] mov r12,r13 ror r13,7 add rdx,r14 mov r14,rdi ror rdi,42 xor r13,r12 shr r12,7 ror r13,1 xor rdi,r14 shr r14,6 ror rdi,19 xor r12,r13 xor rdi,r14 add r12,QWORD PTR[112+rsp] add r12,QWORD PTR[40+rsp] mov r13,r11 add r12,rdi mov r14,rdx ror r13,23 mov rdi,rax xor r13,r11 ror r14,5 xor rdi,rbx mov QWORD PTR[40+rsp],r12 xor r14,rdx and rdi,r11 ror r13,4 add r12,rcx xor rdi,rbx ror r14,6 xor r13,r11 add r12,rdi mov rdi,rdx add r12,QWORD PTR[rbp] xor r14,rdx xor rdi,r8 ror r13,14 mov rcx,r8 and r15,rdi ror r14,28 add r12,r13 xor rcx,r15 add r10,r12 add rcx,r12 lea rbp,QWORD PTR[24+rbp] mov r13,QWORD PTR[56+rsp] mov r15,QWORD PTR[32+rsp] mov r12,r13 ror r13,7 add rcx,r14 mov r14,r15 ror r15,42 xor r13,r12 shr r12,7 ror r13,1 xor r15,r14 shr r14,6 ror r15,19 xor r12,r13 xor r15,r14 add r12,QWORD PTR[120+rsp] add r12,QWORD PTR[48+rsp] mov r13,r10 add r12,r15 mov r14,rcx ror r13,23 mov r15,r11 xor r13,r10 ror r14,5 xor r15,rax mov QWORD PTR[48+rsp],r12 xor r14,rcx and r15,r10 ror r13,4 add r12,rbx xor r15,rax ror r14,6 xor r13,r10 add r12,r15 mov r15,rcx add r12,QWORD PTR[rbp] xor r14,rcx xor r15,rdx ror r13,14 mov rbx,rdx and rdi,r15 ror r14,28 add r12,r13 xor rbx,rdi add r9,r12 add rbx,r12 lea rbp,QWORD PTR[8+rbp] mov r13,QWORD PTR[64+rsp] mov rdi,QWORD PTR[40+rsp] mov r12,r13 ror r13,7 add rbx,r14 mov r14,rdi ror rdi,42 xor r13,r12 shr r12,7 ror r13,1 xor rdi,r14 shr r14,6 ror rdi,19 xor r12,r13 xor rdi,r14 add r12,QWORD PTR[rsp] add r12,QWORD PTR[56+rsp] mov r13,r9 add r12,rdi mov r14,rbx ror r13,23 mov rdi,r10 xor r13,r9 ror r14,5 xor rdi,r11 mov QWORD PTR[56+rsp],r12 xor r14,rbx and rdi,r9 ror r13,4 add r12,rax xor rdi,r11 ror r14,6 xor r13,r9 add r12,rdi mov rdi,rbx add r12,QWORD PTR[rbp] xor r14,rbx xor rdi,rcx ror r13,14 mov rax,rcx and r15,rdi ror r14,28 add r12,r13 xor rax,r15 add r8,r12 add rax,r12 lea rbp,QWORD PTR[24+rbp] mov r13,QWORD PTR[72+rsp] mov r15,QWORD PTR[48+rsp] mov r12,r13 ror r13,7 add rax,r14 mov r14,r15 ror r15,42 xor r13,r12 shr r12,7 ror r13,1 xor r15,r14 shr r14,6 ror r15,19 xor r12,r13 xor r15,r14 add r12,QWORD PTR[8+rsp] add r12,QWORD PTR[64+rsp] mov r13,r8 add r12,r15 mov r14,rax ror r13,23 mov r15,r9 xor r13,r8 ror r14,5 xor r15,r10 mov QWORD PTR[64+rsp],r12 xor r14,rax and r15,r8 ror r13,4 add r12,r11 xor r15,r10 ror r14,6 xor r13,r8 add r12,r15 mov r15,rax add r12,QWORD PTR[rbp] xor r14,rax xor r15,rbx ror r13,14 mov r11,rbx and rdi,r15 ror r14,28 add r12,r13 xor r11,rdi add rdx,r12 add r11,r12 lea rbp,QWORD PTR[8+rbp] mov r13,QWORD PTR[80+rsp] mov rdi,QWORD PTR[56+rsp] mov r12,r13 ror r13,7 add r11,r14 mov r14,rdi ror rdi,42 xor r13,r12 shr r12,7 ror r13,1 xor rdi,r14 shr r14,6 ror rdi,19 xor r12,r13 xor rdi,r14 add r12,QWORD PTR[16+rsp] add r12,QWORD PTR[72+rsp] mov r13,rdx add r12,rdi mov r14,r11 ror r13,23 mov rdi,r8 xor r13,rdx ror r14,5 xor rdi,r9 mov QWORD PTR[72+rsp],r12 xor r14,r11 and rdi,rdx ror r13,4 add r12,r10 xor rdi,r9 ror r14,6 xor r13,rdx add r12,rdi mov rdi,r11 add r12,QWORD PTR[rbp] xor r14,r11 xor rdi,rax ror r13,14 mov r10,rax and r15,rdi ror r14,28 add r12,r13 xor r10,r15 add rcx,r12 add r10,r12 lea rbp,QWORD PTR[24+rbp] mov r13,QWORD PTR[88+rsp] mov r15,QWORD PTR[64+rsp] mov r12,r13 ror r13,7 add r10,r14 mov r14,r15 ror r15,42 xor r13,r12 shr r12,7 ror r13,1 xor r15,r14 shr r14,6 ror r15,19 xor r12,r13 xor r15,r14 add r12,QWORD PTR[24+rsp] add r12,QWORD PTR[80+rsp] mov r13,rcx add r12,r15 mov r14,r10 ror r13,23 mov r15,rdx xor r13,rcx ror r14,5 xor r15,r8 mov QWORD PTR[80+rsp],r12 xor r14,r10 and r15,rcx ror r13,4 add r12,r9 xor r15,r8 ror r14,6 xor r13,rcx add r12,r15 mov r15,r10 add r12,QWORD PTR[rbp] xor r14,r10 xor r15,r11 ror r13,14 mov r9,r11 and rdi,r15 ror r14,28 add r12,r13 xor r9,rdi add rbx,r12 add r9,r12 lea rbp,QWORD PTR[8+rbp] mov r13,QWORD PTR[96+rsp] mov rdi,QWORD PTR[72+rsp] mov r12,r13 ror r13,7 add r9,r14 mov r14,rdi ror rdi,42 xor r13,r12 shr r12,7 ror r13,1 xor rdi,r14 shr r14,6 ror rdi,19 xor r12,r13 xor rdi,r14 add r12,QWORD PTR[32+rsp] add r12,QWORD PTR[88+rsp] mov r13,rbx add r12,rdi mov r14,r9 ror r13,23 mov rdi,rcx xor r13,rbx ror r14,5 xor rdi,rdx mov QWORD PTR[88+rsp],r12 xor r14,r9 and rdi,rbx ror r13,4 add r12,r8 xor rdi,rdx ror r14,6 xor r13,rbx add r12,rdi mov rdi,r9 add r12,QWORD PTR[rbp] xor r14,r9 xor rdi,r10 ror r13,14 mov r8,r10 and r15,rdi ror r14,28 add r12,r13 xor r8,r15 add rax,r12 add r8,r12 lea rbp,QWORD PTR[24+rbp] mov r13,QWORD PTR[104+rsp] mov r15,QWORD PTR[80+rsp] mov r12,r13 ror r13,7 add r8,r14 mov r14,r15 ror r15,42 xor r13,r12 shr r12,7 ror r13,1 xor r15,r14 shr r14,6 ror r15,19 xor r12,r13 xor r15,r14 add r12,QWORD PTR[40+rsp] add r12,QWORD PTR[96+rsp] mov r13,rax add r12,r15 mov r14,r8 ror r13,23 mov r15,rbx xor r13,rax ror r14,5 xor r15,rcx mov QWORD PTR[96+rsp],r12 xor r14,r8 and r15,rax ror r13,4 add r12,rdx xor r15,rcx ror r14,6 xor r13,rax add r12,r15 mov r15,r8 add r12,QWORD PTR[rbp] xor r14,r8 xor r15,r9 ror r13,14 mov rdx,r9 and rdi,r15 ror r14,28 add r12,r13 xor rdx,rdi add r11,r12 add rdx,r12 lea rbp,QWORD PTR[8+rbp] mov r13,QWORD PTR[112+rsp] mov rdi,QWORD PTR[88+rsp] mov r12,r13 ror r13,7 add rdx,r14 mov r14,rdi ror rdi,42 xor r13,r12 shr r12,7 ror r13,1 xor rdi,r14 shr r14,6 ror rdi,19 xor r12,r13 xor rdi,r14 add r12,QWORD PTR[48+rsp] add r12,QWORD PTR[104+rsp] mov r13,r11 add r12,rdi mov r14,rdx ror r13,23 mov rdi,rax xor r13,r11 ror r14,5 xor rdi,rbx mov QWORD PTR[104+rsp],r12 xor r14,rdx and rdi,r11 ror r13,4 add r12,rcx xor rdi,rbx ror r14,6 xor r13,r11 add r12,rdi mov rdi,rdx add r12,QWORD PTR[rbp] xor r14,rdx xor rdi,r8 ror r13,14 mov rcx,r8 and r15,rdi ror r14,28 add r12,r13 xor rcx,r15 add r10,r12 add rcx,r12 lea rbp,QWORD PTR[24+rbp] mov r13,QWORD PTR[120+rsp] mov r15,QWORD PTR[96+rsp] mov r12,r13 ror r13,7 add rcx,r14 mov r14,r15 ror r15,42 xor r13,r12 shr r12,7 ror r13,1 xor r15,r14 shr r14,6 ror r15,19 xor r12,r13 xor r15,r14 add r12,QWORD PTR[56+rsp] add r12,QWORD PTR[112+rsp] mov r13,r10 add r12,r15 mov r14,rcx ror r13,23 mov r15,r11 xor r13,r10 ror r14,5 xor r15,rax mov QWORD PTR[112+rsp],r12 xor r14,rcx and r15,r10 ror r13,4 add r12,rbx xor r15,rax ror r14,6 xor r13,r10 add r12,r15 mov r15,rcx add r12,QWORD PTR[rbp] xor r14,rcx xor r15,rdx ror r13,14 mov rbx,rdx and rdi,r15 ror r14,28 add r12,r13 xor rbx,rdi add r9,r12 add rbx,r12 lea rbp,QWORD PTR[8+rbp] mov r13,QWORD PTR[rsp] mov rdi,QWORD PTR[104+rsp] mov r12,r13 ror r13,7 add rbx,r14 mov r14,rdi ror rdi,42 xor r13,r12 shr r12,7 ror r13,1 xor rdi,r14 shr r14,6 ror rdi,19 xor r12,r13 xor rdi,r14 add r12,QWORD PTR[64+rsp] add r12,QWORD PTR[120+rsp] mov r13,r9 add r12,rdi mov r14,rbx ror r13,23 mov rdi,r10 xor r13,r9 ror r14,5 xor rdi,r11 mov QWORD PTR[120+rsp],r12 xor r14,rbx and rdi,r9 ror r13,4 add r12,rax xor rdi,r11 ror r14,6 xor r13,r9 add r12,rdi mov rdi,rbx add r12,QWORD PTR[rbp] xor r14,rbx xor rdi,rcx ror r13,14 mov rax,rcx and r15,rdi ror r14,28 add r12,r13 xor rax,r15 add r8,r12 add rax,r12 lea rbp,QWORD PTR[24+rbp] cmp BYTE PTR[7+rbp],0 jnz $L$rounds_16_xx mov rdi,QWORD PTR[((128+0))+rsp] add rax,r14 lea rsi,QWORD PTR[128+rsi] add rax,QWORD PTR[rdi] add rbx,QWORD PTR[8+rdi] add rcx,QWORD PTR[16+rdi] add rdx,QWORD PTR[24+rdi] add r8,QWORD PTR[32+rdi] add r9,QWORD PTR[40+rdi] add r10,QWORD PTR[48+rdi] add r11,QWORD PTR[56+rdi] cmp rsi,QWORD PTR[((128+16))+rsp] mov QWORD PTR[rdi],rax mov QWORD PTR[8+rdi],rbx mov QWORD PTR[16+rdi],rcx mov QWORD PTR[24+rdi],rdx mov QWORD PTR[32+rdi],r8 mov QWORD PTR[40+rdi],r9 mov QWORD PTR[48+rdi],r10 mov QWORD PTR[56+rdi],r11 jb $L$loop mov rsi,QWORD PTR[((128+24))+rsp] mov r15,QWORD PTR[rsi] mov r14,QWORD PTR[8+rsi] mov r13,QWORD PTR[16+rsi] mov r12,QWORD PTR[24+rsi] mov rbp,QWORD PTR[32+rsi] mov rbx,QWORD PTR[40+rsi] lea rsp,QWORD PTR[48+rsi] $L$epilogue:: mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue mov rsi,QWORD PTR[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_sha512_block_data_order:: sha512_block_data_order ENDP ALIGN 64 K512:: DQ 0428a2f98d728ae22h,07137449123ef65cdh DQ 0428a2f98d728ae22h,07137449123ef65cdh DQ 0b5c0fbcfec4d3b2fh,0e9b5dba58189dbbch DQ 0b5c0fbcfec4d3b2fh,0e9b5dba58189dbbch DQ 03956c25bf348b538h,059f111f1b605d019h DQ 03956c25bf348b538h,059f111f1b605d019h DQ 0923f82a4af194f9bh,0ab1c5ed5da6d8118h DQ 0923f82a4af194f9bh,0ab1c5ed5da6d8118h DQ 0d807aa98a3030242h,012835b0145706fbeh DQ 0d807aa98a3030242h,012835b0145706fbeh DQ 0243185be4ee4b28ch,0550c7dc3d5ffb4e2h DQ 0243185be4ee4b28ch,0550c7dc3d5ffb4e2h DQ 072be5d74f27b896fh,080deb1fe3b1696b1h DQ 072be5d74f27b896fh,080deb1fe3b1696b1h DQ 09bdc06a725c71235h,0c19bf174cf692694h DQ 09bdc06a725c71235h,0c19bf174cf692694h DQ 0e49b69c19ef14ad2h,0efbe4786384f25e3h DQ 0e49b69c19ef14ad2h,0efbe4786384f25e3h DQ 00fc19dc68b8cd5b5h,0240ca1cc77ac9c65h DQ 00fc19dc68b8cd5b5h,0240ca1cc77ac9c65h DQ 02de92c6f592b0275h,04a7484aa6ea6e483h DQ 02de92c6f592b0275h,04a7484aa6ea6e483h DQ 05cb0a9dcbd41fbd4h,076f988da831153b5h DQ 05cb0a9dcbd41fbd4h,076f988da831153b5h DQ 0983e5152ee66dfabh,0a831c66d2db43210h DQ 0983e5152ee66dfabh,0a831c66d2db43210h DQ 0b00327c898fb213fh,0bf597fc7beef0ee4h DQ 0b00327c898fb213fh,0bf597fc7beef0ee4h DQ 0c6e00bf33da88fc2h,0d5a79147930aa725h DQ 0c6e00bf33da88fc2h,0d5a79147930aa725h DQ 006ca6351e003826fh,0142929670a0e6e70h DQ 006ca6351e003826fh,0142929670a0e6e70h DQ 027b70a8546d22ffch,02e1b21385c26c926h DQ 027b70a8546d22ffch,02e1b21385c26c926h DQ 04d2c6dfc5ac42aedh,053380d139d95b3dfh DQ 04d2c6dfc5ac42aedh,053380d139d95b3dfh DQ 0650a73548baf63deh,0766a0abb3c77b2a8h DQ 0650a73548baf63deh,0766a0abb3c77b2a8h DQ 081c2c92e47edaee6h,092722c851482353bh DQ 081c2c92e47edaee6h,092722c851482353bh DQ 0a2bfe8a14cf10364h,0a81a664bbc423001h DQ 0a2bfe8a14cf10364h,0a81a664bbc423001h DQ 0c24b8b70d0f89791h,0c76c51a30654be30h DQ 0c24b8b70d0f89791h,0c76c51a30654be30h DQ 0d192e819d6ef5218h,0d69906245565a910h DQ 0d192e819d6ef5218h,0d69906245565a910h DQ 0f40e35855771202ah,0106aa07032bbd1b8h DQ 0f40e35855771202ah,0106aa07032bbd1b8h DQ 019a4c116b8d2d0c8h,01e376c085141ab53h DQ 019a4c116b8d2d0c8h,01e376c085141ab53h DQ 02748774cdf8eeb99h,034b0bcb5e19b48a8h DQ 02748774cdf8eeb99h,034b0bcb5e19b48a8h DQ 0391c0cb3c5c95a63h,04ed8aa4ae3418acbh DQ 0391c0cb3c5c95a63h,04ed8aa4ae3418acbh DQ 05b9cca4f7763e373h,0682e6ff3d6b2b8a3h DQ 05b9cca4f7763e373h,0682e6ff3d6b2b8a3h DQ 0748f82ee5defb2fch,078a5636f43172f60h DQ 0748f82ee5defb2fch,078a5636f43172f60h DQ 084c87814a1f0ab72h,08cc702081a6439ech DQ 084c87814a1f0ab72h,08cc702081a6439ech DQ 090befffa23631e28h,0a4506cebde82bde9h DQ 090befffa23631e28h,0a4506cebde82bde9h DQ 0bef9a3f7b2c67915h,0c67178f2e372532bh DQ 0bef9a3f7b2c67915h,0c67178f2e372532bh DQ 0ca273eceea26619ch,0d186b8c721c0c207h DQ 0ca273eceea26619ch,0d186b8c721c0c207h DQ 0eada7dd6cde0eb1eh,0f57d4f7fee6ed178h DQ 0eada7dd6cde0eb1eh,0f57d4f7fee6ed178h DQ 006f067aa72176fbah,00a637dc5a2c898a6h DQ 006f067aa72176fbah,00a637dc5a2c898a6h DQ 0113f9804bef90daeh,01b710b35131c471bh DQ 0113f9804bef90daeh,01b710b35131c471bh DQ 028db77f523047d84h,032caab7b40c72493h DQ 028db77f523047d84h,032caab7b40c72493h DQ 03c9ebe0a15c9bebch,0431d67c49c100d4ch DQ 03c9ebe0a15c9bebch,0431d67c49c100d4ch DQ 04cc5d4becb3e42b6h,0597f299cfc657e2ah DQ 04cc5d4becb3e42b6h,0597f299cfc657e2ah DQ 05fcb6fab3ad6faech,06c44198c4a475817h DQ 05fcb6fab3ad6faech,06c44198c4a475817h DQ 00001020304050607h,008090a0b0c0d0e0fh DQ 00001020304050607h,008090a0b0c0d0e0fh DB 83,72,65,53,49,50,32,98,108,111,99,107,32,116,114,97 DB 110,115,102,111,114,109,32,102,111,114,32,120,56,54,95,54 DB 52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121 DB 32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46 DB 111,114,103,62,0 EXTERN __imp_RtlVirtualUnwind:NEAR ALIGN 16 se_handler PROC PRIVATE push rsi push rdi push rbx push rbp push r12 push r13 push r14 push r15 pushfq sub rsp,64 mov rax,QWORD PTR[120+r8] mov rbx,QWORD PTR[248+r8] mov rsi,QWORD PTR[8+r9] mov r11,QWORD PTR[56+r9] mov r10d,DWORD PTR[r11] lea r10,QWORD PTR[r10*1+rsi] cmp rbx,r10 jb $L$in_prologue mov rax,QWORD PTR[152+r8] mov r10d,DWORD PTR[4+r11] lea r10,QWORD PTR[r10*1+rsi] cmp rbx,r10 jae $L$in_prologue mov rsi,rax mov rax,QWORD PTR[((128+24))+rax] lea rax,QWORD PTR[48+rax] mov rbx,QWORD PTR[((-8))+rax] mov rbp,QWORD PTR[((-16))+rax] mov r12,QWORD PTR[((-24))+rax] mov r13,QWORD PTR[((-32))+rax] mov r14,QWORD PTR[((-40))+rax] mov r15,QWORD PTR[((-48))+rax] mov QWORD PTR[144+r8],rbx mov QWORD PTR[160+r8],rbp mov QWORD PTR[216+r8],r12 mov QWORD PTR[224+r8],r13 mov QWORD PTR[232+r8],r14 mov QWORD PTR[240+r8],r15 lea r10,QWORD PTR[$L$epilogue] cmp rbx,r10 jb $L$in_prologue lea rsi,QWORD PTR[((128+32))+rsi] lea rdi,QWORD PTR[512+r8] mov ecx,12 DD 0a548f3fch $L$in_prologue:: mov rdi,QWORD PTR[8+rax] mov rsi,QWORD PTR[16+rax] mov QWORD PTR[152+r8],rax mov QWORD PTR[168+r8],rsi mov QWORD PTR[176+r8],rdi mov rdi,QWORD PTR[40+r9] mov rsi,r8 mov ecx,154 DD 0a548f3fch mov rsi,r9 xor rcx,rcx mov rdx,QWORD PTR[8+rsi] mov r8,QWORD PTR[rsi] mov r9,QWORD PTR[16+rsi] mov r10,QWORD PTR[40+rsi] lea r11,QWORD PTR[56+rsi] lea r12,QWORD PTR[24+rsi] mov QWORD PTR[32+rsp],r10 mov QWORD PTR[40+rsp],r11 mov QWORD PTR[48+rsp],r12 mov QWORD PTR[56+rsp],rcx call QWORD PTR[__imp_RtlVirtualUnwind] mov eax,1 add rsp,64 popfq pop r15 pop r14 pop r13 pop r12 pop rbp pop rbx pop rdi pop rsi DB 0F3h,0C3h ;repret se_handler ENDP .text$ ENDS .pdata SEGMENT READONLY ALIGN(4) ALIGN 4 DD imagerel $L$SEH_begin_sha512_block_data_order DD imagerel $L$SEH_end_sha512_block_data_order DD imagerel $L$SEH_info_sha512_block_data_order .pdata ENDS .xdata SEGMENT READONLY ALIGN(8) ALIGN 8 $L$SEH_info_sha512_block_data_order:: DB 9,0,0,0 DD imagerel se_handler DD imagerel $L$prologue,imagerel $L$epilogue .xdata ENDS END
13.731975
61
0.709318
3d95c341eab43626256413a98f9ef474cf7b474d
44
asm
Assembly
examples/usecase_barrelfish/get_disp/extract-synth-mips.asm
Harvard-PRINCESS/Cassiopea-Release
3fc731463575e9cc6e614f2bcfd11215b7651b5f
[ "BSD-3-Clause" ]
null
null
null
examples/usecase_barrelfish/get_disp/extract-synth-mips.asm
Harvard-PRINCESS/Cassiopea-Release
3fc731463575e9cc6e614f2bcfd11215b7651b5f
[ "BSD-3-Clause" ]
null
null
null
examples/usecase_barrelfish/get_disp/extract-synth-mips.asm
Harvard-PRINCESS/Cassiopea-Release
3fc731463575e9cc6e614f2bcfd11215b7651b5f
[ "BSD-3-Clause" ]
null
null
null
lw $gp, 0($4) lw $gp, 0($gp) lw $gp, 8($gp)
11
14
0.454545
1b1217d0a60f78c16629642fa45ebaa742a7a7d7
274
asm
Assembly
libsrc/_DEVELOPMENT/alloc/malloc/c/sdcc_ix/heap_info_unlocked.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/_DEVELOPMENT/alloc/malloc/c/sdcc_ix/heap_info_unlocked.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/_DEVELOPMENT/alloc/malloc/c/sdcc_ix/heap_info_unlocked.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
; void heap_info_unlocked(void *heap, void *callback) SECTION code_alloc_malloc PUBLIC heap_info_unlocked EXTERN l0_heap_info_unlocked_callee heap_info_unlocked: pop af pop de pop bc push bc push de push af jp l0_heap_info_unlocked_callee
13.047619
53
0.748175
4c4a99ba5f120f78a25069af0dabd6bf6cb32fa5
341
asm
Assembly
programs/oeis/007/A007399.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/007/A007399.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/007/A007399.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A007399: Add 8, then reverse digits!. ; 0,8,61,96,401,904,219,722,37,54,26,43,15,32,4,21,92,1,9,71,97,501,905,319,723,137,541,945,359,763,177,581,985,399,704,217,522,35,34,24,23,13,12,2,1,9,71 mov $3,$0 mov $0,8 mov $2,$3 lpb $2 seq $0,4086 ; Read n backwards (referred to as R(n) in many sequences). add $0,8 sub $2,1 lpe sub $0,8
26.230769
154
0.651026
0fd7e1c7adfdc587c67c6546650becfd6b177611
1,296
asm
Assembly
asm/unittests/lda.asm
mslinklater/retrotools
962d7ed5cfea09f901919cef4ec1b240a0396e0c
[ "BSD-2-Clause" ]
7
2019-11-18T23:11:23.000Z
2022-02-01T14:12:17.000Z
asm/unittests/lda.asm
mslinklater/retrotools
962d7ed5cfea09f901919cef4ec1b240a0396e0c
[ "BSD-2-Clause" ]
70
2019-11-06T22:10:52.000Z
2022-02-19T09:49:03.000Z
asm/unittests/lda.asm
mslinklater/retrotools
962d7ed5cfea09f901919cef4ec1b240a0396e0c
[ "BSD-2-Clause" ]
1
2020-01-03T13:28:34.000Z
2020-01-03T13:28:34.000Z
; Assembler should use basic 6502 instructions processor 6502 ; Some zero page data org $0080 ZP_ZERO .byte $00 ZP_ONE .byte $01 ZP_TWO .byte $02 ZP_D0 .word DATA_ZERO ZP_D1 .word DATA_ONE ZP_D2 .word DATA_TWO ZP_D3 .word DATA_THREE ZP_DP .word PAGE_NEXT_ROOT ; Some non zero page data org $400 DATA_ZERO .byte $00 DATA_ONE .byte $01 DATA_TWO .byte $02 DATA_THREE .byte $03 .byte $04 org $5c0 PAGE_NEXT_ROOT .byte $00 org $610 PAGE_NEXT .byte $24 ; Some code org $1000 IMM_VALUE_NOFLAGS = $40 IMM_VALUE_ZEROFLAG = $00 IMM_VALUE_NEGFLAG = $80 Start_imm lda #IMM_VALUE_NOFLAGS brk Start_zero lda #IMM_VALUE_ZEROFLAG brk Start_neg lda #IMM_VALUE_NEGFLAG brk Start_zp lda ZP_ONE brk Start_zpx1 ldx #$ff lda ZP_ONE,x brk Start_zpx2 ldx #$01 lda ZP_ONE,x brk Start_abs lda DATA_ONE brk Start_absx1 ldx #$01 lda DATA_ONE,x brk Start_absx2 ldx #PAGE_NEXT-PAGE_NEXT_ROOT lda PAGE_NEXT_ROOT,x brk Start_absy1 ldy #$01 lda DATA_ONE,y brk Start_absy2 ldy #PAGE_NEXT-PAGE_NEXT_ROOT lda PAGE_NEXT_ROOT,y brk Start_indx ldx #ZP_D2-ZP_D0 lda (ZP_D0,x) brk Start_indy1 ldy #$01 lda (ZP_D3),y brk Start_indy2 ldy #PAGE_NEXT-PAGE_NEXT_ROOT lda (ZP_DP),y brk
11.571429
46
0.696759
a37cccc593e321a5686d4c28788082c05814a570
124,230
asm
Assembly
src/presets/kpdr21_data.asm
tewtal/sm_practice_hack
2e435012a4259035cb69b0d3bc90a221cb5de37d
[ "Unlicense" ]
15
2019-02-23T20:38:49.000Z
2022-02-18T01:14:04.000Z
src/presets/kpdr21_data.asm
tewtal/sm_practice_hack
2e435012a4259035cb69b0d3bc90a221cb5de37d
[ "Unlicense" ]
50
2019-03-06T22:02:17.000Z
2022-03-31T05:25:54.000Z
src/presets/kpdr21_data.asm
tewtal/sm_practice_hack
2e435012a4259035cb69b0d3bc90a221cb5de37d
[ "Unlicense" ]
20
2019-02-23T20:40:53.000Z
2022-02-22T17:44:45.000Z
preset_kpdr21_crateria_ship: dw #$0000 dl $7E078B : db $02 : dw $0000 ; Elevator Index dl $7E078D : db $02 : dw $88FE ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $91F8 ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E07F3 : db $02 : dw $0006 ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $03D0 ; Screen Y position in pixels dl $7E093F : db $02 : dw $0000 ; Ceres escape flag dl $7E09A2 : db $02 : dw $0000 ; Equipped Items dl $7E09A4 : db $02 : dw $0000 ; Collected Items dl $7E09A6 : db $02 : dw $0000 ; Beams dl $7E09A8 : db $02 : dw $0000 ; Beams dl $7E09C0 : db $02 : dw $0000 ; Manual/Auto reserve tank dl $7E09C2 : db $02 : dw $0063 ; Health dl $7E09C4 : db $02 : dw $0063 ; Max helath dl $7E09C6 : db $02 : dw $0000 ; Missiles dl $7E09C8 : db $02 : dw $0000 ; Max missiles dl $7E09CA : db $02 : dw $0000 ; Supers dl $7E09CC : db $02 : dw $0000 ; Max supers dl $7E09CE : db $02 : dw $0000 ; Pbs dl $7E09D0 : db $02 : dw $0000 ; Max pbs dl $7E09D2 : db $02 : dw $0000 ; Currently selected item dl $7E09D4 : db $02 : dw $0000 ; Max reserves dl $7E09D6 : db $02 : dw $0000 ; Reserves dl $7E0A1C : db $02 : dw $0000 ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0A68 : db $02 : dw $0000 ; Flash suit dl $7E0A76 : db $02 : dw $0000 ; Hyper beam dl $7E0AF6 : db $02 : dw $0481 ; Samus X dl $7E0AFA : db $02 : dw $0440 ; Samus Y dl $7E0B3F : db $02 : dw $0000 ; Blue suit dl $7ED7C0 : db $02 : dw $0000 ; SRAM copy dl $7ED7C2 : db $02 : dw $0000 ; SRAM copy dl $7ED7C4 : db $02 : dw $0000 ; SRAM copy dl $7ED7C6 : db $02 : dw $0000 ; SRAM copy dl $7ED7C8 : db $02 : dw $0800 ; SRAM copy dl $7ED7CA : db $02 : dw $0400 ; SRAM copy dl $7ED7CC : db $02 : dw $0200 ; SRAM copy dl $7ED7CE : db $02 : dw $0100 ; SRAM copy dl $7ED7D0 : db $02 : dw $4000 ; SRAM copy dl $7ED7D2 : db $02 : dw $0080 ; SRAM copy dl $7ED7D4 : db $02 : dw $8000 ; SRAM copy dl $7ED7D6 : db $02 : dw $0040 ; SRAM copy dl $7ED7D8 : db $02 : dw $2000 ; SRAM copy dl $7ED7DA : db $02 : dw $0020 ; SRAM copy dl $7ED7DC : db $02 : dw $0010 ; SRAM copy dl $7ED7DE : db $02 : dw $0000 ; SRAM copy dl $7ED7E0 : db $02 : dw $0063 ; SRAM copy dl $7ED7E2 : db $02 : dw $0063 ; SRAM copy dl $7ED7E4 : db $02 : dw $0000 ; SRAM copy dl $7ED7E6 : db $02 : dw $0000 ; SRAM copy dl $7ED7E8 : db $02 : dw $0000 ; SRAM copy dl $7ED7EA : db $02 : dw $0000 ; SRAM copy dl $7ED7EC : db $02 : dw $0000 ; SRAM copy dl $7ED7EE : db $02 : dw $0000 ; SRAM copy dl $7ED7F0 : db $02 : dw $0000 ; SRAM copy dl $7ED7F2 : db $02 : dw $0000 ; SRAM copy dl $7ED7F4 : db $02 : dw $0000 ; SRAM copy dl $7ED7F6 : db $02 : dw $0000 ; SRAM copy dl $7ED7F8 : db $02 : dw $0026 ; SRAM copy dl $7ED7FA : db $02 : dw $0006 ; SRAM copy dl $7ED7FC : db $02 : dw $0001 ; SRAM copy dl $7ED7FE : db $02 : dw $0000 ; SRAM copy dl $7ED800 : db $02 : dw $0000 ; SRAM copy dl $7ED802 : db $02 : dw $0000 ; SRAM copy dl $7ED804 : db $02 : dw $0001 ; SRAM copy dl $7ED806 : db $02 : dw $0001 ; SRAM copy dl $7ED808 : db $02 : dw $0000 ; SRAM copy dl $7ED80A : db $02 : dw $0000 ; SRAM copy dl $7ED80C : db $02 : dw $0000 ; SRAM copy dl $7ED80E : db $02 : dw $0000 ; SRAM copy dl $7ED810 : db $02 : dw $0000 ; SRAM copy dl $7ED812 : db $02 : dw $0000 ; SRAM copy dl $7ED814 : db $02 : dw $0000 ; SRAM copy dl $7ED816 : db $02 : dw $0000 ; SRAM copy dl $7ED818 : db $02 : dw $0000 ; SRAM copy dl $7ED81A : db $02 : dw $0000 ; SRAM copy dl $7ED81C : db $02 : dw $0000 ; SRAM copy dl $7ED81E : db $02 : dw $0000 ; SRAM copy dl $7ED820 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED822 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED824 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED826 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED828 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED82A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED82C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED82E : db $02 : dw $0001 ; Events, Items, Doors dl $7ED830 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED832 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED834 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED836 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED838 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED83A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED83C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED83E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED840 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED842 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED844 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED846 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED848 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED84A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED84C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED84E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED850 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED852 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED854 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED856 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED858 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED85A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED85C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED85E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED860 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED862 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED864 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED866 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED868 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED86A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED86C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED86E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED870 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED872 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED874 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED876 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED878 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED87A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED87C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED87E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED880 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED882 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED884 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED886 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED888 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED88A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED88C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED88E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED890 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED892 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED894 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED896 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED898 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED89A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED89C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED89E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8A0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8A2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8A4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8A6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8A8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8AA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8AC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8AE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8B0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8B2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8B4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8B6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8B8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8BA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8BC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8BE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8C0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8C2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8C4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8C6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8C8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8CA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8CC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8CE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8D0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8D2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8D4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8D6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8D8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8DA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8DC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8DE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8E0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8E2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8E4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8E6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8E8 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8EA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8EC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8EE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8F0 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8F2 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8F4 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8F6 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8F8 : db $02 : dw $0001 ; Events, Items, Doors dl $7ED8FA : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8FC : db $02 : dw $0000 ; Events, Items, Doors dl $7ED8FE : db $02 : dw $0000 ; Events, Items, Doors dl $7ED900 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED902 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED904 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED906 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED908 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED90A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED90C : db $02 : dw $0000 ; Events, Items, Doors dl $7ED90E : db $02 : dw $0000 ; Events, Items, Doors dl $7ED910 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED912 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED914 : db $02 : dw $0005 ; Events, Items, Doors dl $7ED916 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED918 : db $02 : dw $0000 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0000 ; Events, Items, Doors dl $7ED91C : db $02 : dw $1010 ; Events, Items, Doors dl $7ED91E : db $02 : dw $0000 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_crateria_parlor: dw #preset_kpdr21_crateria_ship ; Crateria: Ship dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $1400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0400 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0079 ; Samus X dl $7E0AFA : db $02 : dw $049B ; Samus Y dw #$FFFF .after preset_kpdr21_crateria_parlor_downback: dw #preset_kpdr21_crateria_parlor ; Crateria: Parlor dl $7E078D : db $02 : dw $8916 ; DDB dl $7E079B : db $02 : dw $92FD ; MDB dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $02E9 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $01A7 ; Samus X dl $7E0AFA : db $02 : dw $035B ; Samus Y dw #$FFFF .after preset_kpdr21_crateria_climb_down: dw #preset_kpdr21_crateria_parlor_downback ; Crateria: Parlor Downback dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $4000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $041F ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $01A8 ; Samus X dl $7E0AFA : db $02 : dw $04BB ; Samus Y dw #$FFFF .after preset_kpdr21_crateria_pit_room: dw #preset_kpdr21_crateria_climb_down ; Crateria: Climb Down dl $7E078D : db $02 : dw $898E ; DDB dl $7E078F : db $02 : dw $0004 ; DoorOut Index dl $7E079B : db $02 : dw $96BA ; MDB dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $15BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B0 ; GFX Pointers dl $7E090F : db $02 : dw $6FFF ; Screen subpixel X position. dl $7E0913 : db $02 : dw $3800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0800 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $01DB ; Samus X dl $7E0AFA : db $02 : dw $088B ; Samus Y dw #$FFFF .after preset_kpdr21_crateria_morph: dw #preset_kpdr21_crateria_pit_room ; Crateria: Pit Room dl $7E078D : db $02 : dw $8B9E ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $9E9F ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers dl $7E07F5 : db $02 : dw $0007 ; Music Track dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0000 ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0580 ; Samus X dl $7E0AFA : db $02 : dw $02A8 ; Samus Y dl $7ED91A : db $02 : dw $0001 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_crateria_construction_zone: dw #preset_kpdr21_crateria_morph ; Crateria: Morph dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0700 ; Screen X position in pixels dl $7E0913 : db $02 : dw $E400 ; Screen subpixel Y position dl $7E09A2 : db $02 : dw $0004 ; Equipped Items dl $7E09A4 : db $02 : dw $0004 ; Collected Items dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $07AC ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED872 : db $02 : dw $0400 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_crateria_construction_zone_revisit: dw #preset_kpdr21_crateria_construction_zone ; Crateria: Construction Zone dl $7E078D : db $02 : dw $8EDA ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $A107 ; MDB dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $6800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0005 ; Missiles dl $7E09C8 : db $02 : dw $0005 ; Max missiles dl $7E0AF6 : db $02 : dw $0055 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED874 : db $02 : dw $0004 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0002 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_crateria_pit_room_revisit: dw #preset_kpdr21_crateria_construction_zone_revisit ; Crateria: Construction Zone Revisit dl $7E078D : db $02 : dw $8EB6 ; DDB dl $7E079B : db $02 : dw $97B5 ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0A1C : db $02 : dw $0000 ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0080 ; Samus X dl $7E0AFA : db $02 : dw $0088 ; Samus Y dl $7ED91A : db $02 : dw $0003 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_crateria_climb_up: dw #preset_kpdr21_crateria_pit_room_revisit ; Crateria: Pit Room Revisit dl $7E078D : db $02 : dw $8B92 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $975C ; MDB dl $7E07F3 : db $02 : dw $0009 ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0083 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED820 : db $02 : dw $0001 ; Events, Items, Doors dl $7ED8B2 : db $02 : dw $0400 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0004 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_crateria_parlor_revisit: dw #preset_kpdr21_crateria_climb_up ; Crateria: Climb Up dl $7E078D : db $02 : dw $8B7A ; DDB dl $7E079B : db $02 : dw $96BA ; MDB dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $C000 ; Screen subpixel Y position dl $7E0AF6 : db $02 : dw $01A0 ; Samus X dl $7E0AFA : db $02 : dw $005B ; Samus Y dw #$FFFF .after preset_kpdr21_crateria_flyway: dw #preset_kpdr21_crateria_parlor_revisit ; Crateria: Parlor Revisit dl $7E078D : db $02 : dw $8B3E ; DDB dl $7E079B : db $02 : dw $92FD ; MDB dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels dl $7E0913 : db $02 : dw $2BFF ; Screen subpixel Y position dl $7E0915 : db $02 : dw $01E6 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $0369 ; Samus X dl $7E0AFA : db $02 : dw $026B ; Samus Y dw #$FFFF .after preset_kpdr21_crateria_bomb_torizo: dw #preset_kpdr21_crateria_flyway ; Crateria: Flyway dl $7E078D : db $02 : dw $8982 ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $9879 ; MDB dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $D000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0000 ; Missiles dl $7E0AF6 : db $02 : dw $02BE ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8B2 : db $02 : dw $2400 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_crateria_alcatraz: dw #preset_kpdr21_crateria_bomb_torizo ; Crateria: Bomb Torizo dl $7E078D : db $02 : dw $8BAA ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E090F : db $02 : dw $2001 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E09A2 : db $02 : dw $1004 ; Equipped Items dl $7E09A4 : db $02 : dw $1004 ; Collected Items dl $7E09C6 : db $02 : dw $0005 ; Missiles dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0040 ; Samus X dl $7ED828 : db $02 : dw $0004 ; Events, Items, Doors dl $7ED870 : db $02 : dw $0080 ; Events, Items, Doors dl $7ED8B2 : db $02 : dw $2C00 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0005 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_crateria_terminator: dw #preset_kpdr21_crateria_alcatraz ; Crateria: Alcatraz dl $7E078D : db $02 : dw $8BB6 ; DDB dl $7E079B : db $02 : dw $92FD ; MDB dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E090F : db $02 : dw $F400 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $8800 ; Screen subpixel Y position dl $7E0AF6 : db $02 : dw $0115 ; Samus X dl $7E0B3F : db $02 : dw $0104 ; Blue suit dw #$FFFF .after preset_kpdr21_crateria_green_pirate_shaft: dw #preset_kpdr21_crateria_terminator ; Crateria: Terminator dl $7E078D : db $02 : dw $895E ; DDB dl $7E079B : db $02 : dw $990D ; MDB dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E090F : db $02 : dw $9F00 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $01FC ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00C7 ; Health dl $7E09C4 : db $02 : dw $00C7 ; Max helath dl $7E0AF6 : db $02 : dw $0063 ; Samus X dl $7E0AFA : db $02 : dw $029B ; Samus Y dl $7E0B3F : db $02 : dw $0000 ; Blue suit dl $7ED870 : db $02 : dw $0180 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0006 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_green_brinstar_elevator: dw #preset_kpdr21_crateria_green_pirate_shaft ; Crateria: Green Pirate Shaft dl $7E078D : db $02 : dw $8C22 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $9938 ; MDB dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $C400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $008B ; Health dl $7E0AF6 : db $02 : dw $007E ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED91A : db $02 : dw $0008 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_early_supers: dw #preset_kpdr21_brinstar_green_brinstar_elevator ; Brinstar: Green Brinstar Elevator dl $7E078D : db $02 : dw $8C0A ; DDB dl $7E078F : db $02 : dw $0009 ; DoorOut Index dl $7E079B : db $02 : dw $9AD9 ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers dl $7E07F3 : db $02 : dw $000F ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $041B ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0000 ; Missiles dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $00A5 ; Samus X dl $7E0AFA : db $02 : dw $048B ; Samus Y dl $7ED8B4 : db $02 : dw $0002 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0009 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_dachora_room: dw #preset_kpdr21_brinstar_early_supers ; Brinstar: Early Supers dl $7E078D : db $02 : dw $8D4E ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position. dl $7E0915 : db $02 : dw $061B ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0081 ; Health dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E09CC : db $02 : dw $0005 ; Max supers dl $7E0AF6 : db $02 : dw $0057 ; Samus X dl $7E0AFA : db $02 : dw $068B ; Samus Y dl $7ED872 : db $02 : dw $0401 ; Events, Items, Doors dl $7ED8B4 : db $02 : dw $0006 ; Events, Items, Doors dl $7ED91A : db $02 : dw $000C ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_big_pink: dw #preset_kpdr21_brinstar_dachora_room ; Brinstar: Dachora Room dl $7E078D : db $02 : dw $8CE2 ; DDB dl $7E078F : db $02 : dw $0005 ; DoorOut Index dl $7E079B : db $02 : dw $9CB3 ; MDB dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0600 ; Screen X position in pixels dl $7E0913 : db $02 : dw $8000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0002 ; Missiles dl $7E0AF6 : db $02 : dw $069C ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_brinstar_green_hill_zone: dw #preset_kpdr21_brinstar_big_pink ; Brinstar: Big Pink dl $7E078D : db $02 : dw $8DAE ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $9D19 ; MDB dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels dl $7E0913 : db $02 : dw $8C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0611 ; Screen Y position in pixels dl $7E09A6 : db $02 : dw $1000 ; Beams dl $7E09A8 : db $02 : dw $1000 ; Beams dl $7E09C6 : db $02 : dw $0007 ; Missiles dl $7E09C8 : db $02 : dw $000A ; Max missiles dl $7E09CA : db $02 : dw $0003 ; Supers dl $7E0AF6 : db $02 : dw $0365 ; Samus X dl $7E0AFA : db $02 : dw $068B ; Samus Y dl $7ED872 : db $02 : dw $04C1 ; Events, Items, Doors dl $7ED8B4 : db $02 : dw $0206 ; Events, Items, Doors dl $7ED91A : db $02 : dw $000F ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_noob_bridge: dw #preset_kpdr21_brinstar_green_hill_zone ; Brinstar: Green Hill Zone dl $7E078D : db $02 : dw $8DEA ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $9E52 ; MDB dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0700 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0077 ; Health dl $7E0AF6 : db $02 : dw $07B9 ; Samus X dl $7E0AFA : db $02 : dw $038B ; Samus Y dl $7ED91A : db $02 : dw $0010 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_red_tower: dw #preset_kpdr21_brinstar_noob_bridge ; Brinstar: Noob Bridge dl $7E078D : db $02 : dw $8E92 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $9FBA ; MDB dl $7E0911 : db $02 : dw $0482 ; Screen X position in pixels dl $7E0913 : db $02 : dw $E000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E0AF6 : db $02 : dw $0522 ; Samus X dl $7E0AFA : db $02 : dw $00AB ; Samus Y dl $7ED8B6 : db $02 : dw $0008 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_skree_boost: dw #preset_kpdr21_brinstar_red_tower ; Brinstar: Red Tower dl $7E078D : db $02 : dw $8F0A ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A253 ; MDB dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E090F : db $02 : dw $3001 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $091A ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $0056 ; Samus X dl $7E0AFA : db $02 : dw $098B ; Samus Y dw #$FFFF .after preset_kpdr21_brinstar_below_spazer: dw #preset_kpdr21_brinstar_skree_boost ; Brinstar: Skree Boost dl $7E078D : db $02 : dw $9042 ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $A3DD ; MDB dl $7E090F : db $02 : dw $2FFF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $006D ; Health dl $7E0AF6 : db $02 : dw $01DC ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_brinstar_entering_kraids_lair: dw #preset_kpdr21_brinstar_below_spazer ; Brinstar: Below Spazer dl $7E078D : db $02 : dw $A348 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $CF80 ; MDB dl $7E079F : db $02 : dw $0004 ; Region dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0006 ; Missiles dl $7E09CA : db $02 : dw $0005 ; Supers dl $7E0AF6 : db $02 : dw $002E ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dw #$FFFF .after preset_kpdr21_brinstar_kraid_kihunters: dw #preset_kpdr21_brinstar_entering_kraids_lair ; Brinstar: Entering Kraids Lair dl $7E078D : db $02 : dw $923A ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A471 ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $8000 ; Screen subpixel Y position dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E0AF6 : db $02 : dw $0167 ; Samus X dw #$FFFF .after preset_kpdr21_brinstar_mini_kraid: dw #preset_kpdr21_brinstar_kraid_kihunters ; Brinstar: Kraid Kihunters dl $7E078D : db $02 : dw $9156 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $A4DA ; MDB dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $FC00 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $0059 ; Health dl $7E0AF6 : db $02 : dw $016B ; Samus X dl $7ED91A : db $02 : dw $0011 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_kraid: dw #preset_kpdr21_brinstar_mini_kraid ; Brinstar: Mini Kraid dl $7E078D : db $02 : dw $919E ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A56B ; MDB dl $7E07F3 : db $02 : dw $0027 ; Music Bank dl $7E07F5 : db $02 : dw $0006 ; Music Track dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0800 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $0043 ; Health dl $7E09C6 : db $02 : dw $0005 ; Missiles dl $7E0AF6 : db $02 : dw $01C1 ; Samus X dl $7ED8B8 : db $02 : dw $0024 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_leaving_varia: dw #preset_kpdr21_brinstar_kraid ; Brinstar: Kraid dl $7E078D : db $02 : dw $91DA ; DDB dl $7E079B : db $02 : dw $A6E2 ; MDB dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $5800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09A2 : db $02 : dw $1005 ; Equipped Items dl $7E09A4 : db $02 : dw $1005 ; Collected Items dl $7E09C2 : db $02 : dw $0084 ; Health dl $7E09C6 : db $02 : dw $0007 ; Missiles dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0078 ; Samus X dl $7E0AFA : db $02 : dw $0088 ; Samus Y dl $7ED828 : db $02 : dw $0104 ; Events, Items, Doors dl $7ED876 : db $02 : dw $0001 ; Events, Items, Doors dl $7ED8B8 : db $02 : dw $0064 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0012 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_mini_kraid_revisit: dw #preset_kpdr21_brinstar_leaving_varia ; Brinstar: Leaving Varia dl $7E078D : db $02 : dw $91CE ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $A56B ; MDB dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $7800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $007C ; Health dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0058 ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED8B8 : db $02 : dw $00E4 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_kraid_kihunters_revisit: dw #preset_kpdr21_brinstar_mini_kraid_revisit ; Brinstar: Mini Kraid Revisit dl $7E078D : db $02 : dw $91AA ; DDB dl $7E079B : db $02 : dw $A521 ; MDB dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $4000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0004 ; Missiles dl $7E09CA : db $02 : dw $0005 ; Supers dl $7E0AF6 : db $02 : dw $009A ; Samus X dl $7E0AFA : db $02 : dw $00AB ; Samus Y dl $7ED8B8 : db $02 : dw $00EC ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_brinstar_kraid_etank: dw #preset_kpdr21_brinstar_kraid_kihunters_revisit ; Brinstar: Kraid Kihunters Revisit dl $7E078D : db $02 : dw $916E ; DDB dl $7E079B : db $02 : dw $A471 ; MDB dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $D400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $0051 ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED8B8 : db $02 : dw $00ED ; Events, Items, Doors dl $7ED91A : db $02 : dw $0013 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_business_center: dw #preset_kpdr21_brinstar_kraid_etank ; Brinstar: Kraid E-tank dl $7E078D : db $02 : dw $9246 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $A7DE ; MDB dl $7E079F : db $02 : dw $0002 ; Region dl $7E07C3 : db $02 : dw $C3F9 ; GFX Pointers dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers dl $7E07F3 : db $02 : dw $0015 ; Music Bank dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0238 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0006 ; Missiles dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0080 ; Samus X dl $7E0AFA : db $02 : dw $02A8 ; Samus Y dw #$FFFF .after preset_kpdr21_upper_norfair_hi_jump_etank: dw #preset_kpdr21_upper_norfair_business_center ; Upper Norfair: Business Center dl $7E078F : db $02 : dw $0005 ; DoorOut Index dl $7E090F : db $02 : dw $EFFF ; Screen subpixel X position. dl $7E0915 : db $02 : dw $051B ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0003 ; Supers dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0041 ; Samus X dl $7E0AFA : db $02 : dw $058B ; Samus Y dl $7ED8B8 : db $02 : dw $20ED ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_leaving_hi_jump: dw #preset_kpdr21_upper_norfair_hi_jump_etank ; Upper Norfair: Hi Jump E-tank dl $7E078D : db $02 : dw $9426 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A9E5 ; MDB dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $1FFF ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09A2 : db $02 : dw $1105 ; Equipped Items dl $7E09A4 : db $02 : dw $1105 ; Collected Items dl $7E09C2 : db $02 : dw $012B ; Health dl $7E09C4 : db $02 : dw $012B ; Max helath dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $00B5 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED876 : db $02 : dw $0121 ; Events, Items, Doors dl $7ED8BA : db $02 : dw $0001 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0016 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_business_center_2: dw #preset_kpdr21_upper_norfair_leaving_hi_jump ; Upper Norfair: Leaving Hi Jump dl $7E078D : db $02 : dw $93F6 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $AA41 ; MDB dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $E400 ; Screen subpixel Y position dl $7E09C6 : db $02 : dw $000B ; Missiles dl $7E09C8 : db $02 : dw $000F ; Max missiles dl $7E0AF6 : db $02 : dw $019C ; Samus X dl $7ED876 : db $02 : dw $01A1 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0018 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_precathedral: dw #preset_kpdr21_upper_norfair_business_center_2 ; Upper Norfair: Business Center 2 dl $7E078D : db $02 : dw $941A ; DDB dl $7E079B : db $02 : dw $A7DE ; MDB dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $53FE ; Screen subpixel Y position dl $7E0915 : db $02 : dw $02F8 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $00A5 ; Samus X dl $7E0AFA : db $02 : dw $038B ; Samus Y dw #$FFFF .after preset_kpdr21_upper_norfair_cathedral: dw #preset_kpdr21_upper_norfair_precathedral ; Upper Norfair: Pre-Cathedral dl $7E078D : db $02 : dw $92CA ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A7B3 ; MDB dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $F400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0009 ; Missiles dl $7E09CA : db $02 : dw $0002 ; Supers dl $7E0AF6 : db $02 : dw $02A6 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8B8 : db $02 : dw $24ED ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_rising_tide: dw #preset_kpdr21_upper_norfair_cathedral ; Upper Norfair: Cathedral dl $7E078D : db $02 : dw $92B2 ; DDB dl $7E079B : db $02 : dw $A788 ; MDB dl $7E090F : db $02 : dw $7FFF ; Screen subpixel X position. dl $7E0913 : db $02 : dw $2800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0001 ; Supers dl $7E0AF6 : db $02 : dw $02BB ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED8B8 : db $02 : dw $26ED ; Events, Items, Doors dl $7ED91A : db $02 : dw $0019 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_bubble_mountain: dw #preset_kpdr21_upper_norfair_rising_tide ; Upper Norfair: Rising Tide dl $7E078D : db $02 : dw $929A ; DDB dl $7E079B : db $02 : dw $AFA3 ; MDB dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0115 ; Health dl $7E0AF6 : db $02 : dw $04AD ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_upper_norfair_bat_cave: dw #preset_kpdr21_upper_norfair_bubble_mountain ; Upper Norfair: Bubble Mountain dl $7E078D : db $02 : dw $973E ; DDB dl $7E079B : db $02 : dw $ACB3 ; MDB dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $2000 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $0110 ; Health dl $7E09C6 : db $02 : dw $0008 ; Missiles dl $7E0AF6 : db $02 : dw $01C2 ; Samus X dl $7ED8BA : db $02 : dw $0011 ; Events, Items, Doors dl $7ED91A : db $02 : dw $001A ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_single_chamber: dw #preset_kpdr21_upper_norfair_bat_cave ; Upper Norfair: Bat Cave dl $7E078D : db $02 : dw $97AA ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E090F : db $02 : dw $BFFF ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0104 ; Screen Y position in pixels dl $7E09A2 : db $02 : dw $3105 ; Equipped Items dl $7E09A4 : db $02 : dw $3105 ; Collected Items dl $7E09C2 : db $02 : dw $0126 ; Health dl $7E09C6 : db $02 : dw $000F ; Missiles dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E0AF6 : db $02 : dw $01AD ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED822 : db $02 : dw $0020 ; Events, Items, Doors dl $7ED878 : db $02 : dw $0004 ; Events, Items, Doors dl $7ED8BA : db $02 : dw $0031 ; Events, Items, Doors dl $7ED91A : db $02 : dw $001E ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_double_chamber: dw #preset_kpdr21_upper_norfair_single_chamber ; Upper Norfair: Single Chamber dl $7E078D : db $02 : dw $9582 ; DDB dl $7E078F : db $02 : dw $0004 ; DoorOut Index dl $7E079B : db $02 : dw $AD5E ; MDB dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $A400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $011C ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0008 ; Missiles dl $7E0AF6 : db $02 : dw $00BE ; Samus X dl $7ED8BA : db $02 : dw $0071 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_double_chamber_revisit: dw #preset_kpdr21_upper_norfair_double_chamber ; Upper Norfair: Double Chamber dl $7E078D : db $02 : dw $961E ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $ADDE ; MDB dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $7800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09A6 : db $02 : dw $1001 ; Beams dl $7E09A8 : db $02 : dw $1001 ; Beams dl $7E09C6 : db $02 : dw $000D ; Missiles dl $7E09C8 : db $02 : dw $0014 ; Max missiles dl $7E09CA : db $02 : dw $0003 ; Supers dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0051 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED878 : db $02 : dw $001C ; Events, Items, Doors dl $7ED8BA : db $02 : dw $00F1 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0020 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_single_chamber_revisit: dw #preset_kpdr21_upper_norfair_double_chamber_revisit ; Upper Norfair: Double Chamber Revisit dl $7E078D : db $02 : dw $962A ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $ADAD ; MDB dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $6000 ; Screen subpixel Y position dl $7E0AF6 : db $02 : dw $0050 ; Samus X dl $7ED91A : db $02 : dw $0021 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_bubble_mountain_revisit: dw #preset_kpdr21_upper_norfair_single_chamber_revisit ; Upper Norfair: Single Chamber Revisit dl $7E078D : db $02 : dw $9606 ; DDB dl $7E079B : db $02 : dw $AD5E ; MDB dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $EC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0002 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $008F ; Samus X dw #$FFFF .after preset_kpdr21_upper_norfair_frog_speedway: dw #preset_kpdr21_upper_norfair_bubble_mountain_revisit ; Upper Norfair: Bubble Mountain Revisit dl $7E078D : db $02 : dw $956A ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $AF72 ; MDB dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $1400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $012B ; Health dl $7E09C6 : db $02 : dw $000E ; Missiles dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E0AF6 : db $02 : dw $008E ; Samus X dl $7ED91A : db $02 : dw $0022 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_business_center_3: dw #preset_kpdr21_upper_norfair_frog_speedway ; Upper Norfair: Frog Speedway dl $7E078D : db $02 : dw $97DA ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $B167 ; MDB dl $7E07C3 : db $02 : dw $860B ; GFX Pointers dl $7E07C5 : db $02 : dw $21C0 ; GFX Pointers dl $7E07C7 : db $02 : dw $C2C0 ; GFX Pointers dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $A800 ; Screen subpixel Y position dl $7E0AF6 : db $02 : dw $0029 ; Samus X dw #$FFFF .after preset_kpdr21_red_brinstar_alpha_spark: dw #preset_kpdr21_upper_norfair_business_center_3 ; Upper Norfair: Business Center 3 dl $7E078D : db $02 : dw $92EE ; DDB dl $7E078F : db $02 : dw $0004 ; DoorOut Index dl $7E079B : db $02 : dw $A6A1 ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E09C6 : db $02 : dw $0014 ; Missiles dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0080 ; Samus X dl $7E0AFA : db $02 : dw $0086 ; Samus Y dw #$FFFF .after preset_kpdr21_red_brinstar_reverse_skree_boost: dw #preset_kpdr21_red_brinstar_alpha_spark ; Red Brinstar: Alpha Spark dl $7E078D : db $02 : dw $A36C ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A408 ; MDB dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $B400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0005 ; Supers dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $003F ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dw #$FFFF .after preset_kpdr21_red_brinstar_red_tower_climb: dw #preset_kpdr21_red_brinstar_reverse_skree_boost ; Red Brinstar: Reverse Skree Boost dl $7E078D : db $02 : dw $910E ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $A3DD ; MDB dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $EC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0129 ; Health dl $7E0AF6 : db $02 : dw $0024 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_red_brinstar_hellway: dw #preset_kpdr21_red_brinstar_red_tower_climb ; Red Brinstar: Red Tower Climb dl $7E078D : db $02 : dw $90F6 ; DDB dl $7E079B : db $02 : dw $A253 ; MDB dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $6800 ; Screen subpixel Y position dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $008F ; Samus X dw #$FFFF .after preset_kpdr21_red_brinstar_caterpillars_down: dw #preset_kpdr21_red_brinstar_hellway ; Red Brinstar: Hellway dl $7E078D : db $02 : dw $901E ; DDB dl $7E079B : db $02 : dw $A2F7 ; MDB dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $01FB ; Screen X position in pixels dl $7E0913 : db $02 : dw $4400 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $0119 ; Health dl $7E0AF6 : db $02 : dw $0291 ; Samus X dw #$FFFF .after preset_kpdr21_red_brinstar_alpha_power_bombs: dw #preset_kpdr21_red_brinstar_caterpillars_down ; Red Brinstar: Caterpillars Down dl $7E078D : db $02 : dw $908A ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A322 ; MDB dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $071C ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0041 ; Samus X dl $7E0AFA : db $02 : dw $078B ; Samus Y dl $7ED8B6 : db $02 : dw $2008 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_red_brinstar_caterpillars_up: dw #preset_kpdr21_red_brinstar_alpha_power_bombs ; Red Brinstar: Alpha Power Bombs dl $7E078D : db $02 : dw $9096 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $A3AE ; MDB dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $FC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $010F ; Health dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E09D0 : db $02 : dw $0005 ; Max pbs dl $7E09D2 : db $02 : dw $0003 ; Currently selected item dl $7E09D2 : db $02 : dw $0003 ; Currently selected item dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $02AF ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED874 : db $02 : dw $0104 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0024 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_crateria_kihunters: dw #preset_kpdr21_red_brinstar_caterpillars_up ; Red Brinstar: Caterpillars Up dl $7E078D : db $02 : dw $90BA ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $962A ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $A400 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $0123 ; Health dl $7E09CA : db $02 : dw $0005 ; Supers dl $7E09CE : db $02 : dw $0003 ; Pbs dl $7E0A1C : db $02 : dw $0028 ; Samus position/state dl $7E0A1E : db $02 : dw $0504 ; More position/state dl $7E0AF6 : db $02 : dw $0068 ; Samus X dl $7E0AFA : db $02 : dw $0060 ; Samus Y dl $7ED8B2 : db $02 : dw $2C01 ; Events, Items, Doors dl $7ED8B6 : db $02 : dw $3008 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_oceanfly_setup: dw #preset_kpdr21_wrecked_ship_crateria_kihunters ; Wrecked Ship: Crateria Kihunters dl $7E078D : db $02 : dw $8AF6 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $948C ; MDB dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $8C00 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $3000 ; Screen subpixel Y position dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E09D2 : db $02 : dw $0000 ; Currently selected item dl $7E09D2 : db $02 : dw $0000 ; Currently selected item dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $002C ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8B0 : db $02 : dw $6000 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_ocean_spark: dw #preset_kpdr21_wrecked_ship_oceanfly_setup ; Wrecked Ship: Oceanfly Setup dl $7E078D : db $02 : dw $8A36 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $95FF ; MDB dl $7E090F : db $02 : dw $A3FF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $6C00 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00EE ; Health dl $7E0AF6 : db $02 : dw $01C6 ; Samus X dl $7ED91A : db $02 : dw $0025 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_entering_wrecked_ship: dw #preset_kpdr21_wrecked_ship_ocean_spark ; Wrecked Ship: Ocean Spark dl $7E078D : db $02 : dw $8AEA ; DDB dl $7E079B : db $02 : dw $93FE ; MDB dl $7E07F3 : db $02 : dw $000C ; Music Bank dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0700 ; Screen X position in pixels dl $7E0913 : db $02 : dw $B000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0400 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0074 ; Health dl $7E09CA : db $02 : dw $0004 ; Supers dl $7E0AF6 : db $02 : dw $07DB ; Samus X dl $7E0AFA : db $02 : dw $048B ; Samus Y dl $7ED8B0 : db $02 : dw $7000 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0028 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_basement: dw #preset_kpdr21_wrecked_ship_entering_wrecked_ship ; Wrecked Ship: Entering Wrecked Ship dl $7E078D : db $02 : dw $A1BC ; DDB dl $7E079B : db $02 : dw $CAF6 ; MDB dl $7E079F : db $02 : dw $0003 ; Region dl $7E07C3 : db $02 : dw $AE9E ; GFX Pointers dl $7E07C5 : db $02 : dw $A6BB ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B1 ; GFX Pointers dl $7E07F3 : db $02 : dw $0030 ; Music Bank dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels dl $7E0913 : db $02 : dw $F000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $071F ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0003 ; Supers dl $7E0AF6 : db $02 : dw $0455 ; Samus X dl $7E0AFA : db $02 : dw $07BB ; Samus Y dl $7ED8C0 : db $02 : dw $0010 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0029 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_phantoon: dw #preset_kpdr21_wrecked_ship_basement ; Wrecked Ship: Basement dl $7E078D : db $02 : dw $A21C ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $CC6F ; MDB dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $7000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0002 ; Supers dl $7E0AF6 : db $02 : dw $04CC ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8C0 : db $02 : dw $0030 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_leaving_phantoon: dw #preset_kpdr21_wrecked_ship_phantoon ; Wrecked Ship: Phantoon dl $7E078D : db $02 : dw $A2C4 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E07C5 : db $02 : dw $E7BB ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B0 ; GFX Pointers dl $7E07F5 : db $02 : dw $0006 ; Music Track dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $8000 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00E2 ; Health dl $7E09CA : db $02 : dw $0005 ; Supers dl $7E09CE : db $02 : dw $0003 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $04D6 ; Samus X dl $7ED82A : db $02 : dw $0100 ; Events, Items, Doors dl $7ED8C0 : db $02 : dw $0070 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_shaft_to_supers: dw #preset_kpdr21_wrecked_ship_leaving_phantoon ; Wrecked Ship: Leaving Phantoon dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0226 ; Screen X position in pixels dl $7E0913 : db $02 : dw $FC00 ; Screen subpixel Y position dl $7E0AF6 : db $02 : dw $02C4 ; Samus X dl $7E0AFA : db $02 : dw $006B ; Samus Y dw #$FFFF .after preset_kpdr21_wrecked_ship_wrecked_ship_shaft: dw #preset_kpdr21_wrecked_ship_shaft_to_supers ; Wrecked Ship: Shaft to Supers dl $7E078D : db $02 : dw $A210 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $CDA8 ; MDB dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $7800 ; Screen subpixel Y position dl $7E09CA : db $02 : dw $000A ; Supers dl $7E09CC : db $02 : dw $000A ; Max supers dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $00C4 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED880 : db $02 : dw $0020 ; Events, Items, Doors dl $7ED8C0 : db $02 : dw $0074 ; Events, Items, Doors dl $7ED91A : db $02 : dw $002B ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_attic: dw #preset_kpdr21_wrecked_ship_wrecked_ship_shaft ; Wrecked Ship: Wrecked Ship Shaft dl $7E078D : db $02 : dw $A2E8 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $CAF6 ; MDB dl $7E090F : db $02 : dw $AC00 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels dl $7E0913 : db $02 : dw $B000 ; Screen subpixel Y position dl $7E0AF6 : db $02 : dw $0445 ; Samus X dl $7E0AFA : db $02 : dw $006B ; Samus Y dl $7ED91A : db $02 : dw $002C ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_upper_west_ocean: dw #preset_kpdr21_wrecked_ship_attic ; Wrecked Ship: Attic dl $7E078D : db $02 : dw $A228 ; DDB dl $7E078F : db $02 : dw $0004 ; DoorOut Index dl $7E079B : db $02 : dw $CA52 ; MDB dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $C7FD ; Screen subpixel Y position dl $7E0915 : db $02 : dw $001F ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00EE ; Health dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $003B ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8C0 : db $02 : dw $0174 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_pancakes_and_wavers: dw #preset_kpdr21_wrecked_ship_upper_west_ocean ; Wrecked Ship: Upper West Ocean dl $7E078D : db $02 : dw $A1E0 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $93FE ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E07F3 : db $02 : dw $000C ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $F800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $01FC ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0102 ; Health dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $02C2 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED91A : db $02 : dw $002F ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_bowling_spark: dw #preset_kpdr21_wrecked_ship_pancakes_and_wavers ; Wrecked Ship: Pancakes and Wavers dl $7E078D : db $02 : dw $89E2 ; DDB dl $7E079B : db $02 : dw $9461 ; MDB dl $7E090F : db $02 : dw $6800 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $2400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $016E ; Samus X dl $7E0AFA : db $02 : dw $009D ; Samus Y dw #$FFFF .after preset_kpdr21_wrecked_ship_leaving_gravity: dw #preset_kpdr21_wrecked_ship_bowling_spark ; Wrecked Ship: Bowling Spark dl $7E078D : db $02 : dw $A1A4 ; DDB dl $7E079B : db $02 : dw $CE40 ; MDB dl $7E079F : db $02 : dw $0003 ; Region dl $7E07C3 : db $02 : dw $AE9E ; GFX Pointers dl $7E07C5 : db $02 : dw $E7BB ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B0 ; GFX Pointers dl $7E07F3 : db $02 : dw $0030 ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $E400 ; Screen subpixel Y position dl $7E09A2 : db $02 : dw $3125 ; Equipped Items dl $7E09A4 : db $02 : dw $3125 ; Collected Items dl $7E09C2 : db $02 : dw $00A9 ; Health dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0078 ; Samus X dl $7E0AFA : db $02 : dw $0088 ; Samus Y dl $7ED880 : db $02 : dw $00A0 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0032 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_moat_ball: dw #preset_kpdr21_wrecked_ship_leaving_gravity ; Wrecked Ship: Leaving Gravity dl $7E078D : db $02 : dw $A300 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $93FE ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E07F3 : db $02 : dw $000C ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $00E4 ; Screen X position in pixels dl $7E0913 : db $02 : dw $2800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0445 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0184 ; Samus X dl $7E0AFA : db $02 : dw $04D0 ; Samus Y dl $7ED91A : db $02 : dw $0035 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_wrecked_ship_crateria_kihunters_return: dw #preset_kpdr21_wrecked_ship_moat_ball ; Wrecked Ship: Moat Ball dl $7E078D : db $02 : dw $89CA ; DDB dl $7E079B : db $02 : dw $95FF ; MDB dl $7E090F : db $02 : dw $8400 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0007 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $003B ; Samus X dl $7E0AFA : db $02 : dw $0097 ; Samus Y dl $7ED91A : db $02 : dw $0036 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_red_brinstar_final_red_tower_elevator: dw #preset_kpdr21_wrecked_ship_crateria_kihunters_return ; Wrecked Ship: Crateria Kihunters Return dl $7E078D : db $02 : dw $8B02 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A322 ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position. dl $7E0915 : db $02 : dw $0238 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00BD ; Health dl $7E09C6 : db $02 : dw $0012 ; Missiles dl $7E09CE : db $02 : dw $0003 ; Pbs dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0080 ; Samus X dl $7E0AFA : db $02 : dw $02A8 ; Samus Y dw #$FFFF .after preset_kpdr21_red_brinstar_final_hellway_revisit: dw #preset_kpdr21_red_brinstar_final_red_tower_elevator ; Red Brinstar Final: Red Tower Elevator dl $7E078F : db $02 : dw $0005 ; DoorOut Index dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $2800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0500 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0040 ; Samus X dl $7E0AFA : db $02 : dw $058B ; Samus Y dw #$FFFF .after preset_kpdr21_red_brinstar_final_red_tower_down: dw #preset_kpdr21_red_brinstar_final_hellway_revisit ; Red Brinstar Final: Hellway Revisit dl $7E078D : db $02 : dw $90AE ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $A2F7 ; MDB dl $7E0913 : db $02 : dw $9000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00B5 ; Health dl $7E0AF6 : db $02 : dw $003D ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_red_brinstar_final_skree_boost_final: dw #preset_kpdr21_red_brinstar_final_red_tower_down ; Red Brinstar Final: Red Tower Down dl $7E078D : db $02 : dw $907E ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $A253 ; MDB dl $7E090F : db $02 : dw $A001 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $091A ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $0054 ; Samus X dl $7E0AFA : db $02 : dw $098B ; Samus Y dw #$FFFF .after preset_kpdr21_red_brinstar_final_below_spazer_final: dw #preset_kpdr21_red_brinstar_final_skree_boost_final ; Red Brinstar Final: Skree Boost Final dl $7E078D : db $02 : dw $9042 ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $A3DD ; MDB dl $7E090F : db $02 : dw $5FFF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00B4 ; Health dl $7E0AF6 : db $02 : dw $01DC ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_maridia_breaking_tube: dw #preset_kpdr21_red_brinstar_final_below_spazer_final ; Red Brinstar Final: Below Spazer Final dl $7E078D : db $02 : dw $911A ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $CF54 ; MDB dl $7E079F : db $02 : dw $0004 ; Region dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers dl $7E09D2 : db $02 : dw $0003 ; Currently selected item dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position dl $7E09CA : db $02 : dw $000A ; Supers dl $7E0AF6 : db $02 : dw $002D ; Samus X dw #$FFFF .after preset_kpdr21_maridia_fish_tank: dw #preset_kpdr21_maridia_breaking_tube ; Maridia: Breaking Tube dl $7E078D : db $02 : dw $A330 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $CFC9 ; MDB dl $7E07F3 : db $02 : dw $001B ; Music Bank dl $7E07F5 : db $02 : dw $0006 ; Music Track dl $7E090F : db $02 : dw $4FFF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $00FE ; Screen X position in pixels dl $7E0913 : db $02 : dw $C000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $05F4 ; Screen Y position in pixels dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E09D2 : db $02 : dw $0000 ; Currently selected item dl $7E0AF6 : db $02 : dw $0167 ; Samus X dl $7E0AFA : db $02 : dw $068B ; Samus Y dl $7ED820 : db $02 : dw $0801 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0038 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_mt_everest: dw #preset_kpdr21_maridia_fish_tank ; Maridia: Fish Tank dl $7E078D : db $02 : dw $A3F0 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $D0B9 ; MDB dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $BC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $031F ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $017C ; Samus X dl $7E0AFA : db $02 : dw $03BB ; Samus Y dw #$FFFF .after preset_kpdr21_maridia_crab_shaft: dw #preset_kpdr21_maridia_mt_everest ; Maridia: Mt Everest dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels dl $7E0913 : db $02 : dw $9C01 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0079 ; Health dl $7E0AF6 : db $02 : dw $05C0 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_maridia_aqueduct: dw #preset_kpdr21_maridia_crab_shaft ; Maridia: Crab Shaft dl $7E078D : db $02 : dw $A468 ; DDB dl $7E078F : db $02 : dw $0005 ; DoorOut Index dl $7E079B : db $02 : dw $D1A3 ; MDB dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $83FF ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E09D2 : db $02 : dw $0003 ; Currently selected item dl $7E0AF6 : db $02 : dw $01AD ; Samus X dl $7E0AFA : db $02 : dw $038B ; Samus Y dl $7ED8C0 : db $02 : dw $8174 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_botwoon_hallway: dw #preset_kpdr21_maridia_aqueduct ; Maridia: Aqueduct dl $7E078D : db $02 : dw $A4C8 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $D5A7 ; MDB dl $7E07C3 : db $02 : dw $E78D ; GFX Pointers dl $7E07C5 : db $02 : dw $2EBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B9 ; GFX Pointers dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09CE : db $02 : dw $0001 ; Pbs dl $7E09D2 : db $02 : dw $0000 ; Currently selected item dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $009D ; Samus X dl $7E0AFA : db $02 : dw $006B ; Samus Y dl $7ED91A : db $02 : dw $003A ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_botwoon: dw #preset_kpdr21_maridia_botwoon_hallway ; Maridia: Botwoon Hallway dl $7E078D : db $02 : dw $A72C ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $D617 ; MDB dl $7E090F : db $02 : dw $DFFF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels dl $7E0913 : db $02 : dw $5800 ; Screen subpixel Y position dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $03A4 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_maridia_botwoon_etank: dw #preset_kpdr21_maridia_botwoon ; Maridia: Botwoon dl $7E078D : db $02 : dw $A774 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $D95E ; MDB dl $7E07F3 : db $02 : dw $002A ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $C000 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00A1 ; Health dl $7E09C6 : db $02 : dw $0014 ; Missiles dl $7E09CA : db $02 : dw $0003 ; Supers dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E0AF6 : db $02 : dw $01C6 ; Samus X dl $7ED82C : db $02 : dw $0002 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_halfie_setup: dw #preset_kpdr21_maridia_botwoon_etank ; Maridia: Botwoon E-tank dl $7E078D : db $02 : dw $A918 ; DDB dl $7E079B : db $02 : dw $D7E4 ; MDB dl $7E07F3 : db $02 : dw $001B ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $001F ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $018F ; Health dl $7E09C4 : db $02 : dw $018F ; Max helath dl $7E0AF6 : db $02 : dw $008D ; Samus X dl $7E0AFA : db $02 : dw $009B ; Samus Y dl $7ED882 : db $02 : dw $0100 ; Events, Items, Doors dl $7ED91A : db $02 : dw $003B ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_draygon: dw #preset_kpdr21_maridia_halfie_setup ; Maridia: Halfie Setup dl $7E078D : db $02 : dw $A7F8 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $D78F ; MDB dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $E400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0110 ; Health dl $7E09CA : db $02 : dw $0001 ; Supers dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0041 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED8C2 : db $02 : dw $0C00 ; Events, Items, Doors dl $7ED91A : db $02 : dw $003C ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_reverse_halfie_spikesuit: dw #preset_kpdr21_maridia_draygon ; Maridia: Draygon dl $7E078D : db $02 : dw $A96C ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09A2 : db $02 : dw $3325 ; Equipped Items dl $7E09A4 : db $02 : dw $3325 ; Collected Items dl $7E09C2 : db $02 : dw $00BA ; Health dl $7E09C6 : db $02 : dw $000D ; Missiles dl $7E09CA : db $02 : dw $0005 ; Supers dl $7E09CE : db $02 : dw $0003 ; Pbs dl $7E0A68 : db $02 : dw $0001 ; Flash suit dl $7E0AF6 : db $02 : dw $0044 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED82C : db $02 : dw $0003 ; Events, Items, Doors dl $7ED882 : db $02 : dw $0500 ; Events, Items, Doors dl $7ED8C2 : db $02 : dw $CC00 ; Events, Items, Doors dl $7ED91A : db $02 : dw $003E ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_womple_jump: dw #preset_kpdr21_maridia_reverse_halfie_spikesuit ; Maridia: Reverse Halfie (Spikesuit) dl $7E0A68 : db $02 : dw $0000 ; Flash suit dw #$FFFF .after preset_kpdr21_maridia_cac_alley_east: dw #preset_kpdr21_maridia_womple_jump ; Maridia: Womple Jump dl $7E078D : db $02 : dw $A7E0 ; DDB dl $7E079B : db $02 : dw $D913 ; MDB dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0915 : db $02 : dw $011A ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00BA ; Health dl $7E09C6 : db $02 : dw $000C ; Missiles dl $7E0A68 : db $02 : dw $0000 ; Flash suit dl $7E0AF6 : db $02 : dw $0030 ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED8C2 : db $02 : dw $DC00 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_cac_alley_west: dw #preset_kpdr21_maridia_cac_alley_east ; Maridia: Cac Alley East dl $7E078D : db $02 : dw $A900 ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $DA2B ; MDB dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position. dl $7E0915 : db $02 : dw $0002 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $000B ; Missiles dl $7E09CA : db $02 : dw $0007 ; Supers dl $7E0AF6 : db $02 : dw $005B ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_maridia_plasma_spark: dw #preset_kpdr21_maridia_cac_alley_west ; Maridia: Cac Alley West dl $7E078D : db $02 : dw $A93C ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $D5EC ; MDB dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0008 ; Supers dl $7E0AF6 : db $02 : dw $0024 ; Samus X dw #$FFFF .after preset_kpdr21_maridia_plasma_climb: dw #preset_kpdr21_maridia_plasma_spark ; Maridia: Plasma Spark dl $7E078D : db $02 : dw $A750 ; DDB dl $7E079B : db $02 : dw $D340 ; MDB dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers dl $7E090F : db $02 : dw $FFFF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $8C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $00F3 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $027F ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dw #$FFFF .after preset_kpdr21_maridia_plasma_beam: dw #preset_kpdr21_maridia_plasma_climb ; Maridia: Plasma Climb dl $7E078D : db $02 : dw $A5DC ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $D27E ; MDB dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $0095 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8C2 : db $02 : dw $DC08 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_plasma_spark_revisit: dw #preset_kpdr21_maridia_plasma_beam ; Maridia: Plasma Beam dl $7E078D : db $02 : dw $A540 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $D387 ; MDB dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $031A ; Screen Y position in pixels dl $7E09A6 : db $02 : dw $1009 ; Beams dl $7E09A8 : db $02 : dw $1009 ; Beams dl $7E09C2 : db $02 : dw $00A4 ; Health dl $7E09C6 : db $02 : dw $0011 ; Missiles dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0025 ; Samus X dl $7E0AFA : db $02 : dw $038B ; Samus Y dl $7ED880 : db $02 : dw $80A0 ; Events, Items, Doors dl $7ED8C2 : db $02 : dw $DC0A ; Events, Items, Doors dl $7ED91A : db $02 : dw $003F ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_toilet: dw #preset_kpdr21_maridia_plasma_spark_revisit ; Maridia: Plasma Spark Revisit dl $7E078D : db $02 : dw $A5D0 ; DDB dl $7E079B : db $02 : dw $D340 ; MDB dl $7E0911 : db $02 : dw $002E ; Screen X position in pixels dl $7E0913 : db $02 : dw $0800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $021F ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00A9 ; Health dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E0AF6 : db $02 : dw $00A3 ; Samus X dl $7E0AFA : db $02 : dw $02AB ; Samus Y dl $7ED8C2 : db $02 : dw $DC1A ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_maridia_sewers: dw #preset_kpdr21_maridia_toilet ; Maridia: Toilet dl $7E078D : db $02 : dw $A600 ; DDB dl $7E079B : db $02 : dw $D48E ; MDB dl $7E07C3 : db $02 : dw $E78D ; GFX Pointers dl $7E07C5 : db $02 : dw $2EBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B9 ; GFX Pointers dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $3000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $011C ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $00BB ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dw #$FFFF .after preset_kpdr21_maridia_lower_maridia_gate: dw #preset_kpdr21_maridia_sewers ; Maridia: Sewers dl $7E078D : db $02 : dw $A528 ; DDB dl $7E079B : db $02 : dw $D21C ; MDB dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $5C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00AE ; Health dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E0AF6 : db $02 : dw $002E ; Samus X dw #$FFFF .after preset_kpdr21_upper_norfair_revisit_ice_beam_gates: dw #preset_kpdr21_maridia_lower_maridia_gate ; Maridia: Lower Maridia Gate dl $7E078D : db $02 : dw $9246 ; DDB dl $7E078F : db $02 : dw $0005 ; DoorOut Index dl $7E079B : db $02 : dw $A7DE ; MDB dl $7E079F : db $02 : dw $0002 ; Region dl $7E07C3 : db $02 : dw $C3F9 ; GFX Pointers dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers dl $7E07F3 : db $02 : dw $0015 ; Music Bank dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0326 ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0007 ; Supers dl $7E0AF6 : db $02 : dw $0032 ; Samus X dl $7E0AFA : db $02 : dw $0395 ; Samus Y dl $7ED8B8 : db $02 : dw $2EED ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_revisit_ice_maze_up: dw #preset_kpdr21_upper_norfair_revisit_ice_beam_gates ; Upper Norfair Revisit: Ice Beam Gates dl $7E078D : db $02 : dw $931E ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $A75D ; MDB dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers dl $7E0913 : db $02 : dw $1800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $0025 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_upper_norfair_revisit_ice_maze_down: dw #preset_kpdr21_upper_norfair_revisit_ice_maze_up ; Upper Norfair Revisit: Ice Maze Up dl $7E078D : db $02 : dw $937E ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $A890 ; MDB dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $7000 ; Screen subpixel Y position dl $7E09A6 : db $02 : dw $100B ; Beams dl $7E09A8 : db $02 : dw $100B ; Beams dl $7E09C2 : db $02 : dw $00BD ; Health dl $7E0AF6 : db $02 : dw $00BA ; Samus X dl $7ED876 : db $02 : dw $01A5 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0040 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_revisit_ice_escape: dw #preset_kpdr21_upper_norfair_revisit_ice_maze_down ; Upper Norfair Revisit: Ice Maze Down dl $7E078D : db $02 : dw $935A ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $A8B9 ; MDB dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $9000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $00C5 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dw #$FFFF .after preset_kpdr21_upper_norfair_revisit_purple_shaft_upper: dw #preset_kpdr21_upper_norfair_revisit_ice_escape ; Upper Norfair Revisit: Ice Escape dl $7E078D : db $02 : dw $971A ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $ACB3 ; MDB dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $E800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $0036 ; Samus X dl $7E0AFA : db $02 : dw $038B ; Samus Y dl $7ED91A : db $02 : dw $0041 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_revisit_magdollite_tunnel_upper: dw #preset_kpdr21_upper_norfair_revisit_purple_shaft_upper ; Upper Norfair Revisit: Purple Shaft (Upper) dl $7E078D : db $02 : dw $9576 ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $AEDF ; MDB dl $7E090F : db $02 : dw $B001 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $01F4 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $0059 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dw #$FFFF .after preset_kpdr21_upper_norfair_revisit_kronic_boost_upper: dw #preset_kpdr21_upper_norfair_revisit_magdollite_tunnel_upper ; Upper Norfair Revisit: Magdollite Tunnel (Upper) dl $7E078D : db $02 : dw $96BA ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $AEB4 ; MDB dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $9000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $02B7 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_upper_norfair_revisit_croc_speedway_lower: dw #preset_kpdr21_upper_norfair_revisit_ice_escape ; Upper Norfair Revisit: Ice Escape dl $7E078D : db $02 : dw $9336 ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $A8F8 ; MDB dl $7E090F : db $02 : dw $6781 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $00DD ; Samus X dl $7E0AFA : db $02 : dw $038B ; Samus Y dl $7ED91A : db $02 : dw $0041 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_upper_norfair_revisit_spiky_acid_snakes_lower: dw #preset_kpdr21_upper_norfair_revisit_croc_speedway_lower ; Upper Norfair Revisit: Croc Speedway (Lower) dl $7E078D : db $02 : dw $93C6 ; DDB dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E079B : db $02 : dw $AFCE ; MDB dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $02A3 ; Screen X position in pixels dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $030E ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7E0B3F : db $02 : dw $0000 ; Blue suit dw #$FFFF .after preset_kpdr21_upper_norfair_revisit_kronic_boost_lower: dw #preset_kpdr21_upper_norfair_revisit_spiky_acid_snakes_lower ; Upper Norfair Revisit: Spiky Acid Snakes (Lower) dl $7E078D : db $02 : dw $9792 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $AFFB ; MDB dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels dl $7E0913 : db $02 : dw $8C00 ; Screen subpixel Y position dl $7E0AF6 : db $02 : dw $03BC ; Samus X dw #$FFFF .after preset_kpdr21_lower_norfair_ln_main_hall: dw #preset_kpdr21_upper_norfair_revisit_kronic_boost_upper ; Upper Norfair Revisit: Kronic Boost (Upper) dl $7E078D : db $02 : dw $96F6 ; DDB dl $7E079B : db $02 : dw $B236 ; MDB dl $7E07F3 : db $02 : dw $0018 ; Music Bank dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00BA ; Health dl $7E09CE : db $02 : dw $0004 ; Pbs dl $7E09D2 : db $02 : dw $0003 ; Currently selected item dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0480 ; Samus X dl $7E0AFA : db $02 : dw $0288 ; Samus Y dl $7ED8BA : db $02 : dw $01F1 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_prepillars: dw #preset_kpdr21_lower_norfair_ln_main_hall ; Lower Norfair: LN Main Hall dl $7E078F : db $02 : dw $0003 ; DoorOut Index dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0700 ; Screen X position in pixels dl $7E0913 : db $02 : dw $E400 ; Screen subpixel Y position dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $07A2 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dw #$FFFF .after preset_kpdr21_lower_norfair_worst_room_in_the_game: dw #preset_kpdr21_lower_norfair_prepillars ; Lower Norfair: Pre-Pillars dl $7E078D : db $02 : dw $9912 ; DDB dl $7E078F : db $02 : dw $0004 ; DoorOut Index dl $7E079B : db $02 : dw $B457 ; MDB dl $7E090F : db $02 : dw $64FF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels dl $7E0913 : db $02 : dw $F800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0070 ; Health dl $7E09C6 : db $02 : dw $0013 ; Missiles dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E0AF6 : db $02 : dw $03DB ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_lower_norfair_amphitheatre: dw #preset_kpdr21_lower_norfair_worst_room_in_the_game ; Lower Norfair: Worst Room in the Game dl $7E078D : db $02 : dw $994E ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $B4AD ; MDB dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $A400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $011D ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0084 ; Health dl $7E09CE : db $02 : dw $0004 ; Pbs dl $7E09D2 : db $02 : dw $0000 ; Currently selected item dl $7E0AF6 : db $02 : dw $00A7 ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dw #$FFFF .after preset_kpdr21_lower_norfair_kihunter_stairs_down: dw #preset_kpdr21_lower_norfair_amphitheatre ; Lower Norfair: Amphitheatre dl $7E078D : db $02 : dw $997E ; DDB dl $7E079B : db $02 : dw $B4E5 ; MDB dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0282 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0043 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $02E2 ; Samus X dl $7E0AFA : db $02 : dw $00B3 ; Samus Y dw #$FFFF .after preset_kpdr21_lower_norfair_wasteland: dw #preset_kpdr21_lower_norfair_kihunter_stairs_down ; Lower Norfair: Kihunter Stairs Down dl $7E078D : db $02 : dw $99A2 ; DDB dl $7E079B : db $02 : dw $B585 ; MDB dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0915 : db $02 : dw $0419 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00AC ; Health dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E0A1C : db $02 : dw $001D ; Samus position/state dl $7E0A1E : db $02 : dw $0408 ; More position/state dl $7E0AF6 : db $02 : dw $0248 ; Samus X dl $7E0AFA : db $02 : dw $0489 ; Samus Y dl $7ED8BA : db $02 : dw $41F1 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_metal_ninja_pirates: dw #preset_kpdr21_lower_norfair_wasteland ; Lower Norfair: Wasteland dl $7E078D : db $02 : dw $99EA ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $B5D5 ; MDB dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0915 : db $02 : dw $021B ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0087 ; Health dl $7E09CA : db $02 : dw $0006 ; Supers dl $7E09CE : db $02 : dw $0001 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0168 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED8BA : db $02 : dw $C1F1 ; Events, Items, Doors dl $7ED91A : db $02 : dw $0042 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_plowerhouse: dw #preset_kpdr21_lower_norfair_metal_ninja_pirates ; Lower Norfair: Metal Ninja Pirates dl $7E078D : db $02 : dw $9A1A ; DDB dl $7E079B : db $02 : dw $B62B ; MDB dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0122 ; Health dl $7E09C6 : db $02 : dw $0014 ; Missiles dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E0AF6 : db $02 : dw $006A ; Samus X dl $7E0AFA : db $02 : dw $00BB ; Samus Y dl $7ED8BC : db $02 : dw $0001 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_ridley: dw #preset_kpdr21_lower_norfair_plowerhouse ; Lower Norfair: Plowerhouse dl $7E078D : db $02 : dw $995A ; DDB dl $7E079B : db $02 : dw $B37A ; MDB dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $5000 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00E3 ; Health dl $7E09CA : db $02 : dw $0008 ; Supers dl $7E0AF6 : db $02 : dw $003D ; Samus X dl $7E0AFA : db $02 : dw $009B ; Samus Y dl $7ED8BA : db $02 : dw $D1F1 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_leaving_ridley: dw #preset_kpdr21_lower_norfair_ridley ; Lower Norfair: Ridley dl $7E078D : db $02 : dw $98CA ; DDB dl $7E079B : db $02 : dw $B32E ; MDB dl $7E07F3 : db $02 : dw $0024 ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $3C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $011F ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00D9 ; Health dl $7E09CA : db $02 : dw $000A ; Supers dl $7E09CE : db $02 : dw $0003 ; Pbs dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $0057 ; Samus X dl $7E0AFA : db $02 : dw $019B ; Samus Y dl $7ED82A : db $02 : dw $0101 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_reverse_plowerhouse: dw #preset_kpdr21_lower_norfair_leaving_ridley ; Lower Norfair: Leaving Ridley dl $7E078D : db $02 : dw $98BE ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $B37A ; MDB dl $7E07F3 : db $02 : dw $0018 ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels dl $7E0913 : db $02 : dw $AC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00D6 ; Health dl $7E0AF6 : db $02 : dw $02B8 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED8BA : db $02 : dw $D5F1 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_wasteland_revisit: dw #preset_kpdr21_lower_norfair_reverse_plowerhouse ; Lower Norfair: Reverse Plowerhouse dl $7E078D : db $02 : dw $9966 ; DDB dl $7E079B : db $02 : dw $B62B ; MDB dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00B4 ; Health dl $7E0AF6 : db $02 : dw $02DC ; Samus X dw #$FFFF .after preset_kpdr21_lower_norfair_kihunter_stairs_up: dw #preset_kpdr21_lower_norfair_wasteland_revisit ; Lower Norfair: Wasteland Revisit dl $7E078D : db $02 : dw $9A3E ; DDB dl $7E079B : db $02 : dw $B5D5 ; MDB dl $7E090F : db $02 : dw $D5FF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels dl $7E0913 : db $02 : dw $B000 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $00B2 ; Health dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E0AF6 : db $02 : dw $055B ; Samus X dl $7E0AFA : db $02 : dw $009B ; Samus Y dl $7ED91A : db $02 : dw $0043 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_fire_flea_room: dw #preset_kpdr21_lower_norfair_kihunter_stairs_up ; Lower Norfair: Kihunter Stairs Up dl $7E078D : db $02 : dw $9A26 ; DDB dl $7E079B : db $02 : dw $B585 ; MDB dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $2800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $000D ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $00B7 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_lower_norfair_springball_maze: dw #preset_kpdr21_lower_norfair_fire_flea_room ; Lower Norfair: Fire Flea Room dl $7E078D : db $02 : dw $9A02 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $B6EE ; MDB dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $A000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0001 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $016C ; Samus X dl $7ED91A : db $02 : dw $0044 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_three_musketeers: dw #preset_kpdr21_lower_norfair_springball_maze ; Lower Norfair: Springball Maze dl $7E078D : db $02 : dw $9A92 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $B510 ; MDB dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers dl $7E090F : db $02 : dw $5A81 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $5000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0003 ; Screen Y position in pixels dl $7E0AF6 : db $02 : dw $0060 ; Samus X dl $7ED91A : db $02 : dw $0045 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_single_chamber_final: dw #preset_kpdr21_lower_norfair_three_musketeers ; Lower Norfair: Three Musketeers dl $7E078D : db $02 : dw $99AE ; DDB dl $7E079B : db $02 : dw $B656 ; MDB dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $E000 ; Screen subpixel Y position dl $7E09C2 : db $02 : dw $0080 ; Health dl $7E0AF6 : db $02 : dw $016E ; Samus X dl $7ED91A : db $02 : dw $0046 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_lower_norfair_bubble_mountain_final: dw #preset_kpdr21_lower_norfair_single_chamber_final ; Lower Norfair: Single Chamber Final dl $7E078D : db $02 : dw $9A4A ; DDB dl $7E079B : db $02 : dw $AD5E ; MDB dl $7E07F3 : db $02 : dw $0015 ; Music Bank dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $A800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0016 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0074 ; Health dl $7E0AF6 : db $02 : dw $0075 ; Samus X dw #$FFFF .after preset_kpdr21_lower_norfair_business_center_final: dw #preset_kpdr21_lower_norfair_bubble_mountain_final ; Lower Norfair: Bubble Mountain Final dl $7E078D : db $02 : dw $97DA ; DDB dl $7E079B : db $02 : dw $B167 ; MDB dl $7E07C3 : db $02 : dw $860B ; GFX Pointers dl $7E07C5 : db $02 : dw $21C0 ; GFX Pointers dl $7E07C7 : db $02 : dw $C2C0 ; GFX Pointers dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $5000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0088 ; Health dl $7E09C6 : db $02 : dw $0011 ; Missiles dl $7E09CE : db $02 : dw $0001 ; Pbs dl $7E0AF6 : db $02 : dw $0032 ; Samus X dl $7ED91A : db $02 : dw $0047 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_backtracking_maridia_tube_revisit: dw #preset_kpdr21_lower_norfair_business_center_final ; Lower Norfair: Business Center Final dl $7E078D : db $02 : dw $92EE ; DDB dl $7E078F : db $02 : dw $0004 ; DoorOut Index dl $7E079B : db $02 : dw $A6A1 ; MDB dl $7E079F : db $02 : dw $0001 ; Region dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0080 ; Samus X dl $7E0AFA : db $02 : dw $0086 ; Samus Y dw #$FFFF .after preset_kpdr21_backtracking_fish_tank_revisit: dw #preset_kpdr21_backtracking_maridia_tube_revisit ; Backtracking: Maridia Tube Revisit dl $7E078D : db $02 : dw $A330 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $CFC9 ; MDB dl $7E079F : db $02 : dw $0004 ; Region dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers dl $7E07F3 : db $02 : dw $001B ; Music Bank dl $7E07F5 : db $02 : dw $0006 ; Music Track dl $7E0911 : db $02 : dw $00FA ; Screen X position in pixels dl $7E0913 : db $02 : dw $5000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $05F3 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $0168 ; Samus X dl $7E0AFA : db $02 : dw $068B ; Samus Y dl $7ED91A : db $02 : dw $0049 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_backtracking_mt_everest_revisit_revisit: dw #preset_kpdr21_backtracking_fish_tank_revisit ; Backtracking: Fish Tank Revisit dl $7E078D : db $02 : dw $A3B4 ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $D017 ; MDB dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0068 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $00C8 ; Samus X dl $7E0AFA : db $02 : dw $006B ; Samus Y dw #$FFFF .after preset_kpdr21_backtracking_red_brinstar_green_gate: dw #preset_kpdr21_backtracking_mt_everest_revisit_revisit ; Backtracking: Mt Everest Revisit Revisit dl $7E078D : db $02 : dw $A42C ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $D104 ; MDB dl $7E090F : db $02 : dw $3801 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $2000 ; Screen subpixel Y position dl $7E0AF6 : db $02 : dw $0079 ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dw #$FFFF .after preset_kpdr21_backtracking_crateria_kihunters_final: dw #preset_kpdr21_backtracking_red_brinstar_green_gate ; Backtracking: Red Brinstar Green Gate dl $7E078D : db $02 : dw $90BA ; DDB dl $7E078F : db $02 : dw $0002 ; DoorOut Index dl $7E079B : db $02 : dw $962A ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E07F3 : db $02 : dw $0012 ; Music Bank dl $7E07F5 : db $02 : dw $0003 ; Music Track dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $2800 ; Screen subpixel Y position dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $0063 ; Samus X dl $7E0AFA : db $02 : dw $005B ; Samus Y dw #$FFFF .after preset_kpdr21_backtracking_parlor_spacejump: dw #preset_kpdr21_backtracking_crateria_kihunters_final ; Backtracking: Crateria Kihunters Final dl $7E078D : db $02 : dw $8AC6 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $91F8 ; MDB dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers dl $7E07F3 : db $02 : dw $000C ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $05DC ; Screen X position in pixels dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0400 ; Screen Y position in pixels dl $7E09C6 : db $02 : dw $0010 ; Missiles dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $067C ; Samus X dl $7E0AFA : db $02 : dw $04BB ; Samus Y dw #$FFFF .after preset_kpdr21_backtracking_terminator_revisit: dw #preset_kpdr21_backtracking_parlor_spacejump ; Backtracking: Parlor Spacejump dl $7E078D : db $02 : dw $8916 ; DDB dl $7E079B : db $02 : dw $92FD ; MDB dl $7E07F3 : db $02 : dw $0009 ; Music Bank dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $B400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $001C ; Samus position/state dl $7E0A1E : db $02 : dw $0304 ; More position/state dl $7E0AF6 : db $02 : dw $0101 ; Samus X dl $7E0AFA : db $02 : dw $0086 ; Samus Y dl $7E0B3F : db $02 : dw $0104 ; Blue suit dw #$FFFF .after preset_kpdr21_backtracking_green_pirate_shaft_revisit: dw #preset_kpdr21_backtracking_terminator_revisit ; Backtracking: Terminator Revisit dl $7E078D : db $02 : dw $895E ; DDB dl $7E079B : db $02 : dw $990D ; MDB dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0073 ; Samus X dl $7E0AFA : db $02 : dw $029B ; Samus Y dl $7E0B3F : db $02 : dw $0000 ; Blue suit dl $7ED91A : db $02 : dw $004A ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_tourian_metroids_1: dw #preset_kpdr21_backtracking_green_pirate_shaft_revisit ; Backtracking: Green Pirate Shaft Revisit dl $7E078D : db $02 : dw $9222 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $DAAE ; MDB dl $7E079F : db $02 : dw $0005 ; Region dl $7E07C3 : db $02 : dw $D414 ; GFX Pointers dl $7E07C5 : db $02 : dw $EDBF ; GFX Pointers dl $7E07C7 : db $02 : dw $C2BA ; GFX Pointers dl $7E07F3 : db $02 : dw $001E ; Music Bank dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0238 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00B0 ; Health dl $7E09C6 : db $02 : dw $0012 ; Missiles dl $7E09CA : db $02 : dw $0008 ; Supers dl $7E0A1C : db $02 : dw $009B ; Samus position/state dl $7E0A1E : db $02 : dw $0000 ; More position/state dl $7E0AF6 : db $02 : dw $0080 ; Samus X dl $7E0AFA : db $02 : dw $02A8 ; Samus Y dl $7ED820 : db $02 : dw $0FC1 ; Events, Items, Doors dl $7ED8B2 : db $02 : dw $6C01 ; Events, Items, Doors dl $7ED90C : db $02 : dw $0100 ; Events, Items, Doors dl $7ED91A : db $02 : dw $004C ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_tourian_metroids_2: dw #preset_kpdr21_tourian_metroids_1 ; Tourian: Metroids 1 dl $7E078D : db $02 : dw $A984 ; DDB dl $7E078F : db $02 : dw $0000 ; DoorOut Index dl $7E079B : db $02 : dw $DAE1 ; MDB dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $5000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00EC ; Health dl $7E09C6 : db $02 : dw $0014 ; Missiles dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E09CE : db $02 : dw $0002 ; Pbs dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $003B ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED822 : db $02 : dw $0021 ; Events, Items, Doors dl $7ED8C4 : db $02 : dw $0001 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_tourian_metroids_3: dw #preset_kpdr21_tourian_metroids_2 ; Tourian: Metroids 2 dl $7E078D : db $02 : dw $A9B4 ; DDB dl $7E078F : db $02 : dw $0001 ; DoorOut Index dl $7E079B : db $02 : dw $DB31 ; MDB dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $1000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0109 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0164 ; Health dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $00C2 ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED822 : db $02 : dw $0023 ; Events, Items, Doors dl $7ED8C4 : db $02 : dw $0003 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_tourian_metroids_4: dw #preset_kpdr21_tourian_metroids_3 ; Tourian: Metroids 3 dl $7E078D : db $02 : dw $A9CC ; DDB dl $7E079B : db $02 : dw $DB7D ; MDB dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels dl $7E0913 : db $02 : dw $0400 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $018F ; Health dl $7E0AF6 : db $02 : dw $059E ; Samus X dl $7E0AFA : db $02 : dw $008B ; Samus Y dl $7ED822 : db $02 : dw $0027 ; Events, Items, Doors dl $7ED8C4 : db $02 : dw $0007 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_tourian_giant_hoppers: dw #preset_kpdr21_tourian_metroids_4 ; Tourian: Metroids 4 dl $7E078D : db $02 : dw $A9E4 ; DDB dl $7E079B : db $02 : dw $DBCD ; MDB dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $4C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $011F ; Screen Y position in pixels dl $7E09CA : db $02 : dw $000A ; Supers dl $7E09CE : db $02 : dw $0005 ; Pbs dl $7E0AF6 : db $02 : dw $0058 ; Samus X dl $7E0AFA : db $02 : dw $01CB ; Samus Y dl $7ED822 : db $02 : dw $002F ; Events, Items, Doors dl $7ED8C4 : db $02 : dw $000F ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_tourian_baby_skip: dw #preset_kpdr21_tourian_giant_hoppers ; Tourian: Giant Hoppers dl $7E078D : db $02 : dw $AA14 ; DDB dl $7E079B : db $02 : dw $DC65 ; MDB dl $7E07F3 : db $02 : dw $0045 ; Music Bank dl $7E07F5 : db $02 : dw $0006 ; Music Track dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $1800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0171 ; Health dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $01D8 ; Samus X dl $7E0AFA : db $02 : dw $00AB ; Samus Y dw #$FFFF .after preset_kpdr21_tourian_gedora_room: dw #preset_kpdr21_tourian_baby_skip ; Tourian: Baby Skip dl $7E078D : db $02 : dw $AA44 ; DDB dl $7E079B : db $02 : dw $DCFF ; MDB dl $7E07F3 : db $02 : dw $001E ; Music Bank dl $7E07F5 : db $02 : dw $0005 ; Music Track dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels dl $7E0913 : db $02 : dw $B800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0117 ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0009 ; Supers dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0AF6 : db $02 : dw $00DC ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED8C4 : db $02 : dw $00AF ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_tourian_zeb_skip: dw #preset_kpdr21_tourian_gedora_room ; Tourian: Gedora Room dl $7E078D : db $02 : dw $AAA4 ; DDB dl $7E079B : db $02 : dw $DDF3 ; MDB dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $021A ; Screen Y position in pixels dl $7E09CA : db $02 : dw $0007 ; Supers dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $0038 ; Samus X dl $7E0AFA : db $02 : dw $028B ; Samus Y dl $7ED8C4 : db $02 : dw $03AF ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_tourian_escape_room_3: dw #preset_kpdr21_tourian_zeb_skip ; Tourian: Zeb Skip dl $7E078D : db $02 : dw $AAEC ; DDB dl $7E079B : db $02 : dw $DE7A ; MDB dl $7E07F3 : db $02 : dw $0024 ; Music Bank dl $7E07F5 : db $02 : dw $0007 ; Music Track dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position. dl $7E0913 : db $02 : dw $2800 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels dl $7E09A6 : db $02 : dw $1009 ; Beams dl $7E09C2 : db $02 : dw $018F ; Health dl $7E09C6 : db $02 : dw $0000 ; Missiles dl $7E09CA : db $02 : dw $0000 ; Supers dl $7E09CE : db $02 : dw $0000 ; Pbs dl $7E0A1C : db $02 : dw $0001 ; Samus position/state dl $7E0A1E : db $02 : dw $0008 ; More position/state dl $7E0A76 : db $02 : dw $8000 ; Hyper beam dl $7E0AF6 : db $02 : dw $00DF ; Samus X dl $7E0AFA : db $02 : dw $018B ; Samus Y dl $7ED820 : db $02 : dw $4FC5 ; Events, Items, Doors dl $7ED82C : db $02 : dw $0203 ; Events, Items, Doors dw #$FFFF .after preset_kpdr21_tourian_climb_spark: dw #preset_kpdr21_tourian_escape_room_3 ; Tourian: Escape Room 3 dl $7E078D : db $02 : dw $AB1C ; DDB dl $7E079B : db $02 : dw $DEDE ; MDB dl $7E0911 : db $02 : dw $00F6 ; Screen X position in pixels dl $7E0913 : db $02 : dw $1C00 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $00EF ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $0171 ; Health dl $7E0AF6 : db $02 : dw $0156 ; Samus X dw #$FFFF .after preset_kpdr21_tourian_escape_parlor: dw #preset_kpdr21_tourian_climb_spark ; Tourian: Climb Spark dl $7E078D : db $02 : dw $AB34 ; DDB dl $7E079B : db $02 : dw $96BA ; MDB dl $7E079F : db $02 : dw $0000 ; Region dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers dl $7E090F : db $02 : dw $BFFF ; Screen subpixel X position. dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels dl $7E0913 : db $02 : dw $6801 ; Screen subpixel Y position dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels dl $7E09C2 : db $02 : dw $00DE ; Health dl $7E0A1C : db $02 : dw $0002 ; Samus position/state dl $7E0A1E : db $02 : dw $0004 ; More position/state dl $7E0AF6 : db $02 : dw $01DA ; Samus X dl $7E0AFA : db $02 : dw $004B ; Samus Y dl $7ED90C : db $02 : dw $FF00 ; Events, Items, Doors dw #$FFFF .after
46.062291
118
0.621991
12f1147e418c4e3f79ffb10212dda4317a72e455
375
asm
Assembly
oeis/286/A286874.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/286/A286874.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/286/A286874.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A286874: Maximal number of binary vectors of length n such that the union (or bitwise OR) of any 2 distinct vectors does not contain any other vector. ; 1,2,2,3,4,5,6,7,8,12,13,17 mov $2,$0 lpb $0 mov $3,$2 dif $3,$0 div $3,3 sub $2,$3 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 mov $4,$2 cmp $4,0 add $2,$4 div $3,$2 add $1,$3 lpe add $1,1 mov $0,$1
17.045455
152
0.592
4cd681d94ccb20de038f97d8befbd5c25d829da8
64
asm
Assembly
tests/I/ori.asm
madhav-datt/mmcpu
e252133e3fd71076596c08775b79dd8bd35135b6
[ "MIT" ]
null
null
null
tests/I/ori.asm
madhav-datt/mmcpu
e252133e3fd71076596c08775b79dd8bd35135b6
[ "MIT" ]
null
null
null
tests/I/ori.asm
madhav-datt/mmcpu
e252133e3fd71076596c08775b79dd8bd35135b6
[ "MIT" ]
null
null
null
main: addi $s0, $zero, 5 ori $t1, $s0, 4095 ori $t2, $zero, 40
21.333333
24
0.578125
074aa21978dfb78a0dfd6caea37b14f7e0b129af
2,981
asm
Assembly
out-of-boredom/that-back-door-though.asm
derp-all-day/Assorted-Fun-and-Interesting-pieces-of-code
66577e61f4fc2e3990aaf2573170bddf3a6e02ad
[ "MIT" ]
null
null
null
out-of-boredom/that-back-door-though.asm
derp-all-day/Assorted-Fun-and-Interesting-pieces-of-code
66577e61f4fc2e3990aaf2573170bddf3a6e02ad
[ "MIT" ]
null
null
null
out-of-boredom/that-back-door-though.asm
derp-all-day/Assorted-Fun-and-Interesting-pieces-of-code
66577e61f4fc2e3990aaf2573170bddf3a6e02ad
[ "MIT" ]
2
2020-10-29T08:09:00.000Z
2022-01-21T19:25:48.000Z
;com file #MAKE_COM# ;offset for DOS COM file org 100h ;clear Registers PUSH ax PUSH bx PUSH cx PUSH dx ;Macro functions PUTC MACRO char PUSH ax MOV ah,09h MOV al,char INT 10h POP ax ENDM PUTP MACRO end_char while: POP bl CMP bl,end_char JZ wend PUTC bl JMP while wend: ENDM jamie MACRO PUTC '-' PUTC 'G' PUTC 'o' PUTC 'o' PUTC 'd' PUTC 'b' PUTC 'y' PUTC 'e' ENDM POPN MACRO num,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p MOV dx,num CMP p,0 JZ SKIP_P PUSH p SUB dx,1 CMP dx,0 JZ pdone SKIP_P: CMP o,0 JZ SKIP_O PUSH o SUB dx,1 CMP dx,0 JZ pdone SKIP_O: CMP n,0 JZ SKIP_N PUSH n SUB dx,1 CMP dx,0 JZ pdone SKIP_N: CMP m,0 JZ SKIP_M PUSH m SUB dx,1 CMP dx,0 JZ pdone SKIP_M: CMP l,0 JZ SKIP_L PUSH l SUB dx,1 CMP dx,0 JZ pdone SKIP_L: CMP k,0 JZ SKIP_K PUSH k SUB dx,1 CMP dx,0 JZ pdone SKIP_K: CMP j,0 JZ SKIP_J PUSH j SUB dx,1 CMP dx,0 JZ pdone SKIP_J: CMP i,0 JZ SKIP_I PUSH i SUB dx,1 CMP dx,0 JZ pdone SKIP_I: CMP h,0 JZ SKIP_H PUSH h SUB dx,1 CMP dx,0 JZ pdone SKIP_H: CMP g,0 JZ SKIP_G PUSH g SUB dx,1 CMP dx,0 JZ pdone SKIP_G: CMP f,0 JZ SKIP_f PUSH f SUB dx,1 CMP dx,0 JZ pdone SKIP_F: CMP e,0 JZ SKIP_E PUSH e SUB dx,1 CMP dx,0 JZ pdone SKIP_E: CMP d,0 JZ SKIP_D PUSH d SUB dx,1 CMP dx,0 JZ pdone SKIP_D: CMP c,0 JZ SKIP_C PUSH c SUB dx,1 CMP dx,0 JZ pdone SKIP_C: CMP b,0 JZ SKIP_B PUSH b SUB dx,1 CMP dx,0 JZ pdone SKIP_B: CMP a,0 JZ SKIP_A PUSH a SKIP_A: pdone: ENDM ;Stacking the deck POPN 7,'I',' ','w','i','n','!','$' ;Dealing out the cards jamie PUTP '$' ; Back-Door <3 ;+-----------------+ ;| | ;| +---+ | ;| | | | ;| | o| | ;+------+---+------+ ;Cleanup POP ax POP bx POP cx POP dx ;Return Controll to the OS RET
18.288344
46
0.365985
a8ef6bc9a89049a60cc075e265854b966c5c62d6
479
asm
Assembly
oeis/052/A052982.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/052/A052982.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/052/A052982.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A052982: Expansion of ( 1-x ) / ( 1-2*x-2*x^2+x^4 ). ; Submitted by Jon Maiga ; 1,1,4,10,27,73,196,528,1421,3825,10296,27714,74599,200801,540504,1454896,3916201,10541393,28374684,76377258,205587683,553388489,1489577660,4009555040,10792677717,29051077025,78197931824,210488462658,566580111247,1525086070785 mov $1,1 mov $4,-1 lpb $0 sub $0,1 add $2,$1 add $4,1 add $3,$4 add $1,$3 add $4,$2 add $3,$4 sub $4,$3 sub $2,$4 add $3,$2 add $3,$4 lpe mov $0,$1
22.809524
227
0.668058
f6c9b15a231daaafaf2528422f28a60223859b98
92
asm
Assembly
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/cosh.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/cosh.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/cosh.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
SECTION code_fp_math32 PUBLIC _cosh EXTERN cm32_sdcc_cosh defc _cosh = cm32_sdcc_cosh
13.142857
28
0.815217
fd6f58638c430b5e0068e3c47c75da814aa4c1bb
3,326
asm
Assembly
source/binary/arithmetic.asm
paulscottrobson/BasicII
ee95caa2ee3e6649a706f977630ff629d032ba0f
[ "MIT" ]
null
null
null
source/binary/arithmetic.asm
paulscottrobson/BasicII
ee95caa2ee3e6649a706f977630ff629d032ba0f
[ "MIT" ]
null
null
null
source/binary/arithmetic.asm
paulscottrobson/BasicII
ee95caa2ee3e6649a706f977630ff629d032ba0f
[ "MIT" ]
null
null
null
; ******************************************************************************************* ; ******************************************************************************************* ; ; Name : arithmetic.asm ; Purpose : Simple binary operators ; Date : 2nd June 2019 ; Author : paul@robsons.org.uk ; ; ******************************************************************************************* ; ******************************************************************************************* ; ******************************************************************************************* ; ; 32 bit add / Concatenate strings ; ; ******************************************************************************************* Binary_Add: ;; + lda EXSPrecType+0,x ; check both same type eor EXSPrecType+2,x bmi _BATypeError lda EXSPrecType+0,x ; see if they are strings bmi _BAConcatenateString ; if so , do the concatenation code. clc lda EXSValueL+0,x adc EXSValueL+2,x sta EXSValueL+0,x lda EXSValueH+0,x adc EXSValueH+2,x sta EXSValueH+0,x rts ; _BATypeError: #error "+ operator can't mix types" ; _BALengthError: #error "String too long" ; ; String concatenation ; _BAConcatenateString: lda EXSValueL+0,x ; save pointers in DTemp1/DTemp2 sta DTemp1 lda EXSValueL+2,x sta DTemp2 sep #$20 ; switch into byte mode. clc ; work out the total length lda (DTemp1) adc (DTemp2) bcs _BAConcatLengthError ; string is too long. rep #$20 ; back to 16 bit mode. jsr StringTempAllocate ; allocate string of that size in temp memory. sta EXSValueL+0,x ; update the address stz EXSValueH+0,x lda DTemp1 ; copy first string there. jsr StringCreateCopy lda DTemp2 ; copy second string there. jsr StringCreateCopy rts _BAConcatLengthError: ; come here if len(s1)+len(s2) > 255 #error "String too long" ; ******************************************************************************************* ; ; 32 bit subtract ; ; ******************************************************************************************* Binary_Subtract: ;; - jsr CheckBothNumeric ; check both values are numeric sec lda EXSValueL+0,x sbc EXSValueL+2,x sta EXSValueL+0,x lda EXSValueH+0,x sbc EXSValueH+2,x sta EXSValueH+0,x rts ; ******************************************************************************************* ; ; Logical shift right ; ; ******************************************************************************************* Binary_ShiftRight: ;; >> jsr CheckBothNumeric ; check both values are numeric lda EXSValueL+2,x and #63 beq _Binary_SRExit _Binary_SRLoop: lsr EXSValueH+0,x ror EXSValueL+0,x dec a bne _Binary_SRLoop _Binary_SRExit: rts ; ******************************************************************************************* ; ; Logical shift left ; ; ******************************************************************************************* Binary_ShiftLeft: ;; << jsr CheckBothNumeric ; check both values are numeric lda EXSValueL+2,x and #63 beq _Binary_SLExit _Binary_SLLoop: asl EXSValueL+0,x rol EXSValueH+0,x dec a bne _Binary_SLLoop _Binary_SLExit: rts
27.487603
93
0.441672
7c7abadff9ac9cee6df5e9266d0e13cc4f835dea
96
asm
Assembly
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/mul2.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/mul2.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/mul2.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
SECTION code_fp_math32 PUBLIC _mul2 EXTERN cm32_sdcc_fsmul2 defc _mul2 = cm32_sdcc_fsmul2
13.714286
30
0.822917
0b9ba91d4bcf2823336ae59c2804651d499839f2
296
asm
Assembly
oeis/105/A105198.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/105/A105198.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/105/A105198.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A105198: a(n) = n(n+1)/2 mod 4. ; Submitted by Christian Krause ; 0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2,2,3,1,0,0,1,3,2 add $0,1 bin $0,2 mod $0,4
37
201
0.533784
bcd7cc61633896e9db5d7d3560def917676fdc30
54,333
asm
Assembly
Lab Quiz 4/160050064-labquiz4/xv6/test1.asm
vamsi3/IITB-Operating-Systems
dfe37adbb6eab69b3dbce299a1caee87acb1728f
[ "MIT" ]
6
2020-09-22T13:48:30.000Z
2022-01-28T12:21:27.000Z
Lab Quiz 4/160050064-labquiz4/xv6/test1.asm
vamsi3/IITB-Operating-Systems
dfe37adbb6eab69b3dbce299a1caee87acb1728f
[ "MIT" ]
null
null
null
Lab Quiz 4/160050064-labquiz4/xv6/test1.asm
vamsi3/IITB-Operating-Systems
dfe37adbb6eab69b3dbce299a1caee87acb1728f
[ "MIT" ]
3
2020-11-05T22:33:15.000Z
2021-03-13T21:40:39.000Z
_test1: file format elf32-i386 Disassembly of section .text: 00000000 <main>: } } 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: 56 push %esi e: 53 push %ebx f: 51 push %ecx 10: 83 ec 1c sub $0x1c,%esp int result2; int result3; int pid; int pids[NWORKERS]; init_taskmaster(); 13: e8 ba 04 00 00 call 4d2 <init_taskmaster> // Creating N worker threads for(int i=0; i<NWORKERS; i++) { pid = fork(); 18: e8 0d 04 00 00 call 42a <fork> if(pid == 0) 1d: 85 c0 test %eax,%eax 1f: 0f 84 ad 00 00 00 je d2 <main+0xd2> 25: 89 c3 mov %eax,%ebx init_taskmaster(); // Creating N worker threads for(int i=0; i<NWORKERS; i++) { pid = fork(); 27: e8 fe 03 00 00 call 42a <fork> if(pid == 0) 2c: 85 c0 test %eax,%eax init_taskmaster(); // Creating N worker threads for(int i=0; i<NWORKERS; i++) { pid = fork(); 2e: 89 c6 mov %eax,%esi if(pid == 0) 30: 0f 84 9c 00 00 00 je d2 <main+0xd2> pids[i] = pid; } // Creating 3 tasks do_task((char *)task1, 100, 10, 11); 36: 6a 0b push $0xb 38: 6a 0a push $0xa 3a: 6a 64 push $0x64 3c: 68 e0 00 00 00 push $0xe0 41: e8 94 04 00 00 call 4da <do_task> do_task((char *)task2, 101, 20, 21); 46: 6a 15 push $0x15 48: 6a 14 push $0x14 4a: 6a 65 push $0x65 4c: 68 40 01 00 00 push $0x140 51: e8 84 04 00 00 call 4da <do_task> do_task((char *)task1, 102, 30, 31); 56: 83 c4 20 add $0x20,%esp 59: 6a 1f push $0x1f 5b: 6a 1e push $0x1e 5d: 6a 66 push $0x66 5f: 68 e0 00 00 00 push $0xe0 64: e8 71 04 00 00 call 4da <do_task> // Waiting for all tasks to complete wait_for_task_to_complete(100, &result1); 69: 58 pop %eax 6a: 8d 45 dc lea -0x24(%ebp),%eax 6d: 5a pop %edx 6e: 50 push %eax 6f: 6a 64 push $0x64 71: e8 6c 04 00 00 call 4e2 <wait_for_task_to_complete> wait_for_task_to_complete(101, &result2); 76: 59 pop %ecx 77: 58 pop %eax 78: 8d 45 e0 lea -0x20(%ebp),%eax 7b: 50 push %eax 7c: 6a 65 push $0x65 7e: e8 5f 04 00 00 call 4e2 <wait_for_task_to_complete> wait_for_task_to_complete(102, &result3); 83: 58 pop %eax 84: 8d 45 e4 lea -0x1c(%ebp),%eax 87: 5a pop %edx 88: 50 push %eax 89: 6a 66 push $0x66 8b: e8 52 04 00 00 call 4e2 <wait_for_task_to_complete> sleep(100); 90: c7 04 24 64 00 00 00 movl $0x64,(%esp) 97: e8 26 04 00 00 call 4c2 <sleep> // Printing the results printf(1, "\n\nResult (100): %d. Result (101): %d. Result (102): %d. \n", result1, result2, result3); 9c: 59 pop %ecx 9d: ff 75 e4 pushl -0x1c(%ebp) a0: ff 75 e0 pushl -0x20(%ebp) a3: ff 75 dc pushl -0x24(%ebp) a6: 68 58 09 00 00 push $0x958 ab: 6a 01 push $0x1 ad: e8 ee 04 00 00 call 5a0 <printf> // Master process kills all worker processes for(int i=0; i<NWORKERS; i++) kill(pids[i]); b2: 83 c4 14 add $0x14,%esp b5: 53 push %ebx b6: e8 a7 03 00 00 call 462 <kill> bb: 89 34 24 mov %esi,(%esp) be: e8 9f 03 00 00 call 462 <kill> for(int i=0; i<NWORKERS; i++) wait(); c3: e8 72 03 00 00 call 43a <wait> c8: e8 6d 03 00 00 call 43a <wait> exit(); cd: e8 60 03 00 00 call 432 <exit> // Creating N worker threads for(int i=0; i<NWORKERS; i++) { pid = fork(); if(pid == 0) worker_thread(); d2: e8 c9 00 00 00 call 1a0 <worker_thread> d7: 66 90 xchg %ax,%ax d9: 66 90 xchg %ax,%ax db: 66 90 xchg %ax,%ax dd: 66 90 xchg %ax,%ax df: 90 nop 000000e0 <task1>: #include "user.h" #define NWORKERS 2 void task1(int id, int a, int b) { e0: 55 push %ebp e1: 89 e5 mov %esp,%ebp e3: 57 push %edi e4: 56 push %esi e5: 53 push %ebx e6: 83 ec 18 sub $0x18,%esp e9: 8b 75 08 mov 0x8(%ebp),%esi ec: 8b 7d 0c mov 0xc(%ebp),%edi int result; sleep(5); ef: 6a 05 push $0x5 #include "user.h" #define NWORKERS 2 void task1(int id, int a, int b) { f1: 8b 5d 10 mov 0x10(%ebp),%ebx int result; sleep(5); f4: e8 c9 03 00 00 call 4c2 <sleep> printf(1, "[%d] Executing task1. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); f9: e8 b4 03 00 00 call 4b2 <getpid> fe: 5a pop %edx ff: 59 pop %ecx 100: 53 push %ebx 101: 57 push %edi result = a + b; 102: 01 fb add %edi,%ebx void task1(int id, int a, int b) { int result; sleep(5); printf(1, "[%d] Executing task1. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); 104: 56 push %esi 105: 50 push %eax 106: 68 c0 08 00 00 push $0x8c0 10b: 6a 01 push $0x1 10d: e8 8e 04 00 00 call 5a0 <printf> result = a + b; sleep(300); 112: 83 c4 14 add $0x14,%esp 115: 68 2c 01 00 00 push $0x12c 11a: e8 a3 03 00 00 call 4c2 <sleep> task_ret(id, result); 11f: 89 5d 0c mov %ebx,0xc(%ebp) 122: 89 75 08 mov %esi,0x8(%ebp) 125: 83 c4 10 add $0x10,%esp } 128: 8d 65 f4 lea -0xc(%ebp),%esp 12b: 5b pop %ebx 12c: 5e pop %esi 12d: 5f pop %edi 12e: 5d pop %ebp sleep(5); printf(1, "[%d] Executing task1. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); result = a + b; sleep(300); task_ret(id, result); 12f: e9 be 03 00 00 jmp 4f2 <task_ret> 134: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 13a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000140 <task2>: } void task2(int id, int a, int b) { 140: 55 push %ebp 141: 89 e5 mov %esp,%ebp 143: 57 push %edi 144: 56 push %esi 145: 53 push %ebx 146: 83 ec 18 sub $0x18,%esp 149: 8b 75 08 mov 0x8(%ebp),%esi 14c: 8b 7d 0c mov 0xc(%ebp),%edi int result; sleep(15); 14f: 6a 0f push $0xf sleep(300); task_ret(id, result); } void task2(int id, int a, int b) { 151: 8b 5d 10 mov 0x10(%ebp),%ebx int result; sleep(15); 154: e8 69 03 00 00 call 4c2 <sleep> printf(1, "[%d] Executing task2. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); 159: e8 54 03 00 00 call 4b2 <getpid> 15e: 5a pop %edx 15f: 59 pop %ecx 160: 53 push %ebx 161: 57 push %edi 162: 56 push %esi 163: 50 push %eax 164: 68 f0 08 00 00 push $0x8f0 169: 6a 01 push $0x1 result = a * b; 16b: 0f af df imul %edi,%ebx void task2(int id, int a, int b) { int result; sleep(15); printf(1, "[%d] Executing task2. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); 16e: e8 2d 04 00 00 call 5a0 <printf> result = a * b; sleep(450); 173: 83 c4 14 add $0x14,%esp 176: 68 c2 01 00 00 push $0x1c2 17b: e8 42 03 00 00 call 4c2 <sleep> task_ret(id, result); 180: 89 5d 0c mov %ebx,0xc(%ebp) 183: 89 75 08 mov %esi,0x8(%ebp) 186: 83 c4 10 add $0x10,%esp } 189: 8d 65 f4 lea -0xc(%ebp),%esp 18c: 5b pop %ebx 18d: 5e pop %esi 18e: 5f pop %edi 18f: 5d pop %ebp printf(1, "[%d] Executing task2. ID: %d. a: %d. b: %d \n", getpid(), id, a, b); result = a * b; sleep(450); task_ret(id, result); 190: e9 5d 03 00 00 jmp 4f2 <task_ret> 195: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001a0 <worker_thread>: } void worker_thread() { 1a0: 55 push %ebp 1a1: 89 e5 mov %esp,%ebp 1a3: 56 push %esi int count = 0; 1a4: 31 f6 xor %esi,%esi sleep(450); task_ret(id, result); } void worker_thread() { 1a6: 53 push %ebx 1a7: eb 24 jmp 1cd <worker_thread+0x2d> 1a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi { ret = wait_for_task(); if(ret > 0) { count ++; printf(1, "[%d] Completed %d tasks. Last completed task ID: %d \n", getpid(), count, ret); 1b0: e8 fd 02 00 00 call 4b2 <getpid> while(1) { ret = wait_for_task(); if(ret > 0) { count ++; 1b5: 83 c6 01 add $0x1,%esi printf(1, "[%d] Completed %d tasks. Last completed task ID: %d \n", getpid(), count, ret); 1b8: 83 ec 0c sub $0xc,%esp 1bb: 53 push %ebx 1bc: 56 push %esi 1bd: 50 push %eax 1be: 68 20 09 00 00 push $0x920 1c3: 6a 01 push $0x1 1c5: e8 d6 03 00 00 call 5a0 <printf> else { printf(1, "wait for task failed \n"); exit(); } } 1ca: 83 c4 20 add $0x20,%esp int count = 0; int ret; while(1) { ret = wait_for_task(); 1cd: e8 18 03 00 00 call 4ea <wait_for_task> if(ret > 0) 1d2: 85 c0 test %eax,%eax int count = 0; int ret; while(1) { ret = wait_for_task(); 1d4: 89 c3 mov %eax,%ebx if(ret > 0) 1d6: 7f d8 jg 1b0 <worker_thread+0x10> count ++; printf(1, "[%d] Completed %d tasks. Last completed task ID: %d \n", getpid(), count, ret); } else { printf(1, "wait for task failed \n"); 1d8: 83 ec 08 sub $0x8,%esp 1db: 68 94 09 00 00 push $0x994 1e0: 6a 01 push $0x1 1e2: e8 b9 03 00 00 call 5a0 <printf> exit(); 1e7: e8 46 02 00 00 call 432 <exit> 1ec: 66 90 xchg %ax,%ax 1ee: 66 90 xchg %ax,%ax 000001f0 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 1f0: 55 push %ebp 1f1: 89 e5 mov %esp,%ebp 1f3: 53 push %ebx 1f4: 8b 45 08 mov 0x8(%ebp),%eax 1f7: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 1fa: 89 c2 mov %eax,%edx 1fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 200: 83 c1 01 add $0x1,%ecx 203: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 207: 83 c2 01 add $0x1,%edx 20a: 84 db test %bl,%bl 20c: 88 5a ff mov %bl,-0x1(%edx) 20f: 75 ef jne 200 <strcpy+0x10> ; return os; } 211: 5b pop %ebx 212: 5d pop %ebp 213: c3 ret 214: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 21a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000220 <strcmp>: int strcmp(const char *p, const char *q) { 220: 55 push %ebp 221: 89 e5 mov %esp,%ebp 223: 56 push %esi 224: 53 push %ebx 225: 8b 55 08 mov 0x8(%ebp),%edx 228: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 22b: 0f b6 02 movzbl (%edx),%eax 22e: 0f b6 19 movzbl (%ecx),%ebx 231: 84 c0 test %al,%al 233: 75 1e jne 253 <strcmp+0x33> 235: eb 29 jmp 260 <strcmp+0x40> 237: 89 f6 mov %esi,%esi 239: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 240: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 243: 0f b6 02 movzbl (%edx),%eax p++, q++; 246: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 249: 0f b6 59 01 movzbl 0x1(%ecx),%ebx 24d: 84 c0 test %al,%al 24f: 74 0f je 260 <strcmp+0x40> 251: 89 f1 mov %esi,%ecx 253: 38 d8 cmp %bl,%al 255: 74 e9 je 240 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; 257: 29 d8 sub %ebx,%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 strcmp(const char *p, const char *q) { while(*p && *p == *q) 260: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 262: 29 d8 sub %ebx,%eax } 264: 5b pop %ebx 265: 5e pop %esi 266: 5d pop %ebp 267: c3 ret 268: 90 nop 269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000270 <strlen>: uint strlen(char *s) { 270: 55 push %ebp 271: 89 e5 mov %esp,%ebp 273: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 276: 80 39 00 cmpb $0x0,(%ecx) 279: 74 12 je 28d <strlen+0x1d> 27b: 31 d2 xor %edx,%edx 27d: 8d 76 00 lea 0x0(%esi),%esi 280: 83 c2 01 add $0x1,%edx 283: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 287: 89 d0 mov %edx,%eax 289: 75 f5 jne 280 <strlen+0x10> ; return n; } 28b: 5d pop %ebp 28c: c3 ret uint strlen(char *s) { int n; for(n = 0; s[n]; n++) 28d: 31 c0 xor %eax,%eax ; return n; } 28f: 5d pop %ebp 290: c3 ret 291: eb 0d jmp 2a0 <memset> 293: 90 nop 294: 90 nop 295: 90 nop 296: 90 nop 297: 90 nop 298: 90 nop 299: 90 nop 29a: 90 nop 29b: 90 nop 29c: 90 nop 29d: 90 nop 29e: 90 nop 29f: 90 nop 000002a0 <memset>: void* memset(void *dst, int c, uint n) { 2a0: 55 push %ebp 2a1: 89 e5 mov %esp,%ebp 2a3: 57 push %edi 2a4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 2a7: 8b 4d 10 mov 0x10(%ebp),%ecx 2aa: 8b 45 0c mov 0xc(%ebp),%eax 2ad: 89 d7 mov %edx,%edi 2af: fc cld 2b0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 2b2: 89 d0 mov %edx,%eax 2b4: 5f pop %edi 2b5: 5d pop %ebp 2b6: c3 ret 2b7: 89 f6 mov %esi,%esi 2b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000002c0 <strchr>: char* strchr(const char *s, char c) { 2c0: 55 push %ebp 2c1: 89 e5 mov %esp,%ebp 2c3: 53 push %ebx 2c4: 8b 45 08 mov 0x8(%ebp),%eax 2c7: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 2ca: 0f b6 10 movzbl (%eax),%edx 2cd: 84 d2 test %dl,%dl 2cf: 74 1d je 2ee <strchr+0x2e> if(*s == c) 2d1: 38 d3 cmp %dl,%bl 2d3: 89 d9 mov %ebx,%ecx 2d5: 75 0d jne 2e4 <strchr+0x24> 2d7: eb 17 jmp 2f0 <strchr+0x30> 2d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 2e0: 38 ca cmp %cl,%dl 2e2: 74 0c je 2f0 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 2e4: 83 c0 01 add $0x1,%eax 2e7: 0f b6 10 movzbl (%eax),%edx 2ea: 84 d2 test %dl,%dl 2ec: 75 f2 jne 2e0 <strchr+0x20> if(*s == c) return (char*)s; return 0; 2ee: 31 c0 xor %eax,%eax } 2f0: 5b pop %ebx 2f1: 5d pop %ebp 2f2: c3 ret 2f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 2f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000300 <gets>: char* gets(char *buf, int max) { 300: 55 push %ebp 301: 89 e5 mov %esp,%ebp 303: 57 push %edi 304: 56 push %esi 305: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 306: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 308: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 30b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 30e: eb 29 jmp 339 <gets+0x39> cc = read(0, &c, 1); 310: 83 ec 04 sub $0x4,%esp 313: 6a 01 push $0x1 315: 57 push %edi 316: 6a 00 push $0x0 318: e8 2d 01 00 00 call 44a <read> if(cc < 1) 31d: 83 c4 10 add $0x10,%esp 320: 85 c0 test %eax,%eax 322: 7e 1d jle 341 <gets+0x41> break; buf[i++] = c; 324: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 328: 8b 55 08 mov 0x8(%ebp),%edx 32b: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 32d: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 32f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 333: 74 1b je 350 <gets+0x50> 335: 3c 0d cmp $0xd,%al 337: 74 17 je 350 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 339: 8d 5e 01 lea 0x1(%esi),%ebx 33c: 3b 5d 0c cmp 0xc(%ebp),%ebx 33f: 7c cf jl 310 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 341: 8b 45 08 mov 0x8(%ebp),%eax 344: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 348: 8d 65 f4 lea -0xc(%ebp),%esp 34b: 5b pop %ebx 34c: 5e pop %esi 34d: 5f pop %edi 34e: 5d pop %ebp 34f: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 350: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 353: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 355: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 359: 8d 65 f4 lea -0xc(%ebp),%esp 35c: 5b pop %ebx 35d: 5e pop %esi 35e: 5f pop %edi 35f: 5d pop %ebp 360: c3 ret 361: eb 0d jmp 370 <stat> 363: 90 nop 364: 90 nop 365: 90 nop 366: 90 nop 367: 90 nop 368: 90 nop 369: 90 nop 36a: 90 nop 36b: 90 nop 36c: 90 nop 36d: 90 nop 36e: 90 nop 36f: 90 nop 00000370 <stat>: int stat(char *n, struct stat *st) { 370: 55 push %ebp 371: 89 e5 mov %esp,%ebp 373: 56 push %esi 374: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 375: 83 ec 08 sub $0x8,%esp 378: 6a 00 push $0x0 37a: ff 75 08 pushl 0x8(%ebp) 37d: e8 f0 00 00 00 call 472 <open> if(fd < 0) 382: 83 c4 10 add $0x10,%esp 385: 85 c0 test %eax,%eax 387: 78 27 js 3b0 <stat+0x40> return -1; r = fstat(fd, st); 389: 83 ec 08 sub $0x8,%esp 38c: ff 75 0c pushl 0xc(%ebp) 38f: 89 c3 mov %eax,%ebx 391: 50 push %eax 392: e8 f3 00 00 00 call 48a <fstat> 397: 89 c6 mov %eax,%esi close(fd); 399: 89 1c 24 mov %ebx,(%esp) 39c: e8 b9 00 00 00 call 45a <close> return r; 3a1: 83 c4 10 add $0x10,%esp 3a4: 89 f0 mov %esi,%eax } 3a6: 8d 65 f8 lea -0x8(%ebp),%esp 3a9: 5b pop %ebx 3aa: 5e pop %esi 3ab: 5d pop %ebp 3ac: c3 ret 3ad: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 3b0: b8 ff ff ff ff mov $0xffffffff,%eax 3b5: eb ef jmp 3a6 <stat+0x36> 3b7: 89 f6 mov %esi,%esi 3b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000003c0 <atoi>: return r; } int atoi(const char *s) { 3c0: 55 push %ebp 3c1: 89 e5 mov %esp,%ebp 3c3: 53 push %ebx 3c4: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 3c7: 0f be 11 movsbl (%ecx),%edx 3ca: 8d 42 d0 lea -0x30(%edx),%eax 3cd: 3c 09 cmp $0x9,%al 3cf: b8 00 00 00 00 mov $0x0,%eax 3d4: 77 1f ja 3f5 <atoi+0x35> 3d6: 8d 76 00 lea 0x0(%esi),%esi 3d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 3e0: 8d 04 80 lea (%eax,%eax,4),%eax 3e3: 83 c1 01 add $0x1,%ecx 3e6: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 3ea: 0f be 11 movsbl (%ecx),%edx 3ed: 8d 5a d0 lea -0x30(%edx),%ebx 3f0: 80 fb 09 cmp $0x9,%bl 3f3: 76 eb jbe 3e0 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 3f5: 5b pop %ebx 3f6: 5d pop %ebp 3f7: c3 ret 3f8: 90 nop 3f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000400 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 400: 55 push %ebp 401: 89 e5 mov %esp,%ebp 403: 56 push %esi 404: 53 push %ebx 405: 8b 5d 10 mov 0x10(%ebp),%ebx 408: 8b 45 08 mov 0x8(%ebp),%eax 40b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 40e: 85 db test %ebx,%ebx 410: 7e 14 jle 426 <memmove+0x26> 412: 31 d2 xor %edx,%edx 414: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 418: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 41c: 88 0c 10 mov %cl,(%eax,%edx,1) 41f: 83 c2 01 add $0x1,%edx { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 422: 39 da cmp %ebx,%edx 424: 75 f2 jne 418 <memmove+0x18> *dst++ = *src++; return vdst; } 426: 5b pop %ebx 427: 5e pop %esi 428: 5d pop %ebp 429: c3 ret 0000042a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 42a: b8 01 00 00 00 mov $0x1,%eax 42f: cd 40 int $0x40 431: c3 ret 00000432 <exit>: SYSCALL(exit) 432: b8 02 00 00 00 mov $0x2,%eax 437: cd 40 int $0x40 439: c3 ret 0000043a <wait>: SYSCALL(wait) 43a: b8 03 00 00 00 mov $0x3,%eax 43f: cd 40 int $0x40 441: c3 ret 00000442 <pipe>: SYSCALL(pipe) 442: b8 04 00 00 00 mov $0x4,%eax 447: cd 40 int $0x40 449: c3 ret 0000044a <read>: SYSCALL(read) 44a: b8 05 00 00 00 mov $0x5,%eax 44f: cd 40 int $0x40 451: c3 ret 00000452 <write>: SYSCALL(write) 452: b8 10 00 00 00 mov $0x10,%eax 457: cd 40 int $0x40 459: c3 ret 0000045a <close>: SYSCALL(close) 45a: b8 15 00 00 00 mov $0x15,%eax 45f: cd 40 int $0x40 461: c3 ret 00000462 <kill>: SYSCALL(kill) 462: b8 06 00 00 00 mov $0x6,%eax 467: cd 40 int $0x40 469: c3 ret 0000046a <exec>: SYSCALL(exec) 46a: b8 07 00 00 00 mov $0x7,%eax 46f: cd 40 int $0x40 471: c3 ret 00000472 <open>: SYSCALL(open) 472: b8 0f 00 00 00 mov $0xf,%eax 477: cd 40 int $0x40 479: c3 ret 0000047a <mknod>: SYSCALL(mknod) 47a: b8 11 00 00 00 mov $0x11,%eax 47f: cd 40 int $0x40 481: c3 ret 00000482 <unlink>: SYSCALL(unlink) 482: b8 12 00 00 00 mov $0x12,%eax 487: cd 40 int $0x40 489: c3 ret 0000048a <fstat>: SYSCALL(fstat) 48a: b8 08 00 00 00 mov $0x8,%eax 48f: cd 40 int $0x40 491: c3 ret 00000492 <link>: SYSCALL(link) 492: b8 13 00 00 00 mov $0x13,%eax 497: cd 40 int $0x40 499: c3 ret 0000049a <mkdir>: SYSCALL(mkdir) 49a: b8 14 00 00 00 mov $0x14,%eax 49f: cd 40 int $0x40 4a1: c3 ret 000004a2 <chdir>: SYSCALL(chdir) 4a2: b8 09 00 00 00 mov $0x9,%eax 4a7: cd 40 int $0x40 4a9: c3 ret 000004aa <dup>: SYSCALL(dup) 4aa: b8 0a 00 00 00 mov $0xa,%eax 4af: cd 40 int $0x40 4b1: c3 ret 000004b2 <getpid>: SYSCALL(getpid) 4b2: b8 0b 00 00 00 mov $0xb,%eax 4b7: cd 40 int $0x40 4b9: c3 ret 000004ba <sbrk>: SYSCALL(sbrk) 4ba: b8 0c 00 00 00 mov $0xc,%eax 4bf: cd 40 int $0x40 4c1: c3 ret 000004c2 <sleep>: SYSCALL(sleep) 4c2: b8 0d 00 00 00 mov $0xd,%eax 4c7: cd 40 int $0x40 4c9: c3 ret 000004ca <uptime>: SYSCALL(uptime) 4ca: b8 0e 00 00 00 mov $0xe,%eax 4cf: cd 40 int $0x40 4d1: c3 ret 000004d2 <init_taskmaster>: #/***************** LAB QUIZ 4 *****************/ SYSCALL(init_taskmaster) 4d2: b8 16 00 00 00 mov $0x16,%eax 4d7: cd 40 int $0x40 4d9: c3 ret 000004da <do_task>: SYSCALL(do_task) 4da: b8 17 00 00 00 mov $0x17,%eax 4df: cd 40 int $0x40 4e1: c3 ret 000004e2 <wait_for_task_to_complete>: SYSCALL(wait_for_task_to_complete) 4e2: b8 18 00 00 00 mov $0x18,%eax 4e7: cd 40 int $0x40 4e9: c3 ret 000004ea <wait_for_task>: SYSCALL(wait_for_task) 4ea: b8 19 00 00 00 mov $0x19,%eax 4ef: cd 40 int $0x40 4f1: c3 ret 000004f2 <task_ret>: SYSCALL(task_ret) 4f2: b8 1a 00 00 00 mov $0x1a,%eax 4f7: cd 40 int $0x40 4f9: c3 ret 4fa: 66 90 xchg %ax,%ax 4fc: 66 90 xchg %ax,%ax 4fe: 66 90 xchg %ax,%ax 00000500 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 500: 55 push %ebp 501: 89 e5 mov %esp,%ebp 503: 57 push %edi 504: 56 push %esi 505: 53 push %ebx 506: 89 c6 mov %eax,%esi 508: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 50b: 8b 5d 08 mov 0x8(%ebp),%ebx 50e: 85 db test %ebx,%ebx 510: 74 7e je 590 <printint+0x90> 512: 89 d0 mov %edx,%eax 514: c1 e8 1f shr $0x1f,%eax 517: 84 c0 test %al,%al 519: 74 75 je 590 <printint+0x90> neg = 1; x = -xx; 51b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 51d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 524: f7 d8 neg %eax 526: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 529: 31 ff xor %edi,%edi 52b: 8d 5d d7 lea -0x29(%ebp),%ebx 52e: 89 ce mov %ecx,%esi 530: eb 08 jmp 53a <printint+0x3a> 532: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 538: 89 cf mov %ecx,%edi 53a: 31 d2 xor %edx,%edx 53c: 8d 4f 01 lea 0x1(%edi),%ecx 53f: f7 f6 div %esi 541: 0f b6 92 b4 09 00 00 movzbl 0x9b4(%edx),%edx }while((x /= base) != 0); 548: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 54a: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 54d: 75 e9 jne 538 <printint+0x38> if(neg) 54f: 8b 45 c4 mov -0x3c(%ebp),%eax 552: 8b 75 c0 mov -0x40(%ebp),%esi 555: 85 c0 test %eax,%eax 557: 74 08 je 561 <printint+0x61> buf[i++] = '-'; 559: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 55e: 8d 4f 02 lea 0x2(%edi),%ecx 561: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 565: 8d 76 00 lea 0x0(%esi),%esi 568: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 56b: 83 ec 04 sub $0x4,%esp 56e: 83 ef 01 sub $0x1,%edi 571: 6a 01 push $0x1 573: 53 push %ebx 574: 56 push %esi 575: 88 45 d7 mov %al,-0x29(%ebp) 578: e8 d5 fe ff ff call 452 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 57d: 83 c4 10 add $0x10,%esp 580: 39 df cmp %ebx,%edi 582: 75 e4 jne 568 <printint+0x68> putc(fd, buf[i]); } 584: 8d 65 f4 lea -0xc(%ebp),%esp 587: 5b pop %ebx 588: 5e pop %esi 589: 5f pop %edi 58a: 5d pop %ebp 58b: c3 ret 58c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 590: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 592: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 599: eb 8b jmp 526 <printint+0x26> 59b: 90 nop 59c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000005a0 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 5a0: 55 push %ebp 5a1: 89 e5 mov %esp,%ebp 5a3: 57 push %edi 5a4: 56 push %esi 5a5: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 5a6: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 5a9: 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++){ 5ac: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 5af: 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++){ 5b2: 89 45 d0 mov %eax,-0x30(%ebp) 5b5: 0f b6 1e movzbl (%esi),%ebx 5b8: 83 c6 01 add $0x1,%esi 5bb: 84 db test %bl,%bl 5bd: 0f 84 b0 00 00 00 je 673 <printf+0xd3> 5c3: 31 d2 xor %edx,%edx 5c5: eb 39 jmp 600 <printf+0x60> 5c7: 89 f6 mov %esi,%esi 5c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 5d0: 83 f8 25 cmp $0x25,%eax 5d3: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 5d6: 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 == '%'){ 5db: 74 18 je 5f5 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5dd: 8d 45 e2 lea -0x1e(%ebp),%eax 5e0: 83 ec 04 sub $0x4,%esp 5e3: 88 5d e2 mov %bl,-0x1e(%ebp) 5e6: 6a 01 push $0x1 5e8: 50 push %eax 5e9: 57 push %edi 5ea: e8 63 fe ff ff call 452 <write> 5ef: 8b 55 d4 mov -0x2c(%ebp),%edx 5f2: 83 c4 10 add $0x10,%esp 5f5: 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++){ 5f8: 0f b6 5e ff movzbl -0x1(%esi),%ebx 5fc: 84 db test %bl,%bl 5fe: 74 73 je 673 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 600: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 602: 0f be cb movsbl %bl,%ecx 605: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 608: 74 c6 je 5d0 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 60a: 83 fa 25 cmp $0x25,%edx 60d: 75 e6 jne 5f5 <printf+0x55> if(c == 'd'){ 60f: 83 f8 64 cmp $0x64,%eax 612: 0f 84 f8 00 00 00 je 710 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 618: 81 e1 f7 00 00 00 and $0xf7,%ecx 61e: 83 f9 70 cmp $0x70,%ecx 621: 74 5d je 680 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 623: 83 f8 73 cmp $0x73,%eax 626: 0f 84 84 00 00 00 je 6b0 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 62c: 83 f8 63 cmp $0x63,%eax 62f: 0f 84 ea 00 00 00 je 71f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 635: 83 f8 25 cmp $0x25,%eax 638: 0f 84 c2 00 00 00 je 700 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 63e: 8d 45 e7 lea -0x19(%ebp),%eax 641: 83 ec 04 sub $0x4,%esp 644: c6 45 e7 25 movb $0x25,-0x19(%ebp) 648: 6a 01 push $0x1 64a: 50 push %eax 64b: 57 push %edi 64c: e8 01 fe ff ff call 452 <write> 651: 83 c4 0c add $0xc,%esp 654: 8d 45 e6 lea -0x1a(%ebp),%eax 657: 88 5d e6 mov %bl,-0x1a(%ebp) 65a: 6a 01 push $0x1 65c: 50 push %eax 65d: 57 push %edi 65e: 83 c6 01 add $0x1,%esi 661: e8 ec fd ff ff call 452 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 666: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 66a: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 66d: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 66f: 84 db test %bl,%bl 671: 75 8d jne 600 <printf+0x60> putc(fd, c); } state = 0; } } } 673: 8d 65 f4 lea -0xc(%ebp),%esp 676: 5b pop %ebx 677: 5e pop %esi 678: 5f pop %edi 679: 5d pop %ebp 67a: c3 ret 67b: 90 nop 67c: 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); 680: 83 ec 0c sub $0xc,%esp 683: b9 10 00 00 00 mov $0x10,%ecx 688: 6a 00 push $0x0 68a: 8b 5d d0 mov -0x30(%ebp),%ebx 68d: 89 f8 mov %edi,%eax 68f: 8b 13 mov (%ebx),%edx 691: e8 6a fe ff ff call 500 <printint> ap++; 696: 89 d8 mov %ebx,%eax 698: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 69b: 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++; 69d: 83 c0 04 add $0x4,%eax 6a0: 89 45 d0 mov %eax,-0x30(%ebp) 6a3: e9 4d ff ff ff jmp 5f5 <printf+0x55> 6a8: 90 nop 6a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 6b0: 8b 45 d0 mov -0x30(%ebp),%eax 6b3: 8b 18 mov (%eax),%ebx ap++; 6b5: 83 c0 04 add $0x4,%eax 6b8: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 6bb: b8 ab 09 00 00 mov $0x9ab,%eax 6c0: 85 db test %ebx,%ebx 6c2: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 6c5: 0f b6 03 movzbl (%ebx),%eax 6c8: 84 c0 test %al,%al 6ca: 74 23 je 6ef <printf+0x14f> 6cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 6d0: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 6d3: 8d 45 e3 lea -0x1d(%ebp),%eax 6d6: 83 ec 04 sub $0x4,%esp 6d9: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 6db: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 6de: 50 push %eax 6df: 57 push %edi 6e0: e8 6d fd ff ff call 452 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 6e5: 0f b6 03 movzbl (%ebx),%eax 6e8: 83 c4 10 add $0x10,%esp 6eb: 84 c0 test %al,%al 6ed: 75 e1 jne 6d0 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 6ef: 31 d2 xor %edx,%edx 6f1: e9 ff fe ff ff jmp 5f5 <printf+0x55> 6f6: 8d 76 00 lea 0x0(%esi),%esi 6f9: 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); 700: 83 ec 04 sub $0x4,%esp 703: 88 5d e5 mov %bl,-0x1b(%ebp) 706: 8d 45 e5 lea -0x1b(%ebp),%eax 709: 6a 01 push $0x1 70b: e9 4c ff ff ff jmp 65c <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 710: 83 ec 0c sub $0xc,%esp 713: b9 0a 00 00 00 mov $0xa,%ecx 718: 6a 01 push $0x1 71a: e9 6b ff ff ff jmp 68a <printf+0xea> 71f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 722: 83 ec 04 sub $0x4,%esp 725: 8b 03 mov (%ebx),%eax 727: 6a 01 push $0x1 729: 88 45 e4 mov %al,-0x1c(%ebp) 72c: 8d 45 e4 lea -0x1c(%ebp),%eax 72f: 50 push %eax 730: 57 push %edi 731: e8 1c fd ff ff call 452 <write> 736: e9 5b ff ff ff jmp 696 <printf+0xf6> 73b: 66 90 xchg %ax,%ax 73d: 66 90 xchg %ax,%ax 73f: 90 nop 00000740 <free>: static Header base; static Header *freep; void free(void *ap) { 740: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 741: a1 cc 0c 00 00 mov 0xccc,%eax static Header base; static Header *freep; void free(void *ap) { 746: 89 e5 mov %esp,%ebp 748: 57 push %edi 749: 56 push %esi 74a: 53 push %ebx 74b: 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)) 74e: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 750: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 753: 39 c8 cmp %ecx,%eax 755: 73 19 jae 770 <free+0x30> 757: 89 f6 mov %esi,%esi 759: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 760: 39 d1 cmp %edx,%ecx 762: 72 1c jb 780 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 764: 39 d0 cmp %edx,%eax 766: 73 18 jae 780 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 768: 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) 76a: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 76c: 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) 76e: 72 f0 jb 760 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 770: 39 d0 cmp %edx,%eax 772: 72 f4 jb 768 <free+0x28> 774: 39 d1 cmp %edx,%ecx 776: 73 f0 jae 768 <free+0x28> 778: 90 nop 779: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 780: 8b 73 fc mov -0x4(%ebx),%esi 783: 8d 3c f1 lea (%ecx,%esi,8),%edi 786: 39 d7 cmp %edx,%edi 788: 74 19 je 7a3 <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; 78a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 78d: 8b 50 04 mov 0x4(%eax),%edx 790: 8d 34 d0 lea (%eax,%edx,8),%esi 793: 39 f1 cmp %esi,%ecx 795: 74 23 je 7ba <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 797: 89 08 mov %ecx,(%eax) freep = p; 799: a3 cc 0c 00 00 mov %eax,0xccc } 79e: 5b pop %ebx 79f: 5e pop %esi 7a0: 5f pop %edi 7a1: 5d pop %ebp 7a2: 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; 7a3: 03 72 04 add 0x4(%edx),%esi 7a6: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 7a9: 8b 10 mov (%eax),%edx 7ab: 8b 12 mov (%edx),%edx 7ad: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 7b0: 8b 50 04 mov 0x4(%eax),%edx 7b3: 8d 34 d0 lea (%eax,%edx,8),%esi 7b6: 39 f1 cmp %esi,%ecx 7b8: 75 dd jne 797 <free+0x57> p->s.size += bp->s.size; 7ba: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 7bd: a3 cc 0c 00 00 mov %eax,0xccc 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; 7c2: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 7c5: 8b 53 f8 mov -0x8(%ebx),%edx 7c8: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 7ca: 5b pop %ebx 7cb: 5e pop %esi 7cc: 5f pop %edi 7cd: 5d pop %ebp 7ce: c3 ret 7cf: 90 nop 000007d0 <malloc>: return freep; } void* malloc(uint nbytes) { 7d0: 55 push %ebp 7d1: 89 e5 mov %esp,%ebp 7d3: 57 push %edi 7d4: 56 push %esi 7d5: 53 push %ebx 7d6: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7d9: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 7dc: 8b 15 cc 0c 00 00 mov 0xccc,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7e2: 8d 78 07 lea 0x7(%eax),%edi 7e5: c1 ef 03 shr $0x3,%edi 7e8: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 7eb: 85 d2 test %edx,%edx 7ed: 0f 84 a3 00 00 00 je 896 <malloc+0xc6> 7f3: 8b 02 mov (%edx),%eax 7f5: 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){ 7f8: 39 cf cmp %ecx,%edi 7fa: 76 74 jbe 870 <malloc+0xa0> 7fc: 81 ff 00 10 00 00 cmp $0x1000,%edi 802: be 00 10 00 00 mov $0x1000,%esi 807: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 80e: 0f 43 f7 cmovae %edi,%esi 811: ba 00 80 00 00 mov $0x8000,%edx 816: 81 ff ff 0f 00 00 cmp $0xfff,%edi 81c: 0f 46 da cmovbe %edx,%ebx 81f: eb 10 jmp 831 <malloc+0x61> 821: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 828: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 82a: 8b 48 04 mov 0x4(%eax),%ecx 82d: 39 cf cmp %ecx,%edi 82f: 76 3f jbe 870 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 831: 39 05 cc 0c 00 00 cmp %eax,0xccc 837: 89 c2 mov %eax,%edx 839: 75 ed jne 828 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 83b: 83 ec 0c sub $0xc,%esp 83e: 53 push %ebx 83f: e8 76 fc ff ff call 4ba <sbrk> if(p == (char*)-1) 844: 83 c4 10 add $0x10,%esp 847: 83 f8 ff cmp $0xffffffff,%eax 84a: 74 1c je 868 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 84c: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 84f: 83 ec 0c sub $0xc,%esp 852: 83 c0 08 add $0x8,%eax 855: 50 push %eax 856: e8 e5 fe ff ff call 740 <free> return freep; 85b: 8b 15 cc 0c 00 00 mov 0xccc,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 861: 83 c4 10 add $0x10,%esp 864: 85 d2 test %edx,%edx 866: 75 c0 jne 828 <malloc+0x58> return 0; 868: 31 c0 xor %eax,%eax 86a: eb 1c jmp 888 <malloc+0xb8> 86c: 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) 870: 39 cf cmp %ecx,%edi 872: 74 1c je 890 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 874: 29 f9 sub %edi,%ecx 876: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 879: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 87c: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 87f: 89 15 cc 0c 00 00 mov %edx,0xccc return (void*)(p + 1); 885: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 888: 8d 65 f4 lea -0xc(%ebp),%esp 88b: 5b pop %ebx 88c: 5e pop %esi 88d: 5f pop %edi 88e: 5d pop %ebp 88f: 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; 890: 8b 08 mov (%eax),%ecx 892: 89 0a mov %ecx,(%edx) 894: eb e9 jmp 87f <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 896: c7 05 cc 0c 00 00 d0 movl $0xcd0,0xccc 89d: 0c 00 00 8a0: c7 05 d0 0c 00 00 d0 movl $0xcd0,0xcd0 8a7: 0c 00 00 base.s.size = 0; 8aa: b8 d0 0c 00 00 mov $0xcd0,%eax 8af: c7 05 d4 0c 00 00 00 movl $0x0,0xcd4 8b6: 00 00 00 8b9: e9 3e ff ff ff jmp 7fc <malloc+0x2c>
29.804169
103
0.422782
99bae348e1afa6f14c85c562e488747287bde1d6
973
asm
Assembly
Source/Assembly/stdio.asm
vitorfeliper/GGOS
7050c06b2bb9d9482bae2fa23c5deb174f636b4b
[ "MIT" ]
null
null
null
Source/Assembly/stdio.asm
vitorfeliper/GGOS
7050c06b2bb9d9482bae2fa23c5deb174f636b4b
[ "MIT" ]
null
null
null
Source/Assembly/stdio.asm
vitorfeliper/GGOS
7050c06b2bb9d9482bae2fa23c5deb174f636b4b
[ "MIT" ]
null
null
null
%define videomem 0xB800 %define textcols [0x044A] prints: %define strptr [bp +4] %define color [bp +6] push bp mov bp, sp mov si, strptr .charloop: lodsb cmp al, 0 je .end mov ah, 0Eh mov bh, 0 mov bl, color int 10h jmp .charloop .end: pop bp ret 4 printsAt: %define strptr [bp + 4] %define color [bp + 6] %define col [bp + 8] %define row [bp + 10] push bp mov bp, sp mov bx, videomem mov es, bx mov ax, row mul word textcols add ax, col shl ax, 1 mov di, ax ;mov ah, 02h ;mov bh, 0 ;mov dh, row ;mov dl, col ;int 10h ;push word color ;push word strptr ;call prints mov si, strptr .charloop: lodsb cmp al, 0 je .end mov ah, color stosw ;mov bh, 0 ;mov bl, color ;int 10h jmp .charloop .end: pop bp ret 8
15.95082
27
0.496403
ae006df35c49bda945003a07e20c85cf7f6c5860
717
asm
Assembly
libsrc/_DEVELOPMENT/l/z80/l_outi_loop.asm
ahjelm/z88dk
c4de367f39a76b41f6390ceeab77737e148178fa
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/l/z80/l_outi_loop.asm
ahjelm/z88dk
c4de367f39a76b41f6390ceeab77737e148178fa
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/l/z80/l_outi_loop.asm
ahjelm/z88dk
c4de367f39a76b41f6390ceeab77737e148178fa
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
INCLUDE "config_private.inc" IF !__CPU_RABBIT__ SECTION code_clib SECTION code_l PUBLIC l_outi_loop IF __SMS PUBLIC l_outi_loop_smc defc l_outi_loop_smc = l_outi_loop ;; smc not possible for SMS because the ;; SMS's outi block is too big ENDIF IF (__SMS = 0) && (__CLIB_OPT_UNROLL & 0x80) EXTERN l_outi_loop_smc defc l_outi_loop = l_outi_loop_smc ELSE EXTERN l_outi EXTERN l_outi_256, l_outi_128 EXTERN l_outi_64, l_outi_32, l_outi_16 l_outi_loop: ld a,b cp 16 jp c, sub_16 rla call c, l_outi_128 rla call c, l_outi_64 rla call c, l_outi_32 rla call c, l_outi_16 ret z otir ret sub_16: or a jp z, l_outi_256 otir ret ENDIF ENDIF
11.030769
44
0.700139
53c4f88b086e088b8b62fe15d9f68c7885196d2f
580
asm
Assembly
programs/oeis/084/A084556.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/084/A084556.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/084/A084556.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A084556: n occurs n! times. ; 0,1,2,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6 lpb $0,1 sub $0,1 add $1,1 div $0,$1 lpe
64.444444
501
0.505172
a8b5c9e850a6da4927995e339e0f291333781a86
6,129
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i9-9900K_12_0xa0_notsx.log_21829_1357.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i9-9900K_12_0xa0_notsx.log_21829_1357.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i9-9900K_12_0xa0_notsx.log_21829_1357.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r15 push %rbp push %rcx push %rdi push %rsi lea addresses_WC_ht+0x212f, %r10 nop nop nop nop nop add $296, %rdi mov (%r10), %r12w nop add $62357, %rsi lea addresses_WC_ht+0xb56f, %rsi nop nop nop add $4116, %r13 mov (%rsi), %r10w nop nop nop nop cmp $49340, %r13 lea addresses_A_ht+0x14279, %rsi lea addresses_UC_ht+0xda2f, %rdi clflush (%rdi) nop nop nop nop sub $47160, %rbp mov $26, %rcx rep movsq add $36675, %r10 lea addresses_WC_ht+0x1412f, %rsi nop nop nop nop nop cmp $36947, %rdi mov (%rsi), %r13d nop dec %rcx lea addresses_A_ht+0xc3af, %rsi lea addresses_UC_ht+0x1522f, %rdi and %r15, %r15 mov $97, %rcx rep movsl nop and $38926, %rcx lea addresses_UC_ht+0xf22f, %rsi lea addresses_WC_ht+0x1d1f, %rdi clflush (%rsi) nop nop nop xor %r10, %r10 mov $75, %rcx rep movsl nop nop inc %r10 lea addresses_normal_ht+0x191af, %r13 nop nop nop nop dec %rbp movw $0x6162, (%r13) nop sub %r15, %r15 lea addresses_normal_ht+0x1bc2f, %r12 nop xor $34238, %rcx movb $0x61, (%r12) add %r12, %r12 lea addresses_WC_ht+0xf62f, %r15 nop cmp %r10, %r10 mov (%r15), %r12w nop nop nop nop nop xor $24707, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r15 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r9 push %rbx push %rsi // Faulty Load lea addresses_D+0x22f, %rsi nop add %r14, %r14 movntdqa (%rsi), %xmm4 vpextrq $1, %xmm4, %r9 lea oracles, %r13 and $0xff, %r9 shlq $12, %r9 mov (%r13,%r9,1), %r9 pop %rsi pop %rbx pop %r9 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 16, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2, 'NT': True, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 8}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 9}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'} {'08': 7, '89': 1, '1d': 7, '45': 21807, '00': 7} 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 */
40.86
2,999
0.655572
4e637749759e0ea2ad262d0596c3316d6721af11
499
nasm
Assembly
SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.nasm
KaoTuz/edk2-stable202108
49d9306e7bf64b2f07d8473be1f2faea49d0a012
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "BSD-2-Clause-Patent", "BSD-3-Clause" ]
9
2021-07-26T17:02:51.000Z
2021-12-30T10:49:46.000Z
SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.nasm
ESdove/edk2_exploring
34ff32b45f43d233d9696e7c8e3de68ea3000a7b
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "BSD-2-Clause-Patent", "BSD-3-Clause" ]
null
null
null
SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.nasm
ESdove/edk2_exploring
34ff32b45f43d233d9696e7c8e3de68ea3000a7b
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "BSD-2-Clause-Patent", "BSD-3-Clause" ]
null
null
null
;------------------------------------------------------------------------------ ; ; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; IntHandler.nasm ; ; Abstract: ; ; Assembly interrupt handler function. ; ;------------------------------------------------------------------------------ global ASM_PFX(AsmInterruptHandle) DEFAULT REL SECTION .text ASM_PFX(AsmInterruptHandle): cli mov al, 1 iretq
20.791667
79
0.482966
6b364635e9a372d46213f283a8bdb40398776f26
2,181
asm
Assembly
dino/lcs/base/67C0.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
6
2020-10-14T15:29:10.000Z
2022-02-12T18:58:54.000Z
dino/lcs/base/67C0.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
null
null
null
dino/lcs/base/67C0.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
1
2020-12-17T08:59:10.000Z
2020-12-17T08:59:10.000Z
copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 0049A8 clr.w ($67c0,A5) 0049AC lea ($69b0,A5), A0 [base+67C0] 0049E2 addq.w #1, ($67c0,A5) [base+67C2] 0049E6 rts [base+67C0] 014002 move.w ($67c0,A5), D7 014006 beq $1406a [base+67C0] 01404A move.w ($67c0,A5), D7 01404E lea ($69b0,A5), A6 [base+67C0] 014072 clr.w ($67c0,A5) [base+67C2] 014076 move.l #$100, (A4)+ [base+67C0] 014EC0 move.w ($67c0,A5), D7 014EC4 beq $14f96 [base+67C0] 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAACE move.w D0, ($2,A0) 0AAAD2 cmp.l (A0), D0 0AAAD4 bne $aaafc 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
72.7
351
0.661165
df63f1948d1b244cf362cd60451ea6374a9039f4
616
asm
Assembly
mk64/autil.asm
kirbyfan64/mk64
05f056d633cdc842038aa72518a40a385f0077d7
[ "BSD-2-Clause" ]
1
2017-09-24T21:08:36.000Z
2017-09-24T21:08:36.000Z
mk64/autil.asm
refi64/mk64
05f056d633cdc842038aa72518a40a385f0077d7
[ "BSD-2-Clause" ]
null
null
null
mk64/autil.asm
refi64/mk64
05f056d633cdc842038aa72518a40a385f0077d7
[ "BSD-2-Clause" ]
null
null
null
extern interrupt$kb_handler extern io$vidptr global interrupt$inb global interrupt$outb global interrupt$keyboard_w global interrupt$generic_handler interrupt$generic_handler: iretq interrupt$keyboard_w: ; I put this here for testing while I figured out what's wrong ; it should *technically* call interrupt$kb_handler mov byte [io$vidptr], '!' mov byte [io$vidptr+1], '!' mov byte [io$vidptr+2], '!' mov byte [io$vidptr+3], '!' t: jmp t ;call interrupt$kb_handler iretq interrupt$inb: mov dx, [rsp+4] in al, dx ret interrupt$outb: mov dx, [rsp+4] mov al, [rsp+6] out dx, al ret
19.25
64
0.707792
e3d03f58faa681e03586397a67cb5e30213a2957
2,219
asm
Assembly
src/boot.asm
vzwGrey/project-akuma
8894d0a9506945cab6095341fa6c828a60517ed7
[ "MIT" ]
2
2018-08-04T21:07:33.000Z
2018-08-08T19:47:08.000Z
src/boot.asm
vzwGrey/project-akuma
8894d0a9506945cab6095341fa6c828a60517ed7
[ "MIT" ]
null
null
null
src/boot.asm
vzwGrey/project-akuma
8894d0a9506945cab6095341fa6c828a60517ed7
[ "MIT" ]
null
null
null
[bits 16] [org 0x7C00] start: xor ax, ax mov ds, ax mov es, ax ; Reset floppy controller .reset_floppy: mov dl, 0x00 ; Floppy drive mov ah, 0x00 ; Function to reset int 0x13 jnc .read_second_stage ; Carry bit set if error occured mov si, RESET_FLOPPY_ERROR_MSG call print_string_ln jmp .reset_floppy .read_second_stage: ; Second stage should be stored at 0x07E0:0x00 (ES:BX) mov bx, 0x7E00 mov ah, 0x02 ; Function to read sector mov al, 0x01 ; Read 1 sector mov ch, 0x00 ; Read from cylinder 0 mov cl, 0x02 ; Start reading from sector 2 mov dh, 0x00 ; Head number mov dl, 0x00 ; Floppy drive int 0x13 jc .read_second_stage_error ; Carry bit set if error occured cmp al, 0x01 ; Check if the amount of sectors read (AL) is really 1 jne .read_second_stage_error call main ; Jump to and execute second stage .read_second_stage_error: mov si, READ_SECOND_STAGE_ERROR_MSG call print_string_ln jmp .read_second_stage RESET_FLOPPY_ERROR_MSG: db `Failed to reset floppy controller. Trying again...`, 0 READ_SECOND_STAGE_ERROR_MSG: db `Failed to read second sector from disk. Trying again...`, 0 %include "print.asm" times 510-($-$$) db 0x00 dw 0xAA55 main: call clear_screen mov si, WELCOME_MSG call print_string_ln .command_loop: mov si, CMD_PROMPT call print_string mov si, CMD_BUFFER call get_input mov si, CMD_BUFFER mov di, INFO_CMD_NAME call string_equal jne .not_info call INFO_CMD_RUN jmp .next .not_info: mov si, CMD_BUFFER mov di, HELP_CMD_NAME call string_equal jne .not_help call HELP_CMD_RUN jmp .next .not_help: mov si, NO_SUCH_COMMAND call print_string_ln .next: jmp .command_loop cli hlt WELCOME_MSG: db `Welcome to HexadOS. Type \`help' for a list of commands.`, 0 CMD_PROMPT: db "$ ", 0 CMD_BUFFER: times 50 db 0 NO_SUCH_COMMAND: db "No such command.", 0 HELP_CMD_NAME: db "help", 0 HELP_CMD_MESSAGE: db "Available commands: help, info.", 0 HELP_CMD_RUN: mov si, HELP_CMD_MESSAGE call print_string_ln ret INFO_CMD_NAME: db "info", 0 INFO_CMD_MESSAGE: db "This is HexadOS. A simple 16-bit bootloader/operating system written in x86 assembly.", 0 INFO_CMD_RUN: mov si, INFO_CMD_MESSAGE call print_string_ln ret %include "functions.asm"
21.133333
111
0.755295
8c950a779c55316938bca416e7d54e73daf43574
8,174
asm
Assembly
demos/SicDemos/text-screen/txtwal.asm
roycrippen/sicxe
fdca37f56c95f2a76a78455f86a90e4b89329a54
[ "MIT" ]
null
null
null
demos/SicDemos/text-screen/txtwal.asm
roycrippen/sicxe
fdca37f56c95f2a76a78455f86a90e4b89329a54
[ "MIT" ]
null
null
null
demos/SicDemos/text-screen/txtwal.asm
roycrippen/sicxe
fdca37f56c95f2a76a78455f86a90e4b89329a54
[ "MIT" ]
null
null
null
... PROGRAM ... txtwal START 0 ... MAIN ........................................................................................... . A demo for SicTools text screen. It creates streams of numbers and scrolls them vertically over . the screen in a matrix-like style. . . Uses text screen, size 80x25 by default, different height supported, but note the change in label: . scrrows - should hold the number of screen rows . . Frequency increase necessary for this to work fast! Somewhere from 10^5 to 10^7 should be fine. main JSUB stinit initiate stack JSUB tsinit initiate text screen LDX #0 X = 0 setloop LDCH poslst,X load next value from poslst COMP #0xFA check for end value JEQ setend end 1st phase if found JSUB lfsr call random number generator LDA lfsrreg A = random 16bit number AND #0x7F mask it to 7bit (max = 127) COMP #79 compare to last column index JGT set2big reduce number if it is too big J setok continue if it is not . this one tends to place everything to the right, but is faster .set2big SUB #48 A -= 48 (so at most A can be 79 now) . this one places evenly, but is slower for each miss set2big JSUB lfsr call random number generator LDA lfsrreg A = random 16bit number AND #0x7F mask it to 7bit (max = 127) COMP #79 compare to last column index JGT set2big reduce number if it is too big J setok continue if it is not setok STCH poslst,X store position number ADD screen add screen coordinate STA scrpos store position number LDA #0x33 A = ascii 3 STA @scrpos write A to screen JSUB lfsr call random number generator LDA lfsrreg A = random 16bit number AND #0x0F mask it to 4bit (max = 15) STCH lenlst,X store length number LDA #1 A = 1 ADDR A,X X++ J setloop loop the setting phase ...2nd phase... setend LDX #0 done setting initial values, X = 0 runloop JSUB sscroll scroll screen LDCH lenlst,X load next value from lenlst COMP #0xFA check for end value JEQ setend restart 2nd phase COMP #0x00 check if zero yet JEQ setnew set a new value if so J decold decrease old value if not ... clear old character & set new length, position, character ... setnew LDCH poslst,X A = position ADD screen add screen coordinate STA scrpos store position number LDA #0x20 A = 0x20 (space) STA @scrpos write A to screen set2bg2 JSUB lfsr setting new position, call random number generator LDA lfsrreg A = random 8bit number AND #0x7F mask it to 7bit (max = 127) COMP #79 compare to last column index JGT set2bg3 reduce number if it is too big J newposk continue if it is not set2bg3 SUB #48 A -= 48 (so at most A can be 79 now) newposk STCH poslst,X save new position to position list JSUB lfsr making new length, call random number generator LDA lfsrreg A = random 8bit number AND #0x0F mask it to 4bit (max = 15) STCH lenlst,X store length number LDCH poslst,X A = position ADD screen add screen coordinate STA scrpos store position number .pick random number JSUB lfsr making new length, call random number generator LDA lfsrreg A = random 8bit number AND #0x07 mask it to 3bit (max = 7) ADD #0x31 mone it up to hold an ascii number from 1 to 7 .LDA #0x38 A = 0x38 (ascii 8) STA @scrpos write A to screen J runloop loop again ... decrease length and loop... decold SUB #1 A-- STCH lenlst,X store decremented A LDA #1 A = 1 ADDR A,X X++ J runloop loop again jscroll JSUB sscroll .J jscroll loop J loop END main ... FUNCTIONS ...................................................................................... ...lfsr - a simple 16bit pseudo-random number generator based on linear-feedback shift register lfsr STL @sp store L JSUB stpush sp++ STA @sp store A JSUB stpush sp++ STS @sp store S JSUB stpush sp++ STT @sp store T JSUB stpush sp++ LDS lfsrreg S = lsfrreg (starts with b01010101) RMO S,A A = S AND b16 16th bit SHIFTR A,15 move it into 1st spot RMO A,T move result to T RMO S,A A = S AND b14 14th bit SHIFTR A,13 move it into 1st spot ADDR A,T add to T RMO S,A A = S AND b13 13th bit SHIFTR A,12 move it into 1st spot ADDR A,T add to T RMO S,A A = S AND b11 11th bit SHIFTR A,10 move it into 1st spot ADDR A,T add to T RMO T,A A = T AND #1 A = the 1st bit of A SHIFTL S,1 shift value left ADDR A,S fill the 1st bit of S after shift w/ xor from 16th, 14th, 13th and 11th. STS lfsrreg store result back .J lfsr lfsrend JSUB stpop sp-- LDT @sp restore T JSUB stpop sp-- LDS @sp restore S JSUB stpop sp-- LDA @sp restore A JSUB stpop sp-- LDL @sp restore L RSUB ... SCREEN FUNCTIONS ............................................................................... ...sscroll - scroll all the text DOWN by one line to free a new line sscroll STL @sp store L JSUB stpush sp++ STA @sp store A JSUB stpush sp++ STS @sp store S JSUB stpush sp++ STT @sp store T JSUB stpush sp++ LDT tmpcur load temp cursor address STT @sp push it to save it for later JSUB stpush sp++ LDA screen A = screen RMO A,S S = screen STS curaddr curaddr = screen ADD scrcols A = screen + width RMO A,T T = screen + width STT tmpcur tmpcur = screen + width scrloop LDCH @curaddr STCH @tmpcur LDA #1 A = 1 ADDR A,S S++ STS curaddr curaddr++ ADDR A,T T++ STT tmpcur tmpcur++ LDA scrend A = scrend ADD #1 COMPR A,T check if T is at the last char yet JEQ scrlend jump to end J scrloop loop scrlend LDA scrend A = screen end SUB scrcols A = screen end - screen width ADD #1 A = screen end - screen width + 1 STA curaddr curaddr = 1st column, last row JSUB stpop sp-- LDT @sp load temp cursor address into T STT tmpcur restore temp cursor address JSUB stpop sp-- LDT @sp restore T JSUB stpop sp-- LDS @sp restore S JSUB stpop sp-- LDA @sp restore A JSUB stpop sp-- LDL @sp restore L RSUB ...tsinit - text screen variables init tsinit STL @sp store L JSUB stpush sp++ STA @sp store A JSUB stpush sp++ LDA scrcols A = scrcols MUL scrrows A = scrcols * scrrows STA scrlen scrlen = scrcols * scrrows ADD screen A = screen + scrlen SUB #1 A = screen + scrlen - 1 STA scrend scrend = screen + scrlen - 1 JSUB stpop sp-- LDA @sp restore A JSUB stpop sp-- LDL @sp restore L RSUB ... STACK FUNCTIONS ................................................................................ ...stinit stinit LDA #stack STA sp get stack pointer in place RSUB return ...stpush stpush STA tempa store A value because we need it LDA sp \ ADD #3 > sp += 3 STA sp / LDA tempa restore A value RSUB return ...stpop stpop STA tempa store A value because we need it LDA sp \ SUB #3 > sp -= 3 STA sp / LDA tempa restore A value RSUB return ... DATA ........................................................................................... number BYTE X'02050800' numbers for faculty calculation poslst BYTE X'000000000000000000000000000000000000000000000000000000000000FA' lenlst BYTE X'000000000000000000000000000000000000000000000000000000000000FA' scrpos RESW 1 andspc RESW 1 .lfsrreg WORD 85 lfsrreg WORD 41 b16 WORD 32768 16th bit b14 WORD 8192 14th bit b13 WORD 4096 13th bit b11 WORD 1024 11th bit screen WORD X'00B800' the location of screen memory mapping scrcols WORD 80 screen width (column count) scrrows WORD 25 screen height (row count) scrlen RESW 1 screen length in bytes curaddr WORD X'00B800' address where cursor points in memory tmpcur WORD X'00B800' temporary cursor address scrend RESW 1 last screen position sp RESW 1 Stack pointer (that needs to be initiated!) stack RESW 256 Stack space. tempa RESW 1 Spot for temporarily storing A.
26.538961
100
0.63335
2461fea32c3668a3209b44ae6f1542f396992697
30,640
asm
Assembly
net/testdata/JsonParser.dll.asm
lillobillo/completion
98b13efef37816d8a758f3b187a6b96b64b59171
[ "MIT", "Unlicense" ]
300
2015-01-08T00:49:27.000Z
2021-05-31T14:43:14.000Z
net/testdata/JsonParser.dll.asm
cybernetics/completion
8f534824577a6b133a7c6ec3d685f96fca3ec1fc
[ "Unlicense", "MIT" ]
16
2015-02-25T16:02:08.000Z
2019-02-14T21:37:34.000Z
net/testdata/JsonParser.dll.asm
cybernetics/completion
8f534824577a6b133a7c6ec3d685f96fca3ec1fc
[ "Unlicense", "MIT" ]
62
2015-01-05T12:27:17.000Z
2021-09-27T23:29:34.000Z
ModuleRow &{Generation:0 Name:JsonParser.dll Mvid:FA75A08B-59E8-4D4A-B10E-2114294958F4 EncId:nil EncBaseId:nil} TypeRefRow &{ResolutionScope:AssemblyRefRow[1] TypeName:NumberStyles TypeNamespace:System.Globalization} &{ResolutionScope:AssemblyRefRow[1] TypeName:IDictionary`2 TypeNamespace:System.Collections.Generic} &{ResolutionScope:AssemblyRefRow[1] TypeName:Type TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:PropertyInfo TypeNamespace:System.Reflection} &{ResolutionScope:AssemblyRefRow[1] TypeName:Exception TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:Object TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:Char TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:RuntimeHelpers TypeNamespace:System.Runtime.CompilerServices} &{ResolutionScope:AssemblyRefRow[1] TypeName:Array TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:RuntimeFieldHandle TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:Dictionary`2 TypeNamespace:System.Collections.Generic} &{ResolutionScope:AssemblyRefRow[1] TypeName:IEnumerable`1 TypeNamespace:System.Collections.Generic} &{ResolutionScope:AssemblyRefRow[1] TypeName:IEnumerator`1 TypeNamespace:System.Collections.Generic} &{ResolutionScope:AssemblyRefRow[1] TypeName:MemberInfo TypeNamespace:System.Reflection} &{ResolutionScope:AssemblyRefRow[1] TypeName:String TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:DateTime TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:RuntimeTypeHandle TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:CultureInfo TypeNamespace:System.Globalization} &{ResolutionScope:AssemblyRefRow[1] TypeName:Int32 TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:IFormatProvider TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:List`1 TypeNamespace:System.Collections.Generic} &{ResolutionScope:AssemblyRefRow[1] TypeName:Convert TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[2] TypeName:Func`2 TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[2] TypeName:Enumerable TypeNamespace:System.Linq} &{ResolutionScope:AssemblyRefRow[1] TypeName:Double TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:Int64 TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:IEnumerator TypeNamespace:System.Collections} &{ResolutionScope:AssemblyRefRow[1] TypeName:IDisposable TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:KeyValuePair`2 TypeNamespace:System.Collections.Generic} &{ResolutionScope:AssemblyRefRow[1] TypeName:StringBuilder TypeNamespace:System.Text} &{ResolutionScope:AssemblyRefRow[1] TypeName:StringComparer TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:IEqualityComparer`1 TypeNamespace:System.Collections.Generic} &{ResolutionScope:AssemblyRefRow[1] TypeName:Activator TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:BindingFlags TypeNamespace:System.Reflection} &{ResolutionScope:AssemblyRefRow[1] TypeName:IEnumerable TypeNamespace:System.Collections} &{ResolutionScope:AssemblyRefRow[1] TypeName:Boolean TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:TimeSpan TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:ICollection`1 TypeNamespace:System.Collections.Generic} &{ResolutionScope:AssemblyRefRow[1] TypeName:IList`1 TypeNamespace:System.Collections.Generic} &{ResolutionScope:AssemblyRefRow[1] TypeName:ArgumentOutOfRangeException TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:NotSupportedException TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:CompilerGeneratedAttribute TypeNamespace:System.Runtime.CompilerServices} &{ResolutionScope:AssemblyRefRow[1] TypeName:Enum TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:ValueType TypeNamespace:System} &{ResolutionScope:AssemblyRefRow[1] TypeName:RuntimeCompatibilityAttribute TypeNamespace:System.Runtime.CompilerServices} TypeDefRow &{Flags:0 TypeName:<Module> TypeNamespace: Extends:TypeDefRow[0] FieldList:FieldRow[1] MethodList:MethodDefRow[1]} &{Flags:257 TypeName:JsonToken TypeNamespace:Json Extends:TypeRefRow[43] FieldList:FieldRow[1] MethodList:MethodDefRow[1]} &{Flags:1048577 TypeName:InvalidJsonException TypeNamespace:Json Extends:TypeRefRow[5] FieldList:FieldRow[14] MethodList:MethodDefRow[1]} &{Flags:1 TypeName:JsonParser TypeNamespace:Json Extends:TypeRefRow[6] FieldList:FieldRow[14] MethodList:MethodDefRow[2]} &{Flags:1048960 TypeName:<PrivateImplementationDetails>{fa75a08b-59e8-4d4a-b10e-2114294958f4} TypeNamespace: Extends:TypeRefRow[6] FieldList:FieldRow[18] MethodList:MethodDefRow[40]} &{Flags:1048851 TypeName:$ArrayType=32 TypeNamespace: Extends:TypeRefRow[44] FieldList:FieldRow[19] MethodList:MethodDefRow[40]} FieldRow &{Flags:1542 Name:value__ Signature:Blob[1]} &{Flags:32854 Name:Unknown Signature:Blob[4]} &{Flags:32854 Name:LeftBrace Signature:Blob[4]} &{Flags:32854 Name:RightBrace Signature:Blob[4]} &{Flags:32854 Name:Colon Signature:Blob[4]} &{Flags:32854 Name:Comma Signature:Blob[4]} &{Flags:32854 Name:LeftBracket Signature:Blob[4]} &{Flags:32854 Name:RightBracket Signature:Blob[4]} &{Flags:32854 Name:String Signature:Blob[4]} &{Flags:32854 Name:Number Signature:Blob[4]} &{Flags:32854 Name:True Signature:Blob[4]} &{Flags:32854 Name:False Signature:Blob[4]} &{Flags:32854 Name:Null Signature:Blob[4]} &{Flags:32849 Name:JsonNumbers Signature:Blob[8]} &{Flags:49 Name:_cache Signature:Blob[12]} &{Flags:49 Name:_base16 Signature:Blob[23]} &{Flags:17 Name:<>f__am$cache2 Signature:Blob[566]} &{Flags:275 Name:$field-0 Signature:Blob[101]} MethodDefRow &{RVA:8272 ImplFlags:0 Flags:6278 Name:.ctor Signature:Blob[87] ParamList:ParamRow[1]} &{RVA:8281 ImplFlags:0 Flags:6278 Name:.ctor Signature:Blob[92] ParamList:ParamRow[2]} &{RVA:8292 ImplFlags:0 Flags:150 Name:Serialize Signature:Blob[701] ParamList:ParamRow[2]} &{RVA:8320 ImplFlags:0 Flags:150 Name:Deserialize Signature:Blob[717] ParamList:ParamRow[3]} &{RVA:8360 ImplFlags:0 Flags:150 Name:Deserialize Signature:Blob[740] ParamList:ParamRow[5]} &{RVA:8397 ImplFlags:0 Flags:145 Name:DeserializeImpl Signature:Blob[764] ParamList:ParamRow[6]} &{RVA:8407 ImplFlags:0 Flags:145 Name:DeserializeImpl Signature:Blob[781] ParamList:ParamRow[9]} &{RVA:8424 ImplFlags:0 Flags:145 Name:DeserializeType Signature:Blob[764] ParamList:ParamRow[12]} &{RVA:8856 ImplFlags:0 Flags:150 Name:FromJson Signature:Blob[823] ParamList:ParamRow[15]} &{RVA:8916 ImplFlags:0 Flags:150 Name:FromJson Signature:Blob[858] ParamList:ParamRow[16]} &{RVA:9000 ImplFlags:0 Flags:150 Name:ToJson Signature:Blob[881] ParamList:ParamRow[18]} &{RVA:9036 ImplFlags:0 Flags:147 Name:GetBagForObject Signature:Blob[896] ParamList:ParamRow[19]} &{RVA:9204 ImplFlags:0 Flags:147 Name:GetBagForObject Signature:Blob[929] ParamList:ParamRow[21]} &{RVA:9227 ImplFlags:0 Flags:147 Name:InitializeBag Signature:Blob[941] ParamList:ParamRow[22]} &{RVA:9240 ImplFlags:0 Flags:147 Name:PrepareInstance Signature:Blob[950] ParamList:ParamRow[22]} &{RVA:9268 ImplFlags:0 Flags:147 Name:PrepareInstance Signature:Blob[963] ParamList:ParamRow[24]} &{RVA:9320 ImplFlags:0 Flags:147 Name:CacheReflection Signature:Blob[981] ParamList:ParamRow[25]} &{RVA:9372 ImplFlags:0 Flags:147 Name:SerializeItem Signature:Blob[993] ParamList:ParamRow[26]} &{RVA:9576 ImplFlags:0 Flags:147 Name:SerializeDateTime Signature:Blob[1012] ParamList:ParamRow[28]} &{RVA:9644 ImplFlags:0 Flags:147 Name:SerializeArray Signature:Blob[1027] ParamList:ParamRow[29]} &{RVA:9808 ImplFlags:0 Flags:147 Name:SerializeObject Signature:Blob[1027] ParamList:ParamRow[31]} &{RVA:10032 ImplFlags:0 Flags:147 Name:SerializeString Signature:Blob[993] ParamList:ParamRow[33]} &{RVA:10208 ImplFlags:0 Flags:147 Name:GetUnicode Signature:Blob[1080] ParamList:ParamRow[35]} &{RVA:10300 ImplFlags:0 Flags:147 Name:ParsePair Signature:Blob[1091] ParamList:ParamRow[36]} &{RVA:10396 ImplFlags:0 Flags:147 Name:ParseToken Signature:Blob[1114] ParamList:ParamRow[38]} &{RVA:10424 ImplFlags:0 Flags:147 Name:ParseString Signature:Blob[1133] ParamList:ParamRow[41]} &{RVA:10784 ImplFlags:0 Flags:147 Name:ParseValue Signature:Blob[1160] ParamList:ParamRow[43]} &{RVA:10944 ImplFlags:0 Flags:147 Name:ParseObject Signature:Blob[1179] ParamList:ParamRow[45]} &{RVA:11256 ImplFlags:0 Flags:147 Name:ParseArray Signature:Blob[1226] ParamList:ParamRow[47]} &{RVA:11464 ImplFlags:0 Flags:147 Name:ParseNumber Signature:Blob[1160] ParamList:ParamRow[49]} &{RVA:11608 ImplFlags:0 Flags:147 Name:NextToken Signature:Blob[1271] ParamList:ParamRow[51]} &{RVA:11697 ImplFlags:0 Flags:147 Name:GetTokenFromSymbol Signature:Blob[1290] ParamList:ParamRow[53]} &{RVA:11708 ImplFlags:0 Flags:147 Name:GetTokenFromSymbol Signature:Blob[1296] ParamList:ParamRow[54]} &{RVA:11968 ImplFlags:0 Flags:147 Name:IgnoreWhitespace Signature:Blob[1308] ParamList:ParamRow[56]} &{RVA:11996 ImplFlags:0 Flags:147 Name:IgnoreWhitespace Signature:Blob[1321] ParamList:ParamRow[59]} &{RVA:12096 ImplFlags:0 Flags:147 Name:GetKeyword Signature:Blob[1338] ParamList:ParamRow[63]} &{RVA:12196 ImplFlags:0 Flags:147 Name:BaseConvert Signature:Blob[1361] ParamList:ParamRow[68]} &{RVA:12296 ImplFlags:0 Flags:6161 Name:.cctor Signature:Blob[1376] ParamList:ParamRow[71]} &{RVA:12332 ImplFlags:0 Flags:145 Name:<SerializeString>m__0 Signature:Blob[1380] ParamList:ParamRow[71]} ParamRow &{Flags:0 Sequence:1 Name:message} &{Flags:0 Sequence:1 Name:instance} &{Flags:0 Sequence:1 Name:json} &{Flags:0 Sequence:2 Name:type} &{Flags:0 Sequence:1 Name:json} &{Flags:0 Sequence:1 Name:map} &{Flags:0 Sequence:2 Name:bag} &{Flags:0 Sequence:3 Name:instance} &{Flags:0 Sequence:1 Name:map} &{Flags:0 Sequence:2 Name:bag} &{Flags:0 Sequence:3 Name:instance} &{Flags:0 Sequence:1 Name:map} &{Flags:0 Sequence:2 Name:bag} &{Flags:0 Sequence:3 Name:instance} &{Flags:0 Sequence:1 Name:json} &{Flags:0 Sequence:1 Name:json} &{Flags:2 Sequence:2 Name:type} &{Flags:0 Sequence:1 Name:bag} &{Flags:0 Sequence:1 Name:type} &{Flags:0 Sequence:2 Name:instance} &{Flags:0 Sequence:1 Name:instance} &{Flags:2 Sequence:1 Name:instance} &{Flags:0 Sequence:2 Name:type} &{Flags:2 Sequence:1 Name:instance} &{Flags:0 Sequence:1 Name:item} &{Flags:0 Sequence:1 Name:sb} &{Flags:0 Sequence:2 Name:item} &{Flags:0 Sequence:1 Name:sb} &{Flags:0 Sequence:1 Name:item} &{Flags:0 Sequence:2 Name:sb} &{Flags:0 Sequence:1 Name:item} &{Flags:0 Sequence:2 Name:sb} &{Flags:0 Sequence:1 Name:sb} &{Flags:0 Sequence:2 Name:item} &{Flags:0 Sequence:1 Name:code} &{Flags:0 Sequence:1 Name:data} &{Flags:0 Sequence:2 Name:index} &{Flags:0 Sequence:1 Name:token} &{Flags:0 Sequence:2 Name:data} &{Flags:0 Sequence:3 Name:index} &{Flags:0 Sequence:1 Name:data} &{Flags:0 Sequence:2 Name:index} &{Flags:0 Sequence:1 Name:data} &{Flags:0 Sequence:2 Name:index} &{Flags:0 Sequence:1 Name:data} &{Flags:0 Sequence:2 Name:index} &{Flags:0 Sequence:1 Name:data} &{Flags:0 Sequence:2 Name:index} &{Flags:0 Sequence:1 Name:data} &{Flags:0 Sequence:2 Name:index} &{Flags:0 Sequence:1 Name:data} &{Flags:0 Sequence:2 Name:index} &{Flags:0 Sequence:1 Name:symbol} &{Flags:0 Sequence:1 Name:symbol} &{Flags:0 Sequence:2 Name:token} &{Flags:0 Sequence:1 Name:data} &{Flags:0 Sequence:2 Name:index} &{Flags:0 Sequence:3 Name:symbol} &{Flags:0 Sequence:1 Name:data} &{Flags:0 Sequence:2 Name:index} &{Flags:0 Sequence:3 Name:token} &{Flags:0 Sequence:4 Name:symbol} &{Flags:0 Sequence:1 Name:word} &{Flags:0 Sequence:2 Name:target} &{Flags:0 Sequence:3 Name:data} &{Flags:0 Sequence:4 Name:index} &{Flags:0 Sequence:5 Name:result} &{Flags:0 Sequence:1 Name:input} &{Flags:0 Sequence:2 Name:charSet} &{Flags:0 Sequence:3 Name:minLength} &{Flags:0 Sequence:1 Name:symbol} MemberRefRow &{Class:TypeRefRow[5] Name:.ctor Signature:Blob[87]} &{Class:TypeRefRow[6] Name:.ctor Signature:Blob[92]} &{Class:TypeRefRow[8] Name:InitializeArray Signature:Blob[105]} &{Class:TypeSpecRow[1] Name:.ctor Signature:Blob[123]} &{Class:TypeSpecRow[3] Name:GetEnumerator Signature:Blob[143]} &{Class:TypeSpecRow[4] Name:get_Current Signature:Blob[159]} &{Class:TypeRefRow[14] Name:get_Name Signature:Blob[164]} &{Class:TypeSpecRow[5] Name:ContainsKey Signature:Blob[175]} &{Class:TypeRefRow[15] Name:Empty Signature:Blob[181]} &{Class:TypeRefRow[15] Name:Replace Signature:Blob[184]} &{Class:TypeSpecRow[5] Name:get_Item Signature:Blob[190]} &{Class:TypeRefRow[4] Name:get_PropertyType Signature:Blob[197]} &{Class:TypeRefRow[3] Name:GetTypeFromHandle Signature:Blob[202]} &{Class:TypeRefRow[6] Name:ToString Signature:Blob[164]} &{Class:TypeRefRow[18] Name:get_InvariantCulture Signature:Blob[209]} &{Class:TypeRefRow[19] Name:Parse Signature:Blob[214]} &{Class:TypeRefRow[16] Name:.ctor Signature:Blob[223]} &{Class:TypeRefRow[16] Name:ToUniversalTime Signature:Blob[230]} &{Class:TypeRefRow[16] Name:AddSeconds Signature:Blob[235]} &{Class:TypeRefRow[22] Name:ToByte Signature:Blob[250]} &{Class:TypeSpecRow[8] Name:.ctor Signature:Blob[262]} &{Class:TypeRefRow[24] Name:Select Signature:Blob[268]} &{Class:TypeRefRow[24] Name:ToArray Signature:Blob[297]} &{Class:TypeRefRow[22] Name:ToDouble Signature:Blob[314]} &{Class:TypeRefRow[22] Name:ToInt32 Signature:Blob[319]} &{Class:TypeRefRow[22] Name:ToInt64 Signature:Blob[324]} &{Class:TypeRefRow[4] Name:SetValue Signature:Blob[329]} &{Class:TypeRefRow[27] Name:MoveNext Signature:Blob[337]} &{Class:TypeRefRow[28] Name:Dispose Signature:Blob[92]} &{Class:TypeRefRow[24] Name:Single Signature:Blob[341]} &{Class:TypeSpecRow[9] Name:get_Value Signature:Blob[369]} &{Class:TypeRefRow[15] Name:ToCharArray Signature:Blob[374]} &{Class:TypeRefRow[30] Name:.ctor Signature:Blob[123]} &{Class:TypeRefRow[3] Name:get_FullName Signature:Blob[164]} &{Class:TypeRefRow[15] Name:Contains Signature:Blob[379]} &{Class:TypeSpecRow[10] Name:get_Item Signature:Blob[190]} &{Class:TypeRefRow[4] Name:get_CanWrite Signature:Blob[337]} &{Class:TypeRefRow[4] Name:get_CanRead Signature:Blob[337]} &{Class:TypeRefRow[4] Name:GetValue Signature:Blob[394]} &{Class:TypeSpecRow[5] Name:Add Signature:Blob[401]} &{Class:TypeRefRow[31] Name:get_OrdinalIgnoreCase Signature:Blob[409]} &{Class:TypeSpecRow[12] Name:.ctor Signature:Blob[421]} &{Class:TypeRefRow[33] Name:CreateInstance Signature:Blob[433]} &{Class:TypeRefRow[33] Name:CreateInstance Signature:Blob[439]} &{Class:TypeSpecRow[10] Name:ContainsKey Signature:Blob[175]} &{Class:TypeRefRow[3] Name:GetProperties Signature:Blob[445]} &{Class:TypeSpecRow[10] Name:Add Signature:Blob[401]} &{Class:TypeRefRow[36] Name:ToString Signature:Blob[164]} &{Class:TypeRefRow[15] Name:ToLower Signature:Blob[164]} &{Class:TypeRefRow[30] Name:Append Signature:Blob[454]} &{Class:TypeRefRow[25] Name:TryParse Signature:Blob[460]} &{Class:TypeRefRow[30] Name:Append Signature:Blob[471]} &{Class:TypeRefRow[6] Name:GetType Signature:Blob[197]} &{Class:TypeRefRow[16] Name:get_UtcNow Signature:Blob[477]} &{Class:TypeRefRow[16] Name:op_Subtraction Signature:Blob[482]} &{Class:TypeRefRow[37] Name:get_TotalSeconds Signature:Blob[492]} &{Class:TypeRefRow[24] Name:Cast Signature:Blob[496]} &{Class:TypeRefRow[24] Name:Count Signature:Blob[513]} &{Class:TypeRefRow[35] Name:GetEnumerator Signature:Blob[524]} &{Class:TypeRefRow[27] Name:get_Current Signature:Blob[529]} &{Class:TypeSpecRow[5] Name:get_Keys Signature:Blob[533]} &{Class:TypeSpecRow[14] Name:GetEnumerator Signature:Blob[143]} &{Class:TypeSpecRow[15] Name:get_Current Signature:Blob[159]} &{Class:TypeSpecRow[16] Name:get_Count Signature:Blob[562]} &{Class:TypeSpecRow[17] Name:.ctor Signature:Blob[262]} &{Class:TypeSpecRow[18] Name:.ctor Signature:Blob[262]} &{Class:TypeRefRow[15] Name:.ctor Signature:Blob[598]} &{Class:TypeRefRow[15] Name:Concat Signature:Blob[604]} &{Class:TypeRefRow[15] Name:Format Signature:Blob[610]} &{Class:TypeSpecRow[9] Name:.ctor Signature:Blob[401]} &{Class:TypeSpecRow[19] Name:get_Item Signature:Blob[623]} &{Class:TypeRefRow[30] Name:.ctor Signature:Blob[92]} &{Class:TypeSpecRow[20] Name:get_Count Signature:Blob[562]} &{Class:TypeRefRow[30] Name:Append Signature:Blob[636]} &{Class:TypeRefRow[9] Name:Copy Signature:Blob[646]} &{Class:TypeRefRow[15] Name:.ctor Signature:Blob[657]} &{Class:TypeRefRow[22] Name:ToInt32 Signature:Blob[663]} &{Class:TypeRefRow[40] Name:.ctor Signature:Blob[92]} &{Class:TypeSpecRow[12] Name:get_Count Signature:Blob[562]} &{Class:TypeRefRow[15] Name:Concat Signature:Blob[669]} &{Class:TypeSpecRow[12] Name:Add Signature:Blob[401]} &{Class:TypeSpecRow[9] Name:get_Key Signature:Blob[159]} &{Class:TypeRefRow[41] Name:.ctor Signature:Blob[87]} &{Class:TypeSpecRow[7] Name:.ctor Signature:Blob[92]} &{Class:TypeSpecRow[7] Name:Add Signature:Blob[675]} &{Class:TypeRefRow[15] Name:get_Length Signature:Blob[562]} &{Class:TypeRefRow[15] Name:get_Chars Signature:Blob[681]} &{Class:TypeRefRow[30] Name:Insert Signature:Blob[686]} &{Class:TypeRefRow[30] Name:Insert Signature:Blob[694]} &{Class:TypeRefRow[30] Name:get_Length Signature:Blob[562]} &{Class:TypeRefRow[42] Name:.ctor Signature:Blob[92]} &{Class:TypeRefRow[45] Name:.ctor Signature:Blob[92]} ConstantRow &{Type:8 Padding:0 Parent:FieldRow[2] Value:Blob[27]} &{Type:8 Padding:0 Parent:FieldRow[3] Value:Blob[32]} &{Type:8 Padding:0 Parent:FieldRow[4] Value:Blob[37]} &{Type:8 Padding:0 Parent:FieldRow[5] Value:Blob[42]} &{Type:8 Padding:0 Parent:FieldRow[6] Value:Blob[47]} &{Type:8 Padding:0 Parent:FieldRow[7] Value:Blob[52]} &{Type:8 Padding:0 Parent:FieldRow[8] Value:Blob[57]} &{Type:8 Padding:0 Parent:FieldRow[9] Value:Blob[62]} &{Type:8 Padding:0 Parent:FieldRow[10] Value:Blob[67]} &{Type:8 Padding:0 Parent:FieldRow[11] Value:Blob[72]} &{Type:8 Padding:0 Parent:FieldRow[12] Value:Blob[77]} &{Type:8 Padding:0 Parent:FieldRow[13] Value:Blob[82]} &{Type:8 Padding:0 Parent:FieldRow[14] Value:Blob[96]} CustomAttributeRow &{Parent:AssemblyRow[1] Type:MemberRefRow[92] Value:Blob[1385]} &{Parent:TypeDefRow[5] Type:MemberRefRow[91] Value:Blob[32]} &{Parent:FieldRow[17] Type:MemberRefRow[91] Value:Blob[32]} &{Parent:MethodDefRow[39] Type:MemberRefRow[91] Value:Blob[32]} ClassLayoutRow &{PackingSize:1 ClassSize:32 Parent:TypeDefRow[6]} StandAloneSigRow &{Signature:Blob[708]} &{Signature:Blob[724]} &{Signature:Blob[747]} &{Signature:Blob[800]} &{Signature:Blob[833]} &{Signature:Blob[871]} &{Signature:Blob[891]} &{Signature:Blob[908]} &{Signature:Blob[976]} &{Signature:Blob[987]} &{Signature:Blob[1000]} &{Signature:Blob[1018]} &{Signature:Blob[1034]} &{Signature:Blob[1047]} &{Signature:Blob[1064]} &{Signature:Blob[1085]} &{Signature:Blob[1108]} &{Signature:Blob[1128]} &{Signature:Blob[1145]} &{Signature:Blob[1172]} &{Signature:Blob[1196]} &{Signature:Blob[1242]} &{Signature:Blob[1261]} &{Signature:Blob[1284]} &{Signature:Blob[1304]} &{Signature:Blob[1356]} &{Signature:Blob[1369]} TypeSpecRow &{Signature:Blob[113]} &{Signature:Blob[133]} &{Signature:Blob[136]} &{Signature:Blob[152]} &{Signature:Blob[168]} &{Signature:Blob[241]} &{Signature:Blob[244]} &{Signature:Blob[255]} &{Signature:Blob[362]} &{Signature:Blob[384]} &{Signature:Blob[133]} &{Signature:Blob[414]} &{Signature:Blob[133]} &{Signature:Blob[543]} &{Signature:Blob[549]} &{Signature:Blob[555]} &{Signature:Blob[574]} &{Signature:Blob[586]} &{Signature:Blob[616]} &{Signature:Blob[629]} FieldRVARow &{RVA:24576 Field:FieldRow[18]} AssemblyRow &{HashAlgId:SHA1 MajorVersion:0 MinorVersion:0 BuildNumber:0 RevisionNumber:0 Flags:0 PublicKey:Blob[0] Name:JsonParser Culture:} AssemblyRefRow &{MajorVersion:2 MinorVersion:0 BuildNumber:0 RevisionNumber:0 Flags:0 PublicKeyOrToken:Blob[1416] Name:mscorlib Culture: HashValue:Blob[0]} &{MajorVersion:3 MinorVersion:5 BuildNumber:0 RevisionNumber:0 Flags:0 PublicKeyOrToken:Blob[1416] Name:System.Core Culture: HashValue:Blob[0]} NestedClassRow &{NestedClass:TypeDefRow[6] EnclosingClass:TypeDefRow[5]} GenericParamRow &{Number:0 Flags:0 Owner:MethodDefRow[3] Name:T} &{Number:0 Flags:0 Owner:MethodDefRow[5] Name:T} &{Number:0 Flags:0 Owner:MethodDefRow[7] Name:T} &{Number:0 Flags:0 Owner:MethodDefRow[13] Name:T} &{Number:0 Flags:0 Owner:MethodDefRow[16] Name:T} MethodSpecRow &{Method:MethodDefRow[13] Instantiation:Blob[128]} &{Method:MethodDefRow[16] Instantiation:Blob[128]} &{Method:MethodDefRow[7] Instantiation:Blob[128]} &{Method:MemberRefRow[22] Instantiation:Blob[292]} &{Method:MemberRefRow[23] Instantiation:Blob[310]} &{Method:MemberRefRow[30] Instantiation:Blob[353]} &{Method:MemberRefRow[44] Instantiation:Blob[128]} &{Method:MemberRefRow[57] Instantiation:Blob[509]} &{Method:MemberRefRow[58] Instantiation:Blob[509]} &{Method:MemberRefRow[22] Instantiation:Blob[581]} &{Method:MemberRefRow[22] Instantiation:Blob[593]} &{Method:MemberRefRow[23] Instantiation:Blob[642]} net://type/Json.JsonToken net://type/Json.InvalidJsonException net://type/Json.JsonParser public class net://type/Json.JsonToken extends net://type/System.Enum public net://type/System.Int32 value__ // net://field/Json.JsonToken;0 public static net://type/Json.JsonToken Unknown // net://field/Json.JsonToken;1 public static net://type/Json.JsonToken LeftBrace // net://field/Json.JsonToken;2 public static net://type/Json.JsonToken RightBrace // net://field/Json.JsonToken;3 public static net://type/Json.JsonToken Colon // net://field/Json.JsonToken;4 public static net://type/Json.JsonToken Comma // net://field/Json.JsonToken;5 public static net://type/Json.JsonToken LeftBracket // net://field/Json.JsonToken;6 public static net://type/Json.JsonToken RightBracket // net://field/Json.JsonToken;7 public static net://type/Json.JsonToken String // net://field/Json.JsonToken;8 public static net://type/Json.JsonToken Number // net://field/Json.JsonToken;9 public static net://type/Json.JsonToken True // net://field/Json.JsonToken;10 public static net://type/Json.JsonToken False // net://field/Json.JsonToken;11 public static net://type/Json.JsonToken Null // net://field/Json.JsonToken;12 public class net://type/Json.InvalidJsonException extends net://type/System.Exception public InvalidJsonException(net://type/System.String message) // net://method/Json.InvalidJsonException;0 public class net://type/Json.JsonParser extends net://type/System.Object private static net://type/System.Globalization.NumberStyles JsonNumbers // net://field/Json.JsonParser;0 private static net://type/System.Collections.Generic.IDictionary`2<net://type/System.Type, net://type/System.Reflection.PropertyInfo[]> _cache // net://field/Json.JsonParser;1 private static net://type/System.Char[] _base16 // net://field/Json.JsonParser;2 public JsonParser() // net://method/Json.JsonParser;0 public static net://type/System.String Serialize(T instance) // net://method/Json.JsonParser;1 public static net://type/System.Object Deserialize(net://type/System.String json, net://type/System.Type type) // net://method/Json.JsonParser;2 public static T Deserialize(net://type/System.String json) // net://method/Json.JsonParser;3 private static net://type/System.Void DeserializeImpl(net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Reflection.PropertyInfo> map, net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> bag, net://type/System.Object instance) // net://method/Json.JsonParser;4 private static net://type/System.Void DeserializeImpl(net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Reflection.PropertyInfo> map, net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> bag, T instance) // net://method/Json.JsonParser;5 private static net://type/System.Void DeserializeType(net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Reflection.PropertyInfo> map, net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> bag, net://type/System.Object instance) // net://method/Json.JsonParser;6 public static net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> FromJson(net://type/System.String json) // net://method/Json.JsonParser;7 public static net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> FromJson(net://type/System.String json, net://type/Json.JsonToken type) // net://method/Json.JsonParser;8 public static net://type/System.String ToJson(net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> bag) // net://method/Json.JsonParser;9 public static net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> GetBagForObject(net://type/System.Type type, net://type/System.Object instance) // net://method/Json.JsonParser;10 public static net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> GetBagForObject(T instance) // net://method/Json.JsonParser;11 public static net://type/System.Collections.Generic.Dictionary`2<net://type/System.String, net://type/System.Object> InitializeBag() // net://method/Json.JsonParser;12 public static net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Reflection.PropertyInfo> PrepareInstance(net://type/System.Object instance, net://type/System.Type type) // net://method/Json.JsonParser;13 public static net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Reflection.PropertyInfo> PrepareInstance(T instance) // net://method/Json.JsonParser;14 public static net://type/System.Void CacheReflection(net://type/System.Type item) // net://method/Json.JsonParser;15 public static net://type/System.Void SerializeItem(net://type/System.Text.StringBuilder sb, net://type/System.Object item) // net://method/Json.JsonParser;16 public static net://type/System.Void SerializeDateTime(net://type/System.Text.StringBuilder sb) // net://method/Json.JsonParser;17 public static net://type/System.Void SerializeArray(net://type/System.Object item, net://type/System.Text.StringBuilder sb) // net://method/Json.JsonParser;18 public static net://type/System.Void SerializeObject(net://type/System.Object item, net://type/System.Text.StringBuilder sb) // net://method/Json.JsonParser;19 public static net://type/System.Void SerializeString(net://type/System.Text.StringBuilder sb, net://type/System.Object item) // net://method/Json.JsonParser;20 public static net://type/System.String GetUnicode(net://type/System.Int32 code) // net://method/Json.JsonParser;21 public static net://type/System.Collections.Generic.KeyValuePair`2<net://type/System.String, net://type/System.Object> ParsePair(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;22 public static net://type/System.Boolean ParseToken(net://type/Json.JsonToken token, net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;23 public static net://type/System.String ParseString(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;24 public static net://type/System.Object ParseValue(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;25 public static net://type/System.Collections.Generic.IDictionary`2<net://type/System.String, net://type/System.Object> ParseObject(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;26 public static net://type/System.Collections.Generic.IEnumerable`1<net://type/System.Object> ParseArray(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;27 public static net://type/System.Object ParseNumber(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;28 public static net://type/Json.JsonToken NextToken(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index) // net://method/Json.JsonParser;29 public static net://type/Json.JsonToken GetTokenFromSymbol(net://type/System.Char symbol) // net://method/Json.JsonParser;30 public static net://type/Json.JsonToken GetTokenFromSymbol(net://type/System.Char symbol, net://type/Json.JsonToken token) // net://method/Json.JsonParser;31 public static net://type/System.Void IgnoreWhitespace(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index, net://type/System.Char symbol) // net://method/Json.JsonParser;32 public static net://type/Json.JsonToken IgnoreWhitespace(net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index, net://type/Json.JsonToken token, net://type/System.Char symbol) // net://method/Json.JsonParser;33 public static net://type/System.Void GetKeyword(net://type/System.String word, net://type/Json.JsonToken target, net://type/System.Collections.Generic.IList`1<net://type/System.Char> data, net://type/System.Int32 index, net://type/Json.JsonToken result) // net://method/Json.JsonParser;34 public static net://type/System.String BaseConvert(net://type/System.Int32 input, net://type/System.Char[] charSet, net://type/System.Int32 minLength) // net://method/Json.JsonParser;35
69.636364
333
0.757213
432da72843be96206060cdca2eca7dc03c5d7198
460
asm
Assembly
util/gut/exdelay.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
util/gut/exdelay.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
util/gut/exdelay.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
; Get system specific execution delay V1.00  2006 Marcel Kilgus section gen_util xdef gu_exdelay include 'dev8_keys_qdos_sms' include 'dev8_keys_sys' ;+++ ; Get system specific value for the delay after executing a job ; ; d0 r ticks to pause ;--- gu_exdelay movem.l d1-d2/a0,-(sp) moveq #sms.info,d0 trap #1 moveq #0,d0 move.b sys_xdly(a0),d0 bne.s xd_exit moveq #25,d0 ; default: pause .5s xd_exit movem.l (sp)+,d1-d2/a0 rts end
16.428571
67
0.695652