Seg fault for writing to CR0

1

I'm trying to write to CR0 in Linux, but I keep getting a segmentation fault. This for assembly of i386 or x86_64. Is there anyway of getting around this?

Bellow is part of the code that sets the segfault.

mov eax,0xffffffff      ;system call number (sys_write)
mov cr0,eax
linux
assembly
x86
asked on Stack Overflow Apr 17, 2012 by Dr.Knowitall • edited Jun 29, 2019 by Peter Cordes

1 Answer

7

CR0 is a protected register. It cannot be modified in a userspace linux application.

answered on Stack Overflow Apr 17, 2012 by Michael Slade

User contributions licensed under CC BY-SA 3.0