u have to put the asm code in kernel module, and load it via "insmod" and when it execute, it will affect all the processes .....and btw, your version is dangerous....normally people will always query the latest value of Cr0, and then OR with the value they want to modify. below is one that worked:<div>
<br></div><div><a href="http://stackoverflow.com/questions/3962950/how-to-set-control-register-0-cr0-bits-in-x86-64-using-gcc-assembly-on-linux">http://stackoverflow.com/questions/3962950/how-to-set-control-register-0-cr0-bits-in-x86-64-using-gcc-assembly-on-linux</a><br>
<div><br><br><div class="gmail_quote">On Mon, Jul 23, 2012 at 12:00 PM, Fan Yang <span dir="ltr"><<a href="mailto:lljyangfan@gmail.com" target="_blank">lljyangfan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
hi all:<div> when I change the cr0 register I get a "Segmentation fault (core dumped)".</div><div> my code is :</div><div> </div><div><br></div><div>.data</div><div>.text</div><div>.global _start</div>
<div>_start:</div><div> movl %eax, %cr0</div><div><br></div><div> this code can work well in ubuntu system when I use root to run it. So what can I do to work it in redhat system?</div><div><br></div><div> thanks</div>
<div><br></div>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh<br>
</div></div>