Copied some changes from hlte kernel