Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Feb 2003 00:37:26 -0800 (PST)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 25150 for review
Message-ID:  <200302140837.h1E8bQCD041312@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=25150

Change 25150 by jmallett@jmallett_dalek on 2003/02/14 00:36:39

	Many new stubs, implement some more atomics (the last?), and so on.

Affected files ...

.. //depot/projects/mips/sys/conf/files.mips#9 edit
.. //depot/projects/mips/sys/mips/include/atomic.h#11 edit
.. //depot/projects/mips/sys/mips/include/cpu.h#2 edit
.. //depot/projects/mips/sys/mips/include/hwfunc.h#2 edit
.. //depot/projects/mips/sys/mips/include/md_var.h#3 edit
.. //depot/projects/mips/sys/mips/include/param.h#7 edit
.. //depot/projects/mips/sys/mips/include/pmap.h#5 edit
.. //depot/projects/mips/sys/mips/mips/elf_machdep.c#1 add
.. //depot/projects/mips/sys/mips/mips/locore.s#3 edit
.. //depot/projects/mips/sys/mips/mips/machdep.c#4 edit
.. //depot/projects/mips/sys/mips/mips/pmap.c#3 edit
.. //depot/projects/mips/sys/mips/mips/sig_machdep.c#1 add
.. //depot/projects/mips/sys/mips/mips/support.S#3 edit
.. //depot/projects/mips/sys/mips/mips/vm_machdep.c#3 edit
.. //depot/projects/mips/sys/mips/sgimips/clock.c#1 add
.. //depot/projects/mips/sys/mips/sgimips/machdep_sgimips.c#3 edit

Differences ...

==== //depot/projects/mips/sys/conf/files.mips#9 (text+ko) ====

@@ -11,15 +11,18 @@
 
 # This stanza is MIPS MD files.
 mips/mips/critical.c		standard
+mips/mips/elf_machdep.c		standard
 #mips/mips/locore.s		standard	Implicit. XXX
 mips/mips/machdep.c		standard
 mips/mips/pmap.c		standard
+mips/mips/sig_machdep.c		standard
 mips/mips/support.S		standard
 mips/mips/sys_machdep.c		standard
 mips/mips/vm_machdep.c		standard
 
 # This stanza is platform files, per platform.
 geom/geom_fx.c			optional	sgimips
+mips/sgimips/clock.c		optional	sgimips
 mips/sgimips/machdep_sgimips.c	optional	sgimips
 
 # This stanza is device files.

==== //depot/projects/mips/sys/mips/include/atomic.h#11 (text+ko) ====

@@ -110,6 +110,30 @@
 ATOMIC_ACQ_LOAD(int)
 ATOMIC_REL_STORE(int)
 
