Macros
constants.h File Reference

Go to the source code of this file.

Macros

#define BAREFLANK_VERSION_MAJOR   1ULL
 
#define BAREFLANK_VERSION_MINOR   1ULL
 
#define BAREFLANK_VERSION_PATCH   0ULL
 
#define USER_VERSION_MAJOR   0ULL
 
#define USER_VERSION_MINOR   0ULL
 
#define USER_VERSION_PATCH   0ULL
 
#define MAX_CACHE_LINE_SHIFT   (6ULL)
 
#define MAX_CACHE_LINE_SIZE   (1 << MAX_CACHE_LINE_SHIFT)
 
#define MAX_PAGE_SHIFT   (12ULL)
 
#define MAX_PAGE_SIZE   (1ULL << MAX_PAGE_SHIFT)
 
#define MAX_HEAP_POOL   (256ULL * MAX_PAGE_SIZE * sizeof(uintptr_t))
 
#define MAX_PAGE_POOL   (32 * 256ULL * MAX_PAGE_SIZE)
 
#define MAX_MEM_MAP_POOL   (256ULL * MAX_PAGE_SIZE * sizeof(uintptr_t))
 
#define MEM_MAP_POOL_START   0x200000ULL
 
#define MAX_NUM_MODULES   (75LL)
 
#define DEBUG_RING_SHIFT   (15)
 
#define DEBUG_RING_SIZE   (1 << DEBUG_RING_SHIFT)
 
#define STACK_SIZE   (1ULL << 15)
 
#define THREAD_LOCAL_STORAGE_SIZE   (0x1000ULL)
 
#define STACK_RESERVED   (0x20)
 
#define VMCALL_IN_BUFFER_SIZE   (32 * MAX_PAGE_SIZE)
 
#define VMCALL_OUT_BUFFER_SIZE   (32 * MAX_PAGE_SIZE)
 
#define DEFAULT_COM_PORT   0x3F8U
 
#define DEFAULT_BAUD_RATE   baud_rate_9600
 
#define DEFAULT_DATA_BITS   char_length_8
 
#define DEFAULT_STOP_BITS   stop_bits_1
 
#define DEFAULT_PARITY_BITS   parity_none
 
#define SECONDARY_ENABLE_IF_VERBOSE   true
 

Macro Definition Documentation

◆ BAREFLANK_VERSION_MAJOR

#define BAREFLANK_VERSION_MAJOR   1ULL

Definition at line 43 of file constants.h.

◆ BAREFLANK_VERSION_MINOR

#define BAREFLANK_VERSION_MINOR   1ULL

Definition at line 44 of file constants.h.

◆ BAREFLANK_VERSION_PATCH

#define BAREFLANK_VERSION_PATCH   0ULL

Definition at line 45 of file constants.h.

◆ USER_VERSION_MAJOR

#define USER_VERSION_MAJOR   0ULL

Definition at line 53 of file constants.h.

◆ USER_VERSION_MINOR

#define USER_VERSION_MINOR   0ULL

Definition at line 57 of file constants.h.

◆ USER_VERSION_PATCH

#define USER_VERSION_PATCH   0ULL

Definition at line 61 of file constants.h.

◆ MAX_CACHE_LINE_SHIFT

#define MAX_CACHE_LINE_SHIFT   (6ULL)

Definition at line 75 of file constants.h.

◆ MAX_CACHE_LINE_SIZE

#define MAX_CACHE_LINE_SIZE   (1 << MAX_CACHE_LINE_SHIFT)

Definition at line 88 of file constants.h.

◆ MAX_PAGE_SHIFT

#define MAX_PAGE_SHIFT   (12ULL)

Definition at line 102 of file constants.h.

◆ MAX_PAGE_SIZE

#define MAX_PAGE_SIZE   (1ULL << MAX_PAGE_SHIFT)

Definition at line 116 of file constants.h.

◆ MAX_HEAP_POOL

#define MAX_HEAP_POOL   (256ULL * MAX_PAGE_SIZE * sizeof(uintptr_t))

Definition at line 130 of file constants.h.

◆ MAX_PAGE_POOL

#define MAX_PAGE_POOL   (32 * 256ULL * MAX_PAGE_SIZE)

Definition at line 142 of file constants.h.

◆ MAX_MEM_MAP_POOL

#define MAX_MEM_MAP_POOL   (256ULL * MAX_PAGE_SIZE * sizeof(uintptr_t))

Definition at line 154 of file constants.h.

◆ MEM_MAP_POOL_START

#define MEM_MAP_POOL_START   0x200000ULL

Definition at line 166 of file constants.h.

◆ MAX_NUM_MODULES

#define MAX_NUM_MODULES   (75LL)

Definition at line 177 of file constants.h.

