[gem5] Add memory check, with optional compiler flag -DMEMCK.
Fix bug: omit setting mach_base for HIDDEN entry of ATT. Other minor changes.