Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QEMU Crashes When Loading Kernel

I've created a C kernel, and I'm loading the kernel in the QEMU emulator. But when I load the kernel, it seems to crash QEMU and it complains that it can't access the kvm folder. Does it mean that kvm is missing, or that I'm not as an administrator; because I logged in as a root administrator. Here is the error information, that originated from the Terminal:

danny@ubuntu:~/Desktop$ sudo qemu -kernel os.bin
open /dev/kvm: No such file or directory
Could not initialize KVM, will disable KVM support
pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"
qemu: fatal: Trying to execute code outside RAM or ROM at 0x000a0000

EAX=00004500 EBX=00000000 ECX=00000000 EDX=00000000
ESI=00000000 EDI=00000000 EBP=00000000 ESP=00009fe0
EIP=0000fdfb EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =9000 00090000 ffffffff 00cf9300
CS =9020 00090200 0000ffff 00009b0f
SS =9000 00090000 0000ffff 00009300
DS =9000 00090000 0000ffff 00009300
FS =9000 00090000 0000ffff 00009300
GS =9000 00090000 0000ffff 00009300
LDT=0000 00000000 0000ffff 00008200
TR =0000 00000000 0000ffff 00008b00
GDT=     000cba40 00000017
IDT=     00000000 000003ff
CR0=00000010 CR2=00000000 CR3=00000000 CR4=00000000
DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000 
DR6=ffff0ff0 DR7=00000400
CCS=00004500 CCD=00004546 CCO=ADDB    
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
Aborted

The error also seems to show information, that seems to be NASM registers, and it complains that it couldn't find a ROM file. So could anyone please tell me what I'm doing wrong, I'd appreciate your time, and effort.

like image 279
Daniel Lopez Avatar asked Jan 07 '11 23:01

Daniel Lopez


1 Answers

The suggestion made by Ben Voigt is not your problem. I have the exact same output when I run my kernel and it doesn't cause any problems.

The reason QEMU aborts is the following:

qemu: fatal: Trying to execute code outside RAM or ROM at 0x000a0000

This means your kernel tries to execute code from an invalid memory location. Thus, it's a bug in your kernel and has nothing to do with QEMU.

Edit: Just a hint on where your bug may be. Looking at your register dump, it is clear that the last executed instruction is just below 640K (at 0x9fffb). On my machine, QEMU reports all memory between 637K and 1M as unavailable. You always have to be careful not to use unavailable memory. A safe bet is to just stay below 637K until you are able to get a memory map and know what memory you can use.

like image 81
mtvec Avatar answered Nov 08 '22 21:11

mtvec