[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1B20BA6B-BF17-4A3E-AE65-49828B708B5C@zytor.com>
Date: Wed, 20 May 2015 15:08:24 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Andy Lutomirski <luto@...capital.net>
CC: "H.J. Lu" <hjl.tools@...il.com>, Borislav Petkov <bp@...en8.de>,
Jan Beulich <JBeulich@...e.com>,
Binutils <binutils@...rceware.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Avoiding unnecessary jump relocations in gas?
Also, obviously, let's get rid of the now unnecessary ASM_NOP2.
On May 20, 2015 2:47:10 PM PDT, Andy Lutomirski <luto@...capital.net> wrote:
>On Wed, May 20, 2015 at 1:59 PM, H. Peter Anvin <hpa@...or.com> wrote:
>> On 05/20/2015 01:53 PM, Andy Lutomirski wrote:
>>> Egads. Now I understand what that code is. I don't like the
>balign,
>>> since this has nothing to do with alignment -- we're creating an
>array
>>> of functions.
>>
>> Actually it does... we align to the beginning of each slot. If
>.balign
>> could be something other than a power of 2 that would work, too.
>
>When I see "align", I think that we want to align to a multiple of X
>but we don't particularly care which multiple of X. Here we want a
>specific address and any other address would be an error.
>
>>
>> I was mostly looking to minimize the amount of gas magic we rely on.
>>
>>> Can't we make it explicit?
>>>
>>> #define EARLY_IDT_HANDLER_STRIDE 9
>>>
>>> ...
>>>
>>> .rept NUM_EXCEPTION_VECTORS
>>> . = early_idt_handlers + i * EARLY_IDT_HANDLER_STRIDE
>>> .if (EXCEPTION_ERRCODE_MASK >> i) & 1
>>> ASM_NOP2
>>> .else
>>> pushl $0 # Dummy error code, to make stack frame uniform
>>> .endif
>>> pushl $i # 20(%esp) Vector number
>>> jmp early_idt_handler
>>> i = i + 1
>>> .endr
>>>
>>> gas will error out if we try to move . backwards, so this should be
>safe.
>>
>> If that works too with all the versions of gas we care about, that
>would
>> be fine (and I do appreciate the explicitness.) However, .[b]align
>is
>> something that will have been well exercised in every version of gas,
>so
>> I do feel slightly safer with it.
>
>I have no idea how to easily test my approach on really old binutils
>versions, but I'm reasonably confident that assigning to . is common.
>
>--Andy
--
Sent from my mobile phone. Please pardon brevity and lack of formatting.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists