Hi to the list, I'm going throu the 32bit on 64bit on debian 4, as first I had a problem with the host kernel to run 32bits uml kernels, I solve it installing a vanilla 2.6.18.8 patch it for debian and then I could start a prebuilted kernel from nagafix(the 2.6.23) but I got the arch_switch_tls_skas problem, I patched the kernel with the x86-64-support.diff from the bb1 branch
http://www.user-mode-linux.org/~blaisorblade/patches/guest/uml-2.6.18-bb1/broken-out/tls/ One hunk failed patching file arch/um/os-Linux/sys-i386/tls.c Hunk #1 FAILED at 1. Hunk #2 FAILED at 28. 2 out of 2 hunks FAILED -- saving rejects to file arch/um/os-Linux/sys-i386/tls.c.rej This is it, sorry I'm not able to fix it: $ cat arch/um/os-Linux/sys-i386/tls.c.rej *************** *** 1,16 **** #include <errno.h> #include <linux/unistd.h> #include "sysdep/tls.h" #include "user_util.h" static _syscall1(int, get_thread_area, user_desc_t *, u_info); /* Checks whether host supports TLS, and sets *tls_min according to the value * valid on the host. * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */ - void check_host_supports_tls(int *supports_tls, int *tls_min) { /* Values for x86 and x86_64.*/ - int val[] = {GDT_ENTRY_TLS_MIN_I386, GDT_ENTRY_TLS_MIN_X86_64}; int i; for (i = 0; i < ARRAY_SIZE(val); i++) { --- 1,26 ---- + #include <sys/ptrace.h> + #include <asm/ldt.h> #include <errno.h> #include <linux/unistd.h> #include "sysdep/tls.h" #include "user_util.h" + #include "os.h" + #include "uml-config.h" + + /* TLS support - we basically rely on the host's one.*/ static _syscall1(int, get_thread_area, user_desc_t *, u_info); + //XXX: should get this from an include! + extern int host_gdt_entry_tls_min; + /* Checks whether host supports TLS, and sets *tls_min according to the value * valid on the host. * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */ + int check_host_supports_tls() + { /* Values for x86 and x86_64.*/ + int val[] = { GDT_ENTRY_TLS_MIN_I386, GDT_ENTRY_TLS_MIN_X86_64 }; int i; for (i = 0; i < ARRAY_SIZE(val); i++) { *************** void check_host_supports_tls(int *suppor *** 18,34 **** info.entry_number = val[i]; if (get_thread_area(&info) == 0) { - *tls_min = val[i]; - *supports_tls = 1; - return; } else { if (errno == EINVAL) continue; else if (errno == ENOSYS) - *supports_tls = 0; - return; } } - *supports_tls = 0; } --- 28,110 ---- info.entry_number = val[i]; if (get_thread_area(&info) == 0) { + host_gdt_entry_tls_min = val[i]; + return 1; } else { if (errno == EINVAL) continue; else if (errno == ENOSYS) + return 0; } } + return 0; + } + + /* In TT mode, this should be called only by the tracing thread, and makes sense + * only for PTRACE_SET_THREAD_AREA. In SKAS mode, it's used normally. + * + */ + + #ifndef PTRACE_GET_THREAD_AREA + #define PTRACE_GET_THREAD_AREA 25 + #endif + + #ifndef PTRACE_SET_THREAD_AREA + #define PTRACE_SET_THREAD_AREA 26 + #endif + + int os_set_thread_area(user_desc_t *info, int pid) + { + int ret; + + ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number, + (unsigned long) info); + if (ret < 0) + ret = -errno; + return ret; + } + + #ifdef UML_CONFIG_MODE_SKAS + + int os_get_thread_area(user_desc_t *info, int pid) + { + int ret; + + ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number, + (unsigned long) info); + if (ret < 0) + ret = -errno; + return ret; + } + + #endif + + #ifdef UML_CONFIG_MODE_TT + #include "linux/unistd.h" + + static _syscall1(int, set_thread_area, user_desc_t *, u_info); + + int do_set_thread_area_tt(user_desc_t *info) + { + int ret; + + ret = set_thread_area(info); + if (ret < 0) { + ret = -errno; + } + return ret; + } + + int do_get_thread_area_tt(user_desc_t *info) + { + int ret; + + ret = get_thread_area(info); + if (ret < 0) { + ret = -errno; + } + return ret; } + + #endif /* UML_CONFIG_MODE_TT */ And another one: *************** *** 1,76 **** - #include <errno.h> - #include <sys/ptrace.h> - #include <asm/ldt.h> - #include "sysdep/tls.h" - #include "uml-config.h" - - /* TLS support - we basically rely on the host's one.*/ - - /* In TT mode, this should be called only by the tracing thread, and makes sense - * only for PTRACE_SET_THREAD_AREA. In SKAS mode, it's used normally. - * - */ - - #ifndef PTRACE_GET_THREAD_AREA - #define PTRACE_GET_THREAD_AREA 25 - #endif - - #ifndef PTRACE_SET_THREAD_AREA - #define PTRACE_SET_THREAD_AREA 26 - #endif - - int os_set_thread_area(user_desc_t *info, int pid) - { - int ret; - - ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number, - (unsigned long) info); - if (ret < 0) - ret = -errno; - return ret; - } - - #ifdef UML_CONFIG_MODE_SKAS - - int os_get_thread_area(user_desc_t *info, int pid) - { - int ret; - - ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number, - (unsigned long) info); - if (ret < 0) - ret = -errno; - return ret; - } - - #endif - - #ifdef UML_CONFIG_MODE_TT - #include "linux/unistd.h" - - static _syscall1(int, get_thread_area, user_desc_t *, u_info); - static _syscall1(int, set_thread_area, user_desc_t *, u_info); - - int do_set_thread_area_tt(user_desc_t *info) - { - int ret; - - ret = set_thread_area(info); - if (ret < 0) { - ret = -errno; - } - return ret; - } - - int do_get_thread_area_tt(user_desc_t *info) - { - int ret; - - ret = get_thread_area(info); - if (ret < 0) { - ret = -errno; - } - return ret; - } - - #endif /* UML_CONFIG_MODE_TT */ --- 0 ---- Am I missing anything, should I install the whole patchset? Anyone else have some hints about patches for running 32bit guests on 64bit hosts? I about to update the wiki with this infos. And btw, about the wiki, I made a comment to the page for host kernel and I cannot take it away... :) Thanks. fruity ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ User-mode-linux-user mailing list User-mode-linux-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user