Auxilary scripts for formatting all components
All checks were successful
Build documentation / build-and-deploy (push) Successful in 44s

This commit is contained in:
2026-01-04 01:44:02 +01:00
parent e077d322f4
commit b5353cb600
11 changed files with 42 additions and 33 deletions

7
aux/format.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
set -x
make -B format_kernel
make -B format_libmsl
make -B format_apps

View File

@@ -3,10 +3,10 @@
#include <amd64/mm.h>
#include <amd64/msr-index.h>
#include <amd64/msr.h>
#include <m/syscall_defs.h>
#include <proc/proc.h>
#include <sys/debug.h>
#include <sys/smp.h>
#include <m/syscall_defs.h>
#include <syscall/syscall.h>
extern void amd64_syscall_entry (void);

View File

@@ -1,8 +1,8 @@
#include <aux/compiler.h>
#include <libk/std.h>
#include <m/syscall_defs.h>
#include <proc/proc.h>
#include <sys/debug.h>
#include <m/syscall_defs.h>
#include <syscall/syscall.h>
#define DEFINE_SYSCALL(name) \

View File

@@ -1,23 +1,22 @@
#include <amd64/syscall.h>
#include <stddef.h>
#include <stdint.h>
#include <amd64/syscall.h>
int msl_amd64_syscall (int syscall_num, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6) {
int msl_amd64_syscall (int syscall_num, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4,
uintptr_t a5, uintptr_t a6) {
uint64_t result;
__asm__ volatile (
"movq %1, %%rax\n"
"movq %2, %%rdi\n"
"movq %3, %%rsi\n"
"movq %4, %%rdx\n"
"movq %5, %%r10\n"
"movq %6, %%r8\n"
"movq %7, %%r9\n"
"syscall\n"
"movq %%rax, %0\n"
: "=r"(result)
: "r"((uint64_t)syscall_num), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(a6)
: "memory", "cc", "rcx", "r11"
);
__asm__ volatile ("movq %1, %%rax\n"
"movq %2, %%rdi\n"
"movq %3, %%rsi\n"
"movq %4, %%rdx\n"
"movq %5, %%r10\n"
"movq %6, %%r8\n"
"movq %7, %%r9\n"
"syscall\n"
"movq %%rax, %0\n"
: "=r"(result)
: "r"((uint64_t)syscall_num), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5),
"r"(a6)
: "memory", "cc", "rcx", "r11");
return (int)result;
}

View File

@@ -3,6 +3,7 @@
#include <stdint.h>
int msl_amd64_syscall (int syscall_num, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6);
int msl_amd64_syscall (int syscall_num, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4,
uintptr_t a5, uintptr_t a6);
#endif // _LIBMSL_AMD64_SYSCALL_H

View File

@@ -1,5 +1,5 @@
#include <stdint.h>
#include <m/proc.h>
#include <stdint.h>
extern volatile uint8_t __bss_start[];
extern volatile uint8_t __bss_end[];
@@ -7,7 +7,7 @@ extern volatile uint8_t __bss_end[];
extern void app_main (void);
static void msl_clear_bss (void) {
uint8_t *p = (uint8_t*)__bss_start;
uint8_t* p = (uint8_t*)__bss_start;
while (p < __bss_end) {
*p++ = 0;
}

View File

@@ -1,10 +1,6 @@
#include <m/syscall.h>
#include <m/syscall_defs.h>
int m_proc_quit (void) {
return m_syscall (SYS_PROC_QUIT, 0, 0, 0, 0, 0, 0);
}
int m_proc_quit (void) { return m_syscall (SYS_PROC_QUIT, 0, 0, 0, 0, 0, 0); }
int m_proc_test (void) {
return m_syscall (SYS_PROC_TEST, 0, 0, 0, 0, 0, 0);
}
int m_proc_test (void) { return m_syscall (SYS_PROC_TEST, 0, 0, 0, 0, 0, 0); }

View File

@@ -4,8 +4,8 @@
#include <m/syscall_defs.h>
#if defined(__x86_64__)
#include <amd64/syscall.h>
#define m_syscall msl_amd64_syscall
#include <amd64/syscall.h>
#define m_syscall msl_amd64_syscall
#endif
#endif // _LIBMSL_M_SYSCALL_H

View File

@@ -6,4 +6,7 @@ all_apps:
clean_apps:
@for d in $(apps); do make -C $$d platform=$(platform) clean; done
.PHONY: all_apps clean_apps
format_apps:
@for d in $(apps); do make -C $$d platform=$(platform) format; done
.PHONY: all_apps clean_apps format_apps

View File

@@ -23,4 +23,7 @@ $(app): $(o)
clean:
rm -f $(o) $(app)
.PHONY: all clean
format:
clang-format -i $$(git ls-files '*.c' '*.h')
.PHONY: all clean format