Metropoli BBS
VIEWER: process.s MODE: TEXT (ASCII)
	.file	"process"
gcc2_compiled.:
___gnu_compiled_c:
.globl _current_pid
.data
	.align 2
_current_pid:
	.long 1
.lcomm _inited.2,4
.text
	.align 2,0x90
_alloc_kernel_stack:
	pushl %ebp
	movl %esp,%ebp
	movl _stackp16,%eax
	addl $-1024,%eax
	movb $0,%al
	cmpl $0,_inited.2
	jne L2
	movl $1,_inited.2
	addl $-43008,%eax
	movl $14,%edx
	.align 2,0x90
L6:
	movl %eax,_kstk(,%edx,2)
	addl $6144,%eax
	addl $-2,%edx
	jns L6
L2:
	movl $_kstk,%eax
	movl $_stack_used,%edx
	movl $_kstk+28,%ecx
	.align 2,0x90
L11:
	cmpb $0,(%edx)
	jne L10
	movb $1,(%edx)
	movl (%eax),%eax
	leave
	ret
	.align 2,0x90
L10:
	addl $4,%eax
	incl %edx
	cmpl %ecx,%eax
	jle L11
	xorl %eax,%eax
	leave
	ret
	.align 2,0x90
_free_kernel_stack:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%ecx
	xorl %eax,%eax
	movl $_kstk,%edx
	.align 2,0x90
L19:
	cmpl %ecx,(%edx)
	jne L18
	movb $0,_stack_used(%eax)
	leave
	ret
	.align 2,0x90
L18:
	addl $4,%edx
	incl %eax
	cmpl $7,%eax
	jle L19
	leave
	ret
LC0:
	.ascii "\12%d -> %d, %lX -> %lX\12\0"
LC1:
	.ascii "\12pid %d kst %lX\12\0"
	.align 2,0x90
.globl _switch_context
_switch_context:
	pushl %ebp
	movl %esp,%ebp
	pushl %esi
	pushl %ebx
	movl 8(%ebp),%esi
	cmpb $0,_opt_printall
	je L23
	pushl 84(%esi)
	movl _npz,%eax
	pushl 84(%eax)
	pushl 456(%esi)
	pushl 456(%eax)
	pushl $LC0
	call _printf
	addl $20,%esp
L23:
	movl _npz,%eax
	cmpl $1,460(%eax)
	je L24
/APP
	pusha ; movl %esp, 84(%ebx)
/NO_APP
L24:
	movl %esi,_npz
	movl %esi,%ebx
	movl 56(%ebx),%eax
	cmpl %eax,552(%ebx)
	jne L25
/APP
	movl 84(%ebx), %esp
/NO_APP
	call _back_from_syscall
	jmp L26
	.align 2,0x90
L25:
/APP
	movl 84(%ebx), %esp ; popa ; nop 
/NO_APP
L26:
	cmpb $0,_opt_printall
	je L27
	movl 84(%ebx),%eax
	pushl %eax
	movl 456(%ebx),%eax
	pushl %eax
	pushl $LC1
	call _printf
L27:
	leal -8(%ebp),%esp
	popl %ebx
	popl %esi
	leave
	ret
.data
	.align 2
_last.9:
	.long _process+916
.text
LC2:
	.ascii "schedule:\0"
LC3:
	.ascii "pid = %d status = %d stack %lX\12\0"
LC4:
	.ascii "schedule: no other process found\12\0"
	.align 2,0x90
.globl _schedule
_schedule:
	pushl %ebp
	movl %esp,%ebp
	pushl %esi
	pushl %ebx
	xorl %esi,%esi
	cmpb $0,_opt_schedule
	je L46
	cmpb $0,_opt_printall
	je L30
	pushl $LC2
	call _puts
	movl $_process+916,%ebx
	addl $4,%esp
	cmpl $_process+7328,%ebx
	ja L30
	.align 2,0x90
L34:
	cmpl $0,456(%ebx)
	je L33
	pushl 84(%ebx)
	pushl 460(%ebx)
	pushl 456(%ebx)
	pushl $LC3
	call _printf
	addl $16,%esp
L33:
	addl $916,%ebx
	cmpl $_process+7328,%ebx
	jbe L34
L30:
	movl _last.9,%ebx
	cmpl $2,460(%ebx)
	jne L40
	cmpl %ebx,_npz
	jne L48
	.align 2,0x90
L40:
	addl $916,%ebx
	cmpl $_process+7328,%ebx
	jbe L39
	movl $_process+916,%ebx
L39:
	cmpl %ebx,_last.9
	je L38
	cmpl $2,460(%ebx)
	jne L40
	cmpl %ebx,_npz
	je L40
	movl $1,%esi
L38:
	testl %esi,%esi
	je L44
