Hey,
Using tasm and dosbox I have done (right) code to move from real to protected mode and from protected mode to real and all is working fine (tested!). There is a small problem with interrupts/exceptions, becouse it seems like all of them are not catched, what is kinda strange.

My idt:
  idt label word
    exception0 pulapka <exception_0>
    exception_def pulapka <exception_default>
    pulapka 30 DUP (<exception_default>)
  idt_size = $ - idt


pulapka is a structure:
pulapka struc
  offs_1 dw 0
  sel dw 16
  rsrv db 0
  attr db 8fh
  offs_h dw 0
pulapka ends


exception_0 and exception_default are procedures that serve interrupts

So as far as you can notice if i would DIV by 0 it would call exception_0 procedure
If any other exception it would call exception_default procedure. And it mostly like that...

If i run this code in protected mode:
mov ax, 6
mov dx, 0
div dx

I get result of exception_0 procedure - printed text at screen - OK

If i run this code in protected mode:
mov ax, 10
mov fs, ax
int 20h

I get result of exception_default procedure - different text printed at scrren, with different position - OK

So it seems interrupt's are served properly, but... if i run in pm mode this:

mov ax, ds:


where data_size is size of data segment (ds). I get no exception... i have moved outside segment border so why there is no exception ?!

Reading program segment isn't also throwing an exepction (98h attribute for this CS descriptior):
mov al, cs:[0]



Why ? What may be wrong ?
Posted on 2013-05-06 14:43:07 by hElllk