Skip to content

Commit

Permalink
[PATCH] i386: Implement alternative_io for i386
Browse files Browse the repository at this point in the history
Ported from x86-64.

Signed-off-by: Andi Kleen <ak@suse.de>
  • Loading branch information
Andi Kleen authored and Andi Kleen committed May 2, 2007
1 parent 3671df8 commit e859dc5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions include/asm-i386/alternative.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ static inline void alternatives_smp_switch(int smp) {}
"663:\n\t" newinstr "\n664:\n" /* replacement */\
".previous" :: "i" (feature), ##input)

/* Like alternative_input, but with a single output argument */
#define alternative_io(oldinstr, newinstr, feature, output, input...) \
asm volatile ("661:\n\t" oldinstr "\n662:\n" \
".section .altinstructions,\"a\"\n" \
" .align 4\n" \
" .long 661b\n" /* label */ \
" .long 663f\n" /* new instruction */ \
" .byte %c[feat]\n" /* feature bit */ \
" .byte 662b-661b\n" /* sourcelen */ \
" .byte 664f-663f\n" /* replacementlen */ \
".previous\n" \
".section .altinstr_replacement,\"ax\"\n" \
"663:\n\t" newinstr "\n664:\n" /* replacement */ \
".previous" : output : [feat] "i" (feature), ##input)

/*
* Alternative inline assembly for SMP.
*
Expand Down

0 comments on commit e859dc5

Please sign in to comment.