Subversion Repositories HelenOS-historic

Rev

Rev 984 | Rev 1186 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 984 Rev 1074
Line 51... Line 51...
51
 * Halt the current CPU until interrupt event.
51
 * Halt the current CPU until interrupt event.
52
 */
52
 */
53
static inline void cpu_halt(void) { __asm__("hlt\n"); };
53
static inline void cpu_halt(void) { __asm__("hlt\n"); };
54
static inline void cpu_sleep(void) { __asm__("hlt\n"); };
54
static inline void cpu_sleep(void) { __asm__("hlt\n"); };
55
 
55
 
56
/** Read CR2
56
#define GEN_READ_REG(reg) static inline __native read_ ##reg (void) \
57
 *
57
    { \
58
 * Return value in CR2
58
    __native res; \
59
 *
-
 
-
 
59
    __asm__ volatile ("movl %%" #reg ", %0" : "=r" (res) ); \
60
 * @return Value read.
60
    return res; \
61
 */
61
    }
62
static inline __u32 read_cr2(void) { __u32 v; __asm__ volatile ("movl %%cr2,%0\n" : "=r" (v)); return v; }
-
 
63
 
62
 
64
/** Write CR3
-
 
65
 *
-
 
66
 * Write value to CR3.
63
#define GEN_WRITE_REG(reg) static inline void write_ ##reg (__native regn) \
67
 *
64
    { \
68
 * @param v Value to be written.
65
    __asm__ volatile ("movl %0, %%" #reg : : "r" (regn)); \
69
 */
66
    }
70
static inline void write_cr3(__u32 v) { __asm__ volatile ("movl %0,%%cr3\n" : : "r" (v)); }
-
 
71
 
67
 
-
 
68
GEN_READ_REG(cr0);
-
 
69
GEN_READ_REG(cr2);
72
/** Read CR3
70
GEN_READ_REG(cr3);
-
 
71
GEN_WRITE_REG(cr3);
73
 *
72
 
-
 
73
GEN_READ_REG(dr0);
-
 
74
GEN_READ_REG(dr1);
-
 
75
GEN_READ_REG(dr2);
-
 
76
GEN_READ_REG(dr3);
-
 
77
GEN_READ_REG(dr6);
74
 * Return value in CR3
78
GEN_READ_REG(dr7);
75
 *
79
 
-
 
80
GEN_WRITE_REG(dr0);
76
 * @return Value read.
81
GEN_WRITE_REG(dr1);
77
 */
82
GEN_WRITE_REG(dr2);
78
static inline __u32 read_cr3(void) { __u32 v; __asm__ volatile ("movl %%cr3,%0\n" : "=r" (v)); return v; }
83
GEN_WRITE_REG(dr3);
-
 
84
GEN_WRITE_REG(dr6);
-
 
85
GEN_WRITE_REG(dr7);
79
 
86
 
80
/** Byte to port
87
/** Byte to port
81
 *
88
 *
82
 * Output byte to port
89
 * Output byte to port
83
 *
90
 *