XenevaOS
Loading...
Searching...
No Matches
Functions
x86_64_lowlevel.h File Reference
#include <stdint.h>
#include <aurora.h>
Include dependency graph for x86_64_lowlevel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

AU_EXTERN AU_EXPORT void x64_cli ()
 
AU_EXTERN AU_EXPORT void x64_sti ()
 
void x64_hlt ()
 
uint8_t x64_inportb (uint16_t port)
 in & out port functions
 
uint16_t x64_inportw (uint16_t port)
 
uint32_t x64_inportd (uint16_t port)
 
void x64_outportb (uint16_t port, uint8_t data)
 
void x64_outportw (uint16_t port, uint16_t data)
 
void x64_outportd (uint16_t port, uint32_t data)
 
uint64_t x64_read_msr (size_t msr)
 MSR functions.
 
void x64_write_msr (size_t msr, uint64_t data)
 
void x64_mfence ()
 Mfench.
 
void x64_pause ()
 Pause.
 
void x64_cpuid (size_t page, size_t *a, size_t *b, size_t *c, size_t *d, size_t subpage=0)
 x64_cpuid
 
size_t x64_read_cr0 ()
 Control Register.
 
size_t x64_read_cr2 ()
 
size_t x64_read_cr3 ()
 
size_t x64_read_cr4 ()
 
void x64_write_cr0 (size_t)
 
void x64_write_cr3 (size_t)
 
void x64_write_cr4 (size_t)
 
void x64_lgdt (void *location)
 GDT & IDT Function.
 
void x64_sgdt (void *location)
 
void x86_64_idt_test ()
 
void flush_tlb (void *addr)
 TLB Flush.
 
void cache_flush ()
 
void x64_atom_exchange (size_t r1, size_t r2)
 
void x64_fxsave (uint8_t *location)
 
void x64_fxrstor (uint8_t *location)
 
uint8_t x64_fs_readb (size_t offset)
 
uint16_t x64_fs_readw (size_t offset)
 
uint32_t x64_fs_readd (size_t offset)
 
uint64_t x64_fs_readq (size_t offset)
 
void x64_fs_writeb (size_t offset, uint8_t val)
 
void x64_fs_writew (size_t offset, uint16_t val)
 
void x64_fs_writed (size_t offset, uint32_t val)
 
void x64_fs_writeq (size_t offset, uint64_t val)
 
uint8_t x64_gs_readb (size_t offset)
 
uint16_t x64_gs_readw (size_t offset)
 
uint32_t x64_gs_readd (size_t offset)
 
uint64_t x64_gs_readq (size_t offset)
 
void x64_gs_writeb (size_t offset, uint8_t val)
 
void x64_gs_writew (size_t offset, uint16_t val)
 
void x64_gs_writed (size_t offset, uint32_t val)
 
void x64_gs_writeq (size_t offset, uint64_t val)
 
void x64_ldmxcsr (uint32_t *location)
 
void x64_stmxcsr (uint32_t *location)
 
void x64_set_kstack (void *ktss, size_t stack)
 
size_t x64_get_kstack (void *ktss)
 
uint64_t x64_kesp_get_top ()
 
void x64_rdtsc (uint32_t *hi, uint32_t *lo)
 
void x64_lidt (void *location)
 Interrupt Descriptor Table functions.
 
void x64_sidt (void *location)
 
void x64_ltr (uint16_t seg)
 
void x64_enter_user (uint64_t stack, uint64_t entry_addr, uint64_t cs, uint64_t ss)
 
void x64_force_sched ()
 
bool x64_lock_test (volatile size_t *lock, size_t old_value, size_t new_value)
 

Function Documentation

◆ cache_flush()

void cache_flush ( )

◆ flush_tlb()

void flush_tlb ( void *  addr)

TLB Flush.

◆ x64_atom_exchange()

void x64_atom_exchange ( size_t  r1,
size_t  r2 
)

◆ x64_cli()

AU_EXTERN AU_EXPORT void x64_cli ( )

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

G L O B A L F U N C T I O N S

◆ x64_cpuid()

void x64_cpuid ( size_t  page,
size_t a,
size_t b,
size_t c,
size_t d,
size_t  subpage = 0 
)

x64_cpuid

◆ x64_enter_user()

void x64_enter_user ( uint64_t  stack,
uint64_t  entry_addr,
uint64_t  cs,
uint64_t  ss 
)

◆ x64_force_sched()

void x64_force_sched ( )

◆ x64_fs_readb()

uint8_t x64_fs_readb ( size_t  offset)

