Initial git commit of kernel code from latest version in fossil. This only includes the base kernel code and LICENSE, not any makefiles or dependencies from libc etc. (the build environment itself hasn't been moved over to git yet)

This commit is contained in:
2025-06-08 20:13:19 +10:00
parent 18a84697ef
commit c0efdc3b0f
62 changed files with 9395 additions and 0 deletions

42
vmrd.h Normal file
View File

@ -0,0 +1,42 @@
// This is NEW CODE, a VM ram/disk access driver for use in the VM
// This driver is intended to be very simple to read/write blocks.
#ifndef _VMRD_H
#define _VMRD_H
#include "diskio.h"
// The address of the first register is the same as for virtio disk but
// the interface (to simplify kernel memory maps) but will use a
// different magic number.
#define VMRD_BASEADDRESS 0x0000000010001000UL
#define VMRD_REG_MAGIC 0
#define VMRD_REG_BLKSIZE 4
#define VMRD_REG_MEMADDR 8
#define VMRD_REG_BLKADDR 16
#define VMRD_REG_ACTION 24
// The magic number is BA5DB105
#define VMRD_MAGIC 0xBA5DB105
// These defines work like global variables for accessing the registers.
#define vmrd_magic *((unsigned int*)(VMRD_BASEADDRESS + VMRD_REG_MAGIC))
#define vmrd_blksize *((unsigned int*)(VMRD_BASEADDRESS + VMRD_REG_BLKSIZE))
#define vmrd_memaddr *((unsigned long*)(VMRD_BASEADDRESS + VMRD_REG_MEMADDR))
#define vmrd_blkaddr *((unsigned long*)(VMRD_BASEADDRESS + VMRD_REG_BLKADDR))
#define vmrd_action *((unsigned int*)(VMRD_BASEADDRESS + VMRD_REG_ACTION))
// Returns a major version number >= 1 if the virtual ram/disk device is
// present and 0 otherwise.
int vmrd_present();
// Initialises vmrd, returning a non-zero value on failure (e.g. if not present)
int vmrd_init();
// Performs a read/write of a block.
int vmrd_rw(diskio_buffer_t* buffer, int writing);
// This doesn't really belong here but is used to enable/disable debug
// tracing in the VM.
void vmrd_settracing(int onoroff);
// From ifndef at end of file:
#endif