1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

NBPG -> PAGE_SIZE

Avoid using the struct pte stuff.
This commit is contained in:
Poul-Henning Kamp 1996-05-02 09:42:45 +00:00
parent a8c5fef5e6
commit 1fa6b8217d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15535
4 changed files with 26 additions and 26 deletions

View File

@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: freebsd-nat.c,v 1.6 1995/05/09 13:59:22 rgrimes Exp $
$Id: freebsd-nat.c,v 1.7 1995/05/30 04:57:05 rgrimes Exp $
*/
#include <sys/types.h>
@ -480,7 +480,7 @@ kvtophys (fd, addr)
CORE_ADDR addr;
{
CORE_ADDR v;
struct pte pte;
unsigned int pte;
static CORE_ADDR PTD = -1;
CORE_ADDR current_ptd;
@ -527,17 +527,17 @@ CORE_ADDR addr;
* Read the first-level page table (ptd).
*/
v = current_ptd + ((unsigned)addr >> PD_SHIFT) * sizeof pte;
if (physrd(fd, v, (char *)&pte, sizeof pte) < 0 || pte.pg_v == 0)
if (physrd(fd, v, (char *)&pte, sizeof pte) < 0 || (pte&PG_V) == 0)
return (~0);
/*
* Read the second-level page table.
*/
v = i386_ptob(pte.pg_pfnum) + ((addr&PT_MASK) >> PG_SHIFT) * sizeof pte;
if (physrd(fd, v, (char *) &pte, sizeof(pte)) < 0 || pte.pg_v == 0)
v = (pte&PG_FRAME) + ((addr >> PAGE_SHIFT)&(NPTEPG-1)) * sizeof pte;
if (physrd(fd, v, (char *) &pte, sizeof(pte)) < 0 || (pte&PG_V) == 0)
return (~0);
addr = i386_ptob(pte.pg_pfnum) + (addr & PGOFSET);
addr = (pte & PG_FRAME) + (addr & PGOFSET);
#if 0
printf("vtophys(%x) -> %x\n", oldaddr, addr);
#endif
@ -605,7 +605,7 @@ kernel_core_file_hook(fd, addr, buf, len)
break;
}
/* we can't read across a page boundary */
i = min(len, NBPG - (addr & PGOFSET));
i = min(len, PAGE_SIZE - (addr & PGOFSET));
if ((cc = physrd(fd, paddr, cp, i)) <= 0) {
bzero(cp, len);
return (cp - buf);

View File

@ -19,7 +19,7 @@
#define SEEK_SET 0
#define SEEK_CUR 1
#define HOST_PAGE_SIZE NBPG
#define HOST_PAGE_SIZE PAGE_SIZE
#define HOST_MACHINE_ARCH bfd_arch_i386
#define HOST_TEXT_START_ADDR USRTEXT

View File

@ -117,7 +117,7 @@ trad_unix_core_file_p (abfd)
bfd_set_error (bfd_error_system_call);
return 0;
}
if (NBPG * (UPAGES + u.u_dsize
if (PAGE_SIZE * (UPAGES + u.u_dsize
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- u.u_tsize
#endif
@ -127,7 +127,7 @@ trad_unix_core_file_p (abfd)
return 0;
}
#ifndef TRAD_CORE_ALLOW_ANY_EXTRA_SIZE
if (NBPG * (UPAGES + u.u_dsize + u.u_ssize)
if (PAGE_SIZE * (UPAGES + u.u_dsize + u.u_ssize)
#ifdef TRAD_CORE_EXTRA_SIZE_ALLOWED
/* Some systems write the file too big. */
+ TRAD_CORE_EXTRA_SIZE_ALLOWED
@ -187,26 +187,26 @@ trad_unix_core_file_p (abfd)
core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
core_datasec (abfd)->_raw_size = NBPG * u.u_dsize
core_datasec (abfd)->_raw_size = PAGE_SIZE * u.u_dsize
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- NBPG * u.u_tsize
- PAGE_SIZE * u.u_tsize
#endif
;
core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize;
core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */
core_stacksec (abfd)->_raw_size = PAGE_SIZE * u.u_ssize;
core_regsec (abfd)->_raw_size = PAGE_SIZE * UPAGES; /* Larger than sizeof struct u */
/* What a hack... we'd like to steal it from the exec file,
since the upage does not seem to provide it. FIXME. */
#ifdef HOST_DATA_START_ADDR
core_datasec (abfd)->vma = HOST_DATA_START_ADDR;
#else
core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (NBPG * u.u_tsize);
core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (PAGE_SIZE * u.u_tsize);
#endif
#ifdef HOST_STACK_START_ADDR
core_stacksec (abfd)->vma = HOST_STACK_START_ADDR;
#else
core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (NBPG * u.u_ssize);
core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (PAGE_SIZE * u.u_ssize);
#endif
/* This is tricky. As the "register section", we give them the entire
@ -225,10 +225,10 @@ trad_unix_core_file_p (abfd)
using minor trickery to get around the offset-or-absolute-addr problem. */
core_regsec (abfd)->vma = 0 - (int) u.u_ar0;
core_datasec (abfd)->filepos = NBPG * UPAGES;
core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize
core_datasec (abfd)->filepos = PAGE_SIZE * UPAGES;
core_stacksec (abfd)->filepos = (PAGE_SIZE * UPAGES) + PAGE_SIZE * u.u_dsize
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- NBPG * u.u_tsize
- PAGE_SIZE * u.u_tsize
#endif
;
core_regsec (abfd)->filepos = 0; /* Register segment is the upage */

View File

@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: freebsd-nat.c,v 1.6 1995/05/09 13:59:22 rgrimes Exp $
$Id: freebsd-nat.c,v 1.7 1995/05/30 04:57:05 rgrimes Exp $
*/
#include <sys/types.h>
@ -480,7 +480,7 @@ kvtophys (fd, addr)
CORE_ADDR addr;
{
CORE_ADDR v;
struct pte pte;
unsigned int pte;
static CORE_ADDR PTD = -1;
CORE_ADDR current_ptd;
@ -527,17 +527,17 @@ CORE_ADDR addr;
* Read the first-level page table (ptd).
*/
v = current_ptd + ((unsigned)addr >> PD_SHIFT) * sizeof pte;
if (physrd(fd, v, (char *)&pte, sizeof pte) < 0 || pte.pg_v == 0)
if (physrd(fd, v, (char *)&pte, sizeof pte) < 0 || (pte&PG_V) == 0)
return (~0);
/*
* Read the second-level page table.
*/
v = i386_ptob(pte.pg_pfnum) + ((addr&PT_MASK) >> PG_SHIFT) * sizeof pte;
if (physrd(fd, v, (char *) &pte, sizeof(pte)) < 0 || pte.pg_v == 0)
v = (pte&PG_FRAME) + ((addr >> PAGE_SHIFT)&(NPTEPG-1)) * sizeof pte;
if (physrd(fd, v, (char *) &pte, sizeof(pte)) < 0 || (pte&PG_V) == 0)
return (~0);
addr = i386_ptob(pte.pg_pfnum) + (addr & PGOFSET);
addr = (pte & PG_FRAME) + (addr & PGOFSET);
#if 0
printf("vtophys(%x) -> %x\n", oldaddr, addr);
#endif
@ -605,7 +605,7 @@ kernel_core_file_hook(fd, addr, buf, len)
break;
}
/* we can't read across a page boundary */
i = min(len, NBPG - (addr & PGOFSET));
i = min(len, PAGE_SIZE - (addr & PGOFSET));
if ((cc = physrd(fd, paddr, cp, i)) <= 0) {
bzero(cp, len);
return (cp - buf);