CVS commit: src/sys/arch/ia64/ia64

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 20:50:08 UTC 2020

Modified Files:
src/sys/arch/ia64/ia64: interrupt.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/ia64/ia64/interrupt.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/ia64/ia64/interrupt.c
diff -u src/sys/arch/ia64/ia64/interrupt.c:1.10 src/sys/arch/ia64/ia64/interrupt.c:1.11
--- src/sys/arch/ia64/ia64/interrupt.c:1.10	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/ia64/ia64/interrupt.c	Sat Nov 21 20:50:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.10 2019/11/10 21:16:28 chs Exp $ */
+/* $NetBSD: interrupt.c,v 1.11 2020/11/21 20:50:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -33,7 +33,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.10 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.11 2020/11/21 20:50:08 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -41,7 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: interrupt.c,
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -293,7 +293,7 @@ intr_establish(int irq, int type, int le
 
 	i = ia64_intrs[vector];
 	if (i == NULL) {
-		i = malloc(sizeof(struct ia64_intr), M_DEVBUF, M_WAITOK);
+		i = kmem_alloc(sizeof(struct ia64_intr), KM_SLEEP);
 		i->irq = irq;
 		i->sapic = sa;
 		i->type = type;
@@ -309,7 +309,7 @@ intr_establish(int irq, int type, int le
 		if (i->type != type)
 			return NULL;
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_level = level;
@@ -334,10 +334,10 @@ intr_disestablish(void *cookie)
 
 		ia64_intrs[vector] = NULL;
 		evcnt_detach(>evcnt);
-		free(i, M_DEVBUF);
+		kmem_free(i, sizeof(*i));
 	}
 
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 static int



CVS commit: src/sys/arch/ia64/ia64

2019-05-02 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Thu May  2 17:34:01 UTC 2019

Modified Files:
src/sys/arch/ia64/ia64: syscall_stubs.S

Log Message:
Add more code from FreeBSD, still needs work


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/ia64/syscall_stubs.S

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/ia64/ia64/syscall_stubs.S
diff -u src/sys/arch/ia64/ia64/syscall_stubs.S:1.5 src/sys/arch/ia64/ia64/syscall_stubs.S:1.6
--- src/sys/arch/ia64/ia64/syscall_stubs.S:1.5	Wed Jan  9 18:03:34 2019
+++ src/sys/arch/ia64/ia64/syscall_stubs.S	Thu May  2 17:34:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall_stubs.S,v 1.5 2019/01/09 18:03:34 scole Exp $	*/
+/*	$NetBSD: syscall_stubs.S,v 1.6 2019/05/02 17:34:01 scole Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 Marcel Moolenaar
@@ -74,9 +74,510 @@
  * information they need and we have the freedom to move code around.
  */
 
+/* XXX fix */	
+#define syscall		0	
+#define SYS_sigreturn	0
+	
 	.section	.text.gateway, "ax"
 	.align		PAGE_SIZE
 	.global		ia64_gateway_page
 ia64_gateway_page:
-#warning this is a stub!!!
+{   .mmb
+mov r14=ar.k7   // Memory stack
+mov r15=ar.k6   // Register stack
+epc
+;;
+}
+{   .mlx
+mov r11=psr
+movlr31=epc_syscall
+;;
+}
+{   .mib
+rum psr.be
+mov b7=r31
+br  b7
+;;
+}
+gw_ret:
+{   .mmi
+mov ar.rnat=r22
+;;
+mov ar.rsc=r24
+mov ar.pfs=r20
+}
+{   .mib
+mov ar.fpsr=r25
+mov b0=r18
+br.sptk b6
+;;
+}
+gw_ret_ia32:
+{   .mmi
+flushrs
+nop 0
+nop 0
+;;
+}
+{   .mib
+nop 0
+nop 0
+br.ia.sptk  b6
+;;
+}
 
+
+ENTRY_NOPROFILE(break_sigtramp, 0)
+{   .mib
+mov ar.rsc=0
+cmp.ne  p15,p0=0,gp
+cover
+;;
+}
+{   .mmi
+flushrs
+(p15)   invala
+add r16=16+UC_MCONTEXT+MC_SPECIAL,sp
+;;
+}
+{   .mmi
+mov r17=ar.bsp
+mov r18=ar.rnat
+add r14=40,r16
+;;
+}
+{   .mmi
+st8 [r14]=r17,64// bspstore
+(p15)   mov ar.bspstore=gp
+add r15=48,r16
+;;
+}
+{   .mmi
+st8 [r15]=r18   // rnat
+st8 [r14]=r0// ndirty
+nop 0
+;;
+}
+{   .mmi
+alloc   r14=ar.pfs, 0, 0, 3, 0
+mov ar.rsc=15
+mov out0=r8
+;;
+}
+{   .mmi
+ld8 r16=[r10],8 // function address
+;;
+ld8 gp=[r10]// function's gp value
+mov b7=r16
+;;
+}
+{   .mib
+mov out1=r9
+add out2=16,sp
+br.call.sptkrp=b7
+;;
+}
+{   .mmi
+mov r15=SYS_sigreturn
+add out0=16,sp
+break   0x10
+;;
+}
+{   .mmi
+mov r15=SYS_exit
+mov out0=ret0
+break   0x10
+;;
+}
+END(break_sigtramp)
+
+ENTRY_NOPROFILE(epc_sigtramp, 0)
+{   .mmi
+ld8 r16=[r10],8 // function address
+mov ar.rsc=0
+cmp.ne  p15,p0=0,gp
+;;
+}
+{   .mmi
+(p15)   invala
+(p15)   mov ar.bspstore=gp
+mov b7=r16
+;;
+}
+{   .mmi
+alloc   r14=ar.pfs, 0, 0, 3, 0
+mov ar.rsc=15
+nop 0
+;;
+}
+{   .mii
+ld8 gp=[r10]// function's gp value
+mov out0=r8
+mov out1=r9
+}
+{   .mib
+add out2=16,sp
+nop 0
+br.call.sptkrp=b7
+;;
+}
+add out0=16,sp
+/* XXX fix */	
+#if 0
+CALLSYS_NOERROR(sigreturn)
+mov out0=ret0
+CALLSYS_NOERROR(exit)
+#endif	
+END(epc_sigtramp)
+
+.align  PAGE_SIZE
+
+.text
+
+ENTRY_NOPROFILE(epc_syscall, 8)
+.prologue
+.unwabi @svr4, 'E'
+.save   rp, r0
+.body
+{   .mmi
+mov r16=ar.rsc
+mov ar.rsc=0
+nop 0
+;;
+}
+{   .mmi
+mov r18=ar.bspstore
+;;
+mov 

CVS commit: src/sys/arch/ia64/ia64

2019-05-02 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Thu May  2 17:31:56 UTC 2019

Modified Files:
src/sys/arch/ia64/ia64: genassym.cf

Log Message:
Restore UC_MCONTEXT, UC_MCONTEXT, and clean up some whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/ia64/ia64/genassym.cf

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/ia64/ia64/genassym.cf
diff -u src/sys/arch/ia64/ia64/genassym.cf:1.15 src/sys/arch/ia64/ia64/genassym.cf:1.16
--- src/sys/arch/ia64/ia64/genassym.cf:1.15	Thu May  2 16:55:50 2019
+++ src/sys/arch/ia64/ia64/genassym.cf	Thu May  2 17:31:56 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.15 2019/05/02 16:55:50 scole Exp $
+#	$NetBSD: genassym.cf,v 1.16 2019/05/02 17:31:56 scole Exp $
 
 #
 # Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -85,8 +85,8 @@ define	KSTACK_PAGES		KSTACK_PAGES
 
 define	IA64_VM_MINKERN_REGION	IA64_VM_MINKERN_REGION
 define	IA64_PBVM_RR		IA64_PBVM_RR
-define  IA64_PBVM_PAGE_SHIFT	IA64_PBVM_PAGE_SHIFT
-define  IA64_PSR_I		IA64_PSR_I
+define	IA64_PBVM_PAGE_SHIFT	IA64_PBVM_PAGE_SHIFT
+define	IA64_PSR_I		IA64_PSR_I
 define	IA64_PSR_DT		IA64_PSR_DT
 define	IA64_PSR_DFL		IA64_PSR_DFL
 define	IA64_PSR_DFH		IA64_PSR_DFH
@@ -95,7 +95,7 @@ define	IA64_PSR_RT		IA64_PSR_RT
 define	IA64_PSR_BN		IA64_PSR_BN
 define	IA64_PBVM_BASE		IA64_PBVM_BASE
 define	IA64_PBVM_PGTBL		IA64_PBVM_PGTBL
-define  IA64_DCR_DEFAULT	IA64_DCR_DEFAULT
+define	IA64_DCR_DEFAULT	IA64_DCR_DEFAULT
 
 define	PTE_PRESENT		PTE_PRESENT
 define	PTE_ACCESSED		PTE_ACCESSED
@@ -112,17 +112,20 @@ define	EFAULT			EFAULT
 # Important offsets into the lwp and proc structs & associated constants
 define	L_PCB			offsetof(struct lwp, l_addr)
 
-define  SIZEOF_PCB		sizeof(struct pcb)
-define  SIZEOF_TRAPFRAME	sizeof(struct trapframe)
+define	SIZEOF_PCB		sizeof(struct pcb)
+define	SIZEOF_TRAPFRAME	sizeof(struct trapframe)
 define	SIZEOF_SPECIAL		sizeof(struct _special)
 
+define	MC_SPECIAL		offsetof(struct __mcontext, mc_special)
+define	UC_MCONTEXT		offsetof(struct __ucontext, uc_mcontext)
+
 # general constants 
 define	VM_MAX_ADDRESS		VM_MAX_ADDRESS
 
 # Important offsets into the user struct & associated constants
 define	UPAGES			UPAGES
 
-define 	FRAME_SYSCALL		FRAME_SYSCALL
+define	FRAME_SYSCALL		FRAME_SYSCALL
 
 define	PC_CURLWP		offsetof(struct cpu_info, ci_curlwp) 
 define	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault) 



CVS commit: src/sys/arch/ia64/ia64

2019-04-19 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Apr 19 16:28:32 UTC 2019

Modified Files:
src/sys/arch/ia64/ia64: machdep.c

Log Message:
In map_vhpt(), read pmap_vhpt_log2size before any memory translation
instructions to avoid "Data Nested TLB faults" with GCC 7.4.0


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/ia64/ia64/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/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.42 src/sys/arch/ia64/ia64/machdep.c:1.43
--- src/sys/arch/ia64/ia64/machdep.c:1.42	Sat Apr  6 03:06:25 2019
+++ src/sys/arch/ia64/ia64/machdep.c	Fri Apr 19 16:28:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.42 2019/04/06 03:06:25 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.43 2019/04/19 16:28:32 scole Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -267,18 +267,24 @@ map_vhpt(uintptr_t vhpt)
 pt_entry_t pte;
 uint64_t psr;
 
+	/*
+	 * XXX read pmap_vhpt_log2size before any memory translation
+	 * instructions to avoid "Data Nested TLB faults".  Not
+	 * exactly sure why this is needed with GCC 7.4
+	 */
+	register uint64_t log2size = pmap_vhpt_log2size << 2;
+	
 pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY |
 		PTE_PL_KERN | PTE_AR_RW;
 pte |= vhpt & PTE_PPN_MASK;
 
-__asm __volatile("ptr.d %0,%1" :: "r"(vhpt),
-			 "r"(pmap_vhpt_log2size << 2));
+__asm __volatile("ptr.d %0,%1" :: "r"(vhpt), "r"(log2size));
 
 __asm __volatile("mov   %0=psr" : "=r"(psr));
 __asm __volatile("rsm   psr.ic|psr.i");
 ia64_srlz_i();
 ia64_set_ifa(vhpt);
-ia64_set_itir(pmap_vhpt_log2size << 2);
+	ia64_set_itir(log2size);
 ia64_srlz_d();
 __asm __volatile("itr.d dtr[%0]=%1" :: "r"(3), "r"(pte));
 __asm __volatile("mov   psr.l=%0" :: "r" (psr));



CVS commit: src/sys/arch/ia64/ia64

2019-01-18 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Jan 18 18:47:16 UTC 2019

Modified Files:
src/sys/arch/ia64/ia64: machdep.c

Log Message:
Add DPRINTF function, use kstack variable for proc0 memory, reorder some 
functions so ci initialized before use


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/ia64/ia64/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/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.40 src/sys/arch/ia64/ia64/machdep.c:1.41
--- src/sys/arch/ia64/ia64/machdep.c:1.40	Thu Nov 15 20:39:18 2018
+++ src/sys/arch/ia64/ia64/machdep.c	Fri Jan 18 18:47:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.40 2018/11/15 20:39:18 scole Exp $	*/
+/*	$NetBSD: machdep.c,v 1.41 2019/01/18 18:47:16 scole Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -119,6 +119,12 @@
 #include 
 #include 
 
+#ifdef DEBUG
+#define	DPRINTF(fmt, args...)	printf("%s: " fmt, __func__, ##args)
+#else
+#define	DPRINTF(fmt, args...)	((void)0)
+#endif
+ 
 /* the following is used externally (sysctl_hw) */
 char	machine[] = MACHINE;		/* from  */
 char	machine_arch[] = MACHINE_ARCH;	/* from  */
@@ -387,12 +393,6 @@ ia64_init(void)
 	vaddr_t v;
 
 	/* NO OUTPUT ALLOWED UNTIL FURTHER NOTICE */
-
-	/*
-	 * TODO: Disable interrupts, floating point etc.
-	 * Maybe flush cache and tlb
-	 */
-
 	ia64_set_fpsr(IA64_FPSR_DEFAULT);
 
 	/*
@@ -514,10 +514,8 @@ ia64_init(void)
 
 	for (md = efi_md_first(); md != NULL; md = efi_md_next(md)) {
 
-#ifdef DEBUG
-		printf("MD %p: type %d pa 0x%lx cnt 0x%lx\n", md,
-		md->md_type, md->md_phys, md->md_pages);
-#endif
+		DPRINTF("MD %p: type %d pa 0x%lx cnt 0x%lx\n", md,
+			md->md_type, md->md_phys, md->md_pages);
 
 		pfn0 = ia64_btop(round_page(md->md_phys));
 		pfn1 = ia64_btop(trunc_page(md->md_phys + md->md_pages * 4096));
@@ -553,17 +551,15 @@ ia64_init(void)
 			 * Must compute the location of the kernel
 			 * within the segment.
 			 */
-#ifdef DEBUG
-			printf("Descriptor %p contains kernel\n", md);
-#endif
+			DPRINTF("Descriptor %p contains kernel\n", md);
+
 			if (pfn0 < kernstartpfn) {
 /*
  * There is a chunk before the kernel.
  */
-#ifdef DEBUG
-printf("Loading chunk before kernel: "
-   "0x%lx / 0x%lx\n", pfn0, kernstartpfn);
-#endif
+DPRINTF("Loading chunk before kernel: "
+	"0x%lx / 0x%lx\n", pfn0, kernstartpfn);
+
 uvm_page_physload(pfn0, kernstartpfn,
 pfn0, kernstartpfn, VM_FREELIST_DEFAULT);
 
@@ -572,10 +568,8 @@ ia64_init(void)
 /*
  * There is a chunk after the kernel.
  */
-#ifdef DEBUG
-printf("Loading chunk after kernel: "
-   "0x%lx / 0x%lx\n", kernendpfn, pfn1);
-#endif
+DPRINTF("Loading chunk after kernel: "
+	"0x%lx / 0x%lx\n", kernendpfn, pfn1);
 
 uvm_page_physload(kernendpfn, pfn1,
 kernendpfn, pfn1, VM_FREELIST_DEFAULT);
@@ -585,10 +579,8 @@ ia64_init(void)
 			/*
 			 * Just load this cluster as one chunk.
 			 */
-#ifdef DEBUG
-			printf("Loading descriptor %p: 0x%lx / 0x%lx\n",
-			md, pfn0, pfn1);
-#endif
+			DPRINTF("Loading descriptor %p: 0x%lx / 0x%lx\n",
+md, pfn0, pfn1);
 
 			uvm_page_physload(pfn0, pfn1, pfn0, pfn1,
 			VM_FREELIST_DEFAULT);
@@ -600,21 +592,16 @@ ia64_init(void)
 		panic("can't happen: system seems to have no memory!");
 
 	/*
-	 * Initialize the virtual memory system.
-	 */
-
-	pmap_bootstrap();
-
-	/*
 	 * Initialize error message buffer (at end of core).
 	 */
 	msgbufaddr = (void *) uvm_pageboot_alloc(MSGBUFSIZE);
 	initmsgbuf(msgbufaddr, MSGBUFSIZE);
 
 	/*
-	 * Init mapping for u page(s) for proc 0
+	 * Init mapping for u page(s) for proc 0.  use memory area
+	 * already set up in locore.S
 	 */
-	v = uvm_pageboot_alloc(UPAGES * PAGE_SIZE);
+	v = (vaddr_t)
 	uvm_lwp_setuarea(, v);
 
 	/*
@@ -622,6 +609,8 @@ ia64_init(void)
 	 * and make lwp0's trapframe pointer point to it for sanity.
 	 */
 	lwp0.l_md.md_tf = (struct trapframe *)(v + UAREA_TF_OFFSET);
+	lwp0.l_md.md_tf->tf_length = sizeof(struct trapframe);
+	lwp0.l_md.md_tf->tf_flags = FRAME_SYSCALL;
 
 	lwp0.l_md.user_stack = NULL;
 	lwp0.l_md.user_stack_size = 0;
@@ -630,8 +619,6 @@ ia64_init(void)
 	pcb0->pcb_special.sp = v + UAREA_SP_OFFSET;
 	pcb0->pcb_special.bspstore = v + UAREA_BSPSTORE_OFFSET;
 	
-	mutex_init(>pcb_fpcpu_slock, MUTEX_DEFAULT, 0);
-
 	/*
 	 * Setup global data for the bootstrap cpu.
 	 */
@@ -643,9 +630,8 @@ ia64_init(void)
 	ia64_set_k4((uint64_t) ci);
 	ci->ci_cpuid = cpu_number();
 
-
 	/*
-	 * Initialise process context. XXX: This should really be in cpu_switch
+	 * Initialise process context. XXX: This should really be in cpu_switchto
 	 */
 	ci->ci_curlwp = 
 
@@ -662,6 +648,8 @@ ia64_init(void)
 	ia64_set_tpr(0);
 	ia64_srlz_d();
 
+	mutex_init(>pcb_fpcpu_slock, MUTEX_DEFAULT, 0);
+
 	/*
 	 * Save our current context so that we have a known (maybe 

CVS commit: src/sys/arch/ia64/ia64

2019-01-18 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Jan 18 18:03:06 UTC 2019

Modified Files:
src/sys/arch/ia64/ia64: vm_machdep.c

Log Message:
hopefully fix deadlock issue in cpu_switchto.  pointed out by  (Thanks!)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/ia64/ia64/vm_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/ia64/ia64/vm_machdep.c
diff -u src/sys/arch/ia64/ia64/vm_machdep.c:1.15 src/sys/arch/ia64/ia64/vm_machdep.c:1.16
--- src/sys/arch/ia64/ia64/vm_machdep.c:1.15	Wed Nov 14 21:10:59 2018
+++ src/sys/arch/ia64/ia64/vm_machdep.c	Fri Jan 18 18:03:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.15 2018/11/14 21:10:59 scole Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.16 2019/01/18 18:03:06 scole Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -91,8 +91,9 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw
 		KASSERT(oldlwp == l);
 		swapctx(oldpcb, newpcb);
 	}
-	
-	return (oldlwp);
+
+	/* return oldlwp for the original thread that called cpu_switchto */
+	return ((lwp_t *)reg9);
 }
 
 /*
@@ -189,13 +190,12 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 		tf->tf_scratch.gr10 = 0;
 	}
 
-	tf->tf_scratch.gr2 = (unsigned long)FDESC_FUNC(func);
-	tf->tf_scratch.gr3 = (unsigned long)arg;
-
-	pcb2->pcb_special.sp = ua2 + UAREA_SP_OFFSET;
-	pcb2->pcb_special.rp = (unsigned long)FDESC_FUNC(lwp_trampoline);
 	pcb2->pcb_special.bspstore = ua2 + UAREA_BSPSTORE_OFFSET + ndirty;
 	pcb2->pcb_special.pfs = 0;
+	pcb2->pcb_special.sp = ua2 + UAREA_SP_OFFSET;
+	pcb2->pcb_special.rp = (unsigned long)FDESC_FUNC(lwp_trampoline);
+	tf->tf_scratch.gr2 = (unsigned long)FDESC_FUNC(func);
+	tf->tf_scratch.gr3 = (unsigned long)arg;
 
 	return;
 }



CVS commit: src/sys/arch/ia64/ia64

2019-01-09 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Wed Jan  9 18:03:34 UTC 2019

Modified Files:
src/sys/arch/ia64/ia64: syscall_stubs.S

Log Message:
whitespace cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/ia64/syscall_stubs.S

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/ia64/ia64/syscall_stubs.S
diff -u src/sys/arch/ia64/ia64/syscall_stubs.S:1.4 src/sys/arch/ia64/ia64/syscall_stubs.S:1.5
--- src/sys/arch/ia64/ia64/syscall_stubs.S:1.4	Sat Apr  8 17:46:30 2017
+++ src/sys/arch/ia64/ia64/syscall_stubs.S	Wed Jan  9 18:03:34 2019
@@ -1,6 +1,6 @@
-/*	$NetBSD: syscall_stubs.S,v 1.4 2017/04/08 17:46:30 scole Exp $	*/
+/*	$NetBSD: syscall_stubs.S,v 1.5 2019/01/09 18:03:34 scole Exp $	*/
 
