FEATURE: Linaro optimizations & fixes
- taken from Semaphore by @stratosk, Mackay kernel by @kasperhettinga & somewhere else i forgot (sorry!)