Files
mckernel/arch/x86_64/kernel/include/cpulocal.h
Dominique Martinet 21cf953a03 x86: disable zero mapping and add a boot pt for ap trampoline
the application processor trampoline needs the trampoline physical
address to be mapped for the few instructions between loading the
page table and jumping to normal memory area; setup a new pt for them.

Also make it use its stack where it needs to be directly.

With that, x86 can finally remove the 0 page from its init mapping

Change-Id: Iab3f33a2ed22570eeb47b5ab6e068c9a17c25413
2019-02-14 07:59:03 +00:00

58 lines
1.2 KiB
C

/**
* \file cpulocal.h
* License details are found in the file LICENSE.
* \brief
* Declare information for individual CPUs.
* \author Taku Shimosawa <shimosawa@is.s.u-tokyo.ac.jp> \par
* Copyright (C) 2011 - 2012 Taku Shimosawa
*/
/*
* HISTORY
*/
#ifndef HEADER_X86_COMMON_CPULOCAL_H
#define HEADER_X86_COMMON_CPULOCAL_H
#include <types.h>
#include <registers.h>
/*
* CPU Local Page
* 0 - : struct x86_cpu_local_varibles
* - 4096 : kernel stack
*/
#define X86_CPU_LOCAL_OFFSET_TSS 176
#define X86_CPU_LOCAL_OFFSET_KSTACK 16
#define X86_CPU_LOCAL_OFFSET_USTACK 24
struct x86_cpu_local_variables {
/* 0 */
unsigned long processor_id;
unsigned long apic_id;
/* 16 */
unsigned long kernel_stack;
unsigned long user_stack;
/* 32 */
struct x86_desc_ptr gdt_ptr;
unsigned short pad[3];
/* 48 */
uint64_t gdt[16];
/* 176 */
struct tss64 tss;
/* 280 */
unsigned long paniced;
uint64_t panic_regs[21];
/* 456 */
} __attribute__((packed));
struct x86_cpu_local_variables *get_x86_cpu_local_variable(int id);
struct x86_cpu_local_variables *get_x86_this_cpu_local(void);
void *get_x86_cpu_local_kstack(int id);
void *get_x86_this_cpu_kstack(void);
#endif