1,249 questions
3
votes
2
answers
122
views
How can I correctly load the kernel to its canonical high address space
I am working on a small os with a custom boot loader targeting BIOS. For this, I need to map the kernel to its canonical high address space (0xFFFFFFFF80000000) and jump to its entry point.
For this, ...
2
votes
1
answer
135
views
OSDev: Stuck at adding GDT
I've followed the book OS01 by Tuhdo, kind of made a simple bootloader, that loads the kernel. Then I tried to add some code to set up GDT, but I've witnessed unusual behavior in gdb.
Here I stopped ...
15
votes
1
answer
394
views
Using OUTB to set cursor position in my minimal OS kernel causes QEMU screen to flicker
I am getting started with a minimal OS kernel (just gdt and place holder idt). Using i386 assembly and freestanding C. I wanted to change the position of the cursor for which i found several sites ...
3
votes
1
answer
151
views
INT 13, AH=42h fails with AH=1, CF=1
I am trying to write a simple bootloader which loads my program from LBA=1 into memory and jumps to its start. I emulate my bootloader in qemu with -drive flag passed. When I try to read blocks from ...
2
votes
1
answer
76
views
Double fault when i enable interrupts (via sti)
im making an os kernel in zig (grub to boot) and im trying to get interrupts to work specifically hardware interrupts and as soon as i enable them (i have a pic, gdt and idt setup) it gives me a ...
2
votes
0
answers
109
views
Mouse Cursor in 16-bit Assembly (NASM) Overwrites Screen Content in VGA Mode 0x12
I'm developing a PS/2 mouse driver in 16-bit assembly (NASM) for a custom operating system running in VGA mode 0x12 (640x480, 16 colors). The driver initializes the mouse, handles mouse events, and ...
0
votes
0
answers
92
views
OSDev (NASM/QEMU): VGA Text Output Cut Off in Protected Mode
I've embarked on the exciting journey of OS development, following the tutorials on BrokenThorn.com. It's an older resource, but I've found it to be incredibly insightful for learning the ropes.
I've ...
1
vote
1
answer
159
views
In kernel development, why do developers avoid pasting in high level libraries directly to the kernel?
Context: I am a somewhat seasoned C++ and Python developer, and a beginner in Rust with no experience in assembly or machine code following the blogOS guide trying to create a minimal kernel that ...
1
vote
0
answers
150
views
Function Call leads to infinite loop
I've been trying to get a program running on the QEMU emulator. The issue is that when I pass an empty string or a non-empty string to the print function, the program prints ABC indefinitely.
#[unsafe(...
3
votes
1
answer
85
views
Why does working Assembly code not work when loaded into different memory by disk read?
Problem
I have assembly code that switches to 32bit mode and prints a character successfully when I have it inside the boot sector -
But when I use a disk read to load the code to the next sector the ...
0
votes
1
answer
48
views
Placement of %include in my NASM bootloader affects program behavior
I am learning to write a 16-bit bootloader using NASM with BIOS interrupts to print strings to the screen. I’ve created a simple print subroutine in an external file (printer.asm), and I'm using %...
1
vote
1
answer
99
views
How to enable paging in x86 Protected Mode
I'm progressing along developing my OS, and I recently implemented a virtual memory manager that handles paging. I used 2 Page Tables: (1) to identity map the first 4 MB and (2) to map the kernel (...
2
votes
1
answer
170
views
x86 Page Fault with error code 0 when PRESENT flag is enabled and CR3 is correctly set
I'm developing an operating system and I'm taking 'Nanobyte OS' as a base because I had trouble with the toolchain and compilation system. The problem comes when loading an ELF, because it throws a ...
0
votes
1
answer
109
views
Why is a memset causing my higher-half kernel to page (interrupt 14)?
Currently, a memset to kernel_dir is causing my kernel to page fault. The kernel is a higher-half kernel, and is mapped to 0xC0000000 in virtual memory.
#include "paging.h"
#include "...
4
votes
1
answer
109
views
How do I get the x86 current CPU mode (code bit size) using the GDB remote protocol?
I'm running qemu-system-i386 -s -S -singlestep (and sometimes qemu-system-x86_64), and I connect to it over TCP to address 127.0.0.1:1234 using the GDB remote protocol. I issue the g command to get (...
1
vote
0
answers
62
views
What is causing the GPF error during switching into user mode?
I am developing a x86 architecture based 64 bit Operating System. I have implemented GDT(Null, Kernel-code, kernel-data, user-code, user-data, tss) . Now I want to switch into user space(Lower half ...
1
vote
0
answers
67
views
Bootloader Fails to Load More Than 53 Sectors Despite Modifications
https://github.com/UdayKhare09/EXO_OS is my repo.
I am working on a custom bootloader for my operating system, and I am encountering an issue where the bootloader fails to load more than 53 sectors ...
1
vote
0
answers
88
views
KVM crashes with General Protection Fault when enabling paging in my 32-bit kernel. OSDEV
I'm writing a 32-bit OS kernel with support for PAE paging. When I enable paging with mov %eax, %cr0 (setting the PG bit), the kernel works fine under QEMU with TCG, but crashes with a General ...
4
votes
1
answer
134
views
Can't get welcome messages to load in QEMU
I am trying to make my own OS and am currently stuck on one tiny problem.
My welcome messages are not loading in the terminal.
Other than that, everything seems to work fine. (I'm not too sure, so ...
1
vote
1
answer
85
views
My Multiboot Info Structure is not correct. Why?
I am trying to write a physical allocator, and to do so I need the base address for available memory, the high address for available memory, and a memory map. This is all provided to me by the BIOS (...
3
votes
1
answer
59
views
NASM+WCC+WLINK (OW 1.9): strange error addressing CONST data (wrong/even addressing)
I'm porting a tiny experimental 80286 kernel from pure assembler (NASM) to assembler+C (NASM+Open Watcom 1.9). Boot sector code loads the BIN kernel image at address 0x010000 and then jumps to that ...
2
votes
0
answers
78
views
How could I resolve this round robin process switching?
I have made three threads inside of process init_thread, thread1, thread2 by below code
void init_processes() {
// Create the init process
process_t *process = create_process("process0&...
3
votes
1
answer
89
views
Custom Bootloader Fails to Load C Kernel (kernel.c), But Works with Assembly (kernel.asm)
I'm writing a custom OS with my own bootloader and trying to switch from an assembly-based kernel (kernel.asm) to a C-based kernel (kernel.c).
When using kernel.asm, everything works fine. But when I ...
0
votes
0
answers
41
views
Why does`LAPIC_SVR`, `LAPIC_TDCR`, `LAPIC_TICR`, `LAPIC_TCCR`, address value is zero even after write?
I am trying to enable periodic APIC Timer in x86 architecture based 64 bit OS.
void apic_timer_init(uint32_t frequency) {
disable_interrupts();
// Ensure APIC is enabled (set Spurious ...
2
votes
0
answers
99
views
Updating the Linear Frame Buffer much slower on real hardware than QEMU
I am currently booting my system into a 640x480x32b VESA mode with a linear frame buffer.
Using the following code, I flash red and green on the screen:
void clear(Color color) {
u8* cursor = ...