ctxsw.s

来自「TCP-IP红宝书源代码」· S 代码 · 共 36 行

S
36
字号
/* ctxsw.s - ctxsw */

		.text
		.globl	_ctxsw
newmask:	.word	0

/*------------------------------------------------------------------------
 * ctxsw -  call is ctxsw(&oldsp, &oldmask, &newsp, &newmask)
 *------------------------------------------------------------------------
 */
_ctxsw:
		pushl	%ebp
		movl	%esp,%ebp

		pushl	12(%ebp)
		call	_disable
		movl	20(%ebp),%eax
		movw	(%eax),%dx
		movw	%dx,newmask
		pushfl			/* save flags */
		pushal			/* save general regs */
		/* save segment registers here, if multiple allowed */
		movl	8(%ebp),%eax
		movl	%esp,(%eax)	/* save old SP */

		movl	16(%ebp),%eax
		movl	(%eax),%esp	/* restore new SP */
		/* restore new segment registers here, if multiple allowed */
		popal			/* restore general registers */
		popfl			/* restore flags */
		pushl	$newmask
		call	_restore
		leave
		ret

⌨️ 快捷键说明

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