2010-03-22 22:25:22 +01:00
|
|
|
/* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
|
2010-08-17 18:44:07 +02:00
|
|
|
#include <machine/asm.h>
|
2010-01-26 00:18:02 +01:00
|
|
|
|
|
|
|
.text
|
|
|
|
|
|
|
|
MAGIC = 0x564D5868
|
|
|
|
BD_PORT = 0x5658
|
|
|
|
IO_PORT = 0x5659
|
|
|
|
|
2010-08-17 18:44:07 +02:00
|
|
|
ENTRY(__libhgfs_backdoor)
|
2010-01-26 00:18:02 +01:00
|
|
|
pushl %ebx
|
|
|
|
pushl %esi
|
|
|
|
pushl %edi
|
|
|
|
pushl %ebp
|
|
|
|
movl 4+16(%esp), %ebp
|
|
|
|
movl $MAGIC, %eax
|
|
|
|
movl 4(%ebp), %ebx
|
|
|
|
movl 8(%ebp), %ecx
|
|
|
|
movl 12(%ebp), %edx
|
|
|
|
movw $BD_PORT, %dx
|
|
|
|
movl 16(%ebp), %esi
|
|
|
|
movl 20(%ebp), %edi
|
|
|
|
inl %dx
|
|
|
|
movl %eax, (%ebp)
|
|
|
|
movl %ebx, 4(%ebp)
|
|
|
|
movl %ecx, 8(%ebp)
|
|
|
|
movl %edx, 12(%ebp)
|
|
|
|
movl %esi, 16(%ebp)
|
|
|
|
movl %edi, 20(%ebp)
|
|
|
|
popl %ebp
|
|
|
|
popl %edi
|
|
|
|
popl %esi
|
|
|
|
popl %ebx
|
|
|
|
ret
|
|
|
|
|
2010-08-17 18:44:07 +02:00
|
|
|
ENTRY(__libhgfs_backdoor_in)
|
2010-01-26 00:18:02 +01:00
|
|
|
pushl %ebx
|
|
|
|
pushl %esi
|
|
|
|
pushl %edi
|
|
|
|
pushl %ebp
|
|
|
|
movl 4+16(%esp), %eax
|
|
|
|
movl 4(%eax), %ebx
|
|
|
|
movl 8(%eax), %ecx
|
|
|
|
movl 12(%eax), %edx
|
|
|
|
movw $IO_PORT, %dx
|
|
|
|
movl 16(%eax), %esi
|
|
|
|
movl 20(%eax), %edi
|
|
|
|
movl 24(%eax), %ebp
|
|
|
|
movl $MAGIC, %eax
|
|
|
|
cld
|
|
|
|
repe; insb
|
|
|
|
pushl %eax
|
|
|
|
movl 4+20(%esp), %eax
|
|
|
|
movl %ebx, 4(%eax)
|
|
|
|
movl %ecx, 8(%eax)
|
|
|
|
movl %edx, 12(%eax)
|
|
|
|
movl %esi, 16(%eax)
|
|
|
|
movl %edi, 20(%eax)
|
|
|
|
movl %ebp, 24(%eax)
|
|
|
|
popl %ebx
|
|
|
|
movl %ebx, (%eax)
|
|
|
|
movl (%eax), %eax
|
|
|
|
popl %ebp
|
|
|
|
popl %edi
|
|
|
|
popl %esi
|
|
|
|
popl %ebx
|
|
|
|
ret
|
|
|
|
|
2010-08-17 18:44:07 +02:00
|
|
|
ENTRY(__libhgfs_backdoor_out)
|
2010-01-26 00:18:02 +01:00
|
|
|
pushl %ebx
|
|
|
|
pushl %esi
|
|
|
|
pushl %edi
|
|
|
|
pushl %ebp
|
|
|
|
movl 4+16(%esp), %eax
|
|
|
|
movl 4(%eax), %ebx
|
|
|
|
movl 8(%eax), %ecx
|
|
|
|
movl 12(%eax), %edx
|
|
|
|
movw $IO_PORT, %dx
|
|
|
|
movl 16(%eax), %esi
|
|
|
|
movl 20(%eax), %edi
|
|
|
|
movl 24(%eax), %ebp
|
|
|
|
movl $MAGIC, %eax
|
|
|
|
cld
|
|
|
|
repe; outsb
|
|
|
|
pushl %eax
|
|
|
|
movl 4+20(%esp), %eax
|
|
|
|
movl %ebx, 4(%eax)
|
|
|
|
movl %ecx, 8(%eax)
|
|
|
|
movl %edx, 12(%eax)
|
|
|
|
movl %esi, 16(%eax)
|
|
|
|
movl %edi, 20(%eax)
|
|
|
|
movl %ebp, 24(%eax)
|
|
|
|
popl %ebx
|
|
|
|
movl %ebx, (%eax)
|
|
|
|
movl (%eax), %eax
|
|
|
|
popl %ebp
|
|
|
|
popl %edi
|
|
|
|
popl %esi
|
|
|
|
popl %ebx
|
|
|
|
ret
|