You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/inline-assembly.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -1382,7 +1382,7 @@ r[asm.naked-rules.intro]
1382
1382
To avoid undefined behavior, these rules must be followed when using function-scope inline assembly in naked functions (`naked_asm!`):
1383
1383
1384
1384
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.
1386
1386
- 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.
1387
1387
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).
- Caller-saved registes may be used freely, even if they are not used for the return value.
1392
1392
1393
1393
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.
1395
1395
- the assembly code is expected to contain a return instruction or to diverge
1396
1396
1397
1397
r[asm.naked-rules.mem-same-as-ffi]
1398
1398
- The set of memory locations that assembly code is allowed to read and write are the same as those allowed for an FFI function.
1399
1399
- 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.
1401
1401
1402
1402
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.
1404
1404
- 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.
1405
1405
- Runtime code patching is allowed, via target-specific mechanisms.
0 commit comments