File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -543,16 +543,20 @@ mod hw {
543
543
asm ! (
544
544
// Dummy `cpuid(0)` to serialize instruction execution.
545
545
"xor eax, eax" ,
546
+ // LLVM sometimes reserves `ebx` for its internal use, we so we need to use
547
+ // a scratch register for it instead.
548
+ "mov {tmp_rbx}, rbx" ,
546
549
"cpuid" ,
550
+ "mov rbx, {tmp_rbx}" ,
547
551
548
552
"mov ecx, {rdpmc_ecx:e}" ,
549
553
"rdpmc" ,
550
554
rdpmc_ecx = in( reg) reg_idx,
555
+ tmp_rbx = out( reg) _,
551
556
out( "eax" ) lo,
552
557
out( "edx" ) hi,
553
558
554
559
// `cpuid` clobbers (not overwritten by `rdpmc`).
555
- out( "ebx" ) _,
556
560
out( "ecx" ) _,
557
561
558
562
options( nostack) ,
@@ -574,7 +578,11 @@ mod hw {
574
578
asm ! (
575
579
// Dummy `cpuid(0)` to serialize instruction execution.
576
580
"xor eax, eax" ,
581
+ // LLVM sometimes reserves `ebx` for its internal use, we so we need to use
582
+ // a scratch register for it instead.
583
+ "mov {tmp_rbx}, rbx" ,
577
584
"cpuid" ,
585
+ "mov rbx, {tmp_rbx}" ,
578
586
579
587
"mov ecx, {a_rdpmc_ecx:e}" ,
580
588
"rdpmc" ,
@@ -586,11 +594,11 @@ mod hw {
586
594
a_rdpmc_eax = out( reg) a_lo,
587
595
a_rdpmc_edx = out( reg) a_hi,
588
596
b_rdpmc_ecx = in( reg) b_reg_idx,
597
+ tmp_rbx = out( reg) _,
589
598
out( "eax" ) b_lo,
590
599
out( "edx" ) b_hi,
591
600
592
601
// `cpuid` clobbers (not overwritten by `rdpmc`).
593
- out( "ebx" ) _,
594
602
out( "ecx" ) _,
595
603
596
604
options( nostack) ,
You can’t perform that action at this time.
0 commit comments