ARCv2: Support for ARCv2 ISA and HS38x cores
[deliverable/linux.git] / arch / arc / kernel / process.c
index f46efd14059d302712df70442604c19f1a8f2fe6..51560435a26bb26ac650d80626920720c82a3351 100644 (file)
@@ -44,12 +44,25 @@ SYSCALL_DEFINE0(arc_gettls)
 void arch_cpu_idle(void)
 {
        /* sleep, but enable all interrupts before committing */
-       __asm__("sleep 0x3");
+       if (is_isa_arcompact()) {
+               __asm__("sleep 0x3");
+       } else {
+               /* default irq priority (<=) which can interrupt the doze */
+               const int arg = 0x10 | ARCV2_IRQ_DEF_PRIO;
+
+               __asm__ __volatile__(
+               "sleep %0       \n"
+               :
+               :"r"(arg));
+       }
 }
 
 asmlinkage void ret_from_fork(void);
 
-/* Layout of Child kernel mode stack as setup at the end of this function is
+/*
+ * Copy architecture-specific thread state
+ *
+ * Layout of Child kernel mode stack as setup at the end of this function is
  *
  * |     ...        |
  * |     ...        |
@@ -81,7 +94,7 @@ asmlinkage void ret_from_fork(void);
  * ------------------  <===== END of PAGE
  */
 int copy_thread(unsigned long clone_flags,
-               unsigned long usp, unsigned long arg,
+               unsigned long usp, unsigned long kthread_arg,
                struct task_struct *p)
 {
        struct pt_regs *c_regs;        /* child's pt_regs */
@@ -112,7 +125,7 @@ int copy_thread(unsigned long clone_flags,
        if (unlikely(p->flags & PF_KTHREAD)) {
                memset(c_regs, 0, sizeof(struct pt_regs));
 
-               c_callee->r13 = arg; /* argument to kernel thread */
+               c_callee->r13 = kthread_arg;
                c_callee->r14 = usp;  /* function */
 
                return 0;
@@ -163,8 +176,7 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long usp)
         * [L] ZOL loop inhibited to begin with - cleared by a LP insn
         * Interrupts enabled
         */
-       regs->status32 = STATUS_U_MASK | STATUS_L_MASK |
-                        STATUS_E1_MASK | STATUS_E2_MASK;
+       regs->status32 = STATUS_U_MASK | STATUS_L_MASK | ISA_INIT_STATUS_BITS;
 
        /* bogus seed values for debugging */
        regs->lp_start = 0x10;
@@ -194,8 +206,11 @@ int elf_check_arch(const struct elf32_hdr *x)
 {
        unsigned int eflags;
 
-       if (x->e_machine != EM_ARCOMPACT)
+       if (x->e_machine != EM_ARC_INUSE) {
+               pr_err("ELF not built for %s ISA\n",
+                       is_isa_arcompact() ? "ARCompact":"ARCv2");
                return 0;
+       }
 
        eflags = x->e_flags;
        if ((eflags & EF_ARC_OSABI_MSK) < EF_ARC_OSABI_CURRENT) {
This page took 0.027431 seconds and 5 git commands to generate.