Run clang-format

This commit is contained in:
apio 2022-11-08 19:07:43 +01:00
parent 0c1ffedd3f
commit 98da473fdc
11 changed files with 44 additions and 30 deletions

View File

@ -1,7 +1,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
int main()
{

View File

@ -35,5 +35,6 @@ namespace MemoryManager
void protect(void* page, uint64_t count, int flags);
void map_several_pages(uint64_t physicalAddress, uint64_t virtualAddress, uint64_t count, int flags = MAP_READ_WRITE);
void map_several_pages(uint64_t physicalAddress, uint64_t virtualAddress, uint64_t count,
int flags = MAP_READ_WRITE);
}

View File

@ -1,8 +1,8 @@
#include "fs/devices/DeviceFS.h"
#include "fs/devices/Console.h"
#include "fs/devices/Framebuffer.h"
#include "fs/devices/Keyboard.h"
#include "fs/devices/NullDevice.h"
#include "fs/devices/Framebuffer.h"
#include "fs/devices/Random.h"
#include "fs/devices/Serial.h"
#include "fs/devices/Version.h"

View File

@ -10,6 +10,7 @@
#include "memory/MemoryManager.h"
#include "memory/PMM.h"
#include "memory/VMM.h"
#include "misc/MSR.h"
#include "misc/hang.h"
#include "rand/Init.h"
#include "rand/Mersenne.h"
@ -18,7 +19,6 @@
#include "std/assert.h"
#include "std/string.h"
#include "utils/Time.h"
#include "misc/MSR.h"
extern BOOTBOOT bootboot;
extern "C" char environment[4096];
@ -46,7 +46,8 @@ extern void panic_prepare_keyboard_triple_fault();
static void check_and_enable_nx()
{
if(!CPU::has_nx()) {
if (!CPU::has_nx())
{
kerrorln("This machine does not support the NX feature, which is required to continue booting.");
kerrorln("On most cases, this means your machine is too old and not supported.");

View File

@ -1,8 +1,8 @@
#define MODULE "irq"
#include "interrupts/IRQ.h"
#include "fs/devices/Keyboard.h"
#include "fs/devices/Console.h"
#include "fs/devices/Keyboard.h"
#include "io/IO.h"
#include "io/PIC.h"
#include "log/Log.h"

View File

@ -26,7 +26,8 @@ void AddressSpace::destroy()
if (!pdp_pde.present) continue;
if (pdp_pde.larger_pages)
{
if(pdp_pde.owned_by_task) {
if (pdp_pde.owned_by_task)
{
pages_freed++;
PMM::free_page((void*)pdp_pde.get_address());
}
@ -39,7 +40,8 @@ void AddressSpace::destroy()
if (!pd_pde.present) continue;
if (pd_pde.larger_pages)
{
if(pd_pde.owned_by_task) {
if (pd_pde.owned_by_task)
{
pages_freed++;
PMM::free_page((void*)pd_pde.get_address());
}
@ -52,7 +54,8 @@ void AddressSpace::destroy()
if (!pt_pde.present) continue;
if (pt_pde.larger_pages)
{
if(pt_pde.owned_by_task) {
if (pt_pde.owned_by_task)
{
pages_freed++;
PMM::free_page((void*)pt_pde.get_address());
}
@ -91,7 +94,8 @@ void AddressSpace::clear()
if (!pdp_pde.present) continue;
if (pdp_pde.larger_pages)
{
if(pdp_pde.owned_by_task) {
if (pdp_pde.owned_by_task)
{
pages_freed++;
PMM::free_page((void*)pdp_pde.get_address());
}
@ -104,7 +108,8 @@ void AddressSpace::clear()
if (!pd_pde.present) continue;
if (pd_pde.larger_pages)
{
if(pd_pde.owned_by_task) {
if (pd_pde.owned_by_task)
{
pages_freed++;
PMM::free_page((void*)pd_pde.get_address());
}
@ -117,7 +122,8 @@ void AddressSpace::clear()
if (!pt_pde.present) continue;
if (pt_pde.larger_pages)
{
if(pt_pde.owned_by_task) {
if (pt_pde.owned_by_task)
{
pages_freed++;
PMM::free_page((void*)pt_pde.get_address());
}

View File

@ -7,8 +7,8 @@
#include "memory/MemoryManager.h"
#include "memory/PMM.h"
#include "memory/VMM.h"
#include "std/assert.h"
#include "misc/utils.h"
#include "std/assert.h"
void MemoryManager::init()
{
@ -25,8 +25,10 @@ extern char end_of_kernel_data[1];
void MemoryManager::protect_kernel_sections()
{
protect(start_of_kernel_rodata, Utilities::get_blocks_from_size(PAGE_SIZE, end_of_kernel_rodata - start_of_kernel_rodata), 0);
protect(start_of_kernel_data, Utilities::get_blocks_from_size(PAGE_SIZE, end_of_kernel_data - start_of_kernel_data), MAP_READ_WRITE);
protect(start_of_kernel_rodata,
Utilities::get_blocks_from_size(PAGE_SIZE, end_of_kernel_rodata - start_of_kernel_rodata), 0);
protect(start_of_kernel_data, Utilities::get_blocks_from_size(PAGE_SIZE, end_of_kernel_data - start_of_kernel_data),
MAP_READ_WRITE);
}
void* MemoryManager::get_mapping(void* physicalAddress, int flags)

View File

@ -16,7 +16,9 @@ void Syscall::entry(Context* context)
case SYS_sleep: sys_sleep(context, context->rdi); break;
case SYS_write: sys_write(context, (int)context->rdi, context->rsi, (const char*)context->rdx); break;
case SYS_getprocid: sys_getprocid(context, (int)context->rdi); break;
case SYS_mmap: sys_mmap(context, (void*)context->rdi, context->rsi, (int)context->rdx, (int)context->r10, (off_t)context->r8); break;
case SYS_mmap:
sys_mmap(context, (void*)context->rdi, context->rsi, (int)context->rdx, (int)context->r10, (off_t)context->r8);
break;
case SYS_munmap: sys_munmap(context, (void*)context->rdi, context->rsi); break;
case SYS_open: sys_open(context, (const char*)context->rdi, (int)context->rsi, (mode_t)context->rdx); break;
case SYS_read: sys_read(context, (int)context->rdi, context->rsi, (char*)context->rdx); break;

View File

@ -119,7 +119,8 @@ ELFImage* ELFLoader::load_elf_from_vfs(VFS::Node* node)
int new_flags = MAP_USER | MAP_AS_OWNED_BY_TASK;
if (can_write_segment(phdr.p_flags)) new_flags |= MAP_READ_WRITE;
else if (can_execute_segment(phdr.p_flags)) new_flags |= MAP_EXEC;
else if (can_execute_segment(phdr.p_flags))
new_flags |= MAP_EXEC;
MemoryManager::protect(buffer, pages, new_flags);

View File

@ -1,8 +1,8 @@
#include <luna/syscall.h>
#include <sys/ioctl.h>
#include <sys/syscall.h>
#include <stdarg.h>
#include <stdint.h>
#include <sys/ioctl.h>
#include <sys/syscall.h>
extern "C"
{

View File

@ -7,7 +7,8 @@ extern "C"
// FIXME: Implement a POSIX-compliant mmap.
void* mmap(void* addr, size_t len, int prot, int flags, int fd, off_t offset)
{
long result = __luna_syscall5(SYS_mmap, (sysarg_t)addr, (sysarg_t)len, (sysarg_t)prot, flags & MAP_ANONYMOUS ? (sysarg_t)-1 : (sysarg_t)fd, (sysarg_t)offset);
long result = __luna_syscall5(SYS_mmap, (sysarg_t)addr, (sysarg_t)len, (sysarg_t)prot,
flags & MAP_ANONYMOUS ? (sysarg_t)-1 : (sysarg_t)fd, (sysarg_t)offset);
_RETURN_WITH_MEMORY_ERRNO(result, void*);
}