Print this page
OS-5192 need faster clock_gettime
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
Reviewed by: Ryan Zezeski <ryan@zinascii.com>

*** 25,35 **** /* * Copyright (c) 2010, Intel Corporation. * All rights reserved. */ /* ! * Copyright 2015 Joyent, Inc. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. */ #include <sys/types.h> #include <sys/thread.h> --- 25,35 ---- /* * Copyright (c) 2010, Intel Corporation. * All rights reserved. */ /* ! * Copyright 2016 Joyent, Inc. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. */ #include <sys/types.h> #include <sys/thread.h>
*** 245,255 **** --- 245,273 ---- } kpreempt_enable(); } + #if !defined(__xpv) /* + * Configure per-cpu ID GDT + */ + static void + init_cpu_id_gdt(struct cpu *cp) + { + /* Write cpu_id into limit field of GDT for usermode retrieval */ + #if defined(__amd64) + set_usegd(&cp->cpu_gdt[GDT_CPUID], SDP_SHORT, NULL, cp->cpu_id, + SDT_MEMRODA, SEL_UPL, SDP_BYTES, SDP_OP32); + #elif defined(__i386) + set_usegd(&cp->cpu_gdt[GDT_CPUID], NULL, cp->cpu_id, SDT_MEMRODA, + SEL_UPL, SDP_BYTES, SDP_OP32); + #endif + } + #endif /* !defined(__xpv) */ + + /* * Multiprocessor initialization. * * Allocate and initialize the cpu structure, TRAPTRACE buffer, and the * startup and idle threads for the specified CPU. * Parameter boot is true for boot time operations and is false for CPU
*** 428,437 **** --- 446,459 ---- #endif cp->cpu_m.mcpu_idle_cpu = cpu_idle; init_cpu_info(cp); + #if !defined(__xpv) + init_cpu_id_gdt(cp); + #endif + /* * alloc space for ucode_info */ ucode_alloc_space(cp); xc_init_cpu(cp);
*** 1484,1493 **** --- 1506,1519 ---- /* * Initialize our own cpu_info. */ init_cpu_info(CPU); + #if !defined(__xpv) + init_cpu_id_gdt(CPU); + #endif + cmn_err(CE_CONT, "?cpu%d: %s\n", CPU->cpu_id, CPU->cpu_idstr); cmn_err(CE_CONT, "?cpu%d: %s\n", CPU->cpu_id, CPU->cpu_brandstr); /* * Initialize our syscall handlers