Core.inc

This file defines the structures, constants, and macros for the entry point into the Core of PwnOS, and includes the rest of the include files for Core.

See Also

Authors

  • Neil G.  Dickson
Summary
Core.incThis file defines the structures, constants, and macros for the entry point into the Core of PwnOS, and includes the rest of the include files for Core.
CALLVECTORLISTThis structure defines the layout of CallVectors, containing the addresses of all Core functions accessible from Libraries.
Enumerations and Constants
Core Call Gate ConstantsThese constants define indices into CallVectors (or CALLVECTORLIST) for use by Libraries calling CoreCallGate.
Core Access Flag ConstantsThese constants define bit indices into CoreAccessFlags to lock access to certain areas of the Core.
Miscellaneous ConstantsThese constants are miscellaneous things that don’t really fit anywhere else at the moment.
Device InterruptsThese are the interrupt numbers chosen for all device interrupts.
Handle Type ConstantsThese constants allow distinguishing of different types of handle structures.

CALLVECTORLIST

This structure defines the layout of CallVectors, containing the addresses of all Core functions accessible from Libraries.

Note: When updating this, update Core Call Gate Constants

Summary
Enumerations and Constants
Core Call Gate ConstantsThese constants define indices into CallVectors (or CALLVECTORLIST) for use by Libraries calling CoreCallGate.
Core Access Flag ConstantsThese constants define bit indices into CoreAccessFlags to lock access to certain areas of the Core.
Miscellaneous ConstantsThese constants are miscellaneous things that don’t really fit anywhere else at the moment.
Device InterruptsThese are the interrupt numbers chosen for all device interrupts.
Handle Type ConstantsThese constants allow distinguishing of different types of handle structures.

Enumerations and Constants

Core Call Gate Constants

These constants define indices into CallVectors (or CALLVECTORLIST) for use by Libraries calling CoreCallGate.

Note: When updating these, update CALLVECTORLIST

Start Value

0 Increment: 1

Members

CG_CREATE_PROCESSCreateProcess
CG_DESTROY_PROCESSDestroyProcess
CG_EXIT_PROCESSExitProcess
CG_GET_CURRENT_PROCESSGetCurrentProcess
CG_CREATE_THREADCreateThread
CG_DESTROY_THREADDestroyThread
CG_PAUSE_THREADPauseThread
CG_RESUME_THREADResumeThread
CG_GET_CURRENT_THREADGetCurrentThread
CG_SLEEP_THREAD<SleepThread>
CG_SCHEDULE_THREAD<ScheduleThread>
CG_GET_LOCKGetLock
CG_RELEASE_LOCKReleaseLock
CG_ATTEMPT_GET_LOCKAttemptGetLock
CG_WAIT_FOR_NOTIFYWaitForNotify
CG_ATTEMPT_WAIT_FOR_NOTIFYAttemptWaitForNotify
CG_NOTIFYNotify
CG_NOTIFY_ALLNotifyAll
CG_ALLOCATE_PAGESAllocatePages
CG_FREE_PAGESFreePages
CG_ALLOCATE_MEMORYAllocateMemory
CG_ALLOCATE_ALIGNED_MEMORYAllocateAlignedMemory
CG_FREE_MEMORYFreeMemory
CG_OPEN_FILEOpenFile
CG_GET_FILE_SIZEGetFileSize
CG_READ_FILEReadFile
CG_WRITE_FILE<WriteFile>
CG_CLOSE_FILECloseFile
CG_GET_GRAPHICS_ACCESS<GetGraphicsAccess>
CG_RELEASE_GRAPHICS_ACCESS<ReleaseGraphicsAccess>
NUM_CALL_GATESthe number of call gate constants

Core Access Flag Constants

These constants define bit indices into CoreAccessFlags to lock access to certain areas of the Core.

Start Value

0 Increment: 1

Members

THREAD_SCHEDULER_ACCESS_BITNUMlock for access to ThreadScheduler

Miscellaneous Constants

These constants are miscellaneous things that don’t really fit anywhere else at the moment.

Members

MAX_NUM_PROCESSORSmaximum number of processors chosen to be allowed (only 15 supported by Pentium 4 anyway)
TESTING_MODETRUE means that testing operations will be compiled-in and FALSE means taht they won’t

