Re: Incorrect execve_wrapper macro?

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

 



On Tue, Mar 23, 2010 at 8:45 PM, John David Anglin
<dave@xxxxxxxxxxxxxxxxxx> wrote:
>> The execve_wrapper macro loads thread->task like this:
>> LDREG   TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
>>
>> This assumes that at the point the macro is called that there is only
>> THREAD_SZ_ALGN+FRAME_SIZE between %r30 and the starting value of %r30
>> (cr30).
>>
>> However, in the syscall entry path I see (syscall.S):
>> ldo     THREAD_SZ_ALGN+FRAME_SIZE(%r30),%r30  /* set up kernel stack */
>> ...
>> STREGM  %r1,FRAME_SIZE(%r30)            /* save r1 (usp) here for now */
>>
>> Which means that between %r30 and the start there is actually
>> THREAD_SZ_ALGN+2*FRAME_SIZE.
>
> This is wrong as there is a compensating LDREGM:
>
>        LDREGM  -FRAME_SIZE(%r30), %r2          /* get users sp back */

Thanks, I missed the `M` and thought it was just loading from a negative offset.

>> or heaven forbid the easier to read:
>>
>> mfctl   %cr30,%r1                       /* get task ptr in %r1 */
>> LDREG   TI_TASK(%r1),%r1
>
> The above looks safer...

It is, but a little bit slower, does it matter?

This change would make execve_wrapper independent of r30's value.

I think for now I'll just document the requirement.

Cheers,
Carlos.
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux