osdev

Scan the keyboard to obtain scan codes

最后都变了- 提交于 2019-12-12 04:49:20
问题 So I'm learning how to make an OS. The problem is that every website says to scan the keyboard to obtain the scancodes in order to detect input. How do I 'scan' the keyboard? I know this question seems very ridiculous, but I really don't know how to do that, and I need help. I also have to mention that I googled it a lot. 回答1: Example for polling the keyboard port without using an ISR (x86-CPU): cli mov al, 2 ; dissable IRQ 1 out 21h, al sti ;---------------------------------------------

Linker script not Settting the origin Correctly

谁说我不能喝 提交于 2019-12-12 04:37:24
问题 I have been working on linking my C++ Kernel to my x86 Assembly Stage2 and It links without any errors but the problem is that When I boot up My OS on Virtual box it doesen't jump to Stage2 which leads me to believe that something is wrong with my linker script before I tried to link the C++ kernel to my assembly code I used: org 0x200 and it worked but when linking you need an elf executable and elf format does not allow the use of the org directive so I now use for the linker : global

Are so many keyboard controller wait calls needed when enabling the A20 gate

情到浓时终转凉″ 提交于 2019-12-12 01:09:23
问题 From the OSDev page on the A20 line, the code for enabling A20 is given as: enable_A20: cli call a20wait mov al,0xAD out 0x64,al call a20wait mov al,0xD0 out 0x64,al call a20wait2 in al,0x60 push eax call a20wait mov al,0xD1 out 0x64,al call a20wait pop eax or al,2 out 0x60,al call a20wait mov al,0xAE out 0x64,al call a20wait sti ret a20wait: in al,0x64 test al,2 jnz a20wait ret a20wait2: in al,0x64 test al,1 jz a20wait2 ret a20wait waits on the input buffer and a20wait2 on the output buffer.

Why does address range 0xC0000000 ~ 0xFFFFFFFF always give 0x00 or 0xFF after switching to protected mode before enabling paging?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 19:09:14
问题 I'm making a custom boot loader, and currently in the stage of enabling paging after switching to protected mode. I tried to check all memory range is usable from 0x00000000 to 0xFFFFFFFF to make sure my kernel has full control over memories. Checking is done by copying value to the memory address and printing the value through video memory(0xB8000). But the address range from 0xC0000000 to 0xFFFFFFFF always contains 0x00(if executed by QEMU) or 0xFF(if executed in real hardware through

Something strange with pointer to video memory (0xB8000) [duplicate]

冷暖自知 提交于 2019-12-11 10:56:07
问题 This question already has an answer here : Why does passing a char to a function change it's value in c? (1 answer) Closed 5 months ago . I am writing an OS. I created pointer to video area in a RAM (0xb8000). But I have some problems with writing to to the screen. To make it works (just writing letters) I have to write to memory with offset by 1 (like mem[1] = char , mem[2] = colour ). And that worked fine. But when i need to implement scroll i got to copy from one part of memory to another.

To access PCB of process in C

一世执手 提交于 2019-12-11 08:35:18
问题 I am working in Linux and i have a little bit confusion that whether i can access the PCB of process or not? if yes then what content of it we can access it and print them on to the terminal and if not then why not? thanks for answering ..... 回答1: If by PCB, you mean the Process Control Block, yes and no... No , because it's in the kernel address space and cannot be accessed directly by user processes. The kernel makes some information from the PCB available under /proc - see the manpage for

IRQ 6 floppy disk controller interrupt not triggered

拜拜、爱过 提交于 2019-12-11 07:00:03
问题 For some reason, IRQ 6 never hits in my Qemu, Bochs, VMWare, or VirtualBox emulators. Do I need some type of virtual Floppy Drive or something? Here is my IRq6 handler: void i86_flpy_irq (struct regs *r) { //! irq fired _FloppyDiskIRQ = 1; printf("IRQ 6 HIT"); } It never says "IRQ 6 HIT", and not only that, in my install function for my irq6 where I call in kernel: void flpydsk_install (int irq) { //! install irq handler install_handler_irq (irq, i86_flpy_irq); //! initialize the DMA for FDC

Assembly: boot loader for custom OS keyboard support

大憨熊 提交于 2019-12-11 03:22:43
问题 I have a working simple custom OS (doesn't do much for now :D). Right now i'm using an assembly file (boot.s) that has no keyboard support. The assembly file (boot.s): # set magic number to 0x1BADB002 to identified by bootloader .set MAGIC, 0x1BADB002 # set flags to 0 .set FLAGS, 0 # set the checksum .set CHECKSUM, -(MAGIC + FLAGS) # set multiboot enabled .section .multiboot # define type to long for each data defined as above .long MAGIC .long FLAGS .long CHECKSUM # set the stack bottom

What language is used to write operating systems (Windows)? [closed]

旧时模样 提交于 2019-12-11 02:56:00
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 9 years ago . What is the language used to write operating systems (Windows) or a boot CD? 回答1: Boot loaders are usually written in Assembly, as well as low-level kernel parts, like hardware drivers. The kernel itself can be written in different languages, like Assembly, C or C++. 回答2: Maybe you want to look into the

How to tell to qemu to copy the ram into a file

╄→гoц情女王★ 提交于 2019-12-11 02:43:53
问题 I am making an OS and I am debugging it using the Qemu. I want a way to read some big blocks of the ram at the end of some instructions. How to do that? Can say to Qemu to copy the ram into a file? If not what I can do? 回答1: qmp or hmp command dump-guest-memory . 来源: https://stackoverflow.com/questions/45397607/how-to-tell-to-qemu-to-copy-the-ram-into-a-file