-/* $OpenBSD: acpi_wakecode.S,v 1.49 2022/12/01 00:26:15 guenther Exp $ */
+/* $OpenBSD: acpi_wakecode.S,v 1.50 2024/02/25 22:33:09 guenther Exp $ */
/*
* Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
* Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
wrmsr
movl $MSR_CSTAR, %ecx
- movl .Lacpi_saved_cstar, %eax
- movl .Lacpi_saved_cstar+4, %edx
+ xorl %eax, %eax
+ xorl %edx, %edx
wrmsr
movl $MSR_SFMASK, %ecx
.quad 0
_ACPI_TRMP_DATA_LABEL(.Lacpi_saved_lstar)
.quad 0
-_ACPI_TRMP_DATA_LABEL(.Lacpi_saved_cstar)
- .quad 0
_ACPI_TRMP_DATA_LABEL(.Lacpi_saved_sfmask)
.quad 0
#if NLAPIC > 0
movl %eax, .Lacpi_saved_star
movl %edx, .Lacpi_saved_star+4
- movl $MSR_CSTAR, %ecx
- rdmsr
- movl %eax, .Lacpi_saved_cstar
- movl %edx, .Lacpi_saved_cstar+4
-
movl $MSR_LSTAR, %ecx
rdmsr
movl %eax, .Lacpi_saved_lstar
-/* $OpenBSD: cpu.c,v 1.182 2024/02/24 17:00:05 deraadt Exp $ */
+/* $OpenBSD: cpu.c,v 1.183 2024/02/25 22:33:09 guenther Exp $ */
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
{
wrmsr(MSR_STAR,
((uint64_t)GSEL(GCODE_SEL, SEL_KPL) << 32) |
- ((uint64_t)GSEL(GUCODE32_SEL, SEL_UPL) << 48));
+ ((uint64_t)GSEL(GUDATA_SEL-1, SEL_UPL) << 48));
wrmsr(MSR_LSTAR, cpu_meltdown ? (uint64_t)Xsyscall_meltdown :
(uint64_t)Xsyscall);
- wrmsr(MSR_CSTAR, (uint64_t)Xsyscall32);
+ wrmsr(MSR_CSTAR, 0);
wrmsr(MSR_SFMASK, PSL_NT|PSL_T|PSL_I|PSL_C|PSL_D|PSL_AC);
wrmsr(MSR_FSBASE, 0);
-/* $OpenBSD: locore.S,v 1.145 2024/02/12 01:18:17 guenther Exp $ */
+/* $OpenBSD: locore.S,v 1.146 2024/02/25 22:33:09 guenther Exp $ */
/* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */
/*
lfence
END(savectx)
-// XXX this should not behave like a nop
-IDTVEC(syscall32)
- sysret /* go away please */
-END(Xsyscall32)
-
/*
* syscall insn entry.
* Enter here with interrupts blocked; %rcx contains the caller's
-/* $OpenBSD: machdep.c,v 1.290 2024/02/03 16:21:22 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.291 2024/02/25 22:33:09 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
set_mem_segment(GDT_ADDR_MEM(cpu_info_primary.ci_gdt, GDATA_SEL), 0,
0xfffff, SDT_MEMRWA, SEL_KPL, 1, 0, 1);
- set_mem_segment(GDT_ADDR_MEM(cpu_info_primary.ci_gdt, GUCODE32_SEL), 0,
- atop(VM_MAXUSER_ADDRESS32) - 1, SDT_MEMERA, SEL_UPL, 1, 1, 0);
-
set_mem_segment(GDT_ADDR_MEM(cpu_info_primary.ci_gdt, GUDATA_SEL), 0,
atop(VM_MAXUSER_ADDRESS) - 1, SDT_MEMRWA, SEL_UPL, 1, 0, 1);
-/* $OpenBSD: vmm_machdep.c,v 1.18 2024/02/12 02:57:14 jsg Exp $ */
+/* $OpenBSD: vmm_machdep.c,v 1.19 2024/02/25 22:33:09 guenther Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
msr_store[2].vms_index = MSR_LSTAR;
msr_store[2].vms_data = rdmsr(MSR_LSTAR);
msr_store[3].vms_index = MSR_CSTAR;
- msr_store[3].vms_data = rdmsr(MSR_CSTAR);
+ msr_store[3].vms_data = 0;
msr_store[4].vms_index = MSR_SFMASK;
msr_store[4].vms_data = rdmsr(MSR_SFMASK);
msr_store[5].vms_index = MSR_KERNELGSBASE;
-/* $OpenBSD: vmm_support.S,v 1.24 2023/11/28 00:17:48 dv Exp $ */
+/* $OpenBSD: vmm_support.S,v 1.25 2024/02/25 22:33:09 guenther Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
pushq %rax
pushq %rdx
- /* XXX - unused? */
- movq $MSR_CSTAR, %rcx
- rdmsr
- pushq %rax
- pushq %rdx
-
movq $MSR_SFMASK, %rcx
rdmsr
pushq %rax
movq $MSR_SFMASK, %rcx
wrmsr
- /* XXX - unused? */
- popq %rdx
- popq %rax
+ /* make sure guest doesn't bleed into host */
+ xorl %edx, %edx
+ xorl %eax, %eax
movq $MSR_CSTAR, %rcx
wrmsr
pushq %rax
pushq %rdx
- /* XXX - unused? */
- movq $MSR_CSTAR, %rcx
- rdmsr
- pushq %rax
- pushq %rdx
-
movq $MSR_SFMASK, %rcx
rdmsr
pushq %rax
movq $MSR_SFMASK, %rcx
wrmsr
- /* XXX - unused? */
- popq %rdx
- popq %rax
+ /* make sure guest doesn't bleed into host */
+ xorl %edx, %edx
+ xorl %eax, %eax
movq $MSR_CSTAR, %rcx
wrmsr
-/* $OpenBSD: segments.h,v 1.16 2024/01/19 18:38:16 kettenis Exp $ */
+/* $OpenBSD: segments.h,v 1.17 2024/02/25 22:33:09 guenther Exp $ */
/* $NetBSD: segments.h,v 1.1 2003/04/26 18:39:47 fvdl Exp $ */
/*-
* Then comes the predefined TSS descriptor.
* There are NGDT_SYS of them.
*
- * The particular order of the UCODE32, UDATA, and UCODE descriptors is
- * required by the syscall/sysret instructions.
+ * The particular order of the UDATA and UCODE descriptors is
+ * required by the sysretq instruction.
*/
#define GNULL_SEL 0 /* Null descriptor */
#define GCODE_SEL 1 /* Kernel code descriptor */
#define GDATA_SEL 2 /* Kernel data descriptor */
-#define GUCODE32_SEL 3 /* User 32bit code descriptor (unused) */
-#define GUDATA_SEL 4 /* User data descriptor */
-#define GUCODE_SEL 5 /* User code descriptor */
-#define NGDT_MEM 6
+#define GUDATA_SEL 3 /* User data descriptor */
+#define GUCODE_SEL 4 /* User code descriptor */
+#define NGDT_MEM 5
#define GPROC0_SEL 0 /* common TSS */
#define NGDT_SYS 1