|
From: | Richard Henderson |
Subject: | Re: [PATCH v16 2/9] linux-user: Add LoongArch signal support |
Date: | Wed, 15 Jun 2022 08:00:07 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
On 6/15/22 02:57, gaosong wrote:
On 2022/6/15 上午12:15, Richard Henderson wrote:+static void *get_ctx(struct target_sctx_info *info) +{ + return (void *)((char *)info + sizeof(struct target_sctx_info)); +}Return type should be struct target_sctx_info *.I wonder that if we return target_fpu_context * and rename get_ctx to get_fpu_context() would be better.So we need't cast like this: struct target_fpu_context *fpu_ctx = (struct target_fpu_context *) get_ctx(info);
Oh, hmm. I think I mis-read the kernel code before -- retain the return type of void* so that you do not need the cast at all in the caller.
The computation in the function is weirdly over-complicated -- it's really just "return info + 1".
r~
[Prev in Thread] | Current Thread | [Next in Thread] |