Skip to content

Commit

Permalink
ch7: fix: console input does not work in x86_64
Browse files Browse the repository at this point in the history
A stupid typo (x96_64) make the first_bit work incorrectly.
Also add #else macro to prevent such kind of error.
  • Loading branch information
koukaipan committed Aug 25, 2013
1 parent 99175b0 commit c758de1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions chapter7/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ void init_events(void)
HYPERVISOR_set_callbacks(
FLAT_KERNEL_CS, (unsigned long)hypervisor_callback,
FLAT_KERNEL_CS, (unsigned long)failsafe_callback);
#else
#elif defined (__x86_64__)
HYPERVISOR_set_callbacks(
(unsigned long)hypervisor_callback,
(unsigned long)failsafe_callback, 0);
#else
#error "Unsupported architecture"
#endif
/* Set all handlers to ignore, and mask them */
for(unsigned int i=0 ; i<NUM_CHANNELS ; i++)
Expand All @@ -65,10 +67,12 @@ static inline unsigned long int first_bit(unsigned long int word)
__asm__("bsfl %1,%0"
:"=r" (word)
:"rm" (word));
#elif defined (__x96_64__)
#elif defined (__x86_64__)
__asm__("bsfq %1,%0"
:"=r" (word)
:"rm" (word));
#else
#error "Unsupported architecture"
#endif
return word;
}
Expand All @@ -86,6 +90,8 @@ static inline unsigned long int xchg(unsigned long int * old, unsigned long int
:"=r" (value)
:"m" (*old), "0"(value)
:"memory");
#else
#error "Unsupported architecture"
#endif
return value;
}
Expand Down

0 comments on commit c758de1

Please sign in to comment.