source: rtems/doc/porting/cpuinit.t @ 5495124

4.104.114.84.95
Last change on this file since 5495124 was 9d7b376, checked in by Joel Sherrill <joel.sherrill@…>, on 10/06/99 at 19:54:41

Added copyrights and CVS Ids.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter CPU Initialization
10
11This section describes the general CPU and system initialization sequence
12as it pertains to the CPU dependent code.
13
14@section Introduction
15
16XXX general startup sequence description rewritten to make it more
17applicable to CPU depdent code in executive
18
19@section CPU Dependent Configuration Table
20
21The CPU Dependent Configuration Table contains information which tailors
22the behavior of RTEMS base Some of the fields in this table are required
23to be present in all ports of RTEMS.  These fields appear at the beginning
24of the data structure.  Fields past this point may be CPU family and CPU
25model dependent.  For example, a port may add a field to specify the
26default value for an interrupt mask register on the CPU.  This table is
27initialized by the Board Support Package and passed to the
28rtems_initialize_executive or rtems_initialize_executive_early directive.
29
30@example
31typedef struct @{
32  void       (*pretasking_hook)( void );
33  void       (*predriver_hook)( void );
34  void       (*postdriver_hook)( void );
35  void       (*idle_task)( void );
36  boolean      do_zero_of_workspace;
37  unsigned32   idle_task_stack_size;
38  unsigned32   interrupt_stack_size;
39  unsigned32   extra_mpci_receive_server_stack;
40  void *     (*stack_allocate_hook)( unsigned32 );
41  void       (*stack_free_hook)( void* );
42  /* end of fields required on all CPUs */
43
44  unsigned32   some_other_cpu_dependent_info;
45@}   rtems_cpu_table;
46@end example
47
48XXX copy the descriptions of the fields from another CPU supplement
49
50@section Initializing the CPU
51
52The _CPU_Initialize routine performs processor dependent initialization.
53
54@example
55void _CPU_Initialize(
56  rtems_cpu_table  *cpu_table,
57  void            (*thread_dispatch)  /* may be ignored */
58)
59@end example
60
61The thread_dispatch argument is the address of the entry point for the
62routine called at the end of an ISR once it has been decided a context
63switch is necessary.  On some compilation systems it is difficult to call
64a high-level language routine from assembly.  Providing the address of the
65_Thread_ISR_Dispatch routine allows the porter an easy way to obtain this
66critical address and thus provides an easy way to work around this
67limitation on these systems.
68
69If you encounter this problem save the entry point in a CPU dependent
70variable as shown below:
71
72@example
73_CPU_Thread_dispatch_pointer = thread_dispatch;
74@end example
75
76
77During the initialization of the context for tasks with floating point,
78the CPU dependent code is responsible for initializing the floating point
79context.  If there is not an easy way to initialize the FP context during
80Context_Initialize, then it is usually easier to save an "uninitialized"
81FP context here and copy it to the task's during Context_Initialize.  If
82this technique is used to initialize the FP contexts, then it is important
83to ensure that the state of the floating point unit is in a coherent,
84initialized state.
85
86Finally, this routine is responsible for copying the application's CPU
87Table into a locally accessible and modifiable area.  This is shown below:
88
89@example
90_CPU_Table = *cpu_table;
91@end example
92
93
Note: See TracBrowser for help on using the repository browser.