Starcraft, Cedega and TLS
I have tried to play starcraft in Linux using Wine. But the speed was unacceptable.
I've heard from others that wine works for them. However, it doesn't work here.
So I tried cedega days ago. The result is quite satisfactory! I don't need to return to Windows to play starcraft any more.
Yesterday I looked into the details of accessing thread local storage.
I wrote a small kernel module to get the base address of insmod process's tls segment, and then print the value of AT_SYSINFO
#include <linux/init.h>
#include <linux/module.h>
#include <asm/desc.h>
static int __init mod_init(void)
{
int i=0, a=0, b=0, h, l;
int *ptr=(int *)get_cpu_gdt_table(0);
for(; i<28; i++){
l = *ptr++;
h = *ptr++;
if (i==6){
b = h;
a = l;
}
printk("0x%08x", h);
printk(" %08x", l);
printk("\n");
}
a = a>>16 & 0xffff;
a |= (b & 0xff)<<16;
a |= b & 0xff000000;
printk("0x%08x", *(int *)(a + 0x10));
return 0;
}
static void __exit mod_exit(void)
{
}
module_init(mod_init);
module_exit(mod_exit);
MODULE_LICENSE("GPL");
references:
[1] http://manugarg.googlepages.com/aboutelfauxiliaryvectors
I've heard from others that wine works for them. However, it doesn't work here.
So I tried cedega days ago. The result is quite satisfactory! I don't need to return to Windows to play starcraft any more.
Yesterday I looked into the details of accessing thread local storage.
I wrote a small kernel module to get the base address of insmod process's tls segment, and then print the value of AT_SYSINFO
#include <linux/init.h>
#include <linux/module.h>
#include <asm/desc.h>
static int __init mod_init(void)
{
int i=0, a=0, b=0, h, l;
int *ptr=(int *)get_cpu_gdt_table(0);
for(; i<28; i++){
l = *ptr++;
h = *ptr++;
if (i==6){
b = h;
a = l;
}
printk("0x%08x", h);
printk(" %08x", l);
printk("\n");
}
a = a>>16 & 0xffff;
a |= (b & 0xff)<<16;
a |= b & 0xff000000;
printk("0x%08x", *(int *)(a + 0x10));
return 0;
}
static void __exit mod_exit(void)
{
}
module_init(mod_init);
module_exit(mod_exit);
MODULE_LICENSE("GPL");
references:
[1] http://manugarg.googlepages.com/aboutelfauxiliaryvectors
Comments
http://www.mindstab.net/wordpress/archives/107