base-nova: Added new hypercalls for reserving a specific CPU, creating a habitat and querying the physical CPU ID.

This commit is contained in:
Michael Mueller
2024-03-11 14:34:59 +01:00
parent 0dbbca2af4
commit 13c22bc404
2 changed files with 30 additions and 8 deletions

View File

@@ -73,6 +73,9 @@ namespace Nova {
NOVA_CREATE_CELL= 0x14, NOVA_CREATE_CELL= 0x14,
NOVA_CELL_CTRL = 0x15, NOVA_CELL_CTRL = 0x15,
NOVA_CONS_CTRL = 0x16, NOVA_CONS_CTRL = 0x16,
NOVA_CPUID = 0x17,
NOVA_RESERVE_CPU= 0x18,
NOVA_CREATE_HAB = 0x19,
}; };
/** /**
@@ -591,7 +594,7 @@ namespace Nova {
public: public:
enum { DEFAULT_QUANTUM = 1500, DEFAULT_PRIORITY = 64 }; enum { DEFAULT_QUANTUM = 10000, DEFAULT_PRIORITY = 64 };
Qpd(mword_t quantum = DEFAULT_QUANTUM, Qpd(mword_t quantum = DEFAULT_QUANTUM,
mword_t priority = DEFAULT_PRIORITY) mword_t priority = DEFAULT_PRIORITY)

View File

@@ -155,7 +155,7 @@ namespace Nova {
ALWAYS_INLINE ALWAYS_INLINE
inline uint8_t call(mword_t pt) inline uint8_t call(mword_t pt)
{ {
return syscall_1(NOVA_CALL, 0, pt, 0); return syscall_1(NOVA_CALL, 0, 0, pt);
} }
@@ -441,9 +441,10 @@ namespace Nova {
} }
ALWAYS_INLINE ALWAYS_INLINE
inline uint8_t yield(bool release_core = true) inline uint8_t yield(bool release_core = true, bool block = true)
{ {
return syscall_0(NOVA_YIELD, release_core, 0); Nova::uint8_t flags = block ? release_core : 3;
return syscall_0(NOVA_YIELD, flags, 0);
} }
ALWAYS_INLINE ALWAYS_INLINE
@@ -453,15 +454,27 @@ namespace Nova {
} }
ALWAYS_INLINE ALWAYS_INLINE
inline uint8_t alloc_cores(mword_t count) inline uint8_t alloc_cores(mword_t count, mword_t &allocated)
{ {
return syscall_1(NOVA_ALLOC_CORES, 0, 0, count); return syscall_5(NOVA_ALLOC_CORES, 0, 0, count, allocated);
} }
ALWAYS_INLINE ALWAYS_INLINE
inline uint8_t core_allocation(mword_t &allocation) inline uint8_t wake_core(mword_t core)
{ {
return syscall_5(NOVA_CORE_ALLOC, 0, 0, allocation, allocation); return syscall_1(NOVA_RESERVE_CPU, 0, 0, core);
}
ALWAYS_INLINE
inline uint8_t core_allocation(mword_t &allocation, bool mask = false)
{
return syscall_5(NOVA_CORE_ALLOC, static_cast<Nova::uint8_t>(mask), 0, allocation, allocation);
}
ALWAYS_INLINE
inline uint8_t cpu_id(mword_t &cpuid)
{
return syscall_5(NOVA_CPUID, 0, 0, cpuid, cpuid);
} }
ALWAYS_INLINE ALWAYS_INLINE
@@ -476,6 +489,12 @@ namespace Nova {
return syscall_2(NOVA_CELL_CTRL, Cell_op::GROW, pd, mask, index); return syscall_2(NOVA_CELL_CTRL, Cell_op::GROW, pd, mask, index);
} }
ALWAYS_INLINE
inline uint8_t create_habitat(mword_t start_cpu, mword_t size)
{
return syscall_2(NOVA_CREATE_HAB, 0, 0, start_cpu, size);
}
ALWAYS_INLINE ALWAYS_INLINE
inline uint8_t acquire_console() inline uint8_t acquire_console()
{ {