20 #include "pedigree/kernel/Log.h" 21 #include "pedigree/kernel/process/Scheduler.h" 22 #include "pedigree/kernel/processor/Processor.h" 23 #include "pedigree/kernel/processor/SyscallManager.h" 24 #include "pedigree/kernel/processor/state.h" 26 #include "PedigreeCSyscallManager.h" 27 #include "pedigreecSyscallNumbers.h" 29 #define PEDIGREEC_WITHIN_KERNEL 30 #include "pedigree-syscalls.h" 40 void PedigreeCSyscallManager::initialise()
43 pedigree_config_init();
47 uintptr_t
function, uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4,
50 if (
function >= serviceEnd)
53 "PedigreeCSyscallManager: invalid function called: " 54 <<
Dec << static_cast<int>(
function));
58 posix,
function, p1, p2, p3, p4, p5);
63 uintptr_t p1 = state.getSyscallParameter(0);
64 uintptr_t p2 = state.getSyscallParameter(1);
65 uintptr_t p3 = state.getSyscallParameter(2);
66 uintptr_t p4 = state.getSyscallParameter(3);
67 uintptr_t p5 = state.getSyscallParameter(4);
72 switch (state.getSyscallNumber())
76 return pedigree_login(
77 static_cast<int>(p1), reinterpret_cast<const char *>(p2));
78 case PEDIGREE_LOAD_KEYMAP:
79 return pedigree_load_keymap(reinterpret_cast<uint32_t *>(p1), p2);
80 case PEDIGREE_GET_MOUNT:
81 return pedigree_get_mount(
82 reinterpret_cast<char *>(p1), reinterpret_cast<char *>(p2), p3);
86 case PEDIGREE_CONFIG_GETCOLNAME:
87 pedigree_config_getcolname(
88 p1, p2, reinterpret_cast<char *>(p3), p4);
90 case PEDIGREE_CONFIG_GETSTR_N:
91 pedigree_config_getstr(
92 p1, p2, p3, reinterpret_cast<char *>(p4), p5);
94 case PEDIGREE_CONFIG_GETSTR_S:
95 pedigree_config_getstr(
96 p1, p2, reinterpret_cast<const char *>(p3),
97 reinterpret_cast<char *>(p4), p5);
99 case PEDIGREE_CONFIG_GETNUM_N:
100 return pedigree_config_getnum(p1, p2, p3);
101 case PEDIGREE_CONFIG_GETNUM_S:
102 return pedigree_config_getnum(
103 p1, p2, reinterpret_cast<const char *>(p3));
104 case PEDIGREE_CONFIG_GETBOOL_N:
105 return pedigree_config_getbool(p1, p2, p3);
106 case PEDIGREE_CONFIG_GETBOOL_S:
107 return pedigree_config_getbool(
108 p1, p2, reinterpret_cast<const char *>(p3));
109 case PEDIGREE_CONFIG_QUERY:
110 return pedigree_config_query(reinterpret_cast<const char *>(p1));
111 case PEDIGREE_CONFIG_FREERESULT:
112 pedigree_config_freeresult(p1);
114 case PEDIGREE_CONFIG_NUMCOLS:
115 return pedigree_config_numcols(p1);
116 case PEDIGREE_CONFIG_NUMROWS:
117 return pedigree_config_numrows(p1);
118 case PEDIGREE_CONFIG_WAS_SUCCESSFUL:
119 return pedigree_config_was_successful(p1);
120 case PEDIGREE_CONFIG_GET_ERROR_MESSAGE:
121 pedigree_config_get_error_message(
122 p1, reinterpret_cast<char *>(p2), p3);
124 case PEDIGREE_MODULE_LOAD:
125 pedigree_module_load(reinterpret_cast<char *>(p1));
127 case PEDIGREE_MODULE_UNLOAD:
128 pedigree_module_unload(reinterpret_cast<char *>(p1));
130 case PEDIGREE_MODULE_IS_LOADED:
131 return pedigree_module_is_loaded(reinterpret_cast<char *>(p1));
132 case PEDIGREE_MODULE_GET_DEPENDING:
133 return pedigree_module_get_depending(
134 reinterpret_cast<char *>(p1), reinterpret_cast<char *>(p2), p3);
135 case PEDIGREE_GFX_GET_PROVIDER:
136 return pedigree_gfx_get_provider(reinterpret_cast<void *>(p1));
137 case PEDIGREE_GFX_GET_CURR_MODE:
138 return pedigree_gfx_get_curr_mode(
139 reinterpret_cast<void *>(p1), reinterpret_cast<void *>(p2));
140 case PEDIGREE_GFX_GET_RAW_BUFFER:
141 return pedigree_gfx_get_raw_buffer(reinterpret_cast<void *>(p1));
142 case PEDIGREE_GFX_CREATE_BUFFER:
143 return pedigree_gfx_create_buffer(
144 reinterpret_cast<void *>(p1), reinterpret_cast<void **>(p2),
145 reinterpret_cast<void *>(p3));
146 case PEDIGREE_GFX_DESTROY_BUFFER:
147 return pedigree_gfx_destroy_buffer(
148 reinterpret_cast<void *>(p1), reinterpret_cast<void *>(p2));
149 case PEDIGREE_GFX_REDRAW:
151 reinterpret_cast<void *>(p1), reinterpret_cast<void *>(p2));
153 case PEDIGREE_GFX_BLIT:
155 reinterpret_cast<void *>(p1), reinterpret_cast<void *>(p2));
157 case PEDIGREE_GFX_SET_PIXEL:
158 pedigree_gfx_set_pixel(
159 reinterpret_cast<void *>(p1), p2, p3, p4, p5);
161 case PEDIGREE_GFX_RECT:
163 reinterpret_cast<void *>(p1), reinterpret_cast<void *>(p2));
165 case PEDIGREE_GFX_COPY:
167 reinterpret_cast<void *>(p1), reinterpret_cast<void *>(p2));
169 case PEDIGREE_GFX_LINE:
171 reinterpret_cast<void *>(p1), reinterpret_cast<void *>(p2));
173 case PEDIGREE_GFX_DRAW:
175 reinterpret_cast<void *>(p1), reinterpret_cast<void *>(p2));
177 case PEDIGREE_GFX_CREATE_FBUFFER:
178 return pedigree_gfx_create_fbuffer(
179 reinterpret_cast<void *>(p1), reinterpret_cast<void *>(p2));
180 case PEDIGREE_GFX_DELETE_FBUFFER:
181 pedigree_gfx_delete_fbuffer(reinterpret_cast<void *>(p1));
183 case PEDIGREE_GFX_FBINFO:
185 reinterpret_cast<void *>(p1), reinterpret_cast<size_t *>(p2),
186 reinterpret_cast<size_t *>(p3),
187 reinterpret_cast<uint32_t *>(p4),
188 reinterpret_cast<size_t *>(p5));
190 case PEDIGREE_GFX_SETPALETTE:
191 pedigree_gfx_setpalette(
192 reinterpret_cast<void *>(p1), reinterpret_cast<uint32_t *>(p2),
195 case PEDIGREE_INPUT_INSTALL_CALLBACK:
196 pedigree_input_install_callback(
197 reinterpret_cast<void *>(p1), p2, p3);
199 case PEDIGREE_INPUT_REMOVE_CALLBACK:
200 pedigree_input_remove_callback(reinterpret_cast<void *>(p1));
202 case PEDIGREE_INPUT_INHIBIT_EVENTS:
203 pedigree_input_inhibit_events(p1);
205 case PEDIGREE_EVENT_RETURN:
206 pedigree_event_return();
207 case PEDIGREE_SYS_REQUEST_MEM:
208 return reinterpret_cast<uintptr_t
>(pedigree_sys_request_mem(p1));
209 case PEDIGREE_HALTFS:
214 "PedigreeCSyscallManager: invalid syscall received: " 215 <<
Dec << state.getSyscallNumber());
static EXPORTED_PUBLIC SyscallManager & instance()
virtual uintptr_t syscall(SyscallState &state)
static void setInterrupts(bool bEnable)
uintptr_t call(uintptr_t function, uintptr_t p1=0, uintptr_t p2=0, uintptr_t p3=0, uintptr_t p4=0, uintptr_t p5=0)
PedigreeCSyscallManager()
virtual ~PedigreeCSyscallManager()
virtual bool registerSyscallHandler(Service_t Service, SyscallHandler *pHandler)=0
virtual uintptr_t syscall(Service_t service, uintptr_t function, uintptr_t p1=0, uintptr_t p2=0, uintptr_t p3=0, uintptr_t p4=0, uintptr_t p5=0)=0