How to understand the comment of macro *compute_indices*?

Valdis Kl=?utf-8?Q?=c4=93?=tnieks valdis.kletnieks at vt.edu
Mon Jul 13 22:21:13 EDT 2020


On Tue, 14 Jul 2020 07:54:04 +0800, carver said:
> Hello,
>
> Macro *compute_indices* in arch/arm64/kernel/head.S have a comment
> as shown below:
> 	mov     \istart, \ptrs
> 	mul     \istart, \istart, \count
> 	add     \iend, \iend, \istart   // iend += (count - 1) * ptrs
>
> I am wondering whether this comment should be change to
> "iend += count * ptrs".

Examine the uses of the macro, and see where they expect the result
to be pointing if there is exactly one entry. (Hint - what's the address of
the first entry of a C array, and what's the next location after the array,
and how would the corresponding C code for iterating across the array
have as the termination condition?)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200713/f77219fa/attachment.sig>


More information about the Kernelnewbies mailing list