L48:
	movl %ebx,_last.9
	pushl %ebx
	call _switch_context
	movl $1,%eax
	jmp L47
	.align 2,0x90
L44:
	cmpb $0,_opt_printall
	je L46
	pushl $LC4
	call _printf
L46:
	xorl %eax,%eax
L47:
	leal -8(%ebp),%esp
	popl %ebx
	popl %esi
	leave
	ret
	.align 2,0x90
.globl _init_this_process
_init_this_process:
	pushl %ebp
	movl %esp,%ebp
	movl $_process+916,%eax
	cmpl $_process+7328,%eax
	ja L51
	.align 2,0x90
L53:
	movl $0,460(%eax)
	addl $916,%eax
	cmpl $_process+7328,%eax
	jbe L53
L51:
	movl $_process,_npz
	movl _current_pid,%eax
	movl %eax,_process+456
	incl _current_pid
	movl $2,_process+460
	movl $256,_process+464
	movl _stackp16,%eax
	movl %eax,_process+84
	call _init_rsx_filetab
	movl _npz,%eax
	movl $_rsx_filetab,576(%eax)
	movl $_rsx_filetab+20,580(%eax)
	movl $_rsx_filetab+40,584(%eax)
	leave
	ret
	.align 2,0x90
_find_empty_process:
	pushl %ebp
	movl %esp,%ebp
	movl $_process+916,%eax
	cmpl $_process+7328,%eax
	ja L57
	.align 2,0x90
L59:
	cmpl $0,460(%eax)
	je L62
	addl $916,%eax
	cmpl $_process+7328,%eax
	jbe L59
L57:
	xorl %eax,%eax
L62:
	leave
	ret
	.align 2,0x90
.globl _verify_illegal
_verify_illegal:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%edx
	movl 12(%ebp),%eax
	movl 16(%ebp),%ecx
	cmpb $0,464(%edx)
	jge L64
	cmpl $167,%eax
	jbe L66
L71:
	addl %ecx,%eax
	cmpl %eax,480(%edx)
	ja L67
L66:
	movl $1,%eax
	leave
	ret
	.align 2,0x90
L64:
	cmpl $4095,%eax
	jbe L66
	jmp L71
	.align 2,0x90
L67:
	xorl %eax,%eax
	leave
	ret
	.align 2,0x90
.globl _verify_illegal_write
_verify_illegal_write:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%edx
	movl 12(%ebp),%ecx
	movl %ecx,%eax
	addl 16(%ebp),%eax
	cmpl %ecx,500(%edx)
	jbe L74
	cmpl %eax,504(%edx)
	jbe L73
L74:
	xorl %eax,%eax
	leave
	ret
	.align 2,0x90
L73:
	cmpl %ecx,536(%edx)
	jbe L74
	cmpl %eax,532(%edx)
	ja L74
	cmpl %ecx,544(%edx)
	jbe L74
	cmpl %eax,548(%edx)
	ja L74
	movl $1,%eax
	leave
	ret
	.align 2,0x90
.globl _find_process
_find_process:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%edx
	movl $_process+916,%eax
	cmpl $_process+7328,%eax
	ja L82
	.align 2,0x90
L84:
	cmpl %edx,456(%eax)
	je L87
	addl $916,%eax
	cmpl $_process+7328,%eax
	jbe L84
L82:
	xorl %eax,%eax
L87:
	leave
	ret
	.align 2,0x90
.globl _sys_wait
_sys_wait:
	pushl %ebp
	movl %esp,%ebp
	pushl %esi
	pushl %ebx
	movl 8(%ebp),%esi
	movl $-1,%ebx
	.align 2,0x90
L89:
	movl $_process+7328,%ecx
	cmpl $_process+916,%ecx
	jb L93
	movl $_process+7788,%edx
	.align 2,0x90
L95:
	movl -12(%edx),%eax
	cmpl %eax,_npz
	jne L94
	testb $8,4(%edx)
	je L94
	movl 8(%edx),%eax
	movl %eax,(%esi)
	movl -4(%edx),%ebx
	andl $-9,4(%edx)
	cmpl $1,(%edx)
	jne L93
	pushl %ecx
	call _clean_processtable
	addl $4,%esp
	jmp L93
	.align 2,0x90
L94:
	addl $-916,%edx
	addl $-916,%ecx
	cmpl $_process+916,%ecx
	jae L95
L93:
	testl %ebx,%ebx
	jge L90
	movl _npz,%eax
	movl $4,460(%eax)
	call _schedule
	testl %eax,%eax
	jne L89
	movl _npz,%eax
	movl $2,460(%eax)
L90:
	movl %ebx,%eax
	leal -8(%ebp),%esp
	popl %ebx
	popl %esi
	leave
	ret
	.align 2,0x90
