From: Luca A. <luc...@em...> - 2003-05-20 15:30:03
|
Hi Juras, (I cc the oslib-devel mailing list, because the e-mails that I write to you keep bounching - there is some _serious problem_ with your mail server... I hope you will read this e-mail in the oslib-devel archives) > I was confused by the biosdemo example when an 0x6D handler is set. > The topic is that we can map a real-mode INT instruction into a protected one > through GPF (General Protection Fault) handler. No, oslib uses a different approach. The IOPL of the VM86 task is set so that an INT instruction does not generate a GPF, but triggers the corresponding interrupt (returning to ring 0) according to the PM IDT. Hence, the interrupt handler only has to do some tricks on the VM86 stack to invoke the RM handler, and everything is done... No need for monitors or emulators ;-) > So I thought that in > OSLib a GPF handler is defined and that handler called automatically > a protected mode interrupt with the same number as needed in the > vm86task. No, this is not the case... Because of the IOPL setting, no GPF is generated... If you _really want_ a GPF to be generated, you must set the IDT entry corresponding to your interrupt as invalid (in this way, the INT instruction will generate a GPF, and you will have to handle it). > I need to write a > simple vm86 monitor for BIOS to see where INT instruction is called and what > interrupts are needed, so I need a personal exception handler for > GPF which will decode INT instruction and act as it must be. Ok, if you really want to do the emulation stuff, you have two possibilities: 1) set all the IDT entries but the first 32 to 0 (so that they are invalid, and a GPF is generated) 2) change the IOPL level in vm86_callBIOS() However, I suggest to simply set the hanlders that you need as in biosdemo.c... If an INT is invoked and you did not set the proper handler, you will see something like "Unhandled INT or Exc <number>" on the screen, and the program will stop. Then, you will know that you need to handle that int ;-) (try to comment out the l1_int_bind() call in biosdemo.c...) Luca -- _____________________________________________________________________________ Copy this in your signature, if you think it is important: N O W A R ! ! ! -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Miotti.it eyewear: qualità, assortimento e sopratutto spedizioni gratuite! Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=1451&d=20-5 |