Linux PARISC architecture development
 help / color / mirror / Atom feed
* [parisc-linux] 2.4 64bits MAX_ADDRESS ?
@ 2003-11-09 17:37 Joel Soete
  2003-11-09 17:48 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Soete @ 2003-11-09 17:37 UTC (permalink / raw)
  To: parisc-linux

Hi all,

Being at the very begining of my study of the Mel Goramn' thesis and so 
comparing parisc linux vm implementation, I just try to figure out some 
cst values. I so write I small case:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

#define PAGE_SHIFT 12
#define PAGE_SIZE       (1UL << PAGE_SHIFT)
#define PAGE_MASK       (~(PAGE_SIZE-1))

/* ifdef __LP64__ */
#define PT_NLEVELS 3
#define PT_INITIAL 4 /* Number of initial page tables */
/*
#else __LP64__
#define PT_NLEVELS 2
#define PT_INITIAL 2
#endif
  */

#define MAX_ADDRBITS (PAGE_SHIFT + (PT_NLEVELS)*(PAGE_SHIFT - PT_NLEVELS))
#define MAX_ADDRESS (1UL << MAX_ADDRBITS)


int main(int argc, char * * argv, char * * env) {

     printf("For remainder:\n");
     printf("Int size: %d,\n", sizeof(int));
     printf("Long size: %d,\n", sizeof(long));
     printf("LongLong size: %d.\n\n", sizeof(long long));
     printf("Some VM cst into parisc 64bits:\n");
     printf("PAGE_SHIFT: %#010x (%u)\n\n", PAGE_SHIFT, PAGE_SHIFT);
     printf("PAGE_SIZE   (1UL << PAGE_SHIFT)\n");
     printf("PAGE_SIZE: %#010x (%u)\n\n", PAGE_SIZE, PAGE_SIZE);
     printf(" PAGE_MASK  (~(PAGE_SIZE-1))\n");
     printf("PAGE_MASK: %#010x (%u) (%d)\n\n", PAGE_MASK, PAGE_MASK, 
PAGE_MASK);

     printf("PT_NLEVELS: %#010x (%u)\n\n", PT_NLEVELS, PT_NLEVELS);
     printf("PT_INITIAL: %#010x (%u)\n\n", PT_INITIAL, PT_INITIAL);
     printf("MAX_ADDRBITS (PAGE_SHIFT + (PT_NLEVELS)*(PAGE_SHIFT - 
PT_NLEVELS))\n");
     printf("MAX_ADDRBITS: %#010x (%u)\n\n", MAX_ADDRBITS, MAX_ADDRBITS);
     printf("MAX_ADDRESS (1UL << MAX_ADDRBITS)\n");
     printf("MAX_ADDRESS: %#010Lx (%ul)\n\n", MAX_ADDRESS, MAX_ADDRESS);
}

which correctly warm me about some 'overflow':

foo.c: In function `main':
foo.c:42: warning: left shift count >= width of type
foo.c:42: warning: left shift count >= width of type

afaik MAX_ADDRBITS==39 against a long contains only 32bits?

So is this patch make sense for all (I trust if we want a day managing 
the some 15 Exabytes of vm available with pa-2.0 processors):
---------><---------
--- include/asm-parisc/pgtable.h.orig	2003-11-09 18:08:10.000000000 +0100
+++ include/asm-parisc/pgtable.h	2003-11-09 18:09:01.000000000 +0100
@@ -72,7 +72,11 @@
  #endif

  #define MAX_ADDRBITS (PAGE_SHIFT + (PT_NLEVELS)*(PAGE_SHIFT - PT_NLEVELS))
+#ifdef __LP64__
+#define MAX_ADDRESS (1ULL << MAX_ADDRBITS)
+#else
  #define MAX_ADDRESS (1UL << MAX_ADDRBITS)
+#endif

  #define SPACEID_SHIFT (MAX_ADDRBITS - 32)

---------><---------

And may be is this not the only change. Please advise.

Thanks inadvance,
	Joel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [parisc-linux] 2.4 64bits MAX_ADDRESS ?
  2003-11-09 17:37 [parisc-linux] 2.4 64bits MAX_ADDRESS ? Joel Soete
@ 2003-11-09 17:48 ` Matthew Wilcox
  2003-11-09 19:27   ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2003-11-09 17:48 UTC (permalink / raw)
  To: Joel Soete; +Cc: parisc-linux

On Sun, Nov 09, 2003 at 05:37:08PM +0000, Joel Soete wrote:
> which correctly warm me about some 'overflow':
> 
> foo.c: In function `main':
> foo.c:42: warning: left shift count >= width of type
> foo.c:42: warning: left shift count >= width of type
> 
> afaik MAX_ADDRBITS==39 against a long contains only 32bits?

no, long is 64-bit in LP64.  that's what LP64 means.

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [parisc-linux] 2.4 64bits MAX_ADDRESS ?
  2003-11-09 17:48 ` Matthew Wilcox
@ 2003-11-09 19:27   ` James Bottomley
  0 siblings, 0 replies; 3+ messages in thread
From: James Bottomley @ 2003-11-09 19:27 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Joel Soete, parisc-linux

On Sun, 2003-11-09 at 11:48, Matthew Wilcox wrote:
> no, long is 64-bit in LP64.  that's what LP64 means.

What Matthew says is correct for the kernel.  You got your error because
you look to have compiled your program in userspace with kernel
headers.  Since userspace is currently only 32 bit, that's why you get
the problems. 

If you want to try out 64 bit userspace, which is the only way userspace
will see a virtual address longer than 32 bits, then there's a
preliminary test environment at

http://parisc-linux.org/~jejb/64bit.tar.gz

The mini library may be sufficient to compile your program.

James

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-11-09 19:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-09 17:37 [parisc-linux] 2.4 64bits MAX_ADDRESS ? Joel Soete
2003-11-09 17:48 ` Matthew Wilcox
2003-11-09 19:27   ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox