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/unsafe/asm.md
+18-4Lines changed: 18 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -387,7 +387,7 @@ The higher 64 bits are stored in `rdx` from which we fill the variable `hi`.
387
387
<!--
388
388
## Clobbered registers
389
389
-->
390
-
## 上書きされたレジスタ
390
+
## クロバーレジスタ
391
391
392
392
<!--
393
393
In many cases inline assembly will modify state that is not needed as an output.
@@ -398,7 +398,7 @@ We need to tell the compiler about this since it may need to save and restore th
398
398
多くの場合、インラインレジスタは出力として必要のない状態を変更することがあります。
399
399
これは普通、アセンブリでスクラッチレジスタを利用する必要があったり、
400
400
私たちがこれ以上必要としていない状態を命令が変更したりするためです。
401
-
これを一般的に「上書き」された状態と呼びます。
401
+
この状態を一般的に"クロバー"(訳注:上書き)と呼びます。
402
402
私たちはコンパイラにこのことを伝える必要があります。
403
403
なぜならコンパイラは、インラインアセンブリブロックの前後で、
404
404
この状態を保存して復元しなくてはならない可能性があるからです。
@@ -440,10 +440,10 @@ fn main() {
440
440
// *ポインタそのもの* は後ろに書かれていても入力にすぎない。
441
441
in("rdi") name_buf.as_mut_ptr(),
442
442
// select cpuid 0, also specify eax as clobbered
443
-
// cpuid 0を選択し、eaxを上書きする
443
+
// cpuid 0を選択し、eaxをクロバーに指定する
444
444
inout("eax") 0=>_,
445
445
// cpuid clobbers these registers too
446
-
//cpuidは以下のレジスタも上書きする
446
+
//cpuidは以下のレジスタもクロバーする
447
447
out("ecx") _,
448
448
out("edx") _,
449
449
);
@@ -515,9 +515,19 @@ assert_eq!(x, 4 * 6);
515
515
# }
516
516
```
517
517
518
+
<!--
518
519
## Symbol operands and ABI clobbers
520
+
-->
521
+
## シンボル・オペランドとABIクロバー
519
522
523
+
<!--
520
524
By default, `asm!` assumes that any register not specified as an output will have its contents preserved by the assembly code. The [`clobber_abi`] argument to `asm!` tells the compiler to automatically insert the necessary clobber operands according to the given calling convention ABI: any register which is not fully preserved in that ABI will be treated as clobbered. Multiple `clobber_abi` arguments may be provided and all clobbers from all specified ABIs will be inserted.
0 commit comments