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.
This commit is contained in:
Bruce Evans 1998-08-16 00:41:40 +00:00
parent b55fb9dee6
commit 69ed480f48
9 changed files with 44 additions and 42 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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);