-	/*-
+/*-
  * Copyright (c) 2002, 2003 Marcel Moolenaar
  * All rights reserved.
  *



CVS commit: src/sys/arch/ia64/ia64

2018-11-20 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Tue Nov 20 20:36:24 UTC 2018

Modified Files:
src/sys/arch/ia64/ia64: genassym.cf locore.S

Log Message:
add IA64_DCR_DEFAULT, more changes from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/ia64/ia64/genassym.cf
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/ia64/locore.S

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/ia64/ia64/genassym.cf
diff -u src/sys/arch/ia64/ia64/genassym.cf:1.13 src/sys/arch/ia64/ia64/genassym.cf:1.14
--- src/sys/arch/ia64/ia64/genassym.cf:1.13	Thu Aug 10 12:51:22 2017
+++ src/sys/arch/ia64/ia64/genassym.cf	Tue Nov 20 20:36:24 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.13 2017/08/10 12:51:22 maxv Exp $
+#	$NetBSD: genassym.cf,v 1.14 2018/11/20 20:36:24 scole Exp $
 
 #
 # Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -115,6 +115,7 @@ define  IA64_PBVM_PAGE_SHIFT	IA64_PBVM_P
 define	IA64_PSR_DFH		IA64_PSR_DFH
 define	IA64_PBVM_BASE		IA64_PBVM_BASE
 define	IA64_PBVM_PGTBL		IA64_PBVM_PGTBL
+define  IA64_DCR_DEFAULT	IA64_DCR_DEFAULT
 
 define	PTE_PRESENT		PTE_PRESENT
 define	PTE_ACCESSED		PTE_ACCESSED

Index: src/sys/arch/ia64/ia64/locore.S
diff -u src/sys/arch/ia64/ia64/locore.S:1.8 src/sys/arch/ia64/ia64/locore.S:1.9
--- src/sys/arch/ia64/ia64/locore.S:1.8	Wed Nov 14 21:10:59 2018
+++ src/sys/arch/ia64/ia64/locore.S	Tue Nov 20 20:36:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.8 2018/11/14 21:10:59 scole Exp $	*/
+/*	$NetBSD: locore.S,v 1.9 2018/11/20 20:36:24 scole Exp $	*/
 	
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -81,19 +81,37 @@ ENTRY_NOPROFILE(start, 1)
 	movl	r16=pa_bootinfo
 	;;
 }
+{	.mmi	
 	st8	[r16]=r8		// save the PA of the bootinfo block
 	loadrs// invalidate regs
+	mov r17=IA64_DCR_DEFAULT
 	;;
+}
+{	.mmi
+	mov	cr.dcr=r17
 	mov	ar.rsc=3		// turn rse back on
+	nop	0
 	;;
+}
+{	.mmi
+	srlz.d	
 	alloc	r16=ar.pfs,0,0,1,0
-	;;
-	movl	out0=0			// we are linked at the right address 
+	mov	out0=r0			// we are linked at the right address 
 	;;// we just need to process fptrs
-//	br.call.sptk.many rp=_reloc	// XXX:	Look into relocs
-	;;
+	}
+#if 0  /* XXX: Look into relocs */	
+{	.mib
+	nop	0
+	nop	0
+	br.call.sptk.many rp=_reloc
+}
+#endif	
+{	.mib
+	nop	0
+	nop	0
 	br.call.sptk.many rp=ia64_init
 	;;
+}
 /* We have the new bspstore in r8 and the new sp in r9.
Switch onto the new stack and call mi_startup(). */
 {   .mmi
@@ -109,9 +127,13 @@ ENTRY_NOPROFILE(start, 1)
 mov ar.rsc = 3
 nop 0
 ;;
-}	
+}
+{	.mib
+	nop	0
+	nop	0
 	br.call.sptk.many rp=main
 	;;
+}
 	/* NOTREACHED */
 1:	br.cond.sptk.few 1b
 END(start)



CVS commit: src/sys/arch/ia64/ia64

2018-11-15 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Thu Nov 15 20:39:19 UTC 2018

Modified Files:
src/sys/arch/ia64/ia64: machdep.c

Log Message:
enable some incorrectly commented-out code


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/ia64/ia64/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/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.39 src/sys/arch/ia64/ia64/machdep.c:1.40
--- src/sys/arch/ia64/ia64/machdep.c:1.39	Wed Nov 14 21:10:59 2018
+++ src/sys/arch/ia64/ia64/machdep.c	Thu Nov 15 20:39:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.39 2018/11/14 21:10:59 scole Exp $	*/
+/*	$NetBSD: machdep.c,v 1.40 2018/11/15 20:39:18 scole Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -667,10 +667,8 @@ ia64_init(void)
 	 * sane) context as the initial context for new threads that are
 	 * forked from us.
 	 */
-#if 0	/* XXX */
 	if (savectx(pcb0))
 		panic("savectx failed");
-#endif
 
 	/*
 	 * Initialize debuggers, and break into them if appropriate.



CVS commit: src/sys/arch/ia64/ia64

2018-05-25 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri May 25 06:34:02 UTC 2018

Modified Files:
src/sys/arch/ia64/ia64: pmap.c

Log Message:
Don't use uvm_emap_size, emap was removed


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/ia64/ia64/pmap.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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.36 src/sys/arch/ia64/ia64/pmap.c:1.37
--- src/sys/arch/ia64/ia64/pmap.c:1.36	Sat Apr  8 20:59:27 2017
+++ src/sys/arch/ia64/ia64/pmap.c	Fri May 25 06:34:02 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.36 2017/04/08 20:59:27 scole Exp $ */
+/* $NetBSD: pmap.c,v 1.37 2018/05/25 06:34:02 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.36 2017/04/08 20:59:27 scole Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.37 2018/05/25 06:34:02 jdolecek Exp $");
 
 #include 
 #include 
@@ -438,7 +438,7 @@ pmap_bootstrap(void)
 	bufsz = buf_memcalc();
 	buf_setvalimit(bufsz);
 
-	nkpt = (((ubc_nwins << ubc_winshift) + uvm_emap_size +
+	nkpt = (((ubc_nwins << ubc_winshift) +
 		 bufsz + 16 * NCARGS + pager_map_size) / PAGE_SIZE +
 		USRIOSIZE + (maxproc * UPAGES) + nkmempages) / NKPTEPG;
 



CVS commit: src/sys/arch/ia64/ia64

2018-04-14 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr 14 19:58:20 UTC 2018

Modified Files:
src/sys/arch/ia64/ia64: vm_machdep.c

Log Message:
Add XXX note regarding incomplete forking


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/ia64/ia64/vm_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/ia64/ia64/vm_machdep.c
diff -u src/sys/arch/ia64/ia64/vm_machdep.c:1.13 src/sys/arch/ia64/ia64/vm_machdep.c:1.14
--- src/sys/arch/ia64/ia64/vm_machdep.c:1.13	Sat Apr  8 17:38:43 2017
+++ src/sys/arch/ia64/ia64/vm_machdep.c	Sat Apr 14 19:58:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.13 2017/04/08 17:38:43 scole Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.14 2018/04/14 19:58:20 scole Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -133,6 +133,14 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 		KASSERT(l1 == );
 	}
 
+	/*
+	 * XXX this seems incomplete, each thread apparently needs its
+	 * own stack and bspstore, and to re-adjust the RSE "ndirty"
+	 * registers.  See
+	 * http://fxr.watson.org/fxr/source/ia64/ia64/vm_machdep.c?v=FREEBSD10#L262
+	 * Also should verify u-area usage is consistent, which may be
+	 * different than freebsd.
+	 */
 	*pcb2 = *pcb1;
 
 	l2->l_md.md_flags = l1->l_md.md_flags;



CVS commit: src/sys/arch/ia64/ia64

2017-08-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Aug 10 12:51:22 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: genassym.cf

Log Message:
Don't include opt_compat_freebsd.h.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/ia64/ia64/genassym.cf

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/ia64/ia64/genassym.cf
diff -u src/sys/arch/ia64/ia64/genassym.cf:1.12 src/sys/arch/ia64/ia64/genassym.cf:1.13
--- src/sys/arch/ia64/ia64/genassym.cf:1.12	Tue Aug  1 14:23:42 2017
+++ src/sys/arch/ia64/ia64/genassym.cf	Thu Aug 10 12:51:22 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.12 2017/08/01 14:23:42 maxv Exp $
+#	$NetBSD: genassym.cf,v 1.13 2017/08/10 12:51:22 maxv Exp $
 
 #
 # Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,6 @@
 #
 
 if defined(_KERNEL_OPT)
-include "opt_compat_freebsd.h"
 include "opt_compat_linux.h"
 include "opt_multiprocessor.h"
 endif



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 20:59:27 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: pmap.c

Log Message:
Fix a possible infinite loop in pmap_kremove()


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/ia64/ia64/pmap.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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.35 src/sys/arch/ia64/ia64/pmap.c:1.36
--- src/sys/arch/ia64/ia64/pmap.c:1.35	Sat Apr  8 18:08:33 2017
+++ src/sys/arch/ia64/ia64/pmap.c	Sat Apr  8 20:59:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.35 2017/04/08 18:08:33 scole Exp $ */
+/* $NetBSD: pmap.c,v 1.36 2017/04/08 20:59:27 scole Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.35 2017/04/08 18:08:33 scole Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.36 2017/04/08 20:59:27 scole Exp $");
 
 #include 
 #include 
@@ -2110,11 +2110,12 @@ void
 pmap_kremove(vaddr_t va, vsize_t size)
 {
 	struct ia64_lpte *pte;
-
+	vaddr_t eva = va + size;
+	
 	UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
 	UVMHIST_LOG(maphist, "(va=%#lx)", va, 0, 0, 0);
 
-	while (size > 0) {
+	while (va < eva) {
 		pte = pmap_find_kpte(va);
 		if (pmap_present(pte)) {
 			KASSERT(pmap_managed(pte) != 0);
@@ -2123,7 +2124,6 @@ pmap_kremove(vaddr_t va, vsize_t size)
 			pmap_clear_present(pte);
 		}
 		va += PAGE_SIZE;
-		size -= PAGE_SIZE;
 	}
 }
 



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:47:14 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: trap.c

Log Message:
Add include and panic in startlwp()


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/ia64/ia64/trap.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/ia64/ia64/trap.c
diff -u src/sys/arch/ia64/ia64/trap.c:1.13 src/sys/arch/ia64/ia64/trap.c:1.14
--- src/sys/arch/ia64/ia64/trap.c:1.13	Mon Mar 10 13:47:45 2014
+++ src/sys/arch/ia64/ia64/trap.c	Sat Apr  8 17:47:14 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.13 2014/03/10 13:47:45 martin Exp $ */
+/* $NetBSD: trap.c,v 1.14 2017/04/08 17:47:14 scole Exp $ */
 
 /*-
  * Copyright (c) 2005 Marcel Moolenaar
@@ -61,7 +61,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.13 2014/03/10 13:47:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.14 2017/04/08 17:47:14 scole Exp $");
 
 #include 
 #include 
@@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #ifdef DDB
@@ -319,8 +320,7 @@ trap_decode_break(struct trapframe *tf)
 void
 startlwp(void *arg)
 {
-printf("%s: not yet\n", __func__);
-	return;
+	panic("XXX %s implement", __func__);
 }
 
 #ifdef DDB



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:46:30 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: syscall_stubs.S

Log Message:
Add vmparam.h include


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/ia64/ia64/syscall_stubs.S

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/ia64/ia64/syscall_stubs.S
diff -u src/sys/arch/ia64/ia64/syscall_stubs.S:1.3 src/sys/arch/ia64/ia64/syscall_stubs.S:1.4
--- src/sys/arch/ia64/ia64/syscall_stubs.S:1.3	Mon Jul 20 04:41:37 2009
+++ src/sys/arch/ia64/ia64/syscall_stubs.S	Sat Apr  8 17:46:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall_stubs.S,v 1.3 2009/07/20 04:41:37 kiyohara Exp $	*/
+/*	$NetBSD: syscall_stubs.S,v 1.4 2017/04/08 17:46:30 scole Exp $	*/
 
 	/*-
  * Copyright (c) 2002, 2003 Marcel Moolenaar
@@ -33,7 +33,6 @@
 
 
 #include 
-#include 
 #undef VM_MAX_ADDRESS
 
 #include "assym.h"



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:46:01 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: machdep.c

Log Message:
Add more from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/ia64/ia64/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/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.37 src/sys/arch/ia64/ia64/machdep.c:1.38
--- src/sys/arch/ia64/ia64/machdep.c:1.37	Fri Dec 23 07:15:27 2016
+++ src/sys/arch/ia64/ia64/machdep.c	Sat Apr  8 17:46:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.37 2016/12/23 07:15:27 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.38 2017/04/08 17:46:01 scole Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -142,8 +142,10 @@ uint64_t processor_frequency;
 uint64_t bus_frequency;
 uint64_t itc_frequency;
 uint64_t ia64_pal_base;
+uint64_t ia64_pal_size;
 uint64_t ia64_port_base;
 
+int ia64_sync_icache_needed = 0;
 
 extern uint64_t ia64_gateway_page[];
 
@@ -254,6 +256,30 @@ cpu_dumpconf(void)
 }
 
 void
+map_vhpt(uintptr_t vhpt)
+{
+pt_entry_t pte;
+uint64_t psr;
+
+pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY |
+		PTE_PL_KERN | PTE_AR_RW;
+pte |= vhpt & PTE_PPN_MASK;
+
+__asm __volatile("ptr.d %0,%1" :: "r"(vhpt),
+			 "r"(pmap_vhpt_log2size << 2));
+
+__asm __volatile("mov   %0=psr" : "=r"(psr));
+__asm __volatile("rsm   psr.ic|psr.i");
+ia64_srlz_i();
+ia64_set_ifa(vhpt);
+ia64_set_itir(pmap_vhpt_log2size << 2);
+ia64_srlz_d();
+__asm __volatile("itr.d dtr[%0]=%1" :: "r"(3), "r"(pte));
+__asm __volatile("mov   psr.l=%0" :: "r" (psr));
+ia64_srlz_i();
+}
+
+void
 map_pal_code(void)
 {
 	pt_entry_t pte;
@@ -368,6 +394,15 @@ ia64_init(void)
 
 	ia64_set_fpsr(IA64_FPSR_DEFAULT);
 
+	/*
+	 * Region 6 is direct mapped UC and region 7 is direct mapped
+	 * WC. The details of this is controlled by the Alt {I,D}TLB
+	 * handlers. Here we just make sure that they have the largest
+	 * possible page size to minimise TLB usage.
+	 */
+	ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (LOG2_ID_PAGE_SIZE << 2));
+	ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (LOG2_ID_PAGE_SIZE << 2));
+	ia64_srlz_d();
 
 	/*
 	 * TODO: Get critical system information (if possible, from the
@@ -793,3 +828,37 @@ mm_md_physacc(paddr_t pa, vm_prot_t prot
 
 	return 0; /* TODO: Implement. */
 }
+
+void
+ia64_sync_icache(vaddr_t va, vsize_t sz)
+{
+	vaddr_t lim;
+
+if (!ia64_sync_icache_needed)
+return;
+
+lim = va + sz;
+while (va < lim) {
+ia64_fc_i(va);
+va += 32;   /* XXX */
+}
+
+ia64_sync_i();
+ia64_srlz_i();
+}
+
+/*
+ * Construct a PCB from a trapframe. This is called from kdb_trap() where
+ * we want to start a backtrace from the function that caused us to enter
+ * the debugger. We have the context in the trapframe, but base the trace
+ * on the PCB. The PCB doesn't have to be perfect, as long as it contains
+ * enough for a backtrace.
+ */
+void
+makectx(struct trapframe *tf, struct pcb *pcb)
+{
+pcb->pcb_special = tf->tf_special;
+pcb->pcb_special.__spare = ~0UL;/* XXX see unwind.c */
+save_callee_saved(>pcb_preserved);
+save_callee_saved_fp(>pcb_preserved_fp);
+}



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:45:22 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: locore.S

Log Message:
Add kstack_top variable


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/ia64/locore.S

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/ia64/ia64/locore.S
diff -u src/sys/arch/ia64/ia64/locore.S:1.6 src/sys/arch/ia64/ia64/locore.S:1.7
--- src/sys/arch/ia64/ia64/locore.S:1.6	Fri Jun 20 12:41:34 2014
+++ src/sys/arch/ia64/ia64/locore.S	Sat Apr  8 17:45:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.6 2014/06/20 12:41:34 joerg Exp $	*/
+/*	$NetBSD: locore.S,v 1.7 2017/04/08 17:45:22 scole Exp $	*/
 	
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -31,18 +31,18 @@
 #include "opt_multiprocessor.h"
 
 #include 
-#include 
-#include 
 #include 
 #include 
 
 #include "assym.h"
 
 	.section .data.proc0,"aw"
-	.global	kstack
 	.align	PAGE_SIZE
+	.global	kstack
 kstack:	.space KSTACK_PAGES * PAGE_SIZE
