Author Archives: admin
Kernel can load up all segments to correct v-addr and p-addr now

Kernel can load up all segments to correct v-addr and p-addr now 2015/09/29
Tutorial : import svn with all history into github
Tutorial : import svn with all history into github Step 1) Create a project on github Step 2) Init the github project by : Step 3) git clone https://github.com/mcheung63/GKD.git <--- replace your project url Step 4) cd to that directory Step 5) user https://github.com/nirvdrum/svn2git and run: Step 6) svn2git --rebase Step 7) git pull Step […] 2015/09/22
All svn history for peter-bochs debugger
Its time to keep track of all history, peter-bochs change svn server for a few times. Here are all svn history: peter-bochs-self-host <-- peter-bochs svn history hosted in my own server peter-bochs-google <-- peter-bochs svn history hosted in google code gkd <-- peter-bochs renamed to GKD, svn history hosted in my own server 2015/09/22
Netbeans - Maven Runner

Eclipse has a great plugin call "Eclipse runner" https://marketplace.eclipse.org/content/eclipse-runner , i found out netbeans doesn't have any similar one. So i develop one for netbeans. You can add maven goals under the tree node of any project. Double click the goal name will run maven in netbeans. You can download it from http://plugins.netbeans.org/plugin/60381/?show=true, or search "Maven […] 2015/09/16
ported libelf

finally ported libel to my os, my linker script won't warn me I crossed the kernel boundary. So libelf's variables becoming exist in a memory area that they shouldn't be there. 2015/09/13
This battery save my apple magic mouse

When you change your mouse from logitech mouse to magic mouse, the first feeling is that magic mouse is much much heavier. This battery save my apple magic mouse, although it has lesser mah, but it is 5 times lighter than normal battery, so i much my magic mouse much lighter weight. And it is only […] 2015/09/08
Enable peter-swing theme in netbeans
Edit : /Applications/NetBeans/NetBeans 8.0.2.app/Contents/Resources/NetBeans/etc/netbeans.conf Change the line to: 2015/09/06
Enhancement of the OS debug format, support scripting
OS debug format https://code.google.com/p/peter-bochs/wiki/OSDebugStandard is a xml based document stays in memory of the emulator, brining out the debug information in real time to the debugger, make the debugger understand what data structure they want to debug. In the early stage of kernel debugger, people rely on printk to dump out the debug information. At that […] 2015/09/05
http://www.kaizou.org/2015/01/linux-libraries/
Originally from http://www.kaizou.org/2015/01/linux-libraries/ , it is a super professional article that explain the LD process. 08 Jan 2015 by David Corvoysier A few months ago I stumbled upon a linking problem with secondary dependencies I couldn’t solved without overlinking the corresponding libraries. I only realized today in a discussion with my friend Yann E. Morin that not only did I use the […] 2015/09/02
Amazing recording feature by specific which code-block you want to record
In the original GKD design, it works with bochs instrumentation. Being helped (https://sourceforge.net/p/bochs/discussion/39593/thread/d960fe94/?limit=50) by the author of bochs (Mr Stanislav Shwartsman ) emulator, now we can use the prefetch instruction to specific which code-block you want to record, it becomes even more useful now. Every code surrounded by PREFETCHT0 and PREFETCHT1 instruction, GKD will record jumping instruction […] 2015/08/20
handling exception 7
the easiest way to handle exception 7 is to execute clts then iret. My kernel was crashed because it generated a exception 0x7. 2015/08/19
GKD can dump the exceptions now
GKD can dump the exceptions now, it helps me to trace what happened to my kernel 2015/08/13
hard to theme netbeans perfectly
It is hard to theme netbeans using traditional swing look & feel. The reason is netbean's tab container is not traditional swing JTabbedPane. See the post https://netbeans.org/bugzilla/show_bug.cgi?id=150393 Netbeans use a AbstractViewTabDisplayerUI to support only few "default look & feel", such as Metal, Nimbus, Aqua. see below: The problem is : This default look & feel tab container […] 2015/08/06
Peter-swing java look & feel
https://github.com/mcheung63/peter-swing 2015/08/03
grub is slow on bochs
if grub is running slowly on bochs, try to add "--no-rs-codes" to your grub-bios-setup command. It will be 0.5 sec versus 5 seconds different. 2015/08/02
gcc can't handle too much #if macro
gcc can't handle too much macro (#if, #define), the output dwarf will have wrong line number. So when you disassemble the assembly with c/c++ source, everything are wrong, including wrong line number, wrong assembly code to c source code, duplicated c/c++ line. https://github.com/gcc-mirror/gcc/blob/master/libgcc/libgcc2.c In GKD, i add an on/off button to filter out those […] 2015/08/02
GKD is running fast with bochs instrumentation stub now
GKD is running fast with bochs instrumentation stub now, it captures all jmp/call/int/ret, all instructions that change you EIP. I am using H2 as the backbone database, every second can records over 100,000 instruction, which is pretty fast. Turn on subtitle when you are watching it: 2015/07/26
Nazi gun tower
2015/07/13
Getting the parameters by parsing the dwarf directly
I used another two months to getting correct location of each parameter of a functions. Mission sounds stupid, the timeframe i spent sounds stupid. If I use GDB, i perhaps never know how parameters are stored in memory. Now i know how computer ACTUALLY works. People think the parameters are store in the stack, and […] 2015/07/07
libelf include issue
When you meet this: Just comment out the following line in /toolchain/include/libelf/sys_elf.h When I build the libelf in mac and in linux, the output sys_elf.h is different, in mac, the above line is not exist, so my OS is able to compile. Peter. 2015/06/30
How to lookup the value of each parameter from dwarf and memory location
Here are the steps to lookup the parameter value 1) Look into the "info" section from dwarf, "objdump --dwarf=info". There is a die DW_AT_LOCATION (DW_OP_freg:0), telling you the offset to the frame register. 2) Look at the CIE from .eh_frames section, "objdump --dwarf=frames". It will tell you the formula of calculating the CFA, such as […] 2015/06/18
Linux view csv command
alias csv='column -s, -t' csv your_file 2015/06/16
Successfully decode .eh_frame
Successfully decode .eh_frame, now able to calculate the base offset of each parameter, can keep going on profiling feature of GKD 2015/05/27
objdump 2.24 has bug

