Drop m_ prefix from libmsl
This commit is contained in:
69
init/init.c
69
init/init.c
@@ -7,69 +7,22 @@
|
|||||||
char c = 'a';
|
char c = 'a';
|
||||||
|
|
||||||
void app_main (void) {
|
void app_main (void) {
|
||||||
/* uintptr_t out_paddr; */
|
uintptr_t out_paddr;
|
||||||
/* int mem_rid = m_proc_create_resource_mem (16, RV_PRIVATE, &out_paddr); */
|
int mem_rid = proc_create_resource_mem (16, RV_PRIVATE, &out_paddr);
|
||||||
|
|
||||||
/* m_proc_map (out_paddr, M_PROC_MAP_BASE, 16, PM_PRESENT | PM_RW | PM_USER); */
|
proc_map (out_paddr, PROC_MAP_BASE, 16, PM_PRESENT | PM_RW | PM_USER);
|
||||||
|
|
||||||
/* memset ((void*)M_PROC_MAP_BASE, 0, M_PAGE_SIZE * 16); */
|
memset ((void*)PROC_MAP_BASE, 0, PAGE_SIZE * 16);
|
||||||
|
|
||||||
/* m_proc_unmap (M_PROC_MAP_BASE, 16); */
|
proc_unmap (PROC_MAP_BASE, 16);
|
||||||
|
|
||||||
/* m_proc_drop_resource (mem_rid); */
|
proc_drop_resource (mem_rid);
|
||||||
|
|
||||||
/* m_proc_test (); */
|
proc_test ('a');
|
||||||
|
|
||||||
/* int mutex_rid = m_proc_create_resource_mutex (RV_PRIVATE); */
|
int mutex_rid = proc_create_resource_mutex (RV_PRIVATE);
|
||||||
|
|
||||||
/* m_proc_mutex_lock (mutex_rid); */
|
proc_mutex_lock (mutex_rid);
|
||||||
/* m_proc_test (); */
|
proc_test ('b');
|
||||||
/* m_proc_mutex_unlock (mutex_rid); */
|
proc_mutex_unlock (mutex_rid);
|
||||||
|
|
||||||
if (c > 'z')
|
|
||||||
c = 'a';
|
|
||||||
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
m_proc_test (c++);
|
|
||||||
|
|
||||||
__asm__ volatile ("dupa: nop; nop; nop; jmp dupa");
|
|
||||||
/* for (volatile uint64_t i = 0; i < 1000*1000*100; i++); */
|
|
||||||
|
|
||||||
/* if (c > 'z') */
|
|
||||||
/* c = 'a'; */
|
|
||||||
|
|
||||||
/* m_proc_test ('k'); */
|
|
||||||
/* m_proc_test ('l'); */
|
|
||||||
/* m_proc_test ('m'); */
|
|
||||||
/* m_proc_test ('n'); */
|
|
||||||
/* m_proc_test ('o'); */
|
|
||||||
/* m_proc_test ('p'); */
|
|
||||||
/* m_proc_test ('r'); */
|
|
||||||
/* m_proc_test ('s'); */
|
|
||||||
/* m_proc_test ('t'); */
|
|
||||||
/* m_proc_test ('u'); */
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
int msl_amd64_syscall (int syscall_num, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4,
|
int 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) {
|
||||||
uint64_t result;
|
uint64_t result;
|
||||||
__asm__ volatile ("movq %[a4], %%r10\n"
|
__asm__ volatile ("movq %[a4], %%r10\n"
|
||||||
"movq %[a5], %%r8\n"
|
"movq %[a5], %%r8\n"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
int msl_amd64_syscall (int syscall_num, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4,
|
int 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);
|
||||||
|
|
||||||
#endif // _LIBMSL_AMD64_SYSCALL_H
|
#endif // _LIBMSL_AMD64_SYSCALL_H
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ extern volatile uint8_t __bss_end[];
|
|||||||
|
|
||||||
extern void app_main (void);
|
extern void app_main (void);
|
||||||
|
|
||||||
static void msl_clear_bss (void) {
|
static void clear_bss (void) {
|
||||||
uint8_t* p = (uint8_t*)__bss_start;
|
uint8_t* p = (uint8_t*)__bss_start;
|
||||||
while (p < __bss_end) {
|
while (p < __bss_end) {
|
||||||
*p++ = 0;
|
*p++ = 0;
|
||||||
@@ -14,9 +14,9 @@ static void msl_clear_bss (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void __premain (void) {
|
void __premain (void) {
|
||||||
msl_clear_bss ();
|
clear_bss ();
|
||||||
|
|
||||||
app_main ();
|
app_main ();
|
||||||
|
|
||||||
m_proc_quit ();
|
proc_quit ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,35 +3,35 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
int m_proc_quit (void) { return m_syscall (SYS_PROC_QUIT, 0, 0, 0, 0, 0, 0); }
|
int proc_quit (void) { return syscall (SYS_PROC_QUIT, 0, 0, 0, 0, 0, 0); }
|
||||||
|
|
||||||
int m_proc_test (char c) { return m_syscall (SYS_PROC_TEST, (uintptr_t)c, 0, 0, 0, 0, 0); }
|
int proc_test (char c) { return syscall (SYS_PROC_TEST, (uintptr_t)c, 0, 0, 0, 0, 0); }
|
||||||
|
|
||||||
int m_proc_map (uintptr_t paddr, uintptr_t vaddr, size_t pages, uint32_t flags) {
|
int proc_map (uintptr_t paddr, uintptr_t vaddr, size_t pages, uint32_t flags) {
|
||||||
return m_syscall (SYS_PROC_MAP, paddr, vaddr, (uintptr_t)pages, (uintptr_t)flags, 0, 0);
|
return syscall (SYS_PROC_MAP, paddr, vaddr, (uintptr_t)pages, (uintptr_t)flags, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_proc_unmap (uintptr_t vaddr, size_t pages) {
|
int proc_unmap (uintptr_t vaddr, size_t pages) {
|
||||||
return m_syscall (SYS_PROC_UNMAP, vaddr, (uintptr_t)pages, 0, 0, 0, 0);
|
return syscall (SYS_PROC_UNMAP, vaddr, (uintptr_t)pages, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_proc_create_resource_mem (size_t pages, int vis, uintptr_t* out_paddr) {
|
int proc_create_resource_mem (size_t pages, int vis, uintptr_t* out_paddr) {
|
||||||
return m_syscall (SYS_PROC_CREATE_RESOURCE_MEM, (uintptr_t)pages, (uintptr_t)vis,
|
return syscall (SYS_PROC_CREATE_RESOURCE_MEM, (uintptr_t)pages, (uintptr_t)vis,
|
||||||
(uintptr_t)out_paddr, 0, 0, 0);
|
(uintptr_t)out_paddr, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_proc_drop_resource (int rid) {
|
int proc_drop_resource (int rid) {
|
||||||
return m_syscall (SYS_PROC_DROP_RESOURCE, (uintptr_t)rid, 0, 0, 0, 0, 0);
|
return syscall (SYS_PROC_DROP_RESOURCE, (uintptr_t)rid, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_proc_create_resource_mutex (int vis) {
|
int proc_create_resource_mutex (int vis) {
|
||||||
return m_syscall (SYS_PROC_CREATE_RESOURCE_MUTEX, (uintptr_t)vis, 0, 0, 0, 0, 0);
|
return syscall (SYS_PROC_CREATE_RESOURCE_MUTEX, (uintptr_t)vis, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_proc_mutex_lock (int mutex_rid) {
|
int proc_mutex_lock (int mutex_rid) {
|
||||||
return m_syscall (SYS_PROC_MUTEX_LOCK, (uintptr_t)mutex_rid, 0, 0, 0, 0, 0);
|
return syscall (SYS_PROC_MUTEX_LOCK, (uintptr_t)mutex_rid, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_proc_mutex_unlock (int mutex_rid) {
|
int proc_mutex_unlock (int mutex_rid) {
|
||||||
return m_syscall (SYS_PROC_MUTEX_UNLOCK, (uintptr_t)mutex_rid, 0, 0, 0, 0, 0);
|
return syscall (SYS_PROC_MUTEX_UNLOCK, (uintptr_t)mutex_rid, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
#define _LIBMSL_M_PROC_H
|
#define _LIBMSL_M_PROC_H
|
||||||
|
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
#define M_PROC_MAP_BASE 0x0000700000000000
|
#define PROC_MAP_BASE 0x0000700000000000
|
||||||
#define M_PAGE_SIZE 4096
|
#define PAGE_SIZE 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PM_PRESENT (1 << 0)
|
#define PM_PRESENT (1 << 0)
|
||||||
@@ -16,14 +16,14 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
int m_proc_quit (void);
|
int proc_quit (void);
|
||||||
int m_proc_test (char c);
|
int proc_test (char c);
|
||||||
int m_proc_map (uintptr_t paddr, uintptr_t vaddr, size_t pages, uint32_t flags);
|
int proc_map (uintptr_t paddr, uintptr_t vaddr, size_t pages, uint32_t flags);
|
||||||
int m_proc_unmap (uintptr_t vaddr, size_t pages);
|
int proc_unmap (uintptr_t vaddr, size_t pages);
|
||||||
int m_proc_create_resource_mem (size_t pages, int vis, uintptr_t* out_paddr);
|
int proc_create_resource_mem (size_t pages, int vis, uintptr_t* out_paddr);
|
||||||
int m_proc_drop_resource (int rid);
|
int proc_drop_resource (int rid);
|
||||||
int m_proc_create_resource_mutex (int vis);
|
int proc_create_resource_mutex (int vis);
|
||||||
int m_proc_mutex_lock (int mutex_rid);
|
int proc_mutex_lock (int mutex_rid);
|
||||||
int m_proc_mutex_unlock (int mutex_rid);
|
int proc_mutex_unlock (int mutex_rid);
|
||||||
|
|
||||||
#endif // _LIBMSL_M_PROC_H
|
#endif // _LIBMSL_M_PROC_H
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
#include <amd64/syscall.h>
|
#include <amd64/syscall.h>
|
||||||
#define m_syscall msl_amd64_syscall
|
#define syscall amd64_syscall
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _LIBMSL_M_SYSCALL_H
|
#endif // _LIBMSL_M_SYSCALL_H
|
||||||
|
|||||||
Reference in New Issue
Block a user