diff --git a/Makefile b/Makefile index e19af2f..2326a72 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ debug: os.iso kernel/kernel.elf @$(GDB) #gdbgui -g i386-elf-gdb --project $(CWD) -os.iso: kernel/kernel.elf init # vfs devfs initrd vga_drv initrd_drv pci +os.iso: kernel/kernel.elf init sysroot/usr/share/man # vfs devfs initrd vga_drv initrd_drv pci @cp kernel/kernel.elf sysroot/boot @cd initrd; tar -f ../sysroot/boot/initrd.tar -c * @grub-mkrescue -o $@ sysroot >/dev/null 2>/dev/null @@ -71,6 +71,9 @@ libc: sysroot/usr/lib/libc.a sysroot/usr/lib/libc.a: $(LIBC_OBJ) @$(AR) rcs $@ $^ +sysroot/usr/share/man: doc + cp -r kernel/docs/man/man9 sysroot/usr/share/man + kernel/cpu/arch_consts.h: kernel/cpu/$(PLAT)/arch_consts.h @cp kernel/cpu/$(PLAT)/arch_consts.h kernel/cpu/arch_consts.h kernel/cpu/isr.h: kernel/cpu/$(PLAT)/isr.h diff --git a/sysroot/usr/share/man/man9/Process.9 b/sysroot/usr/share/man/man9/Process.9 new file mode 100644 index 0000000..5deeab1 --- /dev/null +++ b/sysroot/usr/share/man/man9/Process.9 @@ -0,0 +1,45 @@ +.TH "Process" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +Process +.SH SYNOPSIS +.br +.PP +.PP +\fC#include \fP +.SS "Data Fields" + +.in +1c +.ti -1c +.RI "char \fBpriv\fP" +.br +.RI "Whether the process is privileged (can execute syscalls to acesss all of memory/has acess to IO ports)\&. " +.ti -1c +.RI "pid_t \fBpid\fP" +.br +.RI "The PID of this process\&. " +.ti -1c +.RI "pid_t \fBnext_tid\fP" +.br +.RI "The TID that the next created thread will use\&. " +.ti -1c +.RI "int \fBnumThreads\fP" +.br +.RI "The number of threads in this process\&. " +.ti -1c +.RI "int \fBnumThreadsBlocked\fP" +.br +.RI "The number of blocked threads in this process\&. " +.ti -1c +.RI "struct \fBThread\fP * \fBfirstThread\fP" +.br +.RI "A pointer to the head of the linked list of threads for this process\&. " +.in -1c +.SH "Detailed Description" +.PP +Represents a process + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/RPCFuncInfo.9 b/sysroot/usr/share/man/man9/RPCFuncInfo.9 new file mode 100644 index 0000000..5f5c2fc --- /dev/null +++ b/sysroot/usr/share/man/man9/RPCFuncInfo.9 @@ -0,0 +1,29 @@ +.TH "RPCFuncInfo" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +RPCFuncInfo +.SH SYNOPSIS +.br +.PP +.PP +\fC#include \fP +.SS "Data Fields" + +.in +1c +.ti -1c +.RI "char \fBname\fP [32]" +.br +.RI "THe name of the function\&. " +.ti -1c +.RI "void *(* \fBcode\fP )(void *)" +.br +.RI "A pointer to the code that implements the funtcion\&. " +.in -1c +.SH "Detailed Description" +.PP +Represents an RPC fumctiom + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/Thread.9 b/sysroot/usr/share/man/man9/Thread.9 new file mode 100644 index 0000000..5551dba --- /dev/null +++ b/sysroot/usr/share/man/man9/Thread.9 @@ -0,0 +1,65 @@ +.TH "Thread" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +Thread +.SH SYNOPSIS +.br +.PP +.PP +\fC#include \fP +.SS "Data Fields" + +.in +1c +.ti -1c +.RI "void * \fBkernel_esp\fP" +.br +.RI "The thread's kernel stack\&. " +.ti -1c +.RI "void * \fBkernel_esp_top\fP" +.br +.RI "The top of the thread's kernel stack\&. " +.ti -1c +.RI "void * \fBcr3\fP" +.br +.RI "The address space of this thread\&. (it is in here and not in the process to simplify the task switch asembly) " +.ti -1c +.RI "pid_t \fBtid\fP" +.br +.RI "The TID of this thread\&. " +.ti -1c +.RI "\fBthread_state\fP \fBstate\fP" +.br +.RI "The state of this thread\&. (running,ready to run,blocked,etc\&.) " +.ti -1c +.RI "int \fBerrno\fP" +.br +.RI "The errno value for this thread\&. " +.ti -1c +.RI "struct \fBThread\fP * \fBnextThreadInProcess\fP" +.br +.RI "The next thread in the process\&. " +.ti -1c +.RI "struct \fBThread\fP * \fBprevThreadInProcess\fP" +.br +.RI "The previous thread in the process\&. " +.ti -1c +.RI "struct \fBThread\fP * \fBnextReadyToRun\fP" +.br +.RI "If the thread is in the ready to run list, this is the next ready to run thread\&. (potentially in a different process) " +.ti -1c +.RI "struct \fBThread\fP * \fBprevReadyToRun\fP" +.br +.RI "If the thread is in the ready to run list, this is the previous ready to run thread\&. (potentially in a different process) " +.ti -1c +.RI "\fBProcess\fP * \fBprocess\fP" +.br +.RI "The thread's process\&. " +.in -1c +.SH "Detailed Description" +.PP +Represents a thread of a process + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/address_spaces.h.9 b/sysroot/usr/share/man/man9/address_spaces.h.9 new file mode 100644 index 0000000..3fc645b --- /dev/null +++ b/sysroot/usr/share/man/man9/address_spaces.h.9 @@ -0,0 +1,56 @@ +.TH "kernel/address_spaces.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/address_spaces.h +.SH SYNOPSIS +.br +.PP +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBaddress_spaces_copy_data\fP (void *cr3, void *\fBdata\fP, uint32_t size, void *virt_addr)" +.br +.ti -1c +.RI "void * \fBaddress_spaces_put_data\fP (void *cr3, void *\fBdata\fP, uint32_t size)" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void address_spaces_copy_data (void * cr3, void * data, uint32_t size, void * virt_addr)" +Copy data into an address space at a specified virtual address +.PP +\fBParameters\fP +.RS 4 +\fIcr3\fP The adress space to copy data to\&. +.br +\fIdata\fP The data to copy +.br +\fIsize\fP The size of the data +.br +\fIvirt_addr\fP The address to copy the data to in the address space +.RE +.PP + +.SS "void* address_spaces_put_data (void * cr3, void * data, uint32_t size)" +Put data into an address space at an unknown virtual address +.PP +\fBParameters\fP +.RS 4 +\fIcr3\fP The adress space to copy data to\&. +.br +\fIdata\fP The data to copy +.br +\fIsize\fP The size of the data +.RE +.PP +\fBReturns\fP +.RS 4 +The address that the data was copied to\&. +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/cpu_init.c.9 b/sysroot/usr/share/man/man9/cpu_init.c.9 new file mode 100644 index 0000000..2673931 --- /dev/null +++ b/sysroot/usr/share/man/man9/cpu_init.c.9 @@ -0,0 +1,25 @@ +.TH "kernel/cpu/i386/cpu_init.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/i386/cpu_init.c +.SH SYNOPSIS +.br +.PP +\fC#include 'gdt\&.h'\fP +.br + +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBcpu_init\fP ()" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void cpu_init ()" +Initialize any architecture-specific CPU things\&. +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/cpu_init.h.9 b/sysroot/usr/share/man/man9/cpu_init.h.9 new file mode 100644 index 0000000..cb52669 --- /dev/null +++ b/sysroot/usr/share/man/man9/cpu_init.h.9 @@ -0,0 +1,22 @@ +.TH "kernel/cpu/cpu_init.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/cpu_init.h +.SH SYNOPSIS +.br +.PP +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBcpu_init\fP ()" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void cpu_init ()" +Initialize any architecture-specific CPU things\&. +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/gdt.c.9 b/sysroot/usr/share/man/man9/gdt.c.9 new file mode 100644 index 0000000..fbb8907 --- /dev/null +++ b/sysroot/usr/share/man/man9/gdt.c.9 @@ -0,0 +1,112 @@ +.TH "kernel/cpu/i386/gdt.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/i386/gdt.c +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br +\fC#include \fP +.br + +.SS "Data Structures" + +.in +1c +.ti -1c +.RI "struct \fBgdt_entry\fP" +.br +.ti -1c +.RI "struct \fBgdt_description\fP" +.br +.ti -1c +.RI "struct \fBtss_entry\fP" +.br +.in -1c +.SS "Macros" + +.in +1c +.ti -1c +.RI "#define \fBNUM_ENTRIES\fP 6" +.br +.RI "Number of entries in the GDT\&. " +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "static void \fBset_entry\fP (int i, uint32_t base, uint32_t limit, uint8_t access)" +.br +.ti -1c +.RI "static void \fBwrite_tss\fP (int32_t num, uint16_t ss0, uint32_t esp0)" +.br +.ti -1c +.RI "void \fBallow_all_ports\fP ()" +.br +.ti -1c +.RI "void \fBblock_all_ports\fP ()" +.br +.ti -1c +.RI "void \fBgdt_init\fP ()" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "uint32_t \fBint_stack_top\fP" +.br +.RI "Initial kernel stack before the kernel's first yield\&. " +.ti -1c +.RI "static \fBgdt_entry\fP \fBgdt\fP [\fBNUM_ENTRIES\fP]" +.br +.RI "The GDT\&. " +.ti -1c +.RI "static \fBgdt_description\fP \fBgdt_desc\fP" +.br +.RI "The value to load into the GDTR\&. " +.ti -1c +.RI "\fBtss_entry\fP \fBtss\fP" +.br +.RI "The TSS\&. " +.in -1c +.SH "Function Documentation" +.PP +.SS "void allow_all_ports ()" +Allows all ports in the IOPB\&. +.SS "void block_all_ports ()" +Blocks all ports in the IOPB\&. +.SS "void gdt_init ()" +Initializes the GDT & TSS\&. +.SS "static void set_entry (int i, uint32_t base, uint32_t limit, uint8_t access)\fC [static]\fP" +Set a GDT entry\&. +.PP +\fBParameters\fP +.RS 4 +\fIi\fP The GDT entry to set\&. +.br +\fIbase\fP The base of the GDT entry\&. +.br +\fIlimit\fP The limit of the GDT entry\&. +.br +\fIaccess\fP The access byte of the GDT entry\&. +.RE +.PP + +.SS "static void write_tss (int32_t num, uint16_t ss0, uint32_t esp0)\fC [static]\fP" +Set a GDT entry\&. +.PP +\fBParameters\fP +.RS 4 +\fInum\fP The GDT entry to set\&. +.br +\fIss0\fP The kernel stack selector\&. +.br +\fIesp0\fP The kernel stack pointer\&. +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/gdt.h.9 b/sysroot/usr/share/man/man9/gdt.h.9 new file mode 100644 index 0000000..d5db461 --- /dev/null +++ b/sysroot/usr/share/man/man9/gdt.h.9 @@ -0,0 +1,32 @@ +.TH "kernel/cpu/i386/gdt.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/i386/gdt.h +.SH SYNOPSIS +.br +.PP +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBgdt_init\fP ()" +.br +.ti -1c +.RI "void \fBallow_all_ports\fP ()" +.br +.ti -1c +.RI "void \fBblock_all_ports\fP ()" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void allow_all_ports ()" +Allows all ports in the IOPB\&. +.SS "void block_all_ports ()" +Blocks all ports in the IOPB\&. +.SS "void gdt_init ()" +Initializes the GDT & TSS\&. +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/gdt_description.9 b/sysroot/usr/share/man/man9/gdt_description.9 new file mode 100644 index 0000000..cc7e439 --- /dev/null +++ b/sysroot/usr/share/man/man9/gdt_description.9 @@ -0,0 +1,27 @@ +.TH "gdt_description" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +gdt_description +.SH SYNOPSIS +.br +.PP +.SS "Data Fields" + +.in +1c +.ti -1c +.RI "uint16_t \fBsize\fP" +.br +.RI "Size of the GDT\&. " +.ti -1c +.RI "\fBgdt_entry\fP * \fBaddress\fP" +.br +.RI "Address of the GDT\&. " +.in -1c +.SH "Detailed Description" +.PP +Pointed to by the GDTR to tell the processor the GDT's size and address\&. + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/gdt_entry.9 b/sysroot/usr/share/man/man9/gdt_entry.9 new file mode 100644 index 0000000..14b9461 --- /dev/null +++ b/sysroot/usr/share/man/man9/gdt_entry.9 @@ -0,0 +1,75 @@ +.TH "gdt_entry" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +gdt_entry +.SH SYNOPSIS +.br +.PP +.SS "Data Fields" + +.in +1c +.ti -1c +.RI "uint16_t \fBlimit_low16\fP" +.br +.RI "Low 16 bits of the limit\&. " +.ti -1c +.RI "uint16_t \fBbase_low16\fP" +.br +.RI "Low 16 bits of the base\&. " +.ti -1c +.RI "uint8_t \fBbase_mid8\fP" +.br +.RI "Middle 8 bits of the base\&. " +.ti -1c +.RI "uint8_t \fBaccess\fP" +.br +.ti -1c +.RI "uint8_t \fBlimit_flags\fP" +.br +.ti -1c +.RI "uint8_t \fBbase_high8\fP" +.br +.RI "High 8 bits of the base\&. " +.in -1c +.SH "Detailed Description" +.PP +Represents an entry in the GDT\&. +.SH "Field Documentation" +.PP +.SS "uint8_t gdt_entry::access" +Access byte\&. Gives info about the descriptor\&. +.br + Format: +.br + Bit 7: Present\&. Must be 1 for all valid selectors\&. +.br + Bits 6-5\&. Privilege\&. Contains the ring level for the selector\&. 0 for kernel mode, 3 for user mode\&. +.br + Bit 4\&. Descriptor type\&. Must be set for code/data segments and cleared for system segments like the TSS\&. +.br + Bit 3\&. Executable\&. If this bit is set, it is a code selector, otherwise a data selector\&. +.br + Bit 2\&. Direction/Conforming\&. Too complex to explain, should be set to 0\&. +.br + Bit 1\&. Readable/Writable\&. For code sels, this bit sets whther you can use it like a read-only data segment\&. For data sels, it sets whether the selector is writable\&. +.br + Bit 0\&. Acessed bit\&. Set to 0\&. +.br + +.SS "uint8_t gdt_entry::limit_flags" +High nibble of this contains two flags, and the lower niblle contains the high 4 bits of the limit\&. +.br + The flags are: +.br + Bit 3\&. Granularity\&. 0 for byte granularity, 1 for 4 KB granularity\&. +.br + Bit 2\&. Size\&. 0 for 16 bit protected mode, 1 for 32 bit protected mode\&. +.br + Bits 1-0\&. Unused\&. Set to 0\&. +.br + + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/halt.h.9 b/sysroot/usr/share/man/man9/halt.h.9 new file mode 100644 index 0000000..74bf523 --- /dev/null +++ b/sysroot/usr/share/man/man9/halt.h.9 @@ -0,0 +1,22 @@ +.TH "kernel/cpu/halt.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/halt.h +.SH SYNOPSIS +.br +.PP +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBhalt\fP ()" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void halt ()" +Clear interrupts and halt the CPU, +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/idt.c.9 b/sysroot/usr/share/man/man9/idt.c.9 new file mode 100644 index 0000000..8ca6bb9 --- /dev/null +++ b/sysroot/usr/share/man/man9/idt.c.9 @@ -0,0 +1,83 @@ +.TH "kernel/cpu/i386/idt.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/i386/idt.c +.SH SYNOPSIS +.br +.PP +\fC#include 'idt\&.h'\fP +.br +\fC#include \fP +.br + +.SS "Data Structures" + +.in +1c +.ti -1c +.RI "struct \fBidt_gate_t\fP" +.br +.ti -1c +.RI "struct \fBidt_register_t\fP" +.br +.in -1c +.SS "Macros" + +.in +1c +.ti -1c +.RI "#define \fBKERNEL_CS\fP 0x08" +.br +.RI "Kernel code segemnt selector\&. " +.ti -1c +.RI "#define \fBIDT_ENTRIES\fP 256" +.br +.RI "Number of entries in the IDT\&. " +.ti -1c +.RI "#define \fBLOW_16\fP(address) (uint16_t)((address) & 0xFFFF)" +.br +.RI "Macro to get the low 16 bits of an address\&. " +.ti -1c +.RI "#define \fBHIGH_16\fP(address) (uint16_t)(((address) >> 16) & 0xFFFF)" +.br +.RI "Macro to get the high 16 bits of an address\&. " +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBidt_set_gate\fP (int n, uint32_t handler)" +.br +.ti -1c +.RI "void \fBload_idt\fP ()" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "static \fBidt_gate_t\fP \fBidt\fP [\fBIDT_ENTRIES\fP]" +.br +.RI "The IDT\&. " +.ti -1c +.RI "static \fBidt_register_t\fP \fBidt_reg\fP" +.br +.RI "The value to load into the IDTR\&. " +.in -1c +.SH "Function Documentation" +.PP +.SS "void idt_set_gate (int n, uint32_t handler)" +Sets an IDT gate\&. +.PP +\fBParameters\fP +.RS 4 +\fIn\fP the IDT gate to set +.br +\fIhandler\fP the handler for the gate\&. +.RE +.PP + +.SS "void load_idt ()" +Loads the IDT +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/idt.h.9 b/sysroot/usr/share/man/man9/idt.h.9 new file mode 100644 index 0000000..005340b --- /dev/null +++ b/sysroot/usr/share/man/man9/idt.h.9 @@ -0,0 +1,39 @@ +.TH "kernel/cpu/i386/idt.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/i386/idt.h +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br + +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBidt_set_gate\fP (int n, uint32_t handler)" +.br +.ti -1c +.RI "void \fBload_idt\fP ()" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void idt_set_gate (int n, uint32_t handler)" +Sets an IDT gate\&. +.PP +\fBParameters\fP +.RS 4 +\fIn\fP the IDT gate to set +.br +\fIhandler\fP the handler for the gate\&. +.RE +.PP + +.SS "void load_idt ()" +Loads the IDT +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/idt_gate_t.9 b/sysroot/usr/share/man/man9/idt_gate_t.9 new file mode 100644 index 0000000..a870b28 --- /dev/null +++ b/sysroot/usr/share/man/man9/idt_gate_t.9 @@ -0,0 +1,42 @@ +.TH "idt_gate_t" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +idt_gate_t +.SH SYNOPSIS +.br +.PP +.SS "Data Fields" + +.in +1c +.ti -1c +.RI "uint16_t \fBlow_offset\fP" +.br +.RI "Lower 16 bits of handler function address\&. " +.ti -1c +.RI "uint16_t \fBsel\fP" +.br +.RI "Kernel segment selector\&. " +.ti -1c +.RI "uint8_t \fBalways0\fP" +.br +.RI "Must be 0\&. " +.ti -1c +.RI "uint8_t \fBflags\fP" +.br +.ti -1c +.RI "uint16_t \fBhigh_offset\fP" +.br +.RI "Higher 16 bits of handler function address\&. " +.in -1c +.SH "Detailed Description" +.PP +Defines an interrupt gate +.SH "Field Documentation" +.PP +.SS "uint8_t idt_gate_t::flags" +Flags byte\&. Gives info about the descriptor Bit 7: Present\&. Must be 1 for all valid selectors\&. Bits 6-5: Privilege\&. Contains the minimum ring level for the caller\&. 0 for kernel mode, 3 for user mode\&. Bit 4: Set to 0 for interrupt gates\&. Bits 3-0: 1110 = '32 bit interrupt gate'\&. + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/idt_register_t.9 b/sysroot/usr/share/man/man9/idt_register_t.9 new file mode 100644 index 0000000..a68f5e6 --- /dev/null +++ b/sysroot/usr/share/man/man9/idt_register_t.9 @@ -0,0 +1,27 @@ +.TH "idt_register_t" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +idt_register_t +.SH SYNOPSIS +.br +.PP +.SS "Data Fields" + +.in +1c +.ti -1c +.RI "uint16_t \fBlimit\fP" +.br +.RI "Size of the IDT\&. " +.ti -1c +.RI "\fBidt_gate_t\fP * \fBbase\fP" +.br +.RI "Address of the IDT\&. " +.in -1c +.SH "Detailed Description" +.PP +Pointed to by the IDTR to tell the processor the IDT's size and address\&. + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/isr.c.9 b/sysroot/usr/share/man/man9/isr.c.9 new file mode 100644 index 0000000..2f95a41 --- /dev/null +++ b/sysroot/usr/share/man/man9/isr.c.9 @@ -0,0 +1,107 @@ +.TH "kernel/cpu/i386/isr.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/i386/isr.c +.SH SYNOPSIS +.br +.PP +\fC#include '\&.\&./\&.\&./kernel\&.h'\fP +.br +\fC#include '\&.\&./\&.\&./tasking\&.h'\fP +.br +\fC#include '\&.\&./\&.\&./vga_err\&.h'\fP +.br +\fC#include '\&.\&./\&.\&./address_spaces\&.h'\fP +.br +\fC#include '\&.\&./halt\&.h'\fP +.br +\fC#include '\&.\&./isr\&.h'\fP +.br +\fC#include '\&.\&./paging\&.h'\fP +.br +\fC#include '\&.\&./serial\&.h'\fP +.br +\fC#include 'gdt\&.h'\fP +.br +\fC#include 'idt\&.h'\fP +.br +\fC#include 'isr\&.h'\fP +.br +\fC#include 'interrupt\&.h'\fP +.br +\fC#include \fP +.br +\fC#include \fP +.br +\fC#include \fP +.br +\fC#include \fP +.br +\fC#include \fP +.br + +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBirq_handler\fP (\fBregisters_t\fP *r)" +.br +.ti -1c +.RI "void \fBisr_install\fP ()" +.br +.ti -1c +.RI "void \fBisr_handler\fP (\fBregisters_t\fP *r)" +.br +.ti -1c +.RI "void \fBisr_register_handler\fP (int n, \fBisr_t\fP handler)" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "static \fBisr_t\fP \fBirq_handlers\fP [16]" +.br +.RI "Handlers for the PIC interrupts\&. " +.ti -1c +.RI "static char * \fBexception_messages\fP []" +.br +.RI "List of messages for each exception\&. " +.in -1c +.SH "Function Documentation" +.PP +.SS "void irq_handler (\fBregisters_t\fP * r)" +Handler for PIC interrupts +.PP +\fBParameters\fP +.RS 4 +\fIr\fP The saved state of the CPU +.RE +.PP + +.SS "void isr_handler (\fBregisters_t\fP * r)" +Handler for non-PIC interrupts +.PP +\fBParameters\fP +.RS 4 +\fIr\fP The saved state of the CPU +.RE +.PP + +.SS "void isr_install ()" +Install the interrupt handlers into the IDT\&. +.SS "void isr_register_handler (int n, \fBisr_t\fP handler)" +Register an IRQ handler +.PP +\fBParameters\fP +.RS 4 +\fIn\fP the IRQ to register a handler for +.br +\fIhandler\fP the handler to register +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/isr.h.9 b/sysroot/usr/share/man/man9/isr.h.9 new file mode 100644 index 0000000..322f6a1 --- /dev/null +++ b/sysroot/usr/share/man/man9/isr.h.9 @@ -0,0 +1,54 @@ +.TH "kernel/cpu/isr.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/isr.h +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br + +.SS "Data Structures" + +.in +1c +.ti -1c +.RI "struct \fBregisters_t\fP" +.br +.in -1c +.SS "Typedefs" + +.in +1c +.ti -1c +.RI "typedef void(* \fBisr_t\fP) (\fBregisters_t\fP *)" +.br +.RI "Type of an ISR handler function pointer\&. " +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBisr_install\fP ()" +.br +.ti -1c +.RI "void \fBisr_register_handler\fP (int n, \fBisr_t\fP handler)" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void isr_install ()" +Install the interrupt handlers into the IDT\&. +.SS "void isr_register_handler (int n, \fBisr_t\fP handler)" +Register an IRQ handler +.PP +\fBParameters\fP +.RS 4 +\fIn\fP the IRQ to register a handler for +.br +\fIhandler\fP the handler to register +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/kmalloc.c.9 b/sysroot/usr/share/man/man9/kmalloc.c.9 new file mode 100644 index 0000000..0c2b79b --- /dev/null +++ b/sysroot/usr/share/man/man9/kmalloc.c.9 @@ -0,0 +1,116 @@ +.TH "kernel/kmalloc.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/kmalloc.c +.SH SYNOPSIS +.br +.PP +\fC#include 'cpu/arch_consts\&.h'\fP +.br +\fC#include \fP +.br +\fC#include \fP +.br +\fC#include \fP +.br + +.SS "Macros" + +.in +1c +.ti -1c +.RI "#define \fBKMALLOC_BMAP_SZ\fP (((KMALLOC_SZ*1024)/4)/8)" +.br +.RI "The size of the kmalloc bitmap\&. " +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "static char \fBget_bmap_bit\fP (size_t index)" +.br +.ti -1c +.RI "static void \fBset_bmap_bit\fP (size_t index)" +.br +.ti -1c +.RI "static void \fBclear_bmap_bit\fP (size_t index)" +.br +.ti -1c +.RI "void * \fBkmalloc\fP (size_t size)" +.br +.ti -1c +.RI "void \fBkfree\fP (void *mem)" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "static char \fBbitmap\fP [\fBKMALLOC_BMAP_SZ\fP]" +.br +.RI "Bitmap of used areas of the heap\&. " +.ti -1c +.RI "static void * \fBdata\fP =(void*)KMALLOC_START" +.br +.RI "Start of the kmalloc heap\&. " +.in -1c +.SH "Function Documentation" +.PP +.SS "static void clear_bmap_bit (size_t index)\fC [static]\fP" +Clear a bit in the heap bitmap +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The bit to clear +.RE +.PP + +.SS "static char get_bmap_bit (size_t index)\fC [static]\fP" +Get a bit in the heap bitmap +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The bit to get +.RE +.PP +\fBReturns\fP +.RS 4 +the bit +.RE +.PP + +.SS "void kfree (void * mem)" +Free a block in the kernel heap +.PP +\fBParameters\fP +.RS 4 +\fImem\fP The address of the block +.RE +.PP + +.SS "void* kmalloc (size_t size)" +Allocate a block in the kernel heap +.PP +\fBParameters\fP +.RS 4 +\fIsize\fP The size of the block +.RE +.PP +\fBReturns\fP +.RS 4 +the address of the block in the heap\&. +.RE +.PP + +.SS "static void set_bmap_bit (size_t index)\fC [static]\fP" +Set a bit in the heap bitmap +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The bit to set +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/kmalloc.h.9 b/sysroot/usr/share/man/man9/kmalloc.h.9 new file mode 100644 index 0000000..2539871 --- /dev/null +++ b/sysroot/usr/share/man/man9/kmalloc.h.9 @@ -0,0 +1,49 @@ +.TH "kernel/kmalloc.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/kmalloc.h +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br + +.SS "Functions" + +.in +1c +.ti -1c +.RI "void * \fBkmalloc\fP (size_t size)" +.br +.ti -1c +.RI "void \fBkfree\fP (void *mem)" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void kfree (void * mem)" +Free a block in the kernel heap +.PP +\fBParameters\fP +.RS 4 +\fImem\fP The address of the block +.RE +.PP + +.SS "void* kmalloc (size_t size)" +Allocate a block in the kernel heap +.PP +\fBParameters\fP +.RS 4 +\fIsize\fP The size of the block +.RE +.PP +\fBReturns\fP +.RS 4 +the address of the block in the heap\&. +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/paging.c.9 b/sysroot/usr/share/man/man9/paging.c.9 new file mode 100644 index 0000000..c8de858 --- /dev/null +++ b/sysroot/usr/share/man/man9/paging.c.9 @@ -0,0 +1,231 @@ +.TH "kernel/cpu/i386/paging.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/i386/paging.c +.SH SYNOPSIS +.br +.PP +\fC#include '\&.\&./\&.\&./pmem\&.h'\fP +.br +\fC#include '\&.\&./\&.\&./vga_err\&.h'\fP +.br +\fC#include '\&.\&./halt\&.h'\fP +.br +\fC#include '\&.\&./paging\&.h'\fP +.br +\fC#include 'arch_consts\&.h'\fP +.br +\fC#include \fP +.br +\fC#include \fP +.br +\fC#include \fP +.br + +.SS "Functions" + +.in +1c +.ti -1c +.RI "static char \fBis_page_present\fP (size_t page)" +.br +.ti -1c +.RI "void \fBmap_pages\fP (void *virt_addr_ptr, void *phys_addr_ptr, int num_pages, char usr, char wr)" +.br +.ti -1c +.RI "void * \fBfind_free_pages\fP (int num_pages)" +.br +.ti -1c +.RI "void * \fBalloc_pages\fP (int num_pages)" +.br +.ti -1c +.RI "void * \fBvirt_to_phys\fP (void *virt_addr_arg)" +.br +.ti -1c +.RI "void \fBalloc_pages_virt\fP (int num_pages, void *addr)" +.br +.ti -1c +.RI "static void \fBinvl_page\fP (void *addr)" +.br +.ti -1c +.RI "void * \fBpaging_new_address_space\fP ()" +.br +.ti -1c +.RI "void \fBload_address_space\fP (void *cr3)" +.br +.ti -1c +.RI "void \fBunmap_pages\fP (void *start_virt, int num_pages)" +.br +.ti -1c +.RI "void \fBpaging_init\fP ()" +.br +.ti -1c +.RI "void * \fBget_cr3\fP ()" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "static uint32_t \fBpage_directory\fP [1024]" +.br +.RI "The kernel process's page directory\&. " +.ti -1c +.RI "static uint32_t \fBkern_page_tables\fP [NUM_KERN_FRAMES]" +.br +.RI "The page tables where the kernel binary is mapped in\&. " +.ti -1c +.RI "static uint32_t \fBkstack_page_tables\fP [218 *1024]" +.br +.RI "Page tables for thread kernel stacks\&. " +.ti -1c +.RI "static uint32_t \fBkmalloc_page_tables\fP [4 *1024]" +.br +.RI "Page tables for the kmalloc heap\&. " +.ti -1c +.RI "static uint32_t * \fBpagdirmap\fP =(uint32_t*)0xFFFFF000" +.br +.RI "Pointer to the page directory entries in the recursive mapping\&. " +.ti -1c +.RI "static uint32_t * \fBpage_table_map\fP =(uint32_t*)0xFFC00000" +.br +.RI "Pointer to the page table entries in the recursive mapping\&. " +.in -1c +.SH "Function Documentation" +.PP +.SS "void* alloc_pages (int num_pages)" +Allocate virtual pages & map them to physical memory\&. +.PP +\fBParameters\fP +.RS 4 +\fInum_pages\fP The number of pages to allocate\&. +.RE +.PP +\fBReturns\fP +.RS 4 +a pointer to the allocated pages\&. +.RE +.PP + +.SS "void alloc_pages_virt (int num_pages, void * addr)" +Allocate virtual pages at a specific address & map them to physical memory\&. +.PP +\fBParameters\fP +.RS 4 +\fInum_pages\fP The number of pages to allocate\&. +.br +\fIaddr\fP The adress to start allocation at\&. +.RE +.PP + +.SS "void* find_free_pages (int num_pages)" +Finds free virtual pages and returns the start address +.PP +\fBParameters\fP +.RS 4 +\fInum_pages\fP The minimum size of the free area +.RE +.PP +\fBReturns\fP +.RS 4 +the start of the free area +.RE +.PP + +.SS "void* get_cr3 ()" +Get the current address space +.PP +\fBReturns\fP +.RS 4 +a pointer to the current address space in physical memory\&. +.RE +.PP + +.SS "static void invl_page (void * addr)\fC [static]\fP" +Invalidates a page in the TLB, +.PP +\fBParameters\fP +.RS 4 +\fIaddr\fP The address of the page to invalidate\&. +.RE +.PP + +.SS "static char is_page_present (size_t page)\fC [static]\fP" +Checks whether a page is present +.PP +\fBParameters\fP +.RS 4 +\fIpage\fP The page number to check +.RE +.PP +\fBReturns\fP +.RS 4 +Whether the page is present +.RE +.PP + +.SS "void load_address_space (void * cr3)" +Load an address space +.PP +\fBParameters\fP +.RS 4 +\fIcr3\fP The address space to load +.RE +.PP + +.SS "void map_pages (void * virt_addr_ptr, void * phys_addr_ptr, int num_pages, char usr, char wr)" +Map virtual pages to physical frames\&. +.PP +\fBParameters\fP +.RS 4 +\fIvirt_addr_ptr\fP The start of the virtual range to map\&. +.br +\fIphys_addr_ptr\fP The start of the physical range to map\&. +.br +\fInum_pages\fP The number of pages to map\&. +.br +\fIusr\fP Are the pages acessible by user mode code +.br +\fIwr\fP Are the pages writable by user mode code (kernel always has write permissions) +.RE +.PP + +.SS "void paging_init ()" +Initialize paging +.SS "void* paging_new_address_space ()" +Create a new address space +.PP +\fBReturns\fP +.RS 4 +a pointer to the new address space in physical memory\&. +.RE +.PP + +.SS "void unmap_pages (void * start_virt, int num_pages)" +Unmap virtual pages, +.PP +\fBParameters\fP +.RS 4 +\fIstart_virt\fP The start of the virtual range to unmap\&. +.br +\fInum_pages\fP The number of pages to map\&. +.RE +.PP + +.SS "void* virt_to_phys (void * virt_addr)" +Convert a virtual address to a physical one\&. +.PP +\fBParameters\fP +.RS 4 +\fIvirt_addr\fP The virtual address to convert +.RE +.PP +\fBReturns\fP +.RS 4 +the physical adress it maps to, or NULL if it is not mapped\&. +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/paging.h.9 b/sysroot/usr/share/man/man9/paging.h.9 new file mode 100644 index 0000000..ee3187e --- /dev/null +++ b/sysroot/usr/share/man/man9/paging.h.9 @@ -0,0 +1,157 @@ +.TH "kernel/cpu/paging.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/paging.h +.SH SYNOPSIS +.br +.PP +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBmap_pages\fP (void *virt_addr_ptr, void *phys_addr_ptr, int num_pages, char usr, char wr)" +.br +.ti -1c +.RI "void \fBunmap_pages\fP (void *start_virt, int num_pages)" +.br +.ti -1c +.RI "void * \fBalloc_pages\fP (int num_pages)" +.br +.ti -1c +.RI "void \fBalloc_pages_virt\fP (int num_pages, void *addr)" +.br +.ti -1c +.RI "void \fBpaging_init\fP ()" +.br +.ti -1c +.RI "void * \fBpaging_new_address_space\fP ()" +.br +.ti -1c +.RI "void \fBload_address_space\fP (void *cr3)" +.br +.ti -1c +.RI "void * \fBvirt_to_phys\fP (void *virt_addr)" +.br +.ti -1c +.RI "void * \fBfind_free_pages\fP (int num_pages)" +.br +.ti -1c +.RI "void * \fBget_cr3\fP ()" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void* alloc_pages (int num_pages)" +Allocate virtual pages & map them to physical memory\&. +.PP +\fBParameters\fP +.RS 4 +\fInum_pages\fP The number of pages to allocate\&. +.RE +.PP +\fBReturns\fP +.RS 4 +a pointer to the allocated pages\&. +.RE +.PP + +.SS "void alloc_pages_virt (int num_pages, void * addr)" +Allocate virtual pages at a specific address & map them to physical memory\&. +.PP +\fBParameters\fP +.RS 4 +\fInum_pages\fP The number of pages to allocate\&. +.br +\fIaddr\fP The adress to start allocation at\&. +.RE +.PP + +.SS "void* find_free_pages (int num_pages)" +Finds free virtual pages and returns the start address +.PP +\fBParameters\fP +.RS 4 +\fInum_pages\fP The minimum size of the free area +.RE +.PP +\fBReturns\fP +.RS 4 +the start of the free area +.RE +.PP + +.SS "void* get_cr3 ()" +Get the current address space +.PP +\fBReturns\fP +.RS 4 +a pointer to the current address space in physical memory\&. +.RE +.PP + +.SS "void load_address_space (void * cr3)" +Load an address space +.PP +\fBParameters\fP +.RS 4 +\fIcr3\fP The address space to load +.RE +.PP + +.SS "void map_pages (void * virt_addr_ptr, void * phys_addr_ptr, int num_pages, char usr, char wr)" +Map virtual pages to physical frames\&. +.PP +\fBParameters\fP +.RS 4 +\fIvirt_addr_ptr\fP The start of the virtual range to map\&. +.br +\fIphys_addr_ptr\fP The start of the physical range to map\&. +.br +\fInum_pages\fP The number of pages to map\&. +.br +\fIusr\fP Are the pages acessible by user mode code +.br +\fIwr\fP Are the pages writable by user mode code (kernel always has write permissions) +.RE +.PP + +.SS "void paging_init ()" +Initialize paging +.SS "void* paging_new_address_space ()" +Create a new address space +.PP +\fBReturns\fP +.RS 4 +a pointer to the new address space in physical memory\&. +.RE +.PP + +.SS "void unmap_pages (void * start_virt, int num_pages)" +Unmap virtual pages, +.PP +\fBParameters\fP +.RS 4 +\fIstart_virt\fP The start of the virtual range to unmap\&. +.br +\fInum_pages\fP The number of pages to map\&. +.RE +.PP + +.SS "void* virt_to_phys (void * virt_addr)" +Convert a virtual address to a physical one\&. +.PP +\fBParameters\fP +.RS 4 +\fIvirt_addr\fP The virtual address to convert +.RE +.PP +\fBReturns\fP +.RS 4 +the physical adress it maps to, or NULL if it is not mapped\&. +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/pg_struct_entry.9 b/sysroot/usr/share/man/man9/pg_struct_entry.9 new file mode 100644 index 0000000..a4bf83e --- /dev/null +++ b/sysroot/usr/share/man/man9/pg_struct_entry.9 @@ -0,0 +1,30 @@ +.TH "pg_struct_entry" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +pg_struct_entry \- Format of a paging structure entry +The format of a page table/directiry entry is as following: +.br + Bits 31-11 is the physical frame number the entry points to\&. +.br + Bits 11-9 are availible for use by the OS\&. +.br + Bit 8 is ignored\&. +.br + Bit 7 is the page size in page directories, and must be 0 in page tables\&. If set to 1 in a page directory, it indicates 4MB pages\&. +.br + Bit 6 is the dirty bit in page tables, and must be 0 in page directories\&. In page tabes, it is set to 1 by the CPU when the page is written to\&. +.br + Bit 5 will be set to 1 by the CPU when the page is accessed\&. +.br + Bit 4 indicates whether the page has it's cache disabled\&. +.br + Bit 3 indictates whether write-through caching (when it is 1), or write-back caching, (when it is 0) is enabled\&. +.br + Bit 2 indictaes whether user mode code can access the page\&. +.br + Bit 1 indicates whether the page is writable\&. +.br + Bit 0 indicates whether the entry is present\&. If it is 0, the CU ignores the other 31 bits of the entry\&. +.br + Privlege bits in the entries are ANDed together, so the most restrictive privlege between the page directory and the page table wins\&. diff --git a/sysroot/usr/share/man/man9/pmem.c.9 b/sysroot/usr/share/man/man9/pmem.c.9 new file mode 100644 index 0000000..662fd77 --- /dev/null +++ b/sysroot/usr/share/man/man9/pmem.c.9 @@ -0,0 +1,132 @@ +.TH "kernel/pmem.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/pmem.c +.SH SYNOPSIS +.br +.PP +\fC#include 'cpu/arch_consts\&.h'\fP +.br +\fC#include 'cpu/halt\&.h'\fP +.br +\fC#include 'vga_err\&.h'\fP +.br +\fC#include \fP +.br +\fC#include \fP +.br +\fC#include \fP +.br +\fC#include \fP +.br + +.SS "Macros" + +.in +1c +.ti -1c +.RI "#define \fBBMAP_LEN\fP (NUM_FRAMES/8)" +.br +.RI "The size of the physical memory manager's bitmap\&. " +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "static char \fBget_bmap_bit\fP (int index)" +.br +.ti -1c +.RI "static void \fBset_bmap_bit\fP (int index)" +.br +.ti -1c +.RI "static void \fBclear_bmap_bit\fP (int index)" +.br +.ti -1c +.RI "void \fBpmem_init\fP (struct multiboot_boot_header_tag *tags)" +.br +.ti -1c +.RI "void * \fBpmem_alloc\fP (int num_pages)" +.br +.ti -1c +.RI "void \fBpmem_free\fP (int start_page, int num_pages)" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "static char \fBbmap\fP [\fBBMAP_LEN\fP]" +.br +.RI "Bitmap of allocated/non-present page frames\&. " +.in -1c +.SH "Function Documentation" +.PP +.SS "static void clear_bmap_bit (int index)\fC [static]\fP" +Clear a bit in the heap bitmap +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The bit to clear +.RE +.PP + +.SS "static char get_bmap_bit (int index)\fC [static]\fP" +Get a bit in the bitmap +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The bit to get +.RE +.PP +\fBReturns\fP +.RS 4 +the bit +.RE +.PP + +.SS "void* pmem_alloc (int num_pages)" +Allocate physical frames +.PP +\fBParameters\fP +.RS 4 +\fInum_pages\fP The number of frames to allocate +.RE +.PP +\fBReturns\fP +.RS 4 +the physical address of the allocated frames +.RE +.PP + +.SS "void pmem_free (int start_page, int num_pages)" +Free allocated physical frames +.PP +\fBParameters\fP +.RS 4 +\fIstart_page\fP The frame to start freeing at\&. +.br +\fInum_pages\fP The number of frames to free +.RE +.PP + +.SS "void pmem_init (struct multiboot_boot_header_tag * tags)" +Initialize the physical memory manager +.PP +\fBParameters\fP +.RS 4 +\fItags\fP The multiboot header +.RE +.PP + +.SS "static void set_bmap_bit (int index)\fC [static]\fP" +Set a bit in the heap bitmap +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The bit to set +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/pmem.h.9 b/sysroot/usr/share/man/man9/pmem.h.9 new file mode 100644 index 0000000..334d7e9 --- /dev/null +++ b/sysroot/usr/share/man/man9/pmem.h.9 @@ -0,0 +1,63 @@ +.TH "kernel/pmem.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/pmem.h +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br + +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBpmem_init\fP (struct multiboot_boot_header_tag *tags)" +.br +.ti -1c +.RI "void * \fBpmem_alloc\fP (int num_pages)" +.br +.ti -1c +.RI "void \fBpmem_free\fP (int start_page, int num_pages)" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void* pmem_alloc (int num_pages)" +Allocate physical frames +.PP +\fBParameters\fP +.RS 4 +\fInum_pages\fP The number of frames to allocate +.RE +.PP +\fBReturns\fP +.RS 4 +the physical address of the allocated frames +.RE +.PP + +.SS "void pmem_free (int start_page, int num_pages)" +Free allocated physical frames +.PP +\fBParameters\fP +.RS 4 +\fIstart_page\fP The frame to start freeing at\&. +.br +\fInum_pages\fP The number of frames to free +.RE +.PP + +.SS "void pmem_init (struct multiboot_boot_header_tag * tags)" +Initialize the physical memory manager +.PP +\fBParameters\fP +.RS 4 +\fItags\fP The multiboot header +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/registers_t.9 b/sysroot/usr/share/man/man9/registers_t.9 new file mode 100644 index 0000000..917f729 --- /dev/null +++ b/sysroot/usr/share/man/man9/registers_t.9 @@ -0,0 +1,85 @@ +.TH "registers_t" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +registers_t +.SH SYNOPSIS +.br +.PP +.PP +\fC#include \fP +.SS "Data Fields" + +.in +1c +.ti -1c +.RI "uint32_t \fBds\fP" +.br +.RI "Data segment selector\&. " +.ti -1c +.RI "uint32_t \fBedi\fP" +.br +.RI "Pushed by pusha\&. " +.ti -1c +.RI "uint32_t \fBesi\fP" +.br +.RI "Pushed by pusha\&. " +.ti -1c +.RI "uint32_t \fBebp\fP" +.br +.RI "Pushed by pusha\&. " +.ti -1c +.RI "uint32_t \fBesp\fP" +.br +.RI "Pushed by pusha\&. " +.ti -1c +.RI "uint32_t \fBebx\fP" +.br +.RI "Pushed by pusha\&. " +.ti -1c +.RI "uint32_t \fBedx\fP" +.br +.RI "Pushed by pusha\&. " +.ti -1c +.RI "uint32_t \fBecx\fP" +.br +.RI "Pushed by pusha\&. " +.ti -1c +.RI "uint32_t \fBeax\fP" +.br +.RI "Pushed by pusha\&. " +.ti -1c +.RI "uint32_t \fBint_no\fP" +.br +.RI "Interrupt number\&. " +.ti -1c +.RI "uint32_t \fBerr_code\fP" +.br +.RI "Error code (if applicable) " +.ti -1c +.RI "uint32_t \fBeip\fP" +.br +.RI "Pushed by the processor automatically\&. " +.ti -1c +.RI "uint32_t \fBcs\fP" +.br +.RI "Pushed by the processor automatically\&. " +.ti -1c +.RI "uint32_t \fBeflags\fP" +.br +.RI "Pushed by the processor automatically\&. " +.ti -1c +.RI "uint32_t \fBuseresp\fP" +.br +.RI "Pushed by the processor automatically\&. " +.ti -1c +.RI "uint32_t \fBss\fP" +.br +.RI "Pushed by the processor automatically\&. " +.in -1c +.SH "Detailed Description" +.PP +Saved state of the CPU when an interrupt occurs + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/rpc.h.9 b/sysroot/usr/share/man/man9/rpc.h.9 new file mode 100644 index 0000000..9d6bdae --- /dev/null +++ b/sysroot/usr/share/man/man9/rpc.h.9 @@ -0,0 +1,18 @@ +.TH "kernel/rpc.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/rpc.h +.SH SYNOPSIS +.br +.PP +.SS "Data Structures" + +.in +1c +.ti -1c +.RI "struct \fBRPCFuncInfo\fP" +.br +.in -1c +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/serial.c.9 b/sysroot/usr/share/man/man9/serial.c.9 new file mode 100644 index 0000000..c81a8e5 --- /dev/null +++ b/sysroot/usr/share/man/man9/serial.c.9 @@ -0,0 +1,99 @@ +.TH "kernel/cpu/i386/serial.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/i386/serial.c +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br + +.SS "Macros" + +.in +1c +.ti -1c +.RI "#define \fBDATA_PORT\fP(com) (\fBdata_ports\fP[com])" +.br +.RI "Returns the data port of a serial port\&. " +.ti -1c +.RI "#define \fBINT_PORT\fP(com) (\fBDATA_PORT\fP(com)+1)" +.br +.RI "Returns the interrupt config port of a serial port\&. " +.ti -1c +.RI "#define \fBFIFO_PORT\fP(com) (\fBDATA_PORT\fP(com)+2)" +.br +.RI "Returns the fifo config port of a serial port\&. " +.ti -1c +.RI "#define \fBLINE_CMD_PORT\fP(com) (\fBDATA_PORT\fP(com)+3)" +.br +.RI "Returns the line cmd port of a serial port\&. " +.ti -1c +.RI "#define \fBMODEM_CMD_PORT\fP(com) (\fBDATA_PORT\fP(com)+4)" +.br +.RI "Returns the modem cmd port of a serial port\&. " +.ti -1c +.RI "#define \fBLINE_STAT_PORT\fP(com) (\fBDATA_PORT\fP(com)+5)" +.br +.RI "Returns the line status port of a serial port\&. " +.ti -1c +.RI "#define \fBSCRATCH_PORT\fP(com) (\fBDATA_PORT\fP(com)+7)" +.br +.RI "Returns the scratch port of a serial port\&. " +.ti -1c +.RI "#define \fBIS_TRANSMIT_FIFO_EMPTY\fP(com) (port_byte_in(\fBLINE_STAT_PORT\fP(com))&0x20)" +.br +.RI "Returns whether the trasmit FIFO is empty\&. " +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "static void \fBconfigure\fP (int com, int rate)" +.br +.ti -1c +.RI "void \fBserial_init\fP ()" +.br +.ti -1c +.RI "void \fBserial_putc\fP (char c)" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "static char \fBconfigured\fP [] ={0,0,0,0}" +.br +.RI "What serial ports have been detected and configured\&. " +.ti -1c +.RI "static int \fBdata_ports\fP [4] ={0x3f8,0x2f8,0x3e8,0x2e8}" +.br +.RI "List of the data ports for all the potential serial ports\&. " +.in -1c +.SH "Function Documentation" +.PP +.SS "static void configure (int com, int rate)\fC [static]\fP" +Configure a serial port with a specified baud rate\&. +.PP +\fBParameters\fP +.RS 4 +\fIcom\fP The number of the serial port to configure +.br +\fIrate\fP The baud rate to set the serial port to\&. +.RE +.PP + +.SS "void serial_init ()" +Initialize the serial driver +.SS "void serial_putc (char c)" +Write a character to the serial port +.PP +\fBParameters\fP +.RS 4 +\fIc\fP The character to write +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/serial.h.9 b/sysroot/usr/share/man/man9/serial.h.9 new file mode 100644 index 0000000..e123c1a --- /dev/null +++ b/sysroot/usr/share/man/man9/serial.h.9 @@ -0,0 +1,70 @@ +.TH "kernel/cpu/serial.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/serial.h +.SH SYNOPSIS +.br +.PP +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBserial_init\fP ()" +.br +.ti -1c +.RI "void \fBserial_putc\fP (char c)" +.br +.ti -1c +.RI "void \fBserial_write_string\fP (const char *s)" +.br +.ti -1c +.RI "void \fBserial_printf\fP (const char *format,\&.\&.\&.)" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void serial_init ()" +Initialize the serial driver +.SS "void serial_printf (const char * format, \&.\&.\&.)" +Printf, but to the serial port +.PP +\fBParameters\fP +.RS 4 +\fIformat\fP The format string +.br +\fI\&.\&.\&.\fP Arguments for the format string +.RE +.PP +\fBNote\fP +.RS 4 +This function is provided by platform-independent code, a serial driver does not need to implement this\&. +.RE +.PP + +.SS "void serial_putc (char c)" +Write a character to the serial port +.PP +\fBParameters\fP +.RS 4 +\fIc\fP The character to write +.RE +.PP + +.SS "void serial_write_string (const char * s)" +Write a string to the serial port +.PP +\fBParameters\fP +.RS 4 +\fIs\fP The string to write +.RE +.PP +\fBNote\fP +.RS 4 +This function is provided by platform-independent code, a serial driver does not need to implement this\&. +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/tar_header.9 b/sysroot/usr/share/man/man9/tar_header.9 new file mode 100644 index 0000000..465fd60 --- /dev/null +++ b/sysroot/usr/share/man/man9/tar_header.9 @@ -0,0 +1,51 @@ +.TH "tar_header" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +tar_header +.SH SYNOPSIS +.br +.PP +.SS "Data Fields" + +.in +1c +.ti -1c +.RI "char \fBfilename\fP [100]" +.br +.RI "Filename of file descried by the tar header\&. " +.ti -1c +.RI "char \fBmode\fP [8]" +.br +.RI "Mode as an octal string\&. " +.ti -1c +.RI "char \fBuid\fP [8]" +.br +.RI "UID of owner as an octal string\&. " +.ti -1c +.RI "char \fBgid\fP [8]" +.br +.RI "GID of owner as an octal string\&. " +.ti -1c +.RI "char \fBsize\fP [12]" +.br +.RI "Size of file as an octal string\&. " +.ti -1c +.RI "char \fBmtime\fP [12]" +.br +.RI "Modification time as an octal string\&. " +.ti -1c +.RI "char \fBchksum\fP [8]" +.br +.RI "Checksum as octal string\&. " +.ti -1c +.RI "char \fBtypeflag\fP [1]" +.br +.RI "File type\&. (0 for normal file) " +.in -1c +.SH "Detailed Description" +.PP +REspresents a TAR file header + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/tasking.c.9 b/sysroot/usr/share/man/man9/tasking.c.9 new file mode 100644 index 0000000..2dee5d2 --- /dev/null +++ b/sysroot/usr/share/man/man9/tasking.c.9 @@ -0,0 +1,279 @@ +.TH "kernel/tasking.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/tasking.c +.SH SYNOPSIS +.br +.PP +\fC#include 'cpu/halt\&.h'\fP +.br +\fC#include 'cpu/paging\&.h'\fP +.br +\fC#include 'cpu/serial\&.h'\fP +.br +\fC#include 'cpu/tasking_helpers\&.h'\fP +.br +\fC#include 'kmalloc\&.h'\fP +.br +\fC#include 'tasking\&.h'\fP +.br +\fC#include \fP +.br + +.SS "Macros" + +.in +1c +.ti -1c +.RI "#define \fBMAX_PROCS\fP 32768" +.br +.RI "Maximum number of processes that can be running at a time\&. " +.ti -1c +.RI "#define \fBHAS_UNBLOCKED_THREADS\fP(proc) (proc\->numThreads!=proc\->numThreadsBlocked)" +.br +.RI "Macro to check whethe a process has unblocked threads\&. " +.ti -1c +.RI "#define \fBNUM_UNBLOCKED_THREADS\fP(proc) (proc\->numThreads\-proc\->numThreadsBlocked)" +.br +.RI "Macro to get the number of unblocked threads for a process\&. " +.ti -1c +.RI "#define \fBSAME_PROC\fP(thread1, thread2) (thread1\->process\->pid==thread2\->process\->pid)" +.br +.RI "Macro to check whether two threads have the same PID\&. " +.ti -1c +.RI "#define \fBSAME_THREAD\fP(thread1, thread2) (thread1\->process\->pid==thread2\->process\->pid&&thread1\->tid==thread2\->tid)" +.br +.RI "Macro to check whether two threads have the same PID and TID\&. " +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "static char \fBis_proc_scheduled\fP (pid_t index)" +.br +.ti -1c +.RI "static void \fBmark_proc_scheduled\fP (pid_t index)" +.br +.ti -1c +.RI "static void \fBunmark_proc_scheduled\fP (pid_t index)" +.br +.ti -1c +.RI "void \fBtasking_create_task\fP (void *eip, void *cr3, char kmode, char param1_exists, void *param1_arg, char param2_exists, void *param2_arg, char isThread)" +.br +.ti -1c +.RI "void \fBtasking_init\fP ()" +.br +.ti -1c +.RI "char \fBtasking_is_privleged\fP ()" +.br +.ti -1c +.RI "pid_t \fBtasking_get_PID\fP ()" +.br +.ti -1c +.RI "int * \fBtasking_get_errno_address\fP ()" +.br +.ti -1c +.RI "pid_t \fBtasking_new_thread\fP (void *start, pid_t pid, char param_exists, void *param_arg)" +.br +.ti -1c +.RI "void \fBswitch_to_thread\fP (\fBThread\fP *thread)" +.br +.ti -1c +.RI "void \fBtasking_yield\fP ()" +.br +.ti -1c +.RI "void \fBtasking_block\fP (\fBthread_state\fP newstate)" +.br +.ti -1c +.RI "void \fBtasking_unblock\fP (pid_t pid, pid_t tid)" +.br +.ti -1c +.RI "void \fBtasking_exit\fP (int code)" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "pid_t \fBnext_pid\fP =0" +.br +.RI "PID to use for the next created process\&. " +.ti -1c +.RI "size_t \fBnum_procs\fP =0" +.br +.RI "Number of non-exited processes\&. " +.ti -1c +.RI "\fBProcess\fP * \fBprocesses\fP [\fBMAX_PROCS\fP]" +.br +.RI "Array pf processes by PID\&. " +.ti -1c +.RI "char \fBproc_schedule_bmap\fP [\fBMAX_PROCS\fP/8]" +.br +.RI "Bitmap of what processes are scheduled\&. " +.ti -1c +.RI "\fBThread\fP * \fBcurrent_thread\fP" +.br +.RI "Currently running thread\&. " +.ti -1c +.RI "static \fBThread\fP * \fBready_to_run_head\fP =NULL" +.br +.RI "Head of the linked list of ready to run threads\&. " +.ti -1c +.RI "static \fBThread\fP * \fBready_to_run_tail\fP =NULL" +.br +.RI "Tail of the linked list of ready to run threads\&. " +.in -1c +.SH "Function Documentation" +.PP +.SS "static char is_proc_scheduled (pid_t index)\fC [static]\fP" +Check whether a process is scheduled +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The PID to check +.RE +.PP +\fBReturns\fP +.RS 4 +whether the process is scheduled +.RE +.PP + +.SS "static void mark_proc_scheduled (pid_t index)\fC [static]\fP" +Mark a process as scheduled +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The PID to mark +.RE +.PP + +.SS "void switch_to_thread (\fBThread\fP * thread)" +Switch to a thread and schedule the next ready thread in the current process, if there is one\&. +.PP +\fBParameters\fP +.RS 4 +\fIthread\fP The thread to switch to +.RE +.PP + +.SS "void tasking_block (\fBthread_state\fP newstate)" +Block the current thread & yield +.PP +\fBParameters\fP +.RS 4 +\fInewstate\fP The state to block it in +.RE +.PP + +.SS "void tasking_create_task (void * eip, void * cr3, char kmode, char param1_exists, void * param1_arg, char param2_exists, void * param2_arg, char isThread)" +Create a task +.PP +\fBParameters\fP +.RS 4 +\fIeip\fP The start address of the task +.br +\fIcr3\fP The address space of the task +.br +\fIkmode\fP Whether the task is a kernel mode task +.br +\fIparam1_exists\fP Whether param1_arg is a valid value +.br +\fIparam1_arg\fP The thread's start function first parameter +.br +\fIparam2_exists\fP Whether param2_arg is a valid value +.br +\fIparam2_arg\fP The thread's start function second parameter/ +.br +\fIisThread\fP Whether we are creating a new process or a thread in a process\&. If we are creating a theead, param2_arg becomes the PID for the newly created thread, and param2_exists must be 0\&. +.RE +.PP + +.SS "void tasking_exit (int code)" +Terminate the current thread If the main thread terminates, the whole process terminates\&. +.PP +\fBNote\fP +.RS 4 +Currently, calling tasking_exit from any thread terminates the whole process\&. +.RE +.PP +\fBParameters\fP +.RS 4 +\fIcode\fP The exit code of the thread +.RE +.PP + +.SS "int* tasking_get_errno_address ()" +Get the adddress of errno for the current thread +.PP +\fBReturns\fP +.RS 4 +The address of errno +.RE +.PP + +.SS "pid_t tasking_get_PID ()" +Get the PID of the current thread\&. +.PP +\fBReturns\fP +.RS 4 +The current thread's PID +.RE +.PP + +.SS "void tasking_init ()" +Initialize tasking +.SS "char tasking_is_privleged ()" +Check whether the current process is privleged +.PP +\fBReturns\fP +.RS 4 +whether the current process is privleged +.RE +.PP + +.SS "pid_t tasking_new_thread (void * start, pid_t pid, char param_exists, void * param_arg)" +Create a new thread +.PP +\fBParameters\fP +.RS 4 +\fIstart\fP The start address of the task +.br +\fIpid\fP The PID that gets the new thread +.br +\fIparam_exists\fP Whether param_arg is a valid value +.br +\fIparam_arg\fP The thread's start function parameter +.RE +.PP +\fBReturns\fP +.RS 4 +the TID of the thread +.RE +.PP + +.SS "void tasking_unblock (pid_t pid, pid_t tid)" +Unblock a thread +.PP +\fBParameters\fP +.RS 4 +\fIpid\fP The PID that contains the thread to unblock +.br +\fItid\fP The TID in the process to unblock\&. +.RE +.PP + +.SS "void tasking_yield ()" +Yield to the next ready thread in any process +.SS "static void unmark_proc_scheduled (pid_t index)\fC [static]\fP" +Unmark a process as scheduled +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The PID to unmark +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/tasking.h.9 b/sysroot/usr/share/man/man9/tasking.h.9 new file mode 100644 index 0000000..99c4ee5 --- /dev/null +++ b/sysroot/usr/share/man/man9/tasking.h.9 @@ -0,0 +1,204 @@ +.TH "kernel/tasking.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/tasking.h +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br +\fC#include \fP +.br + +.SS "Data Structures" + +.in +1c +.ti -1c +.RI "struct \fBProcess\fP" +.br +.ti -1c +.RI "struct \fBThread\fP" +.br +.in -1c +.SS "Enumerations" + +.in +1c +.ti -1c +.RI "enum \fBthread_state\fP { \fBTHREAD_RUNNING\fP, \fBTHREAD_READY\fP, \fBTHREAD_EXITED\fP, \fBTHREAD_BLOCKED\fP }" +.br +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBtasking_create_task\fP (void *eip, void *cr3, char kmode, char param1_exists, void *param1_arg, char param2_exists, void *param2_arg, char isThread)" +.br +.ti -1c +.RI "void \fBtasking_init\fP ()" +.br +.ti -1c +.RI "char \fBtasking_is_privleged\fP ()" +.br +.ti -1c +.RI "pid_t \fBtasking_get_PID\fP ()" +.br +.ti -1c +.RI "int * \fBtasking_get_errno_address\fP ()" +.br +.ti -1c +.RI "pid_t \fBtasking_new_thread\fP (void *start, pid_t pid, char param_exists, void *param_arg)" +.br +.ti -1c +.RI "void \fBtasking_exit\fP (int code)" +.br +.ti -1c +.RI "void \fBtasking_block\fP (\fBthread_state\fP newstate)" +.br +.ti -1c +.RI "void \fBtasking_unblock\fP (pid_t pid, pid_t tid)" +.br +.ti -1c +.RI "void \fBtasking_yield\fP ()" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "\fBThread\fP * \fBcurrent_thread\fP" +.br +.RI "Currently running thread\&. " +.in -1c +.SH "Enumeration Type Documentation" +.PP +.SS "enum \fBthread_state\fP" +Represents the state of a thread +.PP +\fBEnumerator\fP +.in +1c +.TP +\fB\fITHREAD_RUNNING \fP\fP +The state of a running thread\&. +.TP +\fB\fITHREAD_READY \fP\fP +The state of a ready to run thread\&. +.TP +\fB\fITHREAD_EXITED \fP\fP +The state of an exited thread\&. +.TP +\fB\fITHREAD_BLOCKED \fP\fP +The state of a generically blocked thread\&. +.SH "Function Documentation" +.PP +.SS "void tasking_block (\fBthread_state\fP newstate)" +Block the current thread & yield +.PP +\fBParameters\fP +.RS 4 +\fInewstate\fP The state to block it in +.RE +.PP + +.SS "void tasking_create_task (void * eip, void * cr3, char kmode, char param1_exists, void * param1_arg, char param2_exists, void * param2_arg, char isThread)" +Create a task +.PP +\fBParameters\fP +.RS 4 +\fIeip\fP The start address of the task +.br +\fIcr3\fP The address space of the task +.br +\fIkmode\fP Whether the task is a kernel mode task +.br +\fIparam1_exists\fP Whether param1_arg is a valid value +.br +\fIparam1_arg\fP The thread's start function first parameter +.br +\fIparam2_exists\fP Whether param2_arg is a valid value +.br +\fIparam2_arg\fP The thread's start function second parameter/ +.br +\fIisThread\fP Whether we are creating a new process or a thread in a process\&. If we are creating a theead, param2_arg becomes the PID for the newly created thread, and param2_exists must be 0\&. +.RE +.PP + +.SS "void tasking_exit (int code)" +Terminate the current thread If the main thread terminates, the whole process terminates\&. +.PP +\fBNote\fP +.RS 4 +Currently, calling tasking_exit from any thread terminates the whole process\&. +.RE +.PP +\fBParameters\fP +.RS 4 +\fIcode\fP The exit code of the thread +.RE +.PP + +.SS "int* tasking_get_errno_address ()" +Get the adddress of errno for the current thread +.PP +\fBReturns\fP +.RS 4 +The address of errno +.RE +.PP + +.SS "pid_t tasking_get_PID ()" +Get the PID of the current thread\&. +.PP +\fBReturns\fP +.RS 4 +The current thread's PID +.RE +.PP + +.SS "void tasking_init ()" +Initialize tasking +.SS "char tasking_is_privleged ()" +Check whether the current process is privleged +.PP +\fBReturns\fP +.RS 4 +whether the current process is privleged +.RE +.PP + +.SS "pid_t tasking_new_thread (void * start, pid_t pid, char param_exists, void * param_arg)" +Create a new thread +.PP +\fBParameters\fP +.RS 4 +\fIstart\fP The start address of the task +.br +\fIpid\fP The PID that gets the new thread +.br +\fIparam_exists\fP Whether param_arg is a valid value +.br +\fIparam_arg\fP The thread's start function parameter +.RE +.PP +\fBReturns\fP +.RS 4 +the TID of the thread +.RE +.PP + +.SS "void tasking_unblock (pid_t pid, pid_t tid)" +Unblock a thread +.PP +\fBParameters\fP +.RS 4 +\fIpid\fP The PID that contains the thread to unblock +.br +\fItid\fP The TID in the process to unblock\&. +.RE +.PP + +.SS "void tasking_yield ()" +Yield to the next ready thread in any process +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/tasking_helpers.h.9 b/sysroot/usr/share/man/man9/tasking_helpers.h.9 new file mode 100644 index 0000000..4de752d --- /dev/null +++ b/sysroot/usr/share/man/man9/tasking_helpers.h.9 @@ -0,0 +1,62 @@ +.TH "kernel/cpu/tasking_helpers.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/tasking_helpers.h +.SH SYNOPSIS +.br +.PP +\fC#include '\&.\&./tasking\&.h'\fP +.br + +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBswitch_to_thread_asm\fP (\fBThread\fP *thread)" +.br +.ti -1c +.RI "void \fBtask_init\fP ()" +.br +.ti -1c +.RI "void \fBwait_for_unblocked_thread_asm\fP ()" +.br +.ti -1c +.RI "void \fBsetup_kstack\fP (\fBThread\fP *thread, void *param1, void *param2, char kmode, void *eip)" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void setup_kstack (\fBThread\fP * thread, void * param1, void * param2, char kmode, void * eip)" +Setup a kernel stack for a thread +.PP +\fBParameters\fP +.RS 4 +\fIthread\fP The thread to setup a stack for +.br +\fIparam1\fP The thread's start function first parameter +.br +\fIparam2\fP The thread's start function second parameter +.br +\fIkmode\fP Whether the thread is a kernel mode thread +.br +\fIeip\fP The start address of the thread +.RE +.PP + +.SS "void switch_to_thread_asm (\fBThread\fP * thread)" +The assembly part of switching to a thread\&. Performs the actual context switch\&. +.PP +\fBParameters\fP +.RS 4 +\fIthread\fP The thread to switch to\&. +.RE +.PP + +.SS "void task_init ()" +Initializes a usermode task +.SS "void wait_for_unblocked_thread_asm ()" +An assembly helper for waiting for an unblocked thread Starts interrupts, halts, then clears interrupts\&. +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/tasking_helpers_c.c.9 b/sysroot/usr/share/man/man9/tasking_helpers_c.c.9 new file mode 100644 index 0000000..d21619c --- /dev/null +++ b/sysroot/usr/share/man/man9/tasking_helpers_c.c.9 @@ -0,0 +1,101 @@ +.TH "kernel/cpu/i386/tasking_helpers_c.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/cpu/i386/tasking_helpers_c.c +.SH SYNOPSIS +.br +.PP +\fC#include '\&.\&./\&.\&./tasking\&.h'\fP +.br +\fC#include '\&.\&./paging\&.h'\fP +.br +\fC#include '\&.\&./tasking_helpers\&.h'\fP +.br +\fC#include '\&.\&./\&.\&./pmem\&.h'\fP +.br +\fC#include \fP +.br + +.SS "Functions" + +.in +1c +.ti -1c +.RI "static char \fBis_kstack_allocated\fP (size_t index)" +.br +.ti -1c +.RI "static void \fBmark_kstack_allocated\fP (size_t index)" +.br +.ti -1c +.RI "static int \fBnew_kstack\fP ()" +.br +.ti -1c +.RI "void \fBsetup_kstack\fP (\fBThread\fP *thread, void *param1, void *param2, char kmode, void *eip)" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "static void ** \fBkstacks\fP =(void*)0xC8000000" +.br +.RI "Pointer to all the thread kernel stacks\&. " +.ti -1c +.RI "static char \fBkstack_bmap\fP [(218 *1024)/8] ={0}" +.br +.RI "Bitmap of what kernel stacks have been allocated\&. " +.in -1c +.SH "Function Documentation" +.PP +.SS "static char is_kstack_allocated (size_t index)\fC [static]\fP" +Check whether a kernel stack is allocated +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The kernel stack to check +.RE +.PP +\fBReturns\fP +.RS 4 +whether the kernel stack is allocated +.RE +.PP + +.SS "static void mark_kstack_allocated (size_t index)\fC [static]\fP" +Mark that a kernel stack is allocated +.PP +\fBParameters\fP +.RS 4 +\fIindex\fP The kernel stack to mark +.RE +.PP + +.SS "static int new_kstack ()\fC [static]\fP" +Allocate a kernel stack for a thread +.PP +\fBReturns\fP +.RS 4 +The number of the new kernel stack, or -1 if none are unallocated\&. +.RE +.PP + +.SS "void setup_kstack (\fBThread\fP * thread, void * param1, void * param2, char kmode, void * eip)" +Setup a kernel stack for a thread +.PP +\fBParameters\fP +.RS 4 +\fIthread\fP The thread to setup a stack for +.br +\fIparam1\fP The thread's start function first parameter +.br +\fIparam2\fP The thread's start function second parameter +.br +\fIkmode\fP Whether the thread is a kernel mode thread +.br +\fIeip\fP The start address of the thread +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/tss_entry.9 b/sysroot/usr/share/man/man9/tss_entry.9 new file mode 100644 index 0000000..1cd73ea --- /dev/null +++ b/sysroot/usr/share/man/man9/tss_entry.9 @@ -0,0 +1,135 @@ +.TH "tss_entry" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +tss_entry +.SH SYNOPSIS +.br +.PP +.SS "Data Fields" + +.in +1c +.ti -1c +.RI "uint32_t \fBprev_tss\fP" +.br +.RI "The previous TSS - if we used hardware task switching this would form a linked list\&. " +.ti -1c +.RI "uint32_t \fBesp0\fP" +.br +.RI "The stack pointer to load when we change to kernel mode\&. " +.ti -1c +.RI "uint32_t \fBss0\fP" +.br +.RI "The stack segment to load when we change to kernel mode\&. " +.ti -1c +.RI "uint32_t \fBesp1\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBss1\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBss2\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBesp2\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBcr3\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBeip\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBeflags\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBeax\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBecx\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBedx\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBebx\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBesp\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBebp\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBesi\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBedi\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint32_t \fBes\fP" +.br +.RI "The value to load into ES when we change to kernel mode\&. " +.ti -1c +.RI "uint32_t \fBcs\fP" +.br +.RI "The value to load into CS when we change to kernel mode\&. " +.ti -1c +.RI "uint32_t \fBss\fP" +.br +.RI "The value to load into SS when we change to kernel mode\&. " +.ti -1c +.RI "uint32_t \fBds\fP" +.br +.RI "The value to load into DS when we change to kernel mode\&. " +.ti -1c +.RI "uint32_t \fBfs\fP" +.br +.RI "The value to load into FS when we change to kernel mode\&. " +.ti -1c +.RI "uint32_t \fBgs\fP" +.br +.RI "The value to load into GS when we change to kernel mode\&. " +.ti -1c +.RI "uint32_t \fBldt\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint16_t \fBtrap\fP" +.br +.RI "Unused\&. " +.ti -1c +.RI "uint16_t \fBiomap_base\fP" +.br +.RI "Offset of the IOPB in the TSS\&. " +.ti -1c +.RI "char \fBiopb\fP [8192]" +.br +.RI "IO port bitmap\&. " +.ti -1c +.RI "uint8_t \fBset_ff\fP" +.br +.RI "Must be set to 0xFF to mark the end of the IOPB\&. " +.in -1c +.SH "Detailed Description" +.PP +Represents a TSS\&. + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/vga_err.c.9 b/sysroot/usr/share/man/man9/vga_err.c.9 new file mode 100644 index 0000000..0218256 --- /dev/null +++ b/sysroot/usr/share/man/man9/vga_err.c.9 @@ -0,0 +1,84 @@ +.TH "kernel/vga_err.c" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/vga_err.c +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br +\fC#include \fP +.br + +.SS "Macros" + +.in +1c +.ti -1c +.RI "#define \fBVGA_BLACK\fP 0" +.br +.RI "The color black\&. " +.ti -1c +.RI "#define \fBVGA_WHITE\fP 15" +.br +.RI "The color white\&. " +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "static void \fBset_char\fP (int \fBx\fP, char c)" +.br +.ti -1c +.RI "void \fBvga_init\fP (char *addr)" +.br +.ti -1c +.RI "void \fBvga_write_string\fP (const char *string)" +.br +.in -1c +.SS "Variables" + +.in +1c +.ti -1c +.RI "static char * \fBscreen\fP" +.br +.RI "Pointer to VGA screen memory\&. " +.ti -1c +.RI "static int \fBx\fP =0" +.br +.RI "Next character offset in VGA sreen memory\&. " +.in -1c +.SH "Function Documentation" +.PP +.SS "static void set_char (int x, char c)\fC [static]\fP" +Set a character on the screen +.PP +\fBParameters\fP +.RS 4 +\fIx\fP The character index to set +.br +\fIc\fP The character to write +.RE +.PP + +.SS "void vga_init (char * screen)" +Initilaze the VGA error writing driver +.PP +\fBParameters\fP +.RS 4 +\fIscreen\fP Pointer to VGA screen memory +.RE +.PP + +.SS "void vga_write_string (const char * string)" +Write a string starting at the top line of the VGA display +.PP +\fBParameters\fP +.RS 4 +\fIstring\fP The string to write +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&. diff --git a/sysroot/usr/share/man/man9/vga_err.h.9 b/sysroot/usr/share/man/man9/vga_err.h.9 new file mode 100644 index 0000000..696651d --- /dev/null +++ b/sysroot/usr/share/man/man9/vga_err.h.9 @@ -0,0 +1,41 @@ +.TH "kernel/vga_err.h" 9 "Sun Jul 26 2020" "MyOS Kernel" \" -*- nroff -*- +.ad l +.nh +.SH NAME +kernel/vga_err.h +.SH SYNOPSIS +.br +.PP +.SS "Functions" + +.in +1c +.ti -1c +.RI "void \fBvga_init\fP (char *\fBscreen\fP)" +.br +.ti -1c +.RI "void \fBvga_write_string\fP (const char *string)" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "void vga_init (char * screen)" +Initilaze the VGA error writing driver +.PP +\fBParameters\fP +.RS 4 +\fIscreen\fP Pointer to VGA screen memory +.RE +.PP + +.SS "void vga_write_string (const char * string)" +Write a string starting at the top line of the VGA display +.PP +\fBParameters\fP +.RS 4 +\fIstring\fP The string to write +.RE +.PP + +.SH "Author" +.PP +Generated automatically by Doxygen for MyOS Kernel from the source code\&.