Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syscalls physical memory #201

Merged
merged 9 commits into from
Mar 9, 2019

Conversation

Orycterope
Copy link
Member

  • syscall MapMmioRegion
  • syscall QueryPhysicalAddress
  • moving some memory related functions of libuser in their own mem module
  • improving the syscalls macro
  • fixing the capabilities macro

@todo
Copy link

todo bot commented Mar 9, 2019

Kernel mappings must be physically continuous.

Virtual memory is a great thing, it can make a fragmented mapping appear contiguous from the userspace. But unfortunately Horizon does not take advantage of this feature, and allocates its mapping as a single Physical Memory Region.
Its syscalls are based around that fact, and to do a `virt_to_phys(addr)`, you simply need to `query_memory(addr).offset` to get its offset in its mapping, and compute its physical address as `query_physical_address(addr).base + offset`.
This will not work when the mapping is composed of several physical regions, and Horizon drivers will not be expecting that. So for them to work on our kernel, we must renounce using fragmented mappings.
For now `query_physical_address` is providing an additional "offset in physical region" return value, to help KFS drivers doing a virt_to_phys without needing to walk the list of physical regions.


https://github.com/roblabla42/KFS/blob/63f3be7c3ce5eeb8eb0ad7de60c63c0964d264bb/kernel/src/interrupts/syscalls.rs#L120-L130


This comment was generated by todo based on a TODO comment in 63f3be7 in #201. cc @Orycterope.

@Orycterope Orycterope requested review from roblabla and marysaka March 9, 2019 20:45
Copy link
Member

@roblabla roblabla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Member

@marysaka marysaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@roblabla
Copy link
Member

roblabla commented Mar 9, 2019

Cargo test fails.

Removed on_fixed_mmio_rounds_unaligned test,
as `on_fixed_mmio` no longer rounds.
@Orycterope Orycterope merged commit f87dfdc into sunriseos:master Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants