Skip to content

Error Codes

Adam Mathlay edited this page Nov 26, 2024 · 3 revisions

MVM Error Codes

This table lists the error codes used by the MVM, along with their corresponding exception types and descriptions. These error codes are used to signal that an error has occured. Error codes are generally used to signal non-critical errors, allowing the program to handle them gracefully. Critical errors will halt the VM.

Error Code Exception Name Description Notes
1 InvalidRegisterException An invalid register was accessed or manipulated. Typically indicates a programming error (incorrect register name or type).
2 InvalidMemoryAddressException An attempt was made to access memory outside the allocated bounds for a process or a null address was accessed. Indicates a programming error (incorrect memory address calculation or access to an uninitialized pointer).
3 InvalidInstructionException An unknown or unsupported instruction was encountered. Indicates a programming error (typo in the assembly code or use of an unsupported instruction).
4 InvalidSystemCallException An invalid system call ID was used. Indicates a programming error (incorrect system call ID or arguments).
5 StackOverflowException The stack has exceeded its maximum capacity. Indicates a program error (e.g., infinite recursion, excessive function calls).
6 EmptyStackException An attempt was made to pop from or peek at an empty stack. Indicates a program error (mismatched PUSH and POP instructions or attempting to access the stack without any elements).
7 ArithmeticException A general arithmetic error occurred (e.g., division by zero, overflow). Indicates a program error or the result of an operation exceeded the maximum value that can be stored in memory.
8 SystemCallGeneralException A general error occurred during a system call. This is a generic system call error. The specific cause will be in ESF (Error Specific Flag).
9 FileAccessException An error occurred during file access (e.g., file not found, permission denied). Indicates a problem accessing a file in the virtual file system or in the host system. Check file permissions and the existence of the file.
10 SocketException An error occurred during a socket operation. (If networking is implemented). Indicates a problem with network communication. Check network configuration and connectivity.
11 MemoryAllocationException Memory allocation failed (e.g., insufficient memory). Indicates insufficient free memory or a potential issue with the memory manager.
12 InvalidInstructionArgumentException An instruction was provided with an invalid argument. Indicates a programming error (wrong number of arguments, incorrect argument type).
13 NullRegisterException An attempt was made to read from an uninitialized register. Indicates a program error where the register is not initialised before being read.
14 NullAddressException A null address was accessed. Indicates a program error where a null value was used as a memory address (usually an uninitialized pointer).
15 InvalidFileDescriptorException An invalid file descriptor was used. Indicates that a file descriptor was used incorrectly (e.g., trying to read from a closed file).
16 NotFreeMemoryException An attempt was made to write to a memory location that is already in use. Indicates a program error where two parts of a program are trying to write to the same memory location.
17 GeneralBitwiseException A general error occurred during a bitwise operation. This is a broad category of errors. The specific reason for the error can be found in ESF (Error Specific Flag).
18 GeneralControlFlowException A general error occurred during control flow (jumps, branches). The cause can be found in the ESF (Error Specific Flag) register.
19 GeneralDataTransferException A general error occurred during data transfer (MOV, LIT, etc.). This is a broad category of errors. The specific reason for the error can be found in ESF (Error Specific Flag).
20 GeneralIoAbstractionsException A general error occurred during an I/O operation. This is a broad category of errors. The specific reason for the error can be found in ESF (Error Specific Flag).
21 GeneralMemoryException A general error occurred during memory operations (LOAD, STORE, etc.). This is a broad category of errors. The specific reason for the error can be found in ESF (Error Specific Flag).
22 GeneralStackOperationsException A general error occurred during stack operations (PUSH, POP, PEEK). This is a broad category of errors. The specific reason for the error can be found in ESF (Error Specific Flag).
23 GeneralStringException A general error occurred during string operations (STRLEN, STRCAT, etc.). This is a broad category of errors. The specific reason for the error can be found in ESF (Error Specific Flag).
24 InvalidArgumentException A required argument was missing for an instruction or system call. Check that the correct number of arguments are being passed to functions or system calls.
25 InvalidArgumentFormatException An argument was of an incorrect format or type. Ensure that argument types match the instruction or system call requirements. Check your data types.
26 MissingLibraryException A standard library function or a user-defined function could not be found. Check function names and ensure the library files are loaded correctly.
27 InvalidRegisterTypeException An invalid register type was used in an instruction. This can be caused by typos or passing in the wrong type of register.
28 InvalidPcValueException The program counter was set to an invalid value (outside of the program's allocated memory). Indicates an error in your control-flow instructions or the way you are handling jumps.
29 ProcessNotFound The specified process could not be found. Indicates that a process ID in a system call was invalid.
Clone this wiki locally