>>> On 01.06.12 at 08:04, Zeinab Alebouyeh
<z.alebouyeh@gmail.com> wrote:
> I want to write a program in xen that runs in ring 0 and in unpaged
> protected mode.
> For this, I add a hypercall and in my hypercall function write my code. I
> test my hypercall, it works properly.
> I see the value of CR0 register and I found that the PE and PG bits are 1.
> It means that I am in protected mode with paging enabled.
> In order to disable paging I want to set bit 31 of cr0 to 0, I write the
> bellowing code in my hypercall function:
>
> asm volatile(
> "movl %cr0,%eax\n\t"
> "and 0x7fffffff,%eax\n\t"
> "movl %eax,%cr0"
> );
> But when I invoke my hypercall the system restart!!!
Of course, as this causes a triple fault without a lot of other
things taken care of.
> Can anyone tell me where is my fault and how should I disable paging in xen
> kernel?
Your fault is of conceptual nature - you just can''t do what
you''re
intending to do in a pre-existing OS or OS-like environment. You
should instead consider to write your own OS-like environment
(started via some boot loader), where either you never enable
paging, or have a way to cleanly turn it off when you need to.
Jan