-/* $OpenBSD: bus_space.c,v 1.27 2022/06/29 07:44:10 kettenis Exp $ */
+/* $OpenBSD: bus_space.c,v 1.28 2022/11/29 21:41:39 guenther Exp $ */
/* $NetBSD: bus_space.c,v 1.2 2003/03/14 18:47:53 christos Exp $ */
/*-
extern int pmap_initialized;
+/* kernel address of "hole" (location of start of iomem in virtual) */
+u_long atdevbase = 0;
+
/*
* Extent maps to manage I/O and memory space. Allocate
* storage for 16 regions in each, initially. Later, ioport_malloc_safe
-/* $OpenBSD: cpu.c,v 1.162 2022/11/08 17:34:13 cheloha Exp $ */
+/* $OpenBSD: cpu.c,v 1.163 2022/11/29 21:41:39 guenther Exp $ */
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
extern long _stac;
extern long _clac;
+int cpuid_level = 0; /* cpuid(0).eax */
+char cpu_vendor[16] = { 0 }; /* cpuid(0).e[bdc]x, \0 */
+int cpu_id = 0; /* cpuid(1).eax */
+int cpu_ebxfeature = 0; /* cpuid(1).ebx */
+int cpu_ecxfeature = 0; /* cpuid(1).ecx */
+int cpu_feature = 0; /* cpuid(1).edx */
+int cpu_perf_eax = 0; /* cpuid(0xa).eax */
+int cpu_perf_ebx = 0; /* cpuid(0xa).ebx */
+int cpu_perf_edx = 0; /* cpuid(0xa).edx */
+int cpu_apmi_edx = 0; /* cpuid(0x80000007).edx */
+int ecpu_ecxfeature = 0; /* cpuid(0x80000001).ecx */
+int cpu_meltdown = 0;
+
void
replacesmap(void)
{
-/* $OpenBSD: locore.S,v 1.129 2022/11/04 16:49:31 kettenis Exp $ */
+/* $OpenBSD: locore.S,v 1.130 2022/11/29 21:41:39 guenther Exp $ */
/* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */
/*
.space NBPG-LAPIC_ISR
#endif
- .globl _C_LABEL(cpu_id),_C_LABEL(cpu_vendor)
- .globl _C_LABEL(cpuid_level),_C_LABEL(cpu_feature)
- .globl _C_LABEL(cpu_ebxfeature)
- .globl _C_LABEL(cpu_ecxfeature),_C_LABEL(ecpu_ecxfeature)
- .globl _C_LABEL(cpu_perf_eax)
- .globl _C_LABEL(cpu_perf_ebx)
- .globl _C_LABEL(cpu_perf_edx)
- .globl _C_LABEL(cpu_apmi_edx)
- .globl _C_LABEL(ssym),_C_LABEL(esym),_C_LABEL(boothowto)
- .globl _C_LABEL(bootdev)
- .globl _C_LABEL(bootinfo), _C_LABEL(bootinfo_size), _C_LABEL(atdevbase)
- .globl _C_LABEL(proc0paddr)
- .globl _C_LABEL(biosbasemem)
- .globl _C_LABEL(bootapiver)
- .globl _C_LABEL(pg_nx)
- .globl _C_LABEL(pg_g_kern)
- .globl _C_LABEL(cpu_meltdown)
-_C_LABEL(cpu_id): .long 0 # saved from `cpuid' instruction
-_C_LABEL(cpu_feature): .long 0 # feature flags from 'cpuid'
- # instruction
-_C_LABEL(cpu_ebxfeature):.long 0 # ext. ebx feature flags from 'cpuid'
-_C_LABEL(cpu_ecxfeature):.long 0 # ext. ecx feature flags from 'cpuid'
-_C_LABEL(ecpu_ecxfeature):.long 0 # extended ecx feature flags
-_C_LABEL(cpu_perf_eax): .long 0 # arch. perf. mon. flags from 'cpuid'
-_C_LABEL(cpu_perf_ebx): .long 0 # arch. perf. mon. flags from 'cpuid'
-_C_LABEL(cpu_perf_edx): .long 0 # arch. perf. mon. flags from 'cpuid'
-_C_LABEL(cpu_apmi_edx): .long 0 # adv. power mgmt. info. from 'cpuid'
-_C_LABEL(cpuid_level): .long -1 # max. level accepted by 'cpuid'
- # instruction
-_C_LABEL(cpu_vendor): .space 16 # vendor string returned by `cpuid'
- # instruction
-_C_LABEL(ssym): .quad 0 # ptr to start of syms
-_C_LABEL(esym): .quad 0 # ptr to end of syms
-_C_LABEL(atdevbase): .quad 0 # location of start of iomem in virtual
-_C_LABEL(bootapiver): .long 0 # /boot API version
-_C_LABEL(bootdev): .long 0 # device we booted from
-_C_LABEL(proc0paddr): .quad 0
-#ifndef REALBASEMEM
-_C_LABEL(biosbasemem): .long 0 # base memory reported by BIOS
-#else
-_C_LABEL(biosbasemem): .long REALBASEMEM
-#endif
-#ifndef REALEXTMEM
-_C_LABEL(biosextmem): .long 0 # extended memory reported by BIOS
-#else
-_C_LABEL(biosextmem): .long REALEXTMEM
-#endif
-_C_LABEL(pg_nx): .quad 0 # NX PTE bit (if CPU supports)
-_C_LABEL(pg_g_kern): .quad 0 # 0x100 if global pages should be used
- # in kernel mappings, 0 otherwise (for
- # insecure CPUs)
-_C_LABEL(cpu_meltdown): .long 0 # 1 if this CPU has Meltdown
-
/*****************************************************************************/
/*
-/* $OpenBSD: machdep.c,v 1.283 2022/11/08 14:46:51 cheloha Exp $ */
+/* $OpenBSD: machdep.c,v 1.284 2022/11/29 21:41:39 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
int cpureset_delay = 0;
#endif
+char *ssym = 0, *esym = 0; /* start and end of symbol table */
+dev_t bootdev = 0; /* device we booted from */
+int biosbasemem = 0; /* base memory reported by BIOS */
+u_int bootapiver = 0; /* /boot API version */
+
int physmem;
u_int64_t dumpmem_low;
u_int64_t dumpmem_high;
size_t newlen, struct proc *p)
{
bios_diskinfo_t *pdi;
- extern dev_t bootdev;
int biosdev;
/* all sysctl names at this level except diskinfo are terminal */
struct gate_descriptor *idt;
char idt_allocmap[NIDT];
-extern struct user *proc0paddr;
+struct user *proc0paddr = NULL;
void
setgate(struct gate_descriptor *gd, void *func, int ist, int type, int dpl,
-/* $OpenBSD: pmap.c,v 1.155 2022/10/16 15:03:39 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.156 2022/11/29 21:41:39 guenther Exp $ */
/* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */
/*
struct pmap kernel_pmap_store; /* the kernel's pmap (proc0) */
+/*
+ * pg_nx: NX PTE bit (if CPU supports)
+ * pg_g_kern: PG_G if global pages should be used in kernel mappings,
+ * 0 otherwise (for insecure CPUs)
+ */
+pt_entry_t pg_nx = 0;
+pt_entry_t pg_g_kern = 0;
+
/*
* pmap_pg_wc: if our processor supports PAT then we set this
* to be the pte bits for Write Combining. Else we fall back to
-/* $OpenBSD: biosvar.h,v 1.28 2022/06/29 07:51:54 kettenis Exp $ */
+/* $OpenBSD: biosvar.h,v 1.29 2022/11/29 21:41:39 guenther Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
void bios_getopt(void);
bios_diskinfo_t *bios_getdiskinfo(dev_t);
+extern int biosbasemem;
extern u_int bootapiver;
extern bios_memmap_t *bios_memmap;
extern bios_efiinfo_t *bios_efiinfo;
-/* $OpenBSD: cpu.h,v 1.153 2022/11/08 17:34:13 cheloha Exp $ */
+/* $OpenBSD: cpu.h,v 1.154 2022/11/29 21:41:39 guenther Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
#ifdef _KERNEL
-/* locore.S */
-extern int biosbasemem;
-extern int biosextmem;
+/* cpu.c */
extern int cpu_feature;
extern int cpu_ebxfeature;
extern int cpu_ecxfeature;
extern int cpu_id;
extern char cpu_vendor[];
extern int cpuid_level;
-extern int cpuspeed;
extern int cpu_meltdown;
-
-/* cpu.c */
extern u_int cpu_mwait_size;
extern u_int cpu_mwait_states;
/* identcpu.c */
void identifycpu(struct cpu_info *);
int cpu_amd64speed(int *);
+extern int cpuspeed;
/* machdep.c */
void dumpconf(void);