Module Name: src
Committed By: matt
Date: Wed Dec 29 00:16:31 UTC 2010
Modified Files:
src/sys/arch/pmax/include [matt-nb5-mips64]: dec_prom.h
src/sys/arch/pmax/pmax [matt-nb5-mips64]: locore_machdep.S promcall.c
src/sys/arch/pmax/tc [matt-nb5-mips64]: tcbus.c
Log Message:
Use a promcall wrapper function to call the prom. For non O32 systems
this will save and restore the callee saved registers since the 32-bit
prom probably won't be saving all 64bits.
To generate a diff of this commit:
cvs rdiff -u -r1.20.96.1 -r1.20.96.2 src/sys/arch/pmax/include/dec_prom.h
cvs rdiff -u -r1.23 -r1.23.96.1 src/sys/arch/pmax/pmax/locore_machdep.S
cvs rdiff -u -r1.12.76.2 -r1.12.76.3 src/sys/arch/pmax/pmax/promcall.c
cvs rdiff -u -r1.21 -r1.21.16.1 src/sys/arch/pmax/tc/tcbus.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/pmax/include/dec_prom.h
diff -u src/sys/arch/pmax/include/dec_prom.h:1.20.96.1 src/sys/arch/pmax/include/dec_prom.h:1.20.96.2
--- src/sys/arch/pmax/include/dec_prom.h:1.20.96.1 Wed Sep 16 19:23:18 2009
+++ src/sys/arch/pmax/include/dec_prom.h Wed Dec 29 00:16:30 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_prom.h,v 1.20.96.1 2009/09/16 19:23:18 matt Exp $ */
+/* $NetBSD: dec_prom.h,v 1.20.96.2 2010/12/29 00:16:30 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -145,8 +145,10 @@
#else
extern const struct callback callvec;
#endif
+intptr_t promcall(void *, ...);
#if defined(_STANDALONE) && !defined(_NO_PROM_DEFINES)
+#if 0
#define memcpy (*callv -> _memcpy)
#define memset (*callv -> _memset)
#define strcat (*callv -> _strcat)
@@ -188,6 +190,7 @@
#define gettcinfo (*callv -> _gettcinfo)
#define execute_cmd (*callv -> _execute_cmd)
#define rex (*callv -> _rex)
+#endif
#define bzero(dst, len) memset(dst, 0, len)
/* XXX make sure that no calls to bcopy overlap! */
Index: src/sys/arch/pmax/pmax/locore_machdep.S
diff -u src/sys/arch/pmax/pmax/locore_machdep.S:1.23 src/sys/arch/pmax/pmax/locore_machdep.S:1.23.96.1
--- src/sys/arch/pmax/pmax/locore_machdep.S:1.23 Sun Dec 11 12:18:39 2005
+++ src/sys/arch/pmax/pmax/locore_machdep.S Wed Dec 29 00:16:30 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: locore_machdep.S,v 1.23 2005/12/11 12:18:39 christos Exp $ */
+/* $NetBSD: locore_machdep.S,v 1.23.96.1 2010/12/29 00:16:30 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -56,6 +56,7 @@
#include <mips/asm.h>
#include <mips/cpuregs.h> /* XXX - misnomer? */
+#include "assym.h"
#include "sii.h"
#include "opt_dec_5100.h"
#include "opt_dec_5400.h"
@@ -162,3 +163,56 @@
nop
END(dec_mips1_wbflush)
#endif /* defined(DEC_5100) || defined(DEC_5400) */
+
+#ifdef __mips_o32
+NESTED(promcall, 0, ra)
+ sll t9, a0, 0
+ sll a0, a1, 0
+ sll a1, a2, 0
+ sll a2, a3, 0
+
+ j t9
+ nop
+END(promcall)
+#else
+NESTED(promcall, TF_SIZ, ra)
+ PTR_SUBU sp, TF_SIZ
+ REG_S ra, TF_REG_RA(sp)
+ REG_S s0, TF_REG_S0(sp)
+ REG_S s1, TF_REG_S1(sp)
+ REG_S s2, TF_REG_S2(sp)
+ REG_S s3, TF_REG_S3(sp)
+ REG_S s4, TF_REG_S4(sp)
+ REG_S s5, TF_REG_S5(sp)
+ REG_S s6, TF_REG_S6(sp)
+ REG_S s7, TF_REG_S7(sp)
+ REG_S s8, TF_REG_S8(sp)
+ REG_S gp, TF_REG_GP(sp)
+
+ sll t9, a0, 0
+ sll a0, a1, 0
+ sll a1, a2, 0
+ sll a2, a3, 0
+
+ jal t9
+ nop
+
+ sll v0, v0, 0
+
+ REG_L ra, TF_REG_RA(sp)
+ REG_L s0, TF_REG_S0(sp)
+ REG_L s1, TF_REG_S1(sp)
+ REG_L s2, TF_REG_S2(sp)
+ REG_L s3, TF_REG_S3(sp)
+ REG_L s4, TF_REG_S4(sp)
+ REG_L s5, TF_REG_S5(sp)
+ REG_L s6, TF_REG_S6(sp)
+ REG_L s7, TF_REG_S7(sp)
+ REG_L s8, TF_REG_S8(sp)
+ REG_L gp, TF_REG_GP(sp)
+
+ PTR_ADDU sp, TF_SIZ
+ j ra
+ nop
+END(promcall)
+#endif
Index: src/sys/arch/pmax/pmax/promcall.c
diff -u src/sys/arch/pmax/pmax/promcall.c:1.12.76.2 src/sys/arch/pmax/pmax/promcall.c:1.12.76.3
--- src/sys/arch/pmax/pmax/promcall.c:1.12.76.2 Fri Dec 24 07:23:42 2010
+++ src/sys/arch/pmax/pmax/promcall.c Wed Dec 29 00:16:30 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: promcall.c,v 1.12.76.2 2010/12/24 07:23:42 matt Exp $ */
+/* $NetBSD: promcall.c,v 1.12.76.3 2010/12/29 00:16:30 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: promcall.c,v 1.12.76.2 2010/12/24 07:23:42 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: promcall.c,v 1.12.76.3 2010/12/29 00:16:30 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -119,7 +119,7 @@
int chr, s;
s = splhigh();
- chr = (*callv->_getchar)();
+ chr = promcall(callv->_getchar);
splx(s);
return chr;
}
@@ -133,7 +133,7 @@
int s;
s = splhigh();
- (*callv->_printf)("%c", c);
+ promcall(callv->_printf, "%c", c);
splx(s);
}
@@ -194,7 +194,7 @@
char *
prom_getenv(const char *name)
{
- return (*callv->_getenv)(name);
+ return (void *)promcall(callv->_getenv, name);
}
/*
@@ -207,12 +207,16 @@
int
prom_systype(void)
{
+#ifndef _LP64
char *cp;
if (callv != &callvec)
- return (*callv->_getsysid)();
+#endif
+ return promcall(callv->_getsysid);
+#ifndef _LP64
cp = prom_getenv("systype");
return (cp != NULL) ? strtoul(cp, NULL, 0) : 0;
+#endif
}
/*
@@ -221,7 +225,7 @@
void
prom_haltbutton(void)
{
- (*callv->_halt)((int *)0, 0);
+ promcall(callv->_halt, (int *)0, 0);
}
/*
@@ -231,7 +235,7 @@
prom_halt(int howto, char *bootstr)
{
if (callv != &callvec)
- (*callv->_rex)((howto & RB_HALT) ? 'h' : 'b');
+ promcall(callv->_rex, (howto & RB_HALT) ? 'h' : 'b');
else {
void __dead (*f)(void);
@@ -269,7 +273,7 @@
int len;
if (callv->_getbitmap != NULL)
- return (callv->_getbitmap(map));
+ return promcall(callv->_getbitmap, map);
/*
* See if we can get the bitmap from the environment variables
*/
Index: src/sys/arch/pmax/tc/tcbus.c
diff -u src/sys/arch/pmax/tc/tcbus.c:1.21 src/sys/arch/pmax/tc/tcbus.c:1.21.16.1
--- src/sys/arch/pmax/tc/tcbus.c:1.21 Mon May 26 10:31:22 2008
+++ src/sys/arch/pmax/tc/tcbus.c Wed Dec 29 00:16:30 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: tcbus.c,v 1.21 2008/05/26 10:31:22 nisimura Exp $ */
+/* $NetBSD: tcbus.c,v 1.21.16.1 2010/12/29 00:16:30 matt Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1.21 2008/05/26 10:31:22 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcbus.c,v 1.21.16.1 2010/12/29 00:16:30 matt Exp $");
/*
* Which system models were configured?
@@ -192,7 +192,7 @@
#include <pmax/pmax/cons.h>
#include <machine/dec_prom.h>
-int tc_checkslot __P((tc_addr_t, char *));
+int tc_checkslot(tc_addr_t, char *);
struct cnboards {
const char *cb_tcname;
@@ -229,22 +229,22 @@
};
int
-tcfb_cnattach(slotno)
- int slotno;
+tcfb_cnattach(int slotno)
{
paddr_t tcaddr;
char tcname[TC_ROM_LLEN];
int i;
- tcaddr = (*callv->_slot_address)(slotno);
+ tcaddr = promcall(callv->_slot_address, slotno);
if (tc_badaddr(tcaddr) || tc_checkslot(tcaddr, tcname) == 0)
panic("TC console designated by PROM does not exist!?");
- for (i = 0; i < sizeof(cnboards) / sizeof(cnboards[0]); i++)
+ for (i = 0; i < __arraycount(cnboards); i++) {
if (strncmp(tcname, cnboards[i].cb_tcname, TC_ROM_LLEN) == 0)
break;
+ }
- if (i == sizeof(cnboards) / sizeof(cnboards[0]))
+ if (i == __arraycount(cnboards))
return (0);
(cnboards[i].cb_cnattach)((tc_addr_t)TC_PHYS_TO_UNCACHED(tcaddr));