From: Josh V. <ho...@na...> - 2001-03-13 01:35:53
|
Gareth Hughes <ga...@va...> writes: > > 3. If you want to go all out on this code, you could probably use > > mprotect() to avoid the buffer overflow test entirely. That would > > only be a good idea if buffer overflows are rare though. > > You need buffer overflows as they end up flushing the DMA buffer. In > this case, get_dma() would flush the current buffer and acquire a new > one. I was too vague. You could mprotect() the page after the DMA buffer to PROT_NONE and install a SIGSEGV handler that flushes the buffer if the SIGSEGV was on the end of the DMA buffer. Then you can just let Vertex3f segfault when it uses the buffer up. You would save yourself a test and a predicted jump per call. Not much, but it sounds like you really want to optimize this. Josh |