[kernel] Make channels stream based

Multiple changes regarding channels. Mainly channels are now stream
based and can handle partial reads or writes. Channels now use the
kernel buffers area with the related buffer_cache. Added a fake stdout
stream channel and kernel task to read its contents to the screen in
preparation for handing channels as stdin/stdout to processes.
This commit is contained in:
2020-08-30 18:04:19 -07:00
parent f27b133089
commit 724b846ee4
10 changed files with 117 additions and 78 deletions

View File

@@ -22,8 +22,10 @@ struct vm_range
vm_state state;
inline uintptr_t end() const { return address + size; }
inline int compare(const vm_range *other) const {
return other->address - address;
inline int64_t compare(const vm_range *other) const {
if (address > other->address) return -1;
else if (address < other->address) return 1;
else return 0;
}
};

View File

@@ -253,7 +253,7 @@ vm_space::commit(uintptr_t start, size_t size)
vm_state
vm_space::get(uintptr_t addr)
{
node_type *node = find_overlapping(m_ranges.root(), addr, 0);
node_type *node = find_overlapping(m_ranges.root(), addr, 1);
return node ? node->state : vm_state::unknown;
}