自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(91)
  • 收藏
  • 关注

原创 Rust code: demo of message system

【代码】Rust code: demo of message system。

2023-12-27 21:50:47 727

原创 AI write rust 2

【代码】AI write rust 2。

2023-12-19 09:30:11 571

原创 AI write rust code

【代码】AI write rust code。

2023-12-16 23:04:59 360

原创 enter ‘Program Files‘ by shell script in Gitbash/WSL on Windows

shell script enter 'Program Files'

2022-10-27 21:18:24 388

原创 CMAKE TIPs

1. How to avoid CMAKE check default compilerCMAKE will check default compiler when start CMAKE.If you have CC,CXX in environment variable, CMAKE will use CC,CXX to compile a simple code.But some compiler can't pass this test.So we need find a way t

2022-05-02 15:33:28 259

原创 Virtual C++ ignore warnings

if we enable "-Wall -Werror" on Virtual C++, Virtual C++ will report all warnings and take it as error.But you want to ignore some warnings in some cases. So we need to find a way to ignore warnings. Virtual C++ provide '#pragma warning( xxx)' to do

2022-04-12 15:04:02 404

原创 SCP copy data to target machine through proxy

scp -o ProxyCommand="ssh -q [email protected] -W %h:%p" your_data.tar [email protected]:/home/your_target_folder/And you will need to input 1) proxy password and 2)target machine password.

2022-02-11 17:56:35 279

原创 Intel i5-8500 + H370 study notes

1. CPU + PCH architecturePCH is from south bridge and north bridge is integrated into CPU.H370 is PCH -- Platform Controller Hub.The datasheet of H370 is "Intel series 300 chipset" -- Intel® H370 Chipset.i5-8500 is CPU.The datasheet of i5-8500 is

2022-02-08 14:28:02 389

原创 Change Linux Terminal Title

Add following code to .bashrcfunction title() { if [[ -z "$ORIG" ]]; then ORIG=$PS1 fi TITLE="\[\e]2;$*\a\]" PS1=${ORIG}${TITLE}}And source ~/.bashrcThen open a terminal and run command title:

2022-01-29 18:13:12 1539

原创 Dump Stack on Linux User Space

#include <stdio.h>#include <stdlib.h>#include <execinfo.h>int dump_stack(void){ int j, nptrs; void *buffer[16]; char ** strings; nptrs = backtrace(buffer,16); printf("backtrace() returned %d.

2022-01-11 20:11:13 673

原创 Linux Kernel Get User Pages

Question:if I malloc a buffer in user space, but I don't read/write it. I just pass the virtual address of this buffer to driver by ioctl. In driver, I am trying to use get_user_pages() to get all the pages of this virtual address. Is there page mapping

2022-01-10 21:26:05 525

原创 PCI/PCIe iATU

What is iATU?iATU is internal address translate unit. It translates PCI address to device internal address.For example, you have a PCI/PCIe card, and you have DDR and SoC on the card. And your card has internal address for the SoC devices and DDR.And

2021-09-11 17:45:20 4462

原创 How does QEMU/KVM/VFIO-PCI passthrough HW to Virtual Machine

QEMU, KVM and VFIO-PCI work together to passthrough HW to virtual machine.Passthrough means virtual machine can directly access HW, no other software between virtual machine and HW.There are two pathes from virtual machine to HW. One is DMA access HW,

2021-09-11 17:30:44 202

原创 QEMU/KVM/Virsh Tips

Basic concepts:https://blog.csdn.net/qq_34018840/article/details/1011945711. Virtlib xml to QEMU command line:virsh domxml-to-native qemu-argv my-virtual-machine.xmlAs:2. QEMU command line to XML3. Virtual machine boot error of libvirt unab...

2021-08-15 11:54:19 4051

原创 GDB can‘t stop start_kernel on QEMU ARM64 model

Found a strange issue when use GDB debug Linux Kernel on QEMU ARM64 virtual machine. The issue is GDB can't stop the kernel as following.The reason is ARM64 kernel enabled a new feature KASLR(Kernel address space layout randomization). To disable it.

2021-08-09 20:19:50 142

原创 VFIO-MDEV driver(virtual device) trigger interrupt to virtual machine

Last blog records how to data access between VFIO-MDEV driver(virtual device) to virtual machine. Now this blog records the interrupt from VFIO-MDEV driver(virtual device) to virtual machine.Host side:Actually mtty sample code has the good implementat.

2021-08-05 22:26:37 341

原创 VFIO-MDEV driver access virtual machine‘s memory

As I created myself VFIO-MDEV driver/virtual device, the next steps I can think are:1) make virtual machine can access real hardware through this VFIO-MDEV driver.2) hardware/VFIO-MDEV driver can access the buffer in virtual machine. Because many HW wi

2021-08-04 19:47:44 392

原创 Create my MDEV device and use it in Virtual Machine

Refer to :https://blog.csdn.net/alex_mianmian/article/details/1186785101. Code ArchitectureIn host_driver:tranx_card.c is the MDEV driver. It's actully mtty.c. I just modified it as following:This modification is set new PCIe configure space v.

2021-07-29 22:05:08 288

原创 Run VFIO-MDEV mtty example on Ubuntu20.04

1. Check if VFIO is already in the System.Linux 5.4 build the VFIO into the kernel. Here is the way to check it.Looks like VFIO_MDEV is still a module.Another way to check:Check kernel log too:OK, looks like my system already have VFIO. But

2021-07-12 20:17:21 976

原创 Install KVM on Ubuntu 20

1. Check if CPU support KVMcpuinfo show's 12 times of vmx|svm, it means CPU supports KVM2. Check if board support KVM acceleration3. Install KVM4. Check daemon and network5. Install virtual machineFirstly you need to get an imag...

