aboutsummaryrefslogtreecommitdiff
path: root/package/valgrind/valgrind.patch
blob: 3ef9db97700fc5b2d85f7c4394357dec3a152a80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
diff -urN y/valgrind-2.2.0/coregrind/vg_libpthread.c x/valgrind-2.2.0/coregrind/vg_libpthread.c
--- valgrind-2.2.0/coregrind/vg_libpthread.c	2004-08-29 15:02:27.000000000 -0600
+++ valgrind-2.2.0/coregrind/vg_libpthread.c	2005-01-21 03:42:19.000000000 -0700
@@ -3389,6 +3389,8 @@
    pthread_mutex).  So basically, this is completely broken on recent
    glibcs. */
 
+#ifndef __UCLIBC__
+
 #undef _IO_flockfile
 void _IO_flockfile ( _IO_FILE * file )
 {
@@ -3406,6 +3408,7 @@
 weak_alias(_IO_funlockfile, funlockfile);
 #endif
 
+#endif
 
 /* This doesn't seem to be needed to simulate libpthread.so's external
    interface, but many people complain about its absence. */
diff -urN y/valgrind-2.2.0/coregrind/vg_syscalls.c x/valgrind-2.2.0/coregrind/vg_syscalls.c
--- valgrind-2.2.0/coregrind/vg_syscalls.c	2004-08-30 18:08:37.000000000 -0600
+++ valgrind-2.2.0/coregrind/vg_syscalls.c	2005-01-21 03:49:05.000000000 -0700
@@ -3323,6 +3323,16 @@
       break;
 #           endif /* BLKGETSIZE */
 
+   case BLKBSZSET:
+      SYSCALL_TRACK( pre_mem_write,tid, "ioctl(BLKBSZSET)", arg3,
+		     sizeof(unsigned long));
+      break;
+   case BLKRAGET:
+      SYSCALL_TRACK( pre_mem_write,tid, "ioctl(BLKRAGET)", arg3,
+		     sizeof(unsigned long));
+      break;
+   case BLKRASET:
+      break;
       /* Hard disks */
    case HDIO_GET_IDENTITY: /* 0x030d */
       SYSCALL_TRACK( pre_mem_write,tid, "ioctl(HDIO_GET_IDENTITY)", arg3,
@@ -3375,6 +3385,7 @@
       break;
       /* The following two are probably bogus (should check args
 	 for readability).  JRS 20021117 */
+   case CDROMEJECT:
    case CDROM_DRIVE_STATUS: /* 0x5326 */
    case CDROM_CLEAR_OPTIONS: /* 0x5321 */
       break;
@@ -3383,10 +3394,12 @@
       SYSCALL_TRACK( pre_mem_write,tid, "ioctl(FIGETBSZ)", arg3,
                      sizeof(unsigned long));
       break;
+#if 0
    case FIBMAP:
       SYSCALL_TRACK( pre_mem_read,tid, "ioctl(FIBMAP)", arg3,
                      sizeof(unsigned long));
       break;
+#endif
 
 #ifdef HAVE_LINUX_FB_H
    case FBIOGET_VSCREENINFO: /* 0x4600 */
@@ -3483,6 +3496,87 @@
                      sizeof(struct timeval) );
       break;
 
+#define BLKSSZGET  _IO(0x12,104)
+   case BLKSSZGET:
+      SYSCALL_TRACK( pre_mem_write, tid, "ioctl(BLKSSZGET)", arg3,
+	      sizeof(int));
+      break;
+#undef BLKGETSIZE64
+#undef _IOR
+#define _IOR(type,nr,size)      _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define BLKGETSIZE64 _IOR(0x12,114,size_t)
+   case BLKGETSIZE64:
+      SYSCALL_TRACK( pre_mem_write, tid, "ioctl(BLKGETSIZE64)", arg3,
+	      sizeof(uint64_t));
+      break;
+#define HDIO_GETGEO             0x0301  /* get device geometry */
+   case HDIO_GETGEO:
+      {
+	  struct hd_geometry {
+	      unsigned char heads;
+	      unsigned char sectors;
+	      unsigned short cylinders;
+	      unsigned long start;
+	  };
+
+	  SYSCALL_TRACK( pre_mem_write, tid, "ioctl(HDIO_GETGEO)", arg3,
+		  sizeof(struct hd_geometry));
+      }
+      break;
+#define SCSI_IOCTL_GET_IDLUN 0x5382
+   case SCSI_IOCTL_GET_IDLUN:
+      {
+	  struct scsi_idlun
+	  {
+	      int mux4;
+	      int host_unique_id;
+
+	  };
+
+	  SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_GET_IDLUN)", arg3,
+		  sizeof(struct scsi_idlun));
+      }
+      break;
+#define SCSI_IOCTL_SEND_COMMAND 1
+   case SCSI_IOCTL_SEND_COMMAND:
+      SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_SEND_COMMAND)", arg3,
+	      ((2 * sizeof(unsigned int)) + 6 + 512));
+      break;
+#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
+   case SCSI_IOCTL_GET_BUS_NUMBER:
+      SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_GET_BUS_NUMBER)", arg3,
+	      sizeof(long));
+      break;
+#define SCSI_IOCTL_PROBE_HOST 0x5385
+   case SCSI_IOCTL_PROBE_HOST:
+      {
+	  unsigned long xxxx;
+	  char *array = (char*)arg3;
+	  xxxx = array[0] + (array[1]<<8) + (array[2]<<16) + (array[3]<<24);
+	  SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_PROBE_HOST)", arg3,
+		  sizeof(unsigned long));
+      }
+      break;
+#define BLKFLSBUF  _IO(0x12,97)
+   case BLKFLSBUF:
+      break;
+#define BLKRRPART  _IO(0x12,95)
+   case BLKRRPART:
+      break;
+#define MTIOCTOP  _IO(0x6d,0x1)
+   case MTIOCTOP:
+      {
+	  struct mtop
+	  {
+	      short int mt_op;		/* Operations defined below.  */
+	      int mt_count;		/* How many of them.  */
+	  };
+	  SYSCALL_TRACK( pre_mem_write, tid, "ioctl(MTIOCTOP)", arg3, 
+		  sizeof(struct mtop));
+      }
+      break;
+
+
       /* We don't have any specific information on it, so
 	 try to do something reasonable based on direction and
 	 size bits.  The encoding scheme is described in
@@ -3519,12 +3614,16 @@
 			 "guidance on writing a proper wrapper." );
 	 }
       } else {
-	 if ((dir & _IOC_WRITE) && size > 0)
+	 if ((dir & _IOC_WRITE) && size > 0) {
+	    VG_(message)(Vg_UserMsg, "genric ioctl 0x%x", arg2);
 	    SYSCALL_TRACK( pre_mem_read,tid, "ioctl(generic)", 
 			   arg3, size);
-	 if ((dir & _IOC_READ) && size > 0)
+	 }
+	 if ((dir & _IOC_READ) && size > 0) {
+	    VG_(message)(Vg_UserMsg, "genric ioctl 0x%x", arg2);
 	    SYSCALL_TRACK( pre_mem_write,tid, "ioctl(generic)", 
 			   arg3, size);
+	 }
       }
       break;
    }
@@ -3874,6 +3973,18 @@
 	 VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
       break;
 #           endif /* BLKGETSIZE */
