* [question] Whats up with loading the GDT in startup_setup_env in x86_64?
@ 2022-03-25 15:35 Harm Smits
2022-03-28 13:17 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Harm Smits @ 2022-03-25 15:35 UTC (permalink / raw)
To: kernel-janitors
Hello,
I really have no clue where to ask these kinds of questions so please
excuse me if this is the wrong mailing list. However, I was working my
way through the linux boot code as I am trying to understand to
somewhat of a degree how Linux booting is done. I have gotten to the
point, right before it switches to virtual address space.
However, there is this one line that just bugs me. Maybe it's an
actual bug (although I doubt it), but the call to `native_load_gdt`
contains a virtual address space ptr, and I simply am wondering why in
the world it is not page faulting. If I change it to be contained
within `fixup_pointer` it still works, and nothing seems to have
changed.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/head64.c#n617
What's the reason that in this case the pointer is not wrapped in
'fixup_pointer'?
--
Kind regards,
Harm
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [question] Whats up with loading the GDT in startup_setup_env in x86_64?
2022-03-25 15:35 [question] Whats up with loading the GDT in startup_setup_env in x86_64? Harm Smits
@ 2022-03-28 13:17 ` Dan Carpenter
2022-03-28 13:25 ` Harm Smits
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2022-03-28 13:17 UTC (permalink / raw)
To: Harm Smits; +Cc: kernel-janitors
On Fri, Mar 25, 2022 at 04:35:19PM +0100, Harm Smits wrote:
> Hello,
>
> I really have no clue where to ask these kinds of questions so please
> excuse me if this is the wrong mailing list.
I don't know. If no one else knows then try asking on kernel-newbies
kernelnewbies (at) kernelnewbies (dot) org.
If they don't know then you could try stackoverflow.com
regards,
dasn carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [question] Whats up with loading the GDT in startup_setup_env in x86_64?
2022-03-28 13:17 ` Dan Carpenter
@ 2022-03-28 13:25 ` Harm Smits
2022-03-28 14:25 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Harm Smits @ 2022-03-28 13:25 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kernel-janitors
After a bit more digging, I have figured out what's going on. The
compiler optimization passes seem to turn the absolute addressing into
relative addressing by means of %rip. Should I submit a patch to also
wrap it in `fixup_pointer` to make it in line with all the other .data
manipulation in `startup_64_load_idt` and `__startup_64`? This would
also avoid it from completely relying on an optimization pass which
might get changed in the future.
--
Kind regards,
Harm Smits
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [question] Whats up with loading the GDT in startup_setup_env in x86_64?
2022-03-28 13:25 ` Harm Smits
@ 2022-03-28 14:25 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-03-28 14:25 UTC (permalink / raw)
To: Harm Smits; +Cc: kernel-janitors
On Mon, Mar 28, 2022 at 03:25:14PM +0200, Harm Smits wrote:
> After a bit more digging, I have figured out what's going on. The
> compiler optimization passes seem to turn the absolute addressing into
> relative addressing by means of %rip. Should I submit a patch to also
> wrap it in `fixup_pointer` to make it in line with all the other .data
> manipulation in `startup_64_load_idt` and `__startup_64`? This would
> also avoid it from completely relying on an optimization pass which
> might get changed in the future.
>
Your explanation sounds totally reasonable but I'm not a domain expert
for that. If you're sure and you've tested it, then send away. The
worst that can happen is that your patch is rejected but even that means
you learned something so there are only up sides. :)
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-28 14:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-25 15:35 [question] Whats up with loading the GDT in startup_setup_env in x86_64? Harm Smits
2022-03-28 13:17 ` Dan Carpenter
2022-03-28 13:25 ` Harm Smits
2022-03-28 14:25 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.