Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Apr 2010 14:06:24 +0400
From:      pluknet <pluknet@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        freebsd-current@freebsd.org, Nathan Whitehorn <nwhitehorn@freebsd.org>
Subject:   Re: HEADS UP: COMPAT_IA32 renamed COMPAT_FREEBSD32
Message-ID:  <i2ka31046fc1004150306l619e5b2btc158df99f06627f3@mail.gmail.com>
In-Reply-To: <201004071549.41672.jhb@freebsd.org>
References:  <20100312171758.GB31089@dragon.NUXI.org> <l2wa31046fc1004050812q4b7c4437oc4a50ec1c834d2ab@mail.gmail.com> <4BBB5225.5020008@freebsd.org> <201004071549.41672.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 7 April 2010 23:49, John Baldwin <jhb@freebsd.org> wrote:
> On Tuesday 06 April 2010 11:24:21 am Nathan Whitehorn wrote:
>> pluknet wrote:
>> > Hi,
>> >
>> > the interesting part for me is how to properly assert now a value of e.g.
>> > KINFO_PROC_SIZE varying on err.. different COMPAT_FREEBSD32 arches
>> > (say, FreeBSD would have _kern_proc FreeBSD32 compat layer for top/ps/).
>> >
>> >
>> Probably the cleanest thing would be to set KINFO_PROC_SIZE in
>> machine/proc.h instead of where it is now, and then also define a
>> KINFO_PROC32_SIZE or something in the same place. Also, that would be a
>> really nice feature.
>
> Yes, I think this sounds like the best approach.
>

Something quick & not clean (well, it passes universe) attached.
So, don't shoot me, please ;-).
It's unclear how to convert those mips o32/n32/o64/n64 though.
I had to make definitions out of _KERNEL visibility as far as
<sys/proc.h> is included from <sys/user.h> in !_KERNEL only too.

-- 
wbr,
pluknet

[-- Attachment #2 --]
Index: sys/arm/include/proc.h
===================================================================
--- sys/arm/include/proc.h	(revision 206338)
+++ sys/arm/include/proc.h	(working copy)
@@ -60,4 +60,6 @@
 	void	*md_sigtramp;
 };
 
+#define KINFO_PROC_SIZE 792
+
 #endif /* !_MACHINE_PROC_H_ */
Index: sys/powerpc/include/proc.h
===================================================================
--- sys/powerpc/include/proc.h	(revision 206338)
+++ sys/powerpc/include/proc.h	(working copy)
@@ -46,4 +46,6 @@
 struct mdproc {
 };
 
+#define KINFO_PROC_SIZE 768
+
 #endif /* !_MACHINE_PROC_H_ */
Index: sys/sparc64/include/proc.h
===================================================================
--- sys/sparc64/include/proc.h	(revision 206338)
+++ sys/sparc64/include/proc.h	(working copy)
@@ -51,4 +51,6 @@
 	void	*md_sigtramp;
 };
 
+#define KINFO_PROC_SIZE 1088
+
 #endif /* !_MACHINE_PROC_H_ */
Index: sys/ia64/include/proc.h
===================================================================
--- sys/ia64/include/proc.h	(revision 206338)
+++ sys/ia64/include/proc.h	(working copy)
@@ -38,4 +38,6 @@
 	int		__dummy;	/* Avoid having an empty struct. */
 };
 
+#define KINFO_PROC_SIZE 1088
+
 #endif /* !_MACHINE_PROC_H_ */
Index: sys/mips/include/proc.h
===================================================================
--- sys/mips/include/proc.h	(revision 206338)
+++ sys/mips/include/proc.h	(working copy)
@@ -69,4 +69,10 @@
 void	mips_cpu_switch(struct thread *, struct thread *, struct mtx *);
 void	mips_cpu_throw(struct thread *, struct thread *);
 
+#ifdef __mips_n64
+#define KINFO_PROC_SIZE 1088
+#else
+#define KINFO_PROC_SIZE 816
+#endif
+
 #endif	/* !_MACHINE_PROC_H_ */
Index: sys/sun4v/include/proc.h
===================================================================
--- sys/sun4v/include/proc.h	(revision 206338)
+++ sys/sun4v/include/proc.h	(working copy)
@@ -51,4 +51,6 @@
 	void	*md_sigtramp;
 };
 
+#define KINFO_PROC_SIZE 1088
+
 #endif /* !_MACHINE_PROC_H_ */
Index: sys/i386/include/proc.h
===================================================================
--- sys/i386/include/proc.h	(revision 206338)
+++ sys/i386/include/proc.h	(working copy)
@@ -57,6 +57,8 @@
 	struct proc_ldt *md_ldt;	/* (t) per-process ldt */
 };
 
+#define KINFO_PROC_SIZE 768
+
 #ifdef	_KERNEL
 
 /* Get the current kernel thread stack usage. */
Index: sys/amd64/include/proc.h
===================================================================
--- sys/amd64/include/proc.h	(revision 206338)
+++ sys/amd64/include/proc.h	(working copy)
@@ -53,6 +53,11 @@
 	struct system_segment_descriptor md_ldt_sd;
 };
 
+#define KINFO_PROC_SIZE 1088
+#ifdef COMPAT_FREEBSD32
+#define KINFO_PROC32_SIZE 768
+#endif
+
 #ifdef	_KERNEL
 
 /* Get the current kernel thread stack usage. */
Index: sys/sys/user.h
===================================================================
--- sys/sys/user.h	(revision 206338)
+++ sys/sys/user.h	(working copy)
@@ -87,34 +87,11 @@
 #define	KI_NSPARE_LONG	12
 #define	KI_NSPARE_PTR	7
 
-#ifdef __amd64__
-#define	KINFO_PROC_SIZE	1088
-#endif
-#ifdef __arm__
-#define	KINFO_PROC_SIZE	792
-#endif
-#ifdef __ia64__
-#define	KINFO_PROC_SIZE 1088
-#endif
-#ifdef __i386__
-#define	KINFO_PROC_SIZE	768
-#endif
-#ifdef __mips__
-#ifdef __mips_n64
-#define	KINFO_PROC_SIZE	1088
-#else
-#define	KINFO_PROC_SIZE	816
-#endif
-#endif
-#ifdef __powerpc__
-#define	KINFO_PROC_SIZE	768
-#endif
-#ifdef __sparc64__
-#define	KINFO_PROC_SIZE 1088
-#endif
+#ifndef _KERNEL
 #ifndef KINFO_PROC_SIZE
 #error "Unknown architecture"
 #endif
+#endif /* !_KERNEL */
 
 #define	WMESGLEN	8		/* size of returned wchan message */
 #define	LOCKNAMELEN	8		/* size of returned lock name */

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?i2ka31046fc1004150306l619e5b2btc158df99f06627f3>