Skip to content

Commit

Permalink
arch/x86_64: Flag xuk shared page volatile
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Andy Ross authored and nashif committed Mar 13, 2019
1 parent 1781ec9 commit bbe6fa0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion arch/x86_64/core/shared-page.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions arch/x86_64/core/xuk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit bbe6fa0

Please sign in to comment.