Ticket #514: ldt_keeper_darwin.3.patch
| File ldt_keeper_darwin.3.patch, 2.1 KB (added by , 20 years ago) |
|---|
-
ldt_keeper.c
old new 102 102 #define LDT_SEL(idx) ((idx) << 3 | 1 << 2 | 3) 103 103 104 104 /* i got this value from wine sources, it's the first free LDT entry */ 105 #if defined(__FreeBSD__) && defined(LDT_AUTO_ALLOC)105 #if (defined(__FreeBSD__) || defined(CONFIG_DARWIN)) && defined(LDT_AUTO_ALLOC) 106 106 #define TEB_SEL_IDX LDT_AUTO_ALLOC 107 107 #endif 108 108 … … 167 167 #endif 168 168 #endif 169 169 170 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined( __OpenBSD__) || defined(__DragonFly__)170 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(CONFIG_DARWIN) || defined(__OpenBSD__) || defined(__DragonFly__) 171 171 static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content ) 172 172 { 173 173 *buffer++ = ((content->base_addr & 0x0000ffff) << 16) | … … 193 193 194 194 if (!ldt_fs) 195 195 return NULL; 196 196 #ifndef CONFIG_DARWIN 197 197 ldt_fs->fd = open("/dev/zero", O_RDWR); 198 198 if(ldt_fs->fd<0){ 199 199 perror( "Cannot open /dev/zero for READ+WRITE. Check permissions! error: "); … … 202 202 fs_seg= 203 203 ldt_fs->fs_seg = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, 204 204 ldt_fs->fd, 0); 205 #else 206 fs_seg= 207 ldt_fs->fs_seg = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); 208 #endif /* CONFIG_DARWIN */ 205 209 if (ldt_fs->fs_seg == (void*)-1) 206 210 { 207 211 perror("ERROR: Couldn't allocate memory for fs segment"); … … 229 233 } 230 234 #endif /*linux*/ 231 235 232 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined( __OpenBSD__) || defined(__DragonFly__)236 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(CONFIG_DARWIN) || defined(__OpenBSD__) || defined(__DragonFly__) 233 237 { 234 238 unsigned long d[2]; 235 239 236 240 LDT_EntryToBytes( d, &array ); 237 #if defined(__FreeBSD__) && defined(LDT_AUTO_ALLOC)241 #if (defined(__FreeBSD__) || defined(CONFIG_DARWIN)) && defined(LDT_AUTO_ALLOC) 238 242 ret = i386_set_ldt(LDT_AUTO_ALLOC, (union descriptor *)d, 1); 239 243 array.entry_number = ret; 240 244 fs_ldt = ret;
