Refactor copy_and_run so that it uses a single code base instead of
[coreboot.git] / src / cpu / amd / car / copy_and_run.c
1 /* by yhlu 6.2005 
2         moved from nrv2v.c and some lines from crt0.S
3    2006/05/02 - stepan: move nrv2b to an extra file.
4 */
5
6 void copy_and_run_core(u8 *src, u8 *dst, unsigned long ilen, unsigned ebp);
7
8 extern u8 _liseg, _iseg, _eiseg;
9
10 static void copy_and_run(void)
11 {
12         uint8_t *src, *dst; 
13         unsigned long ilen;
14
15         src = &_liseg;
16         dst = &_iseg;
17         ilen = &_eiseg - dst;
18
19         copy_and_run_core(src, dst, ilen, 0);
20 }
21
22 #if CONFIG_AP_CODE_IN_CAR == 1
23
24 extern u8 _liseg_apc, _iseg_apc, _eiseg_apc;
25
26 static void copy_and_run_ap_code_in_car(unsigned ret_addr)
27 {
28         uint8_t *src, *dst;
29         unsigned long ilen;
30
31         src = &_liseg_apc;
32         dst = &_iseg_apc;
33         ilen = &_eiseg_apc - dst;
34
35         copy_and_run_core(src, dst, ilen, ret_addr);
36 }
37 #endif