+   case BLKRAGET:
+      if (res == 0)
+	 VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
+      break;
+   case BLKBSZSET:
+      if (res == 0)
+	 VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
+      break;
+   case BLKBSZGET:
+      if (res == 0)
+	 VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
+      break;
 
       /* Hard disks */
    case HDIO_GET_IDENTITY: /* 0x030d */
@@ -3897,7 +4008,8 @@
    case CDROMPLAYMSF:
       break;
       /* The following two are probably bogus (should check args
-	 for readability).  JRS 20021117 */
+        for readability).  JRS 20021117 */
+   case CDROMEJECT:
    case CDROM_DRIVE_STATUS: /* 0x5326 */
    case CDROM_CLEAR_OPTIONS: /* 0x5321 */
       break;
@@ -3906,10 +4018,12 @@
       if (res == 0)
          VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
       break;
+#if 0
    case FIBMAP:
       if (res == 0)
          VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
       break;
+#endif
 
 #ifdef HAVE_LINUX_FB_H
    case FBIOGET_VSCREENINFO: //0x4600
@@ -3965,6 +4079,28 @@
       VG_TRACK( post_mem_write, arg3, sizeof(struct timeval) );
       break;
 
+   case SCSI_IOCTL_GET_IDLUN:
+      {
+	  struct scsi_idlun
+	  {
+	      int mux4;
+	      int host_unique_id;
+
+	  };
+
+	  VG_TRACK( post_mem_write, arg3, sizeof(struct scsi_idlun) );
+      }
+      break;
+   case SCSI_IOCTL_SEND_COMMAND:
+      VG_TRACK( post_mem_write, arg3, ((2 * sizeof(unsigned int)) + 6 + 512));
+      break;
+   case SCSI_IOCTL_GET_BUS_NUMBER:
+      VG_TRACK( post_mem_write, arg3, sizeof(long) );
+      break;
+   case SCSI_IOCTL_PROBE_HOST:
+      VG_TRACK( post_mem_write, arg3, sizeof(unsigned long) );
+      break;
+
       /* We don't have any specific information on it, so
 	 try to do something reasonable based on direction and
 	 size bits.  The encoding scheme is described in
--- valgrind-2.2.0.orig/coregrind/vg_unsafe.h	2005-02-18 18:49:47.000000000 -0700
+++ valgrind-2.2.0/coregrind/vg_unsafe.h	2005-02-18 19:40:39.000000000 -0700
@@ -72,7 +72,13 @@
 #ifndef HAVE_U16
 typedef unsigned short u16;
 #endif
-#include <linux/mii.h>    /* for mii_* structs */
+/* Extracted from linux/mii.h for mii_* structs */
+struct mii_ioctl_data {
+	u16		phy_id;
+	u16		reg_num;
+	u16		val_in;
+	u16		val_out;
+};
 #endif
 #include <linux/ppdev.h>  /* for PP* ioctls */