Module Name: src Committed By: maxv Date: Thu Oct 19 18:36:31 UTC 2017
Modified Files: src/sys/arch/amd64/acpi: acpi_wakeup_low.S src/sys/arch/amd64/amd64: locore.S machdep.c Log Message: Improve our segregs model. Pass 1/3. Right now, we are saving and restoring %ds/%es each time we enter/leave the kernel. However, we let %fs/%gs live in the kernel space, and we rely on the fact that when switching to an LWP, %fs/%gs are set right away (via cpu_switchto or setregs). It has two drawbacks: we are taking care of %ds/%es while they are deprecated (useless) on 64bit LWPs, and we are restricting %fs/%gs while they still have a meaning on 32bit LWPs. Therefore, handle 32bit and 64bit LWPs differently: * 64bit LWPs use fixed segregs, which are not taken care of. * 32bit LWPs have dynamic segregs, always saved/restored. For now, only %ds and %es are changed; %fs and %gs will be in the next passes. The trapframe is constructed as usual. In INTRFASTEXIT, we restore %ds/%es depending on the %cs value. If %cs contains one of the two standard 64bit selectors, don't do anything. Otherwise, restore everything. When doing a context switch, just restore %ds/%es to their default values. On a 32bit LWP they will be overwritten by INTRFASTEXIT; on a 64bit LWP they won't be updated. In the ACPI wakeup code, restore %ds/%es to the default 64bit user value. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amd64/acpi/acpi_wakeup_low.S cvs rdiff -u -r1.133 -r1.134 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.269 -r1.270 src/sys/arch/amd64/amd64/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.