2019-06-05 19:31:48 +02:00
|
|
|
// The OS/K Team licenses this file to you under the MIT license.
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
2019-06-13 23:12:11 +02:00
|
|
|
#include <pc/dev.h>
|
2019-06-05 19:31:48 +02:00
|
|
|
|
2019-06-15 13:42:30 +02:00
|
|
|
#define MAX_RFRAME_IDX 255
|
|
|
|
|
|
|
|
//
|
|
|
|
// Register frales
|
|
|
|
//
|
|
|
|
reg_t **rfs = NULL;
|
|
|
|
size_t rfs_used = 0;
|
|
|
|
|
2019-06-05 22:11:45 +02:00
|
|
|
long cpudev_testfn(ctx_t *ctx, dev_t *dev)
|
2019-06-05 19:48:56 +02:00
|
|
|
{
|
|
|
|
rax = 4;
|
|
|
|
rdx = 3;
|
2019-06-05 22:11:45 +02:00
|
|
|
|
|
|
|
return 0;
|
2019-06-05 19:48:56 +02:00
|
|
|
}
|
|
|
|
|
2019-06-05 22:11:45 +02:00
|
|
|
long cpudev_poweron(ctx_t *ctx, dev_t *dev)
|
2019-06-05 19:48:56 +02:00
|
|
|
{
|
2019-06-15 13:42:30 +02:00
|
|
|
rfs = malloc(sizeof(reg_t *) * (MAX_RFRAME_IDX + 1));
|
|
|
|
|
|
|
|
if (rfs == NULL)
|
|
|
|
return -1;
|
2019-06-05 19:48:56 +02:00
|
|
|
|
|
|
|
dev->state = DEVGOOD;
|
2019-06-15 13:42:30 +02:00
|
|
|
|
|
|
|
dev->fslots[0] = cpudev_testfn;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
long cpudev_poweroff(ctx_t *ctx, dev_t *dev)
|
|
|
|
{
|
|
|
|
if (rfs)
|
|
|
|
free(rfs);
|
2019-06-05 22:11:45 +02:00
|
|
|
|
|
|
|
return 0;
|
2019-06-05 19:48:56 +02:00
|
|
|
}
|
|
|
|
|
2019-06-05 19:31:48 +02:00
|
|
|
dev_t cpudev =
|
|
|
|
{
|
|
|
|
.type = "cpu",
|
|
|
|
.name = "K-CPU",
|
2019-06-05 22:11:45 +02:00
|
|
|
.modl = "Prisma 1",
|
2019-06-05 19:31:48 +02:00
|
|
|
.vend = "The OS/K Team",
|
|
|
|
|
2019-06-13 23:12:11 +02:00
|
|
|
.major = KARCH_MAJOR,
|
|
|
|
.minor = KARCH_MINOR,
|
|
|
|
.revis = KARCH_REVIS,
|
2019-06-05 19:48:56 +02:00
|
|
|
|
|
|
|
.fpwon = cpudev_poweron,
|
2019-06-05 19:31:48 +02:00
|
|
|
};
|
|
|
|
|