arch/x86_64: Flag xuk shared page volatile

The shared page is inherently used in multiprocessor contexts where
the compiler optimizer can trip us up (specifically, a spin on
num_active_pus was being hoisted out of the loop on some gcc's).  Put
the volatile declartion into the struct pointer itself instead of
relying on the code to get it right.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2019-02-22 15:34:29 -08:00 committed by Anas Nashif
commit bbe6fa04b5
2 changed files with 3 additions and 3 deletions

View file

@ -57,7 +57,7 @@ struct xuk_shared_mem {
int vgacol;
};
#define _shared (*((struct xuk_shared_mem *)(long)SHARED_ADDR))
#define _shared (*((volatile struct xuk_shared_mem *)(long)SHARED_ADDR))
static inline void shared_init(void)
{

View file

@ -314,8 +314,8 @@ void xuk_set_isr_mask(int interrupt, int masked)
static void setup_fg_segs(int cpu)
{
int fi = 3 + 2 * cpu, gi = 3 + 2 * cpu + 1;
struct gdt64 *fs = &_shared.gdt[fi];
struct gdt64 *gs = &_shared.gdt[gi];
struct gdt64 *fs = (struct gdt64 *) &_shared.gdt[fi];
struct gdt64 *gs = (struct gdt64 *) &_shared.gdt[gi];
gdt64_set_base(fs, (long)&_shared.fs_ptrs[cpu]);
gdt64_set_base(gs, (long)&_shared.gs_ptrs[cpu]);