Which offest(ip) is passed to invalid opcode handler?

Тема в разделе "WASM.ENGLISH", создана пользователем morkster, 12 окт 2005.

  1. morkster

    morkster New Member

    Публикаций:
    0
    Регистрация:
    12 окт 2005
    Сообщения:
    31
    Running in realmode(read - DOS)

    I'm wondering, sopose i have code which has invlaid opcode in it, and it's prefaced with lock, segment overrides, 66h, etc. which offest will be pushed to stack when cpu will try to execute invalid code. The offest of preface instruction, or the actual instruction?



    And as additional question. When win9x detects invalid opcode, it happily closes dos box. Is there a way to disable that feature, and let dos use it's own int06h to handle it?



    Sorry for my bad english,typos,and lack of logic.
     
  2. Broken Sword

    Broken Sword Robert

    Публикаций:
    0
    Регистрация:
    30 авг 2002
    Сообщения:
    433
    1. Offset of preface instruction will be pushed



    2. If you don't mean IDT patching the answer is NO - it is not possible in win9x (the protected mode #UD handler don't calls virtual-8086 monitor), but it is possible in x86 Virtual-8086 mode (#UD handler CAN call virtual-8086 monitor to handle exception which in turn CAN pass control back to 8086 program's interrupt handler).



    btw, my win9x (win98) doesn't closes dos box. instead it displays message window with error information.
     
  3. morkster

    morkster New Member

    Публикаций:
    0
    Регистрация:
    12 окт 2005
    Сообщения:
    31
    1. Thanks. Was confused by some debuggers that like to show some of them in separate line, specially segment overrides, and when i tried to test it just crashed somewhere, probably due a faulty hands.com tsr i have :)



    2. yes, afaik, i'm talking about x86 Virtual-8086 mode(terminology isn't one of my strong points). I assumne virtual-8086 mode monitor is the vmm.vxd? Could you possibly point me to some documentation on it? Ralf Brown's Interrupt List has some info in int 2f section, but it doesn't seem enough and didn't manage to google much usefull either. Just an example of how to make the monitor pass controll back to 8086 program's interrupt handler would be nice too, but documentation would naturally be better. It's not that critical tough, knowing it's possible is enough too, just gona take soem time to figure it out. Thanks again :)



    btw, yes, mine shows the message window with error info too, i just have trouble putting my thoughts to words thus apology for lack of logic



    P.S. Sorry for my bad english,typos,and lack of logic(again).
     
  4. _BC_

    _BC_ БЦ

    Публикаций:
    0
    Регистрация:
    20 янв 2005
    Сообщения:
    759
    For Win9x V86-task you can hook invalid opcode fault on a VxD level by using VMM service Hook_V86_Fault. When exception #UD occur, VxD can reflect VM execution back to V86 int06 fault handler using so called 'nested-execution' or by direct modification of Client_Reg_Structure.

    More information can be found in DDK98.
     
  5. Broken Sword

    Broken Sword Robert

    Публикаций:
    0
    Регистрация:
    30 авг 2002
    Сообщения:
    433
    The best documentation of how to make monitor pass control back to 8086 task you can find is the chapter 15.3.1.2 of Intel Architecture Developers manual (handling an interrupt or exception with an 8086 program interrupt or exception handler)
     
  6. morkster

    morkster New Member

    Публикаций:
    0
    Регистрация:
    12 окт 2005
    Сообщения:
    31
    Many thanks.