General
cancel
Showing results for 
Search instead for 
Did you mean: 

check if 32 or 64-bit system using live CD

SOLVED
Go to solution
'chris'
Super Advisor

check if 32 or 64-bit system using live CD

hi

Howto check if if 32 or 64-bit system using live CD?
10 REPLIES
Prokopets
Respected Contributor
Solution

Re: check if 32 or 64-bit system using live CD

Hi!
Not sure, if i understand you correctly, but you cat check /etc/cpuinfo - it will show you the processor information and you'll see if it is x86-64.

regards,
Philipp.
'chris'
Super Advisor

Re: check if 32 or 64-bit system using live CD

# cat /proc/cpuinfo

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU 3050 @ 2.13GHz
stepping : 6
cpu MHz : 2133.443
cache size : 2048 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow
bogomips : 4266.88
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU 3050 @ 2.13GHz
stepping : 6
cpu MHz : 2133.443
cache size : 2048 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow
bogomips : 4266.82
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

root@squeeze:/proc# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU 3050 @ 2.13GHz
stepping : 6
cpu MHz : 2133.443
cache size : 2048 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow
bogomips : 4266.88
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU 3050 @ 2.13GHz
stepping : 6
cpu MHz : 2133.443
cache size : 2048 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow
bogomips : 4266.82
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

Prokopets
Respected Contributor

Re: check if 32 or 64-bit system using live CD

Actually, you can find more information about your CPU here: http://ark.intel.com/Product.aspx?id=27204&code=Xeon+3050

Regards,
Philipp.
Jimmy Vance
HPE Pro

Re: check if 32 or 64-bit system using live CD

using the info provided from the output of "cat /proc/cpuinfo" look at the "flags" listing. The flag "lm" denotes x86_64 capable.

From the kernel sources

#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */



__________________________________________________
No support by private messages. Please ask the forum!      I work for HPE

If you feel this was helpful please click the KUDOS! thumb below!   
'chris'
Super Advisor

Re: check if 32 or 64-bit system using live CD

Thx, but have you looked my /proc/cpuinfo?
Jimmy Vance
HPE Pro

Re: check if 32 or 64-bit system using live CD

>>Thx, but have you looked my /proc/cpuinfo?

Yes, and I provided the answer to your question.

look at where it shows "flags" if it shows "lm" that denotes the CPU is x86_64 capable



__________________________________________________
No support by private messages. Please ask the forum!      I work for HPE

If you feel this was helpful please click the KUDOS! thumb below!   
Lucifer Megacruel
Valued Contributor

Re: check if 32 or 64-bit system using live CD

Hi Chris,

Get flat assmebler or nasm (Netwide assembler )write a simple program than uses uses the rax register. rax register is not present in 32 bits so the program should fault in 32 bits system and will work fine of 64 bit system.

--Lucifer
"To Denouce the Evils of Truth and Love. To cause may hem and destruction and necromancy , Lucifer is here"
Lucifer Megacruel
Valued Contributor

Re: check if 32 or 64-bit system using live CD

Hello chris,

In case you have difficulty writing x86 assembly language , I am writing a simple program for you here , compile with flat assembler and see that it works.

<-------------------------------------->
format ELF64 executable at 0000000100000000h
segment readable executable
entry $
xor rax,rax
mov edx,char_count
lea rsi,[print_str]
mov edi,1
mov eax,1
syscall
xor rax,rax
xor edi,edi
mov eax,60
syscall

segment readable writeable
print_str db '64 bit program!',0xA
char_count = $-print_str .

Another sure shot way is to make use of the cpuid instruction and get the CPU identification. Just showing an example here , not really tested

macro ccall proc,[arg]
{ common
local size
size = 0
mov ebp,esp
if ~ arg eq
forward
size = size + 4
common
sub esp,size
end if
and esp,-16
if ~ arg eq
add esp,size
reverse
pushd arg
common
end if
call proc
mov esp,ebp }

format elf
section '.text' executable
public main
extrn printf
main:
xor eax , eax
cpuid
ccall printf,cpuid_str,ebx,edx,ecx
ret

section '.data' writable
cpuid_str db "Curr ID %.12s",0x0a,0

--Lucifer


"To Denouce the Evils of Truth and Love. To cause may hem and destruction and necromancy , Lucifer is here"
'chris'
Super Advisor

Re: check if 32 or 64-bit system using live CD

Thx, but howto run these programs from the live CD?
Lucifer Megacruel
Valued Contributor

Re: check if 32 or 64-bit system using live CD

Just as you would normally :) .

If you have internet connection get fasm from the net, else put it in a usb drive and mount it or prepare a live CD with the above program in it. Search the internet for remastering or ( knoppix remastering ).

Or else you can use the .as assembler that comes with most of the Linux distributions. I am more familiar with intel syntax than at & t syntax and fasm is the assembler i have been using lately :).

With as assembler you need to reverse the operands , add a suffix to indicate size , replace [] with () , use % for registers etc , etc.. .pain IMHO.

Another thing you can do is make use of GCC inline assembly . I am not a big fan of inline assembly, I prefer writing .asm modules in assembly itself and later linking separately. That way you keep architecture specific code out from your C code .


GNU as is more or less written as a compiler back end where the compiler always feeds it with correct code , not really suitable for hand coding.


--Lucifer
"To Denouce the Evils of Truth and Love. To cause may hem and destruction and necromancy , Lucifer is here"