The new paging implementation needs to access paging structures in
physical memory, making it necessary to temporarily disable paging.
This commit adds the necessary functions to explicitly disable and
enable paging on a processor.
*/
.global cpu_get_id
-
cpu_get_id:
movl $APIC_ID_ADDR, %esi
movl (%esi), %eax
ret
.global cpu_get_capabilities
-
cpu_get_capabilities:
pushl %ebx
movl $1, %eax
ret
.global cpu_set_pstate
-
cpu_set_pstate:
pushl %ebx
movl $0x199, %ecx
wrmsr
popl %ebx
ret
+
+.global cpu_paging_disable
+cpu_paging_disable:
+ movl %cr0, %eax
+ movl %eax, %ecx
+ andl $0x7fffffff, %eax
+ movl %eax, %cr0
+ movl %ecx, %eax
+ shr $31, %eax
+ ret
+
+.global cpu_paging_enable
+cpu_paging_enable:
+ movl %cr0, %eax
+ movl %eax, %ecx
+ orl $0x80000000, %eax
+ movl %eax, %cr0
+ movl %ecx, %eax
+ shr $31, %eax
+ ret
u32_t cpu_set_pstate(int pstate);
+int cpu_paging_enable(void);
+int cpu_paging_disable(void);
+
int task_prepare(struct task*, u32_t cr3, u32_t eip, u32_t esp0, u32_t esp, u32_t priv);
int task_prepare_fork(struct task*);
int task_switch(struct task*);