Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83164
b: refs/heads/master
c: 235a6f0
h: refs/heads/master
v: v3
  • Loading branch information
Karol Swietlicki authored and Linus Torvalds committed Feb 5, 2008
1 parent 44d58a2 commit afceff5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0ba9d3f91d213f6d07c84230a0b3e2b16a0bb176
refs/heads/master: 235a6f06eb5571db600a743cda7c73fd4f74127f
1 change: 1 addition & 0 deletions trunk/arch/um/include/common-offsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ DEFINE_STR(UM_KERN_WARNING, KERN_WARNING);
DEFINE_STR(UM_KERN_NOTICE, KERN_NOTICE);
DEFINE_STR(UM_KERN_INFO, KERN_INFO);
DEFINE_STR(UM_KERN_DEBUG, KERN_DEBUG);
DEFINE_STR(UM_KERN_CONT, KERN_CONT);

DEFINE(UM_ELF_CLASS, ELF_CLASS);
DEFINE(UM_ELFCLASS32, ELFCLASS32);
Expand Down
40 changes: 31 additions & 9 deletions trunk/arch/um/sys-i386/bugs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,41 @@
#include "os.h"
#include "task.h"
#include "user.h"
#include "sysdep/archsetjmp.h"

#define MAXTOKEN 64

/* Set during early boot */
int host_has_cmov = 1;
static jmp_buf cmov_test_return;

static void cmov_sigill_test_handler(int sig)
{
host_has_cmov = 0;
longjmp(cmov_test_return, 1);
}

static void test_for_host_cmov(void)
{
struct sigaction old, new;

printk(UM_KERN_INFO "Checking for host processor cmov support...");
new.sa_handler = cmov_sigill_test_handler;

/* Make sure that SIGILL is enabled after the handler longjmps back */
new.sa_flags = SA_NODEFER;
sigemptyset(&new.sa_mask);
sigaction(SIGILL, &new, &old);

if (setjmp(cmov_test_return) == 0) {
unsigned long foo = 0;
__asm__ __volatile__("cmovz %0, %1" : "=r" (foo) : "0" (foo));
printk(UM_KERN_CONT "Yes\n");
} else
printk(UM_KERN_CONT "No\n");

sigaction(SIGILL, &old, &new);
}

static char token(int fd, char *buf, int len, char stop)
{
Expand Down Expand Up @@ -153,15 +183,7 @@ void arch_init_thread(void)

void arch_check_bugs(void)
{
int have_it;

if (os_access("/proc/cpuinfo", OS_ACC_R_OK) < 0) {
printk(UM_KERN_ERR "/proc/cpuinfo not available - skipping CPU "
"capability checks\n");
return;
}
if (check_cpu_flag("cmov", &have_it))
host_has_cmov = have_it;
test_for_host_cmov();
}

int arch_handle_signal(int sig, struct uml_pt_regs *regs)
Expand Down

0 comments on commit afceff5

Please sign in to comment.