Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1301091
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) |
| Date | 2016-01-04 22:10 +0100 |
| Message-ID | <qNky7-oU-17@gated-at.bofh.it> (permalink) |
| References | <qN289-4OO-3@gated-at.bofh.it> <qN28a-4OO-15@gated-at.bofh.it> <qNc7z-3jA-87@gated-at.bofh.it> <qNh7c-6vZ-17@gated-at.bofh.it> <qNhJW-6ZN-45@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Jan 04, 2016 at 10:08:43AM -0800, Andy Lutomirski wrote:
> All of that's correct, including the part where it's confusing. The
> comments aren't the best.
>
> How about adding a comment like:
>
> ----- begin comment -----
>
> The offset to the fixup is signed, and we're trying to use the high
> bits for a different purpose. In C, we could just do:
>
> u32 class_and_offset = ((target - here) & 0x3fffffff) | class;
>
> Then, to decode it, we'd mask off the class and sign-extend to recover
> the offset.
>
> In asm, we can't do that, because this all gets laundered through the
> linker, and there's no relocation type that supports this chicanery.
> Instead we cheat a bit. We first add a large number to the offset
> (0x20000000). The result is still nominally signed, but now it's
> always positive, and the two high bits are always clear. We can then
> set high bits by ordinary addition or subtraction instead of using
> bitwise operations. As far as the linker is concerned, all we're
> doing is adding a large constant to the difference between here (".")
> and the target, and that's a valid relocation type.
>
> In the C code, we just mask off the class bits and subtract 0x20000000
> to get the offset.
>
> ----- end comment -----
Yeah, that makes more sense, thanks.
That nasty "." current position thing stays in the way to do it cleanly. :-)
Anyway, ok, I see it now. It still feels a bit hacky to me. I probably
would've added the third int to the exception table instead. It would've
been much more straightforward and clean this way and I'd gladly pay the
additional 6K growth.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Andy Lutomirski <luto@amacapital.net> - 2016-01-04 02:30 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Tony Luck <tony.luck@gmail.com> - 2016-01-04 02:40 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Ingo Molnar <mingo@kernel.org> - 2016-01-04 08:50 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Borislav Petkov <bp@alien8.de> - 2016-01-04 13:10 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Tony Luck <tony.luck@gmail.com> - 2016-01-04 18:30 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Andy Lutomirski <luto@amacapital.net> - 2016-01-04 19:10 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Tony Luck <tony.luck@gmail.com> - 2016-01-04 20:00 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Andy Lutomirski <luto@amacapital.net> - 2016-01-04 20:10 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Borislav Petkov <bp@alien8.de> - 2016-01-04 22:10 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Andy Lutomirski <luto@amacapital.net> - 2016-01-04 23:30 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Borislav Petkov <bp@alien8.de> - 2016-01-05 00:10 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Borislav Petkov <bp@alien8.de> - 2016-01-05 00:10 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Andy Lutomirski <luto@amacapital.net> - 2016-01-05 00:30 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Borislav Petkov <bp@alien8.de> - 2016-01-05 12:30 +0100
Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Tony Luck <tony.luck@gmail.com> - 2016-01-05 00:20 +0100
csiph-web