Subversion Repositories HelenOS-historic

Rev

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

Rev 224 Rev 226
Line 34... Line 34...
34
 
34
 
35
 
35
 
36
void asm_delay_loop(__u32 t);
36
void asm_delay_loop(__u32 t);
37
void asm_fake_loop(__u32 t);
37
void asm_fake_loop(__u32 t);
38
 
38
 
39
/* TODO: implement the real stuff */
-
 
40
static inline __address get_stack_base(void)
39
static inline __address get_stack_base(void)
41
{
40
{
-
 
41
    __address v;
-
 
42
   
-
 
43
    __asm__ volatile ("andq %%rsp, %0\n" : "=r" (v) : "0" (~((__u64)STACK_SIZE-1)));
-
 
44
   
42
    return NULL;
45
    return v;
43
}
46
}
44
 
47
 
45
static inline void cpu_sleep(void) { __asm__("hlt"); };
48
static inline void cpu_sleep(void) { __asm__("hlt"); };
46
static inline void cpu_halt(void) { __asm__("hlt"); };
49
static inline void cpu_halt(void) { __asm__("hlt"); };
47
 
50
 
Line 49... Line 52...
49
static inline __u8 inb(__u16 port)
52
static inline __u8 inb(__u16 port)
50
{
53
{
51
    __u8 out;
54
    __u8 out;
52
 
55
 
53
    asm (
56
    asm (
54
        "mov %0, %%dx;"
57
        "mov %1, %%dx;"
55
        "inb %%dx,%%al;"
58
        "inb %%dx,%%al;"
56
        "mov %%al, %1;"
59
        "mov %%al, %0;"
57
        :"=m"(out)
60
        :"=m"(out)
58
        :"m"(port)
61
        :"m"(port)
59
        :"%dx","%al"
62
        :"%dx","%al"
60
        );
63
        );
61
    return out;
64
    return out;