+static __inline int
+atomic_cmpset_int(u_int *p, u_int old, u_int val)
+{
+	u_int temp;
+	int res;
+
+	__asm __volatile (
+	"1:\n\t"
+	"move	%[res], $0\n\t"
+	"ll	%[temp], (%[p])\n\t"
+	"bne	%[temp], %[old], 2f\n\t"
+	"move	%[temp], %[val]\n\t"
+	"li	%[res], 1\n\t"
+	"sc	%[temp], (%[p])\n\t"
+	"beqz	%[temp], 1b\n\t"
+	"2:\n\t"
+	: [old] "=r"(old), [val] "=r"(val)
+	: [res] "r"(res), [temp] "r"(temp), [p] "r"(p)
+	: "memory"
+	);
+
+	return res;
+}
+
 static __inline u_int
 atomic_readandclear_int(u_int *p)
 {
@@ -171,6 +195,30 @@
 ATOMIC_ACQ_LOAD(long)
 ATOMIC_REL_STORE(long)
 
+static __inline int
+atomic_cmpset_long(u_long *p, u_long old, u_long val)
+{
+	u_long temp;
+	int res;
+
+	__asm __volatile (
+	"1:\n\t"
+	"move	%[res], $0\n\t"
+	"lld	%[temp], (%[p])\n\t"
+	"bne	%[temp], %[old], 2f\n\t"
+	"move	%[temp], %[val]\n\t"
+	"li	%[res], 1\n\t"
+	"scd	%[temp], (%[p])\n\t"
+	"beqz	%[temp], 1b\n\t"
+	"2:\n\t"
+	: [old] "=r"(old), [val] "=r"(val)
+	: [res] "r"(res), [temp] "r"(temp), [p] "r"(p)
+	: "memory"
+	);
+
+	return res;
+}
+
 static __inline u_long
 atomic_readandclear_long(u_long *p)
 {
@@ -218,6 +266,30 @@
 ATOMIC_POP(set)
 ATOMIC_POP(subtract)
 
+static __inline int
+atomic_cmpset_ptr(void *p, void *old, void *val)
+{
+	return atomic_cmpset_long(p, (u_long)old, (u_long)val);
+}
+
+static __inline int
+atomic_cmpset_acq_ptr(void *p, void *old, void *val)
+{
+	int res;
+
+	res = atomic_cmpset_long(p, (u_long)old, (u_long)val);
+	if (res)
+		mips_write_membar();
+	return res;
+}
+
+static __inline int
+atomic_cmpset_rel_ptr(void *p, void *old, void *val)
+{
+	mips_read_membar();
+	return atomic_cmpset_long(p, (u_long)old, (u_long)val);
+}
+
 static __inline void *
 atomic_load_acq_ptr(void *p)
 {

==== //depot/projects/mips/sys/mips/include/cpu.h#2 (text+ko) ====

@@ -34,6 +34,8 @@
 #define	CLKF_USERMODE(cfp)	(0)
 #define	CLKF_PC(cfp)		(0)
 
+#define TRAPF_PC(tframe)	((tframe)->tf_epc)
+
 #define	cpu_getstack(p)		(0)
 #define	cpu_setstack(p, sp)	(0)
 

==== //depot/projects/mips/sys/mips/include/hwfunc.h#2 (text+ko) ====

@@ -33,6 +33,7 @@
  */
 
 void platform_halt(void);
+void platform_reset(void);
 void platform_start(int, char *[]);
 
 #endif /* !_MACHINE_HWFUNC_H_ */

==== //depot/projects/mips/sys/mips/include/md_var.h#3 (text+ko) ====

@@ -28,6 +28,8 @@
 #ifndef _MACHINE_MD_VAR_H_
 #define	_MACHINE_MD_VAR_H_
 
+void	cpu_halt(void);
+void	cpu_reset(void);
 void	swi_vm(void *);
 
 #endif /* !_MACHINE_MD_VAR_H_ */

==== //depot/projects/mips/sys/mips/include/param.h#7 (text+ko) ====

@@ -90,6 +90,7 @@
 
 #define	atop(x)			((unsigned long)(x) >> PAGE_SHIFT)
 #define	ptoa(x)			((unsigned long)(x) << PAGE_SHIFT)
+#define	pgtok(x)		((unsigned long)(x) * (PAGE_SIZE / 1024))
 
 /* pages ("clicks") (4096 bytes) to disk blocks */
 #define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))

==== //depot/projects/mips/sys/mips/include/pmap.h#5 (text+ko) ====

@@ -33,6 +33,7 @@
 };
 
 struct pmap {
+	struct pmap_statistics	pm_stats;
 };
 
 typedef	struct pmap *pmap_t;
@@ -46,6 +47,7 @@
 
 vm_offset_t pmap_kextract(vm_offset_t);
 
+#define	pmap_resident_count(pm)	((pm)->pm_stats.resident_count)
 #define	vtophys(va)	pmap_kextract((vm_offset_t)(va))
 
 #endif	/* !_MACHINE_PMAP_H_ */

==== //depot/projects/mips/sys/mips/mips/locore.s#3 (text+ko) ====

@@ -34,7 +34,22 @@
  */
 #define	CALLSTACK	64
 
+	.data
+/*
+ * Dummy interrupt table to keep sysctl happy until
+ * it's worked out what to do with naming
+ */
+GLOBAL(intrnames)
+	.asciz "dummy"
+GLOBAL(eintrnames)
+	.align 4
+GLOBAL(intrcnt)
+	.long 0
+GLOBAL(eintrcnt)
+
 	.set noreorder
+
+	.text
 	.globl start
 start:
 	# Just keep the boot exception vector and soft reset bits around,

==== //depot/projects/mips/sys/mips/mips/machdep.c#4 (text+ko) ====

@@ -27,10 +27,13 @@
  */
 
 #include <sys/param.h>
+#include <sys/conf.h>
 #include <sys/systm.h>
+#include <sys/ucontext.h>
 
 #include <machine/cpufunc.h>
 #include <machine/hwfunc.h>
+#include <machine/md_var.h>
 
 int cpu_prid, fpu_id;
 
@@ -41,8 +44,89 @@
 }
 
 void
+cpu_reset(void)
+{
+	platform_reset();
+}
+
+void
 Debugger(const char *msg)
 {
 	printf("Debugger(%s)\n", msg);
 	mips_break();
 }
+
+void
+dumpsys(struct dumperinfo *dip)
+{
+}
+
+int
+get_mcontext(struct thread *td, mcontext_t *mcp)
+{
+	return (0);
+}
+
+int
+set_mcontext(struct thread *td, const mcontext_t *mcp)
+{
+	return (0);
+}
+
+int
+fill_regs(struct thread *td, struct reg *regs)
+{
+	return (0);
+}
+
+int
+fill_dbregs(struct thread *td, struct dbreg *dbregs)
+{
+	return (0);
+}
+
+int
+fill_fpregs(struct thread *td, struct fpreg *fpregs)
+{
+	return (0);
+}
+
+int
+set_regs(struct thread *td, struct reg *regs)
+{
+	return (0);
+}
+
+int
+set_dbregs(struct thread *td, struct dbreg *dbregs)
+{
+	return (0);
+}
+
+int
+set_fpregs(struct thread *td, struct fpreg *fpregs)
+{
+	return (0);
+}
+
+int
+ptrace_set_pc(struct thread *td, u_long addr)
+{
+	return (0);
+}
+
+int
+ptrace_single_step(struct thread *td)
+{
+	return (0);
+}
+
+void
+cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t sz)
+{
+}
+
+void
+exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings)
+{
+}