2021-07-10 11:32:10 125

原创 CMAKE tips(link error of --major-image-version) on Windows

One issue I got is link flag was not know by linker ld.exe:The solution is setCMAKE_SYSTEM_NAME to Generic on the top of CMakelist.txt as:If you put line 3 after your project(xxx), it doesn't help you to fix this issue.

2021-06-23 09:18:08 1673

原创 Vulkan Study

1. Study resource:https://vulkan-tutorial.com/Overview

2021-06-16 19:54:14 122

原创 How to add IOCTL for platform device

As platform device has no file operations, it can't implement ioctl() API by itself. So platform device need char device or misc device to add ioctl() API.

2021-06-16 19:43:58 162

原创 Tips of C programming

1. if(i)void check_positive(int a){ if(a) printf("I am positive %d\n",a); else printf("I am negative %d\n",a);}int main(void){ int a = 9; int b = -1; check_positive(a); check_positive(b); retu.

2021-04-01 11:32:40 76

原创 How to Share Data between ISR and Task

Recently I developed a library. And another engineer use the API of this library in ISR. Actually this API is designed for Task and this API will get mutex , do something, then release mutex.Then we got strange errors and start to debug.The mutex..

2021-03-02 21:31:43 135 1

原创 printf becomes puts

Firstly, let's read following simple code:#include <stdio.h>int input_number(void){ printf("please input numbers:\n"); return 0;}int output_number(void){ printf("check my implementation"); return 0;}int main

2021-01-22 22:01:26 72

原创 Use Python and Sed create simple C code

My Simple code is:switch(event){case EVENT_XXXX: name = "EVENT_XXXX"; break;}And all the events are defined on a web page as:<td class="tg-cly1">EVENT_XXXX(OtaStateId,&nbsp;&nbsp;&nbsp;OK/FAIL)</td><td class="

2020-11-24 22:23:49 90

原创 Link a static library‘s all sections

Suppose I build a static library "mylib.a" which has many sections. one section is called ".my_test" and I put some structure in it.Suppose My main() function call some functions in the library.However, no functions directly access the structure in se.

2020-10-28 21:07:28 116

原创 Remove then add string from variable of Makefile

As we know, use sed command can change string.When we want to use it in Makefile, how to use it?Let's write a Makefile as following:LDFLAGS = -Txxhello.lds -LhelloIOT_LDFLAGS = $(LDFLAGS) | sed 's/-T.*lds/-Talex.lds/g'all: @echo $(LDFLA

2020-10-06 13:21:53 88

原创 CMAKE notes

1. How to set relative path to a variableHere is the folder struct. We run cmake in 'folder_cmake' and we hope to use something in 'my_folder'. /folder_top/folder_level1/folder_cmake /folder_top/my_folderSET(my_variable ${CMAKE_CURRENT_SOU...

2020-09-03 15:59:50 100

原创 Hide symbol of dynamic library

os_api.c#include <stdio.h>void func_os_api(void){ printf("I am OS API\n");}os_api.h#ifndef __OS_API_H__#define __OS_API_H__extern void func_os_api(void);#endifcall_os_api.c#include <stdio.h>#include "os_api.h"v...

2020-08-27 22:24:16 128

原创 open source hypervisor

https://blog.csdn.net/lemin9538/article/details/105453362https://blog.csdn.net/lemin9538/article/details/105061023record good project here firstly, later will study it.

2020-07-27 20:23:39 137

原创 Linux I2C notes

I2C has Master and Slave.Master could beSoC I2C controller.Slave could be EEPROM, LCD, Audio Codec.So Linux should provide master driver and slave driver.Master driver: how to send cmd/data to slave deviceSlave driver: how to access slave re...

2020-07-13 22:32:46 142

原创 OPTEE notes

1. optee_smccc_hvc() and optee_smccc_smc()During optee_probe(), get_invoke_func() will return one of these two functions based on device tree configure.And this returned invoke_fn will register to optee->invoke_fn for other functions to use.

2020-07-10 22:25:05 176

原创 MMU and SMMU (Linux) notes

MMU:1. Each process has a MMU page table--including user space entries and kernel space entries.2. All processes share one global kernel MMU page table--init_mm, all kernel space entries are on it.3. When a new process trap into kernel, page fault ha

2020-07-09 21:19:32 334

原创 Linux kernel send signal to user space by fasync

1. application#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdio.h>#include <poll.h>#include <signal.h>#include <sys/types.h>#include <unistd.h>#include <fcntl.h>

2020-06-10 18:47:47 209

原创 Linux Kernel Send Signal to User Space

Signal is one way that Kenerl can notify User Space application that something happened.Linux Version: Ubuntu 18.04This demo includes:1. kernel module + Makefile2. applicationFirst, it is kernel module -- signal.c/* * sending signal from kern

2020-06-01 10:04:00 569

原创 QEMU ARM interrupt system architecture 2

I'd like to list the log here to help the understand of the process.GPIO_IN initialize API is :void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n){ qdev_init_gpio_in_na...

2019-08-05 12:20:32 423

原创 QEMU ARM interrupt system architecture

QEMU interrupt system use GPIO to implement interruptsystem. We can understand it by asimple model:Device.[GPIO_OUT] ->[GPIO_IN].GIC.[GPIO_OUT]->[GPIO_IN].coreGPIO_IN IRQ is created by...

2019-08-02 11:19:41 873

原创 tmux -- ssh terminal can be closed without impact the server process

When we use SSH terminal to do something on the server side, we can't close the SSH terminal if the task/process is still running on the server side.TMUX can help it.1.open SSH terminal2.login ...

2019-07-19 21:37:50 156

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除