Compare commits

..

4 Commits

Author SHA1 Message Date
72230e696f Doc comment libterminal terminal.h
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m15s
2026-02-13 01:04:25 +01:00
551a757429 Doc comment libstring string.h 2026-02-13 01:03:35 +01:00
3f37cbce49 Doc comment libprocess process.h 2026-02-13 01:02:23 +01:00
369efaec2e Doc comment libmsl m/system.h 2026-02-13 00:59:42 +01:00
11 changed files with 50 additions and 3 deletions

View File

@@ -20,7 +20,7 @@ void app_proc (void) {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
terminal_print (&letter, 1); terminal_print (&letter, 1);
for (volatile int i = 0; i < 1000*1000; i++) for (volatile int i = 0; i < 1000 * 1000; i++)
; ;
mutex_unlock (MUTEX); mutex_unlock (MUTEX);
@@ -43,8 +43,8 @@ void app_main (void) {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
terminal_print (&letter, 1); terminal_print (&letter, 1);
for (volatile int i = 0; i < 1000*1000; i++) for (volatile int i = 0; i < 1000 * 1000; i++)
; ;
mutex_unlock (MUTEX); mutex_unlock (MUTEX);

1
liballoc/.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.o *.o
*.json *.json
docs/ docs/
.cache/

1
libmsl/.gitignore vendored
View File

@@ -1,2 +1,3 @@
*.json *.json
docs/ docs/
.cache/

View File

@@ -3,6 +3,7 @@
#include <stdint.h> #include <stdint.h>
/* Performs a syscall for the AMD64 */
uintptr_t amd64_syscall (int syscall_num, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t amd64_syscall (int syscall_num, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4,
uintptr_t a5, uintptr_t a6); uintptr_t a5, uintptr_t a6);

View File

@@ -13,17 +13,40 @@
#define MAP_USER (1 << 2) #define MAP_USER (1 << 2)
#define MAP_FLAGS (MAP_PRESENT | MAP_USER) #define MAP_FLAGS (MAP_PRESENT | MAP_USER)
/* Quit the current running process */
int quit (void); int quit (void);
/* Test syscall */
int test (char c); int test (char c);
/* Give the CPU to another process */
int sched (void); int sched (void);
/* map memory into this procgrou[ */
void* map (uintptr_t vaddr, size_t pages, uint32_t flags); void* map (uintptr_t vaddr, size_t pages, uint32_t flags);
/* unmap memory from this procgrou[ */
int unmap (uintptr_t vaddr, size_t pages); int unmap (uintptr_t vaddr, size_t pages);
/* Clone process with argument and entry point */
int clone (uintptr_t vstack_top, void (*entry) (void), void* argument_ptr); int clone (uintptr_t vstack_top, void (*entry) (void), void* argument_ptr);
/* Create a mutex */
int mutex_create (int mutex_rid); int mutex_create (int mutex_rid);
/* Delete a mutex. Will wake up waiters */
int mutex_delete (int mutex_rid); int mutex_delete (int mutex_rid);
/* Lock a mutex */
int mutex_lock (int mutex_rid); int mutex_lock (int mutex_rid);
/* Unlock a mutex */
int mutex_unlock (int mutex_rid); int mutex_unlock (int mutex_rid);
/* get current process argument pointer */
void* argument_ptr (void); void* argument_ptr (void);
/* Call a device command */
int device_do (int device_id, int cmd, void* a1, void* a2, void* a3, void* a4); int device_do (int device_id, int cmd, void* a1, void* a2, void* a3, void* a4);
#endif // _LIBMSL_M_SYSTEM_H #endif // _LIBMSL_M_SYSTEM_H

View File

@@ -1,3 +1,4 @@
*.o *.o
*.json *.json
docs/ docs/
.cache/

View File

@@ -3,12 +3,19 @@
#include <m/system.h> #include <m/system.h>
/* Size of process' stack */
#define STACK_SIZE (256 * PAGE_SIZE) #define STACK_SIZE (256 * PAGE_SIZE)
/* Process entry function */
typedef void (*process_func_t) (void); typedef void (*process_func_t) (void);
/* Spawn a new process within the same procgroup with argument */
int process_spawn (process_func_t func, void* argument_ptr); int process_spawn (process_func_t func, void* argument_ptr);
/* Quit the current process */
int process_quit (void); int process_quit (void);
/* Get process argument pointer */
void* process_argument (void); void* process_argument (void);
#endif // _LIBPROCESS_PROCESS_PROCESS_H #endif // _LIBPROCESS_PROCESS_PROCESS_H

View File

@@ -1,3 +1,4 @@
*.o *.o
*.json *.json
docs/ docs/
.cache/

View File

@@ -4,10 +4,19 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
/* Set block of memory */
size_t memset (void* dst, uint8_t b, size_t n); size_t memset (void* dst, uint8_t b, size_t n);
/* Copy memory from src to dst */
size_t memcpy (void* dst, const void* src, size_t n); size_t memcpy (void* dst, const void* src, size_t n);
/* Copy n chars from string */
void strncpy (char* dst, const char* src, size_t n); void strncpy (char* dst, const char* src, size_t n);
/* Count chars in a string */
size_t strlen (const char* str); size_t strlen (const char* str);
/* Compare blocks of memory */
int memcmp (const void* s1, const void* s2, size_t n); int memcmp (const void* s1, const void* s2, size_t n);
#endif // _LIBSTRING_STRING_H #endif // _LIBSTRING_STRING_H

View File

@@ -1,3 +1,4 @@
*.o *.o
*.json *.json
docs/ docs/
.cache/

View File

@@ -4,8 +4,10 @@
#include <m/terminal_device.h> #include <m/terminal_device.h>
#include <stddef.h> #include <stddef.h>
/* ID of kernel terminal device */
#define TERMINAL_DEVICE 1 #define TERMINAL_DEVICE 1
/* Print a string onto a graphical terminal. Prints len chars */
void terminal_print (const char* string, size_t len); void terminal_print (const char* string, size_t len);
#endif // _LIBTERMINAL_TERMINAL_TERMINAL_H #endif // _LIBTERMINAL_TERMINAL_TERMINAL_H