Andes Workshop

It is currently Thu Mar 28, 2024 8:29 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: 如何使vector table對齊16 bytes
PostPosted: Fri Feb 22, 2013 6:15 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
vector table的size是可變的,
在ESZ裡設定,一般情況設在4 bytes就好,
可以省code size。
下面這個例子裡,每個vector佔16byte。
這個程式中,nop在compile過後變成2byte的nop,造成vector的位置錯誤。

Code:
        j _start                            !  (0) Trap Reset
        nop
        nop
        nop
        j OS_Trap_DebugException         !  (1) Trap DebugException
        nop
        nop
        nop
        j OS_Trap_GeneralException       !  (2) Trap GeneralException
        nop
        nop
        nop


這裡有2個建議,
(1) 將vector的size改成4 bytes,不需要用nop填充空間。
也可以省code size。
(2) 如果真的要用16 byte的vector,可以用下列的語法。
Code:
.align 4
exception_vector:
.align 4
j _start ! (0) Trap Reset
.align 4
j OS_Trap_DebugException ! (1) Trap DebugException
.align 4
j OS_Trap_GeneralException ! (2) Trap GeneralException
.align 4


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group