This patch modifies the x86 alternative macros to allow more than one
alternative code sequence.
This is done by simply adding multiple alternative patches, which are
applied in sequence, overwriting previous ones.
+/* alternative assembly primitive: */
+#define ALTERNATIVE(oldinstr, newinstr, feature) \
+ "661:\n\t" oldinstr "\n662:\n" \
+ ALTERNATIVE_PATCH("661b", "662b", newinstr, feature)
+
+#define ALTERNATIVE3(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+ "661:\n\t" oldinstr "\n662:\n" \
+ ALTERNATIVE_PATCH("661b", "662b", newinstr1, feature1) "\n" \
+ ALTERNATIVE_PATCH("661b", "662b", newinstr2, feature2)
+
+#define ALTERNATIVE4(oldinstr, newinstr1, feature1, newinstr2, feature2, newinstr3, feature3) \
+ "661:\n\t" oldinstr "\n662:\n" \
+ ALTERNATIVE_PATCH("661b", "662b", newinstr1, feature1) "\n" \
+ ALTERNATIVE_PATCH("661b", "662b", newinstr2, feature2) "\n" \
+ ALTERNATIVE_PATCH("661b", "662b", newinstr3, feature3)
+