Re: [PATCH 3/3 v5] livepatch: Use the default ftrace_ops instead of REGS when ARGS is available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 12, 2020 at 09:21:44AM +0100, Peter Zijlstra wrote:
> Also, do you want something like:
> 
> unsigned long ftrace_regs_get_register(struct ftrace_regs *regs, unsigned int offset)
> {

I forgot the full regs case:

	if (regs->regs.cs)
		return regs_get_register(regs->regs, offset);

> 	switch (offset / sizeof(long)) {
> 	case  4: /* RBP */
> 
> 	case  8: /* R9  */
> 	case  9: /* R8  */
> 	case 10: /* RAX */
> 	case 11: /* RCX */
> 	case 12: /* RDX */
> 	case 13: /* RSI */
> 	case 14: /* RDI */
> 	case 15: /* ORIG_RAX */
> 	case 16: /* RIP */
> 		return *(unsigned long *)regs->regs + offset;
> 
> 	default:
> 		WARN_ON_ONCE(1);
> 	}
> 	return 0;
> }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux