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

📄 mpx386.s

📁 Minix比较全的源码
💻 S
📖 第 1 页 / 共 2 页
字号:
	push	(_irq_handlers+4*irq)	/* irq_handlers[irq]		  */;\	call	_intr_handle		/* intr_handle(irq_handlers[irq]) */;\	pop	ecx							    ;\	cmp	(_irq_actids+4*irq), 0	/* interrupt still active?	  */;\	jz	0f							    ;\	inb	INT2_CTLMASK						    ;\	orb	al, [1<<[irq-8]]					    ;\	outb	INT2_CTLMASK		/* disable the irq		  */;\0:	movb	al, END_OF_INT						    ;\	outb	INT_CTL			/* reenable master 8259		  */;\	outb	INT2_CTL		/* reenable slave 8259		  */;\	ret				/* restart (another) process      */! Each of these entry points is an expansion of the hwint_slave macro	.align	16_hwint08:		! Interrupt routine for irq 8 (realtime clock)	hwint_slave(8)	.align	16_hwint09:		! Interrupt routine for irq 9 (irq 2 redirected)	hwint_slave(9)	.align	16_hwint10:		! Interrupt routine for irq 10	hwint_slave(10)	.align	16_hwint11:		! Interrupt routine for irq 11	hwint_slave(11)	.align	16_hwint12:		! Interrupt routine for irq 12	hwint_slave(12)	.align	16_hwint13:		! Interrupt routine for irq 13 (FPU exception)	hwint_slave(13)	.align	16_hwint14:		! Interrupt routine for irq 14 (AT winchester)	hwint_slave(14)	.align	16_hwint15:		! Interrupt routine for irq 15	hwint_slave(15)!*===========================================================================*!*				save					     *!*===========================================================================*! Save for protected mode.! This is much simpler than for 8086 mode, because the stack already points! into the process table, or has already been switched to the kernel stack.	.align	16save:	cld			! set direction flag to a known value	pushad			! save "general" registers    o16	push	ds		! save ds    o16	push	es		! save es    o16	push	fs		! save fs    o16	push	gs		! save gs	mov	dx, ss		! ss is kernel data segment	mov	ds, dx		! load rest of kernel segments	mov	es, dx		! kernel does not use fs, gs	mov	eax, esp	! prepare to return	incb	(_k_reenter)	! from -1 if not reentering	jnz	set_restart1	! stack is already kernel stack	mov	esp, k_stktop	push	_restart	! build return address for int handler	xor	ebp, ebp	! for stacktrace	jmp	RETADR-P_STACKBASE(eax)	.align	4set_restart1:	push	restart1	jmp	RETADR-P_STACKBASE(eax)!*===========================================================================*!*				_s_call					     *!*===========================================================================*	.align	16_s_call:_p_s_call:	cld			! set direction flag to a known value	sub	esp, 6*4	! skip RETADR, eax, ecx, edx, ebx, est	push	ebp		! stack already points into proc table	push	esi	push	edi    o16	push	ds    o16	push	es    o16	push	fs    o16	push	gs	mov	si, ss		! ss is kernel data segment	mov	ds, si		! load rest of kernel segments	mov	es, si		! kernel does not use fs, gs	incb	(_k_reenter)	! increment kernel entry count	mov	esi, esp	! assumes P_STACKBASE == 0	mov	esp, k_stktop	xor	ebp, ebp	! for stacktrace				! end of inline save				! now set up parameters for sys_call()	push	edx		! event set or flags bit map 	push	ebx		! pointer to user message	push	eax		! source / destination	push	ecx		! call number (ipc primitive to use)	call	_sys_call	! sys_call(call_nr, src_dst, m_ptr, bit_map)				! caller is now explicitly in proc_ptr	mov	AXREG(esi), eax	! sys_call MUST PRESERVE si! Fall into code to restart proc/task running.!*===========================================================================*!*				restart					     *!*===========================================================================*_restart:! Restart the current process or the next process if it is set. 	cmp	(_next_ptr), 0		! see if another process is scheduled	jz	0f	mov 	eax, (_next_ptr)	mov	(_proc_ptr), eax	! schedule new process 	mov	(_next_ptr), 00:	mov	esp, (_proc_ptr)	! will assume P_STACKBASE == 0	lldt	P_LDT_SEL(esp)		! enable process' segment descriptors 	lea	eax, P_STACKTOP(esp)	! arrange for next interrupt	mov	(_tss+TSS3_S_SP0), eax	! to save state in process tablerestart1:	decb	(_k_reenter)    o16	pop	gs    o16	pop	fs    o16	pop	es    o16	pop	ds	popad	add	esp, 4		! skip return adr	iretd			! continue process!*===========================================================================*!*				exception handlers			     *!*===========================================================================*_divide_error:	push	DIVIDE_VECTOR	jmp	exception_single_step_exception:	push	DEBUG_VECTOR	jmp	exception_nmi:	push	NMI_VECTOR	jmp	exception_breakpoint_exception:	push	BREAKPOINT_VECTOR	jmp	exception_overflow:	push	OVERFLOW_VECTOR	jmp	exception_bounds_check:	push	BOUNDS_VECTOR	jmp	exception_inval_opcode:	push	INVAL_OP_VECTOR	jmp	exception_copr_not_available:	push	COPROC_NOT_VECTOR	jmp	exception_double_fault:	push	DOUBLE_FAULT_VECTOR	jmp	errexception_copr_seg_overrun:	push	COPROC_SEG_VECTOR	jmp	exception_inval_tss:	push	INVAL_TSS_VECTOR	jmp	errexception_segment_not_present:	push	SEG_NOT_VECTOR	jmp	errexception_stack_exception:	push	STACK_FAULT_VECTOR	jmp	errexception_general_protection:	push	PROTECTION_VECTOR	jmp	errexception_page_fault:	push	PAGE_FAULT_VECTOR	jmp	errexception_copr_error:	push	COPROC_ERR_VECTOR	jmp	exception!*===========================================================================*!*				exception				     *!*===========================================================================*! This is called for all exceptions which do not push an error code.	.align	16exception: sseg	mov	(trap_errno), 0		! clear trap_errno sseg	pop	(ex_number)	jmp	exception1!*===========================================================================*!*				errexception				     *!*===========================================================================*! This is called for all exceptions which push an error code.	.align	16errexception: sseg	pop	(ex_number) sseg	pop	(trap_errno)exception1:				! Common for all exceptions.	push	eax			! eax is scratch register	mov	eax, 0+4(esp)		! old eip sseg	mov	(old_eip), eax	movzx	eax, 4+4(esp)		! old cs sseg	mov	(old_cs), eax	mov	eax, 8+4(esp)		! old eflags sseg	mov	(old_eflags), eax	pop	eax	call	save	push	(old_eflags)	push	(old_cs)	push	(old_eip)	push	(trap_errno)	push	(ex_number)	call	_exception		! (ex_number, trap_errno, old_eip,					!	old_cs, old_eflags)	add	esp, 5*4	ret!*===========================================================================*!*				level0_call				     *!*===========================================================================*_level0_call:	call	save	jmp	(_level0_func)!*===========================================================================*!*				data					     *!*===========================================================================*.sect .rom	! Before the string table please	.data2	0x526F		! this must be the first data entry (magic #).sect .bssk_stack:	.space	K_STACK_BYTES	! kernel stackk_stktop:			! top of kernel stack	.comm	ex_number, 4	.comm	trap_errno, 4	.comm	old_eip, 4	.comm	old_cs, 4	.comm	old_eflags, 4

⌨️ 快捷键说明

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