Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0677e1e

Browse files
committedMar 7, 2025··
use naked_asm! block to clarify we're talking just about naked assembly
1 parent 84c9b7d commit 0677e1e

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
@@ -1351,7 +1351,7 @@ r[asm.naked-rules.intro]
13511351
To avoid undefined behavior, these rules must be followed when using function-scope inline assembly in naked functions (`naked_asm!`):
13521352

13531353
r[asm.naked-rules.reg-not-input]
1354-
- 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.
1354+
- 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.
13551355
- 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.
13561356
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).
13571357

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

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

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

13711371
r[asm.naked-rules.black-box]
1372-
- The compiler cannot assume that the instructions in the asm are the ones that will actually end up executed.
1372+
- The compiler cannot assume that the instructions in the `naked_asm!` block are the ones that will actually be executed.
13731373
- 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.
13741374
- Runtime code patching is allowed, via target-specific mechanisms.
13751375

0 commit comments

Comments
 (0)
Please sign in to comment.