Opened 5 years ago
Last modified 5 years ago
#19402 new defect
GuruMeditation in a simple hobby operating system
| Reported by: | Mariana89 | Owned by: | |
|---|---|---|---|
| Component: | other | Version: | VirtualBox 6.1.0 |
| Keywords: | int 13h guru meditation | Cc: | |
| Guest type: | other | Host type: | other |
Description
I was developing a hobby operating system that only loads a doubleword from disk to print it, buteven though the value was correctly printed to screen, I also got a GuruMeditation error.
This is the command I execute every time I make any change to the source code to compile and test my kernel:
mkdir vbox ; \
VBoxManage controlvm "X" poweroff ; \
sleep 1 ; \
VBoxManage unregistervm "e0b08add-d834-4af5-89e8-05abec11aa78" ; \
rm -r vbox/X kernel kernel.raw kernel.vdi ; \
VBoxManage createvm \
--name "X" \
--ostype "Other" \
--register \
--basefolder "$(pwd)/vbox" \
--uuid "e0b08add-d834-4af5-89e8-05abec11aa78" \
--default ; \
VBoxManage modifyvm "e0b08add-d834-4af5-89e8-05abec11aa78" \
--usbxhci on \
--memory 8 ; \
nasm -l kernel.lst kernel.asm ; \
dd if=/dev/zero of=kernel.raw bs=1024 count=2048 ; \
dd if=kernel of=kernel.raw conv=notrunc ; \
VBoxManage convertfromraw kernel.raw kernel.vdi --format VDI ; \
VBoxManage storageattach "X" \
--storagectl "IDE" \
--port 0 \
--device 0 \
--type hdd \
--medium "$(pwd)"/kernel.vdi ; \
VBoxManage startvm "X" ;
This is the source code of my kernel (also attached to this ticket as kernel.asm):
VGA_MEMORY equ 0xB8000
BLACK equ 0x0
BLUE equ 0x1
GREEN equ 0x2
CYAN equ 0x3
RED equ 0x4
MAGENTA equ 0x5
BROWN equ 0x6
LIGHT_GREY equ 0x7
DARK_GREY equ 0x8
LIGHT_BLUE equ 0x9
LIGHT_GREEN equ 0xA
LIGHT_CYAN equ 0xB
LIGHT_RED equ 0xC
LIGHT_MAGENTA equ 0xD
LIGHT_BROWN equ 0xE
WHITE equ 0xF
org 0x7C00
bits 16
mov ax, VGA_MEMORY >> 4
mov es, ax
mov ax, 0x07E0
mov ss, ax
mov esp, 0xFFF0
mov ax, 0
mov ds, ax
; Disable the annoying cursor
mov ah, 0x01
mov ch, 001_11111b
int 0x10
reset_disk_hdd:
mov ah, 0x00 ; reset function
int 0x13 ; disk int
jc reset_disk_hdd
mov ax, 00h
mov ds, ax
mov si, disk_address_packet
read_disk_hdd:
mov ah, 42h ; read function
int 0x13 ; disk int
jc read_disk_hdd
mov ax, VGA_MEMORY >> 4
mov es, ax
mov ax, [0x7E00]
mov [es:0x00], ax
jmp $
disk_address_packet:
db 10h ; size of DAP (set this to 10h)
db 00h ; unused, should be zero
dw 44h ; number of sectors to be read
dd 0x0000_7E00 ; segment:offset pointer to the memory buffer to which sectors will be transferred
dq 01h ; absolute number of the start of the sectors to be read
times 510-($-$$) db 0
dw 0xAA55
dw (RED << 4 | GREEN) << 8 | 'P'
Apparently, when the number of sectors to be read is lower than 44h the guru meditation error disappear, but when it is 43h instead of 44h, it only appear sometimes.
Attachments (4)
Change History (5)
by , 5 years ago
| Attachment: | kernel.asm added |
|---|
comment:1 by , 5 years ago
While creating this ticket, I selected as component 'other' because I wasn't sure, but I think the component should be 'Hard disk' since this happens while reading from the hard disk.


The source code of the kernel