|
From: <sv...@va...> - 2009-06-24 06:27:12
|
Author: njn
Date: 2009-06-24 07:25:36 +0100 (Wed, 24 Jun 2009)
New Revision: 10371
Log:
Add support for various aio_*() syscalls on Darwin. With them, Quicktime
runs, albeit incredibly slowly.
Modified:
trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
trunk/coregrind/m_syswrap/syswrap-darwin.c
trunk/include/vki/vki-darwin.h
trunk/memcheck/tests/darwin/scalar.c
trunk/memcheck/tests/darwin/scalar.stderr.exp
Modified: trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
===================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-darwin.h 2009-06-24 05:01:41 UTC (rev 10370)
+++ trunk/coregrind/m_syswrap/priv_syswrap-darwin.h 2009-06-24 06:25:36 UTC (rev 10371)
@@ -369,12 +369,12 @@
// NYI settid_with_pid 311
// NYI __pthread_cond_timedwait 312
// NYI aio_fsync 313
-// NYI aio_return 314
-// NYI aio_suspend 315
+DECL_TEMPLATE(darwin, aio_return); // 314
+DECL_TEMPLATE(darwin, aio_suspend); // 315
// NYI aio_cancel 316
-// NYI aio_error 317
-// NYI aio_read 318
-// NYI aio_write 319
+DECL_TEMPLATE(darwin, aio_error); // 317
+DECL_TEMPLATE(darwin, aio_read); // 318
+DECL_TEMPLATE(darwin, aio_write); // 319
// NYI lio_listio 320
// NYI __pthread_cond_wait 321
// NYI iopolicysys 322
Modified: trunk/coregrind/m_syswrap/syswrap-darwin.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-darwin.c 2009-06-24 05:01:41 UTC (rev 10370)
+++ trunk/coregrind/m_syswrap/syswrap-darwin.c 2009-06-24 06:25:36 UTC (rev 10371)
@@ -3355,6 +3355,51 @@
}
+PRE(aio_return)
+{
+ // This assumes that the kernel looks at the struct pointer, but not the
+ // contents of the struct.
+ PRINT( "aio_return ( %#lx )", ARG1 );
+ PRE_REG_READ1(long, "aio_return", struct vki_aiocb*, aiocbp);
+}
+
+PRE(aio_suspend)
+{
+ // This assumes that the kernel looks at the struct pointers in the list,
+ // but not the contents of the structs.
+ PRINT( "aio_suspend ( %#lx )", ARG1 );
+ PRE_REG_READ3(long, "aio_suspend",
+ const struct vki_aiocb *, aiocbp, int, nent,
+ const struct vki_timespec *, timeout);
+ if (ARG2 > 0)
+ PRE_MEM_READ("aio_suspend(list)", ARG1, ARG2 * sizeof(struct vki_aiocb *));
+ if (ARG3)
+ PRE_MEM_READ ("aio_suspend(timeout)", ARG3, sizeof(struct vki_timespec));
+}
+
+PRE(aio_error)
+{
+ // This assumes that the kernel looks at the struct pointer, but not the
+ // contents of the struct.
+ PRINT( "aio_error ( %#lx )", ARG1 );
+ PRE_REG_READ1(long, "aio_error", struct vki_aiocb*, aiocbp);
+}
+
+PRE(aio_read)
+{
+ PRINT( "aio_read ( %#lx )", ARG1 );
+ PRE_REG_READ1(long, "aio_read", struct vki_aiocb*, aiocbp);
+ PRE_MEM_READ( "aio_read(aiocbp)", ARG1, sizeof(struct vki_aiocb));
+}
+
+PRE(aio_write)
+{
+ PRINT( "aio_write ( %#lx )", ARG1 );
+ PRE_REG_READ1(long, "aio_write", struct vki_aiocb*, aiocbp);
+ PRE_MEM_READ( "aio_write(aiocbp)", ARG1, sizeof(struct vki_aiocb));
+}
+
+
/* ---------------------------------------------------------------------
mach_msg: formatted messages
------------------------------------------------------------------ */
@@ -7300,12 +7345,12 @@
// _____(__NR_settid_with_pid),
// _____(__NR___pthread_cond_timedwait),
// _____(__NR_aio_fsync),
-// _____(__NR_aio_return),
-// _____(__NR_aio_suspend),
+ MACX_(__NR_aio_return, aio_return),
+ MACX_(__NR_aio_suspend, aio_suspend),
// _____(__NR_aio_cancel),
-// _____(__NR_aio_error),
-// _____(__NR_aio_read),
-// _____(__NR_aio_write),
+ MACX_(__NR_aio_error, aio_error),
+ MACX_(__NR_aio_read, aio_read),
+ MACX_(__NR_aio_write, aio_write),
// _____(__NR_lio_listio), // 320
// _____(__NR___pthread_cond_wait),
// _____(__NR_iopolicysys),
Modified: trunk/include/vki/vki-darwin.h
===================================================================
--- trunk/include/vki/vki-darwin.h 2009-06-24 05:01:41 UTC (rev 10370)
+++ trunk/include/vki/vki-darwin.h 2009-06-24 06:25:36 UTC (rev 10371)
@@ -1020,4 +1020,8 @@
#define VKI_A_SETKAUDIT A_SETKAUDIT
+#include <sys/aio.h>
+
+#define vki_aiocb aiocb
+
#endif
Modified: trunk/memcheck/tests/darwin/scalar.c
===================================================================
--- trunk/memcheck/tests/darwin/scalar.c 2009-06-24 05:01:41 UTC (rev 10370)
+++ trunk/memcheck/tests/darwin/scalar.c 2009-06-24 06:25:36 UTC (rev 10371)
@@ -537,12 +537,24 @@
// __NR_settid_with_pid 311
// __NR___pthread_cond_timedwait 312
// __NR_aio_fsync 313
- // __NR_aio_return 314
- // __NR_aio_suspend 315
+
+ GO(__NR_aio_return, 314, "1s 0m");
+ SY(__NR_aio_return, x0); FAIL;
+
+ GO(__NR_aio_suspend, 315, "1s 0m");
+ SY(__NR_aio_suspend, x0, x0+1, x0); FAIL;
+
// __NR_aio_cancel 316
- // __NR_aio_error 317
- // __NR_aio_read 318
- // __NR_aio_write 319
+
+ GO(__NR_aio_error, 317, "1s 0m");
+ SY(__NR_aio_error, x0); FAIL;
+
+ GO(__NR_aio_read, 318, "1s 1m");
+ SY(__NR_aio_read, x0); FAIL;
+
+ GO(__NR_aio_write, 319, "1s 1m");
+ SY(__NR_aio_write, x0); FAIL;
+
// __NR_lio_listio 320
// __NR___pthread_cond_wait 321
// __NR_iopolicysys 322
Modified: trunk/memcheck/tests/darwin/scalar.stderr.exp
===================================================================
--- trunk/memcheck/tests/darwin/scalar.stderr.exp 2009-06-24 05:01:41 UTC (rev 10370)
+++ trunk/memcheck/tests/darwin/scalar.stderr.exp 2009-06-24 06:25:36 UTC (rev 10371)
@@ -688,6 +688,54 @@
(300): old shared_region_make_private_np
-----------------------------------------------------
-----------------------------------------------------
+x200013a(314): __NR_aio_return 1s 0m
+-----------------------------------------------------
+
+Syscall param aio_return(aiocbp) contains uninitialised byte(s)
+ ...
+-----------------------------------------------------
+x200013b(315): __NR_aio_suspend 1s 0m
+-----------------------------------------------------
+
+Syscall param aio_suspend(aiocbp) contains uninitialised byte(s)
+ ...
+
+Syscall param aio_suspend(nent) contains uninitialised byte(s)
+ ...
+
+Syscall param aio_suspend(timeout) contains uninitialised byte(s)
+ ...
+
+Syscall param aio_suspend(list) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
+x200013d(317): __NR_aio_error 1s 0m
+-----------------------------------------------------
+
+Syscall param aio_error(aiocbp) contains uninitialised byte(s)
+ ...
+-----------------------------------------------------
+x200013e(318): __NR_aio_read 1s 1m
+-----------------------------------------------------
+
+Syscall param aio_read(aiocbp) contains uninitialised byte(s)
+ ...
+
+Syscall param aio_read(aiocbp) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
+x200013f(319): __NR_aio_write 1s 1m
+-----------------------------------------------------
+
+Syscall param aio_write(aiocbp) contains uninitialised byte(s)
+ ...
+
+Syscall param aio_write(aiocbp) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
(323): unused
-----------------------------------------------------
-----------------------------------------------------
|