Ticket #356: eabi.patch0

File eabi.patch0, 26.4 KB (added by strauman, on Dec 3, 2006 at 1:31:12 PM)

eabi.patch0

Line 
1Version: eabi.patch0, 2003/02/18, against rtems-ss-20030128
2Author:  Till Straumann <strauman@slac.stanford.edu>
3
4This patch makes RTEMS/powerpc/shared EABI compliant:
5
6RTEMS + applications may be compiled with the -meabi -msdata=eabi
7compiler flags who instruct the compiler/linker not only to
8put short data into '.sdata/.sbss' and '.sdata2/.sbss2' sections
9but also to access the short data areas using the reserved
10PowerPC registers R13 and R2, respectively. This makes
11applications both, smaller and faster.
12
13NOTE:
14
15THE LAST HUNK IN THIS PATCH MODIFIES custom/mvme2307.cfg
16TO ENABLE THE EABI SPECIFIC COMPILER FLAGS
17 
18The essential changes performed by this patch are:
19
20 - declare all linker-script defined addresses as
21   variables of unknown size and not as short objects
22   like 'int', 'void*' etc.
23   Since only addresses are used and never those
24   variable's values, the type used in a declaration
25   is not important. A typical case is e.g. __rtems_end
26
27   Instead of declaring
28     
29      extern void *__rtems_end;
30
31   and using the address
32
33      (unsigned32)&__rtems_end
34
35   such linker-defined addresses should be declared e.g.:
36
37      extern void *__rtems_end[]; /* array of unknown size */
38   
39   and used
40
41      (unsigned32)__rtems_end
42 
43   This prevents the compiler from generating a relocation
44   who assumes the existence of an __rtems_end object in
45   one of the short data areas (which would result in a
46   linker error).
47   
48 - let the 'powerpc/shared/' BSP call __eabi() at an early
49   stage. This routine is responsible for setting up the
50   SYSV/EABI environment (e.g. setting R2/R13).
51
52   Note, however, that __eabi() tries to invoke __init()
53   which is responsible for calling the static C++ constructor
54   lists and this step must not be done at this early stage
55   yet.
56
57   A tiny startfile 'rtems_crti.o' has been added which must
58   be linked immediately after ecrti.o. rtems_crti.o contains
59   a code snippet who lets __init() return immediately. Also,
60   a new entry point '_init' to the C++ Ctors is generated
61   for use by the RTEMS Thread_Handler.
62   Affected BSP files: rtems_crti.S, bsp_specs and linkcmds
63
64 - set the _SDA_BASE_ and _SDA2_BASE_ symbols (linkcmds)
65
66 - zero_bss() should clear not only bss but sbss and sbss2
67   also (this is probably a bugfix, as sbss/sbss2 are
68   probably used even if -msdata=eabi is not specified).
69
70 - align the interrupt stack (powerpc/shared BSP) according
71   to the SYSV/EABI requirements.
72   (We assume that the initial stack is always properly aligned)
73   
74 - align a new task's stack according to the SYSV/EABI
75   requirements and set R13/R2 as needed by the PPC_ABI
76   chosen (powerpc/new_exception_processing).
77
78 - let Thread_Handler verify that _init/_main are non-NULL
79   before calling them (gives the linker script/user more
80   freedom to handle special cases)
81
82 - add -meabi -msdata=eabi to the custom/mvme2307.cfg
83
84To apply this patch, chdir to the rtems-ss-20030128 topdir
85and issue
86
87        patch -p0 < this file
88
89NOTE: it is always a good idea to try a --dry-run first ;-)
90
91Index: c/src/lib/libbsp/powerpc/motorola_powerpc/bsp_specs
92===================================================================
93RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/motorola_powerpc/bsp_specs,v
94retrieving revision 1.1.1.3
95diff -c -r1.1.1.3 bsp_specs
96*** c/src/lib/libbsp/powerpc/motorola_powerpc/bsp_specs 29 Jan 2003 22:52:59 -0000      1.1.1.3
97--- c/src/lib/libbsp/powerpc/motorola_powerpc/bsp_specs 14 Feb 2003 02:19:04 -0000
98***************
99*** 14,20 ****
100  %{!qnolinkcmds: -T linkcmds%s}}}
101 
102  *startfile:
103! %{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems:  ecrti%O%s  crtbegin.o%s  \
104  %{!qrtems_debug: start.o%s} \
105  %{qrtems_debug: start_g.o%s}}}
106 
107--- 14,20 ----
108  %{!qnolinkcmds: -T linkcmds%s}}}
109 
110  *startfile:
111! %{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems:  ecrti%O%s rtems_crti%O%s  crtbegin.o%s  \
112  %{!qrtems_debug: start.o%s} \
113  %{qrtems_debug: start_g.o%s}}}
114 
115Index: c/src/lib/libbsp/powerpc/motorola_powerpc/start/Makefile.am
116===================================================================
117RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/motorola_powerpc/start/Makefile.am,v
118retrieving revision 1.1.1.2
119diff -c -r1.1.1.2 Makefile.am
120*** c/src/lib/libbsp/powerpc/motorola_powerpc/start/Makefile.am 29 Jan 2003 22:53:01 -0000      1.1.1.2
121--- c/src/lib/libbsp/powerpc/motorola_powerpc/start/Makefile.am 18 Feb 2003 20:55:44 -0000
122***************
123*** 4,10 ****
124 
125  VPATH = @srcdir@:@srcdir@/../../shared/start
126 
127! S_FILES = start.S
128  S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.$(OBJEXT))
129 
130  OBJS = $(S_O_FILES)
131--- 4,10 ----
132 
133  VPATH = @srcdir@:@srcdir@/../../shared/start
134 
135! S_FILES = start.S rtems_crti.S
136  S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.$(OBJEXT))
137 
138  OBJS = $(S_O_FILES)
139***************
140*** 15,32 ****
141  #
142  # (OPTIONAL) Add local stuff here using +=
143  #
144!
145! install-data-local: $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).$(OBJEXT)
146!       @$(mkinstalldirs) $(DESTDIR)$(bsplibdir)
147!       $(INSTALL_DATA) $< $(DESTDIR)$(bsplibdir)
148 
149  $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).$(OBJEXT): $(ARCH)/start.$(OBJEXT)
150        $(INSTALL_DATA) $< $@
151 
152  TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).$(OBJEXT)
153 
154! all-local: $(ARCH) $(OBJS) $(ARCH)/start.$(OBJEXT) $(TMPINSTALL_FILES)
155 
156! .PRECIOUS: $(ARCH)/start.$(OBJEXT)
157 
158  include $(top_srcdir)/../../../../../../automake/local.am
159--- 15,36 ----
160  #
161  # (OPTIONAL) Add local stuff here using +=
162  #
163! bsplib_DATA =  $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).$(OBJEXT)
164! bsplib_DATA += $(PROJECT_RELEASE)/lib/rtems_crti.$(OBJEXT)
165 
166  $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).$(OBJEXT): $(ARCH)/start.$(OBJEXT)
167        $(INSTALL_DATA) $< $@
168 
169+ $(PROJECT_RELEASE)/lib/rtems_crti.$(OBJEXT): $(ARCH)/rtems_crti.$(OBJEXT)
170+       $(INSTALL_DATA) $< $@
171+
172  TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).$(OBJEXT)
173+ TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/rtems_crti.$(OBJEXT)
174+
175+ all-local: $(ARCH) $(OBJS) $(ARCH)/start.$(OBJEXT) $(ARCH)/rtems_crti.$(OBJEXT) $(TMPINSTALL_FILES)
176 
177! $(OBJS): $(ARCH)
178 
179! .PRECIOUS: $(ARCH)/start.$(OBJEXT) $(ARCH)/rtems_crti.$(OBJEXT)
180 
181  include $(top_srcdir)/../../../../../../automake/local.am
182Index: c/src/lib/libbsp/powerpc/motorola_powerpc/startup/linkcmds
183===================================================================
184RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/motorola_powerpc/startup/linkcmds,v
185retrieving revision 1.5
186diff -c -r1.5 linkcmds
187*** c/src/lib/libbsp/powerpc/motorola_powerpc/startup/linkcmds  12 Feb 2003 22:08:24 -0000      1.5
188--- c/src/lib/libbsp/powerpc/motorola_powerpc/startup/linkcmds  17 Feb 2003 23:31:10 -0000
189***************
190*** 53,59 ****
191    .rela.sdata2    : { *(.rela.sdata2)   }     > CODE
192    .rela.sbss2     : { *(.rela.sbss2)    }     > CODE
193 
194!   .init                 : { _init = .; KEEP(*(.init)) } > CODE
195 
196    .text      :       
197    {
198--- 53,59 ----
199    .rela.sdata2    : { *(.rela.sdata2)   }     > CODE
200    .rela.sbss2     : { *(.rela.sbss2)    }     > CODE
201 
202!   .init                 : { KEEP(*(.init))            } > CODE
203 
204    .text      :       
205    {
206***************
207*** 97,102 ****
208--- 97,103 ----
209    .fini_array     : { *(.fini_array) } >CODE
210    PROVIDE (__fini_array_end = .);
211 
212+ _SDA2_BASE_ = __SDATA2_START__ + 0x8000;
213    .sdata2       : { *(.sdata2) *(.gnu.linkonce.s2.*)  } >CODE
214    .sbss2        : { *(.sbss2) *(.gnu.linkonce.sb2.*)  } >CODE
215    .eh_frame     : { *.(eh_frame)              } >CODE
216***************
217*** 191,196 ****
218--- 192,198 ----
219    /* We want the small data sections together, so single-instruction offsets
220       can access them all, and initialized data all before uninitialized, so
221       we can shorten the on-disk segment size.  */
222+ _SDA_BASE_ = __SDATA_START__ + 0x8000;
223    .sdata        : { *(.sdata) *(.gnu.linkonce.s.*)    } >CODE
224    _edata  =  .;
225    PROVIDE (edata = .);
226Index: c/src/lib/libbsp/powerpc/shared/irq/irq_init.c
227===================================================================
228RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c,v
229retrieving revision 1.4
230diff -c -r1.4 irq_init.c
231*** c/src/lib/libbsp/powerpc/shared/irq/irq_init.c      30 Jan 2003 00:48:58 -0000      1.4
232--- c/src/lib/libbsp/powerpc/shared/irq/irq_init.c      18 Feb 2003 21:05:55 -0000
233***************
234*** 43,51 ****
235  pci_isa_bridge_device* via_82c586 = 0;
236  static pci_isa_bridge_device bridge;
237 
238! extern unsigned int external_exception_vector_prolog_code_size;
239  extern void external_exception_vector_prolog_code();
240! extern unsigned int decrementer_exception_vector_prolog_code_size;
241  extern void decrementer_exception_vector_prolog_code();
242 
243  /*
244--- 43,51 ----
245  pci_isa_bridge_device* via_82c586 = 0;
246  static pci_isa_bridge_device bridge;
247 
248! extern unsigned int external_exception_vector_prolog_code_size[];
249  extern void external_exception_vector_prolog_code();
250! extern unsigned int decrementer_exception_vector_prolog_code_size[];
251  extern void decrementer_exception_vector_prolog_code();
252 
253  /*
254***************
255*** 296,302 ****
256      vectorDesc.exceptIndex    =       ASM_DEC_VECTOR;
257      vectorDesc.hdl.vector     =       ASM_DEC_VECTOR;
258      vectorDesc.hdl.raw_hdl    =       decrementer_exception_vector_prolog_code;
259!     vectorDesc.hdl.raw_hdl_size       =       (unsigned) &decrementer_exception_vector_prolog_code_size;
260      vectorDesc.on             =       nop_func;
261      vectorDesc.off            =       nop_func;
262      vectorDesc.isOn           =       connected;
263--- 296,302 ----
264      vectorDesc.exceptIndex    =       ASM_DEC_VECTOR;
265      vectorDesc.hdl.vector     =       ASM_DEC_VECTOR;
266      vectorDesc.hdl.raw_hdl    =       decrementer_exception_vector_prolog_code;
267!     vectorDesc.hdl.raw_hdl_size       =       (unsigned) decrementer_exception_vector_prolog_code_size;
268      vectorDesc.on             =       nop_func;
269      vectorDesc.off            =       nop_func;
270      vectorDesc.isOn           =       connected;
271***************
272*** 306,312 ****
273      vectorDesc.exceptIndex    =       ASM_EXT_VECTOR;
274      vectorDesc.hdl.vector     =       ASM_EXT_VECTOR;
275      vectorDesc.hdl.raw_hdl    =       external_exception_vector_prolog_code;
276!     vectorDesc.hdl.raw_hdl_size       =       (unsigned) &external_exception_vector_prolog_code_size;
277      if (!mpc60x_set_exception (&vectorDesc)) {
278        BSP_panic("Unable to initialize RTEMS external raw exception\n");
279      }
280--- 306,312 ----
281      vectorDesc.exceptIndex    =       ASM_EXT_VECTOR;
282      vectorDesc.hdl.vector     =       ASM_EXT_VECTOR;
283      vectorDesc.hdl.raw_hdl    =       external_exception_vector_prolog_code;
284!     vectorDesc.hdl.raw_hdl_size       =       (unsigned) external_exception_vector_prolog_code_size;
285      if (!mpc60x_set_exception (&vectorDesc)) {
286        BSP_panic("Unable to initialize RTEMS external raw exception\n");
287      }
288Index: c/src/lib/libbsp/powerpc/shared/start/Makefile.am
289===================================================================
290RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/start/Makefile.am,v
291retrieving revision 1.1.1.2
292diff -c -r1.1.1.2 Makefile.am
293*** c/src/lib/libbsp/powerpc/shared/start/Makefile.am   29 Jan 2003 22:53:28 -0000      1.1.1.2
294--- c/src/lib/libbsp/powerpc/shared/start/Makefile.am   14 Feb 2003 02:18:13 -0000
295***************
296*** 3,10 ****
297  ##
298 
299 
300! S_FILES = start.S
301 
302! EXTRA_DIST = start.S
303 
304  include $(top_srcdir)/../../../../../automake/local.am
305--- 3,10 ----
306  ##
307 
308 
309! S_FILES = start.S rtems_crti.S
310 
311! EXTRA_DIST = start.S rtems_crti.S
312 
313  include $(top_srcdir)/../../../../../automake/local.am
314Index: c/src/lib/libbsp/powerpc/shared/start/rtems_crti.S
315===================================================================
316RCS file: c/src/lib/libbsp/powerpc/shared/start/rtems_crti.S
317diff -N c/src/lib/libbsp/powerpc/shared/start/rtems_crti.S
318*** /dev/null   1 Jan 1970 00:00:00 -0000
319--- c/src/lib/libbsp/powerpc/shared/start/rtems_crti.S  14 Feb 2003 02:17:56 -0000
320***************
321*** 0 ****
322--- 1,35 ----
323+ /* rtems_crti.S */
324+ #include <asm.h>
325+ #include <rtems/score/cpu.h>
326+ #include <libcpu/io.h>
327+
328+       /* terminate the __init() function and create
329+        * a new head '_init' for use by RTEMS to
330+        * invoke C++ global constructors
331+        * NOTE: it is essential that this snippet
332+        * is hooked between ecrti and crtbegin
333+        *
334+        * ecrti has the following .init section:
335+        * __init:
336+        *    stwu r1,-16(r1)
337+        *    mflr r0
338+        *    stw  r0,20(r1)
339+        *
340+        * The reason for this is that we want to call
341+        * __eabi() at an early stage but prevent __eabi()
342+        * from branching to __init (C++ exception init
343+        * and global CTORs). Hence we make __init a no-op
344+        * and create a new entry point:
345+        */
346+       .section ".init","ax"
347+       .align 2
348+       lwz             r0,r20(r1)
349+       mtlr    r0
350+       addi    r1,r1,16
351+       blr
352+       .globl  _init
353+       .type   _init,@function
354+ _init:
355+       stwu    r1,-16(r1)
356+       mflr    r0
357+       stw             r0,20(r1)       
358Index: c/src/lib/libbsp/powerpc/shared/start/start.S
359===================================================================
360RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/start/start.S,v
361retrieving revision 1.3
362diff -c -r1.3 start.S
363*** c/src/lib/libbsp/powerpc/shared/start/start.S       30 Jan 2003 00:49:06 -0000      1.3
364--- c/src/lib/libbsp/powerpc/shared/start/start.S       14 Feb 2003 02:17:28 -0000
365***************
366*** 27,33 ****
367        mtmsr   r10             ;       \
368        li      r10,0x63        ;       \
369        sc
370!                       
371        .text
372        .globl  __rtems_entry_point
373        .type   __rtems_entry_point,@function
374--- 27,34 ----
375        mtmsr   r10             ;       \
376        li      r10,0x63        ;       \
377        sc
378!
379!               
380        .text
381        .globl  __rtems_entry_point
382        .type   __rtems_entry_point,@function
383***************
384*** 86,91 ****
385--- 87,93 ----
386       
387  enter_C_code:
388        bl      MMUon
389+       bl  __eabi      /* setup EABI and SYSV environment */
390        bl      zero_bss
391        /*
392         * restore prep boot params
393Index: c/src/lib/libbsp/powerpc/shared/startup/bspstart.c
394===================================================================
395RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/startup/bspstart.c,v
396retrieving revision 1.5
397diff -c -r1.5 bspstart.c
398*** c/src/lib/libbsp/powerpc/shared/startup/bspstart.c  12 Feb 2003 22:08:51 -0000      1.5
399--- c/src/lib/libbsp/powerpc/shared/startup/bspstart.c  18 Feb 2003 21:04:33 -0000
400***************
401*** 36,44 ****
402  #include <bsp/motorola.h>
403 
404  extern void _return_to_ppcbug();
405! extern unsigned long __rtems_end;
406! extern unsigned long _end;
407! extern unsigned long __bss_start;
408  extern void L1_caches_enables();
409  extern unsigned get_L2CR();
410  extern void set_L2CR(unsigned);
411--- 36,42 ----
412  #include <bsp/motorola.h>
413 
414  extern void _return_to_ppcbug();
415! extern unsigned long __rtems_end[];
416  extern void L1_caches_enables();
417  extern unsigned get_L2CR();
418  extern void set_L2CR(unsigned);
419***************
420*** 135,141 ****
421      rtems_unsigned32        heap_start;   
422      rtems_unsigned32        heap_size;
423 
424!     heap_start = ((rtems_unsigned32) &__rtems_end) +INIT_STACK_SIZE + INTR_STACK_SIZE;
425      if (heap_start & (CPU_ALIGNMENT-1))
426          heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
427 
428--- 133,139 ----
429      rtems_unsigned32        heap_start;   
430      rtems_unsigned32        heap_size;
431 
432!     heap_start = ((rtems_unsigned32) __rtems_end) +INIT_STACK_SIZE + INTR_STACK_SIZE;
433      if (heap_start & (CPU_ALIGNMENT-1))
434          heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
435 
436***************
437*** 153,159 ****
438 
439  void zero_bss()
440  {
441!   memset(&__bss_start, 0, ((unsigned) (&__rtems_end)) - ((unsigned) &__bss_start));
442  }
443 
444  void save_boot_params(RESIDUAL* r3, void *r4, void* r5, char *additional_boot_options)
445--- 151,162 ----
446 
447  void zero_bss()
448  {
449!   /* prevent these from being accessed in the short data areas */
450!   extern unsigned long __bss_start[], __SBSS_START__[], __SBSS_END__[];
451!   extern unsigned long __SBSS2_START__[], __SBSS2_END__[];
452!   memset(__SBSS_START__, 0, ((unsigned) __SBSS_END__) - ((unsigned)__SBSS_START__));
453!   memset(__SBSS2_START__, 0, ((unsigned) __SBSS2_END__) - ((unsigned)__SBSS2_START__));
454!   memset(__bss_start, 0, ((unsigned) __rtems_end) - ((unsigned)__bss_start));
455  }
456 
457  void save_boot_params(RESIDUAL* r3, void *r4, void* r5, char *additional_boot_options)
458***************
459*** 209,215 ****
460     * so there is no need to set it in r1 again... It is just for info
461     * so that It can be printed without accessing R1.
462     */
463!   stack = ((unsigned char*) &__rtems_end) + INIT_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE;
464 
465   /* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
466    *((unsigned32 *)stack) = 0;
467--- 212,218 ----
468     * so there is no need to set it in r1 again... It is just for info
469     * so that It can be printed without accessing R1.
470     */
471!   stack = ((unsigned char*) __rtems_end) + INIT_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE;
472 
473   /* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
474    *((unsigned32 *)stack) = 0;
475***************
476*** 222,230 ****
477     * This could be done latter (e.g in IRQ_INIT) but it helps to understand
478     * some settings below...
479     */
480!   intrStack = ((unsigned char*) &__rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE;
481 
482!  /* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
483    *((unsigned32 *)intrStack) = 0;
484 
485    _write_SPR1((unsigned int)intrStack);
486--- 225,236 ----
487     * This could be done latter (e.g in IRQ_INIT) but it helps to understand
488     * some settings below...
489     */
490!   intrStack = ((unsigned char*) __rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE - CPU_MINIMUM_STACK_FRAME_SIZE;
491 
492!   /* make sure it's properly aligned */
493!   (unsigned32)intrStack &= ~(CPU_STACK_ALIGNMENT-1);
494!
495!   /* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
496    *((unsigned32 *)intrStack) = 0;
497 
498    _write_SPR1((unsigned int)intrStack);
499***************
500*** 357,363 ****
501    work_space_start =
502      (unsigned char *)BSP_mem_size - BSP_Configuration.work_space_size;
503 
504!   if ( work_space_start <= ((unsigned char *)&__rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE) {
505      printk( "bspstart: Not enough RAM!!!\n" );
506      bsp_cleanup();
507    }
508--- 363,369 ----
509    work_space_start =
510      (unsigned char *)BSP_mem_size - BSP_Configuration.work_space_size;
511 
512!   if ( work_space_start <= ((unsigned char *)__rtems_end) + INIT_STACK_SIZE + INTR_STACK_SIZE) {
513      printk( "bspstart: Not enough RAM!!!\n" );
514      bsp_cleanup();
515    }
516Index: c/src/lib/libbsp/powerpc/shared/startup/pgtbl_setup.c
517===================================================================
518RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/startup/pgtbl_setup.c,v
519retrieving revision 1.3
520diff -c -r1.3 pgtbl_setup.c
521*** c/src/lib/libbsp/powerpc/shared/startup/pgtbl_setup.c       12 Feb 2003 22:08:51 -0000      1.3
522--- c/src/lib/libbsp/powerpc/shared/startup/pgtbl_setup.c       18 Feb 2003 00:28:55 -0000
523***************
524*** 50,63 ****
525        /* get those from the linker script.
526         * NOTE THAT THE CORRECTNESS OF THE LINKER SCRIPT IS CRUCIAL
527         */
528!       extern unsigned long __DATA_START__, _etext;
529 
530        /* map text and RO data read-only */
531        tmp = triv121PgTblMap(
532                                                pt,
533                                                TRIV121_121_VSID,
534                                                0,
535!                                               (PAGE_ALIGN((unsigned long)&_etext) - 0) >> PG_SHIFT,
536                                                0, /* WIMG */
537                                                TRIV121_PP_RO_PAGE);
538        if (TRIV121_MAP_SUCCESS != tmp) {
539--- 50,63 ----
540        /* get those from the linker script.
541         * NOTE THAT THE CORRECTNESS OF THE LINKER SCRIPT IS CRUCIAL
542         */
543!       extern unsigned long __DATA_START__[], _etext[];
544 
545        /* map text and RO data read-only */
546        tmp = triv121PgTblMap(
547                                                pt,
548                                                TRIV121_121_VSID,
549                                                0,
550!                                               (PAGE_ALIGN((unsigned long)_etext) - 0) >> PG_SHIFT,
551                                                0, /* WIMG */
552                                                TRIV121_PP_RO_PAGE);
553        if (TRIV121_MAP_SUCCESS != tmp) {
554***************
555*** 69,76 ****
556                tmp = triv121PgTblMap(
557                                                pt,
558                                                TRIV121_121_VSID,
559!                                               (unsigned long)&__DATA_START__,
560!                                               (*pmemsize - (1<<ldPtSize) -  (unsigned long)&__DATA_START__ )>> PG_SHIFT,
561                                                0, /* WIMG */
562                                                TRIV121_PP_RW_PAGE);
563                if (TRIV121_MAP_SUCCESS != tmp) {
564--- 69,76 ----
565                tmp = triv121PgTblMap(
566                                                pt,
567                                                TRIV121_121_VSID,
568!                                               (unsigned long)__DATA_START__,
569!                                               (*pmemsize - (1<<ldPtSize) -  (unsigned long)__DATA_START__ )>> PG_SHIFT,
570                                                0, /* WIMG */
571                                                TRIV121_PP_RW_PAGE);
572                if (TRIV121_MAP_SUCCESS != tmp) {
573Index: c/src/lib/libbsp/powerpc/shared/vectors/vectors.h
574===================================================================
575RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/vectors/vectors.h,v
576retrieving revision 1.3
577diff -c -r1.3 vectors.h
578*** c/src/lib/libbsp/powerpc/shared/vectors/vectors.h   30 Jan 2003 00:49:10 -0000      1.3
579--- c/src/lib/libbsp/powerpc/shared/vectors/vectors.h   18 Feb 2003 00:30:38 -0000
580***************
581*** 75,81 ****
582   */
583 
584  extern        void default_exception_vector_code_prolog();
585! extern        int  default_exception_vector_code_prolog_size;
586 
587  /* codemove is like memmove, but it also gets the cache line size
588   * as 4th parameter to synchronize them. If this last parameter is
589--- 75,85 ----
590   */
591 
592  extern        void default_exception_vector_code_prolog();
593! /* This symbol is generated by the linker; prevent it from
594!  * being accessed in one of the short data areas by declaring
595!  * it as an array
596!  */
597! extern        int  default_exception_vector_code_prolog_size[];
598 
599  /* codemove is like memmove, but it also gets the cache line size
600   * as 4th parameter to synchronize them. If this last parameter is
601Index: c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c
602===================================================================
603RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c,v
604retrieving revision 1.10
605diff -c -r1.10 vectors_init.c
606*** c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c      12 Feb 2003 22:08:53 -0000      1.10
607--- c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c      18 Feb 2003 00:30:53 -0000
608***************
609*** 160,166 ****
610     * Note that next line the '&' before default_exception_vector_code_prolog_size
611     * is not a bug as it is defined a .set directly in asm...
612     */
613!   exception_config.defaultRawEntry.hdl.raw_hdl_size = (unsigned) &default_exception_vector_code_prolog_size;
614    for (i=0; i <= exception_config.exceptSize; i++) {
615      if (!mpc60x_vector_is_valid (i)) {
616        continue;
617--- 160,166 ----
618     * Note that next line the '&' before default_exception_vector_code_prolog_size
619     * is not a bug as it is defined a .set directly in asm...
620     */
621!   exception_config.defaultRawEntry.hdl.raw_hdl_size = (unsigned) default_exception_vector_code_prolog_size;
622    for (i=0; i <= exception_config.exceptSize; i++) {
623      if (!mpc60x_vector_is_valid (i)) {
624        continue;
625Index: c/src/lib/libbsp/powerpc/support/new_exception_processing/cpu.c
626===================================================================
627RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/powerpc/support/new_exception_processing/cpu.c,v
628retrieving revision 1.3
629diff -c -r1.3 cpu.c
630*** c/src/lib/libbsp/powerpc/support/new_exception_processing/cpu.c     30 Jan 2003 00:49:11 -0000      1.3
631--- c/src/lib/libbsp/powerpc/support/new_exception_processing/cpu.c     18 Feb 2003 01:29:11 -0000
632***************
633*** 70,75 ****
634--- 70,78 ----
635    unsigned32 sp;
636 
637    sp = (unsigned32)stack_base + size - CPU_MINIMUM_STACK_FRAME_SIZE;
638+
639+   sp &= ~(CPU_STACK_ALIGNMENT-1);
640+
641    *((unsigned32 *)sp) = 0;
642    the_context->gpr1 = sp;
643     
644***************
645*** 109,114 ****
646--- 112,135 ----
647  #endif
648 
649    the_context->pc = (unsigned32)entry_point;
650+
651+ #if (PPC_ABI == PPC_ABI_SVR4)
652+   { unsigned    r13 = 0;
653+     asm volatile ("mr %0, 13" : "=r" ((r13)));
654+   
655+     the_context->gpr13 = r13;
656+   }
657+ #elif (PPC_ABI == PPC_ABI_EABI)
658+   { unsigned32  r2 = 0;
659+     unsigned    r13 = 0;
660+     asm volatile ("mr %0,2; mr %1,13" : "=r" ((r2)), "=r" ((r13)));
661
662+     the_context->gpr2 = r2;
663+     the_context->gpr13 = r13;
664+   }
665+ #else
666+ #error unsupported PPC_ABI
667+ #endif
668  }
669 
670 
671Index: cpukit/libnetworking/sys/linker_set.h
672===================================================================
673RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/cpukit/libnetworking/sys/linker_set.h,v
674retrieving revision 1.1.1.1
675diff -c -r1.1.1.1 linker_set.h
676*** cpukit/libnetworking/sys/linker_set.h       29 Jan 2003 22:58:02 -0000      1.1.1.1
677--- cpukit/libnetworking/sys/linker_set.h       18 Feb 2003 18:07:07 -0000
678***************
679*** 63,75 ****
680   * Initialize before referring to a give linker set
681   */
682  #define SET_DECLARE(set, ptype)                                               \
683!       extern ptype *__CONCAT(__start_set_,set);                       \
684!       extern ptype *__CONCAT(__stop_set_,set)
685 
686  #define SET_BEGIN(set)                                                        \
687!       (&__CONCAT(__start_set_,set))
688  #define SET_LIMIT(set)                                                        \
689!       (&__CONCAT(__stop_set_,set))
690 
691  /*
692   * Iterate over all the elements of a set.
693--- 63,75 ----
694   * Initialize before referring to a give linker set
695   */
696  #define SET_DECLARE(set, ptype)                                               \
697!       extern ptype *__CONCAT(__start_set_,set)[];                     \
698!       extern ptype *__CONCAT(__stop_set_,set)[]
699 
700  #define SET_BEGIN(set)                                                        \
701!       (__CONCAT(__start_set_,set))
702  #define SET_LIMIT(set)                                                        \
703!       (__CONCAT(__stop_set_,set))
704 
705  /*
706   * Iterate over all the elements of a set.
707Index: cpukit/score/src/threadhandler.c
708===================================================================
709RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/cpukit/score/src/threadhandler.c,v
710retrieving revision 1.4
711diff -c -r1.4 threadhandler.c
712*** cpukit/score/src/threadhandler.c    30 Jan 2003 00:50:27 -0000      1.4
713--- cpukit/score/src/threadhandler.c    13 Feb 2003 00:21:15 -0000
714***************
715*** 109,119 ****
716 
717    _Thread_Enable_dispatch();
718  #if defined(__USE_INIT_FINI__)
719!   if (!doneCons)
720      _init ();
721  #endif
722  #if defined(__USE__MAIN__)
723!   if (!doneCons)
724      __main ();
725  #endif
726 
727--- 109,119 ----
728 
729    _Thread_Enable_dispatch();
730  #if defined(__USE_INIT_FINI__)
731!   if (!doneCons && _init)
732      _init ();
733  #endif
734  #if defined(__USE__MAIN__)
735!   if (!doneCons && _main)
736      __main ();
737  #endif
738 
739Index: make/custom/mvme2307.cfg
740===================================================================
741RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/make/custom/mvme2307.cfg,v
742retrieving revision 1.1.1.3
743diff -c -r1.1.1.3 mvme2307.cfg
744*** make/custom/mvme2307.cfg    29 Jan 2003 22:59:56 -0000      1.1.1.3
745--- make/custom/mvme2307.cfg    18 Feb 2003 20:43:49 -0000
746***************
747*** 16,22 ****
748  #  This contains the compiler options necessary to select the CPU model
749  #  and (hopefully) optimize for it.
750  #
751! CPU_CFLAGS = -mcpu=604 -mmultiple -mstring -mstrict-align -Dmpc604
752 
753  # optimize flag: typically -0, could use -O4 or -fast
754  # -O4 is ok for RTEMS
755--- 16,22 ----
756  #  This contains the compiler options necessary to select the CPU model
757  #  and (hopefully) optimize for it.
758  #
759! CPU_CFLAGS = -mcpu=604 -mmultiple -mstring -mstrict-align -meabi -msdata=eabi
760 
761  # optimize flag: typically -0, could use -O4 or -fast
762  # -O4 is ok for RTEMS