.globl _sys_waitpid
_sys_waitpid:
	pushl %ebp
	movl %esp,%ebp
	pushl %edi
	pushl %esi
	pushl %ebx
	movl $-1,%edi
	cmpl $-1,8(%ebp)
	jne L104
	movl $-1,%eax
	jmp L118
	.align 2,0x90
L104:
	movl $_process+7328,%esi
	cmpl $_process+916,%esi
	jb L106
	movl $_process+7788,%ebx
	.align 2,0x90
L108:
	movl 8(%ebp),%edx
	cmpl %edx,-4(%ebx)
	jne L107
	.align 2,0x90
L110:
	testb $8,4(%ebx)
	je L113
	movl 8(%ebx),%eax
	movl 12(%ebp),%edx
	movl %eax,(%edx)
	movl -4(%ebx),%edi
	andl $-9,4(%ebx)
	cmpl $1,(%ebx)
	jne L107
	pushl %esi
	call _clean_processtable
	addl $4,%esp
	jmp L107
	.align 2,0x90
L113:
	movl _npz,%eax
	movl $4,460(%eax)
	call _schedule
	testl %eax,%eax
	jne L112
	movl _npz,%eax
	movl $2,460(%eax)
	jmp L107
	.align 2,0x90
L112:
	cmpl $-1,%edi
	jne L110
L107:
	addl $-916,%ebx
	addl $-916,%esi
	cmpl $_process+916,%esi
	jae L108
L106:
	movl %edi,%eax
L118:
	leal -12(%ebp),%esp
	popl %ebx
	popl %esi
	popl %edi
	leave
	ret
	.align 2,0x90
.globl _free_process
_free_process:
	pushl %ebp
	movl %esp,%ebp
	pushl %ebx
	movl 8(%ebp),%ebx
	cmpl $0,472(%ebx)
	je L119
	pushl 484(%ebx)
	call _FreeMem
	pushl 472(%ebx)
	call _FreeLDT
	pushl 476(%ebx)
	call _FreeLDT
	movl 476(%ebx),%eax
	addl _sel_incr,%eax
	pushl %eax
	call _FreeLDT
	movl $0,472(%ebx)
	addl $16,%esp
	testb $2,465(%ebx)
	je L119
	movzwl 516(%ebx),%eax
	pushl %eax
	call _rm_close
L119:
	movl -4(%ebp),%ebx
	leave
	ret
	.align 2,0x90
.globl _clean_processtable
_clean_processtable:
	pushl %ebp
	movl %esp,%ebp
	pushl $916
	pushl $0
	pushl 8(%ebp)
	call _memset
	leave
	ret
	.align 2,0x90
_switch_to_process:
	pushl %ebp
	movl %esp,%ebp
	pushl %ebx
	movl 8(%ebp),%ebx
	movl _npz,%eax
	testb $2,464(%eax)
	je L124
	cmpb $3,_copro
	jne L125
	pushl %eax
	call _save_emu_state
	jmp L136
	.align 2,0x90
L125:
	cmpb $1,_copro
	jne L124
	movl _npz,%eax
	addl $744,%eax
	pushl %eax
	call _do_fnsave
L136:
	addl $4,%esp
L124:
	movl %ebx,_npz
	movl $0,_cbrkcall
	cmpb $3,_copro
	jne L128
	cmpl $0,744(%ebx)
	je L129
	orb $2,464(%ebx)
	pushl %ebx
	call _load_emu_state
	addl $4,%esp
L129:
	movl _npz,%eax
	testb $2,464(%eax)
	je L130
	movl 464(%eax),%eax
	andl $1,%eax
	pushl %eax
	pushl $1
	call _emu_switch
	jmp L132
	.align 2,0x90
L130:
	movl 464(%eax),%eax
	andl $1,%eax
	pushl %eax
	pushl $0
	call _emu_switch
	jmp L132
	.align 2,0x90
L128:
	cmpb $1,_copro
	jne L132
	testb $2,464(%ebx)
	je L134
	movl _npz,%eax
	addl $744,%eax
	pushl %eax
	call _do_frstor
	movl _npz,%eax
	orb $2,464(%eax)
	jmp L132
	.align 2,0x90
L134:
	call _do_fninit
L132:
	xorl %eax,%eax
	movl -4(%ebp),%ebx
	leave
	ret
	.align 2,0x90
_mk_cmdline:
	pushl %ebp
	movl %esp,%ebp
	pushl %esi
	pushl %ebx
	movl 8(%ebp),%eax
	movl 12(%ebp),%esi
	cmpl $0,(%eax)
	jne L138
	movb $13,(%esi)
	xorl %eax,%eax
	jmp L148
	.align 2,0x90
