SimpleKernel  0.0.1
arch.cpp File Reference

arch cpp More...

#include "cstdint"
#include "sbi/sbi_ecall_interface.h"
Include dependency graph for arch.cpp:

Go to the source code of this file.

Classes

struct  sbiret_t
 

Functions

sbiret_t ecall (unsigned long _arg0, unsigned long _arg1, unsigned long _arg2, unsigned long _arg3, unsigned long _arg4, unsigned long _arg5, int _fid, int _eid)
 
void put_char (const char _c)
 
int arch (int, char **)
 

Detailed Description

arch cpp

Author
Zone.N (Zone..nosp@m.Niuz.nosp@m.h@hot.nosp@m.mail.nosp@m..com)
Version
1.0
Date
2023-07-15
change log:
DateAuthorDescription
2023-07-15Zone.N (Zone..nosp@m.Niuz.nosp@m.h@hot.nosp@m.mail.nosp@m..com)创建文件

Definition in file arch.cpp.

Function Documentation

◆ arch()

int arch ( int  ,
char **   
)

Definition at line 58 of file arch.cpp.

58  {
59  put_char('H');
60  put_char('e');
61  put_char('l');
62  put_char('l');
63  put_char('W');
64  put_char('o');
65  put_char('r');
66  put_char('l');
67  put_char('d');
68  put_char('!');
69 
70  return 0;
71 }
void put_char(const char _c)
Definition: arch.cpp:53
Here is the call graph for this function:

◆ ecall()

sbiret_t ecall ( unsigned long  _arg0,
unsigned long  _arg1,
unsigned long  _arg2,
unsigned long  _arg3,
unsigned long  _arg4,
unsigned long  _arg5,
int  _fid,
int  _eid 
)

Definition at line 32 of file arch.cpp.

34  {
35  sbiret_t ret;
36  register uintptr_t a0 asm("a0") = (uintptr_t)(_arg0);
37  register uintptr_t a1 asm("a1") = (uintptr_t)(_arg1);
38  register uintptr_t a2 asm("a2") = (uintptr_t)(_arg2);
39  register uintptr_t a3 asm("a3") = (uintptr_t)(_arg3);
40  register uintptr_t a4 asm("a4") = (uintptr_t)(_arg4);
41  register uintptr_t a5 asm("a5") = (uintptr_t)(_arg5);
42  register uintptr_t a6 asm("a6") = (uintptr_t)(_fid);
43  register uintptr_t a7 asm("a7") = (uintptr_t)(_eid);
44  asm("ecall"
45  : "+r"(a0), "+r"(a1)
46  : "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(a6), "r"(a7)
47  : "memory");
48  ret.error = a0;
49  ret.value = a1;
50  return ret;
51 }
long value
返回值
Definition: arch.cpp:29
long error
错误码
Definition: arch.cpp:27
Here is the caller graph for this function:

◆ put_char()

void put_char ( const char  _c)

Definition at line 53 of file arch.cpp.

53  {
54  ecall(_c, 0, 0, 0, 0, 0, 0, SBI_EXT_0_1_CONSOLE_PUTCHAR);
55  return;
56 }
sbiret_t ecall(unsigned long _arg0, unsigned long _arg1, unsigned long _arg2, unsigned long _arg3, unsigned long _arg4, unsigned long _arg5, int _fid, int _eid)
Definition: arch.cpp:32
Here is the call graph for this function:
Here is the caller graph for this function: