kernel

Convert connect address with address familiy AF_SYSTEM to human readable string

雨燕双飞 提交于 2019-12-25 15:52:30
问题 Background I'm writing some dtrace program which tracks application socket file descriptors. Aim is to provide logs which help me spot leak of file descriptors in some very complex OS X application. Here is my other question with very helpful answer. Problem I want that my program is logging address to which file descriptor has been connected to. In examples there is a code which partial do what I need: soconnect_mac.d , here is link to github. soconnect_mac.d works great when applied on

Where does intel 80386 save registers?

让人想犯罪 __ 提交于 2019-12-25 15:19:45
问题 I am trying to develop my own basic kernel for educational purpose. I was reading the Intel 80386 and reading about the the interrupt 0 :- Divide by zero exception. In there, it was written :- Saved Instruction Pointer Saved contents of CS and EIP registers point to the instruction that generated the exception. My question is where are these registers saved. How, can I access these registers ? 回答1: An Interrupt pushes the current contents of the EFLAGS, CS, and EIP registers (in that order)

Incorporating I/O driven scheduling into OS Kernel

这一生的挚爱 提交于 2019-12-25 07:06:01
问题 IronPort developed a high performance file system and an I/O driven scheduler optimized for the asynchronous nature of messaging (hence "Async"OS). If you wanted to do the same but make it open source, what exactly would need to change? 回答1: This is probably mostly marketing - FreeBSD already handles "asynchronous nature of messaging" rather well. They most likely short-circuited some processing in the network stack for their specific purposes, same for the file system. 来源: https:/

Does sysfs procfs devtmpfs mounted by kernel?

醉酒当歌 提交于 2019-12-25 05:50:05
问题 I'm looking into systemd. I thought systemd would mount sysfs(/sys), procfs(/proc), devtmpfs(/dev) during booting after kernel initialization. But my systemd debugging log show that systemd doesn't mount such file systems.(it only mounts cgroups, securityfs, etc...) By when, and whom does such file system is mounted? Does kernel mount sys, proc, dev? 回答1: Yes, those are mounted by systemd PID1, see src/core/mount-setup.c in the systemd sources. 回答2: First point: the Linux kernel can't mount

Units of QueryPerformanceFrequency

半城伤御伤魂 提交于 2019-12-25 05:31:50
问题 A simple question: Which is the QueryPerformanceFrequency unit? Hz (ticks per second)? Thank you very much, Bruno 回答1: Q: Units of QueryPerformanceFrequency? A: KILO-HERTZ (NOT Hz) =========== DETAILS ============================================== My research indicates that both Counters and Freq are in KILOs, KILO-clock-ticks and KILO-HERTZ! The counters register KILO-Clicks (KLICKS) and the freq is either in kHz or I am woefully UnderClocked. When you divide the Clock_Ticks by Clock

Do you need to call init_timer() again after a del_timer()

痴心易碎 提交于 2019-12-25 05:24:12
问题 I have a Linux module which creates timers, some of which may add themselves again during their handler function. In some other cases, the timer is removed (perhaps before it's gone off) using del_timer_sync() . In that case, do I need to do the init_timer() call again on the struct before I next add_timer( ) or is that just a waste of (precious) interrupt latency? 回答1: To answer my own question, I believe I do need to init_timer() my struct after any del_timer() or del_timer_sync() if I ever

int instruction from user space

冷暖自知 提交于 2019-12-25 04:09:19
问题 I was under the impression that "int" instruction on x86 is not privileged. So, I thought we should be able to execute this instruction from the user space application. But does not seem so. I am trying to execute int from user application on windows. I know it may not be right to do so. But I wanted to have some fun. But windows is killing my application. I think the issue is due to condition cpl <=iopl. Does anyone know how to get around it? 回答1: Generally the old dispatcher mechanism for

How to compile a simple multiboot2 bare-metal executable?

安稳与你 提交于 2019-12-25 04:07:34
问题 I want to start to write an os kernel, and then, i found a document introducing multboot2 spec. There are three example code files, named boot.S , kernel.c and multiboot2.h , belonging to the multiboot2 branch of grub project. Firstly, i tried to compile and link the code with some option (using i686-elf-gcc) such as -nostartfiles , -nodefaultlibs and -ffreestanding , but qemu showed me the format was error. And then i found a file named Makefile.am , and the compiler option in this file is

errors when I excute AIX kernel extension program

谁说胖子不能爱 提交于 2019-12-25 04:02:38
问题 Im newbie at AIX. I got many errors when I compiled kernel extension. After then, finally I compiled and Linked. But When I excuted the binary, I got this error. bash# ./sysconfig_1 load ./question.exp Could not load program ./sysconfig_1: The program does not have an entry point or the o_snentry field in the auxiliary haeder is invalid. Examine file headers with the 'dump -ohv' command Could anyone help me? //sysconfig_1.c #include <sys/types.h> #include <sys/sysconfig.h> #include <sys

Address versus Value at Address

流过昼夜 提交于 2019-12-25 03:24:32
问题 I am currently dealing with a problem relating to some kernel-mode code referencing %gs . Here’s what’s going on: I have a fairly large structure which is stored in the %gs register. I am trying to get/set the cpu_active_thread value from that structure, which happens to be at offset 0x8 inside that structure. In other words, I am trying to get/set %gs:0x8 . The problem is, when I get the value, the result is the literal value 0x8. (As this is not a valid address, I am crashing later on.) How