Define netbsd32_uint64 for 64bit integers with the alignment requirement

of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.
This commit is contained in:
dsl 2007-09-16 22:35:01 +00:00
parent 56ad6a2499
commit 06b0a1bdab
4 changed files with 29 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.h,v 1.12 2007/03/16 22:23:30 dsl Exp $ */
/* $NetBSD: netbsd32_machdep.h,v 1.13 2007/09/16 22:35:01 dsl Exp $ */
#ifndef _MACHINE_NETBSD32_H_
#define _MACHINE_NETBSD32_H_
@ -10,6 +10,9 @@
#define NETBSD32_POINTER_TYPE uint32_t
typedef struct { NETBSD32_POINTER_TYPE i32; } netbsd32_pointer_t;
/* i386 has 32bit aligned 64bit integers */
#define NETBSD32_INT64_ALIGN __attribute__((__aligned__(4)))
typedef netbsd32_pointer_t netbsd32_sigcontextp_t;
struct netbsd32_sigcontext13 {

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.h,v 1.2 2003/04/16 08:58:18 dsl Exp $ */
/* $NetBSD: netbsd32_machdep.h,v 1.3 2007/09/16 22:35:01 dsl Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -41,6 +41,9 @@ typedef u_int32_t netbsd32_pointer_t;
*/
#define NETBSD32PTR64(p32) ((void *)(u_long)(u_int)(p32))
/* ppc32 has 32bit aligned 64bit integers */
#define NETBSD32_INT64_ALIGN __attribute__((__aligned__(4)))
#include <compat/netbsd32/netbsd32.h>
#include <powerpc/frame.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.h,v 1.22 2007/03/16 22:24:49 dsl Exp $ */
/* $NetBSD: netbsd32_machdep.h,v 1.23 2007/09/16 22:35:02 dsl Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -39,6 +39,9 @@ struct proc;
#define NETBSD32_POINTER_TYPE uint32_t
typedef struct { NETBSD32_POINTER_TYPE i32; } netbsd32_pointer_t;
/* sparc32 has 32bit aligned 64bit integers */
#define NETBSD32_INT64_ALIGN __attribute__((__aligned__(4)))
/* from <arch/sparc/include/signal.h> */
typedef uint32_t netbsd32_sigcontextp_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32.h,v 1.66 2007/07/17 20:36:11 christos Exp $ */
/* $NetBSD: netbsd32.h,v 1.67 2007/09/16 22:35:02 dsl Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -64,6 +64,8 @@ typedef int32_t netbsd32_key_t;
typedef int32_t netbsd32_intptr_t;
typedef u_int32_t netbsd32_uintptr_t;
/* netbsd32_[u]int64 are machine dependant and defined below */
/*
* machine depedant section; must define:
* netbsd32_pointer_t
@ -119,6 +121,15 @@ NETBSD32IPTR64(NETBSD32_POINTER_TYPE p32) { return (void *)(intptr_t)p32; }
/* Nothing should be using the raw type, so kill it */
#undef NETBSD32_POINTER_TYPE
/*
* 64 bit integers only have 4-byte alignment on some 32 bit ports,
* but always have 8-byte alignment on 64 bit systems.
* NETBSD32_INT64_ALIGN may be __attribute__((__aligned__(4)))
*/
typedef int64_t netbsd32_int64 NETBSD32_INT64_ALIGN;
typedef uint64_t netbsd32_uint64 NETBSD32_INT64_ALIGN;
#undef NETBSD32_INT64_ALIGN
/*
* all pointers are netbsd32_pointer_t (defined in <machine/netbsd32_machdep.h>)
*/
@ -577,10 +588,10 @@ struct netbsd32_statvfs {
fsfilcnt_t f_ffree; /* free file nodes in file system */
fsfilcnt_t f_favail; /* free file nodes avail to non-root */
fsfilcnt_t f_fresvd; /* file nodes reserved for root */
uint64_t f_syncreads; /* count of sync reads since mount */
uint64_t f_syncwrites; /* count of sync writes since mount */
uint64_t f_asyncreads; /* count of async reads since mount */
uint64_t f_asyncwrites; /* count of async writes since mount */
netbsd32_uint64 f_syncreads; /* count of sync reads since mount */
netbsd32_uint64 f_syncwrites; /* count of sync writes since mount */
netbsd32_uint64 f_asyncreads; /* count of async reads since mount */
netbsd32_uint64 f_asyncwrites; /* count of async writes since mount */
fsid_t f_fsidx; /* NetBSD compatible fsid */
netbsd32_u_long f_fsid; /* Posix compatible fsid */
netbsd32_u_long f_namemax; /* maximum filename length */
@ -589,7 +600,7 @@ struct netbsd32_statvfs {
char f_fstypename[_VFS_NAMELEN]; /* fs type name */
char f_mntonname[_VFS_MNAMELEN]; /* directory on which mounted */
char f_mntfromname[_VFS_MNAMELEN]; /* mounted file system */
} __attribute__((packed));
};
/* from <sys/timex.h> */
typedef netbsd32_pointer_t netbsd32_ntptimevalp_t;