summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-08-16 00:41:40 +0000
committerbde <bde@FreeBSD.org>1998-08-16 00:41:40 +0000
commit9fa8a2d79412b133fbecb03e9fd619c95770f665 (patch)
tree1c5ca30276ee0bed24493ee6bdf7a165c9db1679 /sys/i386
parent8814b380eb06aeefb7ad5557e2cbb58aafb4c057 (diff)
downloadFreeBSD-src-9fa8a2d79412b133fbecb03e9fd619c95770f665.zip
FreeBSD-src-9fa8a2d79412b133fbecb03e9fd619c95770f665.tar.gz
pmap.c:
Cast pointers to (vm_offset_t) instead of to (u_long) (as before) or to (uintptr_t)(void *) (as would be more correct). Don't cast vm_offset_t's to (u_long) just to do arithmetic on them. mp_machdep.c: Cast pointers to (uintptr_t) instead of to (u_long). Don't forget to cast pointers to (void *) first or to recover from integral possible integral promotions, although this is too much work for machine-dependent code. vm code generally avoids warnings for pointer vs long size mismatches by using vm_offset_t to represent pointers; pmap.c often uses plain `unsigned int' instead of vm_offset_t and didn't use u_long elsewhere, but this style was messed up by code apparently imported from mp_machdep.c.
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/mp_machdep.c8
-rw-r--r--sys/i386/i386/mptable.c8
-rw-r--r--sys/i386/i386/pmap.c15
-rw-r--r--sys/i386/include/mptable.h8
4 files changed, 20 insertions, 19 deletions
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index c5e392a..8052740 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.75 1998/05/17 18:53:17 tegge Exp $
+ * $Id: mp_machdep.c,v 1.76 1998/05/17 22:12:08 tegge Exp $
*/
#include "opt_smp.h"
@@ -550,7 +550,7 @@ mp_enable(u_int boot_addr)
POSTCODE(MP_ENABLE_POST);
/* turn on 4MB of V == P addressing so we can get to MP table */
- *(int *)PTD = PG_V | PG_RW | ((u_long)KPTphys & PG_FRAME);
+ *(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
invltlb();
/* examine the MP table for needed info, uses physical addresses */
@@ -1680,8 +1680,8 @@ start_all_aps(u_int boot_addr)
bcopy(PTD, newptd, PAGE_SIZE); /* inc prv page pde */
/* set up 0 -> 4MB P==V mapping for AP boot */
- newptd[0] = (pd_entry_t) (PG_V | PG_RW |
- ((u_long)KPTphys & PG_FRAME));
+ newptd[0] = (void *)(uintptr_t)(PG_V | PG_RW |
+ ((uintptr_t)(void *)KPTphys & PG_FRAME));
/* store PTD for this AP's boot sequence */
myPTD = (pd_entry_t *)vtophys(newptd);
diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c
index c5e392a..8052740 100644
--- a/sys/i386/i386/mptable.c
+++ b/sys/i386/i386/mptable.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.75 1998/05/17 18:53:17 tegge Exp $
+ * $Id: mp_machdep.c,v 1.76 1998/05/17 22:12:08 tegge Exp $
*/
#include "opt_smp.h"
@@ -550,7 +550,7 @@ mp_enable(u_int boot_addr)
POSTCODE(MP_ENABLE_POST);
/* turn on 4MB of V == P addressing so we can get to MP table */
- *(int *)PTD = PG_V | PG_RW | ((u_long)KPTphys & PG_FRAME);
+ *(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
invltlb();
/* examine the MP table for needed info, uses physical addresses */
@@ -1680,8 +1680,8 @@ start_all_aps(u_int boot_addr)
bcopy(PTD, newptd, PAGE_SIZE); /* inc prv page pde */
/* set up 0 -> 4MB P==V mapping for AP boot */
- newptd[0] = (pd_entry_t) (PG_V | PG_RW |
- ((u_long)KPTphys & PG_FRAME));
+ newptd[0] = (void *)(uintptr_t)(PG_V | PG_RW |
+ ((uintptr_t)(void *)KPTphys & PG_FRAME));
/* store PTD for this AP's boot sequence */
myPTD = (pd_entry_t *)vtophys(newptd);
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index b23fc31..02f60f4 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
- * $Id: pmap.c,v 1.204 1998/07/11 08:29:38 phk Exp $
+ * $Id: pmap.c,v 1.205 1998/07/11 11:10:46 bde Exp $
*/
/*
@@ -420,20 +420,21 @@ pmap_bootstrap(firstaddr, loadaddr)
/* 1 = page table page */
/* 2 = local apic */
/* 16-31 = io apics */
- SMP_prvpt[2] = (pt_entry_t)(PG_V | PG_RW | pgeflag | ((u_long)cpu_apic_address & PG_FRAME));
+ SMP_prvpt[2] = (pt_entry_t)(PG_V | PG_RW | pgeflag |
+ (cpu_apic_address & PG_FRAME));
for (i = 0; i < mp_napics; i++) {
for (j = 0; j < 16; j++) {
/* same page frame as a previous IO apic? */
- if (((u_long)SMP_prvpt[j + 16] & PG_FRAME) ==
- ((u_long)io_apic_address[0] & PG_FRAME)) {
+ if (((vm_offset_t)SMP_prvpt[j + 16] & PG_FRAME) ==
+ (io_apic_address[0] & PG_FRAME)) {
ioapic[i] = (ioapic_t *)&SMP_ioapic[j * PAGE_SIZE];
break;
}
/* use this slot if available */
- if (((u_long)SMP_prvpt[j + 16] & PG_FRAME) == 0) {
- SMP_prvpt[j + 16] = (pt_entry_t)(PG_V | PG_RW | pgeflag |
- ((u_long)io_apic_address[i] & PG_FRAME));
+ if (((vm_offset_t)SMP_prvpt[j + 16] & PG_FRAME) == 0) {
+ SMP_prvpt[j + 16] = (pt_entry_t)(PG_V | PG_RW |
+ pgeflag | (io_apic_address[i] & PG_FRAME));
ioapic[i] = (ioapic_t *)&SMP_ioapic[j * PAGE_SIZE];
break;
}
diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h
index c5e392a..8052740 100644
--- a/sys/i386/include/mptable.h
+++ b/sys/i386/include/mptable.h
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.75 1998/05/17 18:53:17 tegge Exp $
+ * $Id: mp_machdep.c,v 1.76 1998/05/17 22:12:08 tegge Exp $
*/
#include "opt_smp.h"
@@ -550,7 +550,7 @@ mp_enable(u_int boot_addr)
POSTCODE(MP_ENABLE_POST);
/* turn on 4MB of V == P addressing so we can get to MP table */
- *(int *)PTD = PG_V | PG_RW | ((u_long)KPTphys & PG_FRAME);
+ *(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
invltlb();
/* examine the MP table for needed info, uses physical addresses */
@@ -1680,8 +1680,8 @@ start_all_aps(u_int boot_addr)
bcopy(PTD, newptd, PAGE_SIZE); /* inc prv page pde */
/* set up 0 -> 4MB P==V mapping for AP boot */
- newptd[0] = (pd_entry_t) (PG_V | PG_RW |
- ((u_long)KPTphys & PG_FRAME));
+ newptd[0] = (void *)(uintptr_t)(PG_V | PG_RW |
+ ((uintptr_t)(void *)KPTphys & PG_FRAME));
/* store PTD for this AP's boot sequence */
myPTD = (pd_entry_t *)vtophys(newptd);
OpenPOWER on IntegriCloud