Port-playstation2 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Got further, am stuck now, here's a patch



Having trouble not building mips_fpu.c.
it's a problem because GCC says sdc1 instructions don't exist, and the
code explicitly uses it.

Other things in the patch:
- I tried to make mach_init more like other MIPS mach_init.
- fixed some compile errors (type casting, wrong type for printf,
  removed unused functions without a prototype).
? arch/amd64/conf/GENERIC-USBDEBUG
? arch/mips/mips/.mips_fpu.c.swp
? arch/pmax/conf/GENERIC-DEBUG
Index: arch/playstation2/conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/playstation2/conf/GENERIC,v
retrieving revision 1.10
diff -u -p -r1.10 GENERIC
--- arch/playstation2/conf/GENERIC	31 Mar 2014 11:25:49 -0000	1.10
+++ arch/playstation2/conf/GENERIC	19 Jul 2016 20:08:13 -0000
@@ -37,6 +37,11 @@ options 	SYSCTL_INCLUDE_DESCR	# Include 
 #options 	ALTQ_RIO	# RED with IN/OUT
 #options 	ALTQ_WFQ	# Weighted Fair Queueing
 
+options 	NOFPU
+options 	FPEMUL
+
+makeoptions 	COPTS="-msingle-float"
+
 config		netbsd		root on ? type ?
 
 #makeoptions	DEFGP="-G 48"
Index: arch/playstation2/playstation2/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/playstation2/playstation2/autoconf.c,v
retrieving revision 1.9
diff -u -p -r1.9 autoconf.c
--- arch/playstation2/playstation2/autoconf.c	4 Jul 2014 07:27:57 -0000	1.9
+++ arch/playstation2/playstation2/autoconf.c	19 Jul 2016 20:08:13 -0000
@@ -40,6 +40,8 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 void
 cpu_configure(void)
 {
+	/* Enable all interrupts */
+	(void)splhigh();
 	/*
 	 * During autoconfiguration, SIF BIOS uses DMAC SIF0 interrupt.
 	 * so enable DMAC interrupt here. (EIE | INT1 | IE)
@@ -51,9 +53,6 @@ cpu_configure(void)
 
 	if (config_rootfound("mainbus", NULL) == NULL)
 		panic("no mainbus found");
-
-	/* Enable all interrupts */
-	spl0();
 }
 
 void
Index: arch/playstation2/playstation2/interrupt.c
===================================================================
RCS file: /cvsroot/src/sys/arch/playstation2/playstation2/interrupt.c,v
retrieving revision 1.15
diff -u -p -r1.15 interrupt.c
--- arch/playstation2/playstation2/interrupt.c	19 Jul 2016 16:39:54 -0000	1.15
+++ arch/playstation2/playstation2/interrupt.c	19 Jul 2016 20:08:13 -0000
@@ -105,7 +105,7 @@ interrupt_init(void)
 	evcnt_attach_static(&_playstation2_evcnt.dmac);
 
 	/* install software interrupt handler */
-	intc_intr_establish(I_CH10_TIMER1, IPL_SOFT, timer1_intr, 0);
+	intc_intr_establish(I_CH10_TIMER1, IPL_SOFTCLOCK, timer1_intr, 0);
 	intc_intr_establish(I_CH11_TIMER2, IPL_SOFTCLOCK, timer2_intr, 0);
 
 	/* IPL_SOFTNET and IPL_SOFTSERIAL are shared interrupt. */
@@ -150,21 +150,6 @@ cpu_intr(int ppl, vaddr_t pc, uint32_t s
 		(void)splhigh();
 	}
 }
