old-MTGos-old/kernel/hal/x86/string.c
Morten Delenk 054e1bc230 Added the IDT
+Added an additional release setting, however it does not work.
2015-10-11 12:38:56 +02:00

16 lines
611 B
C

#include <string.h>
//Those pragmas are used to skip optimization for this function
#pragma GCC push_options
#pragma GCC optimize ("O0")
void memmove(void* dst, void* src, uint32_t size) {
uint8_t* from=(uint8_t*)src;
uint8_t* to=(uint8_t*)dst;
if((src<dst)&&((src+size)>dst)) {
for(int i=size-1;i>=0;i--)
to[i]=from[i]; //This would get optimized by gcc to memmove(dst, src, size); if optimizations are enabled.
} else if(src != dst) {
for(int i=0;i<size;i++)
to[i]=from[i]; //This would get optimized by gcc to memmove(dst, src, size); if optimizations are enabled.
}
}
#pragma GCC pop_options