Module Name: src
Committed By: thorpej
Date: Tue Jan 9 14:24:08 UTC 2024
Modified Files:
src/sys/arch/virt68k/virt68k: locore.s machdep.c
Log Message:
Properly implement mm_md_physacc() and garbage-collect the now unused
"lowram" variable (hold-over from hp300 lineage).
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/virt68k/locore.s
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/virt68k/virt68k/machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/virt68k/virt68k/locore.s
diff -u src/sys/arch/virt68k/virt68k/locore.s:1.5 src/sys/arch/virt68k/virt68k/locore.s:1.6
--- src/sys/arch/virt68k/virt68k/locore.s:1.5 Tue Jan 9 07:28:26 2024
+++ src/sys/arch/virt68k/virt68k/locore.s Tue Jan 9 14:24:08 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.5 2024/01/09 07:28:26 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.6 2024/01/09 14:24:08 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -83,7 +83,6 @@ ASLOCAL(tmpstk)
#define RELOC(var, ar) _RELOC(_C_LABEL(var), ar)
#define ASRELOC(var, ar) _RELOC(_ASM_LABEL(var), ar)
-BSS(lowram,4)
BSS(esym,4)
.globl _C_LABEL(edata)
@@ -113,9 +112,6 @@ ASENTRY_NOPROFILE(start)
1: clrl %a0@+
dbra %d0,1b
- RELOC(lowram, %a0)
- movl %a5,%a0@ | store start of physical memory
-
/*
* Qemu does not pass us the symbols, so leave esym alone.
* The bootinfo immediately follows the kernel. Go parse
Index: src/sys/arch/virt68k/virt68k/machdep.c
diff -u src/sys/arch/virt68k/virt68k/machdep.c:1.6 src/sys/arch/virt68k/virt68k/machdep.c:1.7
--- src/sys/arch/virt68k/virt68k/machdep.c:1.6 Mon Jan 8 05:10:51 2024
+++ src/sys/arch/virt68k/virt68k/machdep.c Tue Jan 9 14:24:08 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.6 2024/01/08 05:10:51 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.7 2024/01/09 14:24:08 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.6 2024/01/08 05:10:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.7 2024/01/09 14:24:08 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_m060sp.h"
@@ -113,7 +113,6 @@ paddr_t msgbufpa; /* PA of message buff
// int maxmem; /* max memory per process */
-extern u_int lowram;
extern short exframesize[];
/* prototypes for local functions */
@@ -902,6 +901,18 @@ const uint16_t ipl2psl_table[NIPL] = {
int
mm_md_physacc(paddr_t pa, vm_prot_t prot)
{
+ psize_t size;
+ int i;
- return (pa < lowram || pa >= 0xfffffffc) ? EFAULT : 0;
+ for (i = 0; i < bootinfo_mem_nsegments; i++) {
+ if (pa < bootinfo_mem_segments[i].mem_addr) {
+ continue;
+ }
+ size = trunc_page(bootinfo_mem_segments[i].mem_size);
+ if (pa >= bootinfo_mem_segments[i].mem_addr + size) {
+ continue;
+ }
+ return 0;
+ }
+ return EFAULT;
}