
#include "str.h"

#include "kernel_state.h"

struct kernel_state kernel = { 0 };

const struct str gdt_segment_index_str[SEGMENT_COUNT] = {
    [SEGMENT_NULL       ] = str_attach("SEGMENT_NULL"),
    [SEGMENT_KERNEL_CODE] = str_attach("SEGMENT_KERNEL_CODE"),
    [SEGMENT_KERNEL_DATA] = str_attach("SEGMENT_KERNEL_DATA"),
    [SEGMENT_USER_CODE  ] = str_attach("SEGMENT_USER_CODE"),
    [SEGMENT_USER_DATA  ] = str_attach("SEGMENT_USER_DATA"),
    [SEGMENT_TASK_STATE ] = str_attach("SEGMENT_TASK_STATE"),
};

const struct str idt_desc_index_str[IDT_DESC_COUNT] = {
    [IDT_DESC_EXCEPTION_DIVISION_ERROR             ] = str_attach("IDT_DESC_EXCEPTION_DIVISION_ERROR"),
    [IDT_DESC_EXCEPTION_DEBUG                      ] = str_attach("IDT_DESC_EXCEPTION_DEBUG"),
    [IDT_DESC_EXCEPTION_NON_MASKABLE               ] = str_attach("IDT_DESC_EXCEPTION_NON_MASKABLE"),
    [IDT_DESC_EXCEPTION_BREAKPOINT                 ] = str_attach("IDT_DESC_EXCEPTION_BREAKPOINT"),
    [IDT_DESC_EXCEPTION_OVERFLOW                   ] = str_attach("IDT_DESC_EXCEPTION_OVERFLOW"),
    [IDT_DESC_EXCEPTION_BOUND_RANGE_EXCEEDED       ] = str_attach("IDT_DESC_EXCEPTION_BOUND_RANGE_EXCEEDED"),
    [IDT_DESC_EXCEPTION_INVALID_OPCODE             ] = str_attach("IDT_DESC_EXCEPTION_INVALID_OPCODE"),
    [IDT_DESC_EXCEPTION_DEVICE_NOT_AVAILABLE       ] = str_attach("IDT_DESC_EXCEPTION_DEVICE_NOT_AVAILABLE"),
    [IDT_DESC_EXCEPTION_DOUBLE_FAULT               ] = str_attach("IDT_DESC_EXCEPTION_DOUBLE_FAULT"),
    [IDT_DESC_EXCEPTION_COPROCESSOR_SEGMENT_OVERRUN] = str_attach("IDT_DESC_EXCEPTION_COPROCESSOR_SEGMENT_OVERRUN"),
    [IDT_DESC_EXCEPTION_INVALID_TSS                ] = str_attach("IDT_DESC_EXCEPTION_INVALID_TSS"),
    [IDT_DESC_EXCEPTION_SEGMENT_NOT_PRESENT        ] = str_attach("IDT_DESC_EXCEPTION_SEGMENT_NOT_PRESENT"),
    [IDT_DESC_EXCEPTION_STACK_SEGMENTATION_FAULT   ] = str_attach("IDT_DESC_EXCEPTION_STACK_SEGMENTATION_FAULT"),
    [IDT_DESC_EXCEPTION_GENERAL_PROTECTION_FAULT   ] = str_attach("IDT_DESC_EXCEPTION_GENERAL_PROTECTION_FAULT"),
    [IDT_DESC_EXCEPTION_PAGE_FAULT                 ] = str_attach("IDT_DESC_EXCEPTION_PAGE_FAULT"),
    [IDT_DESC_EXCEPTION_X87_FLOATING_POINT         ] = str_attach("IDT_DESC_EXCEPTION_X87_FLOATING_POINT"),
    [IDT_DESC_EXCEPTION_ALIGNMENT_CHECK            ] = str_attach("IDT_DESC_EXCEPTION_ALIGNMENT_CHECK"),
    [IDT_DESC_EXCEPTION_MACHINE_CHECK              ] = str_attach("IDT_DESC_EXCEPTION_MACHINE_CHECK"),
    [IDT_DESC_EXCEPTION_SIMD_FLOATING_POINT        ] = str_attach("IDT_DESC_EXCEPTION_SIMD_FLOATING_POINT"),
    [IDT_DESC_EXCEPTION_VIRTUALIZATION             ] = str_attach("IDT_DESC_EXCEPTION_VIRTUALIZATION"),
    [IDT_DESC_EXCEPTION_CONTROL_PROTECTION         ] = str_attach("IDT_DESC_EXCEPTION_CONTROL_PROTECTION"),
    [IDT_DESC_EXCEPTION_HYPERVISOR_INJECTION       ] = str_attach("IDT_DESC_EXCEPTION_HYPERVISOR_INJECTION"),
    [IDT_DESC_EXCEPTION_VMM_COMMUNICATION          ] = str_attach("IDT_DESC_EXCEPTION_VMM_COMMUNICATION"),
    [IDT_DESC_EXCEPTION_SECURITY                   ] = str_attach("IDT_DESC_EXCEPTION_SECURITY"),
    [IDT_DESC_PIC1                                 ] = str_attach("IDT_DESC_IRQ_MASTER"),
    [IDT_DESC_PIC2                                 ] = str_attach("IDT_DESC_IRQ_SLAVE"),
    [IDT_DESC_INTERRUPT_SYSCALL                    ] = str_attach("IDT_DESC_INTERRUPT_SYSCALL"),
};

