mirror of
https://github.com/usatiuk/ficus.git
synced 2025-10-29 00:27:52 +01:00
pretty up GDT a little, and other stuff
also thanks internet for the boilerplate
This commit is contained in:
@@ -2,7 +2,26 @@
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: true
|
||||
AcrossComments: false
|
||||
AlignConsecutiveBitFields:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: true
|
||||
AcrossComments: true
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: true
|
||||
AcrossComments: false
|
||||
AlignConsecutiveMacros:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: true
|
||||
AcrossComments: false
|
||||
AlignTrailingComments:
|
||||
Kind: Always
|
||||
OverEmptyLines: 2
|
||||
SpacesBeforeTrailingComments: 1
|
||||
AlignOperands: Align
|
||||
AlignEscapedNewlines: Right
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
@@ -57,7 +76,6 @@ SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 0
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInContainerLiterals: false
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "idt.hpp"
|
||||
#include "io.hpp"
|
||||
|
||||
#define PORT 0x3f8// COM1
|
||||
#define PORT 0x3f8 // COM1
|
||||
|
||||
void SerialTty::putchar(char c) {
|
||||
LockGuard guard(mutex);
|
||||
@@ -41,8 +41,8 @@ void SerialTty::this_pooler() {
|
||||
}
|
||||
|
||||
SerialTty::SerialTty() : Tty() {
|
||||
outb(PORT + 3, 0x00);// Disable DLAB
|
||||
outb(PORT + 1, 0x01);// Enable data available interrupt
|
||||
outb(PORT + 3, 0x00); // Disable DLAB
|
||||
outb(PORT + 1, 0x01); // Enable data available interrupt
|
||||
|
||||
Task *task = new_ktask((void (*)(void))(&SerialTty::this_pooler), "serialpooler", false);
|
||||
task->frame.rdi = reinterpret_cast<uint64_t>(this);
|
||||
|
||||
@@ -28,4 +28,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_SERIALTTY_HPP
|
||||
#endif //OS2_SERIALTTY_HPP
|
||||
|
||||
@@ -38,7 +38,7 @@ real_start() {
|
||||
extern "C" void _start(void) {
|
||||
_sse_setup();
|
||||
barrier();
|
||||
gdt_setup();
|
||||
Arch::GDT::gdt_setup();
|
||||
barrier();
|
||||
idt_init();
|
||||
barrier();
|
||||
@@ -73,7 +73,7 @@ extern "C" void _start(void) {
|
||||
|
||||
uint64_t real_new_cr3 = (uint64_t) HHDM_V2P(KERN_AddressSpace_PML4);
|
||||
uint64_t *new_stack_top = &KERN_stack[KERN_STACK_SIZE - 1]; // Don't forget in which direction the stack grows...
|
||||
new_stack_top = reinterpret_cast<uint64_t *>(((uint64_t) new_stack_top) & (~0xFULL));// correct alignment for sse
|
||||
new_stack_top = reinterpret_cast<uint64_t *>(((uint64_t) new_stack_top) & (~0xFULL)); // correct alignment for sse
|
||||
|
||||
barrier();
|
||||
__asm__ volatile("movq %[new_stack_top], %%rsp; movq %[real_new_cr3], %%cr3; call real_start"
|
||||
|
||||
@@ -74,16 +74,19 @@ gdt_code_user:
|
||||
db PRESENT | USER | NOT_SYS | EXEC | RW ; Access
|
||||
db GRAN_4K | LONG_MODE | 0xF ; Flags & Limit (high, bits 16-19)
|
||||
db 0 ; Base (high, bits 24-31)
|
||||
|
||||
global gdt_tss:data
|
||||
gdt_tss:
|
||||
dq 0x00000000 ;TODO
|
||||
dq 0x00000000
|
||||
dq 0x00000000
|
||||
global gdt_tss_user:data
|
||||
gdt_tss_user:
|
||||
dq 0x00000000 ;TODO
|
||||
dq 0x00000000
|
||||
dq 0x00000000
|
||||
|
||||
global gdt_end:data
|
||||
gdt_end:
|
||||
|
||||
global gdtr:data
|
||||
gdtr:
|
||||
dw gdt_end - gdt_null - 1
|
||||
@@ -93,20 +96,23 @@ section .text
|
||||
global _gdt_setup:function (_gdt_setup.end - _gdt_setup)
|
||||
_gdt_setup:
|
||||
LGDT [gdtr]
|
||||
; Reload CS register:
|
||||
PUSH (gdt_code - gdt_null); Push code segment to stack, 0x08 is a stand-in for your code segment
|
||||
LEA RAX, [rel .flush] ; Load address of .reload_CS into RAX
|
||||
; Reload CS register
|
||||
PUSH (gdt_code - gdt_null) ; Push code segment to stack
|
||||
LEA RAX, [rel .flush] ; Load address of .flush into RAX
|
||||
PUSH RAX ; Push this value to the stack
|
||||
RETFQ ; Perform a far return, RETFQ or LRETQ depending on syntax
|
||||
|
||||
.flush:
|
||||
|
||||
; Reload data segment registers
|
||||
MOV AX, (gdt_data - gdt_null) ; 0x10 is a stand-in for your data segment
|
||||
MOV AX, (gdt_data - gdt_null)
|
||||
MOV DS, AX
|
||||
MOV ES, AX
|
||||
MOV FS, AX
|
||||
MOV GS, AX
|
||||
MOV SS, AX
|
||||
MOV AX, (gdt_tss - gdt_null)
|
||||
|
||||
ltr AX
|
||||
RET
|
||||
.end:
|
||||
|
||||
@@ -3,23 +3,27 @@
|
||||
//
|
||||
|
||||
#include "gdt.hpp"
|
||||
#include "asserts.hpp"
|
||||
#include "misc.hpp"
|
||||
#include <cstddef>
|
||||
namespace Arch::GDT {
|
||||
static tss_entry_struct tss_entry;
|
||||
static tss_entry_struct tss_entry_user;
|
||||
|
||||
static struct tss_entry_struct tss_entry;
|
||||
static struct tss_entry_struct tss_entry_user;
|
||||
static constexpr size_t INT_STACK_SIZE = 16384;
|
||||
static constexpr size_t RSP_STACK_SIZE = 16384;
|
||||
|
||||
#define INT_STACK_SIZE 16384
|
||||
#define RSP_STACK_SIZE 16384
|
||||
static uint64_t int_stack[INT_STACK_SIZE];
|
||||
static uint64_t rsp_stack[RSP_STACK_SIZE];
|
||||
static uint64_t int_stack[INT_STACK_SIZE];
|
||||
static uint64_t rsp_stack[RSP_STACK_SIZE];
|
||||
|
||||
void gdt_setup() {
|
||||
//
|
||||
void gdt_setup() {
|
||||
uint32_t tss_limit = sizeof(tss_entry);
|
||||
uint64_t tss_base = (uint64_t) &tss_entry;
|
||||
|
||||
gdt_tss.limit_low = tss_limit & 0xFFFF;
|
||||
gdt_tss.base_low = tss_base & 0xFFFFFF;
|
||||
gdt_tss.type = 0b1001;// Available 64 bit TSS
|
||||
gdt_tss.type = 0b1001; // Available 64 bit TSS
|
||||
gdt_tss.zero = 0;
|
||||
gdt_tss.DPL = 0;
|
||||
gdt_tss.present = 1;
|
||||
@@ -30,10 +34,14 @@ void gdt_setup() {
|
||||
gdt_tss.base_high = (tss_base >> 24) & 0xFFFFFFFFFF;
|
||||
|
||||
tss_entry.ist1 = (((uintptr_t) int_stack + (INT_STACK_SIZE - 9) - 1) & (~0xFULL)) + 8;
|
||||
if ((tss_entry.ist1 & 0xFULL) != 8) _hcf();
|
||||
tss_entry.rsp0 = (((uintptr_t) rsp_stack + (RSP_STACK_SIZE - 9) - 1) & (~0xFULL)) + 8;
|
||||
if ((tss_entry.rsp0 & 0xFULL) != 8) _hcf();
|
||||
assert((tss_entry.ist1 & 0xFULL) == 8);
|
||||
|
||||
barrier();// The asm function might clobber registers
|
||||
tss_entry.rsp0 = (((uintptr_t) rsp_stack + (RSP_STACK_SIZE - 9) - 1) & (~0xFULL)) + 8;
|
||||
assert((tss_entry.rsp0 & 0xFULL) == 8);
|
||||
|
||||
barrier(); // The asm function might clobber registers
|
||||
_gdt_setup();
|
||||
}
|
||||
barrier();
|
||||
}
|
||||
|
||||
} // namespace Arch::GDT
|
||||
@@ -3,25 +3,29 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
struct gdt_entry_bits {
|
||||
namespace Arch::GDT {
|
||||
struct gdt_entry_bits {
|
||||
unsigned int limit_low : 16;
|
||||
unsigned int base_low : 24;
|
||||
unsigned int accessed : 1;
|
||||
unsigned int read_write : 1; // readable for code, writable for data
|
||||
unsigned int conforming_expand_down : 1;// conforming for code, expand down for data
|
||||
unsigned int conforming_expand_down : 1; // conforming for code, expand down for data
|
||||
unsigned int code : 1; // 1 for code, 0 for data
|
||||
unsigned int code_data_segment : 1; // should be 1 for everything but TSS and LDT
|
||||
unsigned int DPL : 2; // privilege level
|
||||
unsigned int present : 1;
|
||||
unsigned int limit_high : 4;
|
||||
unsigned int available : 1;// only used in software; has no effect on hardware
|
||||
unsigned int available : 1; // only used in software; has no effect on hardware
|
||||
unsigned int long_mode : 1;
|
||||
unsigned int big : 1; // 32-bit opcodes for code, uint32_t stack for data
|
||||
unsigned int gran : 1;// 1 to use 4k page addressing, 0 for byte addressing
|
||||
unsigned int gran : 1; // 1 to use 4k page addressing, 0 for byte addressing
|
||||
unsigned int base_high : 8;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct gdt_tss_entry_bits {
|
||||
//
|
||||
uint64_t selector() volatile;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct gdt_tss_entry_bits {
|
||||
unsigned int limit_low : 16;
|
||||
unsigned int base_low : 24;
|
||||
unsigned int type : 4;
|
||||
@@ -34,9 +38,9 @@ struct gdt_tss_entry_bits {
|
||||
unsigned int gran : 1;
|
||||
uint64_t base_high : 40;
|
||||
unsigned int zeros : 32;
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed));
|
||||
|
||||
struct tss_entry_struct {
|
||||
struct tss_entry_struct {
|
||||
uint32_t reserved;
|
||||
uint64_t rsp0;
|
||||
uint64_t rsp1;
|
||||
@@ -51,30 +55,37 @@ struct tss_entry_struct {
|
||||
uint64_t ist7;
|
||||
uint64_t reserved3;
|
||||
uint32_t reserved4;
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed));
|
||||
|
||||
extern "C" void _gdt_setup();
|
||||
void gdt_setup();
|
||||
void gdt_setup();
|
||||
|
||||
extern volatile struct gdt_entry_bits gdt_null;
|
||||
extern volatile struct gdt_entry_bits gdt_code_16;
|
||||
extern volatile struct gdt_entry_bits gdt_data_16;
|
||||
extern volatile struct gdt_entry_bits gdt_code_32;
|
||||
extern volatile struct gdt_entry_bits gdt_data_32;
|
||||
extern volatile struct gdt_entry_bits gdt_code;
|
||||
extern volatile struct gdt_entry_bits gdt_data;
|
||||
extern volatile struct gdt_entry_bits gdt_code_user;
|
||||
extern volatile struct gdt_entry_bits gdt_data_user;
|
||||
extern volatile struct gdt_tss_entry_bits gdt_tss;
|
||||
extern volatile struct gdt_tss_entry_bits gdt_tss_user;
|
||||
extern "C" {
|
||||
void _gdt_setup();
|
||||
extern volatile struct gdt_entry_bits gdt_null;
|
||||
extern volatile struct gdt_entry_bits gdt_code_16;
|
||||
extern volatile struct gdt_entry_bits gdt_data_16;
|
||||
extern volatile struct gdt_entry_bits gdt_code_32;
|
||||
extern volatile struct gdt_entry_bits gdt_data_32;
|
||||
extern volatile struct gdt_entry_bits gdt_code;
|
||||
extern volatile struct gdt_entry_bits gdt_data;
|
||||
extern volatile struct gdt_entry_bits gdt_code_user;
|
||||
extern volatile struct gdt_entry_bits gdt_data_user;
|
||||
extern volatile struct gdt_tss_entry_bits gdt_tss;
|
||||
extern volatile struct gdt_tss_entry_bits gdt_tss_user;
|
||||
|
||||
extern volatile struct gdt_entry_bits gdt_end;/// It is not a pointer!
|
||||
extern volatile struct gdt_entry_bits gdt_end; // It is not a pointer!
|
||||
|
||||
extern struct {
|
||||
extern struct {
|
||||
uint16_t limit;
|
||||
uint64_t base;
|
||||
} gdtr;
|
||||
} __attribute__((packed)) gdtr;
|
||||
}
|
||||
|
||||
inline uint64_t gdt_entry_bits::selector() volatile {
|
||||
return (((uint64_t) this) - ((uint64_t) &gdt_null));
|
||||
}
|
||||
|
||||
} // namespace Arch::GDT
|
||||
|
||||
#define GDTSEL(x) (((uint64_t) &x) - ((uint64_t) &gdt_null))
|
||||
|
||||
#endif
|
||||
@@ -12,4 +12,4 @@ extern uint64_t KERN_stack[KERN_STACK_SIZE] __attribute__((aligned(16)));
|
||||
|
||||
#define TASK_POINTER 0x10000
|
||||
|
||||
#endif//OS1_GLOBALS_H
|
||||
#endif //OS1_GLOBALS_H
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "task.hpp"
|
||||
#include "timer.hpp"
|
||||
|
||||
__attribute__((aligned(0x10))) static idt_entry_t idt[256];// Create an array of IDT entries; aligned for performance
|
||||
__attribute__((aligned(0x10))) static idt_entry_t idt[256]; // Create an array of IDT entries; aligned for performance
|
||||
static idtr_t idtr;
|
||||
|
||||
extern "C" __attribute__((noreturn)) void exception_handler(void) {
|
||||
@@ -37,7 +37,7 @@ void idt_set_descriptor(uint8_t vector, void (*isr)(), uint8_t flags) {
|
||||
idt_entry_t *descriptor = &idt[vector];
|
||||
|
||||
descriptor->isr_low = (uint64_t) isr & 0xFFFF;
|
||||
descriptor->kernel_cs = GDTSEL(gdt_code);
|
||||
descriptor->kernel_cs = Arch::GDT::gdt_code.selector();
|
||||
descriptor->ist = 1;
|
||||
descriptor->attributes = flags;
|
||||
descriptor->isr_mid = ((uint64_t) isr >> 16) & 0xFFFF;
|
||||
@@ -74,7 +74,7 @@ void idt_init() {
|
||||
barrier();
|
||||
__asm__ volatile("lidt %0"
|
||||
:
|
||||
: "m"(idtr));// load the new IDT
|
||||
: "m"(idtr)); // load the new IDT
|
||||
__asm__ volatile("sti"); // set the interrupt flag
|
||||
barrier();
|
||||
|
||||
@@ -91,28 +91,28 @@ void PIC_sendEOI(unsigned char irq) {
|
||||
void PIC_init() {
|
||||
unsigned char a1, a2;
|
||||
|
||||
a1 = inb(PIC1_DATA);// save masks
|
||||
a1 = inb(PIC1_DATA); // save masks
|
||||
a2 = inb(PIC2_DATA);
|
||||
|
||||
outb(PIC1_COMMAND, ICW1_INIT | ICW1_ICW4);// starts the initialization sequence (in cascade mode)
|
||||
outb(PIC1_COMMAND, ICW1_INIT | ICW1_ICW4); // starts the initialization sequence (in cascade mode)
|
||||
io_wait();
|
||||
outb(PIC2_COMMAND, ICW1_INIT | ICW1_ICW4);
|
||||
io_wait();
|
||||
outb(PIC1_DATA, PIC1_OFFSET);// ICW2: Master PIC vector offset
|
||||
outb(PIC1_DATA, PIC1_OFFSET); // ICW2: Master PIC vector offset
|
||||
io_wait();
|
||||
outb(PIC2_DATA, PIC2_OFFSET);// ICW2: Slave PIC vector offset
|
||||
outb(PIC2_DATA, PIC2_OFFSET); // ICW2: Slave PIC vector offset
|
||||
io_wait();
|
||||
outb(PIC1_DATA, 4);// ICW3: tell Master PIC that there is a slave PIC at IRQ2 (0000 0100)
|
||||
outb(PIC1_DATA, 4); // ICW3: tell Master PIC that there is a slave PIC at IRQ2 (0000 0100)
|
||||
io_wait();
|
||||
outb(PIC2_DATA, 2);// ICW3: tell Slave PIC its cascade identity (0000 0010)
|
||||
outb(PIC2_DATA, 2); // ICW3: tell Slave PIC its cascade identity (0000 0010)
|
||||
io_wait();
|
||||
|
||||
outb(PIC1_DATA, ICW4_8086);// ICW4: have the PICs use 8086 mode (and not 8080 mode)
|
||||
outb(PIC1_DATA, ICW4_8086); // ICW4: have the PICs use 8086 mode (and not 8080 mode)
|
||||
io_wait();
|
||||
outb(PIC2_DATA, ICW4_8086);
|
||||
io_wait();
|
||||
|
||||
outb(PIC1_DATA, a1);// restore saved masks.
|
||||
outb(PIC1_DATA, a1); // restore saved masks.
|
||||
outb(PIC2_DATA, a2);
|
||||
}
|
||||
void IRQ_set_mask(unsigned char IRQline) {
|
||||
|
||||
@@ -39,9 +39,9 @@ uint16_t pic_get_isr(void);
|
||||
|
||||
typedef struct {
|
||||
uint16_t isr_low; // The lower 16 bits of the ISR's address
|
||||
uint16_t kernel_cs;// The GDT segment selector that the CPU will load into CS before calling the ISR
|
||||
uint16_t kernel_cs; // The GDT segment selector that the CPU will load into CS before calling the ISR
|
||||
uint8_t ist; // The IST in the TSS that the CPU will load into RSP; set to zero for now
|
||||
uint8_t attributes;// Type and attributes; see the IDT page
|
||||
uint8_t attributes; // Type and attributes; see the IDT page
|
||||
uint16_t isr_mid; // The higher 16 bits of the lower 32 bits of the ISR's address
|
||||
uint32_t isr_high; // The higher 32 bits of the ISR's address
|
||||
uint32_t reserved; // Set to zero
|
||||
@@ -57,7 +57,7 @@ typedef struct {
|
||||
// Assuming the compiler understands that this is pushed on the stack in the correct order
|
||||
struct task_frame {
|
||||
uint64_t guard;
|
||||
uint64_t guard2;// To keep stack aligned after pushaq
|
||||
uint64_t guard2; // To keep stack aligned after pushaq
|
||||
|
||||
uint64_t r15;
|
||||
uint64_t r14;
|
||||
|
||||
@@ -27,4 +27,4 @@ static inline void io_wait(void) {
|
||||
outb(0x80, 0);
|
||||
}
|
||||
|
||||
#endif//OS1_IO_H
|
||||
#endif //OS1_IO_H
|
||||
|
||||
@@ -258,7 +258,7 @@ void kmain() {
|
||||
|
||||
init_timer();
|
||||
|
||||
srand(micros);// NOLINT
|
||||
srand(micros); // NOLINT
|
||||
|
||||
new_ktask(ktask_main, "ktask_main");
|
||||
new_ktask(dummy_task, "dummy");
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "string.h"
|
||||
|
||||
struct HeapEntry *KERN_HeapBegin;
|
||||
uintptr_t KERN_HeapEnd;// Past the end
|
||||
uintptr_t KERN_HeapEnd; // Past the end
|
||||
|
||||
static bool initialized = false;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ struct HeapEntry {
|
||||
} __attribute__((packed, aligned(32)));
|
||||
|
||||
extern struct HeapEntry *KERN_HeapBegin;
|
||||
extern uintptr_t KERN_HeapEnd;// Past the end
|
||||
extern uintptr_t KERN_HeapEnd; // Past the end
|
||||
|
||||
void *kmalloc(size_t n);
|
||||
void kfree(void *addr);
|
||||
|
||||
@@ -26,22 +26,22 @@ extern "C" {
|
||||
/* Misc */
|
||||
|
||||
#ifdef LIMINE_NO_POINTERS
|
||||
# define LIMINE_PTR(TYPE) uint64_t
|
||||
#define LIMINE_PTR(TYPE) uint64_t
|
||||
#else
|
||||
# define LIMINE_PTR(TYPE) TYPE
|
||||
#define LIMINE_PTR(TYPE) TYPE
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define LIMINE_DEPRECATED __attribute__((__deprecated__))
|
||||
# define LIMINE_DEPRECATED_IGNORE_START \
|
||||
#define LIMINE_DEPRECATED __attribute__((__deprecated__))
|
||||
#define LIMINE_DEPRECATED_IGNORE_START \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
# define LIMINE_DEPRECATED_IGNORE_END \
|
||||
#define LIMINE_DEPRECATED_IGNORE_END \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#else
|
||||
# define LIMINE_DEPRECATED
|
||||
# define LIMINE_DEPRECATED_IGNORE_START
|
||||
# define LIMINE_DEPRECATED_IGNORE_END
|
||||
#define LIMINE_DEPRECATED
|
||||
#define LIMINE_DEPRECATED_IGNORE_START
|
||||
#define LIMINE_DEPRECATED_IGNORE_END
|
||||
#endif
|
||||
|
||||
#define LIMINE_COMMON_MAGIC 0xc7b1dd30df4c8b88, 0x0a82e883a194f07b
|
||||
@@ -59,10 +59,13 @@ struct limine_uuid {
|
||||
|
||||
struct limine_file {
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(void *) address;
|
||||
LIMINE_PTR(void *)
|
||||
address;
|
||||
uint64_t size;
|
||||
LIMINE_PTR(char *) path;
|
||||
LIMINE_PTR(char *) cmdline;
|
||||
LIMINE_PTR(char *)
|
||||
path;
|
||||
LIMINE_PTR(char *)
|
||||
cmdline;
|
||||
uint32_t media_type;
|
||||
uint32_t unused;
|
||||
uint32_t tftp_ip;
|
||||
@@ -76,23 +79,28 @@ struct limine_file {
|
||||
|
||||
/* Boot info */
|
||||
|
||||
#define LIMINE_BOOTLOADER_INFO_REQUEST { LIMINE_COMMON_MAGIC, 0xf55038d8e2a1202f, 0x279426fcf5f59740 }
|
||||
#define LIMINE_BOOTLOADER_INFO_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0xf55038d8e2a1202f, 0x279426fcf5f59740 }
|
||||
|
||||
struct limine_bootloader_info_response {
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(char *) name;
|
||||
LIMINE_PTR(char *) version;
|
||||
LIMINE_PTR(char *)
|
||||
name;
|
||||
LIMINE_PTR(char *)
|
||||
version;
|
||||
};
|
||||
|
||||
struct limine_bootloader_info_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_bootloader_info_response *) response;
|
||||
LIMINE_PTR(struct limine_bootloader_info_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
/* Stack size */
|
||||
|
||||
#define LIMINE_STACK_SIZE_REQUEST { LIMINE_COMMON_MAGIC, 0x224ef0460a8e8926, 0xe1cb0fc25f46ea3d }
|
||||
#define LIMINE_STACK_SIZE_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x224ef0460a8e8926, 0xe1cb0fc25f46ea3d }
|
||||
|
||||
struct limine_stack_size_response {
|
||||
uint64_t revision;
|
||||
@@ -101,13 +109,15 @@ struct limine_stack_size_response {
|
||||
struct limine_stack_size_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_stack_size_response *) response;
|
||||
LIMINE_PTR(struct limine_stack_size_response *)
|
||||
response;
|
||||
uint64_t stack_size;
|
||||
};
|
||||
|
||||
/* HHDM */
|
||||
|
||||
#define LIMINE_HHDM_REQUEST { LIMINE_COMMON_MAGIC, 0x48dcf1cb8ad2b852, 0x63984e959a98244b }
|
||||
#define LIMINE_HHDM_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x48dcf1cb8ad2b852, 0x63984e959a98244b }
|
||||
|
||||
struct limine_hhdm_response {
|
||||
uint64_t revision;
|
||||
@@ -117,12 +127,14 @@ struct limine_hhdm_response {
|
||||
struct limine_hhdm_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_hhdm_response *) response;
|
||||
LIMINE_PTR(struct limine_hhdm_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
/* Framebuffer */
|
||||
|
||||
#define LIMINE_FRAMEBUFFER_REQUEST { LIMINE_COMMON_MAGIC, 0x9d5827dcd881dd75, 0xa3148604f6fab11b }
|
||||
#define LIMINE_FRAMEBUFFER_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x9d5827dcd881dd75, 0xa3148604f6fab11b }
|
||||
|
||||
#define LIMINE_FRAMEBUFFER_RGB 1
|
||||
|
||||
@@ -141,7 +153,8 @@ struct limine_video_mode {
|
||||
};
|
||||
|
||||
struct limine_framebuffer {
|
||||
LIMINE_PTR(void *) address;
|
||||
LIMINE_PTR(void *)
|
||||
address;
|
||||
uint64_t width;
|
||||
uint64_t height;
|
||||
uint64_t pitch;
|
||||
@@ -155,27 +168,32 @@ struct limine_framebuffer {
|
||||
uint8_t blue_mask_shift;
|
||||
uint8_t unused[7];
|
||||
uint64_t edid_size;
|
||||
LIMINE_PTR(void *) edid;
|
||||
LIMINE_PTR(void *)
|
||||
edid;
|
||||
/* Response revision 1 */
|
||||
uint64_t mode_count;
|
||||
LIMINE_PTR(struct limine_video_mode **) modes;
|
||||
LIMINE_PTR(struct limine_video_mode **)
|
||||
modes;
|
||||
};
|
||||
|
||||
struct limine_framebuffer_response {
|
||||
uint64_t revision;
|
||||
uint64_t framebuffer_count;
|
||||
LIMINE_PTR(struct limine_framebuffer **) framebuffers;
|
||||
LIMINE_PTR(struct limine_framebuffer **)
|
||||
framebuffers;
|
||||
};
|
||||
|
||||
struct limine_framebuffer_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_framebuffer_response *) response;
|
||||
LIMINE_PTR(struct limine_framebuffer_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
/* Terminal */
|
||||
|
||||
#define LIMINE_TERMINAL_REQUEST { LIMINE_COMMON_MAGIC, 0xc8ac59310c2b0844, 0xa68d0c7265d38878 }
|
||||
#define LIMINE_TERMINAL_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0xc8ac59310c2b0844, 0xa68d0c7265d38878 }
|
||||
|
||||
#define LIMINE_TERMINAL_CB_DEC 10
|
||||
#define LIMINE_TERMINAL_CB_BELL 20
|
||||
@@ -186,14 +204,14 @@ struct limine_framebuffer_request {
|
||||
#define LIMINE_TERMINAL_CB_MODE 70
|
||||
#define LIMINE_TERMINAL_CB_LINUX 80
|
||||
|
||||
#define LIMINE_TERMINAL_CTX_SIZE ((uint64_t)(-1))
|
||||
#define LIMINE_TERMINAL_CTX_SAVE ((uint64_t)(-2))
|
||||
#define LIMINE_TERMINAL_CTX_RESTORE ((uint64_t)(-3))
|
||||
#define LIMINE_TERMINAL_FULL_REFRESH ((uint64_t)(-4))
|
||||
#define LIMINE_TERMINAL_CTX_SIZE ((uint64_t) (-1))
|
||||
#define LIMINE_TERMINAL_CTX_SAVE ((uint64_t) (-2))
|
||||
#define LIMINE_TERMINAL_CTX_RESTORE ((uint64_t) (-3))
|
||||
#define LIMINE_TERMINAL_FULL_REFRESH ((uint64_t) (-4))
|
||||
|
||||
/* Response revision 1 */
|
||||
#define LIMINE_TERMINAL_OOB_OUTPUT_GET ((uint64_t)(-10))
|
||||
#define LIMINE_TERMINAL_OOB_OUTPUT_SET ((uint64_t)(-11))
|
||||
#define LIMINE_TERMINAL_OOB_OUTPUT_GET ((uint64_t) (-10))
|
||||
#define LIMINE_TERMINAL_OOB_OUTPUT_SET ((uint64_t) (-11))
|
||||
|
||||
#define LIMINE_TERMINAL_OOB_OUTPUT_OCRNL (1 << 0)
|
||||
#define LIMINE_TERMINAL_OOB_OUTPUT_OFDEL (1 << 1)
|
||||
@@ -214,40 +232,46 @@ typedef void (*limine_terminal_callback)(struct limine_terminal *, uint64_t, uin
|
||||
struct LIMINE_DEPRECATED limine_terminal {
|
||||
uint64_t columns;
|
||||
uint64_t rows;
|
||||
LIMINE_PTR(struct limine_framebuffer *) framebuffer;
|
||||
LIMINE_PTR(struct limine_framebuffer *)
|
||||
framebuffer;
|
||||
};
|
||||
|
||||
struct LIMINE_DEPRECATED limine_terminal_response {
|
||||
uint64_t revision;
|
||||
uint64_t terminal_count;
|
||||
LIMINE_PTR(struct limine_terminal **) terminals;
|
||||
LIMINE_PTR(limine_terminal_write) write;
|
||||
LIMINE_PTR(struct limine_terminal **)
|
||||
terminals;
|
||||
LIMINE_PTR(limine_terminal_write)
|
||||
write;
|
||||
};
|
||||
|
||||
struct LIMINE_DEPRECATED limine_terminal_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_terminal_response *) response;
|
||||
LIMINE_PTR(limine_terminal_callback) callback;
|
||||
LIMINE_PTR(struct limine_terminal_response *)
|
||||
response;
|
||||
LIMINE_PTR(limine_terminal_callback)
|
||||
callback;
|
||||
};
|
||||
|
||||
LIMINE_DEPRECATED_IGNORE_END
|
||||
|
||||
/* Paging mode */
|
||||
|
||||
#define LIMINE_PAGING_MODE_REQUEST { LIMINE_COMMON_MAGIC, 0x95c1a0edab0944cb, 0xa4e5cb3842f7488a }
|
||||
#define LIMINE_PAGING_MODE_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x95c1a0edab0944cb, 0xa4e5cb3842f7488a }
|
||||
|
||||
#if defined (__x86_64__) || defined (__i386__)
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#define LIMINE_PAGING_MODE_X86_64_4LVL 0
|
||||
#define LIMINE_PAGING_MODE_X86_64_5LVL 1
|
||||
#define LIMINE_PAGING_MODE_MAX LIMINE_PAGING_MODE_X86_64_5LVL
|
||||
#define LIMINE_PAGING_MODE_DEFAULT LIMINE_PAGING_MODE_X86_64_4LVL
|
||||
#elif defined (__aarch64__)
|
||||
#elif defined(__aarch64__)
|
||||
#define LIMINE_PAGING_MODE_AARCH64_4LVL 0
|
||||
#define LIMINE_PAGING_MODE_AARCH64_5LVL 1
|
||||
#define LIMINE_PAGING_MODE_MAX LIMINE_PAGING_MODE_AARCH64_5LVL
|
||||
#define LIMINE_PAGING_MODE_DEFAULT LIMINE_PAGING_MODE_AARCH64_4LVL
|
||||
#elif defined (__riscv) && (__riscv_xlen == 64)
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#define LIMINE_PAGING_MODE_RISCV_SV39 0
|
||||
#define LIMINE_PAGING_MODE_RISCV_SV48 1
|
||||
#define LIMINE_PAGING_MODE_RISCV_SV57 2
|
||||
@@ -266,14 +290,16 @@ struct limine_paging_mode_response {
|
||||
struct limine_paging_mode_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_paging_mode_response *) response;
|
||||
LIMINE_PTR(struct limine_paging_mode_response *)
|
||||
response;
|
||||
uint64_t mode;
|
||||
uint64_t flags;
|
||||
};
|
||||
|
||||
/* 5-level paging */
|
||||
|
||||
#define LIMINE_5_LEVEL_PAGING_REQUEST { LIMINE_COMMON_MAGIC, 0x94469551da9b3192, 0xebe5e86db7382888 }
|
||||
#define LIMINE_5_LEVEL_PAGING_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x94469551da9b3192, 0xebe5e86db7382888 }
|
||||
|
||||
LIMINE_DEPRECATED_IGNORE_START
|
||||
|
||||
@@ -284,20 +310,22 @@ struct LIMINE_DEPRECATED limine_5_level_paging_response {
|
||||
struct LIMINE_DEPRECATED limine_5_level_paging_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_5_level_paging_response *) response;
|
||||
LIMINE_PTR(struct limine_5_level_paging_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
LIMINE_DEPRECATED_IGNORE_END
|
||||
|
||||
/* SMP */
|
||||
|
||||
#define LIMINE_SMP_REQUEST { LIMINE_COMMON_MAGIC, 0x95a67b819a1b857e, 0xa0b61b723b6a73e0 }
|
||||
#define LIMINE_SMP_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x95a67b819a1b857e, 0xa0b61b723b6a73e0 }
|
||||
|
||||
struct limine_smp_info;
|
||||
|
||||
typedef void (*limine_goto_address)(struct limine_smp_info *);
|
||||
|
||||
#if defined (__x86_64__) || defined (__i386__)
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
|
||||
#define LIMINE_SMP_X2APIC (1 << 0)
|
||||
|
||||
@@ -305,7 +333,8 @@ struct limine_smp_info {
|
||||
uint32_t processor_id;
|
||||
uint32_t lapic_id;
|
||||
uint64_t reserved;
|
||||
LIMINE_PTR(limine_goto_address) goto_address;
|
||||
LIMINE_PTR(limine_goto_address)
|
||||
goto_address;
|
||||
uint64_t extra_argument;
|
||||
};
|
||||
|
||||
@@ -314,17 +343,19 @@ struct limine_smp_response {
|
||||
uint32_t flags;
|
||||
uint32_t bsp_lapic_id;
|
||||
uint64_t cpu_count;
|
||||
LIMINE_PTR(struct limine_smp_info **) cpus;
|
||||
LIMINE_PTR(struct limine_smp_info **)
|
||||
cpus;
|
||||
};
|
||||
|
||||
#elif defined (__aarch64__)
|
||||
#elif defined(__aarch64__)
|
||||
|
||||
struct limine_smp_info {
|
||||
uint32_t processor_id;
|
||||
uint32_t gic_iface_no;
|
||||
uint64_t mpidr;
|
||||
uint64_t reserved;
|
||||
LIMINE_PTR(limine_goto_address) goto_address;
|
||||
LIMINE_PTR(limine_goto_address)
|
||||
goto_address;
|
||||
uint64_t extra_argument;
|
||||
};
|
||||
|
||||
@@ -333,16 +364,18 @@ struct limine_smp_response {
|
||||
uint32_t flags;
|
||||
uint64_t bsp_mpidr;
|
||||
uint64_t cpu_count;
|
||||
LIMINE_PTR(struct limine_smp_info **) cpus;
|
||||
LIMINE_PTR(struct limine_smp_info **)
|
||||
cpus;
|
||||
};
|
||||
|
||||
#elif defined (__riscv) && (__riscv_xlen == 64)
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
|
||||
struct limine_smp_info {
|
||||
uint32_t processor_id;
|
||||
uint64_t hartid;
|
||||
uint64_t reserved;
|
||||
LIMINE_PTR(limine_goto_address) goto_address;
|
||||
LIMINE_PTR(limine_goto_address)
|
||||
goto_address;
|
||||
uint64_t extra_argument;
|
||||
};
|
||||
|
||||
@@ -351,7 +384,8 @@ struct limine_smp_response {
|
||||
uint32_t flags;
|
||||
uint64_t bsp_hartid;
|
||||
uint64_t cpu_count;
|
||||
LIMINE_PTR(struct limine_smp_info **) cpus;
|
||||
LIMINE_PTR(struct limine_smp_info **)
|
||||
cpus;
|
||||
};
|
||||
|
||||
#else
|
||||
@@ -361,13 +395,15 @@ struct limine_smp_response {
|
||||
struct limine_smp_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_smp_response *) response;
|
||||
LIMINE_PTR(struct limine_smp_response *)
|
||||
response;
|
||||
uint64_t flags;
|
||||
};
|
||||
|
||||
/* Memory map */
|
||||
|
||||
#define LIMINE_MEMMAP_REQUEST { LIMINE_COMMON_MAGIC, 0x67cf3d9d378a806f, 0xe304acdfc50c3c62 }
|
||||
#define LIMINE_MEMMAP_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x67cf3d9d378a806f, 0xe304acdfc50c3c62 }
|
||||
|
||||
#define LIMINE_MEMMAP_USABLE 0
|
||||
#define LIMINE_MEMMAP_RESERVED 1
|
||||
@@ -387,18 +423,21 @@ struct limine_memmap_entry {
|
||||
struct limine_memmap_response {
|
||||
uint64_t revision;
|
||||
uint64_t entry_count;
|
||||
LIMINE_PTR(struct limine_memmap_entry **) entries;
|
||||
LIMINE_PTR(struct limine_memmap_entry **)
|
||||
entries;
|
||||
};
|
||||
|
||||
struct limine_memmap_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_memmap_response *) response;
|
||||
LIMINE_PTR(struct limine_memmap_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
/* Entry point */
|
||||
|
||||
#define LIMINE_ENTRY_POINT_REQUEST { LIMINE_COMMON_MAGIC, 0x13d86c035a1cd3e1, 0x2b0caa89d8f3026a }
|
||||
#define LIMINE_ENTRY_POINT_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x13d86c035a1cd3e1, 0x2b0caa89d8f3026a }
|
||||
|
||||
typedef void (*limine_entry_point)(void);
|
||||
|
||||
@@ -409,102 +448,124 @@ struct limine_entry_point_response {
|
||||
struct limine_entry_point_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_entry_point_response *) response;
|
||||
LIMINE_PTR(limine_entry_point) entry;
|
||||
LIMINE_PTR(struct limine_entry_point_response *)
|
||||
response;
|
||||
LIMINE_PTR(limine_entry_point)
|
||||
entry;
|
||||
};
|
||||
|
||||
/* Kernel File */
|
||||
|
||||
#define LIMINE_KERNEL_FILE_REQUEST { LIMINE_COMMON_MAGIC, 0xad97e90e83f1ed67, 0x31eb5d1c5ff23b69 }
|
||||
#define LIMINE_KERNEL_FILE_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0xad97e90e83f1ed67, 0x31eb5d1c5ff23b69 }
|
||||
|
||||
struct limine_kernel_file_response {
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_file *) kernel_file;
|
||||
LIMINE_PTR(struct limine_file *)
|
||||
kernel_file;
|
||||
};
|
||||
|
||||
struct limine_kernel_file_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_kernel_file_response *) response;
|
||||
LIMINE_PTR(struct limine_kernel_file_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
/* Module */
|
||||
|
||||
#define LIMINE_MODULE_REQUEST { LIMINE_COMMON_MAGIC, 0x3e7e279702be32af, 0xca1c4f3bd1280cee }
|
||||
#define LIMINE_MODULE_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x3e7e279702be32af, 0xca1c4f3bd1280cee }
|
||||
|
||||
#define LIMINE_INTERNAL_MODULE_REQUIRED (1 << 0)
|
||||
|
||||
struct limine_internal_module {
|
||||
LIMINE_PTR(const char *) path;
|
||||
LIMINE_PTR(const char *) cmdline;
|
||||
LIMINE_PTR(const char *)
|
||||
path;
|
||||
LIMINE_PTR(const char *)
|
||||
cmdline;
|
||||
uint64_t flags;
|
||||
};
|
||||
|
||||
struct limine_module_response {
|
||||
uint64_t revision;
|
||||
uint64_t module_count;
|
||||
LIMINE_PTR(struct limine_file **) modules;
|
||||
LIMINE_PTR(struct limine_file **)
|
||||
modules;
|
||||
};
|
||||
|
||||
struct limine_module_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_module_response *) response;
|
||||
LIMINE_PTR(struct limine_module_response *)
|
||||
response;
|
||||
|
||||
/* Request revision 1 */
|
||||
uint64_t internal_module_count;
|
||||
LIMINE_PTR(struct limine_internal_module **) internal_modules;
|
||||
LIMINE_PTR(struct limine_internal_module **)
|
||||
internal_modules;
|
||||
};
|
||||
|
||||
/* RSDP */
|
||||
|
||||
#define LIMINE_RSDP_REQUEST { LIMINE_COMMON_MAGIC, 0xc5e77b6b397e7b43, 0x27637845accdcf3c }
|
||||
#define LIMINE_RSDP_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0xc5e77b6b397e7b43, 0x27637845accdcf3c }
|
||||
|
||||
struct limine_rsdp_response {
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(void *) address;
|
||||
LIMINE_PTR(void *)
|
||||
address;
|
||||
};
|
||||
|
||||
struct limine_rsdp_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_rsdp_response *) response;
|
||||
LIMINE_PTR(struct limine_rsdp_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
/* SMBIOS */
|
||||
|
||||
#define LIMINE_SMBIOS_REQUEST { LIMINE_COMMON_MAGIC, 0x9e9046f11e095391, 0xaa4a520fefbde5ee }
|
||||
#define LIMINE_SMBIOS_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x9e9046f11e095391, 0xaa4a520fefbde5ee }
|
||||
|
||||
struct limine_smbios_response {
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(void *) entry_32;
|
||||
LIMINE_PTR(void *) entry_64;
|
||||
LIMINE_PTR(void *)
|
||||
entry_32;
|
||||
LIMINE_PTR(void *)
|
||||
entry_64;
|
||||
};
|
||||
|
||||
struct limine_smbios_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_smbios_response *) response;
|
||||
LIMINE_PTR(struct limine_smbios_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
/* EFI system table */
|
||||
|
||||
#define LIMINE_EFI_SYSTEM_TABLE_REQUEST { LIMINE_COMMON_MAGIC, 0x5ceba5163eaaf6d6, 0x0a6981610cf65fcc }
|
||||
#define LIMINE_EFI_SYSTEM_TABLE_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x5ceba5163eaaf6d6, 0x0a6981610cf65fcc }
|
||||
|
||||
struct limine_efi_system_table_response {
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(void *) address;
|
||||
LIMINE_PTR(void *)
|
||||
address;
|
||||
};
|
||||
|
||||
struct limine_efi_system_table_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_efi_system_table_response *) response;
|
||||
LIMINE_PTR(struct limine_efi_system_table_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
/* Boot time */
|
||||
|
||||
#define LIMINE_BOOT_TIME_REQUEST { LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 }
|
||||
#define LIMINE_BOOT_TIME_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 }
|
||||
|
||||
struct limine_boot_time_response {
|
||||
uint64_t revision;
|
||||
@@ -514,12 +575,14 @@ struct limine_boot_time_response {
|
||||
struct limine_boot_time_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_boot_time_response *) response;
|
||||
LIMINE_PTR(struct limine_boot_time_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
/* Kernel address */
|
||||
|
||||
#define LIMINE_KERNEL_ADDRESS_REQUEST { LIMINE_COMMON_MAGIC, 0x71ba76863cc55f63, 0xb2644a48c516a487 }
|
||||
#define LIMINE_KERNEL_ADDRESS_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0x71ba76863cc55f63, 0xb2644a48c516a487 }
|
||||
|
||||
struct limine_kernel_address_response {
|
||||
uint64_t revision;
|
||||
@@ -530,22 +593,26 @@ struct limine_kernel_address_response {
|
||||
struct limine_kernel_address_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_kernel_address_response *) response;
|
||||
LIMINE_PTR(struct limine_kernel_address_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
/* Device Tree Blob */
|
||||
|
||||
#define LIMINE_DTB_REQUEST { LIMINE_COMMON_MAGIC, 0xb40ddb48fb54bac7, 0x545081493f81ffb7 }
|
||||
#define LIMINE_DTB_REQUEST \
|
||||
{ LIMINE_COMMON_MAGIC, 0xb40ddb48fb54bac7, 0x545081493f81ffb7 }
|
||||
|
||||
struct limine_dtb_response {
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(void *) dtb_ptr;
|
||||
LIMINE_PTR(void *)
|
||||
dtb_ptr;
|
||||
};
|
||||
|
||||
struct limine_dtb_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_dtb_response *) response;
|
||||
LIMINE_PTR(struct limine_dtb_response *)
|
||||
response;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -16,4 +16,4 @@ extern int framebuffer_count;
|
||||
extern struct limine_framebuffer framebuffers[10];
|
||||
|
||||
|
||||
#endif//OS1_LIMINE_FB_H
|
||||
#endif //OS1_LIMINE_FB_H
|
||||
|
||||
@@ -15,4 +15,4 @@ extern unsigned int limine_mm_overflow;
|
||||
|
||||
void limine_mm_save_response();
|
||||
|
||||
#endif//OS1_LIMINE_MM_H
|
||||
#endif //OS1_LIMINE_MM_H
|
||||
|
||||
@@ -18,4 +18,4 @@ extern limine_file saved_modules[max_saved_modules];
|
||||
extern char saved_modules_data[max_saved_modules][max_saved_module_file_size] __attribute__((aligned(4096)));
|
||||
extern char saved_modules_names[max_saved_modules][max_saved_module_name] __attribute__((aligned(4096)));
|
||||
|
||||
#endif//OS2_LIMINE_MODULES_HPP
|
||||
#endif //OS2_LIMINE_MODULES_HPP
|
||||
|
||||
@@ -13,16 +13,16 @@
|
||||
|
||||
|
||||
#define MAXGB 32ULL
|
||||
#define BITMAP_SIZE (((MAXGB) *1024ULL * 1024ULL) / (16ULL))
|
||||
#define MAX_PID (((BITMAP_SIZE) *4) - 4)
|
||||
#define BITMAP_SIZE (((MAXGB) * 1024ULL * 1024ULL) / (16ULL))
|
||||
#define MAX_PID (((BITMAP_SIZE) * 4) - 4)
|
||||
// Expected to be nulled by the bootloader
|
||||
static struct FourPages used_bitmap[BITMAP_SIZE];
|
||||
|
||||
static Mutex memman_lock;
|
||||
|
||||
static uint64_t maxPid = 0;// Past the end
|
||||
static uint64_t maxPid = 0; // Past the end
|
||||
static uint64_t minPid = 0;
|
||||
static uint64_t totalMem = 0;// Past the end
|
||||
static uint64_t totalMem = 0; // Past the end
|
||||
|
||||
static uint64_t roundup4k(uint64_t addr) {
|
||||
if ((addr & 0xFFF) == 0) return addr;
|
||||
|
||||
@@ -26,4 +26,4 @@ void *get4k();
|
||||
void free4k(void *page);
|
||||
uint64_t get_free();
|
||||
|
||||
#endif//OS1_MEMMAN_H
|
||||
#endif //OS1_MEMMAN_H
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#define KERN_P2V(a) ((((uintptr_t) (a) -kernel_phys_base) | kernel_virt_base))
|
||||
|
||||
#define HHDM_BEGIN 0xfffff80000000000ULL
|
||||
#define HHDM_SIZE 32ULL// In GB
|
||||
#define HHDM_SIZE 32ULL // In GB
|
||||
#define HHDM_V2P(a) ((((uintptr_t) (a)) & ~HHDM_BEGIN))
|
||||
#define HHDM_P2V(a) ((((uintptr_t) (a)) | HHDM_BEGIN))
|
||||
|
||||
@@ -64,4 +64,4 @@ void map_hddm(uint64_t *pml4);
|
||||
|
||||
extern "C" void _tlb_flush();
|
||||
|
||||
#endif//OS1_PAGING_H
|
||||
#endif //OS1_PAGING_H
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
#include "io.hpp"
|
||||
#include "task.hpp"
|
||||
|
||||
#define PORT 0x3f8// COM1
|
||||
#define PORT 0x3f8 // COM1
|
||||
|
||||
int init_serial() {
|
||||
outb(PORT + 1, 0x00);// Disable all interrupts
|
||||
outb(PORT + 3, 0x80);// Enable DLAB (set baud rate divisor)
|
||||
outb(PORT + 0, 0x03);// Set divisor to 3 (lo byte) 38400 baud
|
||||
outb(PORT + 1, 0x00);// (hi byte)
|
||||
outb(PORT + 3, 0x03);// 8 bits, no parity, one stop bit
|
||||
outb(PORT + 2, 0xC7);// Enable FIFO, clear them, with 14-byte threshold
|
||||
outb(PORT + 4, 0x0B);// IRQs enabled, RTS/DSR set
|
||||
outb(PORT + 4, 0x1E);// Set in loopback mode, test the serial chip
|
||||
outb(PORT + 0, 0xAE);// Test serial chip (send byte 0xAE and check if serial returns same byte)
|
||||
outb(PORT + 1, 0x00); // Disable all interrupts
|
||||
outb(PORT + 3, 0x80); // Enable DLAB (set baud rate divisor)
|
||||
outb(PORT + 0, 0x03); // Set divisor to 3 (lo byte) 38400 baud
|
||||
outb(PORT + 1, 0x00); // (hi byte)
|
||||
outb(PORT + 3, 0x03); // 8 bits, no parity, one stop bit
|
||||
outb(PORT + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold
|
||||
outb(PORT + 4, 0x0B); // IRQs enabled, RTS/DSR set
|
||||
outb(PORT + 4, 0x1E); // Set in loopback mode, test the serial chip
|
||||
outb(PORT + 0, 0xAE); // Test serial chip (send byte 0xAE and check if serial returns same byte)
|
||||
|
||||
// Check if serial is faulty (i.e: not same byte as sent)
|
||||
if (inb(PORT + 0) != 0xAE) {
|
||||
|
||||
@@ -18,4 +18,4 @@ void writestr(const char *a);
|
||||
void write_serial_no_yield(char a);
|
||||
void writestr_no_yield(const char *a);
|
||||
|
||||
#endif//OS1_SERIAL_H
|
||||
#endif //OS1_SERIAL_H
|
||||
|
||||
@@ -33,17 +33,17 @@ void setup_syscalls() {
|
||||
uint64_t bytes;
|
||||
} __attribute__((__packed__)) newstar{};
|
||||
|
||||
newstar.star.ret_cs_ss = (GDTSEL(gdt_data_user) - 8) | 0x3;
|
||||
assert(newstar.star.ret_cs_ss + 8 == (GDTSEL(gdt_data_user) | 0x3));
|
||||
assert(newstar.star.ret_cs_ss + 16 == (GDTSEL(gdt_code_user) | 0x3));
|
||||
newstar.star.ret_cs_ss = (Arch::GDT::gdt_data_user.selector() - 8) | 0x3;
|
||||
assert(newstar.star.ret_cs_ss + 8 == (Arch::GDT::gdt_data_user.selector() | 0x3));
|
||||
assert(newstar.star.ret_cs_ss + 16 == (Arch::GDT::gdt_code_user.selector() | 0x3));
|
||||
|
||||
newstar.star.call_cs_ss = (GDTSEL(gdt_code));
|
||||
assert(newstar.star.call_cs_ss == GDTSEL(gdt_code));
|
||||
assert(newstar.star.call_cs_ss + 8 == GDTSEL(gdt_data));
|
||||
newstar.star.call_cs_ss = (Arch::GDT::gdt_code.selector());
|
||||
assert(newstar.star.call_cs_ss == Arch::GDT::gdt_code.selector());
|
||||
assert(newstar.star.call_cs_ss + 8 == Arch::GDT::gdt_data.selector());
|
||||
|
||||
wrmsr(0xc0000081, newstar.bytes);
|
||||
wrmsr(0xc0000082, reinterpret_cast<uint64_t>(&_syscall_entrypoint));
|
||||
wrmsr(0xc0000084, (1 << 9));// IA32_FMASK, mask interrupts
|
||||
wrmsr(0xc0000084, (1 << 9)); // IA32_FMASK, mask interrupts
|
||||
|
||||
wrmsr(0xC0000080, rdmsr(0xC0000080) | 0b1);
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ void setup_syscalls();
|
||||
extern "C" void _syscall_entrypoint();
|
||||
extern "C" uint64_t syscall_impl(uint64_t id_rdi, uint64_t a1_rsi, uint64_t a2_rdx, uint64_t a3_rcx);
|
||||
|
||||
#endif//OS2_SYSCALLS_HPP
|
||||
#endif //OS2_SYSCALLS_HPP
|
||||
|
||||
@@ -30,8 +30,8 @@ void sanity_check_frame(struct task_frame *cur_frame) {
|
||||
assert(cur_frame->ss != 0);
|
||||
assert(cur_frame->cs != 0);
|
||||
assert(cur_frame->sp != 0);
|
||||
assert2((cur_frame->ss == GDTSEL(gdt_data) || (cur_frame->ss == GDTSEL(gdt_data_user)) | 0x3), "SS wrong!");
|
||||
assert2((cur_frame->cs == GDTSEL(gdt_code) || (cur_frame->ss == GDTSEL(gdt_code_user)) | 0x3), "CS wrong!");
|
||||
assert2((cur_frame->ss == Arch::GDT::gdt_data.selector() || (cur_frame->ss == Arch::GDT::gdt_data_user.selector()) | 0x3), "SS wrong!");
|
||||
assert2((cur_frame->cs == Arch::GDT::gdt_code.selector() || (cur_frame->ss == Arch::GDT::gdt_code_user.selector()) | 0x3), "CS wrong!");
|
||||
}
|
||||
|
||||
std::atomic<uint64_t> max_pid = 0;
|
||||
@@ -115,13 +115,13 @@ struct Task *new_ktask(void (*fn)(), const char *name, bool start) {
|
||||
newt->fxsave = static_cast<char *>(kmalloc(512));
|
||||
strcpy(name, newt->name);
|
||||
|
||||
newt->frame.sp = ((((uintptr_t) newt->kstack) + (TASK_SS - 9) - 1) & (~0xFULL)) + 8;// Ensure 16byte alignment
|
||||
newt->frame.sp = ((((uintptr_t) newt->kstack) + (TASK_SS - 9) - 1) & (~0xFULL)) + 8; // Ensure 16byte alignment
|
||||
// It should be aligned before call, therefore on function entry it should be misaligned by 8 bytes
|
||||
assert((newt->frame.sp & 0xFULL) == 8);
|
||||
|
||||
newt->frame.ip = (uint64_t) fn;
|
||||
newt->frame.cs = GDTSEL(gdt_code);
|
||||
newt->frame.ss = GDTSEL(gdt_data);
|
||||
newt->frame.cs = Arch::GDT::gdt_code.selector();
|
||||
newt->frame.ss = Arch::GDT::gdt_data.selector();
|
||||
|
||||
for (int i = 0; i < 512; i++) newt->fxsave[i] = 0;
|
||||
|
||||
@@ -157,8 +157,8 @@ struct Task *new_utask(void (*entrypoint)(), const char *name) {
|
||||
strcpy(name, newt->name);
|
||||
|
||||
newt->frame.ip = (uint64_t) entrypoint;
|
||||
newt->frame.cs = GDTSEL(gdt_code_user) | 0x3;
|
||||
newt->frame.ss = GDTSEL(gdt_data_user) | 0x3;
|
||||
newt->frame.cs = Arch::GDT::gdt_code_user.selector() | 0x3;
|
||||
newt->frame.ss = Arch::GDT::gdt_data_user.selector() | 0x3;
|
||||
|
||||
for (int i = 0; i < 512; i++) newt->fxsave[i] = 0;
|
||||
|
||||
@@ -173,12 +173,12 @@ struct Task *new_utask(void (*entrypoint)(), const char *name) {
|
||||
|
||||
task_pointer *taskptr = static_cast<task_pointer *>(
|
||||
newt->vma->mmap_mem(reinterpret_cast<void *>(TASK_POINTER),
|
||||
sizeof(task_pointer), 0, PAGE_RW | PAGE_USER));// FIXME: this is probably unsafe
|
||||
sizeof(task_pointer), 0, PAGE_RW | PAGE_USER)); // FIXME: this is probably unsafe
|
||||
assert((uintptr_t) taskptr == TASK_POINTER);
|
||||
|
||||
task_pointer *taskptr_real = reinterpret_cast<task_pointer *>(HHDM_P2V(newt->addressSpace->virt2real(taskptr)));
|
||||
|
||||
newt->entry_ksp_val = ((((uintptr_t) newt->kstack) + (TASK_SS - 9) - 1) & (~0xFULL));// Ensure 16byte alignment
|
||||
newt->entry_ksp_val = ((((uintptr_t) newt->kstack) + (TASK_SS - 9) - 1) & (~0xFULL)); // Ensure 16byte alignment
|
||||
// It should be aligned before call, therefore it actually should be aligned here
|
||||
assert((newt->entry_ksp_val & 0xFULL) == 0);
|
||||
|
||||
@@ -188,7 +188,7 @@ struct Task *new_utask(void (*entrypoint)(), const char *name) {
|
||||
|
||||
void *ustack = newt->vma->mmap_mem(NULL, TASK_SS, 0, PAGE_RW | PAGE_USER);
|
||||
|
||||
newt->frame.sp = ((((uintptr_t) ustack) + (TASK_SS - 17) - 1) & (~0xFULL)) + 8;// Ensure 16byte alignment
|
||||
newt->frame.sp = ((((uintptr_t) ustack) + (TASK_SS - 17) - 1) & (~0xFULL)) + 8; // Ensure 16byte alignment
|
||||
// It should be aligned before call, therefore on function entry it should be misaligned by 8 bytes
|
||||
assert((newt->frame.sp & 0xFULL) == 8);
|
||||
|
||||
|
||||
@@ -75,6 +75,6 @@ SkipList<uint64_t, std::pair<String, TaskPID>> getTaskTimePerPid();
|
||||
|
||||
void yield_self();
|
||||
|
||||
extern "C" void _yield_self_kern();// Expects the caller to save interrupt state
|
||||
extern "C" void _yield_self_kern(); // Expects the caller to save interrupt state
|
||||
|
||||
#endif//OS1_TASK_H
|
||||
#endif //OS1_TASK_H
|
||||
|
||||
@@ -20,7 +20,7 @@ unsigned read_pit_count(void) {
|
||||
outb(0x43, 0b0000000);
|
||||
|
||||
count = inb(0x40); // Low byte
|
||||
count |= inb(0x40) << 8;// High byte
|
||||
count |= inb(0x40) << 8; // High byte
|
||||
|
||||
return count;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ void set_pit_count(unsigned count) {
|
||||
|
||||
// Set low byte
|
||||
outb(0x40, count & 0xFF); // Low byte
|
||||
outb(0x40, (count & 0xFF00) >> 8);// High byte
|
||||
outb(0x40, (count & 0xFF00) >> 8); // High byte
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,4 +14,4 @@ extern volatile std::atomic<uint64_t> micros;
|
||||
void init_timer();
|
||||
void timer_tick();
|
||||
|
||||
#endif//OS1_TIMER_H
|
||||
#endif //OS1_TIMER_H
|
||||
|
||||
@@ -12,8 +12,8 @@ class BytesFormatter {
|
||||
public:
|
||||
/// Structure for returning the processed byte value
|
||||
struct BytesFormat {
|
||||
String number;///< Number part of the value
|
||||
String prefix;///< Unit of measure
|
||||
String number; ///< Number part of the value
|
||||
String prefix; ///< Unit of measure
|
||||
};
|
||||
|
||||
/// Formats the bytes in BytesFormat format
|
||||
@@ -28,4 +28,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_BYTESFORMATTER_HPP
|
||||
#endif //OS2_BYTESFORMATTER_HPP
|
||||
|
||||
@@ -49,4 +49,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_LOCKGUARD_H
|
||||
#endif //OS2_LOCKGUARD_H
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
void spinlock() {
|
||||
assert2(!are_interrupts_enabled(), "Assuming all spinlocks are without interrupts");
|
||||
while (!try_lock()) { yield_self(); }// FIXME: Should be pause!
|
||||
while (!try_lock()) { yield_self(); } // FIXME: Should be pause!
|
||||
}
|
||||
|
||||
void unlock() {
|
||||
@@ -84,4 +84,4 @@ private:
|
||||
unsigned long f;
|
||||
};
|
||||
|
||||
#endif//OS2_SPINLOCK_H
|
||||
#endif //OS2_SPINLOCK_H
|
||||
|
||||
@@ -15,4 +15,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_TTY_HPP
|
||||
#endif //OS2_TTY_HPP
|
||||
|
||||
@@ -25,4 +25,4 @@ public:
|
||||
|
||||
extern TtyManager GlobalTtyManager;
|
||||
|
||||
#endif//OS1_TTY_H
|
||||
#endif //OS1_TTY_H
|
||||
|
||||
@@ -41,4 +41,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_VMA_HPP
|
||||
#endif //OS2_VMA_HPP
|
||||
|
||||
@@ -21,4 +21,4 @@ static inline void _assert2(int val, const char *msg) {
|
||||
#define assert(x) _assert2(x, "Assertion failed")
|
||||
|
||||
|
||||
#endif//OS2_ASSERTS_HPP
|
||||
#endif //OS2_ASSERTS_HPP
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace __cxxabiv1 {
|
||||
extern "C" void __cxa_guard_abort(__guard *) {
|
||||
_hcf();
|
||||
}
|
||||
}// namespace __cxxabiv1
|
||||
} // namespace __cxxabiv1
|
||||
|
||||
void *operator new(size_t size) {
|
||||
return kmalloc(size);
|
||||
|
||||
@@ -55,4 +55,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_CV_HPP
|
||||
#endif //OS2_CV_HPP
|
||||
|
||||
@@ -37,4 +37,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS1_MUTEX_H
|
||||
#endif //OS1_MUTEX_H
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
// The following functions define a portable implementation of rand and srand.
|
||||
|
||||
static std::atomic<unsigned long int> next = 1;// NB: "unsigned long int" is assumed to be 32 bits wide
|
||||
static std::atomic<unsigned long int> next = 1; // NB: "unsigned long int" is assumed to be 32 bits wide
|
||||
|
||||
extern "C" int rand(void)// RAND_MAX assumed to be 32767
|
||||
extern "C" int rand(void) // RAND_MAX assumed to be 32767
|
||||
{
|
||||
next = next * 1103515245 + 12345;
|
||||
return (unsigned int) (next / 65536ULL) % 32768;
|
||||
|
||||
@@ -18,4 +18,4 @@ void srand(unsigned int seed);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//OS2_RAND_H
|
||||
#endif //OS2_RAND_H
|
||||
|
||||
@@ -106,4 +106,4 @@ inline void strcpy(const char *src, char *dst) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//OS2_STRING_H
|
||||
#endif //OS2_STRING_H
|
||||
|
||||
@@ -62,4 +62,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif//OS2_CIRCULARBUFFER_HPP
|
||||
#endif //OS2_CIRCULARBUFFER_HPP
|
||||
|
||||
@@ -133,4 +133,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_LIST_HPP
|
||||
#endif //OS2_LIST_HPP
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
static int randomL() {
|
||||
int ret = __builtin_ffs(rand());
|
||||
assert(ret >= 0);
|
||||
return ret;// NOLINT
|
||||
return ret; // NOLINT
|
||||
}
|
||||
|
||||
// static inline NodeAllocator nodeAllocator;
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
static int randomL() {
|
||||
int ret = __builtin_ffs(rand());
|
||||
assert(ret >= 0);
|
||||
return ret;// NOLINT
|
||||
return ret; // NOLINT
|
||||
}
|
||||
|
||||
NodeAllocator nodeAllocator;
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
|
||||
int test_templates();
|
||||
|
||||
#endif//OS2_TESTTEMPLATES_HPP
|
||||
#endif //OS2_TESTTEMPLATES_HPP
|
||||
|
||||
@@ -41,4 +41,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_FDT_HPP
|
||||
#endif //OS2_FDT_HPP
|
||||
|
||||
@@ -34,4 +34,4 @@ private:
|
||||
FileOpts _opts;
|
||||
};
|
||||
|
||||
#endif//OS2_FILE_HPP
|
||||
#endif //OS2_FILE_HPP
|
||||
|
||||
@@ -18,4 +18,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_FILESYSTEM_HPP
|
||||
#endif //OS2_FILESYSTEM_HPP
|
||||
|
||||
@@ -44,4 +44,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_MEMFS_HPP
|
||||
#endif //OS2_MEMFS_HPP
|
||||
|
||||
@@ -20,4 +20,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_MOUNTTABLE_HPP
|
||||
#endif //OS2_MOUNTTABLE_HPP
|
||||
|
||||
@@ -66,4 +66,4 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_NODE_HPP
|
||||
#endif //OS2_NODE_HPP
|
||||
|
||||
@@ -13,4 +13,4 @@ using Path = Vector<String>;
|
||||
|
||||
Path StrToPath(const String &str);
|
||||
|
||||
#endif//OS2_PATH_HPP
|
||||
#endif //OS2_PATH_HPP
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace VFSApi {
|
||||
File *get(FDT::FD fd);
|
||||
void close(FDT::FD fd);
|
||||
|
||||
};// namespace VFSApi
|
||||
}; // namespace VFSApi
|
||||
|
||||
|
||||
#endif//OS2_VFSAPI_HPP
|
||||
#endif //OS2_VFSAPI_HPP
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
namespace VFSGlobals {
|
||||
extern RootNode root;
|
||||
extern MountTable mounts;
|
||||
};// namespace VFSGlobals
|
||||
}; // namespace VFSGlobals
|
||||
|
||||
|
||||
#endif//OS2_VFSGLOBALS_HPP
|
||||
#endif //OS2_VFSGLOBALS_HPP
|
||||
|
||||
@@ -12,4 +12,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif//OS2_VFSTESTER_HPP
|
||||
#endif //OS2_VFSTESTER_HPP
|
||||
|
||||
@@ -13,10 +13,10 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
enum FileOpts : uint8_t {
|
||||
O_RDONLY = 1 << 1,// Read
|
||||
O_WRONLY = 1 << 2,// Write
|
||||
O_RDONLY = 1 << 1, // Read
|
||||
O_WRONLY = 1 << 2, // Write
|
||||
O_RDWR = O_RDONLY | O_WRONLY,
|
||||
O_CREAT = 1 << 3,// Create
|
||||
O_CREAT = 1 << 3, // Create
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -24,4 +24,4 @@ enum FileOpts : uint8_t {
|
||||
#endif
|
||||
|
||||
|
||||
#endif//OS2_FILEOPTS_HPP
|
||||
#endif //OS2_FILEOPTS_HPP
|
||||
|
||||
@@ -23,4 +23,4 @@ struct dirent {
|
||||
#endif
|
||||
|
||||
|
||||
#endif//OS2_DIRENT_H
|
||||
#endif //OS2_DIRENT_H
|
||||
|
||||
@@ -35,4 +35,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//OS2_SYSCALLS_DEFS_H
|
||||
#endif //OS2_SYSCALLS_DEFS_H
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
uint64_t do_syscall(uint64_t id_rdi, uint64_t a1_rsi, uint64_t a2_rdx, uint64_t a3_rcx) {
|
||||
uint64_t res;
|
||||
asm volatile("syscall; mov (0x10016), %%rsp"// TASK_POINTER->ret_sp_val
|
||||
asm volatile("syscall; mov (0x10016), %%rsp" // TASK_POINTER->ret_sp_val
|
||||
: "=r"(res)
|
||||
: "D"(id_rdi), "S"(a1_rsi), "d"(a2_rdx), "a"(a3_rcx)
|
||||
: "cc", "rcx", "r8",
|
||||
|
||||
@@ -31,4 +31,4 @@ uint64_t lseek(uint64_t fd, uint64_t off, uint64_t whence);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//OS2_SYSCALLS_INTERFACE_H
|
||||
#endif //OS2_SYSCALLS_INTERFACE_H
|
||||
|
||||
Reference in New Issue
Block a user