-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
164 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: It Compiles! | ||
on: [push] | ||
on: [push, workflow_dispatch] | ||
jobs: | ||
Compile: | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef CRESCENT_HANDLE_H | ||
#define CRESCENT_HANDLE_H | ||
|
||
#include <stdint.h> | ||
|
||
#define INVALID_HANDLE ((Handle) -1) | ||
|
||
typedef uint64_t Handle; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
#pragma once | ||
#include "types.h" | ||
|
||
void arch_hlt(); | ||
void arch_spinloop_hint(); | ||
|
||
void arch_reboot(); | ||
void arch_reboot(); | ||
|
||
#define __user __attribute__((address_space(1), noderef)) | ||
|
||
bool arch_mem_copy_to_user(__user void* restrict user, const void* restrict kernel, usize size); | ||
bool arch_mem_copy_to_kernel(void* restrict kernel, __user const void* restrict user, usize size); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// bool arch_mem_copy_to_user(__user void* restrict user, const void* restrict kernel, usize size); | ||
// bool arch_mem_copy_to_kernel(void* restrict kernel, __user const void* restrict user, usize size); | ||
|
||
#include <arch/x86/sched/usermode.inc> | ||
|
||
.globl arch_mem_copy_to_user | ||
.globl arch_mem_copy_to_kernel | ||
|
||
.type arch_mem_copy_to_user, @function | ||
arch_mem_copy_to_user: | ||
push %rbp | ||
mov %rsp, %rbp | ||
|
||
lea 1f(%rip), %rax | ||
mov %rax, %gs:X86TASK_HANDLER_IP_OFF | ||
mov %rsp, %gs:X86TASK_HANDLER_SP_OFF | ||
|
||
call memcpy | ||
|
||
pop %rbp | ||
mov $1, %eax | ||
ret | ||
1: | ||
pop %rbp | ||
xor %eax, %eax | ||
ret | ||
|
||
.type arch_mem_copy_to_kernel, @function | ||
arch_mem_copy_to_kernel: | ||
push %rbp | ||
mov %rsp, %rbp | ||
|
||
lea 1f(%rip), %rax | ||
mov %rax, %gs:X86TASK_HANDLER_IP_OFF | ||
mov %rsp, %gs:X86TASK_HANDLER_SP_OFF | ||
|
||
call memcpy | ||
|
||
pop %rbp | ||
mov $1, %eax | ||
ret | ||
1: | ||
pop %rbp | ||
xor %eax, %eax | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#ifndef USERMODE_INC | ||
#define USERMODE_INC | ||
|
||
#define X86TASK_INSIDE_SYSCALL_OFFSET 380 | ||
#define X86TASK_HANDLER_IP_OFF 368 | ||
#define X86TASK_HANDLER_SP_OFF 376 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
#include "arch/misc.h" | ||
|
||
static inline bool mem_copy_to_user(__user void* restrict user, const void* restrict kernel, usize size) { | ||
return arch_mem_copy_to_user(user, kernel, size); | ||
} | ||
|
||
static inline bool mem_copy_to_kernel(void* restrict kernel, __user const void* restrict user, usize size) { | ||
return arch_mem_copy_to_kernel(kernel, user, size); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.