1,252 questions
1
vote
1
answer
224
views
mcopy alternatives for windows users
I am trying to compile a custom operating system by following a youtube tutorial. However the video instructs using mcopy, from gnu mtools, of which I cannot seem to install using the package managers ...
0
votes
1
answer
238
views
bochs: fetch_raw_descriptor: GDT: index (bf) 17 > limit (17)
I'm trying to make a simple OS and I'm currently working on interrupts and the IDT.
So I implemented the IDT and a default exception handler that currently doe's nothing.
And when I run my OS in bochs ...
0
votes
0
answers
342
views
KVM internal error suberror 1 when filling the CR3 register
I'm working on a x64 uefi bootloader to load a hobby OS. I'm running on AMD (Ryzen 7 5700G) with kvm, and when I try to fill the CR3 register with my PML4, I get a KVM internal error with 5 extra data
...
1
vote
1
answer
748
views
GRUB not Switching to Graphics Mode in Custom OS Development
I am developing a custom operating system and using the GRUB bootloader to load my kernel. In my development process, I've encountered an issue where I am unable to switch the display mode from text ...
0
votes
0
answers
139
views
qemu exit unexpectedly when I set PE and mov cr0, ax to enable the protected mode
; ---------- GDT ----------
GDT_BASE:
dd 0x00000000
dd 0x00000000
CODE_DESC:
dd 0x0000ffff
dd DESK_CODE_HIGH4
DATA_STACK_DECK:
dd 0x0000ffff
dd DESK_DATA_HIGH4
VIDEO_DESC:
...
0
votes
0
answers
209
views
using Nasm and gcc on windows (MinGW) for osdev
I am currently creating a simple kernel and I just jumped to using C with the GCC(MinGW) compiler on windows. but the way I am using C with assembly is kind of problematic here is what I am doing :
:: ...
0
votes
0
answers
199
views
Jump from bootloader to the kernel - Assembly x86_64
I want to make a text-os only with assembly. I created a simple bootloader, but now I don't know how to start my kernel. Can you please help me with any example (if it's possible with a practical ...
0
votes
0
answers
213
views
How to write a driver that can work with all graphics cards
I am writing a simple OS and I am now trying to display stuff on the screen rather than just text. and after a little bit of research this is what I got :
The simplest way to get graphics modes ...
1
vote
1
answer
184
views
A weird problem when transitioning to protected mode
I am trying to switch to protected mode after playing around a little bit with real mode, but something weird occurs. In real mode I have created a simple welcome screen asking the user to enter their ...
0
votes
1
answer
679
views
How can I get keyboard input in (BareBones) C?
I'm in 32bit protected mode (BAREBONES) C I'm making 32bit DOS called YourDOS, but I can't get input.
here is the code for the kernel That I got from a template on repl.it:
#include <stdbool.h>
#...
1
vote
0
answers
90
views
Kernel not loading | Custom OS
I'm trying to make a kernel for an operating system I'm trying to make, however, it seems the kernel isn't being loaded since the kernel is not printing anything like it should
Error I get when using ...
1
vote
0
answers
118
views
osdev linker "file format not recognized"
I'm trying to make a simple OS, so I wrote a small kernel that consist out of a c file an assembly file that calls the main function in the c file.
but when I try to compile and link the two files ...
1
vote
1
answer
109
views
Why is my assembly code not jumping to the loaded code?
I wrote a simple OS / bootloader that loads 4 additional sectors from disk and then jumps to them. But the jump isn't working and the code just hangs.
This is the start.S file
[BITS 16]
[ORG 0x7C00]
...
3
votes
1
answer
198
views
What is the grub/machine include directory in GRUB source code?
I have always wondered how does GRUB 2 work. While reading it's source code, I saw that there are some #include directives which include seemingly nonexistent "grub/machine/...", for example ...
1
vote
0
answers
335
views
What are the possible solutions for the linker errors I face while building a Rust kernel for x86_64 arch in OSDev?
I am trying to build a rust kernel, however i am facing severe issues with the linker, can someone please suggest any solns for this problem. Thank you!
I have made a library crate (initially a binary ...
1
vote
1
answer
372
views
Why does switch to long mode cause VGA text output to behave strangely?
I'm developing a small demo that boots a x86_64 machine. During early init (real mode), I set videomode 3 via int 10h. I then write to memory-mapped text at 0xb8000. My second stage already is high-...
0
votes
0
answers
59
views
How can I detect keypresses in my x86 C kernel OS and call a function with the keycode as a param?
i followed a tutorial series on youtube on how to make an x86_64 kernel.
I wanted to know how i can detect keypresses in my c kernel.
For example, i want it to call a function when a key is pressed ...
0
votes
0
answers
109
views
Connect Boot and Kernel file
I started creating my first OS recently (I'm a complete beginner). I wanted to know how to connect the boot file with the kernel. I tried alone but I couldn't, how can I do?
This is the project:
boot....
0
votes
0
answers
90
views
Bochs crashes when I load my kernel at 0x8000
I am developing a 32 bit operating system. I have just implemented paging but came across a problem. My GDT was getting overwritten. That problem was fixed in a previous question. To fix it, I had to ...
1
vote
1
answer
71
views
Why my print function doesn't print my string?
I just started creating my first operating system, I wanted to start with a very simple bootloader that basically just prints a very simple string. But I can't figure out why, whatever string, the ...
1
vote
0
answers
110
views
If I set a register, completely unrelated memory location gets changed
I am creating a 32 bit operating system. I have enabled paging and it works fine, until the kernel_main function returns to the assembly code (which calls the kernel_main function). The assembly code ...
0
votes
0
answers
68
views
Load binary file into flat memory and then jump into it in protected mode
I am trying to build my own hobby operating system and is trying to create load and run flat binary file into the heap and then execute it in protected mode?
I have tried creating a pointer and then ...
0
votes
1
answer
132
views
The machine restarts when it starts its own OS
I am developing my OS from scratch on C. I have a problem that I can't solve for 2-3 months.
When I try to output a pixel, it is not output to the screen. And when I try to call 13h mode for 256 ...
0
votes
1
answer
641
views
How to know where to find the RSDP on a BIOS system?
I'm developing a 32-bit operating system on an IA-32 system (emulator: Bochs). I'm trying to implement a graceful shutdown procedure with ACPI. On the OSDev Wiki, it says that it can either be found ...
1
vote
1
answer
452
views
Get Input Result with int 0x16
I did this simple input function that finished when the user press the enter key:
input:
mov ah, 0x00
int 0x16
cmp al, 0x0d
je enter_press
jne enter_not_press
enter_press:
ret
...
0
votes
0
answers
58
views
Shutdown in assembly [duplicate]
I just started programming in assembly, I started with a simple program with a print, input and new line function. Then I wondered how to shutdown the machine and I found this function online:
...
0
votes
0
answers
256
views
ATA read/write sectors in longmode not working
I am not able to get this working. I got this code from here:
https://wiki.osdev.org/ATA_read/write_sectors
`;=============================================================================
; ATA read ...
0
votes
0
answers
51
views
System keeps rebooting when accessing memory after removing identity memory mapping
I'm writing a custom OS kernel for x86-64. It uses a UEFI boot loader to load the kernel to a random free location provided by the UEFI. In the kernel, it first relocates to a high address direct ...
3
votes
1
answer
707
views
Why does the "push" instruction give me an "invalid opcode" exception? (osdev)
What I'm Doing & What Works
I've been working on my own 32 bit toy kernel in C for a while, and lately I've been fiddling around with executing dynamically defined code, as I'd like to add a ...
0
votes
0
answers
81
views
Video memory not being written to while handling interrupt that was triggered in user mode
Here is the Interrupt handler:
void irsHandler(intData data)
{
char* vm = (char*) 0xb8000;
vm[0] = 'A';
}
When user code triggers an interrupt by int instruction, the handler ...
1
vote
0
answers
472
views
qemu invalid tss type
I am switching to user mode from kernel mode in 32-bit protected mode (only segmentation not paging). When I make the switch and call an interrupt in userspace I get this error from QEMU:
This may ...
1
vote
0
answers
132
views
Why not RIP-relative instruction with GCC -fPIC flag
I was trying to write a custom kernel for x86-64 bare bone on Apple Silicon MacBook using x86_64-elf-gcc compiler.
In one of my header file (Memory.hh), I declared a constant:
extern "C" ...
2
votes
1
answer
978
views
Use symbols from an ELF file while linking an executable
I am working on an operating system, and the problem I am stuck on right now has to do with linking kernel modules.
The Operating system has some kernel mode libc functions like malloc, printf etc. I ...
1
vote
1
answer
416
views
USB2.0 control endpoint stall upon set_configuration request
I'm working on xhci controller driver for a proprietary OS. I'm having a problem with enumerating USB2 devices. USB3 devices get enumerated without issues. Here's what my driver does:
Attach device ...
2
votes
1
answer
284
views
Changing segments to Ring3(user) from Ring0(kernel) results in segmentation fault
I am writing a toy operating system. I am trying to implement memory protection for an operating system. All I want to do is create protection for the kernel from user space programs. I want to do ...
0
votes
1
answer
628
views
Does semihosting work for qemu-system-aarch64?
I am using Rust to code in a [no_std] environment, targeting ARM's aarch64-unknown-none. When I enable -semihosting as stipulated in the qemu-system-aarch64 command options below, I never see any ...
1
vote
0
answers
154
views
initialize_paging(); is causing x86 OS to crash upon startup
I am currently attempting to reinvent the wheel and code an x86 OS using C and GAS assembler.
The OS currently starts up, initializes the GDT and IDT as well as interrupt handlers, then attempts to ...
2
votes
1
answer
382
views
Where in memory will os boot code be loaded when using grub chainloader?
Problem Description
Hi. I want to use grub chainloader to load my minios (an os I developed myself, not linux or windows).
Before using grub chainloader, minios boot process was BIOS->MBR->os ...
0
votes
0
answers
112
views
Waiting for DRQ on ATA driver loops for infinity
i have written a super simple os and i decided to start using grub to boot it, so i started a new projected and im getting my old kernel functions to the new kernel and the ATA driver is not working ...
0
votes
0
answers
65
views
In mbr start.S, does the way the Ax register is set affect subsequent mbr interpretation
As we know, the first step in mbr is to set the segment register to 0. But there can be two methods to set the segment register, first we can use "xorw %ax, %ax" to set AX to 0, and second ...
0
votes
0
answers
466
views
Error in x86_64 kernel: Page fault when trying to write to memory
I'm currently working on an x86_64 kernel as a personal project and I'm running into a page fault error when trying to write to memory. I've checked my code and I believe I've set up my paging ...
1
vote
1
answer
180
views
`Undefined reference` errors when calling a C++ classes' static method from assembly
Here is my code:
interruptstubs.s:
.set IRQ_BASE, 0x20
.section .text
.extern _ZN16InterruptManager15handleInterruptEhj
.global _ZN16InterruptManager22IgnoreInterruptRequestEv
.macro ...
1
vote
0
answers
266
views
QEMU starts blinking with custom boot loader in x86
I'm writing my own boot loader for i386 in NASM for education purposes. But when I'm running qemu with this it starts blinking and do anything but what I want. Here's my code:
; defs.asm
%define ...
0
votes
0
answers
116
views
Getting spurious or garbled ISRs upon startup of x86 OS
I have been working on an x86 OS using GRUB-multiboot as of late and have run into a problem concerning the IDT (or more specifically ISRs). Upon starting up my OS, an ISR is generated and then no ...
1
vote
0
answers
103
views
Qemu restart when I reload the segment registers with Rust inline assembly
I'm currently writing a kernel and I have troubles understanding how to load the GDT. In particular, I tried the following code, but the kernel reboot when it hit an mov R, ax instruction with R any ...
3
votes
1
answer
126
views
Bootloader receives a disk read error when booting on real hardware but not on vmware, qemu, and bochs
I have been writing a x86 bootloader for some while, and have verified that my bootloader works on both bochs and qemu, along with vmware. However, I get a disk read error with an error code of 0x0880 ...
0
votes
2
answers
243
views
MIT opencourseware class assignment 1
I am currently doing the MIT opencourseware OS course (https://ocw.mit.edu/courses/6-828-operating-system-engineering-fall-2012/) and I am struggling with the first class assignment which is ...
1
vote
0
answers
228
views
Only one IRQ comes in upon initializing IDT
I am trying to work on an x86 operating system and coding it in C. My OS uses GRUB-Multiboot and thus far I have been able to get a GDT working.
I am currently working on my IDT and have run into a ...
2
votes
1
answer
710
views
bootloader works on qemu but not on real machine
i have been writting an os for the last weeks and its going fine i decided to try it on a real machine but it doesnt jump to kernel
i have tried to use an hdd instead of an usb stick and it doesnt ...
0
votes
0
answers
59
views
Trying to create simple VMM/bootloader but I'm getting a very simple error in the assembly
As the title says, I'm trying to write a simple boot loader in assembly to help with my virtual machine monitor that I've tried to implement using the D programming language. Can anyone help me ...