2012年12月25日 星期二

Virtualization相關Conference

Red: A class top conf.
Orange: B class top conf.
Green: Other conf.

Virtualization

  •  VEE - International Conference on Virtual Execution Environments

OS

  • OSDI - Operating Systems Design and Implementation
  • SOSP - Symposium on Operating Systems Principles
  • USENIX - USENIX Technical Conference
  • RTSS - IEEE Real-Time Systems Symposium
  • USITS -- USENIX Symposium on Internet Technologies and Systems 
  • HotOS(WWOS) - Workshop on Workstation Operating Systems
  • Hybrid Systems
  • CASES - Compilers, Architecture, and Synthesis for Embedded Systems
  • SDSDI - Unix Symposium on Operating Systems Design and Implementation 
  •  

Architecture and Compiler

  • ISCA - International Symposium on Computer Architecture
  • MICRO - International Symposium on Microarchitecture
  • ASPLOS - Architectural Support for Programming Languages and Operating Systems
  • HPCA - International Symposium on High-Performance Computer Architecture 
  • PACT - International Conference on Parallel Architectures and Compilation Techniques
  • CGO - Symposium on Code Generation and Optimization

Mobile and embedded system

  • EMSOFT - International Workshop on Embedded Systems
  • MOBICOM: ACM/IEEE Intl Conf on Mobile Computing and Networking
  • MOBISYS: International Conference on Mobile Systems, Applications, and Services
  • SCOPES - International Workshop on Software and Compilers for Embedded Systems
  • LCTES - ACM SIGPLAN Conference on Languages, Tools, and Compilers for Embedded Systems 

參考資料: 清交資工系升等與博班點數標準

2012年5月12日 星期六

如何讓vim能自動parse出ARM的組合語言

在開發Linux kernel for ARM的時候,我們時常會使用vim來編寫程式碼,在一般以C語言撰寫的部份,vim皆能正確地對程式碼標色。但是在組合語言( Assembly language )檔案的部份,許多時候並不能對指令、參數等正確標色,實為缺憾。

但是我們發現在vim.sourceforge網站上,有人提供了armasm.vim的檔案,能夠讓vim能夠正確的對arm的組合語言標色。不過可惜的是只有Support到v5以前的指令,在v6之後的指令就只能自行修改armasm.vim檔案來支援,不過對於大多數的指令來說已經很夠用了。

其網頁於此:http://vim.sourceforge.net/scripts/script.php?script_id=888


其使用方法如下:
(註:我的使用環境是Ubuntu 11.10,VIM 7.3 for Ubuntu)

1. armasm.vim要放置的資料夾建置

   在家目錄下,建置.vim資料夾,再於.vim資料夾下建置syntax資料夾
   前述資料夾若已經存在則不需再另外建立

2. 取得並放置armasm.vim檔案

     (1) 去http://vim.sourceforge.net/scripts/download_script.php?src_id=4029 下載armasm.vim檔案

     (2) 將方才下載的armasm.vim檔案放置到~/.vim/syntax下

3. 修改家目錄下的.vimrc檔案,使vim能預設啟用armasm.vim檔案

    增加下列字串:
let asmsyntax='armasm' 
let filetype_inc='armasm'


調整好後,用vim開啟arm組合語言檔案就能正確標色




Creative Commons Licence

2012年4月14日 星期六

Alignment & Padding (English)

In order to prevent alignment exception, compiler will pad some empty data into memory to let it fit the alignment restriction.
Here is an example in C:

If we declare a structure like this:

struct align{
   char a;
   int b;
   short int c;
};

We will consider that it will use 7 bytes. However, because it has to prevent alignment exception,compiler will add some padding to let it fit 32-bit (i.e. 4 bytes). It may consider like this:

struct align{
   char a;
   char padding_0[3]; // add by compiler, programmer cannot use   
 
   int b;
   short int c;
   char padding_1[2]; // add by compiler, programmer cannot use   
};

Its memory allocation will look like this:
(放圖)

It is obvious to see that padding will waste lots of memory space. As a result, in order to save memory space, sometimes compiler also provide some pragma to let programmer to add in their code, and compiler can use these pragma to let compiler reallocate the memory allocation of this structure.

Here is an example:

#pragma pack(push)
#pragma pack(4)
        struct align
        {
                char a; //1 byte
                int b;  //4 bytes
                short int c;  //2bytes
        };
#pragma pack(pop)
It will let compiler to reallocate its memory allocation and use memory more efficiently.



Creative Commons Licence



Ref: http://en.wikipedia.org/wiki/Data_structure_alignment

About me

Junior System Software Programmer

M.S. in CS
B.S. in EE

In EECS area

Major research interest: Virtualization, Kernel
Minor research interest: Computer Architecture, Compiler, Other system software
More minor research interest: Digital Signal Process
Just for fun: Probability, Electromagnetism

