|
From: Jeremy F. <je...@go...> - 2005-03-30 09:58:04
|
Tom Hughes wrote: >Attached is a first cut at a kernel abstraction layer. It removes >most of the direct system calls from the coregrind directory and >moves them into KAL routines. As a side effect it implements the >missing mylibc functionality for amd64. > >I've made a start on removing VKI types from the KAL interface as >any abstraction layer will need to be independent of the types used >to communicate with the kernel. Many routines still use VKI types >in their interface however. > > I think we should just use the libc API for this, if not the system glibc. Would uclibc be a good basis (http://www.uclibc.org/)? It would get us out of the business of maintaining a C library as well. If nothing else, the kal_* functions may as well be called VG_(getpid)(), etc, rather than either changing all the callers or having a file full of stub functions. > Int VG_(getppid) ( void ) > { >- Int res; >- res = VG_(do_syscall0)(__NR_getppid); >- return res; >+ return VG_(getppid)(); > } > > This might take a while to terminate... >+Addr VG_(kal_mmap)(Addr start, SizeT length, UInt prot, UInt flags, >+ UInt fd, OffT offset) >+{ >+ UWord args[6]; >+ >+ args[0] = start; >+ args[1] = length; >+ args[2] = prot; >+ args[3] = flags; >+ args[4] = fd; >+ args[5] = offset; >+ >+ return VG_(do_syscall1)(__NR_mmap, (UWord)args); >+} > > I think mmap2 would be preferable here. J |