Questions tagged [osdev]

Operating System development: kernel, shell, networking, cross-compiling, etc.

An operating system is the base software that runs atop computers. It has at least two important roles:

  • it manages access to the underlying hardware, regulating competing access to the same resources from multiple programs;
  • it presents an extended machine for programs that is easy to understand and use.

Operating system development comprises several topics, like:

  • kernel;
  • supporting operating system utilities (e.g. the shell, networking, etc.);
  • cross compiling.

Resources

This community wiki contains links to several interesting resources and courses to get started on operating system development:

What are some resources for getting started in operating system development?

1093 questions
6
votes
1 answer

Can't jump or call kernel loaded at 0x8000

I am trying to develop an operating system. The design is this: I have a bootloader loaded at 0x7c00 which loads the second stage and jumps to it at 0x7e00. The second stage is also in real mode and does a lot of stuff such as loading gdt, enabling…
Ajay
  • 318
  • 2
  • 11
6
votes
1 answer

Write::write_fmt doesn't work properly on bare metal

On x86_64 architectures, the write! macro works as expected with string arguments, but not with integers. When an integer argument is used, I get a strange loop (e.g. write!(writer, "Hello {}!", 123) produces infinite "Hello Hello Hello..."). On…
ababo
  • 1,490
  • 1
  • 10
  • 24
6
votes
0 answers

Weird linker behavior: relocation truncated to fit

I have a linker script for a kernel with two absolute symbols: _kernel_start and _kernel_end. However, I get a linker relocation error for only _kernel_end: In function…
Daniel A.A. Pelsmaeker
  • 47,471
  • 20
  • 111
  • 157
6
votes
2 answers

How does an OS generally go about managing kernel memory and page handling?

I'm working on kernel design, and I've got some questions concerning paging. The basic idea that I have so far is this: Each program gets its own (or so it thinks) 4G of memory, minus a section somewhere that I reserve for kernel functions that the…
Blank
  • 7,088
  • 12
  • 49
  • 69
6
votes
5 answers

RTC vs PIT for scheduler

My professor said that it is recommended to use the PIT instead of the RTC to implement a epoch based round robin scheduler. He didn't really mention any concrete reasons and I can't think of any either. Any thoughts?
Sid
  • 1,239
  • 2
  • 13
  • 36
6
votes
1 answer

Why do interrupts need to be disabled before switching to protected mode from real mode?

I saw in many many oses (and some bootloader), they all disable interrupt (cli) before switch to protected mode from real mode. Why we need do that?
Bình Nguyên
  • 2,252
  • 6
  • 32
  • 47
6
votes
2 answers

Self contained C routine to print string

I would like to make a self contained C function that prints a string. This would be part of an operating system, so I can't use stdio.h. How would I make a function that prints the string I pass to it without using stdio.h? Would I have to write it…
user2151887
  • 457
  • 1
  • 6
  • 9
6
votes
2 answers

Does booting in EFI mode mean that I shall not have access to BIOS interrupts?

I am attempting to develop a simple OS. I have done some assembly programs before and have had to use INT 10h to display characters to the screen. I understand that UEFI has support for legacy BIOS and may still be able to use INT 10h services.…
Lord Loh.
  • 2,437
  • 7
  • 39
  • 64
6
votes
2 answers

Simple C Kernel char Pointers Aren't Working

I am trying to make a simple kernel using C. Everything loads and works fine, and I can access the video memory and display characters, but when i try to implement a simple puts function for some reason it doesn't work. I've tried my own code and…
Hophat Abc
  • 5,203
  • 3
  • 18
  • 18
5
votes
1 answer

kernel mode and memory protection

in Operating System User mode application's virtual address space is private, one application cannot alter data that belongs to another application. Each application runs in isolation, and if an application crashes, the crash is limited to that one…
A S
  • 55
  • 1
  • 4
5
votes
1 answer

CPUID on multiple cores/NUMA

I am working on CPU detection and general environment detection code for my hobby OS. Is there ever a case where CPUID needs to be called multiple times? That is if the system has multiple cores, does the OS need to call CPUID on each core? Same for…
nixeagle
  • 1,002
  • 8
  • 17
5
votes
1 answer

What is the proper way to acknowledge an ATA/IDE interrupt?

I am currently working on a hobby OS, specifically the ATA driver. I am having some issues with PIO data-in commands with interrupts. I am trying to execute the READ MULTIPLE command to read multiple sectors from the drive, block by block, with an…
Mr. Shickadance
  • 5,283
  • 9
  • 45
  • 61
5
votes
1 answer

Why would one use "ret" instead of "call" to call a method?

While reading and learning from open source OSes I stumbled across an extremely complicated way of calling a "method" in assembly. It uses the 'ret' instruction to call a library method doing this: push rbp ; rsp[1] = rbp mov rbp,…
RAVN Mateus
  • 560
  • 3
  • 13
5
votes
1 answer

Placing an instruction in the address pointed by the reset vector using times and align NASM directives

I've been thinking for a while about the following assembly code (NASM IA-32): ORG 0xFF000 ; This is (1MB - 4KB) 0x100000 - 0x1000=0xFF000. USE16 ;produce 16bit code code_size EQU (end -init_16) ; calculates code length times (4096-code_size) db…
Gaston
  • 63
  • 4
5
votes
2 answers

GDB-remote + qemu reports unexpected memory address for static C variable

Remote debugging a code running in Qemu with GDB, based on an os-dev tutorial. My version is here. The problem only happens when remote-debugging code inside qemu, not when building a normal executable to run directly inside GDB under the normal…
itarato
  • 795
  • 1
  • 8
  • 24