WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Merge.

# HG changeset patch
# User adsharma@xxxxxxxxxxxxxxxxxxxx
# Node ID dc61689b4781882b886edad3591240bc3a813274
# Parent  3d31c0ecdbd80bb5e70e830ac4501e27ee8753d9
# Parent  14aa0818c1cab85a6ed0bfb1f9759729967b3df4
Merge.

diff -r 3d31c0ecdbd8 -r dc61689b4781 
linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32
--- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32       Tue Aug 
 9 22:57:45 2005
+++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32       Wed Aug 
10 18:44:42 2005
@@ -415,7 +415,7 @@
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_CRAMFS is not set
+CONFIG_CRAMFS=y
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
diff -r 3d31c0ecdbd8 -r dc61689b4781 
linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64
--- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64       Tue Aug 
 9 22:57:45 2005
+++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64       Wed Aug 
10 18:44:42 2005
@@ -748,7 +748,7 @@
 # CONFIG_BEFS_DEBUG is not set
 CONFIG_BFS_FS=m
 CONFIG_EFS_FS=m
-CONFIG_CRAMFS=m
+CONFIG_CRAMFS=y
 CONFIG_VXFS_FS=m
 # CONFIG_HPFS_FS is not set
 CONFIG_QNX4FS_FS=m
diff -r 3d31c0ecdbd8 -r dc61689b4781 
linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c       Tue Aug  9 
22:57:45 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c       Wed Aug 10 
18:44:42 2005
@@ -182,8 +182,8 @@
        if ((((unsigned int)ptr & ~PAGE_MASK) + size) <= PAGE_SIZE) {
                dma = virt_to_bus(ptr);
        } else {
-               BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, 0)) == NULL);
-               BUG_ON((ent = kmalloc(sizeof(*ent), GFP_KERNEL)) == NULL);
+               BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, GFP_ATOMIC)) 
== NULL);
+               BUG_ON((ent = kmalloc(sizeof(*ent), GFP_ATOMIC)) == NULL);
                if (direction != DMA_FROM_DEVICE)
                        memcpy(bnc, ptr, size);
                ent->dma    = dma;
diff -r 3d31c0ecdbd8 -r dc61689b4781 
linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Tue Aug  9 22:57:45 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Wed Aug 10 18:44:42 2005
@@ -144,8 +144,6 @@
        return 1;
 }
 __setup("independent_wallclock", __independent_wallclock);
-#define INDEPENDENT_WALLCLOCK() \
-    (independent_wallclock || (xen_start_info.flags & SIF_INITDOMAIN))
 
 int tsc_disable __initdata = 0;
 
@@ -173,13 +171,16 @@
 static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
 {
        u64 product;
+#ifdef __i386__
        u32 tmp1, tmp2;
+#endif
 
        if ( shift < 0 )
                delta >>= -shift;
        else
                delta <<= shift;
 
+#ifdef __i386__
        __asm__ (
                "mul  %5       ; "
                "mov  %4,%%eax ; "
@@ -190,6 +191,11 @@
                "adc  %5,%%edx ; "
                : "=A" (product), "=r" (tmp1), "=r" (tmp2)
                : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
+#else
+       __asm__ (
+               "mul %%rdx ; shrd $32,%%rdx,%%rax"
+               : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
+#endif
 
        return product;
 }
@@ -203,8 +209,6 @@
                cpu_khz = __cpu_khz >> -info->tsc_shift;
        else
                cpu_khz = __cpu_khz << info->tsc_shift;
-       printk(KERN_INFO "Xen reported: %lu.%03lu MHz processor.\n",
-              cpu_khz / 1000, cpu_khz % 1000);
 }
 
 static u64 get_nsec_offset(struct shadow_time_info *shadow)
@@ -239,10 +243,7 @@
        }
        while ((s->wc_version & 1) | (shadow_tv_version ^ s->wc_version));
 