◆ x64_fs_readd()

uint32_t x64_fs_readd ( size_t  offset)

◆ x64_fs_readq()

uint64_t x64_fs_readq ( size_t  offset)

◆ x64_fs_readw()

uint16_t x64_fs_readw ( size_t  offset)

◆ x64_fs_writeb()

void x64_fs_writeb ( size_t  offset,
uint8_t  val 
)

◆ x64_fs_writed()

void x64_fs_writed ( size_t  offset,
uint32_t  val 
)

◆ x64_fs_writeq()

void x64_fs_writeq ( size_t  offset,
uint64_t  val 
)

◆ x64_fs_writew()

void x64_fs_writew ( size_t  offset,
uint16_t  val 
)

◆ x64_fxrstor()

void x64_fxrstor ( uint8_t location)

◆ x64_fxsave()

void x64_fxsave ( uint8_t location)

FXSAVE/FXRSTOR

◆ x64_get_kstack()

size_t x64_get_kstack ( void *  ktss)

◆ x64_gs_readb()

uint8_t x64_gs_readb ( size_t  offset)

◆ x64_gs_readd()

uint32_t x64_gs_readd ( size_t  offset)

◆ x64_gs_readq()

uint64_t x64_gs_readq ( size_t  offset)

◆ x64_gs_readw()

uint16_t x64_gs_readw ( size_t  offset)

◆ x64_gs_writeb()

void x64_gs_writeb ( size_t  offset,
uint8_t  val 
)

◆ x64_gs_writed()

void x64_gs_writed ( size_t  offset,
uint32_t  val 
)

◆ x64_gs_writeq()

void x64_gs_writeq ( size_t  offset,
uint64_t  val 
)

◆ x64_gs_writew()

void x64_gs_writew ( size_t  offset,
uint16_t  val 
)

◆ x64_hlt()

void x64_hlt ( )

◆ x64_inportb()

uint8_t x64_inportb ( uint16_t  port)

in & out port functions

◆ x64_inportd()

uint32_t x64_inportd ( uint16_t  port)

◆ x64_inportw()

uint16_t x64_inportw ( uint16_t  port)

◆ x64_kesp_get_top()

uint64_t x64_kesp_get_top ( )

◆ x64_ldmxcsr()

void x64_ldmxcsr ( uint32_t location)

◆ x64_lgdt()

void x64_lgdt ( void *  location)

GDT & IDT Function.

◆ x64_lidt()

void x64_lidt ( void *  location)

Interrupt Descriptor Table functions.

◆ x64_lock_test()

bool x64_lock_test ( volatile size_t lock,
size_t  old_value,
size_t  new_value 
)

◆ x64_ltr()

void x64_ltr ( uint16_t  seg)

◆ x64_mfence()

void x64_mfence ( )

Mfench.

◆ x64_outportb()

void x64_outportb ( uint16_t  port,
uint8_t  data 
)

◆ x64_outportd()

void x64_outportd ( uint16_t  port,
uint32_t  data 
)

◆ x64_outportw()

void x64_outportw ( uint16_t  port,
uint16_t  data 
)

◆ x64_pause()

void x64_pause ( )

Pause.

◆ x64_rdtsc()

void x64_rdtsc ( uint32_t hi,
uint32_t lo 
)

◆ x64_read_cr0()

size_t x64_read_cr0 ( )

Control Register.

◆ x64_read_cr2()

size_t x64_read_cr2 ( )

◆ x64_read_cr3()

size_t x64_read_cr3 ( )

◆ x64_read_cr4()

size_t x64_read_cr4 ( )

◆ x64_read_msr()

uint64_t x64_read_msr ( size_t  msr)

MSR functions.

◆ x64_set_kstack()

void x64_set_kstack ( void *  ktss,
size_t  stack 
)

◆ x64_sgdt()

void x64_sgdt ( void *  location)

◆ x64_sidt()

void x64_sidt ( void *  location)

◆ x64_sti()

AU_EXTERN AU_EXPORT void x64_sti ( )

◆ x64_stmxcsr()

void x64_stmxcsr ( uint32_t location)

◆ x64_write_cr0()

void x64_write_cr0 ( size_t  )

◆ x64_write_cr3()

void x64_write_cr3 ( size_t  )

◆ x64_write_cr4()

void x64_write_cr4 ( size_t  )

◆ x64_write_msr()

void x64_write_msr ( size_t  msr,
uint64_t  data 
)

◆ x86_64_idt_test()

void x86_64_idt_test ( )