| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: x86_machdep.c,v 1.31 2009/03/21 15:01:57 ad Exp $ */ | | 1 | /* $NetBSD: x86_machdep.c,v 1.32 2009/06/20 13:10:14 cegger Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, | | 4 | * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, |
5 | * Copyright (c) 2005, 2008, 2009 The NetBSD Foundation, Inc. | | 5 | * Copyright (c) 2005, 2008, 2009 The NetBSD Foundation, Inc. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * This code is derived from software contributed to The NetBSD Foundation | | 8 | * This code is derived from software contributed to The NetBSD Foundation |
9 | * by Julio M. Merino Vidal. | | 9 | * by Julio M. Merino Vidal. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.31 2009/03/21 15:01:57 ad Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.32 2009/06/20 13:10:14 cegger Exp $"); |
35 | | | 35 | |
36 | #include "opt_modular.h" | | 36 | #include "opt_modular.h" |
37 | | | 37 | |
38 | #include <sys/types.h> | | 38 | #include <sys/types.h> |
39 | #include <sys/param.h> | | 39 | #include <sys/param.h> |
40 | #include <sys/systm.h> | | 40 | #include <sys/systm.h> |
41 | #include <sys/kcore.h> | | 41 | #include <sys/kcore.h> |
42 | #include <sys/errno.h> | | 42 | #include <sys/errno.h> |
43 | #include <sys/kauth.h> | | 43 | #include <sys/kauth.h> |
44 | #include <sys/mutex.h> | | 44 | #include <sys/mutex.h> |
45 | #include <sys/cpu.h> | | 45 | #include <sys/cpu.h> |
46 | #include <sys/intr.h> | | 46 | #include <sys/intr.h> |
47 | #include <sys/atomic.h> | | 47 | #include <sys/atomic.h> |
| @@ -704,81 +704,85 @@ initx86_load_memmap(paddr_t first_avail) | | | @@ -704,81 +704,85 @@ initx86_load_memmap(paddr_t first_avail) |
704 | if (seg_start != seg_end) { | | 704 | if (seg_start != seg_end) { |
705 | if (seg_start < (16 * 1024 * 1024) && | | 705 | if (seg_start < (16 * 1024 * 1024) && |
706 | first16q != VM_FREELIST_DEFAULT) { | | 706 | first16q != VM_FREELIST_DEFAULT) { |
707 | uint64_t tmp; | | 707 | uint64_t tmp; |
708 | | | 708 | |
709 | if (seg_end > (16 * 1024 * 1024)) | | 709 | if (seg_end > (16 * 1024 * 1024)) |
710 | tmp = (16 * 1024 * 1024); | | 710 | tmp = (16 * 1024 * 1024); |
711 | else | | 711 | else |
712 | tmp = seg_end; | | 712 | tmp = seg_end; |
713 | | | 713 | |
714 | if (tmp != seg_start) { | | 714 | if (tmp != seg_start) { |
715 | #ifdef DEBUG_MEMLOAD | | 715 | #ifdef DEBUG_MEMLOAD |
716 | printf("loading 0x%"PRIx64"-0x%"PRIx64 | | 716 | printf("loading 0x%"PRIx64"-0x%"PRIx64 |
717 | " (0x%lx-0x%lx)\n", | | 717 | " (0x%"PRIx64"-0x%"PRIx64")\n", |
718 | seg_start, tmp, | | 718 | seg_start, tmp, |
719 | atop(seg_start), atop(tmp)); | | 719 | (uint64_t)atop(seg_start), |
| | | 720 | (uint64_t)atop(tmp)); |
720 | #endif | | 721 | #endif |
721 | uvm_page_physload(atop(seg_start), | | 722 | uvm_page_physload(atop(seg_start), |
722 | atop(tmp), atop(seg_start), | | 723 | atop(tmp), atop(seg_start), |
723 | atop(tmp), first16q); | | 724 | atop(tmp), first16q); |
724 | } | | 725 | } |
725 | seg_start = tmp; | | 726 | seg_start = tmp; |
726 | } | | 727 | } |
727 | | | 728 | |
728 | if (seg_start != seg_end) { | | 729 | if (seg_start != seg_end) { |
729 | #ifdef DEBUG_MEMLOAD | | 730 | #ifdef DEBUG_MEMLOAD |
730 | printf("loading 0x%"PRIx64"-0x%"PRIx64 | | 731 | printf("loading 0x%"PRIx64"-0x%"PRIx64 |
731 | " (0x%lx-0x%lx)\n", | | 732 | " (0x%"PRIx64"-0x%"PRIx64")\n", |
732 | seg_start, seg_end, | | 733 | seg_start, seg_end, |
733 | atop(seg_start), atop(seg_end)); | | 734 | (uint64_t)atop(seg_start), |
| | | 735 | (uint64_t)atop(seg_end)); |
734 | #endif | | 736 | #endif |
735 | uvm_page_physload(atop(seg_start), | | 737 | uvm_page_physload(atop(seg_start), |
736 | atop(seg_end), atop(seg_start), | | 738 | atop(seg_end), atop(seg_start), |
737 | atop(seg_end), VM_FREELIST_DEFAULT); | | 739 | atop(seg_end), VM_FREELIST_DEFAULT); |
738 | } | | 740 | } |
739 | } | | 741 | } |
740 | | | 742 | |
741 | /* Second hunk */ | | 743 | /* Second hunk */ |
742 | if (seg_start1 != seg_end1) { | | 744 | if (seg_start1 != seg_end1) { |
743 | if (seg_start1 < (16 * 1024 * 1024) && | | 745 | if (seg_start1 < (16 * 1024 * 1024) && |
744 | first16q != VM_FREELIST_DEFAULT) { | | 746 | first16q != VM_FREELIST_DEFAULT) { |
745 | uint64_t tmp; | | 747 | uint64_t tmp; |
746 | | | 748 | |
747 | if (seg_end1 > (16 * 1024 * 1024)) | | 749 | if (seg_end1 > (16 * 1024 * 1024)) |
748 | tmp = (16 * 1024 * 1024); | | 750 | tmp = (16 * 1024 * 1024); |
749 | else | | 751 | else |
750 | tmp = seg_end1; | | 752 | tmp = seg_end1; |
751 | | | 753 | |
752 | if (tmp != seg_start1) { | | 754 | if (tmp != seg_start1) { |
753 | #ifdef DEBUG_MEMLOAD | | 755 | #ifdef DEBUG_MEMLOAD |
754 | printf("loading 0x%"PRIx64"-0x%"PRIx64 | | 756 | printf("loading 0x%"PRIx64"-0x%"PRIx64 |
755 | " (0x%lx-0x%lx)\n", | | 757 | " (0x%"PRIx64"-0x%"PRIx64")\n", |
756 | seg_start1, tmp, | | 758 | seg_start1, tmp, |
757 | atop(seg_start1), atop(tmp)); | | 759 | (uint64_t)atop(seg_start1), |
| | | 760 | (uint64_t)atop(tmp)); |
758 | #endif | | 761 | #endif |
759 | uvm_page_physload(atop(seg_start1), | | 762 | uvm_page_physload(atop(seg_start1), |
760 | atop(tmp), atop(seg_start1), | | 763 | atop(tmp), atop(seg_start1), |
761 | atop(tmp), first16q); | | 764 | atop(tmp), first16q); |
762 | } | | 765 | } |
763 | seg_start1 = tmp; | | 766 | seg_start1 = tmp; |
764 | } | | 767 | } |
765 | | | 768 | |
766 | if (seg_start1 != seg_end1) { | | 769 | if (seg_start1 != seg_end1) { |
767 | #ifdef DEBUG_MEMLOAD | | 770 | #ifdef DEBUG_MEMLOAD |
768 | printf("loading 0x%"PRIx64"-0x%"PRIx64 | | 771 | printf("loading 0x%"PRIx64"-0x%"PRIx64 |
769 | " (0x%lx-0x%lx)\n", | | 772 | " (0x%"PRIx64"-0x%"PRIx64")\n", |
770 | seg_start1, seg_end1, | | 773 | seg_start1, seg_end1, |
771 | atop(seg_start1), atop(seg_end1)); | | 774 | (uint64_t)atop(seg_start1), |
| | | 775 | (uint64_t)atop(seg_end1)); |
772 | #endif | | 776 | #endif |
773 | uvm_page_physload(atop(seg_start1), | | 777 | uvm_page_physload(atop(seg_start1), |
774 | atop(seg_end1), atop(seg_start1), | | 778 | atop(seg_end1), atop(seg_start1), |
775 | atop(seg_end1), VM_FREELIST_DEFAULT); | | 779 | atop(seg_end1), VM_FREELIST_DEFAULT); |
776 | } | | 780 | } |
777 | } | | 781 | } |
778 | } | | 782 | } |
779 | | | 783 | |
780 | return 0; | | 784 | return 0; |
781 | } | | 785 | } |
782 | #endif | | 786 | #endif |
783 | | | 787 | |
784 | void | | 788 | void |