-       if (INDEPENDENT_WALLCLOCK())
-               return;
-
-       if ((time_status & STA_UNSYNC) != 0)
+       if (independent_wallclock)
                return;
 
        /* Adjust wall-clock time base based on wall_jiffies ticks. */
@@ -417,7 +418,7 @@
        if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
                return -EINVAL;
 
-       if (!INDEPENDENT_WALLCLOCK())
+       if (!independent_wallclock && !(xen_start_info.flags & SIF_INITDOMAIN))
                return 0; /* Silent failure? */
 
        cpu = get_cpu();
@@ -463,7 +464,8 @@
        time_esterror = NTP_PHASE_LIMIT;
 
 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
-       if (xen_start_info.flags & SIF_INITDOMAIN) {
+       if ((xen_start_info.flags & SIF_INITDOMAIN) &&
+           !independent_wallclock) {
                dom0_op_t op;
                op.cmd = DOM0_SETTIME;
                op.u.settime.secs        = xentime.tv_sec;
@@ -790,13 +792,15 @@
        }
 #endif
        get_time_values_from_xen();
-       update_wallclock();
-       set_normalized_timespec(&wall_to_monotonic,
-               -xtime.tv_sec, -xtime.tv_nsec);
+
        processed_system_time = per_cpu(shadow_time, 0).system_timestamp;
        per_cpu(processed_system_time, 0) = processed_system_time;
 
+       update_wallclock();
+
        init_cpu_khz();
+       printk(KERN_INFO "Xen reported: %lu.%03lu MHz processor.\n",
+              cpu_khz / 1000, cpu_khz % 1000);
 
 #if defined(__x86_64__)
        vxtime.mode = VXTIME_TSC;
@@ -871,14 +875,12 @@
 {
        init_cpu_khz();
 
-       /* Get timebases for new environment. */ 
        get_time_values_from_xen();
+
+       processed_system_time = per_cpu(shadow_time, 0).system_timestamp;
+       per_cpu(processed_system_time, 0) = processed_system_time;
+
        update_wallclock();
-
-       /* Reset our own concept of passage of system time. */
-       processed_system_time =
-               per_cpu(shadow_time, smp_processor_id()).system_timestamp;
-       per_cpu(processed_system_time, 0) = processed_system_time;
 
        per_cpu(timer_irq, 0) = bind_virq_to_irq(VIRQ_TIMER);
        (void)setup_irq(per_cpu(timer_irq, 0), &irq_timer);
diff -r 3d31c0ecdbd8 -r dc61689b4781 
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c
--- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c     Tue Aug  9 
22:57:45 2005
+++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c     Wed Aug 10 
18:44:42 2005
@@ -234,8 +234,8 @@
        if (((((unsigned long)ptr) & ~PAGE_MASK) + size) <= PAGE_SIZE) {
                dma = virt_to_bus(ptr);
        } else {
-               BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, 0)) == NULL);
-               BUG_ON((ent = kmalloc(sizeof(*ent), GFP_KERNEL)) == NULL);
+               BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, GFP_ATOMIC)) 
== NULL);
+               BUG_ON((ent = kmalloc(sizeof(*ent), GFP_ATOMIC)) == NULL);
                if (direction != DMA_FROM_DEVICE)
                        memcpy(bnc, ptr, size);
                ent->dma    = dma;
