[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: [RFC, PATCH 5/24] i386 Vmi code patching



* Zachary Amsden (zach@xxxxxxxxxx) wrote:
> +static void fixup_translation(struct vmi_annotation *a)
> +{
> +     unsigned char *c, *start, *end;
> +     int left;
> +
> +     memcpy(a->nativeEIP, a->translationEIP, a->translation_size);
> +     start = a->nativeEIP;
> +     end = a->nativeEIP + a->translation_size;
> +
> +     for (c = start; c < end;) {
> +             switch(*c) {
> +                     case MNEM_CALL_NEAR:
> +                             patch_call_site(a, c);
> +                             c+=5;
> +                             break;
> +
> +                     case MNEM_PUSH_I:
> +                             c+=5;
> +                             break;
> +
> +                     case MNEM_PUSH_IB:
> +                             c+=2;
> +                             break;
> +
> +                     case MNEM_PUSH_EAX:
> +                     case MNEM_PUSH_ECX:
> +                     case MNEM_PUSH_EDX:
> +                     case MNEM_PUSH_EBX:
> +                     case MNEM_PUSH_EBP:
> +                     case MNEM_PUSH_ESI:
> +                     case MNEM_PUSH_EDI: 
> +                             c+=1;
> +                             break;
> +
> +                     case MNEM_LEA:
> +                             BUG_ON(*(c+1) != 0x64);  /* [--][--]+disp8, 
> %esp */
> +                             BUG_ON(*(c+2) != 0x24);  /* none + %esp */
> +                             c+=4;
> +                             break;
> +
> +                     default:
> +                             /*
> +                              * Don't printk - it may acquire spinlocks with
> +                              * partially completed VMI translations, causing
> +                              * nuclear meltdown of the core.
> +                              */
> +                             BUG();
> +                             return;
> +             }

Why these restrictions?  How do you do int $0x82, for example?

thanks,
-chris

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.