Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: svs_pmap_sync() svs_pdir_switch() overhead

>> In the [XXX] window, the PTEs could be used by userland.  If you
>> copied them using memcpy(), some parts of the bytes could contain
>> stale values.
> You mean if memcpy() was moving single bytes at a time?  That won't
> happen, see:

> https://nxr.netbsd.org/xref/src/common/lib/libc/arch/x86_64/string/bcopy.S

Even if it won't happen now, that's no guarantee it won't happen in the
future.  It is no part of memcpy()'s contract that it will or won't
copy data in any particular order or fashion.  Indeed, some compilers
inline memcpy under some circumstances, especially when called with a
compile-time constant for the size, and if that happens the library
implementation is completely irrelevant.

I think it would be way too brittle to count on memcpy to copy things
the way you want.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index