osdev

Solution needed for building a static IDT and GDT at assemble/compile/link time

南楼画角 提交于 2019-12-17 20:24:09
问题 This question is inspired by a problem many have encountered over the years, especially in x86 operating system development. Recently a related NASM question was bumped up by an edit. In that case the person was using NASM and was getting the assemble time error: shift operator may only be applied to scalar values Another related question asks about a problem with GCC code when generating a static IDT at compile time that resulted in the error: initializer element is not constant In both

How to make the kernel for my bootloader?

邮差的信 提交于 2019-12-17 05:08:11
问题 I'm trying to make my own custom OS and I need some help with my code. This is my bootloader.asm : [ORG 0x7c00] start: cli xor ax, ax mov ds, ax mov ss, ax mov es, ax mov [BOOT_DRIVE], dl mov bp, 0x8000 mov sp, bp mov bx, 0x9000 mov dh, 5 mov dl, [BOOT_DRIVE] call load_kernel call enable_A20 call graphics_mode lgdt [gdtr] mov eax, cr0 or al, 1 mov cr0, eax jmp CODE_SEG:init_pm [bits 32] 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,

How to run a program without an operating system?

岁酱吖の 提交于 2019-12-17 02:00:14
问题 How do you run a program all by itself without an operating system running? Can you create assembly programs that the computer can load and run at startup, e.g. boot the computer from a flash drive and it runs the program that is on the CPU? 回答1: How do you run a program all by itself without an operating system running? You place your binary code to a place where processor looks for after rebooting (e.g. address 0 on ARM). Can you create assembly programs that the computer can load and run

How to move cursor with mouse?

流过昼夜 提交于 2019-12-13 07:51:10
问题 I am developing a realmode operating system in x86 assembly. I managed to move cursor with keyboard, but I want to move the cursor with mouse. I don't know how. I found int 33h deals with the mouse, but I can't seem to move the cursor using int 33h. 回答1: Interrupts int 10h to int 1Fh are BIOS interrupts; they can be used before the OS is booted. Interrupts int 20h to int 2Fh are DOS interrupts; they can only be used when DOS has already been loaded. Other interrupts (e.g. int 33h ) are

Bootloader memory location

穿精又带淫゛_ 提交于 2019-12-13 06:17:17
问题 This is a part of a bootloader that I am studying from `[ORG 0x00] [BITS 16] SECTION .text jmp 0x07c0:START ; set CS(segment register) to 0x07C0 and jump to START label. TOTALSECTORCOUNT: dw 0x02 KERNEL32SECTORCOUNT: dw 0x02 START: mov ax, 0x07c0 mov ds, ax ; set DS(segment register) to the address of the bootloader. mov ax, 0xb800 mov es, ax ; set ES(segment register) to the address of the video memory starting address. ; stack initialization mov ax, 0x0000 mov ss, ax mov sp, 0xfffe mov bp,

Compiling + linking a custom OS with Cygwin gcc: Unrecognized emulation mode: elf_i386

馋奶兔 提交于 2019-12-12 14:49:53
问题 I have a bootloader written in assembly ( boot.s ) and a kernel written in c ( kernel.c ). I also have some other files such as: linker.ld and grub.cfg but I have no clue how to use them... My Problem: If i run: gcc -g -m32 -c -ffreestanding -o kernel.o kernel.c -lgcc ld -melf_i386 -Tlinker.ld -nostdlib --nmagic -o kernel.elf kernel.o objcopy -O binary kernel.elf kernel.bin i get the Error: ld: Unrecognized emulation mode: elf_i386 PS.: Im using Windows 10 Pro 32Bit and also have VirtualBox

Cannot modify data segment register. When tried General Protection Error is thrown

我的未来我决定 提交于 2019-12-12 11:43:13
问题 I have been trying to create an ISR handler following this tutorial by James Molloy but I got stuck. Whenever I throw a software interrupt, general purpose registers and the data segment register is pushed onto the stack with the variables automatically pushed by the CPU. Then the data segment is changed to the value of 0x10 (Kernel Data Segment Descriptor) so the privilege levels are changed. Then after the handler returns those values are pop ed. But whenever the value in ds is changed a

How to write a simple soundblaster 16 driver using direct write mode for a hobby OS?

梦想的初衷 提交于 2019-12-12 10:40:57
问题 I am developing a 32 bit, protected mode hobby operating system. At the moment, I am looking to add simple sound support. To do this, I'm looking to use the sound blaster 16 and use the direct mode to write to the DAC (I want to avoid DMA at all costs). However, when I output a simple square wave to the DAC (using command 0x10), no sound is output from my computer's speakers. I'm looking for a solution to this problem. I am trying to use the following algorithm to produce sound: 1. Reset DSP

For kernel/OS is C still it? [closed]

蹲街弑〆低调 提交于 2019-12-12 07:08:37
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I like operating systems and would eventually like to become a OS developer mostly working on kernels. In the future will C still be the language of choice and what else should I be trying to learn? 回答1: I think it's safe to say that low-level parts of operating systems (e.g.

Operating System debugger for Ubuntu 11.10

混江龙づ霸主 提交于 2019-12-12 04:57:45
问题 I've been doing operating system development (not building a Linux kernel), and have gotten to the point where I need a debugger, for my latest OS. I've tried Bochs (under my Win 7 partition), but that wouldn't recognize my USB (It's unformatted, I'm reading specific sectors right now.) and I would rather do something under Ubuntu 11.10. Is there a Debugger that would let me debug a custom build OS for Ubuntu 11.10? 回答1: Personally, I use QEMU for debugging a custom OS (which has USB support)