OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 9:59 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: My OS functions well on VirtualBox but not physical hardware
PostPosted: Sat Aug 12, 2017 4:26 am 
Offline
Member
Member

Joined: Wed Aug 09, 2017 7:37 am
Posts: 80
Hello.

I've made a simple OS that gets user input and prints it. It works well on VirtualBox but not on physical hardware (with Intel Atom).
My bootloader has a BIOS parameter block. However, I do not believe that is causing anything.

When I type Steve for example in VirtualBox
Quote:
Steve
Hi Steve!


On real hardware
Quote:
Steve
Hi !


So it isn't printing the name Steve. Why? Everything else functions (I can boot with int 13h and enter user input) on physical hardware but not printing what I put in.

Here's the code for my kernel

Code:
BITS 16
org 0x7c00

mov di, buffer
jmp Main

Main:
mov ah, 0x0
int 16h

mov ah, 0eh
int 10h

cmp al, 0x0d
je ready

stosb
jmp Main

ready:
mov ah, 0eh
mov al, 13
int 10h

mov ah, 0eh
mov al, 10
int 10h

mov al, 0
stosb

mov si, msg
call Print

mov si, buffer
call Print

mov ah, 0eh
mov al, '!'
int 10h

mov ah, 0eh
mov al, 13
int 10h

mov ah, 0eh
mov al, 10
int 10h

mov di, buffer
jmp Main

Print:
lodsb
cmp al, 0
je Done
mov ah, 0eh
int 10h
jmp Print

Done:
ret

buffer times 64 db 0
msg db 'Hi '


I've searched on the Internet for Intel Atom bugs. Checked for threads about physical hardware on this forum (I only found one but that talks about the OS not even booting). I've checked out the Intel Manuals about DS:SI (SI) and ES:DI (DI) but nothing about Atom.

BIOS interrupts work. I don't know what to do. I have tried everything I can possibly think of. I can't really debug it since it is physical hardware.

Any help would be appreciated.

Thanks
Steve.


Top
 Profile  
 
 Post subject: Re: My OS functions well on VirtualBox but not physical hard
PostPosted: Sat Aug 12, 2017 4:51 am 
Offline
Member
Member
User avatar

Joined: Thu Aug 06, 2015 6:41 am
Posts: 97
Location: Netherlands
On real hardware you never know exactly how your registers are initialised (see this), so to make sure your code works as expected you should initialise all registers that you will use.
In this case you never initialised es and ds but you do use them (lodsb / stosb), which might explain why it doesn't work on real HW.
Because of your 'org 0x7c00' you should initialise es and ds to zero (0 * 16 + 0x7c00 = 0x7c00 = offset of your bootsector).


Top
 Profile  
 
 Post subject: Re: My OS functions well on VirtualBox but not physical hard
PostPosted: Sat Aug 12, 2017 5:07 am 
Offline
Member
Member

Joined: Wed Aug 09, 2017 7:37 am
Posts: 80
Thank you so much, sleephacker! It worked.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 55 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group