riscv - 如何在 RISC-V 中的 read_string 之后 print_string
问题描述
我正在尝试读取字符串,将其保存到注册表而不是输出。当我尝试执行以下操作时,出现错误“源字符串必须从双字边界开始:
s1: DC "Input a string"
addi x30, x0, s1
ecall x0, x30, 4 ;info string
ecall x6, x0, 8 ;read_string
ecall x0, x6, 4 ;info string //this is where there error is
我很难找到有关如何使用 RISC-V v0.46 执行此操作的任何文档
解决方案
发现我需要将数据加载到内存中才能读取它,解决方法如下
s1: DC "Input a string"
addi x30, x0, s1
ecall x0, x30, 4 ;info string
ecall x6, x0, 8 ;read_string
//load into memory
sd x6, dst(x0)
addi x29, x0, dst
ecall x0, x29, 4 ;info string
dst: DM 1
推荐阅读
- amazon-web-services - 使用 AWS API 网关作为 websocket 监听器
- xlsx - ConvertAPI 不会使用其他工作表中的单元格翻译公式
- python - 在 Pandas 中添加迄今为止的月份时不要考虑闰年
- c++ - C++ 中 cin.getline() 的意外返回
- xml - 将 4 个 hazelcast.xml 配置“联合”到 1 个 yml
- azure-waf - Azure Web 应用程序防火墙 API
- android - 在 Android 上使用风味时如何设置原始版本/调试?
- python - 自动将数据上传到 Google Cloud Storage 和 BigQuery
- php - Twill CMS (Laravel) - 在内容编辑器中显示转发器数据
- c++ - C++ Windows 错误加载共享库