nothing works but time to update
This commit is contained in:
18
.vscode/c_cpp_properties.json
vendored
Normal file
18
.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "linux-gcc-x64",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**"
|
||||||
|
],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "${default}",
|
||||||
|
"cppStandard": "${default}",
|
||||||
|
"intelliSenseMode": "linux-gcc-x64",
|
||||||
|
"compilerArgs": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
||||||
24
.vscode/launch.json
vendored
Normal file
24
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "C/C++ Runner: Debug Session",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"externalConsole": false,
|
||||||
|
"cwd": "/home/p7mj/Desktop/ISCCS-1",
|
||||||
|
"program": "/home/p7mj/Desktop/ISCCS-1/build/Debug/outDebug",
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"miDebuggerPath": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
59
.vscode/settings.json
vendored
Normal file
59
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"C_Cpp_Runner.cCompilerPath": "gcc",
|
||||||
|
"C_Cpp_Runner.cppCompilerPath": "g++",
|
||||||
|
"C_Cpp_Runner.debuggerPath": "gdb",
|
||||||
|
"C_Cpp_Runner.cStandard": "",
|
||||||
|
"C_Cpp_Runner.cppStandard": "",
|
||||||
|
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
|
||||||
|
"C_Cpp_Runner.useMsvc": false,
|
||||||
|
"C_Cpp_Runner.warnings": [
|
||||||
|
"-Wall",
|
||||||
|
"-Wextra",
|
||||||
|
"-Wpedantic",
|
||||||
|
"-Wshadow",
|
||||||
|
"-Wformat=2",
|
||||||
|
"-Wcast-align",
|
||||||
|
"-Wconversion",
|
||||||
|
"-Wsign-conversion",
|
||||||
|
"-Wnull-dereference"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.msvcWarnings": [
|
||||||
|
"/W4",
|
||||||
|
"/permissive-",
|
||||||
|
"/w14242",
|
||||||
|
"/w14287",
|
||||||
|
"/w14296",
|
||||||
|
"/w14311",
|
||||||
|
"/w14826",
|
||||||
|
"/w44062",
|
||||||
|
"/w44242",
|
||||||
|
"/w14905",
|
||||||
|
"/w14906",
|
||||||
|
"/w14263",
|
||||||
|
"/w44265",
|
||||||
|
"/w14928"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.enableWarnings": true,
|
||||||
|
"C_Cpp_Runner.warningsAsError": false,
|
||||||
|
"C_Cpp_Runner.compilerArgs": [],
|
||||||
|
"C_Cpp_Runner.linkerArgs": [],
|
||||||
|
"C_Cpp_Runner.includePaths": [],
|
||||||
|
"C_Cpp_Runner.includeSearch": [
|
||||||
|
"*",
|
||||||
|
"**/*"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.excludeSearch": [
|
||||||
|
"**/build",
|
||||||
|
"**/build/**",
|
||||||
|
"**/.*",
|
||||||
|
"**/.*/**",
|
||||||
|
"**/.vscode",
|
||||||
|
"**/.vscode/**"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.useAddressSanitizer": false,
|
||||||
|
"C_Cpp_Runner.useUndefinedSanitizer": false,
|
||||||
|
"C_Cpp_Runner.useLeakSanitizer": false,
|
||||||
|
"C_Cpp_Runner.showCompilationTime": false,
|
||||||
|
"C_Cpp_Runner.useLinkTimeOptimization": false,
|
||||||
|
"C_Cpp_Runner.msvcSecureNoWarnings": false
|
||||||
|
}
|
||||||
61
boot.asm
Normal file
61
boot.asm
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
[bits 16]
|
||||||
|
section .text
|
||||||
|
global _start
|
||||||
|
|
||||||
|
_start:
|
||||||
|
mov [BOOT_DRIVE], dl ; Save the boot drive number provided by BIOS
|
||||||
|
|
||||||
|
mov bp, 0x9000
|
||||||
|
mov sp, bp
|
||||||
|
|
||||||
|
call load_kernel ; Load extra sectors from the disk
|
||||||
|
call switch_to_pm ; Transition to 32-bit mode
|
||||||
|
jmp $
|
||||||
|
|
||||||
|
%include "gdt.asm"
|
||||||
|
|
||||||
|
[bits 16]
|
||||||
|
load_kernel:
|
||||||
|
mov bx, 0x7e00 ; Destination memory address for kernel code
|
||||||
|
mov dh, 30 ; Number of sectors to read
|
||||||
|
mov dl, [BOOT_DRIVE]
|
||||||
|
mov ah, 0x02 ; BIOS read sectors function
|
||||||
|
mov al, dh
|
||||||
|
mov ch, 0x00
|
||||||
|
mov dh, 0x00
|
||||||
|
mov cl, 0x02 ; Start reading from the second sector
|
||||||
|
|
||||||
|
int 0x13 ; Trigger BIOS disk interrupt
|
||||||
|
|
||||||
|
jc disk_error
|
||||||
|
ret
|
||||||
|
|
||||||
|
disk_error:
|
||||||
|
jmp $
|
||||||
|
|
||||||
|
[bits 16]
|
||||||
|
switch_to_pm:
|
||||||
|
cli
|
||||||
|
lgdt [gdt_descriptor]
|
||||||
|
mov eax, cr0
|
||||||
|
or eax, 0x1
|
||||||
|
mov cr0, eax
|
||||||
|
jmp CODE_SEG:init_pm
|
||||||
|
|
||||||
|
[bits 32]
|
||||||
|
extern main
|
||||||
|
init_pm:
|
||||||
|
mov ax, DATA_SEG
|
||||||
|
mov ds, ax
|
||||||
|
mov ss, ax
|
||||||
|
mov es, ax
|
||||||
|
mov fs, ax
|
||||||
|
mov gs, ax
|
||||||
|
|
||||||
|
mov ebp, 0x90000
|
||||||
|
mov esp, ebp
|
||||||
|
|
||||||
|
call main
|
||||||
|
jmp $
|
||||||
|
|
||||||
|
BOOT_DRIVE db 0
|
||||||
29
gdt.asm
Normal file
29
gdt.asm
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
gdt_start:
|
||||||
|
dq 0x0 ; The null descriptor (mandatory)
|
||||||
|
|
||||||
|
; Code Segment Descriptor
|
||||||
|
gdt_code:
|
||||||
|
dw 0xffff ; Limit
|
||||||
|
dw 0x0 ; Base (bits 0-15)
|
||||||
|
db 0x0 ; Base (bits 16-23)
|
||||||
|
db 10011010b ; Access byte
|
||||||
|
db 11001111b ; Flags + Limit (bits 16-19)
|
||||||
|
db 0x0 ; Base (bits 24-31)
|
||||||
|
|
||||||
|
; Data Segment Descriptor
|
||||||
|
gdt_data:
|
||||||
|
dw 0xffff
|
||||||
|
dw 0x0
|
||||||
|
db 0x0
|
||||||
|
db 10010010b
|
||||||
|
db 11001111b
|
||||||
|
db 0x0
|
||||||
|
|
||||||
|
gdt_end:
|
||||||
|
|
||||||
|
gdt_descriptor:
|
||||||
|
dw gdt_end - gdt_start - 1
|
||||||
|
dd gdt_start
|
||||||
|
|
||||||
|
CODE_SEG equ gdt_code - gdt_start
|
||||||
|
DATA_SEG equ gdt_data - gdt_start
|
||||||
25
kernel.c
Normal file
25
kernel.c
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
void clear_screen() {
|
||||||
|
char* video_memory = (char*) 0xb8000;
|
||||||
|
for (int i = 0; i < 80 * 25 * 2; i += 2) {
|
||||||
|
video_memory[i] = ' '; // Clear char
|
||||||
|
video_memory[i+1] = 0x07; // Light grey on black
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_string(char* str, unsigned char color, int line) {
|
||||||
|
char* video_memory = (char*) 0xb8000;
|
||||||
|
int offset = line * 160;
|
||||||
|
|
||||||
|
for (int i = 0; str[i] != '\0'; i++) {
|
||||||
|
video_memory[offset + (i * 2)] = str[i];
|
||||||
|
video_memory[offset + (i * 2) + 1] = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
clear_screen();
|
||||||
|
print_string("Welcome to ISCCS OS!", 0x0a, 1);
|
||||||
|
print_string("Kernel Loaded in 32-bit Protected Mode.", 0x0f, 2);
|
||||||
|
|
||||||
|
while(1);
|
||||||
|
}
|
||||||
22
linker.ld
Normal file
22
linker.ld
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
ENTRY(_start)
|
||||||
|
OUTPUT_FORMAT("binary")
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
/* Start at the BIOS boot address */
|
||||||
|
. = 0x7c00;
|
||||||
|
|
||||||
|
.text : {
|
||||||
|
boot.o(.text) /* Ensure bootloader is at the very beginning */
|
||||||
|
*(.text) /* Compiled C code follows */
|
||||||
|
*(.rodata) /* REQUIRED: Text strings live here */
|
||||||
|
}
|
||||||
|
|
||||||
|
.data : { *(.data) }
|
||||||
|
.bss : { *(.bss) }
|
||||||
|
|
||||||
|
/* Place the 0xAA55 signature exactly at the end of the first 512 bytes */
|
||||||
|
.sig : AT(0x7dfe) {
|
||||||
|
SHORT(0xaa55);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
os-image.bin
Executable file
BIN
os-image.bin
Executable file
Binary file not shown.
Reference in New Issue
Block a user