Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Joel Soete <soete.joel@tiscali.be>
To: parisc-linux@parisc-linux.org
Subject: [parisc-linux] 2.4 64bits MAX_ADDRESS ?
Date: Sun, 09 Nov 2003 17:37:08 +0000	[thread overview]
Message-ID: <3FAE7B44.6020805@tiscali.be> (raw)

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

             reply	other threads:[~2003-11-09 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-09 17:37 Joel Soete [this message]
2003-11-09 17:48 ` [parisc-linux] 2.4 64bits MAX_ADDRESS ? Matthew Wilcox
2003-11-09 19:27   ` James Bottomley

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=3FAE7B44.6020805@tiscali.be \
    --to=soete.joel@tiscali.be \
    --cc=parisc-linux@parisc-linux.org \
    /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