|
From: <sv...@va...> - 2006-02-11 16:26:55
|
Author: tom
Date: 2006-02-11 16:26:46 +0000 (Sat, 11 Feb 2006)
New Revision: 5635
Log:
Implement the vm86 and vm86old system calls based on a patch
from Alper Akcan. Fixes bug #118939.
Modified:
trunk/coregrind/m_syswrap/syswrap-x86-linux.c
trunk/include/vki-x86-linux.h
Modified: trunk/coregrind/m_syswrap/syswrap-x86-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/syswrap-x86-linux.c 2006-02-11 14:35:17 UTC=
(rev 5634)
+++ trunk/coregrind/m_syswrap/syswrap-x86-linux.c 2006-02-11 16:26:46 UTC=
(rev 5635)
@@ -772,6 +772,8 @@
DECL_TEMPLATE(x86_linux, sys_ptrace);
DECL_TEMPLATE(x86_linux, sys_sigaction);
DECL_TEMPLATE(x86_linux, old_select);
+DECL_TEMPLATE(x86_linux, sys_vm86old);
+DECL_TEMPLATE(x86_linux, sys_vm86);
DECL_TEMPLATE(x86_linux, sys_syscall223);
=20
PRE(old_select)
@@ -1677,7 +1679,33 @@
POST_MEM_WRITE( ARG3, sizeof(struct vki_old_sigaction));
}
=20
+PRE(sys_vm86old)
+{
+ PRINT("sys_vm86old ( %p )", ARG1);
+ PRE_REG_READ1(int, "vm86old", struct vm86_struct *, info);
+ PRE_MEM_WRITE( "vm86old(info)", ARG1, sizeof(struct vki_vm86_struct))=
;
+}
=20
+POST(sys_vm86old)
+{
+ POST_MEM_WRITE( ARG1, sizeof(struct vki_vm86_struct));
+}
+
+PRE(sys_vm86)
+{
+ PRINT("sys_vm86 ( %d, %p )", ARG1,ARG2);
+ PRE_REG_READ2(int, "vm86", unsigned long, fn, struct vm86plus_struct =
*, v86);
+ if (ARG1 =3D=3D VKI_VM86_ENTER || ARG1 =3D=3D VKI_VM86_ENTER_NO_BYPAS=
S)
+ PRE_MEM_WRITE( "vm86(v86)", ARG2, sizeof(struct vki_vm86plus_struc=
t));
+}
+
+POST(sys_vm86)
+{
+ if (ARG1 =3D=3D VKI_VM86_ENTER || ARG1 =3D=3D VKI_VM86_ENTER_NO_BYPAS=
S)
+ POST_MEM_WRITE( ARG2, sizeof(struct vki_vm86plus_struct));
+}
+
+
/* ---------------------------------------------------------------
PRE/POST wrappers for x86/Linux-variant specific syscalls
------------------------------------------------------------ */
@@ -1869,7 +1897,7 @@
GENX_(__NR_iopl, sys_iopl), // 110
LINX_(__NR_vhangup, sys_vhangup), // 111
GENX_(__NR_idle, sys_ni_syscall), // 112
-//zz // (__NR_vm86old, sys_vm86old), // 113 x86/Li=
nux-only
+ PLAXY(__NR_vm86old, sys_vm86old), // 113 x86/Linux-o=
nly
GENXY(__NR_wait4, sys_wait4), // 114
//zz=20
//zz // (__NR_swapoff, sys_swapoff), // 115 */Linu=
x=20
@@ -1935,7 +1963,7 @@
LINX_(__NR_setresuid, sys_setresuid16), // 164
=20
LINXY(__NR_getresuid, sys_getresuid16), // 165
-//zz // (__NR_vm86, sys_vm86), // 166 x86/Li=
nux-only
+ PLAXY(__NR_vm86, sys_vm86), // 166 x86/Linux-o=
nly
GENX_(__NR_query_module, sys_ni_syscall), // 167
GENXY(__NR_poll, sys_poll), // 168
//zz // (__NR_nfsservctl, sys_nfsservctl), // 169 */Linu=
x
Modified: trunk/include/vki-x86-linux.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/vki-x86-linux.h 2006-02-11 14:35:17 UTC (rev 5634)
+++ trunk/include/vki-x86-linux.h 2006-02-11 16:26:46 UTC (rev 5635)
@@ -786,6 +786,80 @@
#define VKI_PTRACE_SETFPXREGS 19
=20
//----------------------------------------------------------------------
+// From linux-2.6.15.4/include/asm-i386/vm86.h
+//----------------------------------------------------------------------
+
+#define VKI_VM86_PLUS_INSTALL_CHECK 0
+#define VKI_VM86_ENTER 1
+#define VKI_VM86_ENTER_NO_BYPASS 2
+#define VKI_VM86_REQUEST_IRQ 3
+#define VKI_VM86_FREE_IRQ 4
+#define VKI_VM86_GET_IRQ_BITS 5
+#define VKI_VM86_GET_AND_RESET_IRQ 6
+
+struct vki_vm86_regs {
+/*
+ * normal regs, with special meaning for the segment descriptors..
+ */
+ long ebx;
+ long ecx;
+ long edx;
+ long esi;
+ long edi;
+ long ebp;
+ long eax;
+ long __null_ds;
+ long __null_es;
+ long __null_fs;
+ long __null_gs;
+ long orig_eax;
+ long eip;
+ unsigned short cs, __csh;
+ long eflags;
+ long esp;
+ unsigned short ss, __ssh;
+/*
+ * these are specific to v86 mode:
+ */
+ unsigned short es, __esh;
+ unsigned short ds, __dsh;
+ unsigned short fs, __fsh;
+ unsigned short gs, __gsh;
+};
+
+struct vki_revectored_struct {
+ unsigned long __map[8]; /* 256 bits */
+};
+
+struct vki_vm86_struct {
+ struct vki_vm86_regs regs;
+ unsigned long flags;
+ unsigned long screen_bitmap;
+ unsigned long cpu_type;
+ struct vki_revectored_struct int_revectored;
+ struct vki_revectored_struct int21_revectored;
+};
+
+struct vki_vm86plus_info_struct {
+ unsigned long force_return_for_pic:1;
+ unsigned long vm86dbg_active:1; /* for debugger */
+ unsigned long vm86dbg_TFpendig:1; /* for debugger */
+ unsigned long unused:28;
+ unsigned long is_vm86pus:1; /* for vm86 internal use */
+ unsigned char vm86dbg_intxxtab[32]; /* for debugger */
+};
+
+struct vki_vm86plus_struct {
+ struct vki_vm86_regs regs;
+ unsigned long flags;
+ unsigned long screen_bitmap;
+ unsigned long cpu_type;
+ struct vki_revectored_struct int_revectored;
+ struct vki_revectored_struct int21_revectored;
+ struct vki_vm86plus_info_struct vm86plus;
+};
+
+//----------------------------------------------------------------------
// And that's it!
//----------------------------------------------------------------------
=20
|
|
From: Oswald B. <os...@kd...> - 2006-02-11 18:35:32
|
On Sat, Feb 11, 2006 at 04:26:48PM +0000, sv...@va... wrote: > Author: tom > Implement the vm86 and vm86old system calls based on a patch > from Alper Akcan. Fixes bug #118939. > i wouldn't be *too* surprised if this induced *tons* of false positives for some applications. i suppose you don't plan to implement instrumentation of 16 bit code ... oh, well, i guess there is nothing that cannot be suppressed. :) -- Hi! I'm a .signature virus! Copy me into your ~/.signature, please! -- Chaos, panic, and disorder - my work here is done. |
|
From: Tom H. <to...@co...> - 2006-02-11 21:59:37
|
In message <20060211183510.GA11881@ugly.local>
Oswald Buddenhagen <os...@kd...> wrote:
> On Sat, Feb 11, 2006 at 04:26:48PM +0000, sv...@va... wrote:
> > Author: tom
> > Implement the vm86 and vm86old system calls based on a patch
> > from Alper Akcan. Fixes bug #118939.
>
> i wouldn't be *too* surprised if this induced *tons* of false positives
> for some applications. i suppose you don't plan to implement
> instrumentation of 16 bit code ...
Only applications that use it presumably, which is very few.
I would expect that a reasonably large number of 16 bit instructions
are already implemented anyway.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: Oswald B. <os...@kd...> - 2006-02-11 23:04:22
|
On Sat, Feb 11, 2006 at 09:59:23PM +0000, Tom Hughes wrote: > Oswald Buddenhagen wrote: > > On Sat, Feb 11, 2006 at 04:26:48PM +0000, sv...@va... wrote: > > > Author: tom Implement the vm86 and vm86old system calls based on a > > > patch from Alper Akcan. Fixes bug #118939. > > > > i wouldn't be *too* surprised if this induced *tons* of false > > positives for some applications. > > Only applications that use it presumably, which is very few. > indeed, i have problems to come up with three of them. i just meant that people who requested this feature *might* be disappointed about its effects. > > i suppose you don't plan to implement instrumentation of 16 bit code > > ... > > I would expect that a reasonably large number of 16 bit instructions > are already implemented anyway. > believe me, it's "slightly" more complicated that this. we are talking about real/v86 mode here - you know, this stuff with 16 bit offset calculations and segment registers on which you can do arithmetic. also, i can't imagine a dynamic translator would have a particular lot of luck dealing with typical DOS code of mine. :) -- Hi! I'm a .signature virus! Copy me into your ~/.signature, please! -- Chaos, panic, and disorder - my work here is done. |
|
From: Tom H. <to...@co...> - 2006-02-12 00:00:05
|
In message <20060211230420.GA21024@ugly.local>
Oswald Buddenhagen <os...@kd...> wrote:
> On Sat, Feb 11, 2006 at 09:59:23PM +0000, Tom Hughes wrote:
> > Oswald Buddenhagen wrote:
> > > On Sat, Feb 11, 2006 at 04:26:48PM +0000, sv...@va... wrote:
> > > > Author: tom Implement the vm86 and vm86old system calls based on a
> > > > patch from Alper Akcan. Fixes bug #118939.
> > >
> > > i wouldn't be *too* surprised if this induced *tons* of false
> > > positives for some applications.
> >
> > Only applications that use it presumably, which is very few.
>
> indeed, i have problems to come up with three of them. i just meant that
> people who requested this feature *might* be disappointed about its
> effects.
Well I assume the guy who posted the patch on the bug tracker was
using it with some degree of success...
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|