Rev 534 | Rev 1241 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 534 | Rev 693 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | # |
1 | # |
2 | # Copyright (C) 2001-2004 Jakub Jermar |
2 | # Copyright (C) 2001-2004 Jakub Jermar |
- | 3 | # Copyright (C) 2005-2006 Martin Decky |
|
3 | # All rights reserved. |
4 | # All rights reserved. |
4 | # |
5 | # |
5 | # Redistribution and use in source and binary forms, with or without |
6 | # Redistribution and use in source and binary forms, with or without |
6 | # modification, are permitted provided that the following conditions |
7 | # modification, are permitted provided that the following conditions |
7 | # are met: |
8 | # are met: |
Line 28... | Line 29... | ||
28 | 29 | ||
29 | # |
30 | # |
30 | # Init code for application processors. |
31 | # Init code for application processors. |
31 | # |
32 | # |
32 | 33 | ||
- | 34 | #include <arch/boot/boot.h> |
|
- | 35 | #include <arch/boot/memmap.h> |
|
- | 36 | #include <arch/mm/page.h> |
|
- | 37 | #include <arch/pm.h> |
|
- | 38 | ||
33 | .section K_TEXT_START_2, "ax" |
39 | .section K_TEXT_START, "ax" |
34 | 40 | ||
35 | #ifdef CONFIG_SMP |
41 | #ifdef CONFIG_SMP |
36 | 42 | ||
37 | .global ap_boot |
43 | .global unmapped_ap_boot |
38 | 44 | ||
39 | KTEXT=8 |
45 | KTEXT=8 |
40 | KDATA=16 |
46 | KDATA=16 |
41 | 47 | ||
42 | # This piece of code is real-mode and is meant to be alligned at 4K boundary. |
48 | # This piece of code is real-mode and is meant to be alligned at 4K boundary. |
43 | # The requirement for such an alignment comes from MP Specification's STARTUP IPI |
49 | # The requirement for such an alignment comes from MP Specification's STARTUP IPI |
44 | # requirements. |
50 | # requirements. |
45 | 51 | ||
46 | .align 4096 |
52 | .align 4096 |
47 | ap_boot: |
53 | unmapped_ap_boot: |
48 | .code16 |
54 | .code16 |
49 | cli |
55 | cli |
50 | xorw %ax, %ax |
56 | xorw %ax, %ax |
51 | movw %ax, %ds |
57 | movw %ax, %ds |
52 | 58 | ||
53 | lgdt real_bootstrap_gdtr_boot # initialize Global Descriptor Table register |
59 | lgdt ap_gdtr # initialize Global Descriptor Table register |
54 | 60 | ||
55 | movl %cr0, %eax |
61 | movl %cr0, %eax |
56 | orl $1, %eax |
62 | orl $1, %eax |
57 | movl %eax, %cr0 # switch to protected mode |
63 | movl %eax, %cr0 # switch to protected mode |
58 | jmpl $KTEXT, $jump_to_kernel |
64 | jmpl $KTEXT, $jump_to_kernel - BOOT_OFFSET + AP_BOOT_OFFSET |
59 | 65 | ||
60 | jump_to_kernel: |
66 | jump_to_kernel: |
61 | .code32 |
67 | .code32 |
62 | movw $KDATA, %ax |
68 | movw $KDATA, %ax |
63 | movw %ax, %ds |
69 | movw %ax, %ds |
64 | movw %ax, %es |
70 | movw %ax, %es |
65 | movw %ax, %ss |
71 | movw %ax, %ss |
66 | movl $(ctx-0x80000000), %eax # KA2PA((__address) &ctx) |
72 | movl $KA2PA(ctx), %eax # KA2PA((__address) &ctx) |
67 | movl (%eax), %esp |
73 | movl (%eax), %esp |
68 | subl $0x80000000, %esp # KA2PA(ctx.sp) |
74 | subl $0x80000000, %esp # KA2PA(ctx.sp) |
69 | 75 | ||
70 | call map_kernel # map kernel and turn paging on |
76 | call map_kernel # map kernel and turn paging on |
71 | 77 | ||
72 | addl $0x80000000, %esp # PA2KA(ctx.sp) |
78 | addl $0x80000000, %esp # PA2KA(ctx.sp) |
73 | 79 | ||
74 | jmpl $KTEXT, $main_ap |
80 | jmpl $KTEXT, $main_ap |
75 | 81 | ||
76 | #endif /* CONFIG_SMP */ |
82 | #endif /* CONFIG_SMP */ |
- | 83 | ||
- | 84 | ||
- | 85 | .section K_DATA_START, "ax" |
|
- | 86 | ||
- | 87 | #ifdef CONFIG_SMP |
|
- | 88 | ||
- | 89 | .global unmapped_ap_gdtr |
|
- | 90 | ||
- | 91 | unmapped_ap_gdtr: |
|
- | 92 | .word 0 |
|
- | 93 | .long 0 |
|
- | 94 | ||
- | 95 | #endif /* CONFIG_SMP */ |