void ldt_set_entry( WORD sel, LDT_ENTRY entry )
{
#ifdef linux
struct modify_ldt_s ldt_info = { .entry_number = sel >> 3 };
int ret;
ldt_info.base_addr = ldt_get_base( entry );
ldt_info.limit = entry.LimitLow | (entry.HighWord.Bits.LimitHi << 16);
ldt_info.seg_32bit = entry.HighWord.Bits.Default_Big;
ldt_info.contents = (entry.HighWord.Bits.Type >> 2) & 3;
ldt_info.read_exec_only = !(entry.HighWord.Bits.Type & 2);
ldt_info.limit_in_pages = entry.HighWord.Bits.Granularity;
ldt_info.seg_not_present = !entry.HighWord.Bits.Pres;
ldt_info.usable = entry.HighWord.Bits.Sys;
if ((ret = modify_ldt( &ldt_info ))) ERR( "modify_ldt failed %d\n", ret );
#elif defined(__APPLE__)
if (i386_set_ldt(sel >> 3, (union ldt_entry *)&entry, 1) < 0) perror("i386_set_ldt");
#else
fprintf( stderr, "No LDT support on this platform\n" );
exit(1);
#endif
}
I don't know how to patch files. If I try the old wow64 to compile three times, can it be done without modifying any files?Hi, looking at wine's code relevant to WoW64 mode, you will have to patch several files to support FreeBSD otherwise the current ifdefs are:
C:void ldt_set_entry( WORD sel, LDT_ENTRY entry ) { #ifdef linux struct modify_ldt_s ldt_info = { .entry_number = sel >> 3 }; int ret; ldt_info.base_addr = ldt_get_base( entry ); ldt_info.limit = entry.LimitLow | (entry.HighWord.Bits.LimitHi << 16); ldt_info.seg_32bit = entry.HighWord.Bits.Default_Big; ldt_info.contents = (entry.HighWord.Bits.Type >> 2) & 3; ldt_info.read_exec_only = !(entry.HighWord.Bits.Type & 2); ldt_info.limit_in_pages = entry.HighWord.Bits.Granularity; ldt_info.seg_not_present = !entry.HighWord.Bits.Pres; ldt_info.usable = entry.HighWord.Bits.Sys; if ((ret = modify_ldt( &ldt_info ))) ERR( "modify_ldt failed %d\n", ret ); #elif defined(__APPLE__) if (i386_set_ldt(sel >> 3, (union ldt_entry *)&entry, 1) < 0) perror("i386_set_ldt"); #else fprintf( stderr, "No LDT support on this platform\n" ); exit(1); #endif }
Check the wine-proton code (and the bug/review to push it to version 10) as that already includes wow64 patches (and maybe check with shkhln as he worked on that on the past).