objdump 2.24 has bug, but this bug is fixed in 2.25. It dump the wrong address for my 32 bits kernel. 2015/05/22
Decoded first two instructions of .eh_frame
Decoded first two instructions of .eh_frame, dwarf spec is lack of detail, need to hack into the objdump to understand each byte, it is time consuming. 2015/05/12
binutils compile error
If you compiling binutils and have these error, just remove d-exp.c and try again. d-exp.c should be generated by d-exp.y but binutils makefile won't delete it during "make distclean" 2015/05/03
Tsinghua ucore kernel with GKD
I talked to Professor Chen from Tsing Hua (http://media.cs.tsinghua.edu.cn/cn/cheny), i tried their education kernel (https://github.com/chyyuu/ucore_lab). I modified a little bit their Makefile so that it can be compiled in Mac and debug using my GKD debugger. 2015/04/30
I finally understand why "DW_OP_fbreg: 0" is possible
In the following function kmalloc2, take a look the first parameter, the memory location of that parameter is stated by dwarf "DW_AT_location : 2 byte block: 91 0 (DW_OP_fbreg: 0)", where "DW_OP_fbreg: 0" means stack+0. I was thinking why it is possible. Because when cpu executed call instruction, it already pushed 4 bytes into the […] 2015/04/14
objdump has bug
objdump command has bug, i tried to use this command "objdump -dS kernel" to display mixed assembly and c code. But objdump has bug, it dump the same piece of c source code in two different memory locations. I double checked the dwarf data, nothing wrong. On more prove the dwarf is correct, my GKD […] 2015/04/11
I finally understand why same parameter even has multiple locations
I finally understand why same parameter even has multiple locations. My pass concept is parameter stay in the stack. But after hacking the dwarf, it show me same parameter have multiple location during execution. Take a look below image, I wrote a function call kmalloc2 (blue arrow), the third parameter "size" has three locations (yellow […] 2015/04/07
Finally can dump out the parameter type from dwarf standard

Finally can dump out the parameter type from dwarf standard. Some parameter is store recursively, so need to read out DW_AT_type and get the right die and decode again. Personally I think dwarf is just too hard to parse. Here is the code https://sourceforge.net/p/peter-dwarf/code/254/tree//trunk/src/main/java/com/peterdwarf/dwarf/DwarfLib.java https://sourceforge.net/p/peter-dwarf/code/254/tree//trunk/src/main/java/com/peterdwarf/dwarf/Dwarf.java 2015/03/29
This is how to decode dwarf DT_Type

This is how to decode dwarf DT_Type 2015/03/23
heading toward to decode the range address of dwarf

heading toward to decode the range address of dwarf, this job is killing me. And I found the information in die is not always meaningful, see below. 2015/03/22
ubuntu 12.04 vnc startup script for fallback mode
2015/03/21
Fixed ubuntu vnc keymap problem
ubuntu 12.04 vnc keymap has trouble, D become minimize all windows and S become start menu, run these to fix it. 2015/03/19
compile dwarfdump in mac
CFLAGS='-I /opt/local/include -L /opt/local/lib' CXXFLAGS='-I /opt/local/include -L /opt/local/lib' ./configure --prefix=/peter-dwarfdump make make install Because mac gcc doesn't search for the /opt/local, so need to specific the path manually. 2015/03/07
Peter-dwarf library can show hierarchy data for compile unit now

Peter-dwarf library can show hierarchy data for compile unit now 2015/02/15
Thinkaholic open source event 2015/2/10

Thinkaholic open source event 2015/2/10 2015/02/15
I should look at this
I should look at this printf -> _fstat -> _sbrk -> write 2015/02/07
now is good enough
now is good enough, can focus on library things 2015/01/22