Changeset c8e99bb in mainline


Ignore:
Timestamp:
2010-05-30T21:00:18Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ada559c
Parents:
313b617
Message:

Foolproof version of flush_pipeline().

The %o7 version does not work if the calling function does create its own stack
frame and leaves %o7 uninitialized. The %i7 version might not theoretically work
if called from a function running in the first stack frame of a stack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/barrier.h

    r313b617 rc8e99bb  
    3636#define KERN_sparc64_BARRIER_H_
    3737
     38#ifdef KERNEL
     39#include <typedefs.h>
     40#else
     41#include <stdint.h>
     42#endif
     43
    3844/*
    3945 * Our critical section barriers are prepared for the weakest RMO memory model.
     
    6470static inline void flush_pipeline(void)
    6571{
     72        uint64_t pc;
     73
    6674        /*
    6775         * The FLUSH instruction takes address parameter.
     
    7078         * The entire kernel text is mapped by a locked ITLB and
    7179         * DTLB entries. Therefore, when this function is called,
    72          * the %o7 register will always be in the range mapped by
     80         * the %pc register will always be in the range mapped by
    7381         * DTLB.
    7482         */
    7583         
    76         asm volatile ("flush %o7\n");
     84        asm volatile (
     85                "rd %%pc, %0\n"
     86                "flush %0\n"
     87                : "=&r" (pc)
     88        );
    7789}
    7890
Note: See TracChangeset for help on using the changeset viewer.