3 ms·
Write a System Call (2016)
- st_goliath 5y agoIt should be noted that there is generally not really any reason to do this, and you should especially not do this to implement some vendor specific quirk. I posted this nice, real life example here back in February: https://twitter.com/RichFelker/status/1357733309737021444 https://twitter.com/RichFelker/status/1357733309737021444 Even in the example of the `sys_stephen` syscall from November 2016, it already clashes with the syscall number of `sys_leftpad`, proposed upstream in April 2016[1]. [1] https://lkml.org/lkml/2016/3/31/1109 https://lkml.org/lkml/2016/3/31/1109
- saagarjha 5y ago> Unlike my previous articles on kernel development, implementing a system call is not something you can do in a kernel module. Not with that attitude ;)
- wallscratch 5y agoCan anyone help me understand why transitioning to kernel mode is architecture-dependent? I’m not clear on why the linux system call kernel entry code in arch/x86/entry/common.c has to be in assembly, instead of C.
- jackhalford 5y agotransitioning to kernel mode requires a context switch, which is inherently a cpu operation, i.e it works differently on different architectures.
- voxic11 5y agoThe mode is actually tracked/enforced by the CPU but the implementation differs per architecture. For example: > The hardware severely restricts the ways in which control can be passed from one ring to another, and also enforces restrictions on the types of memory access that can be performed across rings. Using x86 as an example, there is a special gate structure which is referenced by the call instruction that transfers control in a secure way. https://en.wikipedia.org/wiki/Protection_ring#Implementations https://en.wikipedia.org/wiki/Protection_ring#Implementation...
- Annatar 5y agoAnd OF COURSE it had to be Linux instead of illmos! Yeah, that's REALLY SMART! Boy does this Linux whoring make me angry!