how to handle general protection fault in linux kernel
问题 I have a piece of kernel module as the following, which tries to read msr register, no doubt it would crash as the msr 0x2 is not exist, a geneal protection fault will happens. My question is how could I bypass this fault, like define my GP handler? if I cannot read a msr, just let it go... The following is my module code: #include <linux/init.h> #include <linux/module.h> #define LBR 0x2 static unsigned long long x86_get_msr(int msr) { unsigned long msrl = -1, msrh = -1; /* NOTE: rdmsr is