diff -r 3d31c0ecdbd8 -r dc61689b4781 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Tue Aug  9 22:57:45 2005
+++ b/tools/console/daemon/io.c Wed Aug 10 18:44:42 2005
@@ -231,6 +231,7 @@
 
                if (!write_sync(xcs_data_fd, &msg, sizeof(msg))) {
                        dolog(LOG_ERR, "Write to xcs failed: %m");
+                       exit(1);
                }
        } else {
                close(dom->tty_fd);
@@ -262,6 +263,7 @@
 
        if (!read_sync(fd, &msg, sizeof(msg))) {
                dolog(LOG_ERR, "read from xcs failed! %m");
+               exit(1);
        } else if (msg.type == XCS_REQUEST) {
                struct domain *dom;
 
diff -r 3d31c0ecdbd8 -r dc61689b4781 tools/console/daemon/utils.c
--- a/tools/console/daemon/utils.c      Tue Aug  9 22:57:45 2005
+++ b/tools/console/daemon/utils.c      Wed Aug 10 18:44:42 2005
@@ -59,6 +59,8 @@
 
                if (len < 1) {
                        if (len == -1 && (errno == EAGAIN || errno == EINTR)) {
+                               continue;
+                       } else {
                                return false;
                        }
                } else {
diff -r 3d31c0ecdbd8 -r dc61689b4781 tools/misc/xend
--- a/tools/misc/xend   Tue Aug  9 22:57:45 2005
+++ b/tools/misc/xend   Wed Aug 10 18:44:42 2005
@@ -24,6 +24,7 @@
 import socket
 import signal
 import time
+import commands
 
 XCS_PATH    = "/var/lib/xen/xcs_socket"
 XCS_EXEC    = "/usr/sbin/xcs"
@@ -116,8 +117,7 @@
        return    
 
 def start_xenstored():
-    if os.fork() == 0:
-        os.execvp('/usr/sbin/xenstored', ['/usr/sbin/xenstored']);
+    s,o = commands.getstatusoutput("/usr/sbin/xenstored 
--pid-file=/var/run/xenstore.pid");
 
 def start_consoled():
     if os.fork() == 0:
diff -r 3d31c0ecdbd8 -r dc61689b4781 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Tue Aug  9 22:57:45 2005
+++ b/tools/python/xen/xm/main.py       Wed Aug 10 18:44:42 2005
@@ -651,7 +651,7 @@
             sys.exit(1)
         except XendError, ex:
             if len(args) > 0:
-                handle_xend_error(argv[1], args[0], ex)
+                handle_xend_error(argv[1], args[1], ex)
             else:
                 print "Unexpected error:", sys.exc_info()[0]
                 print
diff -r 3d31c0ecdbd8 -r dc61689b4781 tools/xenstore/Makefile
--- a/tools/xenstore/Makefile   Tue Aug  9 22:57:45 2005
+++ b/tools/xenstore/Makefile   Wed Aug 10 18:44:42 2005
@@ -1,6 +1,5 @@
 XEN_ROOT=../..
 include $(XEN_ROOT)/tools/Rules.mk
-LIBDIR = lib
 XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
 
 INSTALL         = install
diff -r 3d31c0ecdbd8 -r dc61689b4781 tools/xenstore/utils.c
--- a/tools/xenstore/utils.c    Tue Aug  9 22:57:45 2005
+++ b/tools/xenstore/utils.c    Wed Aug 10 18:44:42 2005
@@ -80,30 +80,6 @@
        barf("malloc of %zu failed", size);
 }
 
-/* Stevens. */
-void daemonize(void)
-{
-       pid_t pid;
-
-       /* Separate from our parent via fork, so init inherits us. */
-       if ((pid = fork()) < 0)
-               barf_perror("Failed to fork daemon");
-       if (pid != 0)
-               exit(0);
-
-       close(STDIN_FILENO);
-       close(STDOUT_FILENO);
-       close(STDERR_FILENO);
-
-       /* Session leader so ^C doesn't whack us. */
-       setsid();
-       /* Move off any mount points we might be in. */
-       chdir("/");
-       /* Discard our parent's old-fashioned umask prejudices. */
-       umask(0);
-}
-
-
 /* This version adds one byte (for nul term) */
 void *grab_file(const char *filename, unsigned long *size)
 {
diff -r 3d31c0ecdbd8 -r dc61689b4781 tools/xenstore/utils.h
--- a/tools/xenstore/utils.h    Tue Aug  9 22:57:45 2005
+++ b/tools/xenstore/utils.h    Wed Aug 10 18:44:42 2005
@@ -40,9 +40,6 @@
 void *grab_file(const char *filename, unsigned long *size);
 void release_file(void *data, unsigned long size);
 
-/* For writing daemons, based on Stevens. */
-void daemonize(void);
-
 /* Signal handling: returns fd to listen on. */
 int signal_to_fd(int signal);
 void close_signal(int fd);
diff -r 3d31c0ecdbd8 -r dc61689b4781 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Tue Aug  9 22:57:45 2005
+++ b/tools/xenstore/xenstored_core.c   Wed Aug 10 18:44:42 2005
@@ -931,8 +931,7 @@
        }
 
        node = canonicalize(conn, vec[0]);
-       if (/*suppress error on write outside transaction*/ 0 &&
-           !within_transaction(conn->transaction, node)) {
+       if (!within_transaction(conn->transaction, node)) {
                send_error(conn, EROFS);
                return;
        }
@@ -1541,10 +1540,49 @@
                            xs_daemon_transactions());
 }
 
+static void write_pidfile(const char *pidfile)
+{
+       char buf[100];
+       int len;
+       int fd;
+
+       fd = open(pidfile, O_RDWR | O_CREAT, 0600);
+       if (fd == -1)
+               barf_perror("Opening pid file %s", pidfile);
+
+       /* We exit silently if daemon already running. */
+       if (lockf(fd, F_TLOCK, 0) == -1)
+               exit(0);
+
+       len = sprintf(buf, "%d\n", getpid());
+       write(fd, buf, len);
+}
+
+/* Stevens. */
+static void daemonize(void)
+{
+       pid_t pid;
+
+       /* Separate from our parent via fork, so init inherits us. */
+       if ((pid = fork()) < 0)
+               barf_perror("Failed to fork daemon");
+       if (pid != 0)
+               exit(0);
+
+       /* Session leader so ^C doesn't whack us. */
+       setsid();
+       /* Move off any mount points we might be in. */
+       chdir("/");
+       /* Discard our parent's old-fashioned umask prejudices. */
+       umask(0);
+}
+
+
 static struct option options[] = { { "no-fork", 0, NULL, 'N' },
                                   { "verbose", 0, NULL, 'V' },
                                   { "output-pid", 0, NULL, 'P' },
                                   { "trace-file", 1, NULL, 'T' },
+                                  { "pid-file", 1, NULL, 'F' },
                                   { NULL, 0, NULL, 0 } };
 
 int main(int argc, char *argv[])
@@ -1554,6 +1592,7 @@
        fd_set inset, outset;
        bool dofork = true;
        bool outputpid = false;
+       const char *pidfile = NULL;
 
        while ((opt = getopt_long(argc, argv, "DVT:", options, NULL)) != -1) {
                switch (opt) {
@@ -1573,10 +1612,19 @@
                                            optarg);
                         write(tracefd, "\n***\n", strlen("\n***\n"));
                        break;
+               case 'F':
+                       pidfile = optarg;
                }
        }
        if (optind != argc)
                barf("%s: No arguments desired", argv[0]);
+
+       if (dofork) {
+               openlog("xenstored", 0, LOG_DAEMON);
+               daemonize();
+       }
+       if (pidfile)
+               write_pidfile(pidfile);
 
        talloc_enable_leak_report_full();
 
@@ -1624,19 +1672,18 @@
        /* Restore existing connections. */
        restore_existing_connections();
 
-       /* Debugging: daemonize() closes standard fds, so dup here. */
-       tmpout = dup(STDOUT_FILENO);
-       if (dofork) {
-               openlog("xenstored", 0, LOG_DAEMON);
-               daemonize();
-       }
-
        if (outputpid) {
                char buffer[20];
                sprintf(buffer, "%i\n", getpid());
                write(tmpout, buffer, strlen(buffer));
        }
-       close(tmpout);
+
+       /* close stdin/stdout now we're ready to accept connections */
+       if (dofork) {
+               close(STDIN_FILENO);
+               close(STDOUT_FILENO);
+               close(STDERR_FILENO);
+       }
 
 #ifdef TESTING
        signal(SIGUSR1, stop_failtest);
diff -r 3d31c0ecdbd8 -r dc61689b4781 xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Tue Aug  9 22:57:45 2005
+++ b/xen/arch/x86/domain_build.c       Wed Aug 10 18:44:42 2005
@@ -78,8 +78,8 @@
     unsigned long pfn, mfn;
     unsigned long nr_pages;
     unsigned long nr_pt_pages;
-    unsigned long alloc_start;
-    unsigned long alloc_end;
+    unsigned long alloc_spfn;
+    unsigned long alloc_epfn;
     unsigned long count;
     struct pfn_info *page = NULL;
     start_info_t *si;
@@ -145,8 +145,8 @@
             ((image_len  + PAGE_SIZE - 1) >> PAGE_SHIFT);
     if ( (page = alloc_largest(d, nr_pages)) == NULL )
         panic("Not enough RAM for DOM0 reservation.\n");
-    alloc_start = page_to_phys(page);
-    alloc_end   = alloc_start + (d->tot_pages << PAGE_SHIFT);
+    alloc_spfn = page_to_pfn(page);
+    alloc_epfn = alloc_spfn + d->tot_pages;
 
     if ( (rc = parseelfimage(&dsi)) != 0 )
         return rc;
@@ -166,7 +166,7 @@
         return -EINVAL;
     }
     if (strstr(dsi.xen_section_string, "SHADOW=translate"))
