aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/context_i686.asm
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /util/system/context_i686.asm
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/system/context_i686.asm')
-rw-r--r--util/system/context_i686.asm43
1 files changed, 43 insertions, 0 deletions
diff --git a/util/system/context_i686.asm b/util/system/context_i686.asm
new file mode 100644
index 0000000000..11f8cecc8e
--- /dev/null
+++ b/util/system/context_i686.asm
@@ -0,0 +1,43 @@
+ [bits 32]
+
+ %define MJB_BX 0
+ %define MJB_SI 1
+ %define MJB_DI 2
+ %define MJB_BP 3
+ %define MJB_SP 4
+ %define MJB_PC 5
+ %define MJB_RSP MJB_SP
+ %define MJB_SIZE 24
+
+ %define LINKAGE 4
+ %define PCOFF 0
+ %define PTR_SIZE 4
+
+ %define PARMS LINKAGE
+ %define JMPBUF PARMS
+ %define JBUF PARMS
+ %define VAL JBUF + PTR_SIZE
+
+EXPORT __mylongjmp
+ mov ecx, [esp + JBUF]
+ mov eax, [esp + VAL]
+ mov edx, [ecx + MJB_PC*4]
+ mov ebx, [ecx + MJB_BX*4]
+ mov esi, [ecx + MJB_SI*4]
+ mov edi, [ecx + MJB_DI*4]
+ mov ebp, [ecx + MJB_BP*4]
+ mov esp, [ecx + MJB_SP*4]
+ jmp edx
+
+EXPORT __mysetjmp
+ mov eax, [esp + JMPBUF]
+ mov [eax + MJB_BX*4], ebx
+ mov [eax + MJB_SI*4], esi
+ mov [eax + MJB_DI*4], edi
+ lea ecx, [esp + JMPBUF]
+ mov [eax + MJB_SP*4], ecx
+ mov ecx, [esp + PCOFF]
+ mov [eax + MJB_PC*4], ecx
+ mov [eax + MJB_BP*4], ebp
+ xor eax, eax
+ ret