⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 process.s

📁 大量的汇编程序源代码
💻 S
📖 第 1 页 / 共 2 页
字号:
	.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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -