2012/11/10

[ARM] DMB, DSB, ISB


Definition

Home > ARM and Thumb Instructions > Miscellaneous instructions > DMB, DSB, and ISB

DMB
Data Memory Barrier acts as a memory barrier. It ensures that all explicit memory accesses that appear in program order before the DMB instruction are observed before any explicit memory accesses that appear in program order after the DMB instruction. It does not affect the ordering of any other instructions executing on the processor.

DSB
Data Synchronization Barrier acts as a special kind of memory barrier. No instruction in program order after this instruction executes until this instruction completes. This instruction completes when:
  • All explicit memory accesses before this instruction complete.
  • All Cache, Branch predictor and TLB maintenance operations before this instruction complete.

ISB
Instruction Synchronization Barrier flushes the pipeline in the processor, so that all instructions following the ISB are fetched from cache or memory, after the instruction has been completed. It ensures that the effects of context altering operations, such as changing the ASID, or completed TLB maintenance operations, or branch predictor maintenance operations, as well as all changes to the CP15 registers, executed before the ISB instruction are visible to the instructions fetched after the ISB.
In addition, the ISB instruction ensures that any branches that appear in program order after it are always written into the branch prediction logic with the context that is visible after the ISB instruction. This is required to ensure correct execution of the instruction stream.

2011/07/03

To write assembly code in c code

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

I need to write some assembly code in c code for embedded system. It's simple
if only pure assembly code is needed. Just write op code with registers in a .s file. Unfortunately, it has to link variables in c code to assembly code, so I need more advanced knowledge.

2011/06/05

[vim] 列出文章中搜尋結果

http://stackoverflow.com/questions/137935/how-to-jump-to-an-occurrence-from-vim-search-list

每次看到學長用這個功能都覺得好神,終於被我找到了,這個功能主要是在視窗下緣列出搜尋的結果,如下圖。

打 [+shift i 就會顯示出來,但他好像使用的是完整匹配,而非原本搜尋的部份匹配,所以游標要移到要搜尋的字串上,接著在呼叫出這個list後打 :+行號,就可以跳到要尋找的行號,非常方便。


2011/03/20

用 GnuCash 記帳 Accounting with GnuCash - 3

外幣的觀念也是一樣,因為是以新台幣為出發點,最後就要換回新台幣結算,因此和股票一樣,新增一個外幣計價的項目,將台幣轉換過去,也是一樣是資產轉換,結算也是一樣換成封關來結算,只是,記錄盈虧比較怪異一點。

Tracking Currency Investments (How-To)

和股票一樣,盈虧需要一個平衡項,這個平衡項也是外幣,但是如果直接登記在外幣項的話會讓外幣增加,這是不對的,參考manual的作法,先登記獲利或虧 損,再登記外幣的平衡項,這時後會跳出匯率視窗,要登記轉換總數為0,也就是匯率為0的意思,這也是一個虛項,將台幣計價的獲利或虧損轉換成價值為0的外 幣。

cash_old -> other currency =
cash_new <- other currency =
             other currency(0) = gain or loss
--> (ignore fee)
cash_new - cash-old = gain or loss

配股配息一樣要入帳,配股比較簡單,但是我還沒遇過,也許有錯,配股其實只要把股票項增加就好,因為股票項是隱藏的,也不會影響平衡;反之配息會讓現金增加,不得不考慮平衡的問題,首先配息會讓股價成本降低,要做個假的賣出和買進(如果有處理配息的功能的話,就不要照我這樣做),這樣會讓現金增加,同樣的錢不可能憑空增加,要再加一筆收入去平衡。

stock_old sell - stock_new buy + cash =
                        stock(hidden) = dividend income

BTW,這一年也遇到公司合併,就會有股票轉換的問題,這就簡單多了,只要把原股轉新股就可以了。

整本帳簿的結算其實很簡單,只要選 Tools/Close Book,就會自動把 Income 加總,Expense 加總,然後相減,列入Equity 這項,基於 Assets = Liability + Owner's Equity + (Income - Expenses)的原則,就可以檢查得出來自己的總帳目有沒有平衡,只要有如實記錄,理論上應該是平衡的,要是我念英文有像記帳那麼有恆心就好...。

2011/03/15

用 GnuCash 記帳 Accounting with GnuCash - 2

GnuCash進階教學-股票篇(1)

我是看上面的教學學習怎麼紀錄股票帳目的,他講的就不再贅述,這裡是將每種股票都分別列一個項目來紀錄,我關心的只是如何紀錄交易的獲利、虧損、配息以及如何結算,但我沒有信用交易的經驗,這裡不提,此外,還有一項小小的外幣記帳心得,只有記帳才會注意到,哇,原來手續費和證交稅就可以花費這麼多錢。

用 GnuCash 記帳 Accounting with GnuCash - 1

GnuCash
Gnucash入門使用教學(一)
GnuCash進階教學-股票篇(1)

09年退伍之後,就想著之後工作一定要瞭解自己的金錢流向,不會開源要先節流;有作投資的話,要能夠知道自己的獲利或是損失有多少,當成公司一樣管理,而不只是玩興趣的而已,剛好又學過基本的會計,就想實踐看看,基本上因為自己使用ubuntu,就不考慮windows only的軟體了,找了許多,正好GnuCash最合我的胃口,因為他的設計就是以會計原則列出所有名目的。

2011/03/13

大通(PX) HD-325 電視棒 on Ubuntu 10.04 x64

可否幫解釋如何安裝電視棒??
Linux,TV
smscore_set_device_mode: error -2 loading firmware: dvb_nova_12mhz_b0.inp

原本看到大通的電視棒可以解 Hi-HD 才買的,而且又看到他的盒子上說有支援 linux,報帳的項目剛好允許,二話不說買來玩玩看,沒想到這麼難裝。