Re: [RFC 1/2] lib/vsprintf: Add support for pte_t
From: Anshuman Khandual
Date: Fri Jun 20 2025 - 02:31:11 EST
On 18/06/25 2:13 PM, David Hildenbrand wrote:
> On 18.06.25 10:33, Anshuman Khandual wrote:
>>
>>
>> On 18/06/25 1:49 PM, David Hildenbrand wrote:
>>>> + case 'p':
>>>> + if (fmt[1] == 't' && fmt[2] == 'e') {
>>>> + pte_t *pte = (pte_t *)ptr;
>>>> +
>>>> + spec.field_width = 10;
>>>> + spec.precision = 8;
>>>> + spec.base = 16;
>>>> + spec.flags = SPECIAL | SMALL | ZEROPAD;
>>>> + if (sizeof(pte_t) == sizeof(u64)) {
>>>> + u64 val = pte_val(*pte);
>>>> +
>>>> + return number(buf, end, val, spec);
>>>> + }
>>>> + WARN_ONCE(1, "Non standard pte_t\n");
>>>
>>> What about 32bit with 32bit pte_t?
>>
>> Ahh, missed that. Just wondering which all platforms might
>> care about the 32 bit pte representation.
>
> I think e.g., 32bit arm has 32bit ptes?
>
> arch/arm/include/asm/pgtable-2level-types.h
>
> typedef u32 pteval_t;
> ...
> typedef struct { pteval_t pte; } pte_t;
Right, missed that. I will accommodate 32 bit representations.