[kernel] Move log buffer to its own memory section
In prep for the coming change to keep log entries as a true ring buffer, move the log buffer from bss into its own memory section. Related changes in this commit: - New vm_area_ring, which maps a set of pages twice to allow easy linear reading of data from a ring buffer when it wraps around the end. - logger_init() went away, and the logger ctor is called from mem::initialize() - Instead of an event object, the logger just has a bare wait_queue - util::counted::from template type changed slightly to allow easy conversion from an intptr_t as well as a pointer - Previously added debugcon_logger code removed - this will be added in a separate file in a followup commit
This commit is contained in:
@@ -126,6 +126,10 @@ public:
|
||||
|
||||
virtual bool get_page(uintptr_t offset, uintptr_t &phys) override;
|
||||
|
||||
/// Tell this VMA about an existing mapping that did not originate
|
||||
/// from get_page.
|
||||
void add_existing(uintptr_t offset, uintptr_t phys);
|
||||
|
||||
private:
|
||||
page_tree *m_mapped;
|
||||
};
|
||||
@@ -178,4 +182,25 @@ private:
|
||||
block_allocator m_stacks;
|
||||
};
|
||||
|
||||
|
||||
/// Area that maps its pages twice for use in ring buffers.
|
||||
/// Cannot be resized.
|
||||
class vm_area_ring :
|
||||
public vm_area_open
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
/// \arg size Virtual size of the ring buffer. Note that
|
||||
/// the VMA size will be double this value.
|
||||
/// \arg flags Flags for this memory area
|
||||
vm_area_ring(size_t size, vm_flags flags);
|
||||
virtual ~vm_area_ring();
|
||||
|
||||
virtual bool get_page(uintptr_t offset, uintptr_t &phys) override;
|
||||
|
||||
private:
|
||||
size_t m_bufsize;
|
||||
page_tree *m_mapped;
|
||||
};
|
||||
|
||||
} // namespace obj
|
||||
|
||||
Reference in New Issue
Block a user