14726dd60SMichal Simek /* SPDX-License-Identifier: GPL-2.0 */ 24511ec15SMichal Simek /* 35233806dSMichal Simek * Copyright (C) 2008-2009 Michal Simek <[email protected]> 45233806dSMichal Simek * Copyright (C) 2008-2009 PetaLogix 54511ec15SMichal Simek * Copyright (C) 2006 Atmark Techno, Inc. 64511ec15SMichal Simek */ 74511ec15SMichal Simek 84511ec15SMichal Simek #ifndef _ASM_MICROBLAZE_PROCESSOR_H 94511ec15SMichal Simek #define _ASM_MICROBLAZE_PROCESSOR_H 104511ec15SMichal Simek 114511ec15SMichal Simek #include <asm/ptrace.h> 124511ec15SMichal Simek #include <asm/setup.h> 134511ec15SMichal Simek #include <asm/registers.h> 142921e2bdSMichal Simek #include <asm/entry.h> 152921e2bdSMichal Simek #include <asm/current.h> 164511ec15SMichal Simek 174511ec15SMichal Simek # ifndef __ASSEMBLY__ 184511ec15SMichal Simek /* from kernel/cpu/mb.c */ 194511ec15SMichal Simek extern const struct seq_operations cpuinfo_op; 204511ec15SMichal Simek 214511ec15SMichal Simek # define cpu_relax() barrier() 224511ec15SMichal Simek 232eba318eSMichal Simek #define task_pt_regs(tsk) \ 242eba318eSMichal Simek (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1) 252eba318eSMichal Simek 26e1c4bd08SMichal Simek /* Do necessary setup to start up a newly executed thread. */ 27e1c4bd08SMichal Simek void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp); 28e1c4bd08SMichal Simek 290dd90aa9SMichal Simek extern void ret_from_fork(void); 302319295dSAl Viro extern void ret_from_kernel_thread(void); 310dd90aa9SMichal Simek 325233806dSMichal Simek # endif /* __ASSEMBLY__ */ 335233806dSMichal Simek 345233806dSMichal Simek /* 355233806dSMichal Simek * This is used to define STACK_TOP, and with MMU it must be below 365233806dSMichal Simek * kernel base to select the correct PGD when handling MMU exceptions. 375233806dSMichal Simek */ 385233806dSMichal Simek # define TASK_SIZE (CONFIG_KERNEL_START) 395233806dSMichal Simek 405233806dSMichal Simek /* 415233806dSMichal Simek * This decides where the kernel will search for a free chunk of vm 425233806dSMichal Simek * space during mmap's. 435233806dSMichal Simek */ 445233806dSMichal Simek # define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3) 455233806dSMichal Simek 465233806dSMichal Simek # define THREAD_KSP 0 475233806dSMichal Simek 485233806dSMichal Simek # ifndef __ASSEMBLY__ 495233806dSMichal Simek 505233806dSMichal Simek /* If you change this, you must change the associated assembly-languages 515233806dSMichal Simek * constants defined below, THREAD_*. 525233806dSMichal Simek */ 535233806dSMichal Simek struct thread_struct { 545233806dSMichal Simek /* kernel stack pointer (must be first field in structure) */ 555233806dSMichal Simek unsigned long ksp; 565233806dSMichal Simek unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */ 575233806dSMichal Simek void *pgdir; /* root of page-table tree */ 585233806dSMichal Simek struct pt_regs *regs; /* Pointer to saved register state */ 595233806dSMichal Simek }; 605233806dSMichal Simek 615233806dSMichal Simek # define INIT_THREAD { \ 625233806dSMichal Simek .ksp = sizeof init_stack + (unsigned long)init_stack, \ 635233806dSMichal Simek .pgdir = swapper_pg_dir, \ 645233806dSMichal Simek } 655233806dSMichal Simek 66*42a20f86SKees Cook unsigned long __get_wchan(struct task_struct *p); 675233806dSMichal Simek 685233806dSMichal Simek /* The size allocated for kernel stacks. This _must_ be a power of two! */ 695233806dSMichal Simek # define KERNEL_STACK_SIZE 0x2000 705233806dSMichal Simek 715233806dSMichal Simek /* Return some info about the user process TASK. */ 725233806dSMichal Simek # define task_tos(task) ((unsigned long)(task) + KERNEL_STACK_SIZE) 735233806dSMichal Simek # define task_regs(task) ((struct pt_regs *)task_tos(task) - 1) 745233806dSMichal Simek 755233806dSMichal Simek # define task_pt_regs_plus_args(tsk) \ 766e83557cSMichal Simek ((void *)task_pt_regs(tsk)) 775233806dSMichal Simek 785233806dSMichal Simek # define task_sp(task) (task_regs(task)->r1) 795233806dSMichal Simek # define task_pc(task) (task_regs(task)->pc) 805233806dSMichal Simek /* Grotty old names for some. */ 815233806dSMichal Simek # define KSTK_EIP(task) (task_pc(task)) 825233806dSMichal Simek # define KSTK_ESP(task) (task_sp(task)) 835233806dSMichal Simek 845233806dSMichal Simek # define STACK_TOP TASK_SIZE 855233806dSMichal Simek # define STACK_TOP_MAX STACK_TOP 865233806dSMichal Simek 87c40d04dfSDavid Howells #ifdef CONFIG_DEBUG_FS 88c40d04dfSDavid Howells extern struct dentry *of_debugfs_root; 89c40d04dfSDavid Howells #endif 90c40d04dfSDavid Howells 915233806dSMichal Simek # endif /* __ASSEMBLY__ */ 924511ec15SMichal Simek #endif /* _ASM_MICROBLAZE_PROCESSOR_H */ 93