1 #include <lunaix/device.h>
2 #include <lunaix/mm/page.h>
5 rng_fill(void* data, size_t len)
12 "jnz 1b" ::"r"((ptr_t)data),
18 __rand_rd_pg(struct device* dev, void* buf, size_t offset)
20 rng_fill(buf, PG_SIZE);
25 __rand_rd(struct device* dev, void* buf, size_t offset, size_t len)
32 pdev_randdev_init(struct device_def* devdef)
34 struct device* devrand = device_addseq(NULL, NULL, "rand");
35 devrand->ops.read = __rand_rd;
36 devrand->ops.read_page = __rand_rd_pg;
41 static struct device_def devrandx86_def = {
43 .class = DEVCLASS(DEVIF_SOC, DEVFN_CHAR, DEV_RNG, 0),
44 .init = pdev_randdev_init
46 EXPORT_DEVICE(randdev, &devrandx86_def, load_earlystage);