kernel

Weird behavior when writing to 0xB8000 / corrupted pointer

扶醉桌前 提交于 2021-01-28 08:12:12
问题 I'm currently developing an OS kernel from scratch. I want to use a function to write characters on the screen , using the 0xB8000 memory location. the problem is the following : I use : void video_write(const unsigned char *string , char color ){ unsigned char *p = (unsigned char*) string ; char *c = (char*) (VIDEO_MEMORY ); //VIDEO_MEMORY is 0XB8000 while(*p != '\0') { *c = p[0] ; c++ ; *c = color ; c++ ; p++ ; } } void clear_screen(){ char *c = (char*) VIDEO_MEMORY ; int i = 0 ; for(i ; i

How to add the two variations of the open syscall in OS161?

℡╲_俬逩灬. 提交于 2021-01-28 07:52:23
问题 From the man pages of OS161 : Synopsis #include <unistd.h> #include <fcntl.h> int open(const char *filename, int flags); int open(const char *filename, int flags, mode_t mode); How the standard c library function open is defined: int open(const char *filename, int flags, ...); The declaration: /* * Definition for each syscall. * All we do is load the syscall number into v0, the register the * kernel expects to find it in, and jump to the shared syscall code. * (Note that the addiu instruction

64-bit time_t in Linux Kernel

£可爱£侵袭症+ 提交于 2021-01-28 06:12:05
问题 I have compiled kernel 3.19.1 but still have a problem with time_t . Just a simple program with cout << sizeof (time_t); gives size of 4 bytes, not 8 bytes as was my intention. Should I switch on a particular option during make menuconfig? 回答1: Currently time_t is just long in kernel: see __kernel_time_t type definition. So if long type on your CPU is 32-bit long, time_t also is 32-bit long. Basically, if you have 32-bit CPU -- long type on your system is also 32-bit long. If you have 64-bit

dtrace: doesn't catch any write sys call

狂风中的少年 提交于 2021-01-28 04:12:26
问题 I'm new to dtrace and trying to write some a basic dtrace scripting. I found a example to catch read(2) and write(2) syscall on seperate terminal as following, syscall::read:entry, syscall::write:entry /pid==4217/ { } The specified pid number is from the other terminal's pid id. When I saw the example, it supposed to show some read and write syscall if I run this script with dtrace. But I only observed read syscall but not write syscall. So if I understand correctly, on the terminal I observe

Limiting the heap area's Virtual address range

时光总嘲笑我的痴心妄想 提交于 2021-01-28 02:06:12
问题 I need to do some brute-force searching in process VA space for my study and hence would like limit my heap area's virtual address range. OS course told me that heap is anywhere between data and stack pages. So I want to shrink my process VA range by doing the following: Have a custom linker script that gave start and end of data somewhere very high in address range (0x7f45f88a6000) Tweak fs/binfmt_elf.c to have stack top as (0x8f45f88a6000) instead of randomly picking. Assume my program uses

Octave kernel for jupyter not working on windows 10

亡梦爱人 提交于 2021-01-27 12:22:55
问题 I tried to install the octave kernel for jupyter using pip (as suggested here https://github.com/calysto/octave_kernel). But I cannot choose the Octave kernel when creating a new notebook. It worked without problems on my Mac, so I guess it might be a Windows related issue. Does someone have any ideas, how I could fix or investigate the problem? Octave is installed. 回答1: Setting environmental variable OCTAVE_EXECUTABLE to C:\\Octave\\Octave-4.2.1\\bin\\octave-cli.exe and restarting the PC

How to enable CONFIG_PREEMPT option in Linux kernel?

我与影子孤独终老i 提交于 2021-01-27 06:48:38
问题 I am new bee in Linux kernel programming, trying to work with an old kernel Linux 2.6.32 on x86_64. I want to enable the CONFIG_PREEMPT option in it but can not find information about how can I do it. I can compile a new kernel with my preferred options, but do not know what I need to do in this case. So can anyone please tell me How can I enable CONFIG_PREEMPT option? Do I need to recompile the kernel again with new menuconfig? In that case which option is responsible for CONFIG_PREEMPT? I

How to set linux kernel not to send RST_ACK, so that I can give SYN_ACK within raw socket

时光怂恿深爱的人放手 提交于 2021-01-27 06:21:33
问题 I want to ask a classic question about raw socket programming and linux kernel TCP handling. I've done the research to some same threads like linux raw socket programming question, How to reproduce TCP protocol 3-way handshake with raw sockets correctly?, and TCP ACK spoofing, but still can't get the solution. I try to make a server which don't listen to any port, but sniff SYN packets from remote hosts. After the server do some calculation, it will send back a SYN_ACK packet to corresponding

How to set linux kernel not to send RST_ACK, so that I can give SYN_ACK within raw socket

馋奶兔 提交于 2021-01-27 06:20:35
问题 I want to ask a classic question about raw socket programming and linux kernel TCP handling. I've done the research to some same threads like linux raw socket programming question, How to reproduce TCP protocol 3-way handshake with raw sockets correctly?, and TCP ACK spoofing, but still can't get the solution. I try to make a server which don't listen to any port, but sniff SYN packets from remote hosts. After the server do some calculation, it will send back a SYN_ACK packet to corresponding

save_stack_trace_tsk and struct stack_trace is no longer available in Linux 5.2+

瘦欲@ 提交于 2021-01-27 05:42:57
问题 In kernel version before 5.2, I use save_stack_trace_tsk to retrieve call stack. But this method is no longer available in Linux kernel 5.2+, what should I use? 回答1: This question seemed so tempting so I did some digging here is my findings. TLDR; stack_trace_save () functions replaced by arch_stack_walk() interfaces * this is part of consolidation plan and remove duplicate code. linux commit 214d8ca6ee854 provide common architecture to walking stack trace. the new interface called arch_stack