This commit is contained in:
julianb0 2019-06-05 19:48:56 +02:00
parent 51f91c8fb1
commit 1144444eff
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
3 changed files with 35 additions and 0 deletions

View File

@ -13,6 +13,8 @@ main:
mov ax0, .buf
call print
iocall 0, 0
leave
ret

View File

@ -3,6 +3,23 @@
#include <dv/dev.h>
void cpudev_testfn(ctx_t *ctx, dev_t *dev)
{
assert(dev == &cpudev);
rax = 4;
rdx = 3;
}
void cpudev_poweron(ctx_t *ctx, dev_t *dev)
{
assert(dev == &cpudev);
dev->fslots[0] = cpudev_testfn;
dev->state = DEVGOOD;
}
dev_t cpudev =
{
.type = "cpu",
@ -13,5 +30,7 @@ dev_t cpudev =
.major = 0,
.minor = 1,
.revis = 0,
.fpwon = cpudev_poweron,
};

View File

@ -85,6 +85,20 @@ IMPL_END;
IMPL_START_2(iocall)
{
CHK_SUPERV();
dev_t *dev = devctl_common(ctx, v1, v2);
if (dev == NULL)
return;
if (v2 >= DEVSLOTS)
rax = -6;
else if (dev->fslots[v2] == NULL)
rax = -6;
else
dev->fslots[v2](ctx, dev);
}
IMPL_END;