Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace gnu c statement expressions #252

Open
nickdesaulniers opened this issue Mar 6, 2023 · 1 comment
Open

replace gnu c statement expressions #252

nickdesaulniers opened this issue Mar 6, 2023 · 1 comment
Assignees

Comments

@nickdesaulniers
Copy link

struct fpu {
  int last_cpu
};
int *current_task, *prev_p, *next_p;
int switch_fpu_prepare_cpu;
long foo_pfo_val__;
void minimal_fpu_save();
void foo() {
  int *__trans_tmp_7 = ({
    ({
      asm("movq %%gs:%[var], %[val]"
          : [val] "=r"(foo_pfo_val__)
          : [var] "p"(&current_task));
      (int *)foo_pfo_val__;
    });
  });
  if (__trans_tmp_7) {
    struct fpu *old_fpu = prev_p;
    minimal_fpu_save(prev_p);
    old_fpu->last_cpu = switch_fpu_prepare_cpu;
  }
}

Can become:

struct fpu {
  int last_cpu
};
int *current_task, *prev_p, *next_p;
int switch_fpu_prepare_cpu;
long foo_pfo_val__;
void minimal_fpu_save();
void foo() {
  asm("movq %%gs:%[var], %[val]"
          : [val] "=r"(foo_pfo_val__)
          : [var] "p"(&current_task));
  if (foo_pfo_val__) {
    struct fpu *old_fpu = prev_p;
    minimal_fpu_save(prev_p);
    old_fpu->last_cpu = switch_fpu_prepare_cpu;
  }
}
@eeide
Copy link
Member

eeide commented Mar 7, 2023

Thank you for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants