【问题标题】:Segfault error from printf?printf的段错误?
【发布时间】:2016-02-04 04:14:25
【问题描述】:

我正在做 SPARC 组装。 这是我的一些代码:

convert:
    save    %sp, -96, %sp

    mov     %i0, %l0       !%i0 has a long array
    mov     %i1, %l1       !%i1 has a char array


process:
    ld      [%i0], %o0      !maps firstArray[0] to %l0
    mov     10, %o1         !maps 10 to %o1 
    call    .div            !divide by 10 to get 10s place
    nop

    mov     %o0, %l3        !stores result in l3
    stb     %l3, [%i1]      !stores result in the second array


    mov     %l3, %o1        !checking contents after calculation
    call    printf
    nop

printf 导致错误,我不知道为什么。我用几个本地寄存器试过这个。我需要它来检查我的结果。我该怎么办?

此外,我实际上不确定我实现参数数组的方式是否正确,但在添加 printf 语句之前我没有收到此错误。

【问题讨论】:

  • 我想我明白了 - %o0 需要设置格式字符串。
  • 您应该将其发布为答案。这确实是问题所在。

标签: arrays assembly sparc


【解决方案1】:

想通了: %o0 需要设置格式字符串。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-12
    • 2015-09-03
    • 1970-01-01
    • 2010-10-07
    • 1970-01-01
    • 2012-03-17
    相关资源
    最近更新 更多