-
+	.global kstack_top
+kstack_top:
+	
 	.text
 
 /*



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:44:27 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: interrupt.c

Log Message:
Add ia64_handle_intr() stub


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/ia64/interrupt.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/ia64/ia64/interrupt.c
diff -u src/sys/arch/ia64/ia64/interrupt.c:1.6 src/sys/arch/ia64/ia64/interrupt.c:1.7
--- src/sys/arch/ia64/ia64/interrupt.c:1.6	Sat Oct  1 15:59:28 2011
+++ src/sys/arch/ia64/ia64/interrupt.c	Sat Apr  8 17:44:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.6 2011/10/01 15:59:28 chs Exp $ */
+/* $NetBSD: interrupt.c,v 1.7 2017/04/08 17:44:27 scole Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -33,7 +33,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.6 2011/10/01 15:59:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.7 2017/04/08 17:44:27 scole Exp $");
 
 #include "opt_ddb.h"
 
@@ -363,6 +363,12 @@ ia64_dispatch_intr(void *frame, u_int ve
 	return handled;
 }
 
+void
+ia64_handle_intr(void *tf)
+{
+	panic("XXX %s not implemented", __func__);
+}
+
 #ifdef DDB
 void
 db_print_vector(u_int vector, int always)



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:43:42 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: genassym.cf

Log Message:
Add more PTE and IA64 mem region variables


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/ia64/ia64/genassym.cf

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/ia64/ia64/genassym.cf
diff -u src/sys/arch/ia64/ia64/genassym.cf:1.10 src/sys/arch/ia64/ia64/genassym.cf:1.11
--- src/sys/arch/ia64/ia64/genassym.cf:1.10	Sat Oct  1 15:59:28 2011
+++ src/sys/arch/ia64/ia64/genassym.cf	Sat Apr  8 17:43:41 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.10 2011/10/01 15:59:28 chs Exp $
+#	$NetBSD: genassym.cf,v 1.11 2017/04/08 17:43:41 scole Exp $
 
 #
 # Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -87,6 +87,7 @@ include 
 
 include 
 include 
+include 
 include 
 include 
 include 
@@ -113,6 +114,21 @@ define	PAGE_SIZE		PAGE_SIZE
 define	PAGE_SHIFT		PAGE_SHIFT
 define	KSTACK_PAGES		KSTACK_PAGES
 
+define	IA64_VM_MINKERN_REGION	IA64_VM_MINKERN_REGION
+define	IA64_PBVM_RR		IA64_PBVM_RR
+define  IA64_PBVM_PAGE_SHIFT	IA64_PBVM_PAGE_SHIFT
+define	IA64_PSR_DFH		IA64_PSR_DFH
+define	IA64_PBVM_BASE		IA64_PBVM_BASE
+define	IA64_PBVM_PGTBL		IA64_PBVM_PGTBL
+
+define	PTE_PRESENT		PTE_PRESENT
+define	PTE_ACCESSED		PTE_ACCESSED
+define	PTE_DIRTY		PTE_DIRTY
+define	PTE_PL_KERN		PTE_PL_KERN
+define	PTE_AR_RWX		PTE_AR_RWX
+define	PTE_MA_WB		PTE_MA_WB
+define	PTE_MA_UC		PTE_MA_UC
+
 define	DT_NULL			DT_NULL
 define	DT_RELA			DT_RELA
 define	DT_RELAENT		DT_RELAENT



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:42:47 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: exception.S

Log Message:
Updates from FreeBSD, mostly compile-tested


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/ia64/exception.S

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/ia64/ia64/exception.S
diff -u src/sys/arch/ia64/ia64/exception.S:1.5 src/sys/arch/ia64/ia64/exception.S:1.6
--- src/sys/arch/ia64/ia64/exception.S:1.5	Sat Oct  1 15:59:27 2011
+++ src/sys/arch/ia64/ia64/exception.S	Sat Apr  8 17:42:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception.S,v 1.5 2011/10/01 15:59:27 chs Exp $ */
+/*	$NetBSD: exception.S,v 1.6 2017/04/08 17:42:47 scole Exp $ */
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -28,18 +28,206 @@
  */
 
 #include 
-#include 
+/* __FBSDID("$FreeBSD: releng/10.1/sys/ia64/ia64/exception.S 268200 2014-07-02 23:47:43Z marcel $"); */
 
 #include "assym.h"
 	
 /*
+ * Nested TLB restart tokens. These are used by the
+ * nested TLB handler for jumping back to the code
+ * where the nested TLB was caused.
+ */
+#define	NTLBRT_SAVE	0x12c12c
+#define	NTLBRT_RESTORE  0x12c12d
+
+/*
  * ar.k7 = kernel memory stack
  * ar.k6 = kernel register stack
  * ar.k5 = EPC gateway page
  * ar.k4 = PCPU data
  */
 
-	.text
+	.section .ivt.data, "aw"
+
+	.align	8
+	.global ia64_kptdir
+	.size	ia64_kptdir, 8
+ia64_kptdir:	data8	0
+
+	
+#ifdef XTRACE
+
+	.align	8
+	.global	ia64_xtrace_mask
+	.size	ia64_xtrace_mask, 8
+ia64_xtrace_mask:	data8	0
+
+	.align	4
+	.global	ia64_xtrace_enabled
+	.size	ia64_xtrace_enabled, 4
+ia64_xtrace_enabled:	data4	0
+
+#define	XTRACE_HOOK(offset)			\
+{	.mii ;	\
+	nop		0 ;			\
+	mov		r31 = b7 ;		\
+	mov		r28 = pr ;		\
+} ;		\
+{	.mib ;	\
+	nop		0 ;			\
+	mov		r25 = ip ;		\
+	br.sptk		ia64_xtrace_write ;;	\
+} ;		\
+{	.mii ;	\
+	nop		0 ;			\
+	mov		b7 = r31 ;		\
+	mov		pr = r28, 0x1 ;;	\
+}
+
+	.section .ivt.text, "ax"
+
+// We can only use r25, r26 & r27
+ENTRY_NOPROFILE(ia64_xtrace_write, 0)
+{	.mlx
+	add	r25 = 16, r25
+	movl	r26 = ia64_xtrace_enabled
+	;;
+}
+{	.mmi
+	mov	r27 = ar.k3
+	ld4	r26 = [r26]
+	mov	b7 = r25
+	;;
+}
+{	.mib
+	add	r25 = -32, r25
+	cmp.eq	p15,p0 = r0, r26
+(p15)	br.dptk.few	b7
+	;;
+}
+{	.mib
+	nop	0
+	cmp.eq	p15,p0 = r0, r27
+(p15)	br.dptk.few	b7
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x00 IVT
+	mov	r26 = ar.itc
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x08 ITC
+	mov	r25 = cr.iip
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x10 IIP
+	mov	r26 = cr.ifa
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x18 IFA
+	mov	r25 = cr.isr
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x20 ISR
+	mov	r26 = cr.ipsr
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x28 IPSR
+	mov	r25 = cr.itir
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x30 ITIR
+	mov	r26 = cr.iipa
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x38 IIPA
+	mov	r25 = cr.ifs
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x40 IFS
+	mov	r26 = cr.iim
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x48 IIM
+	mov	r25 = cr.iha
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x50 IHA
+	mov	r26 = ar.unat
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x58 UNAT
+	mov	r25 = ar.rsc
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x60 RSC
+	mov	r26 = ar.bsp
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x68 BSP
+	mov	r25 = r13
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x70 PCPU/TLS
+	mov	r26 = r12
+	nop	0
+	;;
+}
+{	.mlx
+	st8	[r27] = r26, 8		// 0x78 SP
+	movl	r25 = ia64_xtrace_mask
+	;;
+}
+{	.mmi
+	ld8	r26 = [r25]
+	;;
+	and	r25 = r27, r26
+	nop	0
+	;;
+}
+{	.mib
+	mov	ar.k3 = r25
+	nop	0
+	br.sptk	b7
+	;;
+}
+END(ia64_xtrace_write)
+
+#else /* XTRACE */
+
+#define	XTRACE_HOOK(offset)
+
+	.section .ivt.text, "ax"
+
+#endif /* XTRACE */
 
 /*
  * exception_save: save interrupted state
@@ -67,7 +255,7 @@ ENTRY_NOPROFILE(exception_save, 0)
 	;;
 }
 {	.mmi
-	cmp.le		p14,p15=5,r31
+	cmp.le		p14,p15=IA64_VM_MINKERN_REGION,r31
 	;;
 (p15)	mov		r23=ar.k7		// kernel memory stack
 (p14)	mov		r23=sp
@@ -82,42 +270,57 @@ ENTRY_NOPROFILE(exception_save, 0)
 }
 {	.mmi
 	mov		ar.rsc=0
-	sub		r19=r23,r30
-	add		r31=8,r30
-	;;
-}
-{	.mlx
 	mov		r22=cr.iip
-	movl		r26=exception_save_restart
+	addl		r29=NTLBRT_SAVE,r0	// 22-bit restart token.
 	;;
 }
 
 	/*
-	 * We have a 1KB aligned trapframe, pointed to by sp. If we write
-	 * to the trapframe, we may trigger a data nested TLB fault. By
-	 * aligning the trapframe on a 1KB boundary, we guarantee that if
-	 * we get a data nested TLB fault, it will be on the very first
-	 * write. Since the data nested TLB fault does not preserve any
-	 * state, we have to be careful what we clobber. Consequently, we
-	 * have to be careful what we use here. Below a list of registers
-	 * that are currently alive:
+	 * We have a 1KB aligned trapframe, 

CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:40:50 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: cpu.c

Log Message:
Add more cpus to identify, from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/ia64/ia64/cpu.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/ia64/ia64/cpu.c
diff -u src/sys/arch/ia64/ia64/cpu.c:1.14 src/sys/arch/ia64/ia64/cpu.c:1.15
--- src/sys/arch/ia64/ia64/cpu.c:1.14	Thu Apr  3 17:04:46 2014
+++ src/sys/arch/ia64/ia64/cpu.c	Sat Apr  8 17:40:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.14 2014/04/03 17:04:46 martin Exp $	*/
+/*	$NetBSD: cpu.c,v 1.15 2017/04/08 17:40:50 scole Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.14 2014/04/03 17:04:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.15 2017/04/08 17:40:50 scole Exp $");
 
 #include 
 #include 
@@ -45,6 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.14
 #define MHz	100L
 #define GHz	(1000L * MHz)
 
+extern int ia64_sync_icache_needed;
+
 struct cpu_info cpu_info_primary __aligned(CACHE_LINE_SIZE);
 struct cpu_info *cpu_info_list = _info_primary;
 
@@ -165,6 +167,19 @@ identifycpu(struct cpu_softc *sc)
 			break;
 		}
 		break;
+	case 0x20:
+		ia64_sync_icache_needed = 1;
+
+		family_name = "Itanium 2";
+		switch (model) {
+		case 0x00:
+			model_name = "Montecito";
+			break;
+		case 0x01:
+			model_name = "Montvale";
+			break;
+		}
+		break;
 	}
 	cpu_setmodel("%s", model_name);
 



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:38:44 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: context.S vm_machdep.c

Log Message:
Convert cpu_switchto() from assembly to C code.  Remove comment about
possible cpu_switchto() bug.  Actual issue appears to be new processes
using lwp0 instead of own memory, which is still not fixed.

Thanks to  for figuring this out.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/ia64/context.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/ia64/ia64/vm_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/ia64/ia64/context.S
diff -u src/sys/arch/ia64/ia64/context.S:1.7 src/sys/arch/ia64/ia64/context.S:1.8
--- src/sys/arch/ia64/ia64/context.S:1.7	Mon Dec 26 19:46:59 2016
+++ src/sys/arch/ia64/ia64/context.S	Sat Apr  8 17:38:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: context.S,v 1.7 2016/12/26 19:46:59 scole Exp $	*/
+/*	$NetBSD: context.S,v 1.8 2017/04/08 17:38:43 scole Exp $	*/
 
 /*
  * Copyright (c) 2003 Marcel Moolenaar
@@ -806,93 +806,9 @@ ENTRY(restore_high_fp, 1)
 END(restore_high_fp)
 
 /*
- * lwp_t *
- * cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning)
- *
- * Switch to the specified next LWP
- *   in0 is oldlwp
- *   in1 is newlwp
- */
-ENTRY(cpu_switchto, 3)
-{	.mmi
-	alloc		loc0=ar.pfs,3,2,2,0
-
-	/*
-	 * Save old context, unless the LWP is exiting.
-	 */
-	cmp.eq		p6,p0=r0,in0		// p6 = (in0 == 0)
-	add		r14=PC_CURLWP,r13	// r14 = >ci_curlwp
-	;;
-}
-{	.mii
-	add		r2=L_PCB,in0		// r2 = lwp_getpcb()
-	add		r3=L_PCB,in1		// r3 = lwp_getpcb()
-	mov		loc1=rp			// save rp (loc1 = rp)
-	;;
-}
-{	.mmi
-	st8		[r14]=in1		// ci->ci_curlwp = newlwp
-	mov		r9=in0			// r9 = oldlwp
-	nop		0
-	;;
-}
-{	.mmb
-	nop		0
-	/*
-	 * Switch to new context, if p6 == true.
-	 * We assume to return to restorectx_return_here for swapped context.
-	 */
-(p6)	ld8		out0=[r3]		// out0 = pcb of 
-(p6)	br.call.sptk.many rp=restorectx		// if (p6) restorectx(out0)
-	;;
-}
-{	.mmb
-	/*
-	 * Swap to new context.
-	 */
-	ld8		out0=[r2]
-	ld8		out1=[r3]
-	br.call.sptk.many rp=swapctx
-	;;
-}
-	/*
-	 * XXX seems to be a bug here...
-	 *
-	 * swapctx() and restorectx() (which is called by swapctx())
-	 * both adjust the bspstore (and hence bsp) registers.  When
-	 * returning to "restorectx_return_here:" the bspstore can
-	 * be greater than bsp, a state known as an "Incomplete Register Frame".
-	 *
-	 * That is not necessarily fatal in itself, but apparently the RSE
-	 * engine sets bsp=bspstore to adjust, which re-syncs the stacked
-	 * registers (r32-r127).  This clobbers our local registers below
-	 * (loc0 and loc1) on the br return from swapctx(), and you get all
-	 * kind of mysterious exceptions depeding on what gets restored from
-	 * the backing store.
-	 *
-	 * Not sure of a proper fix is yet or how cpu_switchto should/can
-	 * be interacting with restorectx()/swapctx()
-	 * 
-	 */
-restorectx_return_here:
-{	.mib
-	mov		r8=r9			// r8(ret0) = oldlwp
-	mov		rp=loc1
-	nop		0
-	;;
-}
-{	.mib
-	nop		0
-	mov		ar.pfs=loc0
-	br.ret.sptk.many rp
-	;;
-}
-END(cpu_switchto)
-
-/*
  * lwp_trampoline()
  *
- * Arrange for a function to be invoked neatly, after a cpu_switch().
+ * Arrange for a function to be invoked neatly, after a cpu_switchto().
  *
  * Invokes fork_exit() passing in three arguments: a callout function, an
  * argument to the callout, and a trapframe pointer.  For child processes

Index: src/sys/arch/ia64/ia64/vm_machdep.c
diff -u src/sys/arch/ia64/ia64/vm_machdep.c:1.12 src/sys/arch/ia64/ia64/vm_machdep.c:1.13
--- src/sys/arch/ia64/ia64/vm_machdep.c:1.12	Fri Aug 12 02:08:20 2016
+++ src/sys/arch/ia64/ia64/vm_machdep.c	Sat Apr  8 17:38:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.12 2016/08/12 02:08:20 scole Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.13 2017/04/08 17:38:43 scole Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -62,11 +63,44 @@ cpu_lwp_free2(struct lwp *l)
 }
 
 /*
+ * The cpu_switchto() function saves the context of the LWP which is
+ * currently running on the processor, and restores the context of the LWP
+ * specified by newlwp.  man cpu_switchto(9)
+ */
+lwp_t *
+cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning)
+{
+	const struct lwp *l = curlwp;
+	struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL;
+	struct pcb *newpcb = lwp_getpcb(newlwp);
+	struct cpu_info *ci = curcpu();
+	register uint64_t reg9 __asm("r9");
+
+	KASSERT(newlwp != NULL);
+	
+	ci->ci_curlwp = newlwp;
+	
+	/* required for lwp_startup, copy oldlwp into r9, "mov r9=in0" */
+	__asm __volatile("mov %0=%1" : "=r"(reg9) : "r"(oldlwp));
+	
+	/* XXX handle RAS eventually */
+	
+	if (oldlwp == NULL) {
+		restorectx(newpcb);
+	} else {
+		KASSERT(oldlwp == l);
+		swapctx(oldpcb, newpcb);
+	}
+	
+	return 

CVS commit: src/sys/arch/ia64/ia64

2016-12-26 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Dec 26 19:46:59 UTC 2016

Modified Files:
src/sys/arch/ia64/ia64: context.S

Log Message:
Fix some comments and add new comment explaining probable bug in 
cpu_switchto().  Not sure of a fix for it yet


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/ia64/context.S

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/ia64/ia64/context.S
diff -u src/sys/arch/ia64/ia64/context.S:1.6 src/sys/arch/ia64/ia64/context.S:1.7
--- src/sys/arch/ia64/ia64/context.S:1.6	Fri Aug  5 16:46:56 2016
+++ src/sys/arch/ia64/ia64/context.S	Mon Dec 26 19:46:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: context.S,v 1.6 2016/08/05 16:46:56 scole Exp $	*/
+/*	$NetBSD: context.S,v 1.7 2016/12/26 19:46:59 scole Exp $	*/
 
 /*
  * Copyright (c) 2003 Marcel Moolenaar
@@ -821,7 +821,7 @@ ENTRY(cpu_switchto, 3)
 	 * Save old context, unless the LWP is exiting.
 	 */
 	cmp.eq		p6,p0=r0,in0		// p6 = (in0 == 0)
-	add		r14=PC_CURLWP,r13	// r2 = >ci_curlwp
+	add		r14=PC_CURLWP,r13	// r14 = >ci_curlwp
 	;;
 }
 {	.mii
@@ -840,7 +840,7 @@ ENTRY(cpu_switchto, 3)
 	nop		0
 	/*
 	 * Switch to new context, if p6 == true.
-	 * We assum to return to restorectx_return_here for swapped context.
+	 * We assume to return to restorectx_return_here for swapped context.
 	 */
 (p6)	ld8		out0=[r3]		// out0 = pcb of 
 (p6)	br.call.sptk.many rp=restorectx		// if (p6) restorectx(out0)
@@ -855,7 +855,25 @@ ENTRY(cpu_switchto, 3)
 	br.call.sptk.many rp=swapctx
 	;;
 }
