Subversion Repositories HelenOS

Rev

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

Rev 2452 Rev 2453
Line 56... Line 56...
56
}
56
}
57
 
57
 
58
static inline void cpu_sleep(void)
58
static inline void cpu_sleep(void)
59
{
59
{
60
    asm volatile ("hlt\n");
60
    asm volatile ("hlt\n");
61
};
61
}
62
 
62
 
63
static inline void cpu_halt(void)
63
static inline void cpu_halt(void)
64
{
64
{
65
    asm volatile ("hlt\n");
65
    asm volatile ("hlt\n");
66
};
66
}
67
 
67
 
68
 
68
 
69
/** Byte from port
69
/** Byte from port
70
 *
70
 *
71
 * Get byte from port
71
 * Get byte from port
72
 *
72
 *
73
 * @param port Port to read from
73
 * @param port Port to read from
74
 * @return Value read
74
 * @return Value read
75
 */
75
 */
-
 
76
static inline uint8_t inb(uint16_t port)
-
 
77
{
-
 
78
    uint8_t val;
-
 
79
 
76
static inline uint8_t inb(uint16_t port) { uint8_t val; __asm__ volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port) ); return val; }
80
    asm volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port));
-
 
81
    return val;
-
 
82
}
77
 
83
 
78
/** Byte to port
84
/** Byte to port
79
 *
85
 *
80
 * Output byte to port
86
 * Output byte to port
81
 *
87
 *
82
 * @param port Port to write to
88
 * @param port Port to write to
83
 * @param val Value to write
89
 * @param val Value to write
84
 */
90
 */
-
 
91
static inline void outb(uint16_t port, uint8_t val)
-
 
92
{
85
static inline void outb(uint16_t port, uint8_t val) { __asm__ volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port) ); }
93
    asm volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port));
-
 
94
}
86
 
95
 
87
/** Swap Hidden part of GS register with visible one */
96
/** Swap Hidden part of GS register with visible one */
88
static inline void swapgs(void) { __asm__ volatile("swapgs"); }
97
static inline void swapgs(void)
-
 
98
{
-
 
99
    asm volatile("swapgs");
-
 
100
}
89
 
101
 
90
/** Enable interrupts.
102
/** Enable interrupts.
91
 *
103
 *
92
 * Enable interrupts and return previous
104
 * Enable interrupts and return previous
93
 * value of EFLAGS.
105
 * value of EFLAGS.