summaryrefslogtreecommitdiff
path: root/pwnlib/shellcraft/templates/amd64/freebsd/amd64_to_i386.asm
diff options
context:
space:
mode:
Diffstat (limited to 'pwnlib/shellcraft/templates/amd64/freebsd/amd64_to_i386.asm')
-rw-r--r--pwnlib/shellcraft/templates/amd64/freebsd/amd64_to_i386.asm10
1 files changed, 10 insertions, 0 deletions
diff --git a/pwnlib/shellcraft/templates/amd64/freebsd/amd64_to_i386.asm b/pwnlib/shellcraft/templates/amd64/freebsd/amd64_to_i386.asm
new file mode 100644
index 0000000..aeaaffa
--- /dev/null
+++ b/pwnlib/shellcraft/templates/amd64/freebsd/amd64_to_i386.asm
@@ -0,0 +1,10 @@
+<%docstring>Returns code to switch from amd64 to i386 mode. Trashes eax, ecx, edx.
+
+Note that you most surely want to set up some stack (and place this code)
+in low address space before (or afterwards).</%docstring>
+.code64
+ call $+4
+ .byte 0xc0 /* inc eax */
+ mov byte ptr [rsp+4], 0x33 /* This is the segment we want to go to */
+ retfd
+.code32