summaryrefslogtreecommitdiff
path: root/sys/arch/amiga/stand/loadbsd
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>1998-08-13 21:08:17 +0000
committerMarc Espie <espie@cvs.openbsd.org>1998-08-13 21:08:17 +0000
commit248cbbdc7fc28f38fa8e6e2b52d8535eded841c8 (patch)
treed26660304a8adf3e2adb409a26958fe139bc0303 /sys/arch/amiga/stand/loadbsd
parent5986825ad3ea2a668079aba41f65beab405d6156 (diff)
Make loadbsd aware of poolmem (mainly, kill poolmem before scanning the
memory list)
Diffstat (limited to 'sys/arch/amiga/stand/loadbsd')
-rw-r--r--sys/arch/amiga/stand/loadbsd/Makefile11
-rw-r--r--sys/arch/amiga/stand/loadbsd/README10
-rw-r--r--sys/arch/amiga/stand/loadbsd/loadbsd.c7
-rw-r--r--sys/arch/amiga/stand/loadbsd/poolmem.c59
4 files changed, 75 insertions, 12 deletions
diff --git a/sys/arch/amiga/stand/loadbsd/Makefile b/sys/arch/amiga/stand/loadbsd/Makefile
index a73004d2fd9..dfa5fd6e802 100644
--- a/sys/arch/amiga/stand/loadbsd/Makefile
+++ b/sys/arch/amiga/stand/loadbsd/Makefile
@@ -1,11 +1,10 @@
-# $OpenBSD: Makefile,v 1.2 1998/03/29 22:24:49 espie Exp $
+# $OpenBSD: Makefile,v 1.3 1998/08/13 21:08:08 espie Exp $
CC = gcc
-CFLAGS = -m68030 -Wall -O3 -fomit-frame-pointer -D__progname=program_name -msmall-code -resident
+CFLAGS = -m68030 -Wall -O3 -fomit-frame-pointer -D__progname=program_name -msmall-code -resident
-OBJS = loadbsd.o getopt.o sleep.o vers.o vers_ixemul.o openlibs_ixemul.o openlibs_stub.o
-OBJS1 = loadbsd.o getopt.o sleep.o vers.o openlibs_stub.o
-OBJS2 = loadbsd.o vers_ixemul.o openlibs_ixemul.o
+OBJS1 = loadbsd.o poolmem.o getopt.o sleep.o vers.o openlibs_stub.o
+OBJS2 = loadbsd.o poolmem.o vers_ixemul.o openlibs_ixemul.o
PROGS=loadbsd loadbsd.ixemul
# add -lamiga if you can't get inlines to work
@@ -21,4 +20,4 @@ loadbsd.ixemul: $(OBJS2)
$(CC) $(CFLAGS) $(LDFLAGS) -o loadbsd.ixemul $(OBJS2) $(LIBS)
clean:
- -rm $(OBJS) $(PROGS)
+ -rm $(OBJS1) $(OBJS2) $(PROGS)
diff --git a/sys/arch/amiga/stand/loadbsd/README b/sys/arch/amiga/stand/loadbsd/README
index c754c7affe1..27761103749 100644
--- a/sys/arch/amiga/stand/loadbsd/README
+++ b/sys/arch/amiga/stand/loadbsd/README
@@ -1,4 +1,4 @@
-$OpenBSD: README,v 1.2 1998/03/29 22:24:50 espie Exp $
+$OpenBSD: README,v 1.3 1998/08/13 21:08:13 espie Exp $
This was prepared to compile with Geek Gadgets' gcc for AmigaOS, with
or without libnix. The libnix flavor is stand-alone, but still needs
@@ -7,12 +7,14 @@ AmigaOS 2.0.
You'll need the (unchanged) getopt.c from src/lib/libc/stdlib,
and reboot.h from src/sys/sys too.
-
- Ignatios Souvatzis
-
New for 2.15.2:
compiled with most recent Geek gadgets, everything working.
Looking more closely, the -Z option looks suspiciously untested.
No new options, but smaller, cleaner, and hopefully easier to compile
cleanly.
+
+New for 2.15.3:
+loadbsd knows about poolmem, and will correctly remove it before
+firing up the kernel.
+
Marc Espie
diff --git a/sys/arch/amiga/stand/loadbsd/loadbsd.c b/sys/arch/amiga/stand/loadbsd/loadbsd.c
index 56d586b8a39..4983d13bfb0 100644
--- a/sys/arch/amiga/stand/loadbsd/loadbsd.c
+++ b/sys/arch/amiga/stand/loadbsd/loadbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loadbsd.c,v 1.11 1998/03/29 22:24:52 espie Exp $ */
+/* $OpenBSD: loadbsd.c,v 1.12 1998/08/13 21:08:15 espie Exp $ */
/* $NetBSD: loadbsd.c,v 1.22 1996/10/13 13:39:52 is Exp $ */
/*
@@ -81,6 +81,7 @@ void warnx __P((const char *, ...));
extern const char _version[];
extern void open_libraries(void);
+extern void ensure_no_poolmem(void);
/*
* Version history:
@@ -130,6 +131,7 @@ extern void open_libraries(void);
* 2.15.2 03/30/98 ME - generic dust-off for amigaos compilation,
* turn on -Wall, clean up warnings. Be sensical about
* ixemul/libnix issues.
+ * 2.15.3 07/18/98 ME - poolmem awareness
*/
/*
@@ -158,7 +160,6 @@ struct boot_memlist {
struct boot_memlist memlist;
struct boot_memlist *kmemlist;
-
void get_mem_config __P((void **, u_long *, u_long *));
void get_cpuid __P((void));
void get_eclock __P((void));
@@ -170,6 +171,7 @@ void startit __P((void *, u_long, u_long, void *, u_long, u_long, int, void *,
int, int, u_long, u_long, int));
void startit_end __P((void));
+extern void ensure_no_poolmem(void);
extern struct ExecBase *SysBase;
extern char *optarg;
extern int optind;
@@ -294,6 +296,7 @@ main(argc, argv)
for (cd = 0, ncd = 0; ( cd = FindConfigDev(cd, -1, -1) ); ncd++)
;
get_cpuid();
+ ensure_no_poolmem();
get_mem_config(&fmem, &fmemsz, &cmemsz);
get_eclock();
get_AGA();
diff --git a/sys/arch/amiga/stand/loadbsd/poolmem.c b/sys/arch/amiga/stand/loadbsd/poolmem.c
new file mode 100644
index 00000000000..2058acf25fc
--- /dev/null
+++ b/sys/arch/amiga/stand/loadbsd/poolmem.c
@@ -0,0 +1,59 @@
+/* $OpenBSD: poolmem.c,v 1.1 1998/08/13 21:08:16 espie Exp $ */
+
+/* This piece of code ensures that poolmem no longer runs. It is necessary
+ * to kill poolmem before assessing the memory configuration, as this patch
+ * tampers with exec memory lists
+
+ From: Thomas Richter <thor@math.TU-Berlin.DE>
+
+The following is the "official" port structure of the PoolMem port. That's
+what you get as result of a FindPort("PoolMem.rendezvous"):
+
+struct PoolMemPort {
+ struct MsgPort pm_Port;
+ UWORD pm_Flags; DO NOT CARE
+ ULONG pm_DoNotTouch;
+ void (*pm_RemoveProc)(); The important stuff
+};
+
+Calling syntax is as follows:
+
+ The remove procedure must be called with Exec in "Forbid" state,
+ using register a0 as a pointer to the routine. Register a6 MUST be
+ a pointer to the DosLibrary (purely for historical reasons).
+ Register a5 MUST be a pointer to this port structure.
+ */
+
+#include <proto/exec.h>
+#include <stdio.h>
+
+extern struct DosLibrary *DOSBase;
+void remove_poolmem(struct DosLibrary *db, struct MsgPort *mp);
+
+
+void ensure_no_poolmem()
+ {
+ Forbid();
+ {
+ struct MsgPort *p = FindPort("PoolMem.rendezvous");
+ if (p)
+ remove_poolmem(DOSBase, p);
+ /* this will actually break the Forbid() */
+ puts("Poolmem detected (and removed)");
+ }
+ Permit();
+ }
+
+asm("
+ .text
+ .globl _remove_poolmem
+
+_remove_poolmem:
+ movem.l a0-a6/d0-d7,sp@- | save all regs
+ move.l sp@(64),a6 | DosBase
+ move.l sp@(68),a5 | PoolMemPort
+ move.l a5@(40),a0 | Routine to call
+ jsr a0@
+ movem.l sp@+,a0-a6/d0-d7 | restore all regs
+ rts
+");