XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
x86_64_cpu.h File Reference
#include <stdint.h>
#include <process.h>
#include <time.h>
Include dependency graph for x86_64_cpu.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _stack_frame_
 
struct  _regs_ctx_
 
struct  interrupt_stack_frame
 
struct  _tss
 
struct  _cpu_
 

Macros

#define IA32_EFER   0xC0000080
 
#define IA32_STAR   0xC0000081
 
#define IA32_LSTAR   0xC0000082
 
#define IA32_CSTAR   0xC0000083
 
#define IA32_SFMASK   0xC0000084
 
#define IA32_SYSENTER_CS   0x174
 
#define IA32_SYSENTER_ESP   0x175
 
#define IA32_SYSENTER_EIP   0x176
 
#define IA32_EFLAGS_INTR   (1<<9)
 
#define IA32_EFLAGS_DIRF   (1<<10)
 
#define MSR_IA32_MISC_ENABLE   0x1A0
 
#define MSR_IA32_ENERGY_PERF_BIAS   0x1B0
 
#define MSR_IA32_PERF_CTL   0x199
 
#define MSR_IA32_PERF_STATUS   0x198
 
#define MSR_IA32_PM_ENABLE   0x770
 
#define MSR_IA32_HWP_CAPABILITIES   0x771
 
#define MSR_IA32_HWP_REQUEST_PKG   0x772
 
#define MSR_IA32_HWP_INTERRUPT   0x773
 
#define MSR_IA32_HWP_REQUEST   0x774
 
#define MSR_IA32_HWP_PECI_REQUEST_INFO   0x775
 
#define MSR_IA32_HWP_STATUS   0x777
 
#define MSR_IA32_FS_BASE   0xC0000100
 
#define MSR_IA32_GS_BASE   0xC0000101
 
#define MSR_IA32_KERNELGS_BASE   0xC0000102
 
#define IA32_EFER   0xC0000080
 

Typedefs

typedef struct _stack_frame_ stack_frame
 
typedef struct _regs_ctx_ x86_64_cpu_regs_t
 
typedef struct _tss TSS
 
typedef struct _cpu_ CPUStruc
 

Functions

void x86_64_enable_syscall_ext ()
 
void x86_64_init_user (size_t bit)
 
void x86_64_init_user_ap (size_t bit)
 
TSSx86_64_get_tss ()
 
void x86_64_hal_cpu_feature_enable ()
 
bool x86_64_is_cpu_fxsave_supported ()
 
uint64_t x86_64_cpu_msi_address (uint64_t *data, size_t vector, uint32_t processor, uint8_t edge, uint8_t deassert)
 
void x86_64_cpu_initialize (uint8_t num_cpu)
 
void x86_64_set_ap_start_bit (bool value)
 
void x86_64_initialise_syscall ()
 
uint64_t cpu_read_tsc ()
 
void x86_64_measure_cpu_speed ()
 
uint64_t x86_64_cpu_get_mhz ()
 
int x86_64_gettimeofday (timeval *t)
 
void updateTicks (uint64_t ticks, uint64_t *timerTick, uint64_t *timerSubticks)
 
void x86_64_calculate_ticks (uint64_t milliseconds, uint64_t subsec, uint64_t *out_milliseconds, uint64_t *out_subsec)
 
AU_EXTERN AU_EXPORT void x86_64_udelay (uint64_t usec)
 

Macro Definition Documentation

◆ IA32_CSTAR

#define IA32_CSTAR   0xC0000083

◆ IA32_EFER [1/2]

#define IA32_EFER   0xC0000080

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury 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.

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 HOLDER 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.

◆ IA32_EFER [2/2]

#define IA32_EFER   0xC0000080

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury 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.

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 HOLDER 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.

◆ IA32_EFLAGS_DIRF

#define IA32_EFLAGS_DIRF   (1<<10)

◆ IA32_EFLAGS_INTR

#define IA32_EFLAGS_INTR   (1<<9)

◆ IA32_LSTAR

#define IA32_LSTAR   0xC0000082

◆ IA32_SFMASK

#define IA32_SFMASK   0xC0000084

◆ IA32_STAR

#define IA32_STAR   0xC0000081

◆ IA32_SYSENTER_CS

#define IA32_SYSENTER_CS   0x174

