博文

目前显示的是 十一月, 2010的博文

Android on OKL4 Tutorials

图片
可能在博客里面xml内容显示不正常,移步docs.google,查看 http://docs.google.com/View?id=df6sncnm_899k8tqgng5 Android on OKL4 OKL4 3.0 was originally ported to run on the HTC Dream (found here ). A student, Michael Hills, developed a rudimentary Android port that removes Linux and runs natively on OKL4 3.0 for his undergraduate thesis. The supplied code demonstrates the Lunar Lander application found in the Android SDK running on the Dalvik VM on OKL4. Getting the source 1. First create a base directory to contain all of the source of this project. 2.Then download the Android repo tool and place it into a directory that is in your environment's PATH. 3.Then inside the project base directory, create a directory for the Android source and initialize the repo.      You may need to prepare your build environment to compile Android as specified at http://source.android.com/source/index.html . curl http://android.git.kernel.org/repo >~/bin/repo chmod a+x ~/bin/repo mkdir android-1.5r2 cd android-1.5r2 repo

xen-arm 算法技巧赏析(0)

1 /* 2 原以为,在平时的工程实现中,算法几乎是用不上的。但在看内核的过程中,发现算法还是比较重要的。 3 尤其是一些细微而又精巧的程序设计技巧。这些技巧是需要掌握的。 4 5 下面的这段程序摘自:xen-arm中,的内存初始化部分。 6 功能:从first_page页开始的nr_pages页在页位图中,表示为空闲页。 7 页位图,位于_end之后。_end标识xen-arm kernel的结束地址。 8 9 */ 10 static void map_free( unsigned long first_page, unsigned long nr_pages) 11 { 12 unsigned long start_off, end_off, curr_idx, end_idx; 13 14 #ifndef NDEBUG 15 unsigned long i; 16 /* Check that the block isn't already freed. */ 17 for ( i = 0 ; i < nr_pages; i++ ) 18 ASSERT(allocated_in_map(first_page + i)); //ASSERT:如果条件不成立,就报错 19 #endif 20 21 curr_idx  = (first_page-min_page) / PAGES_PER_MAPWORD; 22 start_off = (first_page-min_page) & (PAGES_PER_MAPWORD- 1 ); 23 end_idx   = (first_page-min_page + nr_pages) / PAGES_PER_MAPWORD; 24 end_off   = (first_page-min_page + nr_pages) & (PAGES_PER_MAPWORD- 1 ); 25 26 if ( curr_idx == end_idx ) 27 { 28 //这个算法还是比较巧妙的 29 //1<<start_off - 1 从start_off位开始,全部为1 30 /* 31 -(1<