system-calls

How to determine where code spends a lot of time in a kernel space (system calls)

孤人 提交于 2019-12-11 02:28:33
问题 I noticed that 10% my code run is system space. However I do NOT know which system calls. I suspect, though, it is either has to do files or timestamps. Is there a tool to figure out which system calls are the culprits? Also, I want to know the frequency of (and location) of calls (and callee) . I am on AS3 thx 回答1: Both strace and truss will help you see which system calls are taking time. Two useful options for strace are: -T to show the time spent in each system call, -c to summarize

How to iterate a string in mips assembly

好久不见. 提交于 2019-12-11 02:17:21
问题 So I am working on a project right now where we have to take in a string and convert it to all uppercase letters and then to lowercase letters if either the toUpper or toLower byte is anything but 0. Right now I am still working on the uppercase portion (guessing the lowercase will be almost the same) but I am getting stuck either when I am going through the string to find the letters that are uppercase or when I am calling the syscall to print. Any help would be great. Here's what I have so

What does the “name” parameter mean in the syscall_32.tbl linux file?

落爺英雄遲暮 提交于 2019-12-11 01:54:16
问题 I am adding some custom system calls to linux Fedora and I am currently trying to update "syscall_32.tbl". The only hiccup is that I am not too sure what the name field for the call table means. Is this something we just make up? As in a name that we decide to call this particular system call? For example the structure of the table is: <number> <abi> <name> <entry point> <compat entry point> For the <name> section is this a parameter that we decide on and just enter there? Or is it something

Interrupting syscalls in threads on linux

跟風遠走 提交于 2019-12-11 01:38:57
问题 I have a pthread that runs in a loop, calling accept() in a blocking manner. Is there any way to interrupt that call from another thread? Everything points to sending the thread a signal, but apparently you can only send a process a signal. I can't just kill the thread because then it leaves the socket open. And that's not very clean anyway. Is there really no way to do this? 回答1: You can signal a thread using pthread_kill(3). The pthread_kill() function sends the signal sig to thread,

Add a new system call at FreeBSD-11.0-RELEASE-amd64

。_饼干妹妹 提交于 2019-12-11 01:19:26
问题 I am a beginner in FreeBSD. I installed FreeBSD-11.0-RELEASE-amd64 on VM. I want to add first new system call. And this is my post in last week. Now I want to build kernel. I see handbook. But In command make buildkernel , indicates errors! mykern.c #include <sys/sysproto.h> #include <sys/param.h> #include <sys/types.h> #include <sys/systm.h> #include <sys/module.h> #include <sys/kernel.h> #include <sys/proc.h> #include <sys/sysent.h> #ifndef _SYS_SYSPROTO_H_ struct myargs { unsigned int k0;

How can I check if my wrapper function system call - read() is correct? [duplicate]

坚强是说给别人听的谎言 提交于 2019-12-10 19:18:18
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Inline Assembler for wrapper function doesn’t work for some reason I'm requested to write wrapper function for read , write , close , open & fork . I've written 4 wrapper functions for read , write , close , open . My questions are : How can I write wrapper function for fork , using the 4 wrapper functions that I wrote for read , write , close & open ? How can I check if the wrapper that I wrote is correct ?

macOS 64-bit System Call Table [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-10 17:17:43
问题 This question already has an answer here : basic assembly not working on Mac (x86_64+Lion)? (1 answer) Closed 5 months ago . I can find a Linux 64-bit system call table, but the call numbers do not work on macOS - I get a Bus Error: 10 whenever I try to use them. What are the macOS call numbers for operations like sys_write ? 回答1: You can get the list of system call numbers from user mode in (/usr/include/)sys/syscall.h. The numbers ARE NOT the same as in Linux. The file is autogenerated

x86_64 assembly execve *char[] syscall

浪子不回头ぞ 提交于 2019-12-10 17:13:30
问题 I am trying to get into a bit of Linux 64bit x86 assembly without using the standard libs, however I am having some issues dealing with arguments presented to my program (argv). I would think (based on documentation) that rsp marks the beginning of the argc qword, whilst [rsp + 8] would be argv. Unfortunately this is not the case, and the following (abridged) program causes EFAULT (Bad address) . sys_execve equ 59 sys_exit equ 60 section .data child db "/bin/sh", 0 global _start section .text

Possible to use bios interrupts in your code on linux?

流过昼夜 提交于 2019-12-10 17:12:26
问题 I write a simple program in assembly language in Linux (using nasm), and for educational purposes, I want to use BIOS interrupt instead linux system calls, is this possible ? 回答1: The short answer is, no it's not possible. The longer answer is that Linux has support for virtual8086 mode (the int vm86(unsigned long fn, struct vm86plus_struct *v86) call) which is capable of executing real mode code (including BIOS functions, if setup properly). However; the BIOS expects lots of different pieces

Unable to find syscall_table_32.S file in linux

人盡茶涼 提交于 2019-12-10 17:11:07
问题 I am using the linux-headers-2.6.32-21 package on Virtual Machine. I am going to write a new system call. I have found the other files to write initials of system calls but I am unable to find this syscall_table_32.S in arch/x86/kernel/ directory. Please help me how and where I can find this file. I am doubted that it might be hidden due to permission issues or others. 回答1: The following commit removes it: commit 303395ac3bf3e2cb488435537d416bc840438fcb Author: H. Peter Anvin <hpa@linux.intel