Skip to content

Commit 7ab0b81

Browse files
committed
System call to abort current process
Also includes: * Corresponding additions to libcm.
1 parent 641a11d commit 7ab0b81

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

include/cm/cm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ static inline void cm_process_kill (UINT code)
5656
syscall (OSIF_SYSCALL_KILL_PROCESS, code, 0, 0, 0, 0);
5757
}
5858

59+
static inline void cm_process_abort (UINT code)
60+
{
61+
syscall (OSIF_SYSCALL_ABORT_PROCESS, code, 0, 0, 0, 0);
62+
}
63+
5964
static inline U32 cm_process_get_pid()
6065
{
6166
return (U32)syscall (OSIF_SYSCALL_PROCESS_GETPID, 0, 0, 0, 0, 0);

include/cm/osif.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ typedef enum OSIF_SYSCALLS {
3333
OSIF_SYSCALL_WINDOW_FLUSH_GRAPHICS = 13,
3434
OSIF_SYSCALL_GET_OS_ERROR = 14,
3535
OSIF_SYSCALL_GET_BOOTLOADED_FILE = 15,
36+
OSIF_SYSCALL_ABORT_PROCESS = 16,
3637
} OSIF_SYSCALLS;
3738

3839
typedef enum OSIF_ProcessEvents {

src/kernel/x86/syscalls.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ INT ksys_createProcess (SystemcallFrame frame, void* processStartAddress, SIZE b
4242
KProcessFlags flags);
4343
void ksys_yieldProcess (SystemcallFrame frame, U32 ebx, U32 ecx, U32 edx, U32 esi, U32 edi);
4444
void ksys_killProcess (SystemcallFrame frame, UINT exitCode);
45+
void ksys_abortProcess (SystemcallFrame frame, UINT exitCode);
4546
bool ksys_processPopEvent (SystemcallFrame frame, OSIF_ProcessEvent* const e);
4647
U32 ksys_process_getPID (SystemcallFrame frame);
4748
U32 ksys_get_tickcount (SystemcallFrame frame);
@@ -110,6 +111,8 @@ void* g_syscall_table[] = {
110111
#else
111112
&s_handleInvalidSystemCall, // 15
112113
#endif
114+
//---------------------------
115+
&ksys_abortProcess, // 16
113116
};
114117
#pragma GCC diagnostic pop
115118

@@ -277,6 +280,13 @@ void ksys_killProcess (SystemcallFrame frame, UINT exitCode)
277280
kprocess_exit ((U8)exitCode, false);
278281
}
279282

283+
void ksys_abortProcess (SystemcallFrame frame, UINT exitCode)
284+
{
285+
FUNC_ENTRY ("Frame return address: %x:%x, exit code: %x", frame.cs, frame.eip, exitCode);
286+
(void)frame;
287+
kprocess_exit ((U8)exitCode, true);
288+
}
289+
280290
U32 ksys_process_getPID (SystemcallFrame frame)
281291
{
282292
FUNC_ENTRY ("Frame return address: %x:%x", frame.cs, frame.eip);

0 commit comments

Comments
 (0)