littlekernel / lk

LK embedded kernel
MIT License
3.14k stars 615 forks source link

[arch][x86] SMEP/SMAP detection bug fix and memcpy/memset x86 architecture implementation #189

Closed AjanZhong closed 6 years ago

AjanZhong commented 7 years ago

Hi Travisg, This pull request contains 3 changes now:

  1. Bug fix on Intel architecture SMEP/SMAP detection: there is an bug while calculating SMEP/SMAP bit in return value of CPUID instruction;
  2. Float test: float test for each thread has different result, but message shows they should be similar. To address this issue, introduced an array to contain value for each thread, and present to uses as a reference.
  3. Intel x86-64 architecture memcpy/memset implementation. Current libc function memcpy has defect while copy memory in this scenario: src < dst < src + count, content of source memory would be overwritten. To address this issue, we introduce x86-64 implementation of memcpy. Also we provided memset implementation on x86-64. Also memcpy_s introduced for secure concern.