Familiar develop environment:
Processor: ARM, x86, TI-C64xx;
OS: Linux, Mac OS X;
Compiler: GCC, Clang-LLVM

Preferred Software License: BSD License
Preferred Kernel: XNU ( Darwin Kernel )
Preferred Compiler: LLVM


於EECS領域研究興趣:
主要研究作業系統核心、虛擬化技術。對於計算機架構與其他系統軟體亦有相當的研究興趣。因過去大學時的經驗,對DSP、機率、電磁相關領域的知識,亦會作為業外新知來吸收。

熟悉的開發平台與環境:
在處理器架構上,主要對ARM有相對較高的熟悉,對x86、TI-C64xx系列亦有些微了解。在作業系統環境上,主要開發對象為Linux,主要使用環境為Mac OS X與Ubuntu。在編譯器環境上,傳統上使用GCC,最近亦對LLVM有興趣接觸與使用。

C語言:函式的Coding-style

傳統上,我們學C語言的時候,大多使用的寫法方式大多如下:
int main(int argc,char **argv)
{
 ... 
}

會直接把傳進函數的參數的type與名稱打在函式名稱右邊的小括弧中。

也因此,有些人的Coding-style,會傾向把函式的左括弧和函式名稱放在同一行,就例如這樣:
int main(int argc,char **argv) {
 ... 
}

這樣的寫法並不違背C語言的語法,拿去編譯器編譯也當然會過,說實在的如果只是寫給自己看、或是工作的環境並沒有特別指定Coding-style的話,只要自己習慣並沒有什麼不好。

然而,如果開發OpenSource相關專案的人,或多或少都會和開源社群交流,也會去trace甚至更改Source code,在這樣的狀況下,規範一個固定的Coding-style實屬必要。以Linux社群為例,就有著一份 "Documentation/CodingStyle and Beyond" (http://kernel.org/doc/ols/2002/ols2002-pages-250-259.pdf) 來約束大家的Coding-style,以便其他完全素昧平生的開發者,也能輕易的(?)看懂你寫的原始碼。

在"Documentation/CodingStyle"這篇文章當中,對函式寫法的標準是:
int foo(int x)
{
 ... 
}

一開始我在看到這段的時候,覺得只是一個換行符號的差別,僅是社群內自行約束的習慣而已,並不以為意。

然而,後來因緣際會看到一些特殊的函式寫法例子之後,就覺得將左括弧換行是有其必要性,我們來看一個例子:
int main(argc,argv)
    int argc;
    char **argv;
{
 ... 
}

上面的程式碼是在GNU Bash當中,實作printenv指令時,main function的寫法。從上面我們可以看到,他在函式名稱旁邊的小括弧當中,其傳遞進函式的參數,僅將其名字列出,並不指定type,而是換行之後才將其宣告寫入,最後再換行打入左大括號。

初次看到此種寫法之時,會以為這個寫法是有問題的,但將此種寫法拿去編譯器編譯,並不會出現問題,此種寫法是早期C語言的寫法,而在此寫法中,函式變數旁的小括弧和負責包住函式本體的大括弧中間,確實有可能出現其他內容,甚至有換行之必要,故在此寫法下,會希望負責包住函式本體的左大括弧,和括住傳入函式參數的小括弧中間有需要換行,而此習慣便延續到現在Linux kernel的Coding-style當中。



Creative Commons Licence

2012年2月17日 星期五

Introduction to Xen-ARM (1) : Brief introduction to Xen-ARM

We has studied on virtualization for years. And we want to share some interesting information on virtualization nowadays. And we also want to have communicate with others who are also interesting in virtualization. The following article is a summary from the Xen-ARM's website and related public documents.




Section 1: Brief introduction to Xen-ARM

Xen-ARM is a hypervisor which is based on ARM architecture. It means that you can run different operating system at the same time when you are using hypervisor. In the category of hypervisor, Xen-ARM is categorized as Type-1 hypervisor[1] . Besides, it's necessary to patch guest OS when you want to use it running on Xen-ARM.
i.e. Xen-ARM is using para-virtualization.

Xen-ARM is based on Xen[2] which is a hypervisor running on x86-platform. Most of  developers of Xen-ARM are come from Samsung instead of XenSource which is main maintainer of Xen.

In the early stage of developing time of Xen-ARM, they had only supported FreeScale develop board. However, Xen-ARM has support several develop boards, such as XScale PXA310, Versatile, Realview-PB, Cortex-A9, etc. Meanwhile, Xen-ARM also supports Goldfish which is a QEMU emulator patched for Android. Otherwise, in software part, Xen-ARM had only supported for Linux 2.6.11 as guest OS in the early stage of developing time of Xen-ARM. But, Xen-ARM has supported for Linux 2.6.11, 2.6.18, 2.6.21, 2.6.24, 2.6.27 as guest OS nowadays.