-
+	/*
+	 * XXX seems to be a bug here...
+	 *
+	 * swapctx() and restorectx() (which is called by swapctx())
+	 * both adjust the bspstore (and hence bsp) registers.  When
+	 * returning to "restorectx_return_here:" the bspstore can
+	 * be greater than bsp, a state known as an "Incomplete Register Frame".
+	 *
+	 * That is not necessarily fatal in itself, but apparently the RSE
+	 * engine sets bsp=bspstore to adjust, which re-syncs the stacked
+	 * registers (r32-r127).  This clobbers our local registers below
+	 * (loc0 and loc1) on the br return from swapctx(), and you get all
+	 * kind of mysterious exceptions depeding on what gets restored from
+	 * the backing store.
+	 *
+	 * Not sure of a proper fix is yet or how cpu_switchto should/can
+	 * be interacting with restorectx()/swapctx()
+	 * 
+	 */
 restorectx_return_here:
 {	.mib
 	mov		r8=r9			// r8(ret0) = oldlwp



CVS commit: src/sys/arch/ia64/ia64

2016-12-23 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Dec 23 17:26:43 UTC 2016

Modified Files:
src/sys/arch/ia64/ia64: pmap.c

Log Message:
make kernel compilable after recent uvm changes


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/ia64/ia64/pmap.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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.33 src/sys/arch/ia64/ia64/pmap.c:1.34
--- src/sys/arch/ia64/ia64/pmap.c:1.33	Fri Dec 23 07:15:27 2016
+++ src/sys/arch/ia64/ia64/pmap.c	Fri Dec 23 17:26:43 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.33 2016/12/23 07:15:27 cherry Exp $ */
+/* $NetBSD: pmap.c,v 1.34 2016/12/23 17:26:43 scole Exp $ */
 
 
 /*-
@@ -85,7 +85,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.33 2016/12/23 07:15:27 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.34 2016/12/23 17:26:43 scole Exp $");
 
 #include 
 #include 
@@ -342,7 +342,7 @@ pmap_steal_memory(vsize_t size, vaddr_t 
 		/*
 		 * There are enough pages here; steal them!
 		 */
-		pa = ptoa(uvm_physseg_get_start(bank));
+		pa = ptoa(uvm_physseg_get_start(upm));
 		uvm_physseg_unplug(atop(pa), npgs);
 
 		va = IA64_PHYS_TO_RR7(pa);
@@ -370,7 +370,7 @@ pmap_steal_vhpt_memory(vsize_t size)
 	int npgs;
 	uvm_physseg_t upm;
 	vaddr_t va;
-	paddr_t tmppa, pa = 0;
+	paddr_t pa = 0;
 	paddr_t vhpt_start = 0, start1, start2, end1, end2;
 
 	size = round_page(size);



CVS commit: src/sys/arch/ia64/ia64

2016-11-22 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Tue Nov 22 22:53:09 UTC 2016

Modified Files:
src/sys/arch/ia64/ia64: core_machdep.c

Log Message:
For ski, break into debugger instead of exiting


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/ia64/ia64/core_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/ia64/ia64/core_machdep.c
diff -u src/sys/arch/ia64/ia64/core_machdep.c:1.1 src/sys/arch/ia64/ia64/core_machdep.c:1.2
--- src/sys/arch/ia64/ia64/core_machdep.c:1.1	Fri Aug  5 16:50:07 2016
+++ src/sys/arch/ia64/ia64/core_machdep.c	Tue Nov 22 22:53:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: core_machdep.c,v 1.1 2016/08/05 16:50:07 scole Exp $	*/
+/*	$NetBSD: core_machdep.c,v 1.2 2016/11/22 22:53:09 scole Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.1 2016/08/05 16:50:07 scole Exp $");
+__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.2 2016/11/22 22:53:09 scole Exp $");
 
 #include 
 #include 
@@ -53,7 +53,7 @@ cpu_coredump(struct lwp *l, struct cored
 struct core *chdr)
 {
   /* XXX implement, pause in ski */
-  __asm __volatile("break.i 0");
+  __asm __volatile("break.i 1");
 
   return -1;
 }



CVS commit: src/sys/arch/ia64/ia64

2016-08-11 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Aug 12 02:08:20 UTC 2016

Modified Files:
src/sys/arch/ia64/ia64: vm_machdep.c

Log Message:
Add volatile flag which might help with ski emulator and longjmp, ok'ed by 



