mywiki:hw:mips:barrier_fence
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mywiki:hw:mips:barrier_fence [2014/07/28 14:18] – shaoguoh | mywiki:hw:mips:barrier_fence [2022/04/02 17:29] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | **MIPS Pipeline Hazards | + | **MIPS Pipeline Hazards, Memory |
| ====== Pipeline Hazards/ | ====== Pipeline Hazards/ | ||
| + | {{: | ||
| MIPS has explicit pipeline hazards; **the instruction immediately following a branch or jump instruction will always be executed** (this instruction is sometimes referred to as the " | MIPS has explicit pipeline hazards; **the instruction immediately following a branch or jump instruction will always be executed** (this instruction is sometimes referred to as the " | ||
| < | < | ||
| Line 35: | Line 36: | ||
| | | ||
| </ | </ | ||
| + | |||
| + | ====== Memory Alignment ====== | ||
| + | Most RISC processors will generate **an alignment fault** when a load or store instruction accesses a **misaligned address**. This allows **the operating system to emulate the misaligned access** using other instructions. For example, the alignment fault handler might use byte loads or stores (which are always aligned) to emulate a larger load or store instruction. | ||
| + | |||
| + | Some architectures like MIPS have special unaligned load and store instructions. One unaligned load instruction gets the bytes from the memory word with the lowest byte address and another gets the bytes from the memory word with the highest byte address. Similarly, store-high and store-low instructions store the appropriate bytes in the higher and lower memory words respectively. | ||
| + | |||
| ====== Memory Barrier/ | ====== Memory Barrier/ | ||
| Line 42: | Line 49: | ||
| CPU cores contain multiple execution units. | CPU cores contain multiple execution units. | ||
| - | {{ ::cpu.png |}} | + | {{:mywiki: |
| Loads and stores to the caches and main memory are buffered and re-ordered using the load, store, and write-combining buffers. | Loads and stores to the caches and main memory are buffered and re-ordered using the load, store, and write-combining buffers. | ||
| Line 110: | Line 117: | ||
| ====== MIPS Linux barrier ====== | ====== MIPS Linux barrier ====== | ||
| + | Refer to: Linux/ | ||
| < | < | ||
| define __sync() | define __sync() | ||
| Line 115: | Line 123: | ||
| " | " | ||
| " | " | ||
| - | " | + | |
| - | | + | " |
| + | " | ||
| + | : /* no output */ \ | ||
| + | : /* no input */ \ | ||
| + | : " | ||
| + | |||
| + | |||
| + | #define __fast_iob() | ||
| + | | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| " | " | ||
| : /* no output */ \ | : /* no output */ \ | ||
| - | : | + | : |
| : " | : " | ||
| - | </ | + | |
| + | # define fast_wmb() | ||
| + | # define fast_rmb() | ||
| + | # define fast_mb() | ||
| + | |||
| + | #define wmb() | ||
| + | #define rmb() | ||
| + | #define mb() wbflush() | ||
| + | #define iob() | ||
| + | #define set_mb(var, value) ... | ||
| + | #define smp_llsc_mb() ... | ||
| + | |||
| + | </ | ||
mywiki/hw/mips/barrier_fence.1406528295.txt.gz · Last modified: (external edit)
