{"action":"opened","issue":{"url":"https://api.github.com/repos/resea/resea/issues/3","labels_url":"https://api.github.com/repos/resea/resea/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/resea/resea/issues/3/comments","events_url":"https://api.github.com/repos/resea/resea/issues/3/events","html_url":"https://github.com/resea/resea/issues/3","id":55723647,"number":3,"title":"base: implement virtual memory","user":{"login":"nuta","id":5053714,"avatar_url":"https://avatars.githubusercontent.com/u/5053714?v=3","gravatar_id":"","url":"https://api.github.com/users/nuta","html_url":"https://github.com/nuta","followers_url":"https://api.github.com/users/nuta/followers","following_url":"https://api.github.com/users/nuta/following{/other_user}","gists_url":"https://api.github.com/users/nuta/gists{/gist_id}","starred_url":"https://api.github.com/users/nuta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuta/subscriptions","organizations_url":"https://api.github.com/users/nuta/orgs","repos_url":"https://api.github.com/users/nuta/repos","events_url":"https://api.github.com/users/nuta/events{/privacy}","received_events_url":"https://api.github.com/users/nuta/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/resea/resea/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-28T07:34:28Z","updated_at":"2015-01-28T07:34:28Z","closed_at":null,"body":"# Virtual memory\r\n- Accessing address spaces where is not allocated by `vmalloc()` invokes so called \"Segmentation Fault\".\r\n\r\n## Interfaces\r\n### HAL\r\n```c\r\nvoid create_vm_space (struct vm_space *vms);\r\nvoid remove_vm_space (struct vm_space *vms);\r\nvoid    link_page   (struct vm_space *vms, vaddr_t v, paddr_t p, size_t n);\r\nvaddr_t vmalloc     (struct vm_space *vms, size_t n,\r\n                     enum page_attrs attrs /* MEMORY_WRITABLE, MEMORY_EXECUTABLE */);\r\nvoid    vfree       (struct vm_space *vms, vaddr_t v);\r\nvaddr_t vaddr2paddr (struct vm_space *vms, vaddr_t v);\r\n```\r\n\r\n### Base\r\n```c\r\npaddr_t pmalloc (size_t n); // allocates a physical page\r\nresult_t page_fault (vaddr_t vaddr); // HAL calls this\r\n```\r\n\r\n### Base Server\r\n```\r\nbase/vms.create:\r\nbase/vms.remove:\r\nbase/vms.getid: -> id\r\nbase/vms.vmalloc: num, pgfault_post -> vaddr\r\nbase/vms.vfree:   vaddr\r\nbase/vms.protect: writable, executable -> res\r\nbase/vms.link:    vaddr, ptr, num -> res\r\nbase/vms.get_page_size: -> size\r\n\r\nbase/vm.malloc: num -> ptr\r\nbase/vm.mfree:  ptr\r\n```\r\n\r\n### Handler\r\n```\r\npgfault: vms, vma, vaddr -> res\r\n``` \r\n"}}