To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/ia64/ia64/vm_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/ia64/ia64/vm_machdep.c
diff -u src/sys/arch/ia64/ia64/vm_machdep.c:1.11 src/sys/arch/ia64/ia64/vm_machdep.c:1.12
--- src/sys/arch/ia64/ia64/vm_machdep.c:1.11	Thu Feb 10 14:46:46 2011
+++ src/sys/arch/ia64/ia64/vm_machdep.c	Fri Aug 12 02:08:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.11 2011/02/10 14:46:46 pooka Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.12 2016/08/12 02:08:20 scole Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -84,7 +84,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 void (*func)(void *), void *arg)
 {
 	struct pcb *pcb1, *pcb2;
-	struct trapframe *tf;
+	struct trapframe * volatile tf;
 
 	pcb1 = lwp_getpcb(l1);
 	pcb2 = lwp_getpcb(l2);



CVS commit: src/sys/arch/ia64/ia64

2016-08-05 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Aug  5 16:53:36 UTC 2016

Modified Files:
src/sys/arch/ia64/ia64: support.S

Log Message:
PR port-ia64/51261

Use common/lib/libc/arch/ia64/string/bzero.S and other string functions


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/ia64/support.S

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/ia64/ia64/support.S
diff -u src/sys/arch/ia64/ia64/support.S:1.6 src/sys/arch/ia64/ia64/support.S:1.7
--- src/sys/arch/ia64/ia64/support.S:1.6	Sun Aug  8 18:18:58 2010
+++ src/sys/arch/ia64/ia64/support.S	Fri Aug  5 16:53:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: support.S,v 1.6 2010/08/08 18:18:58 chs Exp $	*/
+/*	$NetBSD: support.S,v 1.7 2016/08/05 16:53:36 scole Exp $	*/
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -769,84 +769,10 @@ ENTRY(copyoutstr, 4)
 	st8	[loc2]=r0			// kill the fault handler.
 	mov	ar.pfs=loc0			// restore ar.pfs
 	mov	rp=loc1// restore ra.
-	br.ret.sptk.few rp			// ret0 left over from bcopy
+	br.ret.sptk.few rp			// ret0 left over from copystr
 END(copyoutstr)
 
 /*
- * Not the fastest bcopy in the world.
- */
-ENTRY(bcopy, 3)
-	mov	ret0=r0// return zero for copy{in,out}
-	;;
-	cmp.le	p6,p0=in2,r0			// bail if len <= 0
-(p6)	br.ret.spnt.few rp
-
-	sub	r14=in1,in0 ;;			// check for overlap
-	cmp.ltu	p6,p0=r14,in2			// dst-src < len
-(p6)	br.cond.spnt.few 5f
-
-	extr.u	r14=in0,0,3			// src & 7
-	extr.u	r15=in1,0,3 ;;			// dst & 7
-	cmp.eq	p6,p0=r14,r15			// different alignment?
-(p6)	br.cond.spnt.few 2f			// branch if same alignment
-
-1:	ld1	r14=[in0],1 ;;			// copy bytewise
-	st1	[in1]=r14,1
-	add	in2=-1,in2 ;;			// len--
-	cmp.ne	p6,p0=r0,in2
-(p6)	br.cond.dptk.few 1b			// loop
-	br.ret.sptk.few rp			// done
-
-2:	cmp.eq	p6,p0=r14,r0			// aligned?
-(p6)	br.cond.sptk.few 4f
-
-3:	ld1	r14=[in0],1 ;;			// copy bytewise
-	st1	[in1]=r14,1
-	extr.u	r15=in0,0,3			// src & 7
-	add	in2=-1,in2 ;;			// len--
-	cmp.eq	p6,p0=r0,in2			// done?
-	cmp.eq	p7,p0=r0,r15 ;;			// aligned now?
-(p6)	br.ret.spnt.few rp			// return if done
-(p7)	br.cond.spnt.few 4f			// go to main copy
-	br.cond.sptk.few 3b			// more bytes to copy
-
-	// At this point, in2 is non-zero
-
-4:	mov	r14=8 ;;
-	cmp.ltu	p6,p0=in2,r14 ;;		// len < 8?
-(p6)	br.cond.spnt.few 1b			// byte copy the end
-	ld8	r15=[in0],8 ;;			// copy word
-	st8	[in1]=r15,8
-	add	in2=-8,in2 ;;			// len -= 8
-	cmp.ne	p6,p0=r0,in2			// done?
-(p6)	br.cond.spnt.few 4b			// again
-
-	br.ret.sptk.few rp			// return
-
-	// Don't bother optimising overlap case
-
-5:	add	in0=in0,in2
-	add	in1=in1,in2 ;;
-	add	in0=-1,in0
-	add	in1=-1,in1 ;;
-
-6:	ld1	r14=[in0],-1 ;;
-	st1	[in1]=r14,-1
-	add	in2=-1,in2 ;;
-	cmp.ne	p6,p0=r0,in2
-(p6)	br.cond.spnt.few 6b
-
-	br.ret.sptk.few rp
-END(bcopy)
-
-ENTRY(memcpy,3)
-	mov	r14=in0 ;;
-	mov	in0=in1 ;;
-	mov	in1=r14
-	br.cond.sptk.few bcopy
-END(memcpy)
-
-/*
  * int kcopy(const void *from, void *to, size_t len);
  * Copy len bytes, abort on fault.
  */
@@ -876,12 +802,13 @@ ENTRY(kcopy, 3)
 	mov	out0=in0
 	mov	out1=in1
 	mov	out2=in2
+	mov	ret0=r0// XXX netbsd kcopy same as freebsd?
 	;;
 	br.call.sptk.few rp=bcopy		// do the copy.
 	st8	[loc2]=r0			// kill the fault handler.
 	mov	ar.pfs=loc0			// restore ar.pfs
 	mov	rp=loc1// restore ra.
-	br.ret.sptk.few rp			// ret0 left over from bcopy
+	br.ret.sptk.few rp
 END(kcopy)
 
 ENTRY(copyin, 3)
@@ -914,12 +841,13 @@ ENTRY(copyin, 3)
 	mov	out0=in0
 	mov	out1=in1
 	mov	out2=in2
+	mov	ret0=r0// return zero for copy{in,out}
 	;;
 	br.call.sptk.few rp=bcopy		// do the copy.
 	st8	[loc2]=r0			// kill the fault handler.
 	mov	ar.pfs=loc0			// restore ar.pfs
 	mov	rp=loc1// restore ra.
-	br.ret.sptk.few rp			// ret0 left over from bcopy
+	br.ret.sptk.few rp
 END(copyin)
 
 ENTRY(copyout, 3)
@@ -952,12 +880,13 @@ ENTRY(copyout, 3)
 	mov	out0=in0
 	mov	out1=in1
 	mov	out2=in2
+	mov	ret0=r0// return zero for copy{in,out}
 	;;
 	br.call.sptk.few rp=bcopy		// do the copy.
 	st8	[loc2]=r0			// kill the fault handler.
 	mov	ar.pfs=loc0			// restore ar.pfs
 	mov	rp=loc1// restore ra.
-	br.ret.sptk.few rp			// ret0 left over from bcopy
+	br.ret.sptk.few rp
 END(copyout)
 
 ENTRY(copyerr, 0)



CVS commit: src/sys/arch/ia64/ia64

2016-08-05 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Aug  5 16:51:56 UTC 2016

Added Files:
src/sys/arch/ia64/ia64: procfs_machdep.c

Log Message:
PR port-ia64/51261

Add procfs_getcpuinfstr()


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/ia64/ia64/procfs_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/arch/ia64/ia64/procfs_machdep.c
diff -u /dev/null src/sys/arch/ia64/ia64/procfs_machdep.c:1.1
--- /dev/null	Fri Aug  5 16:51:56 2016
+++ src/sys/arch/ia64/ia64/procfs_machdep.c	Fri Aug  5 16:51:56 2016
@@ -0,0 +1,49 @@
+/*	$NetBSD: procfs_machdep.c,v 1.1 2016/08/05 16:51:56 scole Exp $	*/
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.1 2016/08/05 16:51:56 scole Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+/*
+ * Linux-style /proc/cpuinfo.
+ * Only used when procfs is mounted with -o linux.
+ */
+int
+procfs_getcpuinfstr(char *buf, size_t *len)
+{
+	*len = 0;
+
+	return 0;
+}



CVS commit: src/sys/arch/ia64/ia64

2016-08-05 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Aug  5 16:50:07 UTC 2016

Added Files:
src/sys/arch/ia64/ia64: core_machdep.c

Log Message:
PR port-ia64/51261

Add cpu_coredump() stub


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/ia64/ia64/core_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/arch/ia64/ia64/core_machdep.c
diff -u /dev/null src/sys/arch/ia64/ia64/core_machdep.c:1.1
--- /dev/null	Fri Aug  5 16:50:07 2016
+++ src/sys/arch/ia64/ia64/core_machdep.c	Fri Aug  5 16:50:07 2016
@@ -0,0 +1,59 @@
+/*	$NetBSD: core_machdep.c,v 1.1 2016/08/05 16:50:07 scole Exp $	*/
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 			/* RCS ID & Copyright macro defns */
+__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.1 2016/08/05 16:50:07 scole Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * Dump the machine specific header information at the start of a core dump.
+ */
+int
+cpu_coredump(struct lwp *l, struct coredump_iostate *iocookie,
+struct core *chdr)
+{
+  /* XXX implement, pause in ski */
+  __asm __volatile("break.i 0");
+
+  return -1;
+}



CVS commit: src/sys/arch/ia64/ia64

2016-08-05 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Aug  5 16:46:56 UTC 2016

Modified Files:
src/sys/arch/ia64/ia64: context.S

Log Message:
PR port-ia64/51261

Import later version from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/ia64/context.S

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/ia64/ia64/context.S
diff -u src/sys/arch/ia64/ia64/context.S:1.5 src/sys/arch/ia64/ia64/context.S:1.6
--- src/sys/arch/ia64/ia64/context.S:1.5	Sun Mar 24 06:06:19 2013
+++ src/sys/arch/ia64/ia64/context.S	Fri Aug  5 16:46:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: context.S,v 1.5 2013/03/24 06:06:19 kiyohara Exp $	*/
+/*	$NetBSD: context.S,v 1.6 2016/08/05 16:46:56 scole Exp $	*/
 
 /*
  * Copyright (c) 2003 Marcel Moolenaar
@@ -25,7 +25,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/ia64/ia64/context.S,v 1.3 2003/07/02 12:57:07 ru Exp $
+ * $FreeBSD: releng/10.1/sys/ia64/ia64/context.S 204184 2010-02-22 01:23:41Z marcel $
  */
 
 #include 
@@ -64,7 +64,7 @@ ENTRY(restorectx, 1)
 {	.mmi
 	loadrs
 	ld8		r21=[r30],16		// rnat
-	mov		pr=r18,0x1003e		// Preserved pr (p1-p5, p16-p63)
+	mov		pr=r18,0x1fffe
 	;;
 }
 {	.mmi
@@ -88,18 +88,18 @@ ENTRY(restorectx, 1)
 {	.mmi
 	ld8.fill	r6=[r14],16		// r6
 	ld8.fill	r7=[r15],16		// r7
-	nop		1
+	nop		0
 	;;
 }
 {	.mmi
 	mov		ar.unat=r16
 	mov		ar.rsc=3
-	nop		2
+	nop		0
 }
 {	.mmi
 	ld8		r17=[r14],16		// b1
 	ld8		r18=[r15],16		// b2
-	nop		3
+	nop		0
 	;;
 }
 {	.mmi
@@ -288,7 +288,7 @@ ENTRY(swapctx, 2)
 (p15)	br.ret.sptk	rp
 	;;
 }
-{	.mfb
+{	.mib
 	mov		r32=r33
 	nop		0
 	br.sptk		restorectx
@@ -340,10 +340,10 @@ ENTRY(save_callee_saved, 1)
 	mov		r17=b5
 	;;
 }
-{	.mfi
+{	.mii
 	st8		[r14]=r17,16		// b5
-	nop		0
 	mov		r16=ar.lc
+	nop		0
 	;;
 }
 {	.mmb
@@ -365,13 +365,13 @@ ENTRY(restore_callee_saved, 1)
 	add		r31=-8,r32
 	;;
 }
-{	.mmb
+{	.mmi
 	ld8.fill	r4=[r31],16		// r4
 	ld8.fill	r5=[r32],16		// r5
 	nop		0
 	;;
 }
-{	.mmb
+{	.mmi
 	ld8.fill	r6=[r31],16		// r6
 	ld8.fill	r7=[r32],16		// r7
 	nop		0
@@ -657,7 +657,7 @@ ENTRY(restore_high_fp, 1)
 	ldf.fill	f32=[r32],32
 	;;
 	ldf.fill	f33=[r31],32
-	ldf.fill	f34=[r32],32
+	ldf.fill	f34=[r32],32	
 	;;
 	ldf.fill	f35=[r31],32
 	ldf.fill	f36=[r32],32



CVS commit: src/sys/arch/ia64/ia64

2016-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May 13 13:40:56 UTC 2016

Modified Files:
src/sys/arch/ia64/ia64: ssc.c

Log Message:
>From scole_mail:
So here is a patch to get basic ski console output working.  The ski
simulator was decoding the wrong registers in ssccnputc() due to
automagically inlined ssc() which contains a "break" simulated system
call.

The ski loader "skiload" has almost exactly the same inline assembly
call for ssc(), but for whatever reason, (maybe ssc() and
ski_cons_putchar() are in different files?), the ssc() function didn't
get inlined and I/O worked fine.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/ia64/ssc.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/ia64/ia64/ssc.c
diff -u src/sys/arch/ia64/ia64/ssc.c:1.4 src/sys/arch/ia64/ia64/ssc.c:1.5
--- src/sys/arch/ia64/ia64/ssc.c:1.4	Sat Oct 27 13:17:57 2012
+++ src/sys/arch/ia64/ia64/ssc.c	Fri May 13 09:40:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ssc.c,v 1.4 2012/10/27 17:17:57 chs Exp $	*/
+/*	$NetBSD: ssc.c,v 1.5 2016/05/13 13:40:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -46,6 +46,7 @@ int ssccngetc(dev_t);
 void ssccnpollc(dev_t, int);
 
 
+__attribute__((__noinline__))
 uint64_t
 ssc(uint64_t in0, uint64_t in1, uint64_t in2, uint64_t in3, int which)
 {



CVS commit: src/sys/arch/ia64/ia64

2014-04-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr  3 17:04:46 UTC 2014

Modified Files:
src/sys/arch/ia64/ia64: cpu.c

Log Message:
Add missing include


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/ia64/ia64/cpu.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/ia64/ia64/cpu.c
diff -u src/sys/arch/ia64/ia64/cpu.c:1.13 src/sys/arch/ia64/ia64/cpu.c:1.14
--- src/sys/arch/ia64/ia64/cpu.c:1.13	Mon Mar 24 20:06:32 2014
+++ src/sys/arch/ia64/ia64/cpu.c	Thu Apr  3 17:04:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.13 2014/03/24 20:06:32 christos Exp $	*/
+/*	$NetBSD: cpu.c,v 1.14 2014/04/03 17:04:46 martin Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.13 2014/03/24 20:06:32 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.14 2014/04/03 17:04:46 martin Exp $);
 
 #include sys/param.h
+#include sys/cpu.h
 #include sys/proc.h
 #include sys/systm.h
 #include sys/device.h



CVS commit: src/sys/arch/ia64/ia64

2014-04-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr  3 17:05:58 UTC 2014

Modified Files:
src/sys/arch/ia64/ia64: db_interface.c

Log Message:
Fix snprintf fallout


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/ia64/db_interface.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/ia64/ia64/db_interface.c
diff -u src/sys/arch/ia64/ia64/db_interface.c:1.7 src/sys/arch/ia64/ia64/db_interface.c:1.8
--- src/sys/arch/ia64/ia64/db_interface.c:1.7	Wed Jun  9 02:48:52 2010
+++ src/sys/arch/ia64/ia64/db_interface.c	Thu Apr  3 17:05:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.7 2010/06/09 02:48:52 mrg Exp $ */
+/* $NetBSD: db_interface.c,v 1.8 2014/04/03 17:05:58 martin Exp $ */
 
 /*-
  * Copyright (c) 2003-2005 Marcel Moolenaar
@@ -80,7 +80,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.7 2010/06/09 02:48:52 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.8 2014/04/03 17:05:58 martin Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -458,17 +458,17 @@ db_disasm(db_addr_t loc, bool altfmt)
 
 		/* Predicate. */
 		if (i-i_oper[0].o_value != 0) {
-			asm_operand(i-i_oper+0, buf, loc);
+			asm_operand(i-i_oper+0, buf, sizeof(buf), loc);
 			db_printf((%s) , buf);
 		} else
 			db_printf(   );
 
 		/* Mnemonic  completers. */
-		asm_mnemonic(i-i_op, buf);
+		asm_mnemonic(i-i_op, buf, sizeof(buf));
 		db_printf(buf);
 		n = 0;
 		while (n  i-i_ncmpltrs) {
-			asm_completer(i-i_cmpltr + n, buf);
+			asm_completer(i-i_cmpltr + n, buf, sizeof(buf));
 			db_printf(buf);
 			n++;
 		}
@@ -484,7 +484,7 @@ db_disasm(db_addr_t loc, bool altfmt)
 else
 	db_printf(,);
 			}
-			asm_operand(i-i_oper + n, buf, loc);
+			asm_operand(i-i_oper + n, buf, sizeof(buf), loc);
 			db_printf(buf);
 			n++;
 		}



CVS commit: src/sys/arch/ia64/ia64

2014-04-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr  3 17:07:07 UTC 2014

Modified Files:
src/sys/arch/ia64/ia64: consinit.c

Log Message:
Make GENERIC compilable


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/ia64/ia64/consinit.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/ia64/ia64/consinit.c
diff -u src/sys/arch/ia64/ia64/consinit.c:1.3 src/sys/arch/ia64/ia64/consinit.c:1.4
--- src/sys/arch/ia64/ia64/consinit.c:1.3	Wed Mar 12 08:36:59 2014
+++ src/sys/arch/ia64/ia64/consinit.c	Thu Apr  3 17:07:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: consinit.c,v 1.3 2014/03/12 08:36:59 martin Exp $	*/
+/*	$NetBSD: consinit.c,v 1.4 2014/04/03 17:07:07 martin Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: consinit.c,v 1.3 2014/03/12 08:36:59 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: consinit.c,v 1.4 2014/04/03 17:07:07 martin Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -123,7 +123,7 @@ static void
 pcdp_cninit(struct consdev *cn)
 {
 	struct dig64_hcdp_table *tbl;
-#if NVGA  0
+#if NVGA  0 || NCOM  0
 	union dev_desc *desc;
 #endif
 	uint64_t hcdp;
@@ -137,12 +137,13 @@ pcdp_cninit(struct consdev *cn)
 	n = 0;
 	m = tbl-length - sizeof(struct dig64_hcdp_table);
 	while (n  m) {
-#if NVGA  0
+#if NVGA  0 || NCOM  0
 		desc = (union dev_desc *)((char *)tbl-entry + n);
+#endif
 
 /* not yet... */
 /* Our VGA is Framebuffer? */
-
+#if NVGA  0
 		if (cn-cn_pri == CN_NORMAL 
 		desc-type ==
 			(DIG64_ENTRYTYPE_VGA | DIG64_ENTRYTYPE_OUTONLY)) {



CVS commit: src/sys/arch/ia64/ia64

2014-03-14 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Mar 14 17:45:38 UTC 2014

Modified Files:
src/sys/arch/ia64/ia64: machdep.c

Log Message:
Tweak the argument order passed to the elf executable entry point (usually 
__start),
so as to make call to the C function ___start() easier from assembler.
We setup the memory stack frame for ___start(), before calling it.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/ia64/ia64/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/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.34 src/sys/arch/ia64/ia64/machdep.c:1.35
--- src/sys/arch/ia64/ia64/machdep.c:1.34	Sun Jan  6 11:29:35 2013
+++ src/sys/arch/ia64/ia64/machdep.c	Fri Mar 14 17:45:37 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.34 2013/01/06 11:29:35 kiyohara Exp $	*/
+/*	$NetBSD: machdep.c,v 1.35 2014/03/14 17:45:37 cherry Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -716,16 +716,16 @@ setregs(register struct lwp *l, struct e
 		kst = ksttop - 1;
 		if (((uintptr_t)kst  0x1ff) == 0x1f8)
 			*kst-- = 0;
-		*kst-- = l-l_proc-p_psstrp;	/* in3 = ps_strings */
+		*kst-- = stack;/* in3 = sp */
 		if (((uintptr_t)kst  0x1ff) == 0x1f8)
 			*kst-- = 0;
-		*kst-- = 0;/* in2 = *obj */
+		*kst-- = l-l_proc-p_psstrp;		/* in2 = ps_strings */
 		if (((uintptr_t)kst  0x1ff) == 0x1f8)
 			*kst-- = 0;
-		*kst-- = 0;/* in1 = *cleanup */
+		*kst-- = 0;/* in1 = *obj */
 		if (((uintptr_t)kst  0x1ff) == 0x1f8)
 			*kst-- = 0;
-		*kst = stack; /* in0 = sp */
+		*kst = 0;/* in0 = *cleanup */
 		tf-tf_special.ndirty = (ksttop - kst)  3;
 	} else {/* epc syscalls (default). */
 		tf-tf_special.cfm = (3UL62) | (3UL7) | 3UL;
@@ -737,18 +737,18 @@ setregs(register struct lwp *l, struct e
 		 * Assumes that (bspstore  0x1f8)  0x1e0.
 		 */
 
-		/* in0 = sp */
-		suword((char *)tf-tf_special.bspstore - 32, stack);
+		/* in0 = *cleanup */
+		suword((char *)tf-tf_special.bspstore - 32, 0);
 
-		/* in1 == *cleanup */
+		/* in1 == *obj */
 		suword((char *)tf-tf_special.bspstore -  24, 0);
 
-		/* in2 == *obj */
-		suword((char *)tf-tf_special.bspstore -  16, 0);
+		/* in2 == ps_strings */
+		suword((char *)tf-tf_special.bspstore -  16, l-l_proc-p_psstrp);
 
-		/* in3 = ps_strings */
+		/* in3 = sp */
 		suword((char *)tf-tf_special.bspstore - 8,
-		l-l_proc-p_psstrp);
+		stack);
 
 	}
 



CVS commit: src/sys/arch/ia64/ia64

2014-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Mar 12 08:36:59 UTC 2014

Modified Files:
src/sys/arch/ia64/ia64: consinit.c

Log Message:
ifdef variable like their use


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/ia64/ia64/consinit.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/ia64/ia64/consinit.c
diff -u src/sys/arch/ia64/ia64/consinit.c:1.2 src/sys/arch/ia64/ia64/consinit.c:1.3
--- src/sys/arch/ia64/ia64/consinit.c:1.2	Mon Jun 18 01:40:55 2012
+++ src/sys/arch/ia64/ia64/consinit.c	Wed Mar 12 08:36:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: consinit.c,v 1.2 2012/06/18 01:40:55 kiyohara Exp $	*/
+/*	$NetBSD: consinit.c,v 1.3 2014/03/12 08:36:59 martin Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: consinit.c,v 1.2 2012/06/18 01:40:55 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: consinit.c,v 1.3 2014/03/12 08:36:59 martin Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -123,7 +123,9 @@ static void
 pcdp_cninit(struct consdev *cn)
 {
 	struct dig64_hcdp_table *tbl;
+#if NVGA  0
 	union dev_desc *desc;
+#endif
 	uint64_t hcdp;
 	int n, m;
 
@@ -135,8 +137,8 @@ pcdp_cninit(struct consdev *cn)
 	n = 0;
 	m = tbl-length - sizeof(struct dig64_hcdp_table);
 	while (n  m) {
-		desc = (union dev_desc *)((char *)tbl-entry + n);
 #if NVGA  0
+		desc = (union dev_desc *)((char *)tbl-entry + n);
 
 /* not yet... */
 /* Our VGA is Framebuffer? */



CVS commit: src/sys/arch/ia64/ia64

2014-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar 10 13:47:45 UTC 2014

Modified Files:
src/sys/arch/ia64/ia64: cpu.c pmap.c trap.c

Log Message:
Remove unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/ia64/ia64/cpu.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/ia64/ia64/pmap.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/ia64/ia64/trap.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/ia64/ia64/cpu.c
diff -u src/sys/arch/ia64/ia64/cpu.c:1.11 src/sys/arch/ia64/ia64/cpu.c:1.12
--- src/sys/arch/ia64/ia64/cpu.c:1.11	Sun Feb 17 06:46:23 2013
+++ src/sys/arch/ia64/ia64/cpu.c	Mon Mar 10 13:47:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.11 2013/02/17 06:46:23 kiyohara Exp $	*/
+/*	$NetBSD: cpu.c,v 1.12 2014/03/10 13:47:45 martin Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.11 2013/02/17 06:46:23 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.12 2014/03/10 13:47:45 martin Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -117,7 +117,7 @@ identifycpu(struct cpu_softc *sc)
 	uint64_t vendor[3];
 	const char *family_name, *model_name;
 	uint64_t features, tmp;
-	int number, revision, model, family, archrev;
+	int revision, model, family;
 	char bitbuf[32];
 	extern uint64_t processor_frequency;
 
@@ -129,11 +129,11 @@ identifycpu(struct cpu_softc *sc)
 	vendor[2] = '\0';
 
 	tmp = ia64_get_cpuid(3);
-	number = (tmp  0)  0xff;
+	/* number = (tmp  0)  0xff; */
 	revision = (tmp  8)  0xff;
 	model = (tmp  16)  0xff;
 	family = (tmp  24)  0xff;
-	archrev = (tmp  32)  0xff;
+	/* archrev = (tmp  32)  0xff; */
 
 	family_name = model_name = unknown;
 	switch (family) {

Index: src/sys/arch/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.31 src/sys/arch/ia64/ia64/pmap.c:1.32
--- src/sys/arch/ia64/ia64/pmap.c:1.31	Sun Mar 24 06:56:14 2013
+++ src/sys/arch/ia64/ia64/pmap.c	Mon Mar 10 13:47:45 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.31 2013/03/24 06:56:14 kiyohara Exp $ */
+/* $NetBSD: pmap.c,v 1.32 2014/03/10 13:47:45 martin Exp $ */
 
 
 /*-
@@ -85,7 +85,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.31 2013/03/24 06:56:14 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.32 2014/03/10 13:47:45 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1097,8 +1097,6 @@ pmap_protect(pmap_t pmap, vaddr_t sva, v
 {
 	pmap_t oldpmap;
 	struct ia64_lpte *pte;
-	vaddr_t pa;
-	struct vm_page *pg;
 
 	if ((prot  VM_PROT_READ) == VM_PROT_NONE) {
 		pmap_remove(pmap, sva, eva);
@@ -1125,8 +1123,6 @@ pmap_protect(pmap_t pmap, vaddr_t sva, v
 
 		if (pmap_prot(pte) != prot) {
 			if (pmap_managed(pte)) {
-pa = pmap_ppn(pte);
-pg = PHYS_TO_VM_PAGE(pa);
 if (pmap_dirty(pte))
 	pmap_clear_dirty(pte);
 if (pmap_accessed(pte)) {
@@ -1154,9 +1150,7 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa
 {
 	struct ia64_lpte *pte;
 	pmap_t oldpmap;
-	paddr_t pa;
 
-	pa = 0;
 	mutex_enter(pmap-pm_slock);
 	oldpmap = pmap_install(pmap); /*XXX: isn't this a little inefficient ?*/
 	pte = pmap_find_vhpt(va);

Index: src/sys/arch/ia64/ia64/trap.c
diff -u src/sys/arch/ia64/ia64/trap.c:1.12 src/sys/arch/ia64/ia64/trap.c:1.13
--- src/sys/arch/ia64/ia64/trap.c:1.12	Sat Jan 12 08:42:53 2013
+++ src/sys/arch/ia64/ia64/trap.c	Mon Mar 10 13:47:45 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.12 2013/01/12 08:42:53 kiyohara Exp $ */
+/* $NetBSD: trap.c,v 1.13 2014/03/10 13:47:45 martin Exp $ */
 
 /*-
  * Copyright (c) 2005 Marcel Moolenaar
@@ -61,7 +61,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.12 2013/01/12 08:42:53 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.13 2014/03/10 13:47:45 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -382,7 +382,6 @@ trap(int vector, struct trapframe *tf)
 	struct lwp *l;
 	uint64_t ucode;
 	int sig, user;
-	u_int sticks;
 	ksiginfo_t ksi;
 
 	user = TRAPF_USERMODE(tf) ? 1 : 0;
@@ -397,11 +396,9 @@ trap(int vector, struct trapframe *tf)
 	if (user) {
 		ia64_set_fpsr(IA64_FPSR_DEFAULT);
 		p = l-l_proc;
-		sticks = p-p_sticks;
 		l-l_md.md_tf = tf;
 		LWP_CACHE_CREDS(l, p);
 	} else {
-		sticks = 0;		/* XXX bogus -Wuninitialized warning */
 		p = NULL;
 	}
 	sig = 0;



CVS commit: src/sys/arch/ia64/ia64

2013-03-24 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Mar 24 06:06:19 UTC 2013

Modified Files:
src/sys/arch/ia64/ia64: context.S

Log Message:
Remove some TABs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/ia64/context.S

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/ia64/ia64/context.S
diff -u src/sys/arch/ia64/ia64/context.S:1.4 src/sys/arch/ia64/ia64/context.S:1.5
--- src/sys/arch/ia64/ia64/context.S:1.4	Tue Jan 15 13:43:27 2013
+++ src/sys/arch/ia64/ia64/context.S	Sun Mar 24 06:06:19 2013
@@ -1,5 +1,5 @@
-/*	$NetBSD: context.S,v 1.4 2013/01/15 13:43:27 kiyohara Exp $	*/
-	
+/*	$NetBSD: context.S,v 1.5 2013/03/24 06:06:19 kiyohara Exp $	*/
+
 /*
  * Copyright (c) 2003 Marcel Moolenaar
  * All rights reserved.
@@ -657,7 +657,7 @@ ENTRY(restore_high_fp, 1)
 	ldf.fill	f32=[r32],32
 	;;
 	ldf.fill	f33=[r31],32
-	ldf.fill	f34=[r32],32	
+	ldf.fill	f34=[r32],32
 	;;
 	ldf.fill	f35=[r31],32
 	ldf.fill	f36=[r32],32



CVS commit: src/sys/arch/ia64/ia64

2013-03-24 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Mar 24 06:27:52 UTC 2013

Modified Files:
src/sys/arch/ia64/ia64: pmap.c

Log Message:
Remove size pages from va.  Not a page.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/ia64/ia64/pmap.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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.29 src/sys/arch/ia64/ia64/pmap.c:1.30
--- src/sys/arch/ia64/ia64/pmap.c:1.29	Mon Nov  5 15:11:36 2012
+++ src/sys/arch/ia64/ia64/pmap.c	Sun Mar 24 06:27:52 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.29 2012/11/05 15:11:36 chs Exp $ */
+/* $NetBSD: pmap.c,v 1.30 2013/03/24 06:27:52 kiyohara Exp $ */
 
 
 /*-
@@ -85,7 +85,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.29 2012/11/05 15:11:36 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.30 2013/03/24 06:27:52 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1026,11 +1026,15 @@ pmap_kremove(vaddr_t va, vsize_t size)
 {
 struct ia64_lpte *pte;
 
-pte = pmap_find_kpte(va);
-if (pmap_present(pte)) {
-pmap_remove_vhpt(va);
-pmap_invalidate_page(pmap_kernel(), va);
-pmap_clear_present(pte);
+	while (size  0) {
+		pte = pmap_find_kpte(va);
+		if (pmap_present(pte)) {
+			pmap_remove_vhpt(va);
+			pmap_invalidate_page(pmap_kernel(), va);
+			pmap_clear_present(pte);
+		}
+		va += PAGE_SIZE;
+		size -= PAGE_SIZE;
 }
 }
 



CVS commit: src/sys/arch/ia64/ia64

2013-03-24 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Mar 24 06:56:15 UTC 2013

Modified Files:
src/sys/arch/ia64/ia64: pmap.c

Log Message:
Remove null lines.
Remove TAB and white-space terminate.
s/^/\t/.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/ia64/ia64/pmap.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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.30 src/sys/arch/ia64/ia64/pmap.c:1.31
--- src/sys/arch/ia64/ia64/pmap.c:1.30	Sun Mar 24 06:27:52 2013
+++ src/sys/arch/ia64/ia64/pmap.c	Sun Mar 24 06:56:14 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.30 2013/03/24 06:27:52 kiyohara Exp $ */
+/* $NetBSD: pmap.c,v 1.31 2013/03/24 06:56:14 kiyohara Exp $ */
 
 
 /*-
@@ -85,7 +85,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.30 2013/03/24 06:27:52 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.31 2013/03/24 06:56:14 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -130,7 +130,7 @@ vaddr_t pmap_vhpt_log2size;
 
 struct ia64_bucket *pmap_vhpt_bucket;
 int pmap_vhpt_nbuckets;
-kmutex_t pmap_vhptlock;		   /* VHPT collision chain lock */
+kmutex_t pmap_vhptlock;			/* VHPT collision chain lock */
 
 int pmap_vhpt_inserts;
 int pmap_vhpt_resident;
@@ -219,20 +219,20 @@ kmutex_t pmap_all_pmaps_slock;
 #endif /* MULTIPROCESSOR || LOCKDEBUG */
 
 
-#define pmap_accessed(lpte) ((lpte)-pte  PTE_ACCESSED)
-#define pmap_dirty(lpte)((lpte)-pte  PTE_DIRTY)
-#define pmap_managed(lpte)  ((lpte)-pte  PTE_MANAGED)
-#define pmap_ppn(lpte)  ((lpte)-pte  PTE_PPN_MASK)
-#define pmap_present(lpte)  ((lpte)-pte  PTE_PRESENT)
-#define pmap_prot(lpte) (((lpte)-pte  PTE_PROT_MASK)  56)
-#define pmap_wired(lpte)((lpte)-pte  PTE_WIRED)
-
-#define pmap_clear_accessed(lpte)   (lpte)-pte = ~PTE_ACCESSED
-#define pmap_clear_dirty(lpte)  (lpte)-pte = ~PTE_DIRTY
-#define pmap_clear_present(lpte)(lpte)-pte = ~PTE_PRESENT
-#define pmap_clear_wired(lpte)  (lpte)-pte = ~PTE_WIRED
+#define pmap_accessed(lpte)		((lpte)-pte  PTE_ACCESSED)
+#define pmap_dirty(lpte)		((lpte)-pte  PTE_DIRTY)
+#define pmap_managed(lpte)		((lpte)-pte  PTE_MANAGED)
+#define pmap_ppn(lpte)			((lpte)-pte  PTE_PPN_MASK)
+#define pmap_present(lpte)		((lpte)-pte  PTE_PRESENT)
+#define pmap_prot(lpte)			(((lpte)-pte  PTE_PROT_MASK)  56)
+#define pmap_wired(lpte)		((lpte)-pte  PTE_WIRED)
+
+#define pmap_clear_accessed(lpte)	(lpte)-pte = ~PTE_ACCESSED
+#define pmap_clear_dirty(lpte)		(lpte)-pte = ~PTE_DIRTY
+#define pmap_clear_present(lpte)	(lpte)-pte = ~PTE_PRESENT
+#define pmap_clear_wired(lpte)		(lpte)-pte = ~PTE_WIRED
 
-#define pmap_set_wired(lpte)(lpte)-pte |= PTE_WIRED
+#define pmap_set_wired(lpte)		(lpte)-pte |= PTE_WIRED
 
 
 /*
@@ -323,29 +323,14 @@ pmap_steal_memory(vsize_t size, vaddr_t 
 	size = round_page(size);
 	npgs = atop(size);
 
-#if 0
-	printf(PSM: size 0x%lx (npgs 0x%x)\n, size, npgs);
-#endif
-
 	for (lcv = 0; lcv  vm_nphysseg; lcv++) {
 		if (uvm.page_init_done == true)
 			panic(pmap_steal_memory: called _after_ bootstrap);
 
-#if 0
-		printf( bank %d: avail_start 0x%lx, start 0x%lx, 
-		avail_end 0x%lx\n, lcv, VM_PHYSMEM_PTR(lcv)-avail_start,
-		VM_PHYSMEM_PTR(lcv)-start, VM_PHYSMEM_PTR(lcv)-avail_end);
-#endif
-
 		if (VM_PHYSMEM_PTR(lcv)-avail_start != VM_PHYSMEM_PTR(lcv)-start ||
 		VM_PHYSMEM_PTR(lcv)-avail_start = VM_PHYSMEM_PTR(lcv)-avail_end)
 			continue;
 
-#if 0
-		printf( avail_end - avail_start = 0x%lx\n,
-		VM_PHYSMEM_PTR(lcv)-avail_end - VM_PHYSMEM_PTR(lcv)-avail_start);
-#endif
-
 		if ((VM_PHYSMEM_PTR(lcv)-avail_end - VM_PHYSMEM_PTR(lcv)-avail_start)
 		 npgs)
 			continue;
@@ -357,11 +342,11 @@ pmap_steal_memory(vsize_t size, vaddr_t 
 		VM_PHYSMEM_PTR(lcv)-avail_start += npgs;
 		VM_PHYSMEM_PTR(lcv)-start += npgs;
 
-
 		/*
 		 * Have we used up this segment?
 		 */
-		if (VM_PHYSMEM_PTR(lcv)-avail_start == VM_PHYSMEM_PTR(lcv)-end) {
+		if (VM_PHYSMEM_PTR(lcv)-avail_start ==
+		VM_PHYSMEM_PTR(lcv)-end) {
 			if (vm_nphysseg == 1)
 panic(pmap_steal_memory: out of memory!);
 
@@ -385,7 +370,6 @@ pmap_steal_memory(vsize_t size, vaddr_t 
 	panic(pmap_steal_memory: no memory to steal);
 }
 
-
 /*
  * pmap_steal_vhpt_memory:	Derived from alpha/pmap.c:pmap_steal_memory()
  * Note: This function is not visible outside the pmap module.
@@ -393,35 +377,21 @@ pmap_steal_memory(vsize_t size, vaddr_t 
  * Assumptions: size is always a power of 2.
  * Returns: Allocated memory at a naturally aligned address
  */
-
 static vaddr_t
 pmap_steal_vhpt_memory(vsize_t size)
 {
 	int lcv, npgs, x;
 	vaddr_t va;
 	paddr_t pa;
-
 	paddr_t vhpt_start = 0, start1, start2, end1, end2;
 
 	size = round_page(size);
 	npgs = atop(size);
 
-#if 1
-	

CVS commit: src/sys/arch/ia64/ia64

2013-02-16 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Feb 17 06:46:23 UTC 2013

Modified Files:
src/sys/arch/ia64/ia64: cpu.c

Log Message:
Call snprintb() for cpu features register.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/ia64/ia64/cpu.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/ia64/ia64/cpu.c
diff -u src/sys/arch/ia64/ia64/cpu.c:1.10 src/sys/arch/ia64/ia64/cpu.c:1.11
--- src/sys/arch/ia64/ia64/cpu.c:1.10	Sat Oct  1 15:59:27 2011
+++ src/sys/arch/ia64/ia64/cpu.c	Sun Feb 17 06:46:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.10 2011/10/01 15:59:27 chs Exp $	*/
+/*	$NetBSD: cpu.c,v 1.11 2013/02/17 06:46:23 kiyohara Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.10 2011/10/01 15:59:27 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.11 2013/02/17 06:46:23 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -118,6 +118,7 @@ identifycpu(struct cpu_softc *sc)
 	const char *family_name, *model_name;
 	uint64_t features, tmp;
 	int number, revision, model, family, archrev;
+	char bitbuf[32];
 	extern uint64_t processor_frequency;
 
 	/*
@@ -179,5 +180,12 @@ identifycpu(struct cpu_softc *sc)
 	aprint_normal(%s)\n, family_name);
 	aprint_normal_dev(sc-sc_dev, Origin \%s\,  Revision %d\n,
 	(char *)vendor, revision);
-	aprint_normal_dev(sc-sc_dev, Features 0x%x\n, (uint32_t)features);
+
+#define IA64_FEATURES_BITMASK \177\020\
+b\0LB\0	/* 'brl' instruction is implemented */			\
+b\1SD\0	/* Processor implements sportaneous deferral */		\
+b\2AO\0	/* Processor implements 16-byte atomic operations */	\
+\0
+	snprintb(bitbuf, sizeof(bitbuf), IA64_FEATURES_BITMASK, features);
+	aprint_normal_dev(sc-sc_dev, Features %s\n, bitbuf);
 }



CVS commit: src/sys/arch/ia64/ia64

2013-01-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Jan 15 13:43:27 UTC 2013

Modified Files:
src/sys/arch/ia64/ia64: context.S

Log Message:
cpu_switchto() returns argument oldlwp.  Not ci-ci_curlwp.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/ia64/ia64/context.S

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/ia64/ia64/context.S
diff -u src/sys/arch/ia64/ia64/context.S:1.3 src/sys/arch/ia64/ia64/context.S:1.4
--- src/sys/arch/ia64/ia64/context.S:1.3	Fri Nov 27 03:23:10 2009
+++ src/sys/arch/ia64/ia64/context.S	Tue Jan 15 13:43:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: context.S,v 1.3 2009/11/27 03:23:10 rmind Exp $	*/
+/*	$NetBSD: context.S,v 1.4 2013/01/15 13:43:27 kiyohara Exp $	*/
 	
 /*
  * Copyright (c) 2003 Marcel Moolenaar
@@ -28,7 +28,6 @@
  * $FreeBSD: src/sys/ia64/ia64/context.S,v 1.3 2003/07/02 12:57:07 ru Exp $
  */
 
-#include sys/cdefs.h
 #include machine/asm.h
 #include assym.h
 
@@ -831,13 +830,19 @@ ENTRY(cpu_switchto, 3)
 	mov		loc1=rp			// save rp (loc1 = rp)
 	;;
 }
+{	.mmi
+	st8		[r14]=in1		// ci-ci_curlwp = newlwp
+	mov		r9=in0			// r9 = oldlwp
+	nop		0
+	;;
+}
 {	.mmb
+	nop		0
 	/*
 	 * Switch to new context, if p6 == true.
 	 * We assum to return to restorectx_return_here for swapped context.
 	 */
-(p6)	ld8		out0=[r3]		// if (p6) out0 = pcb of newlwp
-	xchg8		r9=[r14],in1		// ci-ci_curlwp = newlwp
+(p6)	ld8		out0=[r3]		// out0 = pcb of newlwp
 (p6)	br.call.sptk.many rp=restorectx		// if (p6) restorectx(out0)
 	;;
 }



CVS commit: src/sys/arch/ia64/ia64

2013-01-12 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan 12 08:42:53 UTC 2013

Modified Files:
src/sys/arch/ia64/ia64: trap.c

Log Message:
Add some vector process from FreeBSD.
Remove and add null-line.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/ia64/ia64/trap.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/ia64/ia64/trap.c
diff -u src/sys/arch/ia64/ia64/trap.c:1.11 src/sys/arch/ia64/ia64/trap.c:1.12
--- src/sys/arch/ia64/ia64/trap.c:1.11	Sun Jan  6 11:25:13 2013
+++ src/sys/arch/ia64/ia64/trap.c	Sat Jan 12 08:42:53 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.11 2013/01/06 11:25:13 kiyohara Exp $ */
+/* $NetBSD: trap.c,v 1.12 2013/01/12 08:42:53 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2005 Marcel Moolenaar
@@ -61,7 +61,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.11 2013/01/06 11:25:13 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.12 2013/01/12 08:42:53 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -414,6 +414,7 @@ trap(int vector, struct trapframe *tf)
 		 */
 		trap_panic(vector, tf);
 		break;
+
 	case IA64_VEC_ITLB:
 	case IA64_VEC_DTLB:
 	case IA64_VEC_EXT_INTR:
@@ -526,7 +527,6 @@ trap(int vector, struct trapframe *tf)
 			} else if (ucode == 0x10) {
 break_syscall(tf);
 return;		/* do_ast() already called. */
-
 			} else if (ucode == 0x18) {
 mcontext_t mc;
 
@@ -547,6 +547,63 @@ trap(int vector, struct trapframe *tf)
 		}
 		break;
 
+	case IA64_VEC_PAGE_NOT_PRESENT:
+	case IA64_VEC_INST_ACCESS_RIGHTS:
+	case IA64_VEC_DATA_ACCESS_RIGHTS: {
+		struct pcb * const pcb = lwp_getpcb(l);
+		vaddr_t va;
+		struct vm_map *map;
+		vm_prot_t ftype;
+		uint64_t onfault;
+		int error = 0;
+
+		va = trunc_page(tf-tf_special.ifa);
+
+		if (va = VM_MAXUSER_ADDRESS) {
+			/*
+			 * Don't allow user-mode faults for kernel virtual
+			 * addresses, including the gateway page.
+			 */
+			if (user)
+goto no_fault_in;
+			map = kernel_map;
+		} else {
+			map = (p != NULL) ? p-p_vmspace-vm_map : NULL;
+			if (map == NULL)
+goto no_fault_in;
+		}
+
+		if (tf-tf_special.isr  IA64_ISR_X)
+			ftype = VM_PROT_EXECUTE;
+		else if (tf-tf_special.isr  IA64_ISR_W)
+			ftype = VM_PROT_WRITE;
+		else
+			ftype = VM_PROT_READ;
+
+		onfault = pcb-pcb_onfault;
+		pcb-pcb_onfault = 0;
+		error = uvm_fault(map, va, ftype);
+		pcb-pcb_onfault = onfault;
+
+		if (error == 0)
+			goto out;
+
+no_fault_in:
+		if (!user) {
+			/* Check for copyin/copyout fault. */
+			if (pcb-pcb_onfault != 0) {
+tf-tf_special.iip = pcb-pcb_onfault;
+tf-tf_special.psr = ~IA64_PSR_RI;
+tf-tf_scratch.gr8 = error;
+goto out;
+			}
+			trap_panic(vector, tf);
+		}
+		ucode = va;
+		sig = (error == EACCES) ? SIGBUS : SIGSEGV;
+		break;
+	}
+
 /* XXX: Fill in the rest */
 
 	case IA64_VEC_SPECULATION:



CVS commit: src/sys/arch/ia64/ia64

2013-01-06 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Jan  6 11:25:14 UTC 2013

Modified Files:
src/sys/arch/ia64/ia64: trap.c

Log Message:
Add IA64_VEC_SPECULATION into trap(). From FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/ia64/ia64/trap.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/ia64/ia64/trap.c
diff -u src/sys/arch/ia64/ia64/trap.c:1.10 src/sys/arch/ia64/ia64/trap.c:1.11
--- src/sys/arch/ia64/ia64/trap.c:1.10	Sun Feb 19 21:06:12 2012
+++ src/sys/arch/ia64/ia64/trap.c	Sun Jan  6 11:25:13 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.10 2012/02/19 21:06:12 rmind Exp $ */
+/* $NetBSD: trap.c,v 1.11 2013/01/06 11:25:13 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2005 Marcel Moolenaar
@@ -61,7 +61,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.10 2012/02/19 21:06:12 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.11 2013/01/06 11:25:13 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -549,6 +549,21 @@ trap(int vector, struct trapframe *tf)
 
 /* XXX: Fill in the rest */
 
+	case IA64_VEC_SPECULATION:
+		/*
+		 * The branching behaviour of the chk instruction is not
+		 * implemented by the processor. All we need to do is
+		 * compute the target address of the branch and make sure
+		 * that control is transfered to that address.
+		 * We should do this in the IVT table and not by entring
+		 * the kernel...
+		 */
+		tf-tf_special.iip += tf-tf_special.ifa  4;
+		tf-tf_special.psr = ~IA64_PSR_RI;
+		goto out;
+
+/* XXX: Fill in the rest */
+
 	case IA64_VEC_DEBUG:
 	case IA64_VEC_SINGLE_STEP_TRAP:
 		tf-tf_special.psr = ~IA64_PSR_SS;
@@ -575,14 +590,9 @@ trap(int vector, struct trapframe *tf)
 	ksi.ksi_code = ucode;
 	trapsignal(l, ksi);
 
-#if 1
 out:
-#endif
-
 	if (user) {
 		mi_userret(l);
 	}
-
-
 	return;
 }



CVS commit: src/sys/arch/ia64/ia64

2013-01-06 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Jan  6 11:29:35 UTC 2013

Modified Files:
src/sys/arch/ia64/ia64: locore.S machdep.c

Log Message:
Call main() in locore.S.  like other arch.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/ia64/locore.S
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/ia64/ia64/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/ia64/ia64/locore.S
diff -u src/sys/arch/ia64/ia64/locore.S:1.4 src/sys/arch/ia64/ia64/locore.S:1.5
--- src/sys/arch/ia64/ia64/locore.S:1.4	Sat Oct  1 15:59:28 2011
+++ src/sys/arch/ia64/ia64/locore.S	Sun Jan  6 11:29:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.4 2011/10/01 15:59:28 chs Exp $	*/
+/*	$NetBSD: locore.S,v 1.5 2013/01/06 11:29:35 kiyohara Exp $	*/
 	
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -96,6 +96,8 @@ ENTRY_NOPROFILE(start, 1)
 	;;
 	br.call.sptk.many rp=ia64_init
 	;;
+	br.call.sptk.many rp=main
+	;;
 	/* NOTREACHED */
 1:	br.cond.sptk.few 1b
 END(start)

Index: src/sys/arch/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.33 src/sys/arch/ia64/ia64/machdep.c:1.34
--- src/sys/arch/ia64/ia64/machdep.c:1.33	Mon Nov  5 15:13:04 2012
+++ src/sys/arch/ia64/ia64/machdep.c	Sun Jan  6 11:29:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.33 2012/11/05 15:13:04 chs Exp $	*/
+/*	$NetBSD: machdep.c,v 1.34 2013/01/06 11:29:35 kiyohara Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -221,7 +221,6 @@ cpu_startup(void)
 	 * information.
 	 */
 	ia64_probe_sapics();
-	/*XXX: ia64_mca_init();*/
 }
 
 void
@@ -664,11 +663,6 @@ ia64_init(void)
 	if (boothowto  RB_KDB)
 		Debugger();
 #endif
-
-	extern void main(void);
-	main();
-
-	panic(Wh!!! main() returned!!! \n);
 }
 
 uint64_t



CVS commit: src/sys/arch/ia64/ia64

2013-01-06 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Jan  6 11:31:39 UTC 2013

Removed Files:
src/sys/arch/ia64/ia64: mca.c

Log Message:
Remove unused a C-source.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r0 src/sys/arch/ia64/ia64/mca.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/ia64/ia64

2012-11-05 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Nov  5 15:11:37 UTC 2012

Modified Files:
src/sys/arch/ia64/ia64: pmap.c

Log Message:
remove pmap_track_modified() since it references kmem globals
that no longer exist.  this check was a hold-over from freebsd,
kmem pages on netbsd are not managed and thus mod/ref state is
anyway not tracked.  also remove commented-out assertions about
pageq locking, this was another freebsd hold-over since pmaps
do not use the pageq lock on netbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/ia64/ia64/pmap.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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.28 src/sys/arch/ia64/ia64/pmap.c:1.29
--- src/sys/arch/ia64/ia64/pmap.c:1.28	Fri Aug 31 14:31:46 2012
+++ src/sys/arch/ia64/ia64/pmap.c	Mon Nov  5 15:11:36 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.28 2012/08/31 14:31:46 chs Exp $ */
+/* $NetBSD: pmap.c,v 1.29 2012/11/05 15:11:36 chs Exp $ */
 
 
 /*-
@@ -85,7 +85,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.28 2012/08/31 14:31:46 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.29 2012/11/05 15:11:36 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -273,9 +273,6 @@ pmap_remove_entry(pmap_t pmap, struct vm
 static void
 pmap_insert_entry(pmap_t pmap, vaddr_t va, struct vm_page *pg);
 
-static __inline int
-pmap_track_modified(vaddr_t va);
-
 static void
 pmap_enter_vhpt(struct ia64_lpte *, vaddr_t);
 static int pmap_remove_vhpt(vaddr_t);
@@ -1162,7 +1159,6 @@ pmap_protect(pmap_t pmap, vaddr_t sva, v
 	if ((sva  PAGE_MASK) || (eva  PAGE_MASK))
 		panic(pmap_protect: unaligned addresses);
 
-	//uvm_lock_pageq();
 	PMAP_LOCK(pmap);
 	oldpmap = pmap_install(pmap);
 	while (sva  eva) {
@@ -1179,7 +1175,8 @@ pmap_protect(pmap_t pmap, vaddr_t sva, v
 			if (pmap_managed(pte)) {
 pa = pmap_ppn(pte);
 pg = PHYS_TO_VM_PAGE(pa);
-if (pmap_dirty(pte)) pmap_clear_dirty(pte);
+if (pmap_dirty(pte))
+	pmap_clear_dirty(pte);
 if (pmap_accessed(pte)) {
 	pmap_clear_accessed(pte);
 }
@@ -1190,7 +1187,6 @@ pmap_protect(pmap_t pmap, vaddr_t sva, v
 
 		sva += PAGE_SIZE;
 	}
-	//uvm_unlock_pageq();
 	pmap_install(oldpmap);
 	PMAP_UNLOCK(pmap);
 }
@@ -1286,8 +1282,6 @@ pmap_page_protect(struct vm_page *pg, vm
 PMAP_UNLOCK(pmap);
 }
 
-		//UVM_LOCK_ASSERT_PAGEQ(); 
-
 pg-flags |= PG_RDONLY;
 } else {
 pmap_page_purge(pg);
@@ -1425,7 +1419,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
  * We might be turning off write access to the page,
  * so we go ahead and sense modify status.
  */
-if (managed  pmap_dirty(origpte)  pmap_track_modified(va)) 
+if (managed  pmap_dirty(origpte))
 			pg-flags = ~PG_CLEAN;
 
 pmap_invalidate_page(pmap, va);
@@ -1494,8 +1488,6 @@ pmap_page_purge(struct vm_page *pg)
 	pmap_t oldpmap;
 	pv_entry_t pv;
 
-	//UVM_LOCK_ASSERT_PAGEQ();
-
 	while ((pv = TAILQ_FIRST(md-pv_list)) != NULL) {
 		struct ia64_lpte *pte;
 		pmap_t pmap = pv-pv_pmap;
@@ -1512,7 +1504,6 @@ pmap_page_purge(struct vm_page *pg)
 		PMAP_UNLOCK(pmap);
 	}
 
-	//UVM_LOCK_ASSERT_PAGEQ(); 
 	pg-flags |= PG_RDONLY;
 
 }
@@ -1766,8 +1757,7 @@ pmap_remove_pte(pmap_t pmap, struct ia64
 	if (pmap_managed(pte)) {
 		pg = PHYS_TO_VM_PAGE(pmap_ppn(pte));
 		if (pmap_dirty(pte))
-			if (pmap_track_modified(va))
-pg-flags = ~(PG_CLEAN);
+			pg-flags = ~(PG_CLEAN);
 		if (pmap_accessed(pte))
 			pg-flags = ~PG_CLEAN; /* XXX: Do we need this ? */
 
@@ -1801,21 +1791,6 @@ pmap_free_pte(struct ia64_lpte *pte, vad
 }
 
 
-/*
- * this routine defines the region(s) of memory that should
- * not be tested for the modified bit.
- */
-static __inline int
-pmap_track_modified(vaddr_t va)
-{
-	extern char *kmembase, kmemlimit;
-	if ((va  (vaddr_t) kmembase) || (va = (vaddr_t) kmemlimit)) 
-		return 1;
-	else
-		return 0;
-}
-
-
 /***
  * page management routines.
  ***/
@@ -1837,7 +1812,6 @@ get_pv_entry(pmap_t locked_pmap)
 	pv_entry_t allocated_pv;
 
 	//LOCK_ASSERT(simple_lock_held(locked_pmap-slock));
-	//UVM_LOCK_ASSERT_PAGEQ();
 	allocated_pv = 	pool_get(pmap_pv_pool, PR_NOWAIT);
 	return allocated_pv;
 
@@ -1985,7 +1959,6 @@ pmap_remove_entry(pmap_t pmap, struct vm
 		TAILQ_REMOVE(md-pv_list, pv, pv_list);
 		md-pv_list_count--;
 		if (TAILQ_FIRST(md-pv_list) == NULL) {
-			//UVM_LOCK_ASSERT_PAGEQ(); 
 			pg-flags |= PG_RDONLY;
 		}
 
@@ -2013,7 +1986,6 @@ pmap_insert_entry(pmap_t pmap, vaddr_t v
 	pv-pv_va = va;
 
 	//LOCK_ASSERT(simple_lock_held(pmap-slock));
-	//UVM_LOCK_ASSERT_PAGEQ(); 
 	TAILQ_INSERT_TAIL(pmap-pm_pvlist, pv, pv_plist);
 	

CVS commit: src/sys/arch/ia64/ia64

2012-11-05 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Nov  5 15:13:04 UTC 2012

Modified Files:
src/sys/arch/ia64/ia64: machdep.c

Log Message:
add a stub cpu_mcontext_validate().


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/ia64/ia64/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/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.32 src/sys/arch/ia64/ia64/machdep.c:1.33
--- src/sys/arch/ia64/ia64/machdep.c:1.32	Sat Jul 28 19:08:24 2012
+++ src/sys/arch/ia64/ia64/machdep.c	Mon Nov  5 15:13:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.32 2012/07/28 19:08:24 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.33 2012/11/05 15:13:04 chs Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -787,6 +787,12 @@ cpu_setmcontext(struct lwp *l, const mco
 }
 
 int
+cpu_mcontext_validate(struct lwp *l, const mcontext_t *mcp)
+{
+	return EINVAL;
+}
+
+int
 mm_md_physacc(paddr_t pa, vm_prot_t prot)
 {
 



CVS commit: src/sys/arch/ia64/ia64

2012-11-05 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Nov  5 15:14:34 UTC 2012

Modified Files:
src/sys/arch/ia64/ia64: syscall.c

Log Message:
add a cpu_spawn_return() that just calls userret().


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/ia64/syscall.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/ia64/ia64/syscall.c
diff -u src/sys/arch/ia64/ia64/syscall.c:1.5 src/sys/arch/ia64/ia64/syscall.c:1.6
--- src/sys/arch/ia64/ia64/syscall.c:1.5	Sat Jan 23 06:20:31 2010
+++ src/sys/arch/ia64/ia64/syscall.c	Mon Nov  5 15:14:34 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.5 2010/01/23 06:20:31 kiyohara Exp $ */
+/* $NetBSD: syscall.c,v 1.6 2012/11/05 15:14:34 chs Exp $ */
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -32,13 +32,14 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.5 2010/01/23 06:20:31 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.6 2012/11/05 15:14:34 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/proc.h
 
 #include machine/frame.h
+#include machine/userret.h
 
 void	syscall_intern(struct proc *);
 void	syscall_plain(struct lwp *, u_int64_t, struct trapframe *);
@@ -80,3 +81,13 @@ child_return(void *arg)
 printf(%s: not yet\n, __func__);
 	return;
 }
+
+/*
+ * Process the tail end of a posix_spawn() for the child.
+ */
+void
+cpu_spawn_return(struct lwp *l)
+{
+
+	userret(l);
+}



CVS commit: src/sys/arch/ia64/ia64

2012-10-27 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Oct 27 17:29:03 UTC 2012

Modified Files:
src/sys/arch/ia64/ia64: sapic.c

Log Message:
malloc - kmem_zalloc.  this also fixes a build error.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/ia64/ia64/sapic.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/ia64/ia64/sapic.c
diff -u src/sys/arch/ia64/ia64/sapic.c:1.1 src/sys/arch/ia64/ia64/sapic.c:1.2
--- src/sys/arch/ia64/ia64/sapic.c:1.1	Mon Jul 20 04:41:36 2009
+++ src/sys/arch/ia64/ia64/sapic.c	Sat Oct 27 17:29:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sapic.c,v 1.1 2009/07/20 04:41:36 kiyohara Exp $	*/
+/*	$NetBSD: sapic.c,v 1.2 2012/10/27 17:29:03 chs Exp $	*/
 /*-
  * Copyright (c) 2001 Doug Rabson
  * All rights reserved.
@@ -30,7 +30,7 @@
 #include opt_ddb.h
 
 #include sys/param.h
-#include sys/malloc.h
+#include sys/kmem.h
 #include sys/kernel.h
 #include sys/systm.h
 #include sys/bus.h
@@ -44,8 +44,6 @@
 #include machine/sapicvar.h
 
 
-static MALLOC_DEFINE(M_SAPIC, sapic, I/O SAPIC devices);
-
 struct sapic *ia64_sapics[16]; /* XXX make this resizable */
 static int ia64_sapic_count;
 
@@ -146,7 +144,7 @@ sapic_create(u_int id, u_int base, uint6
 	struct sapic *sa;
 	u_int i;
 
-	sa = malloc(sizeof(struct sapic), M_SAPIC, M_ZERO | M_NOWAIT);
+	sa = kmem_zalloc(sizeof(struct sapic), KM_NOSLEEP);
 	if (sa == NULL)
 		return NULL;
 



CVS commit: src/sys/arch/ia64/ia64

2012-08-31 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Aug 31 14:31:46 UTC 2012

Modified Files:
src/sys/arch/ia64/ia64: pmap.c

Log Message:
fix some confusion about PG_FAKE.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/ia64/ia64/pmap.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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.27 src/sys/arch/ia64/ia64/pmap.c:1.28
--- src/sys/arch/ia64/ia64/pmap.c:1.27	Fri Nov 12 07:59:26 2010
+++ src/sys/arch/ia64/ia64/pmap.c	Fri Aug 31 14:31:46 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.27 2010/11/12 07:59:26 uebayasi Exp $ */
+/* $NetBSD: pmap.c,v 1.28 2012/08/31 14:31:46 chs Exp $ */
 
 
 /*-
@@ -85,7 +85,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.27 2010/11/12 07:59:26 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.28 2012/08/31 14:31:46 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1239,9 +1239,6 @@ pmap_clear_modify(struct vm_page *pg)
 	pmap_t oldpmap;
 	pv_entry_t pv;
 
-	if (pg-flags  PG_FAKE)
-		return rv;
-
 	TAILQ_FOREACH(pv, md-pv_list, pv_list) {
 		PMAP_LOCK(pv-pv_pmap);
 		oldpmap = pmap_install(pv-pv_pmap);
@@ -1448,7 +1445,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
  * Enter on the PV list if part of our managed memory.
  */
 
-if ((flags  (PG_FAKE)) == 0) {
+if (pg != NULL) {
 pmap_insert_entry(pmap, va, pg);
 managed = true;
 }
@@ -1478,7 +1475,7 @@ validate:
 
 
 /*
- *	Routine:	pmap_page_purge: = was: pmap_remove_all
+ *	Routine:	pmap_page_purge
  *	Function:
  *		Removes this physical page from
  *		all physical maps in which it resides.
@@ -1497,15 +1494,6 @@ pmap_page_purge(struct vm_page *pg)
 	pmap_t oldpmap;
 	pv_entry_t pv;
 
-#if defined(DIAGNOSTIC)
-	/*
-	 * XXX this makes pmap_page_protect(NONE) illegal for non-managed
-	 * pages!
-	 */
-	if (pg-flags  PG_FAKE) {
-		panic(pmap_page_protect: illegal for unmanaged page, va: 0x%lx, VM_PAGE_TO_PHYS(pg));
-	}
-#endif
 	//UVM_LOCK_ASSERT_PAGEQ();
 
 	while ((pv = TAILQ_FIRST(md-pv_list)) != NULL) {



CVS commit: src/sys/arch/ia64/ia64

2012-06-17 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Jun 18 01:40:55 UTC 2012

Modified Files:
src/sys/arch/ia64/ia64: consinit.c

Log Message:
Fix build failed.  s/consinit()/consinit(void)/.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/ia64/ia64/consinit.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/ia64/ia64/consinit.c
diff -u src/sys/arch/ia64/ia64/consinit.c:1.1 src/sys/arch/ia64/ia64/consinit.c:1.2
--- src/sys/arch/ia64/ia64/consinit.c:1.1	Mon Jul 20 04:41:36 2009
+++ src/sys/arch/ia64/ia64/consinit.c	Mon Jun 18 01:40:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: consinit.c,v 1.1 2009/07/20 04:41:36 kiyohara Exp $	*/
+/*	$NetBSD: consinit.c,v 1.2 2012/06/18 01:40:55 kiyohara Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: consinit.c,v 1.1 2009/07/20 04:41:36 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: consinit.c,v 1.2 2012/06/18 01:40:55 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -67,7 +67,7 @@ struct consdev constab[] = {
 
 
 void
-consinit()
+consinit(void)
 {
 
 	cninit();



CVS commit: src/sys/arch/ia64/ia64

2010-10-30 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sat Oct 30 17:27:17 UTC 2010

Modified Files:
src/sys/arch/ia64/ia64: pmap.c

Log Message:
Use VM_PAGE_TO_MD() to locate struct vm_page_md.  No functional
changes.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/ia64/ia64/pmap.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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.24 src/sys/arch/ia64/ia64/pmap.c:1.25
--- src/sys/arch/ia64/ia64/pmap.c:1.24	Sat Nov  7 07:27:44 2009
+++ src/sys/arch/ia64/ia64/pmap.c	Sat Oct 30 17:27:17 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.24 2009/11/07 07:27:44 cegger Exp $ */
+/* $NetBSD: pmap.c,v 1.25 2010/10/30 17:27:17 uebayasi Exp $ */
 
 
 /*-
@@ -85,7 +85,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.24 2009/11/07 07:27:44 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.25 2010/10/30 17:27:17 uebayasi Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -102,6 +102,8 @@
 #include machine/cpufunc.h
 #include machine/md_var.h
 
+#define	VM_PAGE_TO_MD(pg)	((pg)-mdpage)
+
 
 /*
  * Kernel virtual memory management.
@@ -1233,6 +1235,7 @@
 bool
 pmap_clear_modify(struct vm_page *pg)
 {
+	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
 	bool rv = false;
 	struct ia64_lpte *pte;
 	pmap_t oldpmap;
@@ -1241,7 +1244,7 @@
 	if (pg-flags  PG_FAKE)
 		return rv;
 
-	TAILQ_FOREACH(pv, pg-mdpage.pv_list, pv_list) {
+	TAILQ_FOREACH(pv, md-pv_list, pv_list) {
 		PMAP_LOCK(pv-pv_pmap);
 		oldpmap = pmap_install(pv-pv_pmap);
 		pte = pmap_find_vhpt(pv-pv_va);
@@ -1266,6 +1269,7 @@
 void
 pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
 {
+	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
 struct ia64_lpte *pte;
 pmap_t oldpmap, pmap;
 pv_entry_t pv;
@@ -1275,7 +1279,7 @@
 if (prot  (VM_PROT_READ | VM_PROT_EXECUTE)) {
 if (pg-flags  PG_RDONLY)
 return;
-TAILQ_FOREACH(pv, pg-mdpage.pv_list, pv_list) {
+TAILQ_FOREACH(pv, md-pv_list, pv_list) {
 pmap = pv-pv_pmap;
 PMAP_LOCK(pmap);
 oldpmap = pmap_install(pmap);
@@ -1489,8 +1493,9 @@
  */
 
 void
-pmap_page_purge(struct vm_page * pg)
+pmap_page_purge(struct vm_page *pg)
 {
+	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
 	pmap_t oldpmap;
 	pv_entry_t pv;
 
@@ -1505,7 +1510,7 @@
 #endif
 	//UVM_LOCK_ASSERT_PAGEQ();
 
-	while ((pv = TAILQ_FIRST(pg-mdpage.pv_list)) != NULL) {
+	while ((pv = TAILQ_FIRST(md-pv_list)) != NULL) {
 		struct ia64_lpte *pte;
 		pmap_t pmap = pv-pv_pmap;
 		vaddr_t va = pv-pv_va;
@@ -1972,11 +1977,13 @@
  * Remove an entry from the list of managed mappings.
  */
 static int
-pmap_remove_entry(pmap_t pmap, struct vm_page * pg, vaddr_t va, pv_entry_t pv)
+pmap_remove_entry(pmap_t pmap, struct vm_page *pg, vaddr_t va, pv_entry_t pv)
 {
+	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
+
 	if (!pv) {
-		if (pg-mdpage.pv_list_count  pmap-pm_stats.resident_count) {
-			TAILQ_FOREACH(pv, pg-mdpage.pv_list, pv_list) {
+		if (md-pv_list_count  pmap-pm_stats.resident_count) {
+			TAILQ_FOREACH(pv, md-pv_list, pv_list) {
 if (pmap == pv-pv_pmap  va == pv-pv_va) 
 	break;
 			}
@@ -1989,9 +1996,9 @@
 	}
 
 	if (pv) {
-		TAILQ_REMOVE(pg-mdpage.pv_list, pv, pv_list);
-		pg-mdpage.pv_list_count--;
-		if (TAILQ_FIRST(pg-mdpage.pv_list) == NULL) {
+		TAILQ_REMOVE(md-pv_list, pv, pv_list);
+		md-pv_list_count--;
+		if (TAILQ_FIRST(md-pv_list) == NULL) {
 			//UVM_LOCK_ASSERT_PAGEQ(); 
 			pg-flags |= PG_RDONLY;
 		}
@@ -2012,6 +2019,7 @@
 static void
 pmap_insert_entry(pmap_t pmap, vaddr_t va, struct vm_page *pg)
 {
+	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
 	pv_entry_t pv;
 
 	pv = get_pv_entry(pmap);
@@ -2021,8 +2029,8 @@
 	//LOCK_ASSERT(simple_lock_held(pmap-slock));
 	//UVM_LOCK_ASSERT_PAGEQ(); 
 	TAILQ_INSERT_TAIL(pmap-pm_pvlist, pv, pv_plist);
-	TAILQ_INSERT_TAIL(pg-mdpage.pv_list, pv, pv_list);
-	pg-mdpage.pv_list_count++;
+	TAILQ_INSERT_TAIL(md-pv_list, pv, pv_list);
+	md-pv_list_count++;
 }
 
 
@@ -2092,13 +2100,14 @@
 		pa = VM_PAGE_TO_PHYS(pg);
 
 #ifdef DEBUG
-		mutex_enter(pg-mdpage.pv_mutex);
+		struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
+		mutex_enter(md-pv_mutex);
 		if (pg-wire_count != 0) {
 			printf(pmap_physpage_alloc: page 0x%lx has 
 			%d references\n, pa, pg-wire_count);
 			panic(pmap_physpage_alloc);
 		}
-		mutex_exit(pg-mdpage.pv_mutex);
+		mutex_exit(md-pv_mutex);
 #endif
 		*pap = pa;
 		return true;
@@ -2120,10 +2129,11 @@
 		panic(pmap_physpage_free: bogus physical page address);
 
 #ifdef DEBUG
-	mutex_enter(pg-mdpage.pv_mutex);
+	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
+	mutex_enter(md-pv_mutex);
 	if (pg-wire_count != 0)
 		panic(pmap_physpage_free: page still has references);
-	

CVS commit: src/sys/arch/ia64/ia64

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:18:58 UTC 2010

Modified Files:
src/sys/arch/ia64/ia64: support.S

Log Message:
fix copy{in,out}{,str}() to return the error returned by uvm_fault().
part of PR 41813 that I missed earlier.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/ia64/support.S

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/ia64/ia64/support.S
diff -u src/sys/arch/ia64/ia64/support.S:1.5 src/sys/arch/ia64/ia64/support.S:1.6
--- src/sys/arch/ia64/ia64/support.S:1.5	Fri Nov 27 03:23:10 2009
+++ src/sys/arch/ia64/ia64/support.S	Sun Aug  8 18:18:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: support.S,v 1.5 2009/11/27 03:23:10 rmind Exp $	*/
+/*	$NetBSD: support.S,v 1.6 2010/08/08 18:18:58 chs Exp $	*/
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -57,7 +57,6 @@
 
 #include machine/asm.h
 #include machine/ia64_cpu.h
-#include machine/vmparam.h
 
 #include assym.h
 
@@ -708,7 +707,7 @@
 	;;
 	cmp.geu	p6,p0=in0,loc2			// is in user space.
 	;;
-(p6)	br.cond.spnt.few copyerr		// if it's not, error out.
+(p6)	br.cond.spnt.few copyefault		// if it's not, error out.
 	movl	r14=copyerr			// set up fault handler.
 	add	r15=PC_CURLWP,r13		// find curthread
 	;;
@@ -747,7 +746,7 @@
 	;;
 	cmp.geu	p6,p0=in1,loc2			// is in user space.
 	;;
-(p6)	br.cond.spnt.few copyerr		// if it's not, error out.
+(p6)	br.cond.spnt.few copyefault		// if it's not, error out.
 	movl	r14=copyerr			// set up fault handler.
 	add	r15=PC_CURLWP,r13		// find curthread
 	;;
@@ -898,7 +897,7 @@
 	;;
 	cmp.geu	p6,p0=in0,loc2			// is in user space.
 	;;
-(p6)	br.cond.spnt.few copyerr		// if it's not, error out.
+(p6)	br.cond.spnt.few copyefault		// if it's not, error out.
 	movl	r14=copyerr			// set up fault handler.
 	add	r15=PC_CURLWP,r13		// find curthread
 	;;
@@ -936,7 +935,7 @@
 	;;
 	cmp.geu	p6,p0=in1,loc2			// is in user space.
 	;;
-(p6)	br.cond.spnt.few copyerr		// if it's not, error out.
+(p6)	br.cond.spnt.few copyefault		// if it's not, error out.
 	movl	r14=copyerr			// set up fault handler.
 	add	r15=PC_CURLWP,r13		// find curthread
 	;;
@@ -969,10 +968,21 @@
 	add	r14=PCB_ONFAULT,r14 ;;		// curthread-td_pcb-pcb_onfault
 	st8	[r14]=r0			// reset fault handler
 
-	mov	ret0=EFAULT			// return EFAULT
 	br.ret.sptk.few rp
 END(copyerr)
 
+ENTRY(copyefault, 0)
+	add	r14=PC_CURLWP,r13 ;;		// find curthread
+	ld8	r14=[r14] ;;
+	add	r14=L_PCB,r14 ;;		// curthread-td_addr
+	ld8	r14=[r14] ;;
+	add	r14=PCB_ONFAULT,r14 ;;		// curthread-td_pcb-pcb_onfault
+	st8	[r14]=r0			// reset fault handler
+
+	mov	ret0=EFAULT			// return EFAULT
+	br.ret.sptk.few rp
+END(copyefault)
+
 #if defined(GPROF)
 /*
  * Important registers:



CVS commit: src/sys/arch/ia64/ia64

2010-06-28 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Jun 28 12:08:13 UTC 2010

Modified Files:
src/sys/arch/ia64/ia64: cpu.c machdep.c

Log Message:
Move identifycpu() into cpu.c.  Our cpu* says:
  cpu0 at mainbus0: ProcessorID 0, Id 0, Eid 0
  cpu0: McKinley (1000.00-MHz Itanium 2)
  cpu0: Origin GenuineIntel,  Revision 7
  cpu0: Features 0x1


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/ia64/cpu.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/ia64/ia64/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/ia64/ia64/cpu.c
diff -u src/sys/arch/ia64/ia64/cpu.c:1.8 src/sys/arch/ia64/ia64/cpu.c:1.9
--- src/sys/arch/ia64/ia64/cpu.c:1.8	Mon May 17 11:46:19 2010
+++ src/sys/arch/ia64/ia64/cpu.c	Mon Jun 28 12:08:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.8 2010/05/17 11:46:19 kiyohara Exp $	*/
+/*	$NetBSD: cpu.c,v 1.9 2010/06/28 12:08:13 kiyohara Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.8 2010/05/17 11:46:19 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.9 2010/06/28 12:08:13 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -41,17 +41,23 @@
 #include dev/acpi/acpica.h
 #include dev/acpi/acpivar.h
 
+#define MHz	100L
+#define GHz	(1000L * MHz)
 
 struct cpu_info cpu_info_primary __aligned(CACHE_LINE_SIZE);
 
-static int cpu_match(device_t, cfdata_t, void *);
-static void cpu_attach(device_t, device_t, void *);
-
 struct cpu_softc {
 	device_t sc_dev;		/* device tree glue */
 	struct cpu_info *sc_info;	/* pointer to CPU info */
 };
 
+char cpu_model[64];
+
+static int cpu_match(device_t, cfdata_t, void *);
+static void cpu_attach(device_t, device_t, void *);
+
+static void identifycpu(struct cpu_softc *);
+
 CFATTACH_DECL_NEW(cpu, sizeof(struct cpu_softc),
 cpu_match, cpu_attach, NULL, NULL);
 
@@ -98,5 +104,79 @@
 	ci-ci_intrdepth = -1;			/* need ? */
 	ci-ci_dev = self;
 
+	identifycpu(sc);
+
 	return;
 }
+
+
+static void
+identifycpu(struct cpu_softc *sc)
+{
+	uint64_t vendor[3];
+	const char *family_name, *model_name;
+	uint64_t features, tmp;
+	int number, revision, model, family, archrev;
+	extern uint64_t processor_frequency;
+
+	/*
+	 * Assumes little-endian.
+	 */
+	vendor[0] = ia64_get_cpuid(0);
+	vendor[1] = ia64_get_cpuid(1);
+	vendor[2] = '\0';
+
+	tmp = ia64_get_cpuid(3);
+	number = (tmp  0)  0xff;
+	revision = (tmp  8)  0xff;
+	model = (tmp  16)  0xff;
+	family = (tmp  24)  0xff;
+	archrev = (tmp  32)  0xff;
+
+	family_name = model_name = unknown;
+	switch (family) {
+	case 0x07:
+		family_name = Itanium;
+		model_name = Merced;
+		break;
+	case 0x1f:
+		family_name = Itanium 2;
+		switch (model) {
+		case 0x00:
+			model_name = McKinley;
+			break;
+		case 0x01:
+			/*
+			 * Deerfield is a low-voltage variant based on the
+			 * Madison core. We need circumstantial evidence
+			 * (i.e. the clock frequency) to identify those.
+			 * Allow for roughly 1% error margin.
+			 */
+			tmp = processor_frequency  7;
+			if ((processor_frequency - tmp)  1*GHz 
+			(processor_frequency + tmp) = 1*GHz)
+model_name = Deerfield;
+			else
+model_name = Madison;
+			break;
+		case 0x02:
+			model_name = Madison II;
+			break;
+		}
+		break;
+	}
+	snprintf(cpu_model, sizeof(cpu_model), %s, model_name);
+
+	features = ia64_get_cpuid(4);
+
+	aprint_normal_dev(sc-sc_dev, %s (, model_name);
+	if (processor_frequency) {
+		aprint_normal(%ld.%02ld-MHz ,
+		(processor_frequency + 4999) / MHz,
+		((processor_frequency + 4999) / (MHz/100)) % 100);
+	}
+	aprint_normal(%s)\n, family_name);
+	aprint_normal_dev(sc-sc_dev, Origin \%s\,  Revision %d\n,
+	(char *)vendor, revision);
+	aprint_normal_dev(sc-sc_dev, Features 0x%x\n, (uint32_t)features);
+}

Index: src/sys/arch/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.23 src/sys/arch/ia64/ia64/machdep.c:1.24
--- src/sys/arch/ia64/ia64/machdep.c:1.23	Mon Feb  8 19:02:29 2010
+++ src/sys/arch/ia64/ia64/machdep.c	Mon Jun 28 12:08:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.23 2010/02/08 19:02:29 joerg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.24 2010/06/28 12:08:13 kiyohara Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -133,10 +133,7 @@
 struct vm_map *phys_map = NULL;
 
 void *msgbufaddr;
-int	physmem;
-
-char	cpu_model[64];
-char	cpu_family[64];
+int physmem;
 
 vaddr_t kernstart, kernend;
 
@@ -159,78 +156,6 @@
 
 struct fpswa_iface *fpswa_iface;
 
-#define Mhz 100L
-#define Ghz (1000L*Mhz)
-
-static void
-identifycpu(void)
-{
-	uint64_t vendor[3];
-	const char *family_name, *model_name;
-	uint64_t features, tmp;
-	int number, revision, model, family, archrev;
-
-	/*
-	 * Assumes little-endian.
-	 */
-	vendor[0] = ia64_get_cpuid(0);
-	vendor[1] = ia64_get_cpuid(1);
-	vendor[2] = '\0';
-
-	tmp = ia64_get_cpuid(3);

CVS commit: src/sys/arch/ia64/ia64

2010-05-17 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon May 17 11:46:19 UTC 2010

Modified Files:
src/sys/arch/ia64/ia64: cpu.c mainbus.c

Log Message:
Attach CPU only of the pretense.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/ia64/cpu.c \
src/sys/arch/ia64/ia64/mainbus.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/ia64/ia64/cpu.c
diff -u src/sys/arch/ia64/ia64/cpu.c:1.7 src/sys/arch/ia64/ia64/cpu.c:1.8
--- src/sys/arch/ia64/ia64/cpu.c:1.7	Sat Nov 21 15:36:34 2009
+++ src/sys/arch/ia64/ia64/cpu.c	Mon May 17 11:46:19 2010
@@ -1,11 +1,11 @@
-/*	$NetBSD: cpu.c,v 1.7 2009/11/21 15:36:34 rmind Exp $	*/
+/*	$NetBSD: cpu.c,v 1.8 2010/05/17 11:46:19 kiyohara Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  *
- * Author: 
+ * Author:
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,18 +30,22 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.7 2009/11/21 15:36:34 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.8 2010/05/17 11:46:19 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/proc.h
 #include sys/systm.h
 #include sys/device.h
-#include sys/malloc.h
+#include sys/kmem.h
 
-struct cpu_info cpu_info_primary;
+#include dev/acpi/acpica.h
+#include dev/acpi/acpivar.h
 
-int cpu_match(device_t, cfdata_t, void *);
-voidcpu_attach(device_t, device_t, void *);
+
+struct cpu_info cpu_info_primary __aligned(CACHE_LINE_SIZE);
+
+static int cpu_match(device_t, cfdata_t, void *);
+static void cpu_attach(device_t, device_t, void *);
 
 struct cpu_softc {
 	device_t sc_dev;		/* device tree glue */
@@ -52,20 +56,47 @@
 cpu_match, cpu_attach, NULL, NULL);
 
 
-int
+static int
 cpu_match(device_t parent, cfdata_t match, void *aux)
 {
+
 	return 1;
 }
 
-void
+static void
 cpu_attach(device_t parent, device_t self, void *aux)
 {
+	struct cpu_softc *sc = device_private(self);
+	ACPI_MADT_LOCAL_SAPIC *sapic = (ACPI_MADT_LOCAL_SAPIC *)aux;
+	struct cpu_info *ci;
+	uint64_t lid;
+	int id, eid;
+
+	aprint_naive(\n);
+	aprint_normal(: ProcessorID %d, Id %d, Eid %d%s\n,
+	sapic-ProcessorId, sapic-Id, sapic-Eid,
+	sapic-LapicFlags  ACPI_MADT_ENABLED ?  :  (disabled));
+
+	/* Get current CPU Id */
+	lid = ia64_get_lid();
+	id = (lid  0xff00)  24;
+	eid = (lid  0x00ff)  16;
+
+	sc-sc_dev = self;
+	if (id == sapic-Id  eid == sapic-Eid)
+		ci = curcpu();
+	else {
+		ci = (struct cpu_info *)kmem_zalloc(sizeof(*ci), KM_NOSLEEP);
+		if (ci == NULL) {
+			aprint_error_dev(self, memory alloc failed\n);
+			return;
+		}
+	}
+	sc-sc_info = ci;
 
-#if 0	/* not yet */
-	ci-ci_cpuid = id;
-	ci-ci_intrdepth = -1;	/* need ? */
+	ci-ci_cpuid = sapic-ProcessorId;
+	ci-ci_intrdepth = -1;			/* need ? */
 	ci-ci_dev = self;
-#endif
+
 	return;
 }
Index: src/sys/arch/ia64/ia64/mainbus.c
diff -u src/sys/arch/ia64/ia64/mainbus.c:1.7 src/sys/arch/ia64/ia64/mainbus.c:1.8
--- src/sys/arch/ia64/ia64/mainbus.c:1.7	Sat Jan 23 06:13:20 2010
+++ src/sys/arch/ia64/ia64/mainbus.c	Mon May 17 11:46:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.7 2010/01/23 06:13:20 kiyohara Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.8 2010/05/17 11:46:19 kiyohara Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.7 2010/01/23 06:13:20 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.8 2010/05/17 11:46:19 kiyohara Exp $);
 
 #include acpica.h
 
@@ -37,17 +37,15 @@
 #include sys/device.h
 #include sys/errno.h
 
-#if NACPICA  0
+#include dev/acpi/acpica.h
 #include dev/acpi/acpivar.h
-#endif
+#include actables.h
 
 
 static int mainbus_match(device_t, cfdata_t, void *);
 static void mainbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(mainbus,
-/*sizeof(struct device): X It doesn't use it now*/ 0,
-mainbus_match, mainbus_attach, NULL, NULL);
+CFATTACH_DECL_NEW(mainbus, 0, mainbus_match, mainbus_attach, NULL, NULL);
 
 
 /*
@@ -69,10 +67,52 @@
 #if NACPICA  0
 	struct acpibus_attach_args aaa;
 #endif
+	ACPI_PHYSICAL_ADDRESS rsdp_ptr;
+	ACPI_MADT_LOCAL_SAPIC *entry;
+	ACPI_TABLE_MADT *table;
+	ACPI_TABLE_RSDP *rsdp;
+	ACPI_TABLE_XSDT *xsdt;
+	char *end, *p;
+	int tables, i;
 
 	aprint_naive(\n);
 	aprint_normal(\n);
 
+	if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
+		panic(cpu not found);
+
+	rsdp = (ACPI_TABLE_RSDP *)IA64_PHYS_TO_RR7(rsdp_ptr);
+	xsdt = (ACPI_TABLE_XSDT *)IA64_PHYS_TO_RR7(rsdp-XsdtPhysicalAddress);
+
+	tables = (UINT64 *)((char *)xsdt + xsdt-Header.Length) -
+	xsdt-TableOffsetEntry;
+
+	for (i = 0; i  tables; i++) {
+		int len;
+		char *sig;
+
+		table = (ACPI_TABLE_MADT *)
+		IA64_PHYS_TO_RR7(xsdt-TableOffsetEntry[i]);
+
+		sig = 

CVS commit: src/sys/arch/ia64/ia64

2010-01-22 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan 23 06:13:20 UTC 2010

Modified Files:
src/sys/arch/ia64/ia64: mainbus.c

Log Message:
Switch to ACPICA 20090730, and update for API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/ia64/mainbus.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/ia64/ia64/mainbus.c
diff -u src/sys/arch/ia64/ia64/mainbus.c:1.6 src/sys/arch/ia64/ia64/mainbus.c:1.7
--- src/sys/arch/ia64/ia64/mainbus.c:1.6	Mon Jul 20 06:12:41 2009
+++ src/sys/arch/ia64/ia64/mainbus.c	Sat Jan 23 06:13:20 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.6 2009/07/20 06:12:41 kiyohara Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.7 2010/01/23 06:13:20 kiyohara Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -29,15 +29,17 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.6 2009/07/20 06:12:41 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.7 2010/01/23 06:13:20 kiyohara Exp $);
 
-#include acpi.h
+#include acpica.h
 
 #include sys/param.h
 #include sys/device.h
 #include sys/errno.h
 
+#if NACPICA  0
 #include dev/acpi/acpivar.h
+#endif
 
 
 static int mainbus_match(device_t, cfdata_t, void *);
@@ -64,14 +66,14 @@
 static void
 mainbus_attach(device_t parent, device_t self, void *aux)
 {
-#if NACPI  0
+#if NACPICA  0
 	struct acpibus_attach_args aaa;
 #endif
 
 	aprint_naive(\n);
 	aprint_normal(\n);
 
-#if NACPI  0
+#if NACPICA  0
 	acpi_probe();
 
 	aaa.aa_iot = IA64_BUS_SPACE_IO;



CVS commit: src/sys/arch/ia64/ia64

2010-01-22 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan 23 06:20:32 UTC 2010

Modified Files:
src/sys/arch/ia64/ia64: syscall.c

Log Message:
Initialize md_syscall in syscall_intern().  But the md_syscall of ia64 not
support yet.
And remove white-space.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/ia64/syscall.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/ia64/ia64/syscall.c
diff -u src/sys/arch/ia64/ia64/syscall.c:1.4 src/sys/arch/ia64/ia64/syscall.c:1.5
--- src/sys/arch/ia64/ia64/syscall.c:1.4	Mon Jul 20 04:41:37 2009
+++ src/sys/arch/ia64/ia64/syscall.c	Sat Jan 23 06:20:31 2010
@@ -1,11 +1,11 @@
-/* $NetBSD: syscall.c,v 1.4 2009/07/20 04:41:37 kiyohara Exp $ */
+/* $NetBSD: syscall.c,v 1.5 2010/01/23 06:20:31 kiyohara Exp $ */
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  *
- * Author: 
+ * Author:
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.4 2009/07/20 04:41:37 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.5 2010/01/23 06:20:31 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -47,8 +47,11 @@
 void
 syscall_intern(struct proc *p)
 {
-printf(%s: not yet\n, __func__);
-	return;
+
+	if (trace_is_enabled(p))
+		p-p_md.md_syscall = syscall_fancy;
+	else
+		p-p_md.md_syscall = syscall_plain;
 }
 
 /*



CVS commit: src/sys/arch/ia64/ia64

2009-08-23 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Sun Aug 23 16:15:45 UTC 2009

Modified Files:
src/sys/arch/ia64/ia64: machdep.c

Log Message:
Typo fix: Mhz - MHz

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/ia64/ia64/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/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.16 src/sys/arch/ia64/ia64/machdep.c:1.17
--- src/sys/arch/ia64/ia64/machdep.c:1.16	Mon Jul 20 05:10:49 2009
+++ src/sys/arch/ia64/ia64/machdep.c	Sun Aug 23 16:15:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.16 2009/07/20 05:10:49 kiyohara Exp $	*/
+/*	$NetBSD: machdep.c,v 1.17 2009/08/23 16:15:45 ahoka Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -227,7 +227,7 @@
 
 	printf(CPU: %s (, model_name);
 	if (processor_frequency) {
-		printf(%ld.%02ld-Mhz , (processor_frequency + 4999) / Mhz,
+		printf(%ld.%02ld-MHz , (processor_frequency + 4999) / Mhz,
 		((processor_frequency + 4999) / (Mhz/100)) % 100);
 	}
 	printf(%s)\n, family_name);



CVS commit: src/sys/arch/ia64/ia64

2009-07-19 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Jul 20 05:10:49 UTC 2009

Modified Files:
src/sys/arch/ia64/ia64: machdep.c mainbus.c

Log Message:
Fix little bit, and add a few files.
  current status is to see following thread.
http://mail-index.netbsd.org/port-ia64/2009/06/18/msg000102.html
Also call banner().


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/ia64/ia64/machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/ia64/mainbus.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/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.15 src/sys/arch/ia64/ia64/machdep.c:1.16
--- src/sys/arch/ia64/ia64/machdep.c:1.15	Wed Mar 18 16:00:12 2009
+++ src/sys/arch/ia64/ia64/machdep.c	Mon Jul 20 05:10:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.15 2009/03/18 16:00:12 cegger Exp $	*/
+/*	$NetBSD: machdep.c,v 1.16 2009/07/20 05:10:49 kiyohara Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -62,17 +62,17 @@
  * All rights reserved.
  *
  * Author: Chris G. Demetriou
- * 
+ *
  * Permission to use, copy, modify and distribute this software and
  * its documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
  * software, derivative works or modified versions, and any portions
  * thereof, and that both notices appear in supporting documentation.
- * 
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS AS IS 
- * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS AS IS
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- * 
+ *
  * Carnegie Mellon requests users of this software to return to
  *
  *  Software Distribution Coordinator  or  software.distribut...@cs.cmu.edu
@@ -89,7 +89,7 @@
 
 #include opt_modular.h
 
-#include sys/param.h 
+#include sys/param.h
 #include sys/cpu.h
 #include sys/exec.h
 #include sys/ksyms.h
@@ -151,9 +151,9 @@
 uint64_t ia64_port_base;
 
 
-extern u_int64_t ia64_gateway_page[];
+extern uint64_t ia64_gateway_page[];
 
-u_int64_t pa_bootinfo;
+uint64_t pa_bootinfo;
 struct bootinfo bootinfo;
 
 
@@ -168,72 +168,71 @@
 
 static void
 identifycpu(void)
-{   
-u_int64_t vendor[3];
-const char *family_name, *model_name;
-u_int64_t features, tmp;
-int number, revision, model, family, archrev;
-
-/*  
- * Assumes little-endian.
- */
+{
+	uint64_t vendor[3];
+	const char *family_name, *model_name;
+	uint64_t features, tmp;
+	int number, revision, model, family, archrev;
+
+	/*
+	 * Assumes little-endian.
+	 */
 	vendor[0] = ia64_get_cpuid(0);
-	vendor[1] = ia64_get_cpuid(1); 
-	vendor[2] = '\0'; 
-
-tmp = ia64_get_cpuid(3);
-number = (tmp  0)  0xff;
-revision = (tmp  8)  0xff;
-model = (tmp  16)  0xff;
-family = (tmp  24)  0xff;
-archrev = (tmp  32)  0xff;
-
-family_name = model_name = unknown;
-switch (family) {
-case 0x07:
-family_name = Itanium;
-model_name = Merced;
-break;
-case 0x1f:
-family_name = Itanium 2;
-switch (model) {
-case 0x00:
-model_name = McKinley;
-break;
-case 0x01:
-/*
- * Deerfield is a low-voltage variant based on the
- * Madison core. We need circumstantial evidence
- * (i.e. the clock frequency) to identify those.
- * Allow for roughly 1% error margin.
- */ 
-tmp = processor_frequency  7; 
-if ((processor_frequency - tmp)  1*Ghz 
-(processor_frequency + tmp) = 1*Ghz)
-model_name = Deerfield;
-else
-model_name = Madison;
-break;
-case 0x02:
-model_name = Madison II;
-break;
-}
-break;
-}
-snprintf(cpu_family, sizeof(cpu_family), %s, family_name);
-snprintf(cpu_model, sizeof(cpu_model), %s, model_name);
-
-features = ia64_get_cpuid(4);
-
-printf(CPU: %s (, model_name);
-if (processor_frequency) {
-printf(%ld.%02ld-Mhz , 
-(processor_frequency + 4999) / Mhz,
-((processor_frequency + 4999) / (Mhz/100)) % 100);
-}
-