1sync_instruction_memory(3CS)tandard C Library Functionssync_instruction_memory(3C)
2
3
4
6 sync_instruction_memory - make modified instructions executable
7
9 void sync_instruction_memory(caddr_t addr, int len);
10
11
13 The sync_instruction_memory() function performs whatever steps are
14 required to make instructions modified by a program executable.
15
16
17 Some processor architectures, including some SPARC processors, have
18 separate and independent instruction and data caches which are not kept
19 consistent by hardware. For example, if the instruction cache contains
20 an instruction from some address and the program then stores a new
21 instruction at that address, the new instruction may not be immediately
22 visible to the instruction fetch mechanism. Software must explicitly
23 invalidate the instruction cache entries for new or changed mappings of
24 pages that might contain executable instructions. The sync_instruc‐
25 tion_memory() function performs this function, and/or any other func‐
26 tions needed to make modified instructions between addr and addr+len
27 visible. A program should call sync_instruction_memory() after modify‐
28 ing instructions and before executing them.
29
30
31 On processors with unified caches (one cache for both instructions and
32 data) and pipelines which are flushed by a branch instruction, such as
33 the x86 architecture, the function may do nothing and just return.
34
35
36 The changes are immediately visible to the thread calling sync_instruc‐
37 tion_memory() when the call returns, even if the thread should migrate
38 to another processor during or after the call. The changes become visi‐
39 ble to other threads in the same manner that stores do; that is, they
40 eventually become visible, but the latency is implementation-dependent.
41
42
43 The result of executing sync_instruction_memory() are unpredictable if
44 addr through addr+len-1 are not valid for the address space of the pro‐
45 gram making the call.
46
48 No values are returned.
49
51 See attributes(5) for descriptions of the following attributes:
52
53
54
55
56 ┌─────────────────────────────┬─────────────────────────────┐
57 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
58 ├─────────────────────────────┼─────────────────────────────┤
59 │MT-Level │MT-Safe │
60 └─────────────────────────────┴─────────────────────────────┘
61
63 attributes(5)
64
65
66
67SunOS 5.11 12 Feb 1997 sync_instruction_memory(3C)