fixed crash in replaceAsm function

when the patched function address is the tail of memory page, the
patched code touches two pages. so we must make the two pages writable.