==== //depot/projects/mips/sys/mips/mips/pmap.c#3 (text+ko) ====

@@ -47,6 +47,7 @@
 #include <vm/vm_pager.h>
 
 pmap_t kernel_pmap;
+vm_offset_t kernel_vm_end;
 vm_offset_t avail_start;
 vm_offset_t avail_end;
 vm_offset_t phys_avail[10]; /* XXX this is wrong */

==== //depot/projects/mips/sys/mips/mips/support.S#3 (text+ko) ====

@@ -193,3 +193,60 @@
 	jr	ra
 	nop
 END(fuword)
+
+/*
+ * Stubs for copy(9) XXX
+     copyin()      Copies len bytes of data from the user-space address uaddr
+                   to the kernel-space address kaddr.
+ 
+     copyout()     Copies len bytes of data from the kernel-space address
+                   kaddr to the user-space address uaddr.
+ 
+     copystr()     Copies a NUL-terminated string, at most len bytes long,
+                   from kernel-space address kfaddr to kernel-space address
+                   kdaddr.  The number of bytes actually copied, including the
+                   terminating NUL, is returned in *done.
+ 
+     copyinstr()   Copies a NUL-terminated string, at most len bytes long,
+                   from user-space address uaddr to kernel-space address
+                   kaddr.  The number of bytes actually copied, including the
+                   terminating NUL, is returned in *done.
+ */
+
+/*
+ * copyin(9)
+ * <v0>int copyin(<a0>const void *useraddr, <a1>void *kernaddr, <a2>size_t len)
+ */
+ENTRY(copyin)
+	jr	ra
+	nop
+END(copyin)
+
+/*
+ * copyout(9)
+ * <v0>int copyout(<a0>const void *kernaddr, <a1>void *useraddr, <a2>size_t len)
+ */
+ENTRY(copyout)
+	jr	ra
+	nop
+END(copyout)
+
+/*
+ * copystr(9)
+ * <v0>int copystr(<a0>const void *src, <a1>void *dst, <a2>size_t len,
+ *                 <a3>size_t *done)
+ */
+ENTRY(copystr)
+	jr	ra
+	nop
+END(copyout)
+
+/*
+ * copyinstr(9)
+ * <v0>int copyinstr(<a0>const void *useraddr, <a1>void *kernaddr,
+ *                   <a2>size_t len, <a3>size_t *done)
+ */
+ENTRY(copyinstr)
+	jr	ra
+	nop
+END(copyinstr)

==== //depot/projects/mips/sys/mips/mips/vm_machdep.c#3 (text+ko) ====

@@ -52,7 +52,47 @@
 }
 
 void
-cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
+cpu_fork(struct thread *td, struct proc *p2, struct thread *td2, int flags)
+{
+}
+
+void
+cpu_switch(void)
+{
+}
+
+void
+cpu_throw(void)
+{
+}
+
+void
+cpu_wait(struct proc *p)
+{
+}
+
+void
+cpu_thread_exit(struct thread *td)     
+{
+}
+
+void
+cpu_thread_clean(struct thread *td)     
+{
+}
+
+void
+cpu_thread_setup(struct thread *td)
+{
+}
+
+void
+cpu_set_upcall(struct thread *td, void *pcb)
+{
+}
+
+void
+cpu_set_upcall_kse(struct thread *td, struct kse *ke)
 {
 }
 

==== //depot/projects/mips/sys/mips/sgimips/machdep_sgimips.c#3 (text+ko) ====

@@ -42,6 +42,12 @@
 }
 
 void
+platform_reset(void)
+{
+	ARCBIOS->Reboot();
+}
+
+void
 platform_start(int argc, char **argv)
 {
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302140837.h1E8bQCD041312>