History log of /fuchsia/zircon/kernel/arch/x86/start.S
Revision Date Author Comments
# b2ae420b 01-Jul-2018 Mike Krinkin <krinkin@google.com>

[x86][hypervisor][vm] Avoid lgdt/lidt instructions on every VM exit

On VM exit CPU implictly sets GDT limit to 0xffff even if before
VM entry it was different. So we have to call LGDT on VM exit to
restore the limit.

However GDT limit is just a safe guard that causes GP fauilure if
someone tries to load a segment register with a value pointing
outside GDT. It's not accurate though, for example, space allocated
for GDT and the value of GDT limit depends on the value of
SMP_MAX_CPUS constant, and if SMP_MAX_CPUS doesn't match perfectly
the actual number of cpus, we end up allocating more memory than
needed.

So instead of caring about preserving GDTR limit let's just reserve
0x10000 bytes and map just enough pages to store the actual GDT and
leave the rest unmapped. One benefit of this is that LGDT is a
serializing instruction according to Intel SDM.

Note that unlike IDT we are currently modify GDT in the hypervisor
code after VM exit to restore TSS limit, so we use rw mapping around.

With IDT it's simpler, because it doesn't seem that IDT limit
affects anything unless it's smaller than 256 * 16 - 1, so we can
just get rid of lidt altogether.

Test: manually on Intel NUC and QEMU/KVM, k ut all, runtests

Change-Id: I00f87c24621e38d688859e7bbcea775a5b3f0f80


# bb9e3313 07-May-2018 Thomas Garnier <thgarnie@google.com>

[kernel][kaslr] Create static relocation

Add static relocation for x64 and arm64 using the kernel_relocated_base
global variable. Add the DISABLE_KASLR option. Remove any dependency to
KERNEL_BASE when __code_start should be used. Change symbolize script to
dump kaslr offset and correctly show static addresses. Adapt gdb script
to identify KASLR relocation at early boot or if attached later.

x64 specific:
- Simplify page table to use kernel_relocated_base
- Fix zedboot and multiboot dependencies on the static kernel base
- Ensure 16-bit boot path is relocated for secondary CPUs

SEC-31 #comment Add static relocation of the kernel module

Change-Id: I9acb0a53a82c2bbf9973921e4cfe60a1e03c7006


# a8a6d268 31-May-2018 Gurjant Kalsi <gkalsi@google.com>

[zbi][kernel] Remove all references to bootdata

Convert the kernel from bootdata to zbi with a few
notable exceptions:
+ Process bootdata on x86/PC was not converted
because we intend to migrate that to using
libzbi in a future patch.
+ syscalls_system.cpp/mexec weren't migrated for
the same reason as above.

bootdata_unittest.cpp was also removed because it
tests the bootdata append functionality which is
redundant with libzbi functionality and slated
to be removed.

Tested by booting on the following platforms:
+ QEMU ARM
+ QEMU x86 (KVM)
+ Vim2
+ UEFI based x86 system

Change-Id: Ifcf803b16a20a70ecd2f4aae930b0304e9cb3437


# 1defcb2b 18-Apr-2018 Roland McGrath <mcgrathr@google.com>

[kernel] Use --emit-relocs to add self-fixups

SEC-31 #comment This applies relocations to the kernel.

Change-Id: I07b40308b768a56c889eeb9a9a89c0e897924617


# b9fc8f19 13-Apr-2018 Roland McGrath <mcgrathr@google.com>

[kernel][x86] Remove two avoidable PIC fixups from start.S

Change-Id: I8f4384309dc51f93f4687d7ad73570f903d55698


# 5881b59a 13-Apr-2018 Roland McGrath <mcgrathr@google.com>

[kernel][x86] Make _idt_startup uses position-independent without a fixup

Change-Id: I3351796fde7f2b26279fa4032ba9434b42c37635


# c1932bc5 16-Nov-2017 Travis Geiselbrecht <travisg@google.com>

[kernel] remove most uses of MEMBASE + KERNEL_LOAD_OFFSET

These two variables are almost always used when code wants to know the
kernel's physical load address. Add some code to simply save the kernel
load location at boot time and use that instead.
Also standardized the use of linker script defined variables into a
common header and format.

Change-Id: Iccde557d1082d39167a53b0fdc5f23289d81f200


# e0ec887c 09-Nov-2017 Todd Eisenberger <teisenbe@google.com>

[x86][asm] Convert comments from # to //

Change-Id: I3aa8035a9748262373409444d74c6d9cf465c7ec


# d3d6ed2b 18-Oct-2017 Travis Geiselbrecht <travisg@google.com>

[kernel][bootalloc] initialize the boot allocator identically on x86 and arm64

-Now the x86 boot code could use the boot allocator if it wanted to

Change-Id: Ia5f10c4a21f88b69865bb84516086cb78306a8bd


# 07166ed7 13-Oct-2017 Roland McGrath <mcgrathr@google.com>

[kernel] Consolidate kernel linker script

There is much more that's the same than that's different between
the architectures. Maintaining a single linker script that works
for both is easier than keeping two in synch.

Change-Id: I0655919e3f7dc5f8788d47bbe733f444c87ec97b


# a33758fc 13-Oct-2017 Roland McGrath <mcgrathr@google.com>

[kernel][x86] Let _multiboot_info and _bootdata_base live in .bss

It's easy to store these a little later so there's no need to special-case
force them into .data, and we save two words from the load image.

Change-Id: Idfed604e7e0b4c00442d58f310655a734475603e


# 650c7c1a 11-Oct-2017 Roland McGrath <mcgrathr@google.com>

[kernel][x86] Remove arch/x86/64/ subdirectory

Zircon only supports x86-64.
The historical subdirectory split just makes it harder to find all the code.

Change-Id: I7c828660bd1d4d277718aa74f35a3fab5f2333ea