From: "Kris Warkentin" <kewarken@qnx.com>
To: <gdb@sources.redhat.com>
Subject: long long considered harmful?
Date: Tue, 22 Apr 2003 17:39:00 -0000 [thread overview]
Message-ID: <076701c308f6$2f017eb0$0202040a@catdog> (raw)
Below is a clipping from our debug.h header which defines the register
structures for QNX Neutrino. I've been in conversation with Mark Kettenis
about our gdb submission and it looks like portability issues in this header
are one of the few remaining stumbling blocks, at least from his
perspective. I guess that conceivably some older systems might not be able
to deal with a 64 bit int type. The question I want to ask is, "how do I
deal with this in a portable way?"
I don't believe that any of these structures are ever manipulated in any way
other than to read/write bytes of data into and out of them. Would it be
best just to define any long long members as arrays of char? It doesn't
seem very pretty but it would certainly do the trick.
ie. "char u64[8]" instead of "long long u64" is fine but "char gpr_hi[32 *
8]" instead of "long long gpr_hi[32]" seems a bit nasty.
comments?
Kris
>>>>>>>>>>>>>debug.h clip<<<<<<<<<<<<<<<<<<<<<
typedef union
{
unsigned long long u64;
double f;
} mipsfloat;
typedef struct mips_cpu_registers
{
unsigned regs[74];
unsigned long long regs_alignment;
} MIPS_CPU_REGISTERS;
typedef struct mips_fpu_registers
{
mipsfloat fpr[32];
unsigned fpcr31;
} MIPS_FPU_REGISTERS;
typedef struct mips_alt_registers
{
union
{
struct mips_tx79
{
unsigned long long gpr_hi[32];
unsigned long long lo1;
unsigned long long hi1;
unsigned sa;
} tx79;
} un;
} MIPS_ALT_REGISTERS;
#ifdef __BIGREGS__
typedef unsigned long long ppcint;
#else
typedef unsigned ppcint;
#endif
typedef union
{
unsigned long long u64;
double f;
} ppcfloat;
typedef union
{
unsigned long long u64[2];
unsigned u32[4];
unsigned char u8[16];
float f32[4];
} ppcvmx;
typedef struct ppc_cpu_registers
{
ppcint gpr[32];
ppcint ctr;
ppcint lr;
ppcint msr;
ppcint iar;
unsigned cr;
unsigned xer;
unsigned ear; /* Not present on all chips. */
unsigned mq; /* Only on the 601. */
unsigned vrsave; /* On Altivec CPU's, SPR256. */
} PPC_CPU_REGISTERS;
typedef struct ppc_fpu_registers
{
ppcfloat fpr[32];
unsigned fpscr;
unsigned fpscr_val;
/* Load/store of fpscr is done through fprs, the real value is in [32,63]
of a fpr.
Fpscr is the address for lfd, stfd. fpscr_val is the real value of
fpscr. */
} PPC_FPU_REGISTERS;
typedef struct ppc_vmx_registers
{
ppcvmx vmxr[32];
ppcvmx vscr;
} PPC_VMX_REGISTERS;
typedef struct ppc_alt_registers
{
PPC_VMX_REGISTERS vmx;
} PPC_ALT_REGISTERS;
next reply other threads:[~2003-04-22 17:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-22 17:39 Kris Warkentin [this message]
2003-04-22 17:45 ` Daniel Jacobowitz
2003-04-22 18:08 ` Kris Warkentin
2003-04-22 18:21 ` Daniel Jacobowitz
2003-04-22 18:41 ` Kris Warkentin
2003-04-22 19:31 ` Daniel Jacobowitz
2003-04-22 19:12 ` Kris Warkentin
2003-04-22 19:25 ` Kris Warkentin
2003-04-22 19:30 ` Daniel Jacobowitz
2003-04-23 13:39 ` Kris Warkentin
2003-04-23 21:17 ` Daniel Jacobowitz
2003-04-23 21:23 ` Kris Warkentin
2003-04-23 21:44 ` Kris Warkentin
2003-04-23 21:47 ` Daniel Jacobowitz
2003-04-23 22:09 ` Kris Warkentin
2003-04-23 22:11 ` Daniel Jacobowitz
2003-04-23 22:17 ` Kris Warkentin
2003-04-24 21:05 ` Andrew Cagney
2003-04-24 23:51 ` Kris Warkentin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='076701c308f6$2f017eb0$0202040a@catdog' \
--to=kewarken@qnx.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox