Skip to content

Commit 9d54480

Browse files
committed
use naked_asm! block to clarify we're talking just about naked assembly
1 parent aab5418 commit 9d54480

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/inline-assembly.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ r[asm.naked-rules.intro]
13821382
To avoid undefined behavior, these rules must be followed when using function-scope inline assembly in naked functions (`naked_asm!`):
13831383

13841384
r[asm.naked-rules.reg-not-input]
1385-
- Any registers not used for function inputs according to the calling convention and function signature will contain an undefined value on entry to the asm block.
1385+
- Any registers not used for function inputs according to the calling convention and function signature will contain an undefined value on entry to the `naked_asm!` block.
13861386
- An "undefined value" in the context of inline assembly means that the register can (non-deterministically) have any one of the possible values allowed by the architecture.
13871387
Notably it is not the same as an LLVM `undef` which can have a different value every time you read it (since such a concept does not exist in assembly code).
13881388

@@ -1391,16 +1391,16 @@ r[asm.naked-rules.reg-not-output]
13911391
- Caller-saved registes may be used freely, even if they are not used for the return value.
13921392

13931393
r[asm.naked-rules.noreturn]
1394-
- Behavior is undefined if execution falls through to the end of the asm block.
1394+
- Behavior is undefined if execution falls through to the end of the `naked_asm!` block.
13951395
- the assembly code is expected to contain a return instruction or to diverge
13961396

13971397
r[asm.naked-rules.mem-same-as-ffi]
13981398
- The set of memory locations that assembly code is allowed to read and write are the same as those allowed for an FFI function.
13991399
- Refer to the unsafe code guidelines for the exact rules.
1400-
- These rules do not apply to memory which is private to the asm code, such as stack space allocated within the asm block.
1400+
- These rules do not apply to memory which is private to the asm code, such as stack space allocated within the `naked_asm!` block.
14011401

14021402
r[asm.naked-rules.black-box]
1403-
- The compiler cannot assume that the instructions in the asm are the ones that will actually end up executed.
1403+
- The compiler cannot assume that the instructions in the `naked_asm!` block are the ones that will actually be executed.
14041404
- This effectively means that the compiler must treat the `naked_asm!` as a black box and only take the interface specification into account, not the instructions themselves.
14051405
- Runtime code patching is allowed, via target-specific mechanisms.
14061406

0 commit comments

Comments
 (0)