@@ -39,12 +39,20 @@ static __attribute__((used)) void ipi(void)
asm (
"ipi_entry: \n"
- " call ipi \n"
-#ifndef __x86_64__
- " iret"
-#else
- " iretq"
+#ifdef __x86_64__
+ "push %r15; push %r14; push %r13; push %r12 \n\t"
+ "push %r11; push %r10; push %r9; push %r8 \n\t"
#endif
+ "push %"R "di; push %"R "si; push %"R "bp; \n\t"
+ "push %"R "bx; push %"R "dx; push %"R "cx; push %"R "ax \n\t"
+ "call ipi \n\t"
+ "pop %"R "ax; pop %"R "cx; pop %"R "dx; pop %"R "bx \n\t"
+ "pop %"R "bp; pop %"R "si; pop %"R "di \n\t"
+#ifdef __x86_64__
+ "pop %r8; pop %r9; pop %r10; pop %r11 \n\t"
+ "pop %r12; pop %r13; pop %r14; pop %r15 \n\t"
+#endif
+ "iret"W" \n\t"
);
int cpu_count(void)