diff options
author | Jan Sommer <jan.sommer@dlr.de> | 2020-05-31 16:22:53 +0200 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2020-06-11 13:28:55 +1000 |
commit | 85d6a760f57e6f53c72cf8d15be20e3e4eaf4734 (patch) | |
tree | 21f2a8582414ad8810c8a52e553d27e1a790d9f1 /bsps/i386/pc386/start/smp-imps.c | |
parent | bsp/pc386: Turn start16.S into a startAP.S (diff) | |
download | rtems-85d6a760f57e6f53c72cf8d15be20e3e4eaf4734.tar.bz2 |
bsp/pc386: Update GDT to work for SMP
Create a GS segment in the GDT for each processor for storing TLS.
This makes the GDT in startAP.S obsolete as all processors now share the
same GDT, which is passed to each AP at startup.
The correct segment for each processor is calculated in cpu_asm.S.
Update #3335
Diffstat (limited to 'bsps/i386/pc386/start/smp-imps.c')
-rw-r--r-- | bsps/i386/pc386/start/smp-imps.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bsps/i386/pc386/start/smp-imps.c b/bsps/i386/pc386/start/smp-imps.c index 58d9178f90..6480c0d25e 100644 --- a/bsps/i386/pc386/start/smp-imps.c +++ b/bsps/i386/pc386/start/smp-imps.c @@ -83,6 +83,7 @@ #include <assert.h> extern void _pc386_delay(void); +extern uint32_t* gdtdesc; /* #define KERNEL_PRINT(_format) printk(_format) */ @@ -258,10 +259,10 @@ boot_cpu(imps_processor *proc) * under the 1MB boundary. */ - uint32_t *reset; + volatile uint32_t *reset; bootaddr = (512-64)*1024; - reset= (uint32_t *)bootaddr; + reset= (volatile uint32_t *)bootaddr; memcpy( (char *) bootaddr, @@ -269,9 +270,14 @@ boot_cpu(imps_processor *proc) (size_t)_binary_appstart_bin_size ); + /* Pass start function, stack region and gdtdescr to AP + * see startAP.S for location */ reset[1] = (uint32_t)secondary_cpu_initialize; reset[2] = (uint32_t)_Per_CPU_Get_by_index(apicid)->interrupt_stack_high; - + memcpy( + (char*) &reset[3], + &gdtdesc, + 6); /* * Generic CPU startup sequence starts here. */ @@ -325,8 +331,6 @@ boot_cpu(imps_processor *proc) CMOS_WRITE_BYTE(CMOS_RESET_CODE, 0); *((volatile unsigned *) bios_reset_vector) = 0; - printk("\n"); - return success; } @@ -359,6 +363,7 @@ add_processor(imps_processor *proc) /* AP booted successfully, increase number of available cores */ imps_num_cpus++; + printk("#%d Application Processor (AP)\n", imps_apic_cpu_map[apicid]); } } |