ia64/xen-unstable

changeset 111:033b5b739c6f

bitkeeper revision 1.22 (3e3a9049ZUW-GlNZmkFtI9Ae2r4zJg)

Finally, full & working & tested xeno with userspace domain building... Go and boot whatever :)
author bd240@boulderdash.cl.cam.ac.uk
date Fri Jan 31 15:03:37 2003 +0000 (2003-01-31)
parents f68a7447d88c
children b0d356ed774b b46b05647a32
files xen-2.4.16/common/dom0_ops.c xen-2.4.16/common/domain.c xen-2.4.16/common/memory.c xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c
line diff
     1.1 --- a/xen-2.4.16/common/dom0_ops.c	Thu Jan 30 13:25:10 2003 +0000
     1.2 +++ b/xen-2.4.16/common/dom0_ops.c	Fri Jan 31 15:03:37 2003 +0000
     1.3 @@ -41,16 +41,16 @@ static void build_page_list(struct task_
     1.4      curr = p->pg_head;
     1.5      *list++ = p->pg_head;
     1.6      page = (frame_table + p->pg_head)->next;
     1.7 -    printk(KERN_ALERT "bd240 debug: list %lx, page num %lx\n", list, page);
     1.8      while(page != p->pg_head){
     1.9          if(!((unsigned long)list & (PAGE_SIZE-1))){
    1.10 -            printk(KERN_ALERT "bd240 debug: list %lx, page num %lx\n", list, page);
    1.11              curr = (frame_table + curr)->next;
    1.12 +            unmap_domain_mem((unsigned long)(list-1) & PAGE_MASK);
    1.13              list = (unsigned long *)map_domain_mem(curr << PAGE_SHIFT);
    1.14          }
    1.15          *list++ = page;
    1.16          page = (frame_table + page)->next;
    1.17      }
    1.18 +    unmap_domain_mem((unsigned long)(list-1) & PAGE_MASK);
    1.19  }
    1.20      
    1.21  long do_dom0_op(dom0_op_t *u_dom0_op)
    1.22 @@ -99,17 +99,18 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    1.23           * needs to be allocated
    1.24           */
    1.25          if(dom != 0){
    1.26 +
    1.27              if(alloc_new_dom_mem(p, op.u.newdomain.memory_kb) != 0){
    1.28                  ret = -1;
    1.29                  break;
    1.30              }
    1.31              build_page_list(p);
    1.32 +            
    1.33              ret = p->domain;
    1.34  
    1.35              op.u.newdomain.domain = ret;
    1.36              op.u.newdomain.pg_head = p->pg_head;
    1.37              copy_to_user(u_dom0_op, &op, sizeof(op));
    1.38 -            printk(KERN_ALERT "bd240 debug: hyp dom0_ops: %lx, %d\n", op.u.newdomain.pg_head, op.u.newdomain.memory_kb);
    1.39  
    1.40              break;
    1.41          }
     2.1 --- a/xen-2.4.16/common/domain.c	Thu Jan 30 13:25:10 2003 +0000
     2.2 +++ b/xen-2.4.16/common/domain.c	Fri Jan 31 15:03:37 2003 +0000
     2.3 @@ -361,6 +361,7 @@ unsigned int alloc_new_dom_mem(struct ta
     2.4      temp = temp->next;
     2.5      list_del(&pf->list);
     2.6      pf->next = pf->prev = p->pg_head = (pf - frame_table);
     2.7 +    pf->type_count = pf->tot_count = 0;
     2.8      free_pfns--;
     2.9      pf_head = pf;
    2.10  
    2.11 @@ -375,6 +376,7 @@ unsigned int alloc_new_dom_mem(struct ta
    2.12          pf->prev = pf_head->prev;
    2.13          (frame_table + pf_head->prev)->next = (pf - frame_table);
    2.14          pf_head->prev = (pf - frame_table);
    2.15 +        pf->type_count = pf->tot_count = 0;
    2.16  
    2.17          free_pfns--;
    2.18      }
    2.19 @@ -409,7 +411,7 @@ int final_setup_guestos(struct task_stru
    2.20      start_info_t * virt_startinfo_addr;
    2.21      unsigned long virt_stack_addr;
    2.22      unsigned long long time;
    2.23 -    unsigned long phys_l1tab, phys_l2tab;
    2.24 +    unsigned long phys_l2tab;
    2.25      page_update_request_t * pgt_updates;
    2.26      unsigned long curr_update_phys;
    2.27      unsigned long count;
    2.28 @@ -432,6 +434,7 @@ int final_setup_guestos(struct task_stru
    2.29              pgt_updates = (page_update_request_t *)map_domain_mem(curr_update_phys);
    2.30          }
    2.31      }
    2.32 +    unmap_domain_mem((void *)((unsigned long)(pgt_updates-1) & PAGE_MASK));
    2.33  
    2.34      /* entries 0xe0000000 onwards in page table must contain hypervisor
    2.35       * mem mappings - set them up.
    2.36 @@ -452,12 +455,11 @@ int final_setup_guestos(struct task_stru
    2.37      phys_l2tab = pagetable_val(p->mm.pagetable); 
    2.38      l2tab = map_domain_mem(phys_l2tab);
    2.39      l2tab += l2_table_offset(meminfo->virt_shinfo_addr);
    2.40 -    phys_l1tab = l2_pgentry_to_phys(*l2tab) + 
    2.41 -        (l1_table_offset(meminfo->virt_shinfo_addr) * sizeof(l1_pgentry_t));
    2.42 -    l1tab = map_domain_mem(phys_l1tab);
    2.43 +    l1tab = map_domain_mem(l2_pgentry_to_phys(*l2tab));
    2.44 +    l1tab += l1_table_offset(meminfo->virt_shinfo_addr);
    2.45      *l1tab = mk_l1_pgentry(__pa(p->shared_info) | L1_PROT);
    2.46 -    unmap_domain_mem(l2tab);
    2.47 -    unmap_domain_mem(l1tab);
    2.48 +    unmap_domain_mem((void *)((unsigned long)l2tab & PAGE_MASK));
    2.49 +    unmap_domain_mem((void *)((unsigned long)l1tab & PAGE_MASK));
    2.50  
    2.51      /* set up the shared info structure */
    2.52      rdtscll(time);
    2.53 @@ -535,8 +537,7 @@ int final_setup_guestos(struct task_stru
    2.54      __asm__ __volatile__ (
    2.55          "mov %%eax,%%cr3" : : "a" (pagetable_val(current->mm.pagetable)));    
    2.56      __sti();
    2.57 -
    2.58 -
    2.59 +    
    2.60      new_thread(p, 
    2.61                 (unsigned long)meminfo->virt_load_addr, 
    2.62                 (unsigned long)virt_stack_addr, 
    2.63 @@ -570,7 +571,7 @@ int setup_guestos(struct task_struct *p,
    2.64      unsigned long alloc_index;
    2.65      unsigned long ft_pages;
    2.66      l2_pgentry_t *l2tab, *l2start;
    2.67 -    l1_pgentry_t *l1tab = NULL;
    2.68 +    l1_pgentry_t *l1tab = NULL, *l1start = NULL;
    2.69      struct pfn_info *page = NULL;
    2.70      net_ring_t *net_ring;
    2.71      net_vif_t *net_vif;
    2.72 @@ -627,53 +628,74 @@ int setup_guestos(struct task_struct *p,
    2.73       * and frame table struct.
    2.74       */
    2.75  
    2.76 -    ft_pages = (frame_table_size + (PAGE_SIZE - 1)) << PAGE_SHIFT;
    2.77 +    ft_pages = frame_table_size >> PAGE_SHIFT;
    2.78      l2tab += l2_table_offset(virt_load_address);
    2.79      cur_address = p->pg_head << PAGE_SHIFT;
    2.80      for ( count  = 0;
    2.81 -          count < p->tot_pages + 1;
    2.82 +          count < p->tot_pages + 1 + ft_pages;
    2.83            count++)
    2.84      {
    2.85          if ( !((unsigned long)l1tab & (PAGE_SIZE-1)) )
    2.86          {
    2.87 -            if ( l1tab != NULL ) unmap_domain_mem(l1tab-1);
    2.88 +            if ( l1tab != NULL ) unmap_domain_mem(l1start);
    2.89              phys_l1tab = alloc_page_from_domain(&alloc_address, &alloc_index);
    2.90              *l2tab++ = mk_l2_pgentry(phys_l1tab|L2_PROT);
    2.91 -            l1tab = map_domain_mem(phys_l1tab);
    2.92 +            l1start = l1tab = map_domain_mem(phys_l1tab);
    2.93              clear_page(l1tab);
    2.94              l1tab += l1_table_offset(
    2.95                  virt_load_address + (count << PAGE_SHIFT));
    2.96          }
    2.97 +        *l1tab++ = mk_l1_pgentry(cur_address|L1_PROT);
    2.98          
    2.99 -        if( count < alloc_index )
   2.100 +        if(count < p->tot_pages)
   2.101          {
   2.102 -            *l1tab++ = mk_l1_pgentry(cur_address|L1_PROT);
   2.103              page = frame_table + (cur_address >> PAGE_SHIFT);
   2.104              page->flags = dom | PGT_writeable_page;
   2.105              page->type_count = page->tot_count = 1;
   2.106 -        } 
   2.107 -        else 
   2.108 -        {
   2.109 -            *l1tab++ = mk_l1_pgentry((cur_address|L1_PROT) & ~_PAGE_RW);
   2.110 -            page = frame_table + (cur_address >> PAGE_SHIFT);
   2.111 -            page->flags = dom | PGT_l1_page_table;
   2.112 -            page->type_count = 1;
   2.113 -            page->tot_count = 2; 
   2.114          }
   2.115  
   2.116          cur_address = ((frame_table + (cur_address >> PAGE_SHIFT))->next) << PAGE_SHIFT;
   2.117      }
   2.118 -    unmap_domain_mem(l1tab-1);
   2.119 -    page = frame_table + (frame_table + p->pg_head)->prev; 
   2.120 +    unmap_domain_mem(l1start);
   2.121 +
   2.122 +    /* pages that are part of page tables must be read only */
   2.123 +    cur_address = p->pg_head << PAGE_SHIFT;
   2.124 +    for(count = 0;
   2.125 +        count < alloc_index;
   2.126 +        count++){
   2.127 +        cur_address = ((frame_table + (cur_address >> PAGE_SHIFT))->next) << PAGE_SHIFT;
   2.128 +    }
   2.129 +
   2.130 +    l2tab = l2start + l2_table_offset(virt_load_address + 
   2.131 +        (alloc_index << PAGE_SHIFT));
   2.132 +    l1start = l1tab = map_domain_mem(l2_pgentry_to_phys(*l2tab));
   2.133 +    l1tab += l1_table_offset(virt_load_address + (alloc_index << PAGE_SHIFT));
   2.134 +    l2tab++;
   2.135 +    for(count = alloc_index;
   2.136 +        count < p->tot_pages;
   2.137 +        count++){
   2.138 +        *l1tab++ = mk_l1_pgentry(l1_pgentry_val(*l1tab) & ~_PAGE_RW);
   2.139 +        if(!((unsigned long)l1tab & (PAGE_SIZE - 1))){
   2.140 +            unmap_domain_mem(l1start);
   2.141 +            l1start = l1tab = map_domain_mem(l2_pgentry_to_phys(*l2tab));
   2.142 +            l2tab++;
   2.143 +        }
   2.144 +        page = frame_table + (cur_address >> PAGE_SHIFT);
   2.145 +        page->flags = dom | PGT_l1_page_table;
   2.146 +        page->tot_count++;
   2.147 +        
   2.148 +        cur_address = ((frame_table + (cur_address >> PAGE_SHIFT))->next) << PAGE_SHIFT;
   2.149 +    }
   2.150      page->flags = dom | PGT_l2_page_table;
   2.151 +    unmap_domain_mem(l1start);
   2.152  
   2.153      /* Map in the the shared info structure. */
   2.154      virt_shinfo_address = virt_load_address + (p->tot_pages << PAGE_SHIFT); 
   2.155      l2tab = l2start + l2_table_offset(virt_shinfo_address);
   2.156 -    l1tab = map_domain_mem(l2_pgentry_to_phys(*l2tab));
   2.157 +    l1start = l1tab = map_domain_mem(l2_pgentry_to_phys(*l2tab));
   2.158      l1tab += l1_table_offset(virt_shinfo_address);
   2.159      *l1tab = mk_l1_pgentry(__pa(p->shared_info)|L1_PROT);
   2.160 -    unmap_domain_mem(l1tab);
   2.161 +    unmap_domain_mem(l1start);
   2.162  
   2.163      /* Set up shared info area. */
   2.164      rdtscll(time);
   2.165 @@ -693,10 +715,10 @@ int setup_guestos(struct task_struct *p,
   2.166          cur_address < virt_ftable_end;
   2.167          cur_address += PAGE_SIZE){
   2.168          l2tab = l2start + l2_table_offset(cur_address);
   2.169 -        l1tab = map_domain_mem(l2_pgentry_to_phys(*l2tab));
   2.170 +        l1start = l1tab = map_domain_mem(l2_pgentry_to_phys(*l2tab));
   2.171          l1tab += l1_table_offset(cur_address);
   2.172          *l1tab = mk_l1_pgentry(__pa(ft_mapping)|L1_PROT);
   2.173 -        unmap_domain_mem(l1tab);
   2.174 +        unmap_domain_mem(l1start);
   2.175          ft_mapping += PAGE_SIZE;
   2.176      }
   2.177      
   2.178 @@ -791,7 +813,6 @@ int setup_guestos(struct task_struct *p,
   2.179      return 0;
   2.180  }
   2.181  
   2.182 -
   2.183  void __init domain_init(void)
   2.184  {
   2.185      int i;
   2.186 @@ -803,16 +824,3 @@ void __init domain_init(void)
   2.187          schedule_data[i].curr = &idle0_task;
   2.188      }
   2.189  }
   2.190 -
   2.191 -
   2.192 -
   2.193 -#if 0
   2.194 -    unsigned long s = (mod[        0].mod_start + (PAGE_SIZE-1)) & PAGE_MASK;
   2.195 -    unsigned long e = (mod[nr_mods-1].mod_end   + (PAGE_SIZE-1)) & PAGE_MASK;
   2.196 -    while ( s != e ) 
   2.197 -    { 
   2.198 -        free_pages((unsigned long)__va(s), 0); 
   2.199 -        s += PAGE_SIZE;
   2.200 -    }
   2.201 -#endif
   2.202 -
     3.1 --- a/xen-2.4.16/common/memory.c	Thu Jan 30 13:25:10 2003 +0000
     3.2 +++ b/xen-2.4.16/common/memory.c	Fri Jan 31 15:03:37 2003 +0000
     3.3 @@ -269,6 +269,7 @@ static int inc_page_refcnt(unsigned long
     3.4                      flags & PG_type_mask, type, page_type_count(page));
     3.5              return -1;
     3.6          }
     3.7 +
     3.8          page->flags |= type;
     3.9      }
    3.10  
    3.11 @@ -332,7 +333,7 @@ static int get_l2_table(unsigned long pa
    3.12  {
    3.13      l2_pgentry_t *p_l2_entry, l2_entry;
    3.14      int i, ret=0;
    3.15 -    
    3.16 +   
    3.17      ret = inc_page_refcnt(page_nr, PGT_l2_page_table);
    3.18      if ( ret != 0 ) return (ret < 0) ? ret : 0;
    3.19      
    3.20 @@ -354,7 +355,7 @@ static int get_l2_table(unsigned long pa
    3.21          if ( ret ) ret = get_twisted_l2_table(page_nr, l2_entry);
    3.22          if ( ret ) goto out;
    3.23      }
    3.24 -
    3.25 +    
    3.26      /* Now we simply slap in our high mapping. */
    3.27      memcpy(p_l2_entry, 
    3.28             idle_pg_table[smp_processor_id()] + DOMAIN_ENTRIES_PER_L2_PAGETABLE,
    3.29 @@ -570,8 +571,6 @@ static int mod_l1_entry(unsigned long pa
    3.30                (_PAGE_GLOBAL|_PAGE_PAT)) ) 
    3.31          {
    3.32  
    3.33 -            printk(KERN_ALERT "bd240 debug: bad l1 entry val %lx\n", l1_pgentry_val(new_l1_entry) & (_PAGE_GLOBAL | _PAGE_PAT));
    3.34 -
    3.35              MEM_LOG("Bad L1 entry val %04lx",
    3.36                      l1_pgentry_val(new_l1_entry) & 
    3.37                      (_PAGE_GLOBAL|_PAGE_PAT));
    3.38 @@ -592,7 +591,6 @@ static int mod_l1_entry(unsigned long pa
    3.39              
    3.40              if ( get_page(l1_pgentry_to_pagenr(new_l1_entry),
    3.41                            l1_pgentry_val(new_l1_entry) & _PAGE_RW) ){
    3.42 -                printk(KERN_ALERT "bd240 debug: get_page err\n");
    3.43                  goto fail;
    3.44              }
    3.45          } 
    3.46 @@ -765,30 +763,6 @@ int do_process_page_updates_bh(page_upda
    3.47              break;
    3.48  
    3.49              /*
    3.50 -             * PGREQ_UNCHECKED_UPDATE: Make an unchecked update to a
    3.51 -             * bottom-level page-table entry.
    3.52 -             * Restrictions apply:
    3.53 -             *  1. Update only allowed by domain 0.
    3.54 -             *  2. Update must be to a level-1 pte belonging to dom0.
    3.55 -             */
    3.56 -        case PGREQ_UNCHECKED_UPDATE:
    3.57 -            cur->ptr &= ~(sizeof(l1_pgentry_t) - 1);
    3.58 -            page = frame_table + pfn;
    3.59 -            flags = page->flags;
    3.60 -            if ( (flags | current->domain) == PGT_l1_page_table )
    3.61 -            {
    3.62 -                
    3.63 -                *(unsigned long *)map_domain_mem(cur->ptr) = cur->val;
    3.64 -                err = 0;
    3.65 -            }
    3.66 -            else
    3.67 -            {
    3.68 -                MEM_LOG("UNCHECKED_UPDATE: Bad domain %d, or"
    3.69 -                        " bad pte type %08lx", current->domain, flags);
    3.70 -            }
    3.71 -            break;
    3.72 -
    3.73 -            /*
    3.74               * PGREQ_EXTENDED_COMMAND: Extended command is specified
    3.75               * in the least-siginificant bits of the 'value' field.
    3.76               */
    3.77 @@ -804,7 +778,6 @@ int do_process_page_updates_bh(page_upda
    3.78  
    3.79          if ( err )
    3.80          {
    3.81 -            page = frame_table + (cur->ptr >> PAGE_SHIFT);
    3.82              kill_domain_with_errmsg("Illegal page update request");
    3.83          }
    3.84  
     4.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c	Thu Jan 30 13:25:10 2003 +0000
     4.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c	Fri Jan 31 15:03:37 2003 +0000
     4.3 @@ -1,3 +1,4 @@
     4.4 +
     4.5  /******************************************************************************
     4.6   * dom0_core.c
     4.7   * 
     4.8 @@ -40,6 +41,8 @@
     4.9  #define DOM_DIR         "dom"
    4.10  #define DOM_MEM         "mem"
    4.11  
    4.12 +#define MAP_DISCONT     1
    4.13 +
    4.14  frame_table_t * frame_table;
    4.15  
    4.16  static struct proc_dir_entry *xeno_base;
    4.17 @@ -65,7 +68,6 @@ static int cmd_read_proc(char *page, cha
    4.18  static void create_proc_dom_entries(int dom)
    4.19  {
    4.20      struct proc_dir_entry * dir;
    4.21 -    struct proc_dir_entry * file;
    4.22      dom_procdata_t * dom_data;
    4.23      char dir_name[MAX_LEN];
    4.24  
    4.25 @@ -104,12 +106,8 @@ static ssize_t dom_mem_read(struct file 
    4.26  
    4.27      /* remap the range using xen specific routines */
    4.28  
    4.29 -    printk(KERN_ALERT "bd240 debug: dmw entered %lx, %lx\n", mem_data->pfn, mem_data->tot_pages);
    4.30 -
    4.31 -    addr = direct_mmap(mem_data->pfn << PAGE_SHIFT, mem_data->tot_pages << PAGE_SHIFT, prot, 0, 0);
    4.32 +    addr = direct_mmap(mem_data->pfn << PAGE_SHIFT, mem_data->tot_pages << PAGE_SHIFT, prot, MAP_DISCONT, mem_data->tot_pages);
    4.33      
    4.34 -    printk(KERN_ALERT "bd240 debug: dmw exit %lx, %lx\n", mem_data->pfn, mem_data->tot_pages);
    4.35 -
    4.36      copy_to_user((unsigned long *)buff, &addr, sizeof(addr));
    4.37  
    4.38      return sizeof(addr);
    4.39 @@ -215,8 +213,6 @@ static int cmd_write_proc(struct file *f
    4.40              params->num_vifs = op.u.newdomain.num_vifs;
    4.41              params->domain = op.u.newdomain.domain;
    4.42  
    4.43 -            printk(KERN_ALERT "bd240 debug: cmd_write: %lx, %d, %d\n", params->pg_head, params->memory_kb, params->domain); 
    4.44 -
    4.45              /* now notify user space of the new domain's id */
    4.46              new_dom_id = create_proc_entry(DOM0_NEWDOM, 0600, xeno_base);
    4.47              if ( new_dom_id != NULL )
     5.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c	Thu Jan 30 13:25:10 2003 +0000
     5.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_memory.c	Fri Jan 31 15:03:37 2003 +0000
     5.3 @@ -27,9 +27,9 @@ extern struct list_head * find_direct(st
     5.4   * management applications such as domain builder etc.
     5.5   */
     5.6  
     5.7 -#define direct_set_pte(pteptr, pteval) queue_l1_entry_update(__pa(pteptr) | PGREQ_UNCHECKED_UPDATE, (pteval).pte_low)
     5.8 +#define direct_set_pte(pteptr, pteval) queue_l1_entry_update(__pa(pteptr), (pteval).pte_low)
     5.9  
    5.10 -#define direct_pte_clear(pteptr) queue_l1_entry_update(__pa(pteptr) | PGREQ_UNCHECKED_UPDATE, 0)
    5.11 +#define direct_pte_clear(pteptr) queue_l1_entry_update(__pa(pteptr), 0)
    5.12  
    5.13  #define __direct_pte(x) ((pte_t) { (x) } )
    5.14  #define __direct_mk_pte(page_nr,pgprot) __direct_pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
    5.15 @@ -55,6 +55,7 @@ static inline void direct_remappte_range
    5.16  	do {
    5.17  		pte_t oldpage;
    5.18  		oldpage = ptep_get_and_clear(pte);
    5.19 +
    5.20   		direct_set_pte(pte, direct_mk_pte_phys(phys_addr, prot));
    5.21  
    5.22  		forget_pte(oldpage);
    5.23 @@ -122,18 +123,19 @@ int direct_remap_page_range(unsigned lon
    5.24   * used for remapping discontiguous bits of domain's memory, pages to map are
    5.25   * found from frame table beginning at the given first_pg index
    5.26   */ 
    5.27 -int direct_remap_disc_page_range(unsigned long from, unsigned long first_pg,
    5.28 -                int tot_pages, pgprot_t prot)
    5.29 +int direct_remap_disc_page_range(unsigned long from, 
    5.30 +                unsigned long first_pg, int tot_pages, pgprot_t prot)
    5.31  {
    5.32      frame_table_t * current_ft;
    5.33      unsigned long current_pfn;
    5.34      unsigned long start = from;
    5.35      int count = 0;
    5.36  
    5.37 -    current_ft = (frame_table_t *)(frame_table + first_pg);
    5.38 +    current_ft = frame_table + first_pg;
    5.39      current_pfn = first_pg; 
    5.40      while(count < tot_pages){
    5.41 -            if(direct_remap_page_range(start, current_pfn << PAGE_SHIFT, PAGE_SIZE, prot))
    5.42 +            if(direct_remap_page_range(start, current_pfn << PAGE_SHIFT, 
    5.43 +                PAGE_SIZE, prot))
    5.44                  goto out;
    5.45              start += PAGE_SIZE;
    5.46              current_pfn = current_ft->next;
    5.47 @@ -187,10 +189,9 @@ unsigned long direct_mmap(unsigned long 
    5.48  
    5.49      /* and perform the mapping */
    5.50      if(flag == MAP_DISCONT){
    5.51 -        printk(KERN_ALERT "bd240 debug: call direct_remap_disc_page_range\n");
    5.52 -        ret = direct_remap_disc_page_range(addr, phys_addr, tot_pages, prot);
    5.53 +        ret = direct_remap_disc_page_range(addr, phys_addr >> PAGE_SHIFT, 
    5.54 +            tot_pages, prot);
    5.55      } else {
    5.56 -        printk(KERN_ALERT "bd240 debug: call direct_remap_page_range\n");
    5.57          ret = direct_remap_page_range(addr, phys_addr, size, prot);
    5.58      }
    5.59