OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Sep 21, 2019 1:02 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: BIOS fnc. interrupts corrupted in real mode after a far jump
PostPosted: Tue May 22, 2018 6:55 am 
Offline
Member
Member
User avatar

Joined: Mon Dec 28, 2015 11:11 am
Posts: 401
Hello,
as I have mentioned in another post somewhere here on this forum I have started again, actually this time.

Back on the problem I have debugged the OS using bochsdbg just before INT 0x10 execution,
all conditions are just like they are supposed to,
but interrupt never executes, it gets stuck in some SLDT loop, which I assume it's some memory corruption.
It works perfectly fine in 0:0x7C00 (bootloader) but not in 0:0x8000, after a far jump to that address.
It's either aforementioned memory corruption or some segment mis-setup, I don't know...
What do you think? Anyone?
I have added a zipped attachment containing this code.


Attachments:
death.zip [6.94 KiB]
Downloaded 6 times

_________________
Quartz
Developed Nutoak (Blue Desert) in 2016/7; But started from scratch in 2018 again.
Top
 Profile  
 
 Post subject: Re: BIOS fnc. interrupts corrupted in real mode after a far
PostPosted: Tue May 22, 2018 10:13 am 
Online
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 1637
Why all the segment register manipulation? Set all of the segments to 0 and use proper org statements: "org 0x7c00" for stage one and "org 0x8000" for stage two.

Why RETF instead of JMPF? You're wasting space if the destination address is a constant.

Your ReadSectors routine would be easier to understand if you made proper use of BP-relative addressing to access parameters on the stack. Use "RET 4" to clean up the 4 bytes of parameters you pass to the function, instead of manipulating the stack directly. (You may also find the ENTER and LEAVE instructions useful, although it's usually better to use "PUSH BP; MOV BP, SP" instead of ENTER to save a byte.)

What is the address of the last instruction that executes correctly? What is the address of the first instruction that executes incorrectly? Knowing exactly where things go wrong might help us narrow down the problem.


Top
 Profile  
 
 Post subject: Re: BIOS fnc. interrupts corrupted in real mode after a far
PostPosted: Wed May 23, 2018 4:19 am 
Offline
Member
Member
User avatar

Joined: Mon Dec 28, 2015 11:11 am
Posts: 401
Damn, removing all these segment related stuff cleaned my code that much that it does not even look like I wrote it :)
And not only that, it fixed the problem! Probably I made a mistake somewhere dealing with segments, but, as it's really not in existance anymore, neither it does matter. Thanks anyway...
I plan to make ReadSectors more readable by generally doing what you said in thy post.
=======================
=Problem solved.
=======================

_________________
Quartz
Developed Nutoak (Blue Desert) in 2016/7; But started from scratch in 2018 again.


Top
 Profile  
 
 Post subject: Re: BIOS fnc. interrupts corrupted in real mode after a far
PostPosted: Wed May 23, 2018 6:04 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 10, 2016 7:35 am
Posts: 163
Location: Lancaster, England, Disunited Kingdom
Lukand wrote:
I plan to make ReadSectors more readable by generally doing what you said in thy post.


Ooh! A little bug there: "doing what thou said in thy post". The abandoment of thou and thy is a great loss to the English language. I'm all for them!


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 6 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