From owner-p4-projects@FreeBSD.ORG Thu Feb 2 03:24:55 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E9E4116A423; Thu, 2 Feb 2006 03:24:54 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B598516A420 for ; Thu, 2 Feb 2006 03:24:54 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7EC0543D46 for ; Thu, 2 Feb 2006 03:24:54 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k123Osfj030382 for ; Thu, 2 Feb 2006 03:24:54 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k123OsvR030379 for perforce@freebsd.org; Thu, 2 Feb 2006 03:24:54 GMT (envelope-from kmacy@freebsd.org) Date: Thu, 2 Feb 2006 03:24:54 GMT Message-Id: <200602020324.k123OsvR030379@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 90911 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2006 03:24:55 -0000 http://perforce.freebsd.org/chv.cgi?CH=90911 Change 90911 by kmacy@kmacy:freebsd7_xen3 on 2006/02/02 03:24:14 bubble sort last 4MB phys page down to the beginning Affected files ... .. //depot/projects/xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#10 edit Differences ... ==== //depot/projects/xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#10 (text+ko) ==== @@ -558,25 +558,32 @@ static void shift_phys_machine(unsigned long *phys_machine, int nr_pages) { + unsigned long *tmp_page, *current_page, *next_page; int i; tmp_page = bootmem_alloc(PAGE_SIZE); - current_page = phys_machine; - next_page = phys_machine + (PAGE_SIZE/sizeof(unsigned long)); - bcopy(current_page, tmp_page, PAGE_SIZE); + current_page = phys_machine + nr_pages - (PAGE_SIZE/sizeof(unsigned long)); + next_page = current_page - (PAGE_SIZE/sizeof(unsigned long)); + bcopy(phys_machine, tmp_page, PAGE_SIZE); - for (i = 0; i < (nr_pages - 1024); i++) { - xen_machphys_update(phys_machine[i], i + 1024); - } - while (next_page < (phys_machine + nr_pages)) { + while (current_page > phys_machine) { + /* save next page */ + bcopy(next_page, tmp_page, PAGE_SIZE); + /* shift down page */ + bcopy(current_page, next_page, PAGE_SIZE); + /* finish swap */ bcopy(tmp_page, current_page, PAGE_SIZE); - bcopy(next_page, tmp_page, PAGE_SIZE); - current_page += (PAGE_SIZE/sizeof(unsigned long)); - next_page += (PAGE_SIZE/sizeof(unsigned long)); + current_page -= (PAGE_SIZE/sizeof(unsigned long)); + next_page -= (PAGE_SIZE/sizeof(unsigned long)); + } + bootmem_free(tmp_page, PAGE_SIZE); + + for (i = 0; i < nr_pages; i++) { + xen_machphys_update(phys_machine[i], i); } - bootmem_free(tmp_page, PAGE_SIZE); + memset(phys_machine, INVALID_P2M_ENTRY, PAGE_SIZE);