On 1/16/25 21:54, Xin Li wrote:
On 1/16/2025 9:18 PM, Ethan Zhao wrote:
Just swap the 2 arguments, and it should be:
+ switch_likely (etype, EVENT_TYPE_OTHER) {
after swapped the parameters as following:
+#define switch_likely(v,l) \
+ switch((__typeof__(v))__builtin_expect((v),(l)))
+
__visible noinstr void fred_entry_from_user(struct pt_regs *regs)
{
unsigned long error_code = regs->orig_ax;
+ unsigned short etype = regs->fred_ss.type & 0xf;
/* Invalidate orig_ax so that syscall_get_nr() works
correctly */
regs->orig_ax = -1;
- switch (regs->fred_ss.type) {
+ switch_likely (etype, (EVENT_TYPE_EXTINT == etype ||
EVENT_TYPE_OTHER == etype)) {
This is not what I suggested, the (l) argument should be only one
constant; __builtin_expect() doesn't allow 2 different constants.
The (l) argument is not a boolean expression! It is the *expected value*
of (v).
-hpa