Exception On Read Sector

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

Exception On Read Sector

Post by nekros »

Ok, I don't see where an exception would occur here unless there is a divide by 0.

qemu log:
IN:
0x00007c61: divw 31907
0x00007c65: inc %dx
0x00007c66: mov %dl,31911
0x00007c6a: mov 31906,%cl
0x00007c6e: div %cx
0x00007c70: mov %dl,31909
0x00007c74: mov %al,0x7ca6
0x00007c77: mov $0x2,%ah
0x00007c79: pop %cx
0x00007c7a: mov %cl,%al
0x00007c7c: mov 31909,%ch
0x00007c80: mov 31911,%cl
0x00007c84: mov 31910,%dh
0x00007c88: mov 31905,%dl
0x00007c8c: mov 31912,%bx
0x00007c90: int $0x13

Servicing hardware INT=0x08
Here is how I store the driver parameters:

Code: Select all

mov ah,0x08
mov dl,BYTE [drive]
int 0x13 ; get drive parameters
jc FAIL ;did this faiL?
;else store info for LBA TO CHS
mov BYTE [HPC], dh ;//store heads per cylinder

mov ax,0 ;; start counter for all the bits

testandset: ; tests and sets all the sector bits in cl
bt cx,ax ; test bit
jc set ; is the bit set? if yes set it in SPT
inc ax ; if no go to next bit and test set
test ax,6
je continue ;if we are finished, continue with the rest of the code
jmp testandset


set:
bts WORD [SPT],ax
inc ax
test ax,6
je continue ;if done setting, continue
Ok, I thought there was really something stupid or inefficient in the way I store it. Or am I just not using the right int to get the right drive parameters for LBA to CHS? Checking parameters doesn't fail so, I think maybe I'm not storing it's out put correctly?
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Exception On Read Sector

Post by Combuster »

Wouldn't that be a timer interrupt?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

Re: Exception On Read Sector

Post by nekros »

Int 0x08? Either timer or double exception,according Ralf's int list . At the end of the logfile "Servicing hardware INT=0x08" just keeps repeating over and over again.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Exception On Read Sector

Post by Troy Martin »

A double fault only occurs in pmode so it would have to be a timer interrupt.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

Re: Exception On Read Sector

Post by nekros »

ah, I wonder why the code doesn't continue then? Maybe my loading code has gone wrong somewhere... Back to debugging.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Post Reply