processor.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/include/asm-arm/proc-armv/processor.h
  3.  *
  4.  *  Copyright (C) 1996-1999 Russell King.
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License version 2 as
  8.  * published by the Free Software Foundation.
  9.  *
  10.  *  Changelog:
  11.  *   20-09-1996 RMK Created
  12.  *   26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*'
  13.  *   28-09-1996 RMK Moved start_thread into the processor dependencies
  14.  *   09-09-1998 PJB Delete redundant `wp_works_ok'
  15.  *   30-05-1999 PJB Save sl across context switches
  16.  *   31-07-1999 RMK Added 'domain' stuff
  17.  */
  18. #ifndef __ASM_PROC_PROCESSOR_H
  19. #define __ASM_PROC_PROCESSOR_H
  20. #include <asm/proc/domain.h>
  21. #define KERNEL_STACK_SIZE PAGE_SIZE
  22. struct context_save_struct {
  23. unsigned long cpsr;
  24. unsigned long r4;
  25. unsigned long r5;
  26. unsigned long r6;
  27. unsigned long r7;
  28. unsigned long r8;
  29. unsigned long r9;
  30. unsigned long sl;
  31. unsigned long fp;
  32. unsigned long pc;
  33. };
  34. #define INIT_CSS (struct context_save_struct){ SVC_MODE, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
  35. #define EXTRA_THREAD_STRUCT
  36. unsigned int domain;
  37. #define EXTRA_THREAD_STRUCT_INIT
  38. domain:   domain_val(DOMAIN_USER, DOMAIN_CLIENT) |
  39.   domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) |
  40.   domain_val(DOMAIN_IO, DOMAIN_CLIENT)
  41. #define start_thread(regs,pc,sp)
  42. ({
  43. unsigned long *stack = (unsigned long *)sp;
  44. set_fs(USER_DS);
  45. memzero(regs->uregs, sizeof(regs->uregs));
  46. if (current->personality & ADDR_LIMIT_32BIT)
  47. regs->ARM_cpsr = USR_MODE;
  48. else
  49. regs->ARM_cpsr = USR26_MODE;
  50. regs->ARM_pc = pc; /* pc */
  51. regs->ARM_sp = sp; /* sp */
  52. regs->ARM_r2 = stack[2]; /* r2 (envp) */
  53. regs->ARM_r1 = stack[1]; /* r1 (argv) */
  54. regs->ARM_r0 = stack[0]; /* r0 (argc) */
  55. })
  56. #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1021])
  57. #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019])
  58. /* Allocation and freeing of basic task resources. */
  59. /*
  60.  * NOTE! The task struct and the stack go together
  61.  */
  62. #define ll_alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
  63. #define ll_free_task_struct(p) free_pages((unsigned long)(p),1)
  64. #endif