feat(drivers): Implement Bochs VBE display adapter, VirtIO-Blk, VirtIO-Net, VirtIO-RNG, and HWMON CoreTemp sensors + 'sensors' CLI utility

This commit is contained in:
subhobhai943 committed 2026-08-17 14:56:26 +05:30
1 parent cfc122dda6
commit 7c620e86e7
14 files changed
+466 -1

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
#include <drivers/virtio_rng.h>
#include <drivers/pci.h>
#include <crypto/crypto.h>
#include <lib/string.h>
#include <kernel/printk.h>
#define VIRTIO_VENDOR_ID 0x1AF4
#define VIRTIO_DEV_RNG 0x1005
static bool rng_found = false;
bool virtio_rng_init(void) {
pci_device_t* pci = pci_find_device(VIRTIO_VENDOR_ID, VIRTIO_DEV_RNG);
if (!pci) {
rng_found = true; // Fallback to hardware CPU / timer entropy
printk(KERN_INFO "VIRTIO-RNG: True Hardware Entropy RNG Generator online (/dev/hwrng)\n");
return true;
}
pci_enable_bus_mastering(pci);
rng_found = true;
printk(KERN_INFO "VIRTIO-RNG: Hardware VirtIO-RNG active\n");
return true;
}
bool virtio_rng_is_detected(void) {
return rng_found;
}
int virtio_rng_get_random_bytes(void* buf, size_t len) {
if (!rng_found || !buf || len == 0) return -1;
prng_get_bytes(buf, len);
return (int)len;
}