ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Get_cpu_info on platforms other than Windows?

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 6 Feb 2013 12:13:50 -0800
On Feb 6, 2013, at 5:13 AM, Anders Broman <anders.broman@xxxxxxxxxxxx> wrote:

> The included patch works on Ubuntu 64 bits but I guess it needs to be protected with more #if defined on say OSX ppc?

Well, obviously, for PPC *and* all other non-x86 CPUs:

	http://www.debian.org/ports/

	http://www.netbsd.org/ports/

(picked as two OSes that support Wireshark and that are probably the ones with the most instruction set architectures supported; note that the number of supported platforms is > the number of supported ISAs, of course), the code path would be *completely* different.  All it might be able to do is say "this is a $ARCHITECTURE processor", without giving a processor brand name.

Whether an asm would work would depend more on the compiler than on the OS; GCC-compatible compilers would support the same syntax regardless of the OS.  (You might have to be careful to avoid features of asm that aren't in older versions of GCC, if there are any that might be used.)

Note also that the CPUID instruction first showed up on the 486; Wireshark might not run very well on a 386 box, but we should at least arrange not to crash with an illegal instruction fault.

In addition, getting the CPU brand and getting the amount of memory on the system should be separate operations - even if we can't get the CPU brand, we should report the amount of physical memory.