Skip to content

Commit e10a9bf

Browse files
committed
CM: cm_process_create() now takes in file name
1 parent 6f74308 commit e10a9bf

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

include/cm/cm.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ static inline void cm_get_bootloaded_file (const char* const filename,
3939
* Process management
4040
***************************************************************************************************/
4141
INT cm_thread_create (void (*startLocation)(), bool isKernelMode);
42-
INT cm_process_create (void* startLocation, SIZE binaryLengthBytes, bool isKernelMode);
42+
INT cm_process_create (const char* const filename, bool isKernelMode);
43+
44+
static inline bool cm_process_pop_event (OSIF_ProcessEvent* e)
45+
{
46+
return syscall (OSIF_SYSCALL_POP_PROCESS_EVENT, (PTR)e, 0, 0, 0, 0);
47+
}
4348

4449
static inline void cm_process_yield()
4550
{

include/cm/syscall.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,3 @@ static inline bool cm_window_getFB (Handle h, OSIF_WindowFrameBufferInfo* wfb)
5050
{
5151
return syscall (OSIF_SYSCALL_WINDOW_GET_WINDOW_FB, (U32)h, (PTR)wfb, 0, 0, 0);
5252
}
53-
54-
static inline bool cm_process_pop_event (OSIF_ProcessEvent* e)
55-
{
56-
return syscall (OSIF_SYSCALL_POP_PROCESS_EVENT, (PTR)e, 0, 0, 0, 0);
57-
}

src/cm/process.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ bool cm_process_handle_events()
6868
}
6969
/**************************************************************************************************/
7070

71-
INT cm_process_create (void* startLocation, SIZE binaryLengthBytes, bool isKernelMode)
71+
INT cm_process_create (const char* const filename, bool isKernelMode)
7272
{
73-
if (!startLocation || binaryLengthBytes == 0) {
73+
if (filename == NULL) {
7474
CM_RETURN_ERROR__ (CM_ERR_INVALID_INPUT, CM_FAILURE);
7575
}
7676

@@ -79,7 +79,10 @@ INT cm_process_create (void* startLocation, SIZE binaryLengthBytes, bool isKerne
7979
flags |= PROCESS_FLAGS_KERNEL_PROCESS;
8080
}
8181

82-
INT pid = syscall (OSIF_SYSCALL_CREATE_PROCESS, (U32)startLocation, binaryLengthBytes,
82+
OSIF_BootLoadedFiles file = { 0 };
83+
cm_get_bootloaded_file (filename, &file);
84+
85+
INT pid = syscall (OSIF_SYSCALL_CREATE_PROCESS, (U32)file.startLocation, file.length,
8386
(U32)flags, 0, 0);
8487
if (pid < 0) {
8588
CM_RETURN_ERROR__ (cm_get_os_error(), CM_FAILURE);

0 commit comments

Comments
 (0)