Commit 5da7936
x86/boot/64: Simplify global variable accesses in GDT/IDT programming
There are two code paths in the startup code to program an IDT: one that
runs from the 1:1 mapping and one that runs from the virtual kernel
mapping. Currently, these are strictly separate because fixup_pointer()
is used on the 1:1 path, which will produce the wrong value when used
while executing from the virtual kernel mapping.
Switch to RIP_REL_REF() so that the two code paths can be merged. Also,
move the GDT and IDT descriptors to the stack so that they can be
referenced directly, rather than via RIP_REL_REF().
Rename startup_64_setup_env() to startup_64_setup_gdt_idt() while at it,
to make the call from assembler self-documenting.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20240221113506.2565718-19-ardb+git@google.com1 parent 2e5fc47 commit 5da7936
3 files changed
Lines changed: 32 additions & 49 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 80 | | |
89 | 81 | | |
90 | 82 | | |
| |||
569 | 561 | | |
570 | 562 | | |
571 | 563 | | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
| 564 | + | |
| 565 | + | |
578 | 566 | | |
579 | | - | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
580 | 571 | | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
| 572 | + | |
588 | 573 | | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
602 | 579 | | |
603 | 580 | | |
604 | | - | |
605 | | - | |
| 581 | + | |
606 | 582 | | |
607 | 583 | | |
608 | 584 | | |
609 | 585 | | |
610 | 586 | | |
611 | | - | |
| 587 | + | |
| 588 | + | |
612 | 589 | | |
613 | 590 | | |
614 | | - | |
| 591 | + | |
615 | 592 | | |
616 | 593 | | |
617 | | - | |
618 | | - | |
| 594 | + | |
619 | 595 | | |
620 | 596 | | |
621 | 597 | | |
622 | 598 | | |
623 | 599 | | |
624 | | - | |
| 600 | + | |
625 | 601 | | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
626 | 609 | | |
627 | | - | |
628 | 610 | | |
629 | 611 | | |
630 | 612 | | |
631 | 613 | | |
632 | 614 | | |
633 | 615 | | |
634 | 616 | | |
635 | | - | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
636 | 621 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | 71 | | |
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | | - | |
| 78 | + | |
81 | 79 | | |
82 | 80 | | |
83 | 81 | | |
| |||
0 commit comments