Re: Linux 2.1.108: SIGSEGV on doing cpuid in ring 3

Martin Mares (
Tue, 7 Jul 1998 18:38:03 +0200

> I tried to run the following trivial asm program:
> movl $0, %eax
> cpuid
> which was built as:
> $ as cpuid.s -o cpuid.o
> $ ld cpuid.o -o cpuid
> ld: warning: cannot find entry symbol _start; defaulting to 08048074
> $ ./cpuid
> Segmentation fault (core dumped)
> The Intel PII manual says (on page 3-70 of Volume 2) that CPUID can be
> used in any ring so I don't need to be in the kernel.
> Any ideas why it gets a SIGSEGV?

Because it executes your two instruction and then continues with executing
invalid instructions after your program. Try adding

movl $0, %eax
movl %eax, %ebx
int $0x80

to call exit(0) at the end.

Have a nice fortnight

Martin `MJ' Mares   <>
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"They'll release Windows 96 when 95 finishes loading."

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to