I have written a patch [1] that adds support for USER_LDT on amd64. I have only tested it quickly.
The goal is to allow userland to set some entries in the LDT. On i386 this is pretty simple: each entry is 8-byte-sized, so we can use an array and indexes. On amd64 this is more complicated, some entries are 16-byte-sized, so the array design does not work anymore. My patch allows only 8-byte-sized entries to be added, so that the backend still works. Moreover, userland is not allowed to overwrite the initial LDT entries (some of which are 16-byte-sized). All that means we have some initial LDT entries that are fixed, and beyond a certain index userland can add its own entries. The reason we care about USER_LDT at all is because Wine uses it to run 32bit Windows applications. It has to do with WoW64 [2]. I believe my patch should make it work, since the first LDT index used by Wine is above our limit [3], and Wine does not use 16-byte-sized entries. This being said, I don't have Wine with WoW64, and am not a Wine user anyway. I was wondering whether someone would be interested in testing it for real. Thanks, Maxime Note: our pkgsrc package does not support WoW64. Note: I don't know if USER_LDT must be added in netbsd32 for Wine to work, if so then I'll add support for that too. [1] http://m00nbsd.net/garbage/ldt/ldt.diff [2] https://wiki.winehq.org/Building_Wine#Shared_WoW64 [3] https://github.com/wine-mirror/wine/blob/master/libs/wine/ldt.c#L113
