Skip to content

Commit

Permalink
Debug specific Test system call
Browse files Browse the repository at this point in the history
For doing some sort of testing. Might be removed in future.
  • Loading branch information
coderarjob committed Dec 25, 2024
1 parent 309d7b1 commit 2623730
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/cm/osif.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ typedef enum OSIF_SYSCALLS {
OSIF_SYSCALL_GET_OS_ERROR = 14,
OSIF_SYSCALL_GET_BOOTLOADED_FILE = 15,
OSIF_SYSCALL_ABORT_PROCESS = 16,
OSIF_SYSCALL_TEST = 17,
} OSIF_SYSCALLS;

typedef enum OSIF_ProcessEvents {
Expand Down
19 changes: 19 additions & 0 deletions src/kernel/x86/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ typedef struct SystemcallFrame {
} __attribute__ ((packed)) SystemcallFrame;

#if defined(DEBUG)
void ksys_test (SystemcallFrame frame, U8 a, U8 b, U8 c, U8 d);
void ksys_console_writeln (SystemcallFrame frame, char* fmt, char* text);
#if !defined(GRAPHICS_MODE_ENABLED)
void ksys_console_setcolor (SystemcallFrame frame, U8 bg, U8 fg);
Expand Down Expand Up @@ -113,6 +114,12 @@ void* g_syscall_table[] = {
#endif
//---------------------------
&ksys_abortProcess, // 16
//---------------------------
#ifdef DEBUG
&ksys_test, // 17
#else
&s_handleInvalidSystemCall, // 17
#endif
};
#pragma GCC diagnostic pop

Expand Down Expand Up @@ -218,6 +225,18 @@ static INT s_handleInvalidSystemCall()
#pragma GCC diagnostic pop

#if defined(DEBUG)
void ksys_test (SystemcallFrame frame, U8 a, U8 b, U8 c, U8 d)
{
FUNC_ENTRY ("Frame return address: %x:%px, a, b, c, d: {%x, %x, %x, %x}", frame.cs, frame.eip,
a, b, c, d);
(void)frame;
(void)a;
(void)b;
(void)c;
(void)d;

}

void ksys_console_writeln (SystemcallFrame frame, char* fmt, char* text)
{
FUNC_ENTRY ("Frame return address: %x:%px, fmt: %px text: %px", frame.cs, frame.eip, fmt, text);
Expand Down

0 comments on commit 2623730

Please sign in to comment.