cross-platform refactoring, especially of low-level asm code,
and several FPC 2.6.4 compatibility fixes