◆ IA32_SYSENTER_EIP

#define IA32_SYSENTER_EIP   0x176

◆ IA32_SYSENTER_ESP

#define IA32_SYSENTER_ESP   0x175

◆ MSR_IA32_ENERGY_PERF_BIAS

#define MSR_IA32_ENERGY_PERF_BIAS   0x1B0

◆ MSR_IA32_FS_BASE

#define MSR_IA32_FS_BASE   0xC0000100

◆ MSR_IA32_GS_BASE

#define MSR_IA32_GS_BASE   0xC0000101

◆ MSR_IA32_HWP_CAPABILITIES

#define MSR_IA32_HWP_CAPABILITIES   0x771

◆ MSR_IA32_HWP_INTERRUPT

#define MSR_IA32_HWP_INTERRUPT   0x773

◆ MSR_IA32_HWP_PECI_REQUEST_INFO

#define MSR_IA32_HWP_PECI_REQUEST_INFO   0x775

◆ MSR_IA32_HWP_REQUEST

#define MSR_IA32_HWP_REQUEST   0x774

◆ MSR_IA32_HWP_REQUEST_PKG

#define MSR_IA32_HWP_REQUEST_PKG   0x772

◆ MSR_IA32_HWP_STATUS

#define MSR_IA32_HWP_STATUS   0x777

◆ MSR_IA32_KERNELGS_BASE

#define MSR_IA32_KERNELGS_BASE   0xC0000102

◆ MSR_IA32_MISC_ENABLE

#define MSR_IA32_MISC_ENABLE   0x1A0

◆ MSR_IA32_PERF_CTL

#define MSR_IA32_PERF_CTL   0x199

◆ MSR_IA32_PERF_STATUS

#define MSR_IA32_PERF_STATUS   0x198

◆ MSR_IA32_PM_ENABLE

#define MSR_IA32_PM_ENABLE   0x770

Typedef Documentation

◆ CPUStruc

typedef struct _cpu_ CPUStruc

◆ stack_frame

typedef struct _stack_frame_ stack_frame

◆ TSS

typedef struct _tss TSS

◆ x86_64_cpu_regs_t

typedef struct _regs_ctx_ x86_64_cpu_regs_t

Function Documentation

◆ cpu_read_tsc()

uint64_t cpu_read_tsc ( )
extern

◆ updateTicks()

void updateTicks ( uint64_t  ticks,
uint64_t timerTick,
uint64_t timerSubticks 
)
extern

◆ x86_64_calculate_ticks()

void x86_64_calculate_ticks ( uint64_t  milliseconds,
uint64_t  subsec,
uint64_t out_milliseconds,
uint64_t out_subsec 
)

◆ x86_64_cpu_get_mhz()

uint64_t x86_64_cpu_get_mhz ( )
extern

◆ x86_64_cpu_initialize()

void x86_64_cpu_initialize ( uint8_t  num_cpu)
extern

fixed address

◆ x86_64_cpu_msi_address()

uint64_t x86_64_cpu_msi_address ( uint64_t data,
size_t  vector,
uint32_t  processor,
uint8_t  edge,
uint8_t  deassert 
)
extern

◆ x86_64_enable_syscall_ext()

void x86_64_enable_syscall_ext ( )
extern

◆ x86_64_get_tss()

TSS * x86_64_get_tss ( )
extern

◆ x86_64_gettimeofday()

int x86_64_gettimeofday ( timeval t)
extern

◆ x86_64_hal_cpu_feature_enable()

void x86_64_hal_cpu_feature_enable ( )
extern

◆ x86_64_init_user()

void x86_64_init_user ( size_t  bit)
extern

◆ x86_64_init_user_ap()

void x86_64_init_user_ap ( size_t  bit)
extern

◆ x86_64_initialise_syscall()

void x86_64_initialise_syscall ( )
extern

◆ x86_64_is_cpu_fxsave_supported()

bool x86_64_is_cpu_fxsave_supported ( )
extern

◆ x86_64_measure_cpu_speed()

void x86_64_measure_cpu_speed ( )
extern

◆ x86_64_set_ap_start_bit()

void x86_64_set_ap_start_bit ( bool  value)
extern

◆ x86_64_udelay()

AU_EXTERN AU_EXPORT void x86_64_udelay ( uint64_t  usec)