Device Interrupts

These are the interrupt numbers chosen for all device interrupts.  Exception interrupts are in PM.inc

Members

INT_PITProgrammable Interval Timer
INT_KEYBOARDPS/2 Keyboard
INT_COM2_COM4Serial ports
INT_COM1_COM3Serial ports
INT_SOUND_CARDSound card
INT_FLOPPYFloppy drives
INT_PARALLELParallel ports
INT_CMOS_CLOCKCMOS clock
INT_MOUSEPS/2 Mouse
INT_IDE0Drives on IDE0
INT_IDE1Drives on IDE1
INT_APIC_ERRORError in APIC operation
INT_APIC_SPURIOUSSpurious interrupt; its number (in hex) ends in F because that’s required on all before Pentium 4
INT_APIC_TIMERAPIC Timer completion
INT_HANGMiscellaneous interrupt used during Boot
INT_USBUSB devices
INT_NETWORKNetwork cards
N_INTERRUPTStotal number of interrupts in IDT

Handle Type Constants

These constants allow distinguishing of different types of handle structures.

Start Value

0 Increment: 1

Members

HANDLE_TYPE_PROCESSidentifies a PROCESSSTRUCT
HANDLE_TYPE_THREADidentifies a THREADSTRUCT
HANDLE_TYPE_FILEidentifies a <FILESTRUCT>
The Core of PwnOS (a.k.a.
CallVectors CALLVECTORLIST <>
This is the CALLVECTORLIST structure containing the addresses to all Core functions acessible from Libraries, indexed by Core Call Gate Constants.
The Libraries section of PwnOS provides common, useful functions and functionality, and a gateway to the Core.
This structure defines the layout of CallVectors, containing the addresses of all Core functions accessible from Libraries.
Entry point into the Core from Libraries.
CoreAccessFlags dword 0
Bits used to lock access to certain areas of the Core (e.g.
This file defines the entry point into the Core of PwnOS, and includes the rest of the Core.
The Sync section of Core provides functions for mutual exclusion.
The Memory section of Core provides memory management functions.
The Threads section of Core provides thread and process management functions, including common scheduling operations.
The Messages section of Core provides functions for sending and receiving messages to and from message queues.
The I/O section of Core provides device management functions.
The Files section of Core provides functions for accessing files and virtual files.
These constants define indices into CallVectors (or CALLVECTORLIST) for use by Libraries calling CoreCallGate.
This procedure creates a new process.
This procedure destroys a process.
This procedure exits the current process, giving the specified return code.
This procedure returns the current process handle.
This procedure creates a new thread of the current process.
This procedure destroys a thread of the current process.
This procedure pauses a thread of the current process.
This procedure resumes a thread of the current process.
This procedure returns the current thread handle.
This procedure gets a lock’s access for the current thread.
This procedure releases a lock so that other threads can get it.
This procedure attempts to get a lock, but if it cannot get a lock, it gives up after a specified timeout period.
This procedure makes the current thread wait to be notified on the specified lock.
This procedure makes the current thread wait to be notified on the specified lock until a specified timeout period elapses.
This procedure notifies a thread waiting on the specified lock (if there is one).
This procedure notifies all threads waiting on the specified lock (if there are any).
This procedure allocates (64KB) physical pages at a specified virtual address (or any free virtual address if not specified), for the current process.
This procedure frees (64KB) virtual pages and any associated physical pages or pagefile entries.
This procedure allocates a range of memory on the heap.
This procedure allocates a range of memory on the heap, aligned to a multiple of a power of 2 bytes.
This procedure frees a range of memory that is allocated on the heap.
This procedure opens a file.
This procedure gets the size of an open file.
This procedure reads data from an open file.
This procedure closes an open file, freeing all of its resources.
Saves the state of the previous task and jumps to the next task to run.
This file contains constants and structures related to Protected Mode.
This segment contains the 1st-level bootstrap code of PwnOS
IDT: INT_DESC offset IntDivError ;00 Divide Error
INTERRUPT DESCRIPTOR TABLE
This structure defines the state of a process.
This structure defines the state of a thread.