void *memcpy(void *__dest, const void *__src, size_t __count)
{
- if( ((tVAddr)__dest & 7) != ((tVAddr)__src & 7) )
- __asm__ __volatile__ ("rep movsb" : : "D"(__dest),"S"(__src),"c"(__count));
- else {
- const Uint8 *src = __src;
- Uint8 *dst = __dest;
- while( (tVAddr)src & 7 && __count ) {
- *dst++ = *src++;
+ tVAddr dst = (tVAddr)__dest, src = (tVAddr)__src;
+ if( (dst & 7) != (src & 7) )
+ {
+ __asm__ __volatile__ ("rep movsb" : : "D"(dst),"S"(src),"c"(__count));
+ }
+ else
+ {
+ while( (src & 7) && __count ) {
+ *(char*)dst++ = *(char*)src++;
__count --;
}
- __asm__ __volatile__ ("rep movsq" : : "D"(dst),"S"(src),"c"(__count/8));
- src += __count & ~7;
- dst += __count & ~7;
+ __asm__ __volatile__ ("rep movsq" : "=D"(dst),"=S"(src) : "0"(dst),"1"(src),"c"(__count/8));
__count = __count & 7;
while( __count-- )
- *dst++ = *src++;
+ *(char*)dst++ = *(char*)src++;
}
return __dest;
}
int MM_IsValidBuffer(tVAddr Addr, size_t Size)
{
int bIsUser;
- int pml4, pdp, dir, tab;
+ Uint64 pml4, pdp, dir, tab;
Size += Addr & (PAGE_SIZE-1);
Addr &= ~(PAGE_SIZE-1);
pdp = Addr >> 30;
dir = Addr >> 21;
tab = Addr >> 12;
-
-// Debug("Addr = %p, Size = 0x%x, dir = %i, tab = %i", Addr, Size, dir, tab);
if( !(PAGEMAPLVL4(pml4) & 1) ) return 0;
if( !(PAGEDIRPTR(pdp) & 1) ) return 0;
{
// Skip addresses:
// 320 0xFFFFA.... - Kernel Stacks
- if( i == 320 ) continue;
+ if( i == MM_KSTACK_BASE>>39 ) continue;
// 509 0xFFFFFE0.. - Fractal mapping
- if( i == 508 ) continue;
+ if( i == MM_FRACTAL_BASE>>39 ) continue;
// 510 0xFFFFFE8.. - Temp fractal mapping
- if( i == 509 ) continue;
+ if( i == MM_TMPFRAC_BASE>>39 ) continue;
TMPMAPLVL4(i) = PAGEMAPLVL4(i);
if( TMPMAPLVL4(i) & 1 )