3 Jul 2004 10:07
optimisation from MacOS X.3: the comm pages
Emmanuel Dreyfus <manu <at> netbsd.org>
2004-07-03 08:07:42 GMT
2004-07-03 08:07:42 GMT
Hello everybody I upgraded COMPAT_DARWIN to run MacOS X.3 binaries. Apple introduced a performance hack that broke backward compatibility, but we could probably setup somethign similar while retaining it. Two pages (known as the comm pages) are mapped by the kernel at the end of each process memory space. On PowerPC they can be accessed through an absolute branch, so they don't need relocations. Theses pages contains several basic routines optimized for the current CPU: bzero, memcpy, and so on. The point is that the process does not has to test the CPU type, it just uses kernel provided bzero, which is optimized for the hardware. Other trick: the pages start with values that are really readen often: ncpu, system time, and so on. That enable user program to perform a gettimeofday without the overhead of a system call. There are a few sysctl we call really often, so there is probably an easy win to do there. But if we want to keep backward compatibility, we need a mechanism to test for this page presence from libc (probably a sysctl). MacOS X.3 binaries just fail if the page is not there. The implementation in COMPAT_DARWIN can be found in src/sys/compat/darwin/darwin_commpage.c Anyone interested by implementing that? -- --(Continue reading)
RSS Feed