03-13 MIT OSE 讀書會: LEC 1 Operation Systems

127 views
Skip to first unread message

Ben

unread,
Feb 21, 2012, 12:11:25 PM2/21/12
to julu...@googlegroups.com

Q: I'll run the following directly; is it the same as above?
     echo one > out
     echo two > out
Q: How does the shell implement "&"?
Q: What if a background process exits while sh waits for a foreground process?

習題

Booting a PC


Ben

unread,
Feb 26, 2012, 3:12:08 AM2/26/12
to julu...@googlegroups.com

BT

unread,
Feb 27, 2012, 2:40:28 AM2/27/12
to 星系統社群
找到一篇不錯的文章,有興趣的可以看一下

Why BIOS loads MBR into 0x7C00 in x86 ?
http://www.glamenv-septzen.net/en/view/6


On 2月22日, 上午1時11分, Ben <benw...@gmail.com> wrote:
> 問題 (find <Q:> answer fromhttp://pdos.csail.mit.edu/6.828/2011/lec/l-overview.html)

peter Wen

unread,
Feb 29, 2012, 8:29:18 PM2/29/12
to julu...@googlegroups.com


Ben於 2012年2月26日星期日UTC+8下午4時12分08秒寫道:
請問這個練習是在練習組語? 

Ben

unread,
Feb 29, 2012, 10:07:13 PM2/29/12
to julu...@googlegroups.com


peter Wen於 2012年3月1日星期四UTC+8上午9時29分18秒寫道:
之前較少使用inline asm,看到文件裡有,做個小練習實驗看看
gcc -c test_leal.c --save-temps,轉出來的test_leal.s中, 我想知道c語言與inline asm是如何銜接的?
如何分配暫存器的?...


Spark

unread,
Feb 29, 2012, 10:27:54 PM2/29/12
to julu...@googlegroups.com
在 c function 到 inline  asm 前會先push 在 list of clobbered registers 有的 register
離開 inline asm 時,會在pop回來

void test()
{

__asm__ (
        "ldr r4, =0x1;"
        "ldr r5, =0x1;"
        "ldr r6, =0x1;"
        :
        :
        :"r4","r5","r6","r7"
        );
}

00000000 <test>:
   0:   e92d08f0        push    {r4, r5, r6, r7, fp}
   4:   e28db010        add     fp, sp, #16
   8:   e3a04001        mov     r4, #1
   c:   e3a05001        mov     r5, #1
  10:   e3a06001        mov     r6, #1
  14:   e24bd010        sub     sp, fp, #16
  18:   e8bd08f0        pop     {r4, r5, r6, r7, fp}
  1c:   e12fff1e        bx      lr

Ben

unread,
Mar 3, 2012, 11:21:25 AM3/3/12
to julu...@googlegroups.com


Spark於 2012年3月1日星期四UTC+8上午11時27分54秒寫道:
在 c function 到 inline  asm 前會先push 在 list of clobbered registers 有的 register
離開 inline asm 時,會在pop回來

查了一下, 在x86所使用,  不一定會push 所使用到的register, 以https://github.com/benwei/MIT-OSE-Labs/blob/master/ex1/inlineasm_reg/inlineasm.s 為例(在Mac OS X Lion 上編譯), 呼叫swap()函式中的 __asm__, 便不會push clobbered registers. 有空可來比較看其中差異原因.

wayling

unread,
Mar 13, 2012, 12:25:38 PM3/13/12
to julu...@googlegroups.com
hi all
今天有提到Inline-Assembly

google發現那個欄位叫做clobbered registers

是跟gcc說不要用個 register 而已,不是要gcc放到stack裡

這是我查到的,但不知道用太多register時,gcc到底會不會push到stack倒是要試試!!

http://ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html 

Ben於 2012年2月22日星期三UTC+8上午1時11分25秒寫道:

way

unread,
Mar 13, 2012, 12:43:05 PM3/13/12
to julu...@googlegroups.com
還有ELFsection,segment都可以用linker script描述
至於section ->segment 我目前看起來是跟type和address有關
又或許還跟其他屬性有關,這可能要去了解linker 文件才會知道了吧

linker script 描述semgnet
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/phdrs.html
ELF參考
http://www.acsu.buffalo.edu/~charngda/elf.html


2012/3/14 wayling <wayl...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages