setjmp.asm

来自「gerneral os development」· 汇编 代码 · 共 36 行

ASM
36
字号
%include "asm.inc"SECTION .textEXP setjmp	push ebx		mov ebx,[8 + esp]		mov [0 + ebx],edi	; buf->edi == 0(ebx) == EDI		mov [4 + ebx],esi	; buf->esi == 4(ebx) == ESI		mov [8 + ebx],ebp	; buf->ebp == 8(ebx) == EBP		mov [20 + ebx],edx	; buf->edx == 20(ebx) == EDX		mov [24 + ebx],ecx	; buf->ecx == 24(ebx) == ECX		mov [28 + ebx],eax	; buf->eax == 28(ebx) == EAX; use EBX value saved on stack; not the current value		mov eax,[esp]		mov [16 + ebx],eax	; buf->ebx == 16(ebx) == EBX; use ESP value after RET; not the current value		lea eax,[8 + esp]		mov [12 + ebx],eax	; buf->esp == 32(ebx) == ESP; use return address of this routine (EIP value saved on stack);; not the current value		mov eax,[4 + esp]		mov [32 + ebx],eax	; buf->eip == 36(ebx) == EIP; none of the PUSH or MOV instructions changed EFLAGS!		pushf		pop dword [36 + ebx]	; buf->eflags == 40(ebx) == EFLAGS	pop ebx	xor eax,eax	ret

⌨️ 快捷键说明

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