【正文】
rt_to_phys()? ssize_t my_write( struct file *file, const char *buf, size_t len, loff_t *pos ) { unsigned int _cr3, *pgdir, *pgtbl, pfn_pgtbl, pfn_frame。 int nbytes = write( fd, message, msglen )。 int main( void ) { int fd = open( “/dev/nic”, O_RDWR )。s like sendfile, sendfile64, etc. Techniques for creating zerocopy software include the use of DMAbased copying, and memorymapping through an MMU. These features require specific hardware support and usually involve particular memory alignment requirements. Zerocopy protocols are especially important for highspeed works, as memory copies would cause a serious workload for the host cpu. Still, such protocols have some initial overhead so that avoiding programmed IO (PIO) there only makes sense for large messages. Application sourcecode char message[] = “This is a test of workpacket transmission \n”。 } int msglen = strlen( message )。 } printf( “Transmitted %d bytes \n”, nbytes )。 0x3FF。 0xFFF。 pfn_pgtbl = (pgdir[ dindex ] 12)。 kunmap( amp。 buf offset len PAGE_SIZE PAGE_SIZE PAGE_SIZE ?? ? We created this modification of our ?? devicedriver so it?s ?my_write()? function lets an application perform transmissions without performing a memorytomemory copyoperation (., copy_from_user()? ) ? It is not so easy to implement ?zerocopy? for receiving packets – can you say why? Website article ? We?ve posted a link on our CS686 website to a frequently cited researcharticle about the various issues that arise when trying to implement the ?zerocopy? concept for the case of ?ining? workpackets: The Need for Asynchronous, ZeroCopy Network I/O, by Ulrich Drepper, Red Hat, Inc.