//hi,I am now confused by ldt static struct modify_ldt_ldt_s ll; memset(&ll, 0, sizeof(ll)); if( modify_ldt(0, &ll, sizeof(ll)) != 0 ) //<1> read ldt printf("modify_ldt read error \n"); printf("entry_number=%d seg_32bit=%d base_addr=0x%x limit=0x%x limitinpages=%d\n",ll.entry_number,ll.seg_32bit,ll.base_addr,ll.limit,ll.limit_in_pages); memset(&ll, 0, sizeof(ll)); ll.entry_number = LDT_ENTRIES-1; ll.seg_32bit = 1; ll.base_addr = 0x0000dddd; ll.limit = 0xbbbb; ll.limit_in_pages = 1; if( modify_ldt(1, &ll, sizeof(ll)) != 0 ) // <2> set ldt printf("modify_ldt error \n"); memset(&ll, 0, sizeof(ll)); r=modify_ldt(0, &ll, sizeof(ll)); // <3> read ldt again if(r != 0 ) < BR> printf("modify_ldtreaderrorret=%d,ENOSYS=%d,EINVAL=%d EFAULT=%d\n",r,ENOSYS,EINVAL,EFAULT); // now I get and error return value when it goes to
<3>. // I haved looked over the man page of modify_ldt and
the intel architecture paper about ldt // but I'm still not sure what happend when <2>
set an ldt since I believe that linux does not use ldt // the programe's ldt is in gdt .linux trys to ignore
i386's segment mechanism // anyone can fix me ? thank you advance |