clang-format
This commit is contained in:
@@ -40,80 +40,70 @@
|
||||
* used. The cheesy hack versions in dumbvm.c are used instead.
|
||||
*/
|
||||
|
||||
struct addrspace *
|
||||
as_create(void)
|
||||
{
|
||||
struct addrspace *as;
|
||||
struct addrspace *as_create(void) {
|
||||
struct addrspace *as;
|
||||
|
||||
as = kmalloc(sizeof(struct addrspace));
|
||||
if (as == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
as = kmalloc(sizeof(struct addrspace));
|
||||
if (as == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize as needed.
|
||||
*/
|
||||
/*
|
||||
* Initialize as needed.
|
||||
*/
|
||||
|
||||
return as;
|
||||
return as;
|
||||
}
|
||||
|
||||
int
|
||||
as_copy(struct addrspace *old, struct addrspace **ret)
|
||||
{
|
||||
struct addrspace *newas;
|
||||
int as_copy(struct addrspace *old, struct addrspace **ret) {
|
||||
struct addrspace *newas;
|
||||
|
||||
newas = as_create();
|
||||
if (newas==NULL) {
|
||||
return ENOMEM;
|
||||
}
|
||||
newas = as_create();
|
||||
if (newas == NULL) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
|
||||
(void)old;
|
||||
(void)old;
|
||||
|
||||
*ret = newas;
|
||||
return 0;
|
||||
*ret = newas;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
as_destroy(struct addrspace *as)
|
||||
{
|
||||
/*
|
||||
* Clean up as needed.
|
||||
*/
|
||||
void as_destroy(struct addrspace *as) {
|
||||
/*
|
||||
* Clean up as needed.
|
||||
*/
|
||||
|
||||
kfree(as);
|
||||
kfree(as);
|
||||
}
|
||||
|
||||
void
|
||||
as_activate(void)
|
||||
{
|
||||
struct addrspace *as;
|
||||
void as_activate(void) {
|
||||
struct addrspace *as;
|
||||
|
||||
as = proc_getas();
|
||||
if (as == NULL) {
|
||||
/*
|
||||
* Kernel thread without an address space; leave the
|
||||
* prior address space in place.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
as = proc_getas();
|
||||
if (as == NULL) {
|
||||
/*
|
||||
* Kernel thread without an address space; leave the
|
||||
* prior address space in place.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
as_deactivate(void)
|
||||
{
|
||||
/*
|
||||
* Write this. For many designs it won't need to actually do
|
||||
* anything. See proc.c for an explanation of why it (might)
|
||||
* be needed.
|
||||
*/
|
||||
void as_deactivate(void) {
|
||||
/*
|
||||
* Write this. For many designs it won't need to actually do
|
||||
* anything. See proc.c for an explanation of why it (might)
|
||||
* be needed.
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -126,57 +116,48 @@ as_deactivate(void)
|
||||
* moment, these are ignored. When you write the VM system, you may
|
||||
* want to implement them.
|
||||
*/
|
||||
int
|
||||
as_define_region(struct addrspace *as, vaddr_t vaddr, size_t memsize,
|
||||
int readable, int writeable, int executable)
|
||||
{
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
int as_define_region(struct addrspace *as, vaddr_t vaddr, size_t memsize,
|
||||
int readable, int writeable, int executable) {
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
|
||||
(void)as;
|
||||
(void)vaddr;
|
||||
(void)memsize;
|
||||
(void)readable;
|
||||
(void)writeable;
|
||||
(void)executable;
|
||||
return ENOSYS;
|
||||
(void)as;
|
||||
(void)vaddr;
|
||||
(void)memsize;
|
||||
(void)readable;
|
||||
(void)writeable;
|
||||
(void)executable;
|
||||
return ENOSYS;
|
||||
}
|
||||
|
||||
int
|
||||
as_prepare_load(struct addrspace *as)
|
||||
{
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
int as_prepare_load(struct addrspace *as) {
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
|
||||
(void)as;
|
||||
return 0;
|
||||
(void)as;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
as_complete_load(struct addrspace *as)
|
||||
{
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
int as_complete_load(struct addrspace *as) {
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
|
||||
(void)as;
|
||||
return 0;
|
||||
(void)as;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
as_define_stack(struct addrspace *as, vaddr_t *stackptr)
|
||||
{
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
int as_define_stack(struct addrspace *as, vaddr_t *stackptr) {
|
||||
/*
|
||||
* Write this.
|
||||
*/
|
||||
|
||||
(void)as;
|
||||
(void)as;
|
||||
|
||||
/* Initial user-level stack pointer */
|
||||
*stackptr = USERSTACK;
|
||||
/* Initial user-level stack pointer */
|
||||
*stackptr = USERSTACK;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user