How to detect the page read/write fault ?

"Yung-Chang Chiu" <[email protected]> Thu, 8 Feb 2007 14:45:23 +0800
Newsgroups gmane.linux.redhat.amd64
Message-ID <[email protected]>
On the x86 machine, i can use the below program to detect read or write fault.
write_fault=uap->uc_mcontext.gregs[REG_ERR]&4;

but it don't work on AMD64 machine.

I have been search on internet, but there is no answer for AMD64.
Anybody can tell me how to do?