-       opt_dom0_translate = 1;
+        opt_dom0_translate = 1;
 
     /* Align load address to 4MB boundary. */
     dsi.v_start &= ~((1UL<<22)-1);
@@ -215,12 +215,12 @@
 #endif
     }
 
-    if ( (v_end - dsi.v_start) > (alloc_end - alloc_start) )
+    if ( ((v_end - dsi.v_start) >> PAGE_SHIFT) > (alloc_epfn - alloc_spfn) )
         panic("Insufficient contiguous RAM to build kernel image.\n");
 
     printk("PHYSICAL MEMORY ARRANGEMENT:\n"
-           " Dom0 alloc.:   %p->%p",
-           _p(alloc_start), _p(alloc_end));
+           " Dom0 alloc.:   %"PRIphysaddr"->%"PRIphysaddr,
+           pfn_to_phys(alloc_spfn), pfn_to_phys(alloc_epfn));
     if ( d->tot_pages < nr_pages )
         printk(" (%lu pages to be allocated)",
                nr_pages - d->tot_pages);
@@ -249,7 +249,8 @@
         return -ENOMEM;
     }
 
-    mpt_alloc = (vpt_start - dsi.v_start) + alloc_start;
+    mpt_alloc = (vpt_start - dsi.v_start) + 
+        (unsigned long)pfn_to_phys(alloc_spfn);
 
     /*
      * We're basically forcing default RPLs to 1, so that our "what privilege
@@ -306,7 +307,7 @@
 #endif
 
     l2tab += l2_linear_offset(dsi.v_start);
-    mfn = alloc_start >> PAGE_SHIFT;
+    mfn = alloc_spfn;
     for ( count = 0; count < ((v_end-dsi.v_start)>>PAGE_SHIFT); count++ )
     {
         if ( !((unsigned long)l1tab & (PAGE_SIZE-1)) )
@@ -428,7 +429,7 @@
     v->arch.guest_table = mk_pagetable(__pa(l4start));
 
     l4tab += l4_table_offset(dsi.v_start);
-    mfn = alloc_start >> PAGE_SHIFT;
+    mfn = alloc_spfn;
     for ( count = 0; count < ((v_end-dsi.v_start)>>PAGE_SHIFT); count++ )
     {
         if ( !((unsigned long)l1tab & (PAGE_SIZE-1)) )
@@ -563,11 +564,11 @@
     /* Write the phys->machine and machine->phys table entries. */
     for ( pfn = 0; pfn < d->tot_pages; pfn++ )
     {
-        mfn = pfn + (alloc_start>>PAGE_SHIFT);
+        mfn = pfn + alloc_spfn;
 #ifndef NDEBUG
 #define REVERSE_START ((v_end - dsi.v_start) >> PAGE_SHIFT)
         if ( !opt_dom0_translate && (pfn > REVERSE_START) )
-            mfn = (alloc_end>>PAGE_SHIFT) - (pfn - REVERSE_START);
+            mfn = alloc_epfn - (pfn - REVERSE_START);
 #endif
         ((u32 *)vphysmap_start)[pfn] = mfn;
         machine_to_phys_mapping[mfn] = pfn;
@@ -580,7 +581,7 @@
         {
             mfn = page_to_pfn(page);
 #ifndef NDEBUG
-#define pfn (nr_pages - 1 - (pfn - ((alloc_end - alloc_start) >> PAGE_SHIFT)))
+#define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn)))
 #endif
             ((u32 *)vphysmap_start)[pfn] = mfn;
             machine_to_phys_mapping[mfn] = pfn;
@@ -620,13 +621,13 @@
 
     if ( opt_dom0_shadow || opt_dom0_translate )
     {
-       printk("dom0: shadow enable\n");
+        printk("dom0: shadow enable\n");
         shadow_mode_enable(d, (opt_dom0_translate
                                ? SHM_enable | SHM_refcounts | SHM_translate
                                : SHM_enable));
         if ( opt_dom0_translate )
         {
-           printk("dom0: shadow translate\n");
+            printk("dom0: shadow translate\n");
 #if defined(__i386__) && defined(CONFIG_X86_PAE)
             printk("FIXME: PAE code needed here: %s:%d (%s)\n",
                    __FILE__, __LINE__, __FUNCTION__);
@@ -659,7 +660,7 @@
         }
 
         update_pagetables(v); /* XXX SMP */
-       printk("dom0: shadow setup done\n");
+        printk("dom0: shadow setup done\n");
     }
 
     return 0;
diff -r 3d31c0ecdbd8 -r dc61689b4781 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Tue Aug  9 22:57:45 2005
+++ b/xen/arch/x86/time.c       Wed Aug 10 18:44:42 2005
@@ -103,13 +103,16 @@
 static inline u64 scale_delta(u64 delta, struct time_scale *scale)
 {
     u64 product;
+#ifdef CONFIG_X86_32
     u32 tmp1, tmp2;
+#endif
 
     if ( scale->shift < 0 )
         delta >>= -scale->shift;
     else
         delta <<= scale->shift;
 
+#ifdef CONFIG_X86_32
     __asm__ (
         "mul  %5       ; "
         "mov  %4,%%eax ; "
@@ -120,6 +123,11 @@
         "adc  %5,%%edx ; "
         : "=A" (product), "=r" (tmp1), "=r" (tmp2)
         : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (scale->mul_frac) );
+#else
+    __asm__ (
+        "mul %%rdx ; shrd $32,%%rdx,%%rax"
+        : "=a" (product) : "0" (delta), "d" ((u64)scale->mul_frac) );
+#endif
 
     return product;
 }
diff -r 3d31c0ecdbd8 -r dc61689b4781 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Tue Aug  9 22:57:45 2005
+++ b/xen/common/page_alloc.c   Wed Aug 10 18:44:42 2005
@@ -52,7 +52,6 @@
  *  One bit per page of memory. Bit set => page is allocated.
  */
 
-static unsigned long  bitmap_size; /* in bytes */
 static unsigned long *alloc_bitmap;
 #define PAGES_PER_MAPWORD (sizeof(unsigned long) * 8)
 
@@ -135,10 +134,16 @@
 /* Initialise allocator to handle up to @max_page pages. */
 physaddr_t init_boot_allocator(physaddr_t bitmap_start)
 {
+    unsigned long bitmap_size;
+
     bitmap_start = round_pgup(bitmap_start);
 
-    /* Allocate space for the allocation bitmap. */
+    /*
+     * Allocate space for the allocation bitmap. Include an extra longword
+     * of padding for possible overrun in map_alloc and map_free.
+     */
     bitmap_size  = max_page / 8;
+    bitmap_size += sizeof(unsigned long);
     bitmap_size  = round_pgup(bitmap_size);
     alloc_bitmap = (unsigned long *)phys_to_virt(bitmap_start);
 
@@ -171,7 +176,7 @@
         else if ( *p != '\0' )
             break;
 
-        if ( (bad_pfn < (bitmap_size*8)) && !allocated_in_map(bad_pfn) )
+        if ( (bad_pfn < max_page) && !allocated_in_map(bad_pfn) )
         {
             printk("Marking page %lx as bad\n", bad_pfn);
             map_alloc(bad_pfn, 1);
@@ -183,7 +188,7 @@
 {
     unsigned long pg, i;
 
-    for ( pg = 0; (pg + nr_pfns) < (bitmap_size*8); pg += pfn_align )
+    for ( pg = 0; (pg + nr_pfns) < max_page; pg += pfn_align )
     {
         for ( i = 0; i < nr_pfns; i++ )
             if ( allocated_in_map(pg + i) )
@@ -362,7 +367,7 @@
 
     printk("Scrubbing Free RAM: ");
 
-    for ( pfn = 0; pfn < (bitmap_size * 8); pfn++ )
+    for ( pfn = 0; pfn < max_page; pfn++ )
     {
         /* Every 100MB, print a progress dot. */
         if ( (pfn % ((100*1024*1024)/PAGE_SIZE)) == 0 )
diff -r 3d31c0ecdbd8 -r dc61689b4781 xen/include/asm-x86/page.h
--- a/xen/include/asm-x86/page.h        Tue Aug  9 22:57:45 2005
+++ b/xen/include/asm-x86/page.h        Wed Aug 10 18:44:42 2005
@@ -188,6 +188,9 @@
 #define phys_to_page(kaddr) (frame_table + ((kaddr) >> PAGE_SHIFT))
 #define virt_to_page(kaddr) (frame_table + (__pa(kaddr) >> PAGE_SHIFT))
 #define pfn_valid(_pfn)     ((_pfn) < max_page)
+
+#define pfn_to_phys(pfn)    ((physaddr_t)(pfn) << PAGE_SHIFT)
+#define phys_to_pfn(pa)     ((unsigned long)((pa) >> PAGE_SHIFT))
 
 /* High table entries are reserved by the hypervisor. */
 #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
diff -r 3d31c0ecdbd8 -r dc61689b4781 xen/include/asm-x86/types.h
--- a/xen/include/asm-x86/types.h       Tue Aug  9 22:57:45 2005
+++ b/xen/include/asm-x86/types.h       Wed Aug 10 18:44:42 2005
@@ -38,13 +38,16 @@
 typedef unsigned long long u64;
 #if defined(CONFIG_X86_PAE)
 typedef u64 physaddr_t;
+#define PRIphysaddr "016llx"
 #else
-typedef u32 physaddr_t;
+typedef unsigned long physaddr_t;
+#define PRIphysaddr "08lx"
 #endif
 #elif defined(__x86_64__)
 typedef signed long s64;
 typedef unsigned long u64;
-typedef u64 physaddr_t;
+typedef unsigned long physaddr_t;
+#define PRIphysaddr "016lx"
 #endif
 
 typedef unsigned long size_t;
diff -r 3d31c0ecdbd8 -r dc61689b4781 xen/include/asm-x86/x86_32/uaccess.h
--- a/xen/include/asm-x86/x86_32/uaccess.h      Tue Aug  9 22:57:45 2005
+++ b/xen/include/asm-x86/x86_32/uaccess.h      Wed Aug 10 18:44:42 2005
@@ -67,7 +67,7 @@
                "       .long 1b,4b\n"                          \
                "       .long 2b,4b\n"                          \
                ".previous"                                     \
-               : "=r" (retval), "=A" (x)                       \
+               : "=r" (retval), "=&A" (x)                      \
                : "r" (addr), "i"(errret), "0"(retval))
 
 #define __get_user_size(x,ptr,size,retval,errret)                      \

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>