-void
-setsoft(int ipl)
-{
-	const static int timer_map[] = {
-		[IPL_SOFTCLOCK]	= 1,
-		[IPL_SOFTBIO]	= 2,
-		[IPL_SOFTNET]	= 3,
-		[IPL_SOFTSERIAL]= 3,
-	};
-
-	KDASSERT(ipl >= IPL_SOFTCLOCK && ipl <= IPL_SOFTSERIAL);
-
-	/* kick one shot timer */
-	timer_one_shot(timer_map[ipl]);
-}
 
 /*
  * SPL support
@@ -199,25 +184,6 @@ splraise(int npl)
 	return (opl);
 }
 
-void
-splset(int npl)
-{
-	int s;
-
-	s = _intr_suspend();
-	md_imask = npl;
-	md_imask_update();
-	_intr_resume(s);
-}
-
-void
-spl0(void)
-{
-
-	splset(0);
-	_spllower(0);
-}
-
 /*
  * SIF BIOS call of interrupt utility.
  */
Index: arch/playstation2/playstation2/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/playstation2/playstation2/machdep.c,v
retrieving revision 1.31
diff -u -p -r1.31 machdep.c
--- arch/playstation2/playstation2/machdep.c	30 Jun 2015 02:39:04 -0000	1.31
+++ arch/playstation2/playstation2/machdep.c	19 Jul 2016 20:08:13 -0000
@@ -60,6 +60,9 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include <machine/bootinfo.h>
 #include <machine/psl.h>
 #include <machine/intr.h>/* hardintr_init */
+
+#include <mips/locore.h>
+
 #include <playstation2/playstation2/sifbios.h>
 #include <playstation2/playstation2/interrupt.h>
 
@@ -91,7 +94,6 @@ mach_init(void)
 	extern char kernel_text[], edata[], end[];
 	void *kernend;
 	struct pcb *pcb0;
-	vaddr_t v;
 	paddr_t start;
 	size_t size;
 
@@ -99,7 +101,7 @@ mach_init(void)
 	 * Clear the BSS segment.
 	 */
 	kernend = (void *)mips_round_page(end);
-	memset(edata, 0, kernend - edata);
+	memset(edata, 0, (char *) kernend - edata);
 
 	/* disable all interrupt */
 	interrupt_init_bootstrap();
@@ -122,7 +124,7 @@ mach_init(void)
 	 * Initialize locore-function vector.
 	 * Clear out the I and D caches.
 	 */
-	mips_vector_init();
+	mips_vector_init(NULL, false);
 
 	/*
 	 * Load the rest of the available pages into the VM system.
@@ -130,7 +132,7 @@ mach_init(void)
 	start = (paddr_t)round_page(MIPS_KSEG0_TO_PHYS(kernend));
 	size = PS2_MEMORY_SIZE - start - BOOTINFO_BLOCK_SIZE;
 	memset((void *)MIPS_PHYS_TO_KSEG1(start), 0, size);
-	    
+
 	/* kernel itself */
 	mem_clusters[0].start = trunc_page(MIPS_KSEG0_TO_PHYS(kernel_text));
 	mem_clusters[0].size = start - mem_clusters[0].start;
@@ -138,11 +140,11 @@ mach_init(void)
 	mem_clusters[1].start = start;
 	mem_clusters[1].size = size;
 	/* load */
-	printf("load memory %#lx, %#x\n", start, size);
+	printf("load memory %#x, %#lx\n", start, size);
 	uvm_page_physload(atop(start), atop(start + size),
 	    atop(start), atop(start + size), VM_FREELIST_DEFAULT);
 
-	strcpy(cpu_model, "SONY PlayStation 2");
+	cpu_setmodel("SONY PlayStation 2");
 
 	/*
 	 * Initialize error message buffer (at end of core).
@@ -154,15 +156,12 @@ mach_init(void)
 	/*
 	 * Allocate uarea page for lwp0 and set it.
 	 */
-	v = uvm_pageboot_alloc(USPACE);
+	mips_init_lwp0_uarea();
 
-	pcb0 = lwp_getpcb(&lwp0);
-	pcb0->pcb_context[11] = PSL_LOWIPL;	/* SR */
 #ifdef IPL_ICU_MASK
+	pcb0 = lwp_getpcb(&lwp0);
 	pcb0->pcb_ppl = 0;
 #endif
-
-	lwp0.l_md.md_regs = (struct frame *)(v + USPACE) - 1
 }
 
 /*


Home | Main Index | Thread Index | Old Index