
Division by zero at BT instruction
Division by zero at BT instruction
Hey ya. I've one big problem, really big, maybe not so big. I've 2 computers, if you're interested in that, they're: Intel Celeron 1.3GHz 128RAM, ant another is Cyrix instead 233MHz 68RAM. THe problem is that my OS runs fine on cyrix, but on my celeron computer it get a division by zero fault, which shows into address, with BT instruction, as far as i know, division by zero fault can be only excepted then DIV or IDIV instruction tries to divide by zero, or the result is too big. So i'll be happy if someone will help me
.

- kataklinger
- Member
- Posts: 381
- Joined: Fri Nov 04, 2005 12:00 am
- Location: Serbia
Re:Division by zero at BT instruction
Maybe it's some other exception happend (maybe invalid opcode?) but your IDT entery for that exception points to divide by zero exception handler.
Re:Division by zero at BT instruction
Try to replace BT with TEST instruction, then try again.
Re:Division by zero at BT instruction
Now i've changed BT with AND, then with TEST, the only effect what can i see is that fault comes again and again at address 00100BD3. My ORG is 1024*1024+1024. Here is a disassembly cut of that code:
00100BCE EB82 jmp short 0xb52
00100BD0 FB sti
00100BD1 E464 in al,0x64
00100BD3 2401 and al,0x1
00100BD5 0F8477FF jz near 0xb50
00100BD9 FF db 0xFF
00100BDA FF75F3 push word [di-0xd]
There is the 4th line where the fault comes. I don't understand, on another PC it works, on mine doesn't =\ .
00100BCE EB82 jmp short 0xb52
00100BD0 FB sti
00100BD1 E464 in al,0x64
00100BD3 2401 and al,0x1
00100BD5 0F8477FF jz near 0xb50
00100BD9 FF db 0xFF
00100BDA FF75F3 push word [di-0xd]
There is the 4th line where the fault comes. I don't understand, on another PC it works, on mine doesn't =\ .
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Division by zero at BT instruction
That sounds like a badly-remapped PIC to me ... a division by zero that is repeatedly thrown at non-div opcodes ...
your disassembler doesn't seems accurate either: it looks like it tries to disassemble 32bit code in 16-bit mode ...
Code: Select all
00100BD5 0F8477FF jz near 0xb50
00100BD9 FF db 0xFF
00100BDA FF75F3 push word [di-0xd]
- kataklinger
- Member
- Posts: 381
- Joined: Fri Nov 04, 2005 12:00 am
- Location: Serbia
Re:Division by zero at BT instruction
Hmm... What happens when you remove this line?
It looks like you have bad PIC or IDT setup code.
Code: Select all
00100BD0 FB sti
Re:Division by zero at BT instruction
Emm... IDT is working fine, PIC remapped fine too. On another computer it works. Disassembly is in 32bit form, maybe i'll try to test it on some other computers :-\ ...
- kataklinger
- Member
- Posts: 381
- Joined: Fri Nov 04, 2005 12:00 am
- Location: Serbia
Re:Division by zero at BT instruction
Code: Select all
and al,0x1
It happens just after you have enabled interrupts, so there is something wrong with hardware interrupts, I guess.
Code: Select all
jz near 0xb50
db 0xFF
push word [di-0xd]
Re:Division by zero at BT instruction
That is not 32-bit disassembly. There is a 16-bit offset supplied with that near jump instruction. Clearly, the next two bytes also belong to it. Also, there is a 16-bit register used in an address calculation without an address size override prefix.xsix wrote: 00100BD5 0F8477FF jz near 0xb50
00100BD9 FF db 0xFF
00100BDA FF75F3 push word [di-0xd]
- kataklinger
- Member
- Posts: 381
- Joined: Fri Nov 04, 2005 12:00 am
- Location: Serbia
Re:Division by zero at BT instruction
Send real code instead of disassembly. Or tell your compiler to produce asm output and compare the resaults. 

Re:Division by zero at BT instruction
I use NASM. Disassembly done with ndisasm with parameter -b 32... CPU isn't broken, i hope ;D. Ok, whatever, thank you all for your answers, i'll find that error, my code, my problems. 

Re:Division by zero at BT instruction
So if you are coding in assembly in the first place why are you providing output that has been run through two seperate processes rather than just showing us the original?
Re:Division by zero at BT instruction
I'm not good in english... But disassembly is the same as asm code. Doesn't matter,i just want to know why so simple thing faults on one computer, but not on another.
Re:Division by zero at BT instruction
No it isn't. Source is usually better formatted and commented. It does also rule out any wrongful settings to the disassembler.xsix wrote: I'm not good in english... But disassembly is the same as asm code.
Every good solution is obvious once you've found it.
Re:Division by zero at BT instruction
It's also one less step to copy-paste than disassemble-copy-paste.