Re: [PATCH 4 of 7] x86/paravirt: selectively save/restore regs aroundpvops calls

From: Jeremy Fitzhardinge
Date: Thu Jan 29 2009 - 04:30:54 EST


Rusty Russell wrote:
On Thursday 29 January 2009 09:05:04 Jeremy Fitzhardinge wrote:
+#define PV_SAVE_REGS(set) \
+ COND_PUSH(set, CLBR_RAX, rax); \
+ COND_PUSH(set, CLBR_RCX, rcx); \
+ COND_PUSH(set, CLBR_RDX, rdx); \
+ COND_PUSH(set, CLBR_RSI, rsi); \
+ COND_PUSH(set, CLBR_RDI, rdi); \
+ COND_PUSH(set, CLBR_R8, r8); \
+ COND_PUSH(set, CLBR_R9, r9); \
+ COND_PUSH(set, CLBR_R10, r10); \
+ COND_PUSH(set, CLBR_R11, r11)

It's kind of messy. Can we do something clever here with token pasting?

I tried a few things, but no. Passing in just RAX, and then pasting CLBR_##reg works, and the assembler accepts %RAX - but - the asm code also #defines RAX <some stack offset>, so the assembler ends up seeing %48. I considered renaming all the CLBR_ defines to CLBR_rax, but that looks unhappy too. So I stayed with this.

J
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/