core: change types from uint32_t to u32 (e.g)
This commit is contained in:
@ -1,9 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
// boolean types
|
||||
#include "types.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
// size_t, already in libft.h but for readability
|
||||
#include <stddef.h>
|
||||
|
||||
// Remove this and replace it with <assert.h> header
|
||||
|
@ -1,12 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// MSR
|
||||
bool cpu_has_msr();
|
||||
void cpu_set_msr(uint32_t msr, uint32_t lo, uint32_t hi);
|
||||
void cpu_get_msr(uint32_t msr, uint32_t *lo, uint32_t *hi);
|
||||
void cpu_set_msr(u32 msr, u32 lo, u32 hi);
|
||||
void cpu_get_msr(u32 msr, u32 *lo, u32 *hi);
|
||||
|
||||
// 8259 PIC
|
||||
void pic_disable(void);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "kpanic.h"
|
||||
#include "kprintf.h"
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define PRINT_PTR(X) kprintf("%s:%u %s: %p\n", __FILE__, __LINE__, #X, X)
|
||||
@ -17,13 +18,13 @@
|
||||
} while (0)
|
||||
|
||||
struct function_entry {
|
||||
uint32_t addr;
|
||||
u32 addr;
|
||||
char name[64];
|
||||
};
|
||||
|
||||
struct stackframe {
|
||||
struct stackframe *ebp;
|
||||
uint32_t eip;
|
||||
u32 eip;
|
||||
};
|
||||
|
||||
void print_stack(void);
|
||||
|
@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
struct font {
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
uint32_t yoffset;
|
||||
u32 height;
|
||||
u32 width;
|
||||
u32 yoffset;
|
||||
char *bitmap;
|
||||
};
|
||||
|
@ -1,14 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "tss.h"
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define GDT_SIZE 8
|
||||
|
||||
// https://wiki.osdev.org/Global_Descriptor_Table#GDTR
|
||||
struct gdt_descriptor {
|
||||
uint16_t size;
|
||||
uint32_t base;
|
||||
u16 size;
|
||||
u32 base;
|
||||
} __attribute__((packed));
|
||||
|
||||
extern struct tss TSS;
|
||||
@ -33,7 +34,7 @@ void init_gdt();
|
||||
#define GDT_ACCESS_A_ACCESSED 0b00000001
|
||||
#define GDT_ACCESS_A_NOT_ACCESSED 0b00000000
|
||||
|
||||
extern uint8_t gdt_entries[GDT_SIZE * 8];
|
||||
extern u8 gdt_entries[GDT_SIZE * 8];
|
||||
|
||||
#define GDT_OFFSET_KERNEL_CODE 0x08
|
||||
#define GDT_OFFSET_KERNEL_DATA 0x10
|
||||
|
@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
struct icon {
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
uint32_t *pixels;
|
||||
u32 height;
|
||||
u32 width;
|
||||
u32 *pixels;
|
||||
};
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,20 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
// doc : https://wiki.osdev.org/Interrupt_Descriptor_Table#IDTR
|
||||
struct idt_descriptor {
|
||||
uint16_t size;
|
||||
uint32_t offset;
|
||||
u16 size;
|
||||
u32 offset;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct idt_entry {
|
||||
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
|
||||
u16 isr_low; // The lower 16 bits of the ISR's address
|
||||
u16 kernel_cs; // The GDT segment selector that the CPU will load
|
||||
// into CS before calling the ISR
|
||||
uint8_t reserved; // Set to zero
|
||||
uint8_t attributes; // Type and attributes; see the IDT page
|
||||
uint16_t isr_high; // The higher 16 bits of the ISR's address
|
||||
u8 reserved; // Set to zero
|
||||
u8 attributes; // Type and attributes; see the IDT page
|
||||
u16 isr_high; // The higher 16 bits of the ISR's address
|
||||
} __attribute__((packed));
|
||||
|
||||
#define IDT_SIZE 256
|
||||
|
@ -1,22 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
struct registers {
|
||||
// data segment selector
|
||||
uint32_t ds;
|
||||
u32 ds;
|
||||
// general purpose registers pushed by pusha
|
||||
uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
|
||||
u32 edi, esi, ebp, esp, ebx, edx, ecx, eax;
|
||||
// pushed by isr procedure
|
||||
uint32_t int_no, err_code;
|
||||
u32 int_no, err_code;
|
||||
// pushed by CPU automatically
|
||||
uint32_t eip, cs, eflags, useresp, ss;
|
||||
u32 eip, cs, eflags, useresp, ss;
|
||||
};
|
||||
|
||||
typedef void (*isr_t)(struct registers *);
|
||||
|
||||
void isr_handler(struct registers *regs);
|
||||
void pic_send_eoi(uint8_t irq);
|
||||
void pic_send_eoi(u8 irq);
|
||||
void register_interrupt_handler(int index, isr_t handler);
|
||||
|
||||
static inline void cli(void)
|
||||
@ -27,4 +28,4 @@ static inline void cli(void)
|
||||
static inline void sti(void)
|
||||
{
|
||||
__asm__ volatile("sti");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@ -116,8 +117,8 @@
|
||||
#define KEY_CAPSLOCK 0x3A
|
||||
|
||||
struct key_event {
|
||||
uint8_t c;
|
||||
uint8_t scan_code;
|
||||
u8 c;
|
||||
u8 scan_code;
|
||||
};
|
||||
|
||||
struct key_event get_key(void);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "multiboot.h"
|
||||
#include "types.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@ -15,13 +16,13 @@
|
||||
#define PD_SIZE 1024
|
||||
#define PAGE_MASK 0xFFFFF000
|
||||
#define HEAP_END 0xC0000000
|
||||
#define HEAP_START ((uint32_t) & _kernel_end - HEAP_END)
|
||||
#define KERNEL_START ((uint32_t) & _kernel_start)
|
||||
#define KERNEL_END ((uint32_t) & _kernel_end - HEAP_END)
|
||||
#define HEAP_START ((u32) & _kernel_end - HEAP_END)
|
||||
#define KERNEL_START ((u32) & _kernel_start)
|
||||
#define KERNEL_END ((u32) & _kernel_end - HEAP_END)
|
||||
#define PT_START 256
|
||||
|
||||
#define GET_PAGE_ADDR(pd_index, pt_index) \
|
||||
((((uint32_t)pd_index * 1024) + (uint32_t)pt_index) * 4096)
|
||||
((((u32)pd_index * 1024) + (u32)pt_index) * 4096)
|
||||
|
||||
#define GET_FRAME(frame_table, i) (frame_table[i / 8] & (1 << (i % 8)))
|
||||
#define SET_FRAME(frame_table, i, used) \
|
||||
@ -34,28 +35,29 @@
|
||||
|
||||
struct frame_zone {
|
||||
void *addr;
|
||||
uint32_t first_free_frame;
|
||||
uint8_t *frame_table;
|
||||
uint32_t total_frames;
|
||||
uint32_t remaining_frames;
|
||||
u32 first_free_frame;
|
||||
u8 *frame_table;
|
||||
u32 total_frames;
|
||||
u32 remaining_frames;
|
||||
struct frame_zone *next;
|
||||
};
|
||||
|
||||
extern uint32_t _kernel_end;
|
||||
extern uint32_t _kernel_start;
|
||||
extern uint32_t boot_page_directory;
|
||||
extern uint32_t *page_directory;
|
||||
extern uint32_t page_table_default[1024];
|
||||
extern uint32_t mem_size;
|
||||
extern u32 _kernel_end;
|
||||
extern u32 _kernel_start;
|
||||
extern u32 boot_page_directory;
|
||||
extern u32 *page_directory;
|
||||
extern u32 page_table_default[1024];
|
||||
extern u32 mem_size;
|
||||
extern multiboot_memory_map_t *mmap_addr;
|
||||
extern multiboot_uint32_t mmap_length;
|
||||
extern multiboot_u32 mmap_length;
|
||||
extern struct frame_zone *head;
|
||||
|
||||
uint32_t *virt_to_phys(uint32_t *virt_addr);
|
||||
void init_memory(multiboot_info_t *mbd, uint32_t magic);
|
||||
u32 *virt_to_phys(u32 *virt_addr);
|
||||
void init_memory(multiboot_info_t *mbd, u32 magic);
|
||||
void *alloc_frame(void);
|
||||
int free_frame(void *frame_ptr);
|
||||
i8 add_single_page(void *frame);
|
||||
void *alloc_pages(size_t size, void **phys_addr);
|
||||
int free_pages(void *page_ptr, size_t size);
|
||||
void init_page_table(uint32_t page_table[1024], uint16_t start);
|
||||
int16_t add_page_table(uint16_t pd_index);
|
||||
void init_page_table(u32 page_table[1024], u16 start);
|
||||
int16_t add_page_table(u16 pd_index);
|
||||
|
@ -93,71 +93,71 @@
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
typedef unsigned char multiboot_uint8_t;
|
||||
typedef unsigned short multiboot_uint16_t;
|
||||
typedef unsigned int multiboot_uint32_t;
|
||||
typedef unsigned long long multiboot_uint64_t;
|
||||
typedef unsigned char multiboot_u8;
|
||||
typedef unsigned short multiboot_u16;
|
||||
typedef unsigned int multiboot_u32;
|
||||
typedef unsigned long long multiboot_u64;
|
||||
|
||||
struct multiboot_header {
|
||||
/* Must be MULTIBOOT_MAGIC - see above. */
|
||||
multiboot_uint32_t magic;
|
||||
multiboot_u32 magic;
|
||||
|
||||
/* Feature flags. */
|
||||
multiboot_uint32_t flags;
|
||||
multiboot_u32 flags;
|
||||
|
||||
/* The above fields plus this one must equal 0 mod 2^32. */
|
||||
multiboot_uint32_t checksum;
|
||||
multiboot_u32 checksum;
|
||||
|
||||
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
|
||||
multiboot_uint32_t header_addr;
|
||||
multiboot_uint32_t load_addr;
|
||||
multiboot_uint32_t load_end_addr;
|
||||
multiboot_uint32_t bss_end_addr;
|
||||
multiboot_uint32_t entry_addr;
|
||||
multiboot_u32 header_addr;
|
||||
multiboot_u32 load_addr;
|
||||
multiboot_u32 load_end_addr;
|
||||
multiboot_u32 bss_end_addr;
|
||||
multiboot_u32 entry_addr;
|
||||
|
||||
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
|
||||
multiboot_uint32_t mode_type;
|
||||
multiboot_uint32_t width;
|
||||
multiboot_uint32_t height;
|
||||
multiboot_uint32_t depth;
|
||||
multiboot_u32 mode_type;
|
||||
multiboot_u32 width;
|
||||
multiboot_u32 height;
|
||||
multiboot_u32 depth;
|
||||
};
|
||||
|
||||
/* The symbol table for a.out. */
|
||||
struct multiboot_aout_symbol_table {
|
||||
multiboot_uint32_t tabsize;
|
||||
multiboot_uint32_t strsize;
|
||||
multiboot_uint32_t addr;
|
||||
multiboot_uint32_t reserved;
|
||||
multiboot_u32 tabsize;
|
||||
multiboot_u32 strsize;
|
||||
multiboot_u32 addr;
|
||||
multiboot_u32 reserved;
|
||||
};
|
||||
typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
|
||||
|
||||
/* The section header table for ELF. */
|
||||
struct multiboot_elf_section_header_table {
|
||||
multiboot_uint32_t num;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t addr;
|
||||
multiboot_uint32_t shndx;
|
||||
multiboot_u32 num;
|
||||
multiboot_u32 size;
|
||||
multiboot_u32 addr;
|
||||
multiboot_u32 shndx;
|
||||
};
|
||||
typedef struct multiboot_elf_section_header_table
|
||||
multiboot_elf_section_header_table_t;
|
||||
|
||||
struct multiboot_info {
|
||||
/* Multiboot info version number */
|
||||
multiboot_uint32_t flags;
|
||||
multiboot_u32 flags;
|
||||
|
||||
/* Available memory from BIOS */
|
||||
multiboot_uint32_t mem_lower;
|
||||
multiboot_uint32_t mem_upper;
|
||||
multiboot_u32 mem_lower;
|
||||
multiboot_u32 mem_upper;
|
||||
|
||||
/* "root" partition */
|
||||
multiboot_uint32_t boot_device;
|
||||
multiboot_u32 boot_device;
|
||||
|
||||
/* Kernel command line */
|
||||
multiboot_uint32_t cmdline;
|
||||
multiboot_u32 cmdline;
|
||||
|
||||
/* Boot-Module list */
|
||||
multiboot_uint32_t mods_count;
|
||||
multiboot_uint32_t mods_addr;
|
||||
multiboot_u32 mods_count;
|
||||
multiboot_u32 mods_addr;
|
||||
|
||||
union {
|
||||
multiboot_aout_symbol_table_t aout_sym;
|
||||
@ -165,104 +165,105 @@ struct multiboot_info {
|
||||
} u;
|
||||
|
||||
/* Memory Mapping buffer */
|
||||
multiboot_uint32_t mmap_length;
|
||||
multiboot_uint32_t mmap_addr;
|
||||
multiboot_u32 mmap_length;
|
||||
multiboot_u32 mmap_addr;
|
||||
|
||||
/* Drive Info buffer */
|
||||
multiboot_uint32_t drives_length;
|
||||
multiboot_uint32_t drives_addr;
|
||||
multiboot_u32 drives_length;
|
||||
multiboot_u32 drives_addr;
|
||||
|
||||
/* ROM configuration table */
|
||||
multiboot_uint32_t config_table;
|
||||
multiboot_u32 config_table;
|
||||
|
||||
/* Boot Loader Name */
|
||||
multiboot_uint32_t boot_loader_name;
|
||||
multiboot_u32 boot_loader_name;
|
||||
|
||||
/* APM table */
|
||||
multiboot_uint32_t apm_table;
|
||||
multiboot_u32 apm_table;
|
||||
|
||||
/* Video */
|
||||
multiboot_uint32_t vbe_control_info;
|
||||
multiboot_uint32_t vbe_mode_info;
|
||||
multiboot_uint16_t vbe_mode;
|
||||
multiboot_uint16_t vbe_interface_seg;
|
||||
multiboot_uint16_t vbe_interface_off;
|
||||
multiboot_uint16_t vbe_interface_len;
|
||||
multiboot_u32 vbe_control_info;
|
||||
multiboot_u32 vbe_mode_info;
|
||||
multiboot_u16 vbe_mode;
|
||||
multiboot_u16 vbe_interface_seg;
|
||||
multiboot_u16 vbe_interface_off;
|
||||
multiboot_u16 vbe_interface_len;
|
||||
|
||||
multiboot_uint64_t framebuffer_addr;
|
||||
multiboot_uint32_t framebuffer_pitch;
|
||||
multiboot_uint32_t framebuffer_width;
|
||||
multiboot_uint32_t framebuffer_height;
|
||||
multiboot_uint8_t framebuffer_bpp;
|
||||
multiboot_u64 framebuffer_addr;
|
||||
multiboot_u32 framebuffer_pitch;
|
||||
multiboot_u32 framebuffer_width;
|
||||
multiboot_u32 framebuffer_height;
|
||||
multiboot_u8 framebuffer_bpp;
|
||||
#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
|
||||
#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
|
||||
#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
|
||||
multiboot_uint8_t framebuffer_type;
|
||||
multiboot_u8 framebuffer_type;
|
||||
union {
|
||||
struct {
|
||||
multiboot_uint32_t framebuffer_palette_addr;
|
||||
multiboot_uint16_t framebuffer_palette_num_colors;
|
||||
multiboot_u32 framebuffer_palette_addr;
|
||||
multiboot_u16 framebuffer_palette_num_colors;
|
||||
};
|
||||
struct {
|
||||
multiboot_uint8_t framebuffer_red_field_position;
|
||||
multiboot_uint8_t framebuffer_red_mask_size;
|
||||
multiboot_uint8_t framebuffer_green_field_position;
|
||||
multiboot_uint8_t framebuffer_green_mask_size;
|
||||
multiboot_uint8_t framebuffer_blue_field_position;
|
||||
multiboot_uint8_t framebuffer_blue_mask_size;
|
||||
multiboot_u8 framebuffer_red_field_position;
|
||||
multiboot_u8 framebuffer_red_mask_size;
|
||||
multiboot_u8 framebuffer_green_field_position;
|
||||
multiboot_u8 framebuffer_green_mask_size;
|
||||
multiboot_u8 framebuffer_blue_field_position;
|
||||
multiboot_u8 framebuffer_blue_mask_size;
|
||||
};
|
||||
};
|
||||
};
|
||||
typedef struct multiboot_info multiboot_info_t;
|
||||
|
||||
struct multiboot_color {
|
||||
multiboot_uint8_t red;
|
||||
multiboot_uint8_t green;
|
||||
multiboot_uint8_t blue;
|
||||
multiboot_u8 red;
|
||||
multiboot_u8 green;
|
||||
multiboot_u8 blue;
|
||||
};
|
||||
|
||||
struct multiboot_mmap_entry {
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint64_t addr;
|
||||
multiboot_uint64_t len;
|
||||
multiboot_u32 size;
|
||||
multiboot_u64 addr;
|
||||
multiboot_u64 len;
|
||||
#define MULTIBOOT_MEMORY_AVAILABLE 1
|
||||
#define MULTIBOOT_MEMORY_RESERVED 2
|
||||
#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
|
||||
#define MULTIBOOT_MEMORY_NVS 4
|
||||
#define MULTIBOOT_MEMORY_BADRAM 5
|
||||
multiboot_uint32_t type;
|
||||
multiboot_u32 type;
|
||||
} __attribute__((packed));
|
||||
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
|
||||
|
||||
struct multiboot_mod_list {
|
||||
/* the memory used goes from bytes ’mod_start’ to ’mod_end-1’ inclusive
|
||||
*/
|
||||
multiboot_uint32_t mod_start;
|
||||
multiboot_uint32_t mod_end;
|
||||
multiboot_u32 mod_start;
|
||||
multiboot_u32 mod_end;
|
||||
|
||||
/* Module command line */
|
||||
multiboot_uint32_t cmdline;
|
||||
multiboot_u32 cmdline;
|
||||
|
||||
/* padding to take it to 16 bytes (must be zero) */
|
||||
multiboot_uint32_t pad;
|
||||
multiboot_u32 pad;
|
||||
};
|
||||
typedef struct multiboot_mod_list multiboot_module_t;
|
||||
|
||||
/* APM BIOS info. */
|
||||
struct multiboot_apm_info {
|
||||
multiboot_uint16_t version;
|
||||
multiboot_uint16_t cseg;
|
||||
multiboot_uint32_t offset;
|
||||
multiboot_uint16_t cseg_16;
|
||||
multiboot_uint16_t dseg;
|
||||
multiboot_uint16_t flags;
|
||||
multiboot_uint16_t cseg_len;
|
||||
multiboot_uint16_t cseg_16_len;
|
||||
multiboot_uint16_t dseg_len;
|
||||
multiboot_u16 version;
|
||||
multiboot_u16 cseg;
|
||||
multiboot_u32 offset;
|
||||
multiboot_u16 cseg_16;
|
||||
multiboot_u16 dseg;
|
||||
multiboot_u16 flags;
|
||||
multiboot_u16 cseg_len;
|
||||
multiboot_u16 cseg_16_len;
|
||||
multiboot_u16 dseg_len;
|
||||
};
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void init_multiboot(multiboot_info_t *mbd, uint32_t magic);
|
||||
void init_multiboot(multiboot_info_t *mbd, u32 magic);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define SECOND_REGISTER 0x00
|
||||
@ -17,14 +18,14 @@
|
||||
enum { CMOS_ADDRESS = 0x70, CMOS_DATA = 0x71 };
|
||||
|
||||
struct rtc_date {
|
||||
uint8_t second;
|
||||
uint8_t minute;
|
||||
uint8_t hour;
|
||||
u8 second;
|
||||
u8 minute;
|
||||
u8 hour;
|
||||
|
||||
uint8_t index_of_the_day;
|
||||
uint8_t day;
|
||||
uint8_t month;
|
||||
uint32_t year;
|
||||
u8 index_of_the_day;
|
||||
u8 day;
|
||||
u8 month;
|
||||
u32 year;
|
||||
};
|
||||
|
||||
struct rtc_date get_date(void);
|
||||
struct rtc_date get_date(void);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "list.h"
|
||||
#include "memory.h"
|
||||
#include "types.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -13,14 +14,14 @@ enum owner { OWNER_KERNEL, OWNER_USER };
|
||||
#define STACK_SIZE PAGE_SIZE * 4
|
||||
|
||||
struct task {
|
||||
uint32_t *esp;
|
||||
uint32_t *esp0;
|
||||
uint32_t *cr3; // physical
|
||||
uint32_t *heap; // virtual
|
||||
uint32_t *eip;
|
||||
uint16_t pid;
|
||||
uint8_t status;
|
||||
uint8_t owner_id;
|
||||
u32 *esp;
|
||||
u32 *esp0;
|
||||
u32 *cr3; // physical
|
||||
u32 *heap; // virtual
|
||||
u32 *eip;
|
||||
u16 pid;
|
||||
u8 status;
|
||||
u8 uid;
|
||||
struct task *daddy;
|
||||
struct task *child;
|
||||
struct list **signals;
|
||||
@ -31,4 +32,4 @@ struct task {
|
||||
void scheduler(void);
|
||||
void switch_to_task(struct task *next_task);
|
||||
void exec_fn(void (*fn)(void));
|
||||
int create_kernel_task(void);
|
||||
i8 create_kernel_task(void);
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "font.h"
|
||||
#include "icon.h"
|
||||
#include "keyboard.h"
|
||||
#include "types.h"
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@ -18,10 +19,10 @@
|
||||
struct screen {
|
||||
size_t row;
|
||||
size_t column;
|
||||
uint32_t fg_color;
|
||||
uint32_t bg_color;
|
||||
uint8_t buffer[VGA_WIDTH * VGA_HEIGHT];
|
||||
uint32_t default_color;
|
||||
u32 fg_color;
|
||||
u32 bg_color;
|
||||
u8 buffer[VGA_WIDTH * VGA_HEIGHT];
|
||||
u32 default_color;
|
||||
struct icon *background;
|
||||
struct font *font;
|
||||
char line[256];
|
||||
@ -49,8 +50,8 @@ typedef enum {
|
||||
enum cursor_direction { LEFT, RIGHT, UP, DOWN };
|
||||
|
||||
void terminal_initialize(void);
|
||||
void terminal_set_bg_color(uint32_t color);
|
||||
void terminal_set_fg_color(uint32_t color);
|
||||
void terminal_set_bg_color(u32 color);
|
||||
void terminal_set_fg_color(u32 color);
|
||||
int terminal_putchar(char c);
|
||||
int terminal_write(const char *data, size_t size);
|
||||
int terminal_writestring(const char *data);
|
||||
@ -62,9 +63,9 @@ struct key_event terminal_getkey(void);
|
||||
void update_cursor(void);
|
||||
void move_cursor(int direction);
|
||||
void set_color_level(int level);
|
||||
void terminal_set_default_fg_color(uint32_t fg_color);
|
||||
void terminal_set_default_bg_color(uint32_t fg_color);
|
||||
void terminal_change_default_fg_color(uint32_t color);
|
||||
uint32_t terminal_get_default_color(void);
|
||||
uint8_t terminal_get_char(int column, int row);
|
||||
void terminal_set_default_fg_color(u32 fg_color);
|
||||
void terminal_set_default_bg_color(u32 fg_color);
|
||||
void terminal_change_default_fg_color(u32 color);
|
||||
u32 terminal_get_default_color(void);
|
||||
u8 terminal_get_char(int column, int row);
|
||||
void terminal_remove_last_char(void);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void sleep(uint64_t delay);
|
||||
void sleep(u64 delay);
|
||||
|
@ -1,60 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
// _h fields are for the offset
|
||||
struct tss {
|
||||
uint16_t link;
|
||||
uint16_t link_h;
|
||||
u16 link;
|
||||
u16 link_h;
|
||||
|
||||
uint32_t esp0;
|
||||
uint16_t ss0;
|
||||
uint16_t ss0_h;
|
||||
u32 esp0;
|
||||
u16 ss0;
|
||||
u16 ss0_h;
|
||||
|
||||
uint32_t esp1;
|
||||
uint16_t ss1;
|
||||
uint16_t ss1_h;
|
||||
u32 esp1;
|
||||
u16 ss1;
|
||||
u16 ss1_h;
|
||||
|
||||
uint32_t esp2;
|
||||
uint16_t ss2;
|
||||
uint16_t ss2_h;
|
||||
u32 esp2;
|
||||
u16 ss2;
|
||||
u16 ss2_h;
|
||||
|
||||
uint32_t cr3;
|
||||
uint32_t eip;
|
||||
uint32_t eflags;
|
||||
u32 cr3;
|
||||
u32 eip;
|
||||
u32 eflags;
|
||||
|
||||
uint32_t eax;
|
||||
uint32_t ecx;
|
||||
uint32_t edx;
|
||||
uint32_t ebx;
|
||||
u32 eax;
|
||||
u32 ecx;
|
||||
u32 edx;
|
||||
u32 ebx;
|
||||
|
||||
uint32_t esp;
|
||||
uint32_t ebp;
|
||||
u32 esp;
|
||||
u32 ebp;
|
||||
|
||||
uint32_t esi;
|
||||
uint32_t edi;
|
||||
u32 esi;
|
||||
u32 edi;
|
||||
|
||||
uint16_t es;
|
||||
uint16_t es_h;
|
||||
u16 es;
|
||||
u16 es_h;
|
||||
|
||||
uint16_t cs;
|
||||
uint16_t cs_h;
|
||||
u16 cs;
|
||||
u16 cs_h;
|
||||
|
||||
uint16_t ss;
|
||||
uint16_t ss_h;
|
||||
u16 ss;
|
||||
u16 ss_h;
|
||||
|
||||
uint16_t ds;
|
||||
uint16_t ds_h;
|
||||
u16 ds;
|
||||
u16 ds_h;
|
||||
|
||||
uint16_t fs;
|
||||
uint16_t fs_h;
|
||||
u16 fs;
|
||||
u16 fs_h;
|
||||
|
||||
uint16_t gs;
|
||||
uint16_t gs_h;
|
||||
u16 gs;
|
||||
u16 gs_h;
|
||||
|
||||
uint16_t ldt;
|
||||
uint16_t ldt_h;
|
||||
u16 ldt;
|
||||
u16 ldt_h;
|
||||
|
||||
uint16_t trap;
|
||||
uint16_t iomap;
|
||||
u16 trap;
|
||||
u16 iomap;
|
||||
};
|
||||
|
@ -1,17 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "icon.h"
|
||||
#include "types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
struct vbe_interface {
|
||||
uint32_t *buff;
|
||||
uint16_t height;
|
||||
uint16_t width;
|
||||
uint32_t pitch;
|
||||
uint8_t bpp;
|
||||
u32 *buff;
|
||||
u16 height;
|
||||
u16 width;
|
||||
u32 pitch;
|
||||
u8 bpp;
|
||||
};
|
||||
|
||||
extern struct vbe_interface display;
|
||||
|
||||
void draw_icon(uint32_t pos_x, uint32_t pos_y, struct icon *img);
|
||||
void put_pixel(uint32_t color, uint32_t x, uint32_t y);
|
||||
void draw_icon(u32 pos_x, u32 pos_y, struct icon *img);
|
||||
void put_pixel(u32 color, u32 x, u32 y);
|
||||
|
Reference in New Issue
Block a user