Main Page | Class List | Directories | File List | Class Members | File Members

vm_run.c File Reference

CKPM virtual machine execution unit. More...

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include "vm_instr.h"
#include "vm.h"
#include "vm_asm.h"
#include "vm_heap.h"

Functions

void not_implemented (struct instr_set_entry *e)
 this subroutine writes an error message for not implemented instructions.
void dump_stack (int verbose, vm_mem_t *vm)
 this subroutine dumps the current machine stack to stderr
void dump_status (int verbose, vm_mem_t *vm)
 this subroutine dumps the current machine status to stderr
void dump_instruction (int verbose, struct instr_set_entry *e, int arg, int pc)
 this subroutine writes a disassembled instruction to stderr
void instr_fopen (int verbose, vm_mem_t *vm)
 implementation of FOPEN virual machine instruction
void instr_fclose (int verbose, vm_mem_t *vm)
 implementation of FCLOSE virual machine instruction
void instr_putc (int verbose, vm_mem_t *vm)
 implementation of PUTC virual machine instruction
void instr_getc (int verbose, vm_mem_t *vm)
 implementation of GETC virual machine instruction
void instr_read (int verbose, vm_mem_t *vm)
 implementation of READ virual machine instruction
void instr_write (int verbose, vm_mem_t *vm)
 implementation of WRITE virual machine instruction
void instr_new (int verbose, vm_mem_t *vm)
 implementation of NEW virual machine instruction
void instr_del (int verbose, vm_mem_t *vm)
 implementation of DEL virual machine instruction
void instr_ret_i (int verbose, vm_mem_t *vm)
 implementation of RET_I virual machine instruction
void instr_ret_l (int verbose, vm_mem_t *vm)
 implementation of RET_L virual machine instruction
void instr_ret_f (int verbose, vm_mem_t *vm)
 implementation of RET_F virual machine instruction
void instr_ret_d (int verbose, vm_mem_t *vm)
 implementation of RET_D virual machine instruction
void instr_ret (int verbose, vm_mem_t *vm)
 implementation of RET virual machine instruction
void instr_jsr (int verbose, vm_mem_t *vm, vm_addr_t dest)
 implementation of JSR virual machine instruction
int run_vm (int verbose, vm_mem_t *vm)
 run the loaded executable


Detailed Description

CKPM virtual machine execution unit.


Function Documentation

void dump_instruction int  verbose,
struct instr_set_entry e,
int  arg,
int  pc
[inline]
 

this subroutine writes a disassembled instruction to stderr

Parameters:
verbose if > 0 this function will provide verbose output
e the pointer to the current instruction description
arg the argument value of the instruction
pc the actual program counter

void dump_stack int  verbose,
vm_mem_t vm
[inline]
 

this subroutine dumps the current machine stack to stderr

Parameters:
verbose if > 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void dump_status int  verbose,
vm_mem_t vm
[inline]
 

this subroutine dumps the current machine status to stderr

Parameters:
verbose if > 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_del int  verbose,
vm_mem_t vm
[inline]
 

implementation of DEL virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_fclose int  verbose,
vm_mem_t vm
[inline]
 

implementation of FCLOSE virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_fopen int  verbose,
vm_mem_t vm
[inline]
 

implementation of FOPEN virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_getc int  verbose,
vm_mem_t vm
[inline]
 

implementation of GETC virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_jsr int  verbose,
vm_mem_t vm,
vm_addr_t  dest
[inline]
 

implementation of JSR virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory
dest the detination addres of the subroutine

void instr_new int  verbose,
vm_mem_t vm
[inline]
 

implementation of NEW virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_putc int  verbose,
vm_mem_t vm
[inline]
 

implementation of PUTC virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_read int  verbose,
vm_mem_t vm
[inline]
 

implementation of READ virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_ret int  verbose,
vm_mem_t vm
[inline]
 

implementation of RET virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_ret_d int  verbose,
vm_mem_t vm
[inline]
 

implementation of RET_D virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_ret_f int  verbose,
vm_mem_t vm
[inline]
 

implementation of RET_F virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_ret_i int  verbose,
vm_mem_t vm
[inline]
 

implementation of RET_I virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_ret_l int  verbose,
vm_mem_t vm
[inline]
 

implementation of RET_L virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void instr_write int  verbose,
vm_mem_t vm
[inline]
 

implementation of WRITE virual machine instruction

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory

void not_implemented struct instr_set_entry e  )  [inline]
 

this subroutine writes an error message for not implemented instructions.

Parameters:
e the pointer to the current instruction description.

int run_vm int  verbose,
vm_mem_t vm
 

run the loaded executable

Parameters:
verbose if != 0 this function will provide verbose output
vm the pointer to the virtual machine memory
Returns:
0 on success, 1 otherwise
This function executes the instructions as provided in vm_memory.


Generated on Thu Jul 13 03:56:37 2006 for CKPMcc by  doxygen 1.4.4