hos/kernel/sys/cpu.h
josh 6cd78f195f changed kernel stack top to 0x40000000 (1GB) virtual
git-svn-id: svn://anubis/hos/trunk@81 5b3e749e-e535-0410-8002-a9bb6afbdfca
2010-01-07 15:56:53 +00:00

41 lines
820 B
C

#ifndef CPU_H
#define CPU_H
#include "hos_types.h"
static u32_t read_cr0() __attribute__ ((unused));
static u32_t read_cr0()
{
u32_t val;
__asm__ __volatile__ ("movl %%cr0, %0" : "=r" (val));
return val;
}
static u32_t read_cr2() __attribute__ ((unused));
static u32_t read_cr2()
{
u32_t val;
__asm__ __volatile__ ("movl %%cr2, %0" : "=r" (val));
return val;
}
static u32_t read_cr3() __attribute__ ((unused));
static u32_t read_cr3()
{
u32_t val;
__asm__ __volatile__ ("movl %%cr3, %0" : "=r" (val));
return val;
}
#define write_cr0(val) \
__asm__ __volatile__ ("movl %0, %%cr0" : : "r" (val));
#define write_cr3(val) \
__asm__ __volatile__ ("movl %0, %%cr3" : : "r" (val));
#define write_esp(val) \
__asm__ __volatile__ ("movl %0, %%esp" : : "r" (val));
#endif