diff options
author | Ian Moffett <ian@osmora.org> | 2025-09-13 21:54:34 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-09-13 21:56:18 -0400 |
commit | deb636aaaddbb9a06610a7fc21d885b57166834d (patch) | |
tree | fbaca32d8c969d45ca6f6c41bdce5e41e3302e9a /src/sys | |
parent | 3770715193be37c9d4bff160aa4ce6fe12c55b93 (diff) |
os/amd64: Define CPU as pcore with MD counterpart
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/include/arch/amd64/mdcpu.h | 44 | ||||
-rw-r--r-- | src/sys/include/sys/cpuvar.h | 53 |
2 files changed, 97 insertions, 0 deletions
diff --git a/src/sys/include/arch/amd64/mdcpu.h b/src/sys/include/arch/amd64/mdcpu.h new file mode 100644 index 0000000..98ecc16 --- /dev/null +++ b/src/sys/include/arch/amd64/mdcpu.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025 Ian Marco Moffett and L5 engineers + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MACHINE_MDCPU_H_ +#define _MACHINE_MDCPU_H_ 1 + +#include <sys/types.h> + +/* + * Represents the machine dependent information + * of a processor core on the machine. + */ +struct mdcore { + uint32_t apic_id; + uint64_t cr3; +}; + +#endif /* !_MACHINE_MDCPU_H_ */ diff --git a/src/sys/include/sys/cpuvar.h b/src/sys/include/sys/cpuvar.h new file mode 100644 index 0000000..f663aec --- /dev/null +++ b/src/sys/include/sys/cpuvar.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2025 Ian Marco Moffett and L5 engineers + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SYS_CPUVAR_H_ +#define _SYS_CPUVAR_H_ 1 + +#include <sys/types.h> +#if defined(_KERNEL) +#include <machine/mdcpu.h> +#endif /* _KERNEL */ + +/* + * Logically describes a processor core on the + * system. This structure contains machine + * independent. + * + * @id: Monotonic logical ID + * @md: Machine dependent processor information + */ +struct pcore { + uint32_t id; +#if defined(_KERNEL) + struct mdcore md; +#endif /* _KERNEL */ +}; + +#endif /* !_SYS_CPUVAR_H_ */ |