Subversion Repositories HelenOS-historic

Rev

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

Rev 597 Rev 625
Line 52... Line 52...
52
 
52
 
53
static inline void cpu_sleep(void) { __asm__ volatile ("hlt\n"); };
53
static inline void cpu_sleep(void) { __asm__ volatile ("hlt\n"); };
54
static inline void cpu_halt(void) { __asm__ volatile ("hlt\n"); };
54
static inline void cpu_halt(void) { __asm__ volatile ("hlt\n"); };
55
 
55
 
56
 
56
 
57
static inline __u8 inb(__u16 port)
57
/** Byte from port
58
{
58
 *
59
    __u8 out;
59
 * Get byte from port
60
 
60
 *
61
    __asm__ volatile (
61
 * @param port Port to read from
62
        "mov %1, %%dx\n"
-
 
63
        "inb %%dx,%%al\n"
-
 
64
        "mov %%al, %0\n"
-
 
65
        :"=m"(out)
-
 
66
        :"m"(port)
-
 
67
        :"%rdx","%rax"
-
 
68
        );
-
 
69
    return out;
62
 * @return Value read
70
}
63
 */
-
 
64
static inline __u8 inb(__u16 port) { __u8 val; __asm__ volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port) ); return val; }
71
 
65
 
72
static inline __u8 outb(__u16 port,__u8 b)
66
/** Byte to port
73
{
67
 *
74
    __asm__ volatile (
-
 
75
        "mov %0,%%dx\n"
-
 
76
        "mov %1,%%al\n"
-
 
77
        "outb %%al,%%dx\n"
68
 * Output byte to port
78
        :
69
 *
79
        :"m"( port), "m" (b)
70
 * @param port Port to write to
80
        :"%rdx","%rax"
71
 * @param val Value to write
81
        );
72
 */
82
}
-
 
-
 
73
static inline void outb(__u16 port, __u8 val) { __asm__ volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port) ); }
83
 
74
 
84
/** Enable interrupts.
75
/** Enable interrupts.
85
 *
76
 *
86
 * Enable interrupts and return previous
77
 * Enable interrupts and return previous
87
 * value of EFLAGS.
78
 * value of EFLAGS.