Bug 118939 - vm86old syscall patch for valgrind 3.1.0
Summary: vm86old syscall patch for valgrind 3.1.0
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.1.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-24 01:51 UTC by Alper Akcan
Modified: 2006-02-11 17:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
vm86old syscall patch for valgrind 3.1.0 (3.58 KB, patch)
2005-12-24 01:52 UTC, Alper Akcan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alper Akcan 2005-12-24 01:51:19 UTC
here is vm86old syscall patch for valgrind 3.1.0

tested with;

lrmi-0.10
Linux 2.4.32
gcc-3.3.6
glibc-2.3.5

I do not know how to add attachment, so here is the copy&paste. I`ve emailed
this to valgrind-users list too.

greetings.

Alper Akcan.

diff -U 3 -H -d -r -N valgrind-3.1.0/coregrind/m_syswrap/priv_syswrap-linux.h
valgrind-3.1.0-vm86old.linux/coregrind/m_syswrap/priv_syswrap-linux.h
--- valgrind-3.1.0/coregrind/m_syswrap/priv_syswrap-linux.h	2005-11-25
14:36:16.000000000 +0200
+++ valgrind-3.1.0-vm86old.linux/coregrind/m_syswrap/priv_syswrap-linux.h
2005-12-24 02:06:00.000000000 +0200
@@ -68,6 +68,7 @@
 DECL_TEMPLATE(linux, sys_syslog);
 DECL_TEMPLATE(linux, sys_vhangup);
 DECL_TEMPLATE(linux, sys_sysinfo);
+DECL_TEMPLATE(linux, sys_vm86old);
 DECL_TEMPLATE(linux, sys_personality);
 DECL_TEMPLATE(linux, sys_sysctl);
 DECL_TEMPLATE(linux, sys_prctl);
diff -U 3 -H -d -r -N valgrind-3.1.0/coregrind/m_syswrap/syswrap-linux.c
valgrind-3.1.0-vm86old.linux/coregrind/m_syswrap/syswrap-linux.c
--- valgrind-3.1.0/coregrind/m_syswrap/syswrap-linux.c	2005-11-25
14:36:16.000000000 +0200
+++ valgrind-3.1.0-vm86old.linux/coregrind/m_syswrap/syswrap-linux.c	2005-12-24
02:04:40.000000000 +0200
@@ -652,6 +652,17 @@
    POST_MEM_WRITE( ARG1, sizeof(struct vki_sysinfo) );
 }
 
+PRE(sys_vm86old)
+{
+   PRINT("sys_vm86old ( %p )",ARG1);
+   PRE_REG_READ1(long, "vm86old", struct vm86_struct *, info);
+   PRE_MEM_WRITE( "vm86old(info)", ARG1, sizeof(struct vki_vm86_struct) );
+}
+POST(sys_vm86old)
+{
+   POST_MEM_WRITE( ARG1, sizeof(struct vki_vm86_struct) );
+}
+
 PRE(sys_personality)
 {
    PRINT("sys_personality ( %llu )", (ULong)ARG1);
diff -U 3 -H -d -r -N valgrind-3.1.0/coregrind/m_syswrap/syswrap-x86-linux.c
valgrind-3.1.0-vm86old.linux/coregrind/m_syswrap/syswrap-x86-linux.c
--- valgrind-3.1.0/coregrind/m_syswrap/syswrap-x86-linux.c	2005-11-25
14:36:16.000000000 +0200
+++ valgrind-3.1.0-vm86old.linux/coregrind/m_syswrap/syswrap-x86-linux.c
2005-12-24 02:05:14.000000000 +0200
@@ -1869,7 +1869,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/Linux-only
+   LINXY(__NR_vm86old,           sys_vm86old),        // 113 x86/Linux-only
    GENXY(__NR_wait4,             sys_wait4),          // 114
 //zz 
 //zz    //   (__NR_swapoff,           sys_swapoff),        // 115 */Linux 
diff -U 3 -H -d -r -N valgrind-3.1.0/include/vki-linux.h
valgrind-3.1.0-vm86old.linux/include/vki-linux.h
--- valgrind-3.1.0/include/vki-linux.h	2005-11-25 14:36:04.000000000 +0200
+++ valgrind-3.1.0-vm86old.linux/include/vki-linux.h	2005-12-24
02:12:37.000000000 +0200
@@ -181,6 +181,50 @@
 	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
 };
 
+struct 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 revectored_struct {
+	unsigned long __map[8];			/* 256 bits */
+};
+
+struct vki_vm86_struct {
+	struct vm86_regs regs;
+	unsigned long flags;
+	unsigned long screen_bitmap;
+	unsigned long cpu_type;
+	struct revectored_struct int_revectored;
+	struct revectored_struct int21_revectored;
+};
+	
+
 //----------------------------------------------------------------------
 // From linux-2.6.8.1/include/linux/time.h
 //----------------------------------------------------------------------
Comment 1 Alper Akcan 2005-12-24 01:52:46 UTC
Created attachment 14030 [details]
vm86old syscall patch for valgrind 3.1.0
Comment 2 Tom Hughes 2006-02-11 17:27:53 UTC
I've committed an implementation of vm86old and vm86 as SVN revision 5635 based on your patch but moved to the x86-linux wrappers file as they are x86 specific.