vm: replace vm-region with address-space
address-space is a non-recursive data structure, which contains a flat list of vm_areas representing mapped vm-objects. userspace programs can no longer create sub-address-spaces. instead, they can reserve portions of the address space, and use that reserved space to create mappings.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#include <kernel/address-space.h>
|
||||
#include <kernel/channel.h>
|
||||
#include <kernel/msg.h>
|
||||
#include <kernel/port.h>
|
||||
#include <kernel/task.h>
|
||||
#include <kernel/thread.h>
|
||||
#include <kernel/util.h>
|
||||
#include <kernel/vm-region.h>
|
||||
#include <mango/signal.h>
|
||||
|
||||
#define CHANNEL_CAST(p) OBJECT_C_CAST(struct channel, c_base, &channel_type, p)
|
||||
@@ -167,13 +167,13 @@ extern kern_status_t channel_recv_msg(
|
||||
struct task *sender = msg->msg_sender_thread->tr_parent;
|
||||
struct task *receiver = self->tr_parent;
|
||||
|
||||
struct vm_region *src = sender->t_address_space,
|
||||
*dst = receiver->t_address_space;
|
||||
struct address_space *src = sender->t_address_space,
|
||||
*dst = receiver->t_address_space;
|
||||
|
||||
unsigned long f;
|
||||
vm_region_lock_pair_irqsave(src, dst, &f);
|
||||
address_space_lock_pair_irqsave(src, dst, &f);
|
||||
|
||||
kern_status_t status = vm_region_memmove_v(
|
||||
kern_status_t status = address_space_memmove_v(
|
||||
dst,
|
||||
0,
|
||||
out_msg->msg_data,
|
||||
@@ -182,7 +182,7 @@ extern kern_status_t channel_recv_msg(
|
||||
0,
|
||||
msg->msg_req.msg_data,
|
||||
msg->msg_req.msg_data_count,
|
||||
VM_REGION_COPY_ALL,
|
||||
ADDRESS_SPACE_COPY_ALL,
|
||||
NULL);
|
||||
|
||||
if (status != KERN_OK) {
|
||||
@@ -210,7 +210,7 @@ extern kern_status_t channel_recv_msg(
|
||||
&sender->t_handles_lock,
|
||||
&receiver->t_handles_lock,
|
||||
f);
|
||||
vm_region_unlock_pair_irqrestore(src, dst, f);
|
||||
address_space_unlock_pair_irqrestore(src, dst, f);
|
||||
|
||||
if (status != KERN_OK) {
|
||||
kmsg_reply_error(msg, status, &msg_lock_flags);
|
||||
@@ -250,12 +250,12 @@ extern kern_status_t channel_reply_msg(
|
||||
/* the task that is about to send the response */
|
||||
struct task *sender = self->tr_parent;
|
||||
|
||||
struct vm_region *src = sender->t_address_space,
|
||||
*dst = receiver->t_address_space;
|
||||
struct address_space *src = sender->t_address_space,
|
||||
*dst = receiver->t_address_space;
|
||||
unsigned long f;
|
||||
vm_region_lock_pair_irqsave(src, dst, &f);
|
||||
address_space_lock_pair_irqsave(src, dst, &f);
|
||||
|
||||
kern_status_t status = vm_region_memmove_v(
|
||||
kern_status_t status = address_space_memmove_v(
|
||||
dst,
|
||||
0,
|
||||
msg->msg_resp.msg_data,
|
||||
@@ -264,7 +264,7 @@ extern kern_status_t channel_reply_msg(
|
||||
0,
|
||||
reply->msg_data,
|
||||
reply->msg_data_count,
|
||||
VM_REGION_COPY_ALL,
|
||||
ADDRESS_SPACE_COPY_ALL,
|
||||
NULL);
|
||||
|
||||
if (status != KERN_OK) {
|
||||
@@ -292,7 +292,7 @@ extern kern_status_t channel_reply_msg(
|
||||
&sender->t_handles_lock,
|
||||
&receiver->t_handles_lock,
|
||||
f);
|
||||
vm_region_unlock_pair_irqrestore(src, dst, f);
|
||||
address_space_unlock_pair_irqrestore(src, dst, f);
|
||||
|
||||
if (status != KERN_OK) {
|
||||
kmsg_reply_error(msg, status, &msg_lock_flags);
|
||||
@@ -308,7 +308,7 @@ extern kern_status_t channel_read_msg(
|
||||
struct channel *channel,
|
||||
msgid_t id,
|
||||
size_t offset,
|
||||
struct vm_region *dest_region,
|
||||
struct address_space *dest_region,
|
||||
const kern_iovec_t *dest_iov,
|
||||
size_t dest_iov_count,
|
||||
size_t *nr_read)
|
||||
@@ -325,13 +325,13 @@ extern kern_status_t channel_read_msg(
|
||||
return KERN_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
struct vm_region *src_region
|
||||
struct address_space *src_region
|
||||
= msg->msg_sender_thread->tr_parent->t_address_space;
|
||||
|
||||
unsigned long f;
|
||||
vm_region_lock_pair_irqsave(src_region, dest_region, &f);
|
||||
address_space_lock_pair_irqsave(src_region, dest_region, &f);
|
||||
|
||||
kern_status_t status = vm_region_memmove_v(
|
||||
kern_status_t status = address_space_memmove_v(
|
||||
dest_region,
|
||||
0,
|
||||
dest_iov,
|
||||
@@ -340,9 +340,9 @@ extern kern_status_t channel_read_msg(
|
||||
offset,
|
||||
msg->msg_req.msg_data,
|
||||
msg->msg_req.msg_data_count,
|
||||
VM_REGION_COPY_ALL,
|
||||
ADDRESS_SPACE_COPY_ALL,
|
||||
nr_read);
|
||||
vm_region_unlock_pair_irqrestore(src_region, dest_region, f);
|
||||
address_space_unlock_pair_irqrestore(src_region, dest_region, f);
|
||||
|
||||
spin_unlock_irqrestore(&msg->msg_lock, msg_lock_flags);
|
||||
|
||||
@@ -353,7 +353,7 @@ extern kern_status_t channel_write_msg(
|
||||
struct channel *channel,
|
||||
msgid_t id,
|
||||
size_t offset,
|
||||
struct vm_region *src_region,
|
||||
struct address_space *src_region,
|
||||
const kern_iovec_t *src_iov,
|
||||
size_t src_iov_count,
|
||||
size_t *nr_written)
|
||||
@@ -370,13 +370,13 @@ extern kern_status_t channel_write_msg(
|
||||
return KERN_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
struct vm_region *dest_region
|
||||
struct address_space *dest_region
|
||||
= msg->msg_sender_thread->tr_parent->t_address_space;
|
||||
|
||||
unsigned long f;
|
||||
vm_region_lock_pair_irqsave(src_region, dest_region, &f);
|
||||
address_space_lock_pair_irqsave(src_region, dest_region, &f);
|
||||
|
||||
kern_status_t status = vm_region_memmove_v(
|
||||
kern_status_t status = address_space_memmove_v(
|
||||
dest_region,
|
||||
offset,
|
||||
msg->msg_resp.msg_data,
|
||||
@@ -385,9 +385,9 @@ extern kern_status_t channel_write_msg(
|
||||
0,
|
||||
src_iov,
|
||||
src_iov_count,
|
||||
VM_REGION_COPY_ALL,
|
||||
ADDRESS_SPACE_COPY_ALL,
|
||||
nr_written);
|
||||
vm_region_unlock_pair_irqrestore(src_region, dest_region, f);
|
||||
address_space_unlock_pair_irqrestore(src_region, dest_region, f);
|
||||
|
||||
spin_unlock_irqrestore(&msg->msg_lock, msg_lock_flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user