简体   繁体   English

RISC-V 是否具有与 MIPS 类似的系统调用服务集?

[英]Does RISC-V have equivalent set of syscall services like that of MIPS?

I know MIPS ISA out of the box has syscall instruction that can be used to print characters, open files, read from file, write to file and more.我知道开箱即用的 MIPS ISA 具有可用于打印字符、打开文件、从文件读取、写入文件等的系统调用指令
This make it very easy for MIPS to be used without the need for an Operating System.这使得无需操作系统即可轻松使用 MIPS。

The question is, does the RISC-V ISA have an equivalent service as the above?问题是,RISC-V ISA 是否有与上述等效的服务?
In other words does RISC-V provide an equivalent set services as above-out of the box?换句话说,RISC-V 是否提供了与上述开箱即用的等效服务集?
Does one absolutely need to manually implement these syscall services on RISC-V or is it provided just like on MIPS?是否绝对需要在 RISC-V 上手动实现这些系统调用服务,或者它是否像在 MIPS 上一样提供?
eg例如
On MIPS I could easily print a character using syscall instuction-I wouldn't need to implement anything to achieve this besides passing the approriate values into the appropriate registers.在 MIPS 上,我可以使用系统调用指令轻松地打印一个字符——除了将适当的值传递到适当的寄存器之外,我不需要实现任何东西来实现这一点。 Can this be done on RISC-V as easily?这可以在 RISC-V 上轻松完成吗?

I hope my question was clear.我希望我的问题很清楚。 Please let me know if any clarification is needed.如果需要任何说明,请告诉我。 I really appreciate the help.非常感谢您的帮助。
N/B不适用
I know RISC-V has an ecall instruction but that only enables you to use system call functions which one has implemented manually.我知道 RISC-V 有一个 ecall 指令,但它只能让你使用手动实现的系统调用功能。

UPDATE : Based on the comments I now understand that syscall and ecall are the instructions provided by MIPS and RISCV respectively.更新根据评论,我现在了解到 syscall 和 ecall 分别是 MIPS 和 RISCV 提供的指令。 The ISA doesn't specify what should happen beyond these calls. ISA 没有指定在这些调用之外应该发生什么。 In order words the functionalities provided after these calls are dictated by the operating environment.换句话说,这些调用之后提供的功能由操作环境决定。

Yes it does, in the version of the MARS simulator for RISC V, called RARS :是的,在 RISC V 的 MARS 模拟器版本中,称为RARS

These ecall s in RARS are the same as the ones in MARS, but with a few new ones added. RARS 中的这些ecall与 MARS 中的相同,但添加了一些新的。

RARS uses a7 for selecting call number, whereas MARS uses $v0 . RARS 使用a7来选择索书号,而 MARS 使用$v0

Let's also note that for both MARS and RARS the system calls are incomplete and not orthogonal.我们还要注意,对于 MARS 和 RARS,系统调用都是不完整的并且不是正交的。 For example, you can print an integer to the console but not to a file.例如,您可以将 integer 打印到控制台而不是文件。

Still, this group of system calls allows for simpler programs than linux would, since on linux all we really have is character I/O;尽管如此,这组系统调用允许比 linux 更简单的程序,因为在 linux 上我们真正拥有的只是字符 I/O; so, printing a integer even to the console requires itoa capability in the user's program.因此,即使向控制台打印 integer 也需要用户程序中的itoa功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM