Invalid Opcode on ia32, Pistachio 0.4

Alexander Wieder <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Message-ID <[email protected]>
Hi!

I'm trying to understand the handling of the invalid opcode exception on
ia32. In particular, I wonder in which cases the handler
(/source/kernel/src/glue/v4-ia32/exception.cc, L.211 et seq.) will send
an exception-IPC to the exception-handler-thread (if existent).

The code there reads as follows:

221     if (space->is_user_area(addr))
222     {
223         switch(space->get_from_user(addr))
224         {
225         case 0xf0: /* lock prefix */
226             if (space->get_from_user(addr_offset(addr, 1)) == 0x90)
227             {
228                 /* lock; nop */
229                 frame->eax =
(u32_t)space->get_kip_page_area().get_base();
230                 frame->ecx = get_kip()->api_version;
231                 frame->edx = get_kip()->api_flags;
232                 frame->esi =
get_kip()->get_kernel_descriptor()->kernel_id.get_raw();
233                 frame->eip+= 2;
234                 return;
235             }
236         default:
237             printf("invalid opcode  at IP %p\n", addr);
238             enter_kdebug("invalid opcode");
239         }
240     }
241
242     if (send_exception_ipc(frame, IA32_EXC_INVALIDOPCODE))
243         return;

This looks to me like any invalid opcode in the user area (except the
sequence lock; nop;) will execute enter_kdebug() and thus basicly crash.
By this, the exception-IPC will only be sent if the invalid opcode was
executed _not_ in user area.
Does this make sense? Wouldn't it make more sense to skip the
enter_kdebug() in L.238 (comment out) to sent the exception-IPC if the
exception was not caused by the KIP-syscall?

Any hints appreciated..


Best regards,

Alexander Wieder
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.