|
@@ -95,14 +95,22 @@ static inline int alternatives_text_reserved(void *start, void *end)
|
|
__OLDINSTR(oldinstr, num) \
|
|
__OLDINSTR(oldinstr, num) \
|
|
alt_end_marker ":\n"
|
|
alt_end_marker ":\n"
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * max without conditionals. Idea adapted from:
|
|
|
|
+ * http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax
|
|
|
|
+ *
|
|
|
|
+ * The additional "-" is needed because gas works with s32s.
|
|
|
|
+ */
|
|
|
|
+#define alt_max_short(a, b) "((" a ") ^ (((" a ") ^ (" b ")) & -(-((" a ") - (" b ")))))"
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Pad the second replacement alternative with additional NOPs if it is
|
|
* Pad the second replacement alternative with additional NOPs if it is
|
|
* additionally longer than the first replacement alternative.
|
|
* additionally longer than the first replacement alternative.
|
|
*/
|
|
*/
|
|
-#define OLDINSTR_2(oldinstr, num1, num2) \
|
|
|
|
- __OLDINSTR(oldinstr, num1) \
|
|
|
|
- ".skip -(((" alt_rlen(num2) ")-(" alt_rlen(num1) ")-(662b-661b)) > 0) * " \
|
|
|
|
- "((" alt_rlen(num2) ")-(" alt_rlen(num1) ")-(662b-661b)),0x90\n" \
|
|
|
|
|
|
+#define OLDINSTR_2(oldinstr, num1, num2) \
|
|
|
|
+ "661:\n\t" oldinstr "\n662:\n" \
|
|
|
|
+ ".skip -((" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")) > 0) * " \
|
|
|
|
+ "(" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")), 0x90\n" \
|
|
alt_end_marker ":\n"
|
|
alt_end_marker ":\n"
|
|
|
|
|
|
#define ALTINSTR_ENTRY(feature, num) \
|
|
#define ALTINSTR_ENTRY(feature, num) \
|