L138:
	xorl %ecx,%ecx
	movl (%eax),%edx
	testl %edx,%edx
	je L140
	movl %eax,%ebx
	jmp L149
	.align 2,0x90
	.align 2,0x90
L145:
	movb (%edx),%al
	movb %al,(%ecx,%esi)
	incl %edx
	incl %ecx
L149:
	cmpb $0,(%edx)
	jne L145
	movb $32,(%ecx,%esi)
	incl %ecx
	addl $4,%ebx
	movl (%ebx),%edx
	testl %edx,%edx
	jne L149
L140:
	decl %ecx
	movb $13,(%ecx,%esi)
	movl %ecx,%eax
L148:
	leal -8(%ebp),%esp
	popl %ebx
	popl %esi
	leave
	ret
	.align 2,0x90
.globl _execute_realmode_prg
_execute_realmode_prg:
	pushl %ebp
	movl %esp,%ebp
	subl $144,%esp
	pushl %edi
	pushl %esi
	pushl %ebx
	movl 16(%ebp),%ebx
	movl 20(%ebp),%edi
	leal -144(%ebp),%esi
	leal -142(%ebp),%eax
	pushl %eax
	movl 12(%ebp),%eax
	addl $4,%eax
	pushl %eax
	call _mk_cmdline
	incb %al
	movb %al,-144(%ebp)
	movb $32,-143(%ebp)
	movl (%ebx),%eax
	shrl $4,%eax
	movw _ds16real,%dx
	addw %ax,%dx
	movw %dx,-16(%ebp)
	movw _ds16real,%ax
	movw %ax,-12(%ebp)
	movw %si,-14(%ebp)
	movw $0,-10(%ebp)
	movw $0,-8(%ebp)
	movw $0,-6(%ebp)
	movw $0,-4(%ebp)
	leal -16(%ebp),%eax
	pushl %eax
	pushl 8(%ebp)
	call _rm_exec
	movl %eax,(%edi)
	addl $16,%esp
	cmpl $-1,%eax
	je L151
	call _rm_get_exit_status
	andl $255,%eax
	movl %eax,(%edi)
	xorl %eax,%eax
	jmp L152
	.align 2,0x90
L151:
	movl $-1,%eax
L152:
	leal -156(%ebp),%esp
	popl %ebx
	popl %esi
	popl %edi
	leave
	ret
	.align 2,0x90
.globl _realmode_prg
_realmode_prg:
	pushl %ebp
	movl %esp,%ebp
	subl $4,%esp
	pushl %edi
	pushl %esi
	pushl %ebx
	xorl %ebx,%ebx
	xorl %esi,%esi
	movl _npz,%eax
	cmpl $0,576(%eax)
	je L154
	movl 576(%eax),%eax
	cmpw $0,6(%eax)
	je L154
	pushl $0
	call _rm_dup
	movl %eax,%ebx
	pushl $0
	movl _npz,%eax
	movl 576(%eax),%eax
	movzwl 6(%eax),%eax
	pushl %eax
	call _rm_dup2
	addl $12,%esp
L154:
	movl _npz,%eax
	cmpl $0,580(%eax)
	je L155
	movl 580(%eax),%eax
	cmpw $1,6(%eax)
	je L155
	pushl $1
	call _rm_dup
	movl %eax,%esi
	pushl $1
	movl _npz,%eax
	movl 580(%eax),%eax
	movzwl 6(%eax),%eax
	pushl %eax
	call _rm_dup2
	addl $12,%esp
L155:
	leal -4(%ebp),%eax
	pushl %eax
	pushl 16(%ebp)
	pushl 12(%ebp)
	pushl 8(%ebp)
	call _execute_realmode_prg
	movl %eax,%edi
	addl $16,%esp
	testl %ebx,%ebx
	je L156
	pushl $0
	movl %ebx,%eax
	movzwl %ax,%ebx
	pushl %ebx
	call _rm_dup2
	pushl %ebx
	call _rm_close
	addl $12,%esp
L156:
	testl %esi,%esi
	je L157
	pushl $1
	movl %esi,%eax
	movzwl %ax,%ebx
	pushl %ebx
	call _rm_dup2
	pushl %ebx
	call _rm_close
	addl $12,%esp
L157:
	testl %edi,%edi
	jne L158
	movl _npz,%eax
	movzbl -4(%ebp),%edx
	movl %edx,44(%eax)
	incl _current_pid
	xorl %eax,%eax
	jmp L160
	.align 2,0x90
L158:
	pushl -4(%ebp)
	call _doserror_to_errno
L160:
	leal -16(%ebp),%esp
	popl %ebx
	popl %esi
	popl %edi
	leave
	ret
	.align 2,0x90
_copy_filedescriptors:
	pushl %ebp
	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
[ RETURN TO DIRECTORY ]