XenevaOS
Loading...
Searching...
No Matches
Macros | Enumerations | Functions | Variables
x86_64_cpu.cpp File Reference
#include <Hal/x86_64_cpu.h>
#include <Hal/pcpu.h>
#include <Hal/x86_64_gdt.h>
#include <Hal/x86_64_idt.h>
#include <Hal/x86_64_lowlevel.h>
#include <Hal/apic.h>
#include <Hal/x86_64_ap_init.h>
#include <Mm/pmmngr.h>
#include <Mm/vmmngr.h>
#include <aucon.h>
#include <string.h>
#include <time.h>
#include <Hal/serial.h>
Include dependency graph for x86_64_cpu.cpp:

Macros

#define CMOS_ADDRESS   0x70
 
#define CMOS_DATA   0x71
 
#define fromBCD(val)   ((val / 16) * 10 + (val & 0xf))
 
#define SUBSECONDS_PER_SECOND   1000000
 

Enumerations

enum  {
  CMOS_SECOND = 0 , CMOS_MINUTE = 2 , CMOS_HOUR = 4 , CMOS_DAY = 7 ,
  CMOS_MONTH = 8 , CMOS_YEAR = 9
}
 

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)
 
uint64_t _ICRDest (uint32_t processor)
 
bool _ICRBusy ()
 
void x86_64_cpu_initialize (uint8_t num_cpu)
 
void x86_64_set_ap_start_bit (bool value)
 
void syscall_entry ()
 
void x64_syscall_entry_compat ()
 
void x86_64_initialise_syscall ()
 
uint64_t cpu_read_tsc ()
 
void CMOSDump (uint16_t *val)
 
int isUpdateInProgress (void)
 
uint64_t secs_of_years (int years)
 
uint64_t readCMOS (void)
 
void updateTicks (uint64_t ticks, uint64_t *timerTick, uint64_t *timerSubticks)
 
void x86_64_measure_cpu_speed ()
 
uint64_t x86_64_cpu_get_mhz ()
 
int x86_64_gettimeofday (timeval *t)
 
void x86_64_calculate_ticks (uint64_t milliseconds, uint64_t subsec, uint64_t *out_milliseconds, uint64_t *out_subsec)
 
void x86_64_udelay (uint64_t usec)
 

Variables

TSS_tss
 
bool _fxsave = false
 
uint64_t cpuMhz
 
uint64_t tscBasisTiming
 
uint64_t tscBasisTimingKhz
 
uint64_t bootTime
 
bool __ApStarted
 

Macro Definition Documentation

◆ CMOS_ADDRESS

#define CMOS_ADDRESS   0x70

◆ CMOS_DATA

#define CMOS_DATA   0x71

◆ fromBCD

#define fromBCD (   val)    ((val / 16) * 10 + (val & 0xf))

◆ SUBSECONDS_PER_SECOND

#define SUBSECONDS_PER_SECOND   1000000

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CMOS_SECOND 
CMOS_MINUTE 
CMOS_HOUR 
CMOS_DAY 
CMOS_MONTH 
CMOS_YEAR 

Function Documentation

◆ _ICRBusy()

bool _ICRBusy ( )

◆ _ICRDest()

uint64_t _ICRDest ( uint32_t  processor)

◆ CMOSDump()

void CMOSDump ( uint16_t val)

◆ cpu_read_tsc()

uint64_t cpu_read_tsc ( )

◆ isUpdateInProgress()

int isUpdateInProgress ( void  )

◆ readCMOS()

uint64_t readCMOS ( void  )

◆ secs_of_years()

uint64_t secs_of_years ( int  years)

◆ syscall_entry()

void syscall_entry ( )

◆ updateTicks()

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

◆ x64_syscall_entry_compat()

void x64_syscall_entry_compat ( )

◆ 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 ( )

◆ x86_64_cpu_initialize()

void x86_64_cpu_initialize ( uint8_t  num_cpu)

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 
)

◆ x86_64_enable_syscall_ext()

void x86_64_enable_syscall_ext ( )

◆ x86_64_get_tss()

TSS * x86_64_get_tss ( )

◆ x86_64_gettimeofday()

int x86_64_gettimeofday ( timeval t)

◆ x86_64_hal_cpu_feature_enable()

void x86_64_hal_cpu_feature_enable ( )

◆ x86_64_init_user()

void x86_64_init_user ( size_t  bit)

◆ x86_64_init_user_ap()

void x86_64_init_user_ap ( size_t  bit)

◆ x86_64_initialise_syscall()

void x86_64_initialise_syscall ( )

◆ x86_64_is_cpu_fxsave_supported()

bool x86_64_is_cpu_fxsave_supported ( )

◆ x86_64_measure_cpu_speed()

void x86_64_measure_cpu_speed ( )

◆ x86_64_set_ap_start_bit()

void x86_64_set_ap_start_bit ( bool  value)

◆ x86_64_udelay()

void x86_64_udelay ( uint64_t  usec)

Variable Documentation

◆ __ApStarted

bool __ApStarted

◆ _fxsave

bool _fxsave = false

◆ _tss

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.

◆ bootTime

uint64_t bootTime

◆ cpuMhz

uint64_t cpuMhz

◆ tscBasisTiming

uint64_t tscBasisTiming

◆ tscBasisTimingKhz

uint64_t tscBasisTimingKhz