◆ DEBUG_RING_SHIFT

#define DEBUG_RING_SHIFT   (15)

Debug Ring Shift

Defines the size of the debug ring. Note that each vCPU gets one of these, and thus the total amount of memory that is used can add up quickly. That being said, make these as large as you can afford. Also note that these will be allocated using the mem pool, so make sure that it is large enough to hold the debug rings for each vCPU and then some.

Note: defined in shifted bits

Definition at line 192 of file constants.h.

◆ DEBUG_RING_SIZE

#define DEBUG_RING_SIZE   (1 << DEBUG_RING_SHIFT)

Debug Ring Size

Defines the size of the debug ring. Note that each vCPU gets one of these, and thus the total amount of memory that is used can add up quickly. That being said, make these as large as you can afford. Also note that these will be allocated using the mem pool, so make sure that it is large enough to hold the debug rings for each vCPU and then some.

Note: defined in bytes

Definition at line 206 of file constants.h.

◆ STACK_SIZE

#define STACK_SIZE   (1ULL << 15)

Stack Size

Each entry function is guarded with a custom stack to prevent stack overflows from corrupting the kernel, as well as providing a larger stack that common in userspace code, but not in the kernel. If stack corruption is occuring, this function likely needs to be increased. Note one stack frame is allocated per CPU, so only increase this if needed.

Note: Must be defined using a bit shift as we will mask to get the bottom of the stack if needed.

Note: This is hard coded in the thread_context.asm as there is no way to use this include in NASM. If you change this, you must change this in this file as well.

Definition at line 225 of file constants.h.

◆ THREAD_LOCAL_STORAGE_SIZE

#define THREAD_LOCAL_STORAGE_SIZE   (0x1000ULL)

Thread Local Storage (TLS) Size

Bareflank doesn't support threads, but it does support Multi-Core, and this we need a way to store CPU specific information. Certain libc++ operations (for example, std::uncaught_exceptions) needs to use this CPU specific storage so that the cores are not interfering with each other. So as far as the code is concerned, TLS is being used, even if a "thread" in the traditional sense isn't.

Note: Defined in bytes

Definition at line 241 of file constants.h.

◆ STACK_RESERVED

#define STACK_RESERVED   (0x20)

Stack Reserved

The bottom of the stack is reserved for storing useful information (similar to the Linux kernel). The following defines how much of the stack is reserved.

Note: Defined in bytes

Definition at line 254 of file constants.h.

◆ VMCALL_IN_BUFFER_SIZE

#define VMCALL_IN_BUFFER_SIZE   (32 * MAX_PAGE_SIZE)

VMCall In Buffer Size (MAX)

Note: Defined in bytes

Definition at line 263 of file constants.h.

◆ VMCALL_OUT_BUFFER_SIZE

#define VMCALL_OUT_BUFFER_SIZE   (32 * MAX_PAGE_SIZE)

VMCall Out Buffer Size (MAX)

Note: Defined in bytes

Definition at line 272 of file constants.h.

◆ DEFAULT_COM_PORT

#define DEFAULT_COM_PORT   0x3F8U

Default Serial COM Port

Possible values include:

  • 0x3F8U // COM1
  • 0x2F8U // COM2
  • 0x3E8U // COM3
  • 0x2E8U // COM4
  • 0xE000
  • 0xE010

Note: See bfvmm/serial/serial_port_intel_x64.h

Definition at line 289 of file constants.h.

◆ DEFAULT_BAUD_RATE

#define DEFAULT_BAUD_RATE   baud_rate_9600

Default Serial Baud Rate

Note: See bfvmm/serial/serial_port_intel_x64.h

Definition at line 298 of file constants.h.

◆ DEFAULT_DATA_BITS

#define DEFAULT_DATA_BITS   char_length_8

Default Serial Data Bits

Note: See bfvmm/serial/serial_port_intel_x64.h

Definition at line 307 of file constants.h.

◆ DEFAULT_STOP_BITS

#define DEFAULT_STOP_BITS   stop_bits_1

Default Serial Stop Bits

Note: See bfvmm/serial/serial_port_intel_x64.h

Definition at line 316 of file constants.h.

◆ DEFAULT_PARITY_BITS

#define DEFAULT_PARITY_BITS   parity_none

Default Serial Parity Bits

Note: See bfvmm/serial/serial_port_intel_x64.h

Definition at line 325 of file constants.h.

◆ SECONDARY_ENABLE_IF_VERBOSE

#define SECONDARY_ENABLE_IF_VERBOSE   true

Secondary Enable If Verbosity

On VMWare, certain secondary controls are not needed but we throw a warning so that people know there is an issue. Use this to turn this warning off

Definition at line 336 of file constants.h.