简体   繁体   中英

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.
This make it very easy for MIPS to be used without the need for an Operating System.

The question is, does the RISC-V ISA have an equivalent service as the above?
In other words does RISC-V provide an equivalent set services as above-out of the box?
Does one absolutely need to manually implement these syscall services on RISC-V or is it provided just like on 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. Can this be done on RISC-V as easily?

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.

UPDATE : Based on the comments I now understand that syscall and ecall are the instructions provided by MIPS and RISCV respectively. The ISA doesn't specify what should happen beyond these calls. 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 :

These ecall s in RARS are the same as the ones in MARS, but with a few new ones added.

RARS uses a7 for selecting call number, whereas MARS uses $v0 .

Let's also note that for both MARS and RARS the system calls are incomplete and not orthogonal. For example, you can print an integer to the console but not to a file.

Still, this group of system calls allows for simpler programs than linux would, since on linux all we really have is character I/O; so, printing a integer even to the console requires itoa capability in the user's program.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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