summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2012-11-11 03:26:14 +0000
committerneel <neel@FreeBSD.org>2012-11-11 03:26:14 +0000
commitbc4be3dff1bc1b0cdc3ea30df0fd3e83998cf9eb (patch)
treeb6b271fb331d43e30e10d824f2042de2c063f2eb /sys/amd64/include
parent263c4acf84c3be71025f3484c0378a83cd668e15 (diff)
parentde6ea8b20e870490db809a8d8a965bd784981d81 (diff)
downloadFreeBSD-src-bc4be3dff1bc1b0cdc3ea30df0fd3e83998cf9eb.zip
FreeBSD-src-bc4be3dff1bc1b0cdc3ea30df0fd3e83998cf9eb.tar.gz
IFC @ r242684
Diffstat (limited to 'sys/amd64/include')
-rw-r--r--sys/amd64/include/atomic.h4
-rw-r--r--sys/amd64/include/cpufunc.h7
-rw-r--r--sys/amd64/include/fpu.h3
-rw-r--r--sys/amd64/include/intr_machdep.h2
-rw-r--r--sys/amd64/include/md_var.h2
-rw-r--r--sys/amd64/include/param.h8
-rw-r--r--sys/amd64/include/pc/bios.h52
-rw-r--r--sys/amd64/include/pcpu.h22
8 files changed, 78 insertions, 22 deletions
diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h
index 99a94b7..91c33e6 100644
--- a/sys/amd64/include/atomic.h
+++ b/sys/amd64/include/atomic.h
@@ -226,7 +226,7 @@ atomic_fetchadd_long(volatile u_long *p, u_long v)
static __inline void \
atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
{ \
- __asm __volatile("" : : : "memory"); \
+ __compiler_membar(); \
*p = v; \
} \
struct __hack
@@ -240,7 +240,7 @@ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \
u_##TYPE tmp; \
\
tmp = *p; \
- __asm __volatile("" : : : "memory"); \
+ __compiler_membar(); \
return (tmp); \
} \
struct __hack
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h
index 09d04db..7243173 100644
--- a/sys/amd64/include/cpufunc.h
+++ b/sys/amd64/include/cpufunc.h
@@ -290,6 +290,13 @@ popcntq(u_long mask)
}
static __inline void
+lfence(void)
+{
+
+ __asm __volatile("lfence" : : : "memory");
+}
+
+static __inline void
mfence(void)
{
diff --git a/sys/amd64/include/fpu.h b/sys/amd64/include/fpu.h
index 4c39fa6..1ce59d0 100644
--- a/sys/amd64/include/fpu.h
+++ b/sys/amd64/include/fpu.h
@@ -63,7 +63,8 @@ int fpusetregs(struct thread *td, struct savefpu *addr,
char *xfpustate, size_t xfpustate_size);
int fpusetxstate(struct thread *td, char *xfpustate,
size_t xfpustate_size);
-int fputrap(void);
+int fputrap_sse(void);
+int fputrap_x87(void);
void fpuuserinited(struct thread *td);
struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags);
void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx);
diff --git a/sys/amd64/include/intr_machdep.h b/sys/amd64/include/intr_machdep.h
index 9d066b1..700e35f 100644
--- a/sys/amd64/include/intr_machdep.h
+++ b/sys/amd64/include/intr_machdep.h
@@ -140,7 +140,9 @@ int elcr_probe(void);
enum intr_trigger elcr_read_trigger(u_int irq);
void elcr_resume(void);
void elcr_write_trigger(u_int irq, enum intr_trigger trigger);
+#ifdef SMP
void intr_add_cpu(u_int cpu);
+#endif
int intr_add_handler(const char *name, int vector, driver_filter_t filter,
driver_intr_t handler, void *arg, enum intr_type flags,
void **cookiep);
diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h
index ff11ea1..5d7cb74 100644
--- a/sys/amd64/include/md_var.h
+++ b/sys/amd64/include/md_var.h
@@ -48,6 +48,7 @@ extern u_int amd_pminfo;
extern u_int via_feature_rng;
extern u_int via_feature_xcrypt;
extern u_int cpu_clflush_line_size;
+extern u_int cpu_stdext_feature;
extern u_int cpu_fxsr;
extern u_int cpu_high;
extern u_int cpu_id;
@@ -57,6 +58,7 @@ extern u_int cpu_procinfo;
extern u_int cpu_procinfo2;
extern char cpu_vendor[];
extern u_int cpu_vendor_id;
+extern char ctx_switch_xsave[];
extern char kstack[];
extern char sigcode[];
extern int szsigcode;
diff --git a/sys/amd64/include/param.h b/sys/amd64/include/param.h
index 6dbeb40..9ddcf68 100644
--- a/sys/amd64/include/param.h
+++ b/sys/amd64/include/param.h
@@ -123,14 +123,6 @@
#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */
/*
- * Ceiling on amount of swblock kva space, can be changed via
- * the kern.maxswzone /boot/loader.conf variable.
- */
-#ifndef VM_SWZONE_SIZE_MAX
-#define VM_SWZONE_SIZE_MAX (32 * 1024 * 1024)
-#endif
-
-/*
* Mach derived conversion macros
*/
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
diff --git a/sys/amd64/include/pc/bios.h b/sys/amd64/include/pc/bios.h
index 364f86c..e7d568e 100644
--- a/sys/amd64/include/pc/bios.h
+++ b/sys/amd64/include/pc/bios.h
@@ -30,16 +30,9 @@
#ifndef _MACHINE_PC_BIOS_H_
#define _MACHINE_PC_BIOS_H_
-extern u_int32_t bios_sigsearch(u_int32_t start, u_char *sig, int siglen,
- int paralen, int sigofs);
-
-#define BIOS_PADDRTOVADDR(x) ((x) + KERNBASE)
-#define BIOS_VADDRTOPADDR(x) ((x) - KERNBASE)
-
/*
* Int 15:E820 'SMAP' structure
*/
-
#define SMAP_SIG 0x534D4150 /* 'SMAP' */
#define SMAP_TYPE_MEMORY 1
@@ -58,22 +51,61 @@ struct bios_smap {
u_int32_t type;
} __packed;
+/*
+ * System Management BIOS
+ */
+#define SMBIOS_START 0xf0000
+#define SMBIOS_STEP 0x10
+#define SMBIOS_OFF 0
+#define SMBIOS_LEN 4
+#define SMBIOS_SIG "_SM_"
+
+struct smbios_eps {
+ uint8_t anchor_string[4]; /* '_SM_' */
+ uint8_t checksum;
+ uint8_t length;
+ uint8_t major_version;
+ uint8_t minor_version;
+ uint16_t maximum_structure_size;
+ uint8_t entry_point_revision;
+ uint8_t formatted_area[5];
+ uint8_t intermediate_anchor_string[5]; /* '_DMI_' */
+ uint8_t intermediate_checksum;
+ uint16_t structure_table_length;
+ uint32_t structure_table_address;
+ uint16_t number_structures;
+ uint8_t BCD_revision;
+};
+
+struct smbios_structure_header {
+ uint8_t type;
+ uint8_t length;
+ uint16_t handle;
+};
+
+#ifdef _KERNEL
+#define BIOS_PADDRTOVADDR(x) ((x) + KERNBASE)
+#define BIOS_VADDRTOPADDR(x) ((x) - KERNBASE)
+
struct bios_oem_signature {
char * anchor; /* search anchor string in BIOS memory */
size_t offset; /* offset from anchor (may be negative) */
size_t totlen; /* total length of BIOS string to copy */
} __packed;
+
struct bios_oem_range {
u_int from; /* shouldn't be below 0xe0000 */
u_int to; /* shouldn't be above 0xfffff */
} __packed;
+
struct bios_oem {
struct bios_oem_range range;
struct bios_oem_signature signature[];
} __packed;
-extern int
-bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen);
-
+int bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen);
+uint32_t bios_sigsearch(uint32_t start, u_char *sig, int siglen, int paralen,
+ int sigofs);
+#endif
#endif /* _MACHINE_PC_BIOS_H_ */
diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h
index d07dbac..2188442 100644
--- a/sys/amd64/include/pcpu.h
+++ b/sys/amd64/include/pcpu.h
@@ -216,16 +216,36 @@ extern struct pcpu *pcpup;
#define PCPU_PTR(member) __PCPU_PTR(pc_ ## member)
#define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val)
+#define OFFSETOF_CURTHREAD 0
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnull-dereference"
+#endif
static __inline __pure2 struct thread *
__curthread(void)
{
struct thread *td;
- __asm("movq %%gs:0,%0" : "=r" (td));
+ __asm("movq %%gs:%1,%0" : "=r" (td)
+ : "m" (*(char *)OFFSETOF_CURTHREAD));
return (td);
}
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
#define curthread (__curthread())
+#define OFFSETOF_CURPCB 32
+static __inline __pure2 struct pcb *
+__curpcb(void)
+{
+ struct pcb *pcb;
+
+ __asm("movq %%gs:%1,%0" : "=r" (pcb) : "m" (*(char *)OFFSETOF_CURPCB));
+ return (pcb);
+}
+#define curpcb (__curpcb())
+
#define IS_BSP() (PCPU_GET(cpuid) == 0)
#else /* !lint || defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */
OpenPOWER on IntegriCloud