28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

118<br />

5. Some calling conventions (e.g. ARM EABI) require 64bit parameters to be<br />

passed in even numbered registers. For example, consider <strong>the</strong> lseek call.<br />

<strong>The</strong> first parameter is an integer <strong>and</strong> is passed to <strong>the</strong> system call in register<br />

0. <strong>The</strong> second parameter is 64bit, <strong>and</strong> according to <strong>the</strong> ABI it needs to<br />

be passed in registers 2+3 instead <strong>of</strong> registers 1+2. To ensure <strong>the</strong> alignment<br />

constraint matches in <strong>the</strong> kernel, <strong>the</strong> system call description table<br />

syscalls.master contains padding parameters. For example, lseek is defined<br />

as lseek(int fd, int pad, <strong>of</strong>f_t <strong>of</strong>fset, int whence). Since “pad”<br />

is not a part <strong>of</strong> <strong>the</strong> application API, we do not want to include it in <strong>the</strong><br />

rump kernel system call signature. However, we must include padding in<br />

<strong>the</strong> struct sys_lseek_args parameter which is passed to <strong>the</strong> kernel. We<br />

solved <strong>the</strong> issue by first renaming all pad parameters to <strong>the</strong> uppercase “PAD”<br />

to decrease <strong>the</strong> possibility <strong>of</strong> conflict with an actual parameter called “pad”.<br />

<strong>The</strong>n, we modified makesyscalls.sh to ignore all parameters named “PAD” for<br />

<strong>the</strong> application interface side.<br />

A possibility outside <strong>of</strong> <strong>the</strong> scope <strong>of</strong> this work is to examine if <strong>the</strong> libc system call<br />

stubs <strong>and</strong> prototypes can now be autogenerated from syscalls.master instead <strong>of</strong><br />

requiring separate code in <strong>the</strong> NetBSD libc Makefiles <strong>and</strong> system headers.<br />

3.6.2 vnode Interface<br />

<strong>The</strong> vnode interface is a kernel internal interface. <strong>The</strong> vnode interface routines take a<br />

vnode object along with o<strong>the</strong>r parameters, <strong>and</strong> call <strong>the</strong> respective method <strong>of</strong> <strong>the</strong> file<br />

system associated with <strong>the</strong> vnode. For example, <strong>the</strong> interface for reading is <strong>the</strong> following:<br />

int VOP_READ(struct vnode *, struct uio *, int, kauth_cred_t);<br />

if <strong>the</strong> first parameter is a pointer to a FFS vnode, <strong>the</strong> call will be passed to <strong>the</strong> FFS<br />

driver.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!