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
@@ -1351,7 +1351,7 @@ r[asm.naked-rules.intro]
1351
1351
To avoid undefined behavior, these rules must be followed when using function-scope inline assembly in naked functions (`naked_asm!`):
1352
1352
1353
1353
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.
1355
1355
- 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.
1356
1356
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.
1361
1361
1362
1362
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.
1364
1364
- the assembly code is expected to contain a return instruction or to diverge
1365
1365
1366
1366
r[asm.naked-rules.mem-same-as-ffi]
1367
1367
- The set of memory locations that assembly code is allowed to read and write are the same as those allowed for an FFI function.
1368
1368
- 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.
1370
1370
1371
1371
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.
1373
1373
- 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.
1374
1374
- Runtime code patching is allowed, via target-specific mechanisms.
0 commit comments