333 questions with no answers
0
votes
0
answers
127
views
Why are interrupts not triggered during an infinite printing loop task
Specifically, I have two tasks fn and fn1 that are being run by a scheduler. The code for each is below:
int fn(void *arg)
{
for(;;) {
printf("a");
}
return 6;
}
int fn2(void *arg)...
3
votes
0
answers
236
views
Does the CS register need to be set when setting up Unreal Mode?
The OSDev Wiki describes the general procedure of switching to unreal mode, with an example bootloader:
ORG 0x7c00 ; add to offsets
start:
xor ax, ax ; make it zero
...
1
vote
0
answers
73
views
variable won't update in ISR
this is an ISR that gets executed whenever an IRQ1 is fired, but something weird is happening the data at memory location 0xb8100 is not updating, but IRQ1 is firing and the ISR is executing (I ...
1
vote
0
answers
105
views
Is there a way to jump to long mode using an indirect jump?
I am writing an operating system and have just started the other CPUs, so I am in assembly on each now. I have set up long mode and now I just need to perform a far jump. However, when I try to do any ...
0
votes
0
answers
114
views
Can't mask IRQ using PIC
I've been trying to setup interrupts in an x86_64 protected mode kernel in order to use the keyboard interrupt. I have loaded the IDT, remapped the PIC, the keyboard IRQ works but I keep receiving INT ...
1
vote
0
answers
73
views
why my os doesn't switch to protected mode
I started creating an os entirely in assembly thinking I wanted to do it completely in real-mode, but as soon as I realized the limitations I had, I decided to create the bootloader in real-mode and ...
0
votes
0
answers
87
views
Why is my boot-loader crashing on far jump into protected mode?
I have trying to boot into a kernel made in C. I have been learning and attempting to make a functional boot loader for a while now, however it always fails in one spot or another. I am using the gnu ...
0
votes
0
answers
43
views
Adding hardware interrupts handeling breaks the program
I'm working on a simple OS and I've managed to set up the IDT table and now I'm working on hardware interrupts and the PIC's.
In isr.c there is an array of functions and the isr handler calls the ...
0
votes
0
answers
155
views
display library 'carbon' not available
i'm currently making an os, and have an issue, and wanna debug what's going on. I'm on mac, i use bochs.
So basically i ran bochs -f bochs_config, and bochs_config:
megs: 128
romimage: file=/usr/local/...
0
votes
0
answers
92
views
Is there a way to tell the kernel to use an offset at runtime
I am trying to write a OS and make it total with something new, take ideas from my mind and just dont copy from the internet i have done it everywhere i could as memory management process creation, ...
1
vote
0
answers
79
views
Qemu: booting failed
I started making an OS entirely in assembly (by my choice) but when you run it it doesn't work.
There are the files..
bootloader.asm:
section .text
global _start
_start:
cli
xor ax, ...
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
...
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
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
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 ...
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
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
0
answers
257
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 ...
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
473
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" ...
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 ...
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
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
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 ...
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 ...
0
votes
0
answers
60
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 ...
0
votes
0
answers
129
views
wrong section order when linking flat binary
So I'm trying to link 16-bit assembly code which jumps to 64-bit rust code.
It worked before but now it for some reason doesn't work.
So Assembly code that boot sector program should run is in _start ...
0
votes
0
answers
247
views
Trouble enabling paging in simple kernel written in NASM
I am writing a basic kernel to learn and am having difficulty enabling paging, so that I can work in long mode.
I slimmed down my code for simplicity.
boot.asm:
;=======================================...
0
votes
0
answers
79
views
kernel development, physical addresses and virtual addresses
I'm writing an operating system (kernel) as a hobby and I have a problem with the "boot boot" bootloader:
When my kernel's main() is loaded I retrieve screen pointers to display text on the ...
0
votes
0
answers
95
views
64 bit mode pixel outputting does not work (mov es, ax) vm crashes
So I switched directly to 64-bit mode because it was easier. But I want to output pixels, and the command move es, ax crashes my computer (a key part of the pixel output code). And I realized that ...
0
votes
0
answers
491
views
gate descriptor is not valid sys seg
i use Bochs to emulate my kernel. I wrote IDT struct, load_idt function and keyboard handler procedure. Print handler, called by keyboard handler, just read 0x60 port and put char on screen.
When ...
0
votes
0
answers
82
views
Ata interrupts fires constantly on real hardware
I have been writing some ata stuff recently. On real hardware the ata controller uses IRQ_11. To get the driver to work I had to mask IRQ_11 because it would constantly fire after issuing the identify ...
0
votes
0
answers
459
views
gcc run asm in real mode (kernel development)
I have been following the Osdev wiki, and I'm trying to follow their "inline assembly" page. I want to use BIOS in my code, but when I try, it crashes the kernel and returns to the bootloader (which ...
0
votes
0
answers
59
views
Jumping out of the bootloader to the next sector
I have a function "outside" which is placed on the 2nd sector of the hard drive and I want to access it after executing all the needed stuff in my bootloader. But after reading 2nd sector ...
0
votes
0
answers
376
views
Why does ARM not support the full physical address space in LPAE mode?
I know that the ARM 32-bit (AArch32) architecture supports 2 types of page tables: the short format (which has 32-bit table entries) and the long format (which has 64-bit table entries and is known as ...
0
votes
0
answers
79
views
In my custom kernel, for my IDE disk-read operations I have to multiply the LBA by 2
For my disk-read function,
int ide_read_sectors(uint8 drive, uint8 num_sectors, uint32 lba, uint32 buffer)
, the function works as it should for certain small LBA numbers, and then after a while, for ...
0
votes
0
answers
230
views
Rust-based kernel triggers a "Invalid Opcode" interrupt
Said kernel is from this repo in src/kernel/core/main.rs.
The bootloader is from the same repo in src/bootloader/bootloader.c.
The steps the bootloader takes are:
Do UEFI functionality checks
Get a ...
0
votes
0
answers
508
views
"undefined" label references in AS assembler
I have been trying to use a collection of various resources recently (mostly https://wiki.osdev.org and https://www.osdever.net). And currently I am trying to initialize a GDT in my assembly file boot....
0
votes
0
answers
1k
views
Inline assembly: Saving the stack pointer on ARM
I'm working on building an RTOS from the ground up and getting stuck on some of the inline assembly used for the context switch. I have a thread object that currently stores the stack pointer for that ...