Skip to content

Commit 537c3e7

Browse files
romancardenasrmsyn
andauthored
Apply suggestions from code review
Co-authored-by: rmsyn <[email protected]>
1 parent 4d96ff6 commit 537c3e7

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

riscv-rt/macros/src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,9 @@ fn weak_start_trap(arch: RiscvArch) -> TokenStream {
426426
let ret = "mret";
427427

428428
format!(
429-
"
429+
r#"
430430
core::arch::global_asm!(
431-
\".section .trap, \\\"ax\\\"
431+
".section .trap, \\"ax\\"
432432
.align {width}
433433
.weak _start_trap
434434
_start_trap:
@@ -439,7 +439,7 @@ _start_trap:
439439
{load}
440440
addi sp, sp, {TRAP_SIZE} * {width}
441441
{ret}
442-
\");"
442+
");"#
443443
)
444444
.parse()
445445
.unwrap()
@@ -479,9 +479,9 @@ fn vectored_interrupt_trap(arch: RiscvArch) -> TokenStream {
479479
let ret = "mret";
480480

481481
let instructions = format!(
482-
"
482+
r#"
483483
core::arch::global_asm!(
484-
\".section .trap, \\\"ax\\\"
484+
".section .trap, \\"ax\\"
485485
486486
.global _start_DefaultHandler_trap
487487
_start_DefaultHandler_trap:
@@ -496,7 +496,7 @@ _continue_interrupt_trap:
496496
{load} // restore trap frame
497497
addi sp, sp, {TRAP_SIZE} * {width} // deallocate space for trap frame
498498
{ret} // return from interrupt
499-
\");"
499+
");"#
500500
);
501501

502502
instructions.parse().unwrap()
@@ -584,17 +584,17 @@ fn start_interrupt_trap(ident: &syn::Ident, arch: RiscvArch) -> proc_macro2::Tok
584584
let store = store_trap(arch, |r| r == "a0");
585585

586586
let instructions = format!(
587-
"
587+
r#"
588588
core::arch::global_asm!(
589-
\".section .trap, \\\"ax\\\"
589+
".section .trap, \\"ax\\"
590590
.align 2
591591
.global _start_{interrupt}_trap
592592
_start_{interrupt}_trap:
593593
addi sp, sp, -{TRAP_SIZE} * {width} // allocate space for trap frame
594594
{store} // store trap partially (only register a0)
595595
la a0, {interrupt} // load interrupt handler address into a0
596596
j _continue_interrupt_trap // jump to common part of interrupt trap
597-
\");"
597+
");"#
598598
);
599599

600600
instructions.parse().unwrap()

riscv-rt/src/asm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ riscv_rt_macros::vectored_interrupt_trap_riscv64!();
290290
#[cfg(feature = "v-trap")]
291291
cfg_global_asm!(
292292
// Set the vector mode to vectored.
293-
".section .trap, \"ax\"
293+
r#".section .trap, "ax"
294294
.weak _vector_table
295295
.type _vector_table, @function
296296
@@ -316,7 +316,7 @@ cfg_global_asm!(
316316
// default table does not include the remaining interrupts.
317317
// Targets with extra interrupts should override this table.
318318
319-
.option pop",
319+
.option pop"#,
320320
);
321321

322322
#[rustfmt::skip]

0 commit comments

Comments
 (0)