📄 process.s
字号:
movl %esp,%ebp
pushl %ebx
movl 8(%ebp),%ecx
movl 12(%ebp),%ebx
xorl %edx,%edx
.align 2,0x90
L165:
cmpl $0,576(%ecx,%edx,4)
je L164
movl 576(%ecx,%edx,4),%eax
movl %eax,576(%ebx,%edx,4)
incw 4(%eax)
L164:
incl %edx
cmpl $39,%edx
jle L165
movl -4(%ebp),%ebx
leave
ret
.globl _stub_info
.data
.align 2
_stub_info:
.ascii "StubInfoMagic!!\0"
.long 68
.ascii "RSX\0"
.space 12
.byte 0
.byte 98
.byte 0
.byte 4
.long 262144
.long 0
.ascii "\0"
.space 14
.byte 0
.long 0
.text
.align 2,0x90
_set_go32_info_block:
pushl %ebp
movl %esp,%ebp
movl $40,_go32_info_block
movl $720896,_go32_info_block+4
movl $753664,_go32_info_block+8
movl _ds16real,%eax
sall $4,%eax
movl %eax,%edx
addl _iobuf,%edx
addl $4096,%edx
movl %edx,_go32_info_block+12
movl $4096,_go32_info_block+16
movl $42,_go32_info_block+20
movb $8,_go32_info_block+24
movb $70,_go32_info_block+25
movw _dosmem_sel,%dx
movw %dx,_go32_info_block+26
addl $_stub_info,%eax
movl %eax,_go32_info_block+28
movl _cs16real,%ecx
sall $4,%ecx
movl %ecx,_go32_info_block+32
movw $3,_go32_info_block+36
movw $144,_go32_info_block+38
leave
ret
LC5:
.ascii "no kernel stack\0"
.align 2,0x90
.globl _exec32
_exec32:
pushl %ebp
movl %esp,%ebp
subl $4,%esp
pushl %edi
pushl %esi
pushl %ebx
movl 12(%ebp),%ebx
cmpb $0,_opt_schedule
jne L170
leal -4(%ebp),%eax
pushl %eax
call _sys_wait
addl $4,%esp
L170:
call _find_empty_process
movl %eax,%esi
testl %esi,%esi
jne L171
movl $11,%eax
jmp L197
.align 2,0x90
L171:
pushl %esi
pushl %ebx
call _load_protected_program
movl %eax,-4(%ebp)
addl $8,%esp
testl %eax,%eax
je L172
movl $0,460(%esi)
jmp L197
.align 2,0x90
L172:
call _alloc_kernel_stack
movl %eax,84(%esi)
testl %eax,%eax
jne L173
pushl $LC5
call _puts
movl $0,460(%esi)
movl $11,%eax
jmp L197
.align 2,0x90
L173:
pushl %ebx
pushl %esi
call _cpy_exename_to_stack
pushl %esi
pushl 28(%ebp)
pushl 24(%ebp)
pushl 20(%ebp)
pushl 16(%ebp)
call _argvenv
movl _current_pid,%eax
movl %eax,456(%esi)
incl _current_pid
movl _npz,%eax
movl %eax,448(%esi)
addl $28,%esp
cmpl $3,8(%ebp)
jne L174
orb $1,464(%esi)
L174:
movl 552(%esi),%eax
movl %eax,56(%esi)
movl 540(%esi),%eax
movl %eax,28(%esi)
movl 540(%esi),%ecx
addl $-12,%ecx
movl %ecx,68(%esi)
movl _dosmem_sel,%eax
sall $16,%eax
orl $28680,%eax
movl %eax,44(%esi)
movl $0,32(%esi)
movl $0,40(%esi)
movl _ds16real,%eax
sall $4,%eax
addl $_go32_info_block,%eax
movl %eax,36(%esi)
movl $0,20(%esi)
movl $0,16(%esi)
movl $0,24(%esi)
movl 472(%esi),%eax
movl %eax,60(%esi)
movl 476(%esi),%eax
movl %eax,12(%esi)
movl 476(%esi),%eax
movl %eax,8(%esi)
cmpb $0,_opt_stack
jne L176
testb $2,465(%esi)
je L175
L176:
movl 476(%esi),%eax
movl %eax,72(%esi)
jmp L177
.align 2,0x90
L175:
movl 476(%esi),%ecx
addl _sel_incr,%ecx
movl %ecx,72(%esi)
L177:
movl 476(%esi),%eax
movl %eax,4(%esi)
movl _dosmem_sel,%eax
movl %eax,(%esi)
movl $12802,64(%esi)
movl _time_tic,%eax
movl %eax,568(%esi)
movl _npz,%eax
movl %esi,452(%eax)
cmpb $0,464(%esi)
jge L178
call _set_go32_info_block
L178:
pushl %esi
pushl _npz
call _copy_filedescriptors
movl _npz,%edi
movl %esi,_npz
xorl %ebx,%ebx
addl $8,%esp
.align 2,0x90
L182:
movl %ebx,%edx
sarl $5,%edx
movl %ebx,%ecx
andl $31,%ecx
movl $1,%eax
sall %cl,%eax
testl %eax,736(%edi,%edx,4)
je L181
pushl %ebx
call _sys_close
addl $4,%esp
L181:
incl %ebx
cmpl $39,%ebx
jle L182
movl %edi,_npz
testb $1,465(%edi)
je L185
call _djio_init
movl $2,460(%esi)
pushl %esi
call _switch_context
pushl $0
call _shut_down
addl $8,%esp
L185:
cmpl $0,8(%ebp)
jne L186
movl _npz,%eax
pushl 480(%eax)
pushl 488(%eax)
call _MarkPageDemand
movl _npz,%eax
movl $3,460(%eax)
movl $2,460(%esi)
pushl %esi
call _switch_context
movl _npz,%eax
movl $2,460(%eax)
andl $-2,64(%eax)
cmpb $0,468(%esi)
je L187
movl $3,44(%eax)
jmp L189
.align 2,0x90
L187:
movzbl 469(%esi),%esi
movl %esi,44(%eax)
jmp L189
.align 2,0x90
L186:
cmpl $1,8(%ebp)
jne L190
movl $2,460(%esi)
cmpb $0,_opt_schedule
jne L191
pushl %esi
call _switch_context
L191:
movl _npz,%eax
andl $-2,64(%eax)
movl 456(%esi),%edx
movl %edx,44(%eax)
jmp L189
.align 2,0x90
L190:
cmpl $3,8(%ebp)
jne L193
movl _npz,%edx
movl 456(%esi),%eax
movl %eax,44(%edx)
movl $3,460(%esi)
jmp L189
.align 2,0x90
L193:
cmpl $2,8(%ebp)
je L195
movl $22,%eax
jmp L197
.align 2,0x90
L195:
movl _npz,%ebx
andl $-3,464(%ebx)
pushl 448(%ebx)
call _switch_to_process
pushl %ebx
call _free_process
pushl %ebx
call _clean_processtable
movl _npz,%eax
movl %esi,452(%eax)
movl %eax,448(%esi)
pushl %esi
call _switch_to_process
movl _npz,%eax
movl $2,460(%eax)
L189:
xorl %eax,%eax
L197:
leal -16(%ebp),%esp
popl %ebx
popl %esi
popl %edi
leave
ret
.align 2,0x90
.globl _sys_fork
_sys_fork:
pushl %ebp
movl %esp,%ebp
subl $8,%esp
pushl %edi
pushl %esi
pushl %ebx
call _find_empty_process
movl %eax,-4(%ebp)
testl %eax,%eax
jne L199
movl $-11,%eax
jmp L208
.align 2,0x90
L199:
movl -4(%ebp),%edi
movl _npz,%eax
movl %eax,%esi
cld
movl $229,%ecx
rep
movsl
movl -4(%ebp),%ecx
movl $0,460(%ecx)
call _alloc_kernel_stack
movl -4(%ebp),%esi
movl %eax,84(%esi)
testl %eax,%eax
jne L200
pushl $LC5
call _puts
movl $-11,%eax
jmp L208
.align 2,0x90
L200:
movl -4(%ebp),%ecx
testb $2,465(%ecx)
je L201
movl %ecx,%eax
addl $488,%eax
pushl %eax
movl %ecx,%eax
addl $484,%eax
pushl %eax
pushl $0
pushl $0
movl _npz,%eax
pushl 480(%eax)
call _AllocLinearMemory
addl $20,%esp
jmp L209
.align 2,0x90
L201:
movl -4(%ebp),%eax
addl $488,%eax
pushl %eax
movl -4(%ebp),%eax
addl $484,%eax
pushl %eax
movl _npz,%eax
pushl 480(%eax)
call _AllocMem
addl $12,%esp
L209:
testl %eax,%eax
je L203
movl $-12,%eax
jmp L208
.align 2,0x90
L203:
movl -4(%ebp),%eax
addl $472,%eax
pushl %eax
pushl $3
call _AllocLDT
addl $8,%esp
testl %eax,%eax
je L205
movl -4(%ebp),%esi
pushl 484(%esi)
call _FreeMem
movl $-5,%eax
jmp L208
.align 2,0x90
L205:
movl -4(%ebp),%ecx
movl 472(%ecx),%esi
addl _sel_incr,%esi
movl %esi,476(%ecx)
movw 476(%ecx),%bx
addw _sel_incr,%bx
pushl 488(%ecx)
pushl 472(%ecx)
call _SetBaseAddress
movl -4(%ebp),%ecx
pushl 488(%ecx)
pushl 476(%ecx)
call _SetBaseAddress
movl -4(%ebp),%esi
pushl 488(%esi)
movzwl %bx,%ebx
pushl %ebx
call _SetBaseAddress
pushl $192
pushl $250
pushl 472(%esi)
call _SetAccess
addl $36,%esp
pushl $192
pushl $242
pushl 476(%esi)
call _SetAccess
pushl $192
pushl $246
pushl %ebx
call _SetAccess
movl _npz,%eax
pushl 472(%eax)
call _lsl32
pushl %eax
pushl 472(%esi)
call _SetLimit
addl $36,%esp
movl _npz,%eax
pushl 476(%eax)
call _lsl32
pushl %eax
pushl 476(%esi)
call _SetLimit
movl _npz,%eax
movzwl 72(%eax),%eax
pushl %eax
call _lsl32
pushl %eax
pushl %ebx
call _SetLimit
movl 472(%esi),%eax
movl %eax,60(%esi)
movl 476(%esi),%eax
movl %eax,12(%esi)
movl 476(%esi),%eax
movl %eax,8(%esi)
addl $24,%esp
cmpb $0,_opt_stack
jne L206
testb $2,465(%esi)
jne L206
movl %ebx,72(%esi)
jmp L207
.align 2,0x90
L206:
movl -4(%ebp),%ecx
movl 476(%ecx),%eax
movl %eax,72(%ecx)
L207:
movl -4(%ebp),%esi
movl 476(%esi),%eax
movl %eax,4(%esi)
movl _dosmem_sel,%eax
movl %eax,(%esi)
movl _current_pid,%ebx
movl %ebx,456(%esi)
incl _current_pid
movl _npz,%edx
movl %edx,448(%esi)
movl $0,452(%esi)
movl $0,572(%esi)
movl _time_tic,%eax
movl %eax,568(%esi)
movl $0,516(%esi)
movl 56(%esi),%eax
movl %eax,552(%esi)
movl %esi,452(%edx)
pushl %esi
pushl %edx
call _copy_filedescriptors
movl _npz,%edx
movl 496(%edx),%eax
subl 492(%edx),%eax
pushl %eax
pushl 492(%esi)
movzwl 476(%esi),%eax
pushl %eax
pushl 492(%edx)
movzwl 476(%edx),%eax
pushl %eax
call _cpy32_32
movl _npz,%edx
movl 504(%edx),%eax
subl 500(%edx),%eax
pushl %eax
pushl 500(%esi)
movzwl 476(%esi),%eax
pushl %eax
pushl 500(%edx)
movzwl 476(%edx),%eax
pushl %eax
call _cpy32_32
addl $48,%esp
movl _npz,%edx
movl 548(%edx),%eax
subl 544(%edx),%eax
pushl %eax
pushl 544(%esi)
movzwl 476(%esi),%eax
pushl %eax
pushl 544(%edx)
movzwl 476(%edx),%eax
pushl %eax
call _cpy32_32
movl _npz,%edx
movl 532(%edx),%eax
subl 68(%edx),%eax
pushl %eax
movl 68(%edx),%ecx
pushl %ecx
movzwl 476(%esi),%eax
pushl %eax
pushl %ecx
movzwl 476(%edx),%eax
pushl %eax
call _cpy32_32
movl $0,40(%esi)
movl $0,44(%esi)
movl $2,460(%esi)
addl $40,%esp
pushl %esi
call _switch_context
movl %ebx,%eax
L208:
leal -20(%ebp),%esp
popl %ebx
popl %esi
popl %edi
leave
ret
LC6:
.ascii "clock: %lu ticks = %lu sec\12\0"
.align 2,0x90
.globl _shut_down
_shut_down:
pushl %ebp
movl %esp,%ebp
subl $4,%esp
pushl %ebx
movl $_process+916,%ebx
testl %ebx,%ebx
je L212
.align 2,0x90
L216:
cmpl $_process+7328,%ebx
ja L212
pushl %ebx
call _free_process
addl $4,%esp
addl $916,%ebx
jne L216
L212:
cmpb $0,_opt_printall
je L217
movl _time_tic,%eax
movl %eax,-4(%ebp)
leal (%eax,%eax,4),%eax
andl $2147483647,%eax
movl $-1274330955,%edx
mull %edx
shrl $6,%edx
movl %edx,-4(%ebp)
pushl %edx
movl _time_tic,%eax
pushl %eax
pushl $LC6
call _printf
addl $12,%esp
L217:
call _clean_up
movw 8(%ebp),%ax
andl $65535,%eax
pushl %eax
call _protected_to_real
movl -8(%ebp),%ebx
leave
ret
LC7:
.ascii "warning: memaccess pointer is not valid\0"
.align 2,0x90
.globl _getmem
_getmem:
pushl %ebp
movl %esp,%ebp
subl $12,%esp
pushl %edi
pushl %esi
pushl %ebx
movl 8(%ebp),%esi
movl 12(%ebp),%ebx
cmpl %esi,556(%ebx)
jb L219
movl 548(%ebx),%edx
movl %edx,-12(%ebp)
addl %esi,548(%ebx)
subl %esi,556(%ebx)
jmp L220
.align 2,0x90
L219:
cmpb $0,464(%ebx)
jge L221
leal 65535(%esi),%eax
movl %eax,%edi
andl $-65536,%edi
jmp L222
.align 2,0x90
L221:
leal 4095(%esi),%eax
movl %eax,%edi
andl $-4096,%edi
L222:
leal -8(%ebp),%eax
pushl %eax
leal -4(%ebp),%eax
pushl %eax
pushl 484(%ebx)
movl %edi,%eax
addl 480(%ebx),%eax
pushl %eax
call _ResizeMem
addl $16,%esp
testl %eax,%eax
je L223
movl $-1,%eax
jmp L230
.align 2,0x90
L223:
addl %edi,480(%ebx)
movl 548(%ebx),%edx
movl %edx,-12(%ebp)
addl %esi,548(%ebx)
movl %edi,%eax
subl %esi,%eax
addl %eax,556(%ebx)
cmpb $0,_opt_memaccess
jne L224
testb $1,564(%ebx)
jne L224
movl 480(%ebx),%eax
decl %eax
pushl %eax
pushl 476(%ebx)
call _SetLimit
addl $8,%esp
L224:
movl 484(%ebx),%eax
cmpl %eax,-4(%ebp)
je L225
movl -4(%ebp),%eax
movl %eax,484(%ebx)
L225:
movl 488(%ebx),%eax
cmpl %eax,-8(%ebp)
je L226
movl -8(%ebp),%eax
movl %eax,488(%ebx)
pushl %eax
pushl 472(%ebx)
call _SetBaseAddress
pushl 488(%ebx)
pushl 476(%ebx)
call _SetBaseAddress
pushl 488(%ebx)
movl 476(%ebx),%eax
addl _sel_incr,%eax
pushl %eax
call _SetBaseAddress
addl $24,%esp
cmpb $0,_opt_memaccess
je L226
cmpb $0,_opt_printall
je L226
pushl $LC7
call _puts
addl $4,%esp
L226:
cmpb $0,464(%ebx)
jl L229
cmpb $0,_opt_zero
je L220
L229:
pushl %edi
pushl -12(%ebp)
movzwl 476(%ebx),%eax
pushl %eax
call _bzero32
L220:
movl -12(%ebp),%eax
L230:
leal -24(%ebp),%esp
popl %ebx
popl %esi
popl %edi
leave
ret
LC8:
.ascii "RSX: end of do_exit4c() should never reached\0"
.align 2,0x90
.globl _do_exit4c
_do_exit4c:
pushl %ebp
movl %esp,%ebp
pushl %edi
pushl %esi
pushl %ebx
movl 8(%ebp),%edi
movl _npz,%eax
movzbl 44(%eax),%esi
xorl %ebx,%ebx
.align 2,0x90
L235:
movl _npz,%eax
cmpl $0,576(%eax,%ebx,4)
je L234
pushl %ebx
call _sys_close
addl $4,%esp
L234:
incl %ebx
cmpl $40,%ebx
jle L235
movl _npz,%eax
movl 448(%eax),%ebx
testl %edi,%edi
je L238
movl %edi,468(%eax)
jmp L239
.align 2,0x90
L238:
movl %esi,%edx
sall $8,%edx
movl %edx,468(%eax)
L239:
movl _npz,%eax
movl $1,460(%eax)
orb $8,464(%eax)
andl $-3,464(%eax)
pushl %eax
call _free_process
movl _npz,%eax
pushl 84(%eax)
call _free_kernel_stack
addl $8,%esp
testb $1,465(%ebx)
je L240
pushl %esi
call _shut_down
addl $4,%esp
L240:
cmpl $4,460(%ebx)
jne L241
movl $2,460(%ebx)
L241:
pushl $18
pushl %ebx
call _send_signal
pushl %ebx
call _switch_context
pushl $LC8
call _puts
pushl $0
call _shut_down
xorl %eax,%eax
leal -12(%ebp),%esp
popl %ebx
popl %esi
popl %edi
leave
ret
.comm _process,8244
.comm _npz,4
.lcomm _stack_used,8
.lcomm _kstk,32
.comm _go32_info_block,40
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -