system-calls

Adding new System Call to Linux Kernel 3.13 on 64 bit system

浪子不回头ぞ 提交于 2020-12-29 05:45:14
问题 I'm trying to add a simple helloworld System Call to kernel 3.13.0-37-generic on 64 bit system. I'll try to show what I did so far step by step : 1- I've downloaded kernel source by : sudo apt-get source linux-image-3.13.0-37-generic After that, kernel source files extracted to /usr/src/ 2- Define a new system call sys_hello() : I've created a directory with hello name in the kernel source directory in /usr/src/linux-3.13/ And I created a hello.c file in hello directory with below content :

How to print a number in ARM assembly?

天涯浪子 提交于 2020-12-26 06:56:45
问题 I am trying to print a number that I have stored. I'm not sure if I am close or way off. Any help would be appreciated though. Here is my code: .data .balign 4 a: .word 4 .text .global main main: ldr r0, addr_of_a mov r1, #8 str r1, [r0] write: mov r0, #1 ldr r1, addr_of_a mov r2, #4 mov r7, #4 swi #0 bx lr addr_of_a: .word a It compiles and runs, but I don't see anything printed. From what I understand, I need the address of where to start printing in r1, how many bytes in r2, the file