[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] Add cpu_number and cpuboot
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 3/4] Add cpu_number and cpuboot |
Date: |
Tue, 15 Nov 2022 02:13:15 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Damien Zammit, le ven. 11 nov. 2022 23:21:28 +0000, a ecrit:
> diff --git a/i386/i386/cpu_number.c b/i386/i386/cpu_number.c
> new file mode 100644
> index 00000000..d4621669
> --- /dev/null
> +++ b/i386/i386/cpu_number.c
> +#if NCPUS > 1
> +int cpu_number(void)
> +{
> + int kernel_id;
> + unsigned long flags;
> +
> + cpu_intr_save(&flags);
> +
> + kernel_id = apic_get_cpu_kernel_id(apic_get_current_cpu());
> +
> + cpu_intr_restore(flags);
Why disabling interrupts?
> + return kernel_id;
> +}
> +#endif
> diff --git a/i386/i386/cpuboot.S b/i386/i386/cpuboot.S
> new file mode 100644
> index 00000000..4a5823be
> --- /dev/null
> +++ b/i386/i386/cpuboot.S
> + /* KERNEL_CS */
> + .word 0xffff /* Segment limit first 0-15 bits*/
> + .word (-KERNELBASE) & 0xffff /*Base first 0-15 bits*/
> + .byte ((-KERNELBASE) >> 16) & 0xff /*Base 16-23 bits */
> + .byte (ACC_P | ACC_CODE_R) /*Access byte */
> + .byte 0xcf /* High 4 bits */
0xc0 should rather be the non-magic (SZ_G|SZ_32) << 4
> + .byte ((-KERNELBASE) >> 24) & 0xff /*Base 24-31 bits */
> + /* KERNEL_DS */
> + .word 0xffff /*Segment limit */
> + .word (-KERNELBASE) & 0xffff /*Base first 0-15 bits*/
> + .byte ((-KERNELBASE) >> 16) & 0xff
> + .byte (ACC_P | ACC_DATA_W) /*Access byte*/
> + .byte 0xcf /* High 4 bits */
Ditto
> + .byte ((-KERNELBASE) >> 24) & 0xff /*Base 24-31 bits */
> +.align 16
> +gdt_tmp:
> + /* 0 */
> + .quad 0
> + /* BOOT_CS */
> + .word 0xffff
> + .word 0x0000
> + .byte 0x00
> + .byte (ACC_P | ACC_CODE_R)
> + .byte 0xcf
Ditto
> + .byte 0x00
> + /* BOOT_DS */
> + .word 0xffff
> + .word 0x0000
> + .byte 0x00
> + .byte (ACC_P | ACC_DATA_W)
> + .byte 0xcf
Ditto
> + .byte 0x00
> +
> +_apbootend:
> +apbootend:
> diff --git a/i386/i386at/boothdr.S b/i386/i386at/boothdr.S
> index 82d4b34a..a4830326 100644
> --- a/i386/i386at/boothdr.S
> +++ b/i386/i386at/boothdr.S
> @@ -58,7 +58,7 @@ boot_entry:
>
> /* Reset EFLAGS to a known state. */
> pushl $0
> - popf
> + popfl
>
> /* Clear uninitialized data. */
> lea _edata,%edi
> --
> 2.34.1
>
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
[PATCH 3/4] Add cpu_number and cpuboot, Damien Zammit, 2022/11/11
- Re: [PATCH 3/4] Add cpu_number and cpuboot,
Samuel Thibault <=
[PATCH 4/4] i386: Refactor int stacks to be per cpu for SMP, Damien Zammit, 2022/11/11