Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inline annotated function disassembly #17

Merged
merged 1 commit into from
Nov 6, 2020

Conversation

stschake
Copy link
Contributor

@stschake stschake commented Nov 6, 2020

These are Ghidra disassemblies of functions where
the DWARF data indicates functions were inlined.
Instructions belonging to an inlined function are
marked as such at the end. This is particularly
helpful for functions that access peripheral
registers where helper functions are used that
are almost always inlined and the name of the
inlined function can reveal the register name
or purpose.

Example:

                            ;undefined rf_reset()
2300e2d0        4111            c.addi      sp,-0x10                                
2300e2d2        06c6            c.swsp      ra,0xc,sp                               
2300e2d4        b7070028        lui         a5=>DAT_28000000,0x28000                                ;ble_txpwrup_setf
2300e2d8        03a70708        lw          a4,0x80,a5=>DAT_28000080                                ;ble_txpwrup_setf
2300e2dc        c176            c.lui       a3,0x30                                                 ;ble_txpwrdn_setf
2300e2de        9386f60f        addi        a3,a3,0xff                                              ;ble_txpwrdn_setf
2300e2e2        137707f0        andi        a4,a4,-0x100                                            ;ble_txpwrup_setf
2300e2e6        13672704        ori         a4,a4,0x42                                              ;ble_txpwrup_setf
2300e2ea        23a0e708        sw          a4,0x80,a5=>DAT_28000080                                ;ble_txpwrup_setf
2300e2ee        03a70708        lw          a4,0x80,a5=>DAT_28000080                                ;ble_txpwrdn_setf
2300e2f2        758f            c.and       a4,a3                                                   ;ble_txpwrdn_setf
2300e2f4        23a0e708        sw          a4,0x80,a5=>DAT_28000080                                ;ble_txpwrdn_setf
2300e2f8        03a70708        lw          a4,0x80,a5=>DAT_28000080                                ;ble_rxpwrup_setf
2300e2fc        b70601ff        lui         a3,0xff010                                              ;ble_rxpwrup_setf
2300e300        fd16            c.addi      a3,-0x1                                                 ;ble_rxpwrup_setf
2300e302        758f            c.and       a4,a3                                                   ;ble_rxpwrup_setf
2300e304        b7063c00        lui         a3,0x3c0                                                ;ble_rxpwrup_setf
2300e308        558f            c.or        a4,a3                                                   ;ble_rxpwrup_setf
2300e30a        23a0e708        sw          a4,0x80,a5=>DAT_28000080                                ;ble_rxpwrup_setf
2300e30e        03a70708        lw          a4,0x80,a5=>DAT_28000080                                ;ble_rtrip_delay_setf
2300e312        b7060081        lui         a3,0x81000                                              ;ble_rtrip_delay_setf
2300e316        fd16            c.addi      a3,-0x1                                                 ;ble_rtrip_delay_setf
2300e318        758f            c.and       a4,a3                                                   ;ble_rtrip_delay_setf
2300e31a        23a0e708        sw          a4,0x80,a5=>DAT_28000080                                ;ble_rtrip_delay_setf
2300e31e        2947            c.li        a4,0xa                                                  ;ble_tx_delay_time_select_setf
2300e320        23a2e71a        sw          a4,0x1a4,a5=>DAT_280001a4                               ;ble_tx_delay_time_select_setf
2300e324        1307d007        li          a4,0x7d                                                 ;ble_tx_proc_time_us_setf
2300e328        23a4e71a        sw          a4,0x1a8,a5=>DAT_280001a8                               ;ble_tx_proc_time_us_setf
2300e32c        03a7c71a        lw          a4,0x1ac,a5=>DAT_280001ac                               ;ble_rxsyncwinszdef_setf
2300e330        137707fc        andi        a4,a4,-0x40                                             ;ble_rxsyncwinszdef_setf
2300e334        13678702        ori         a4,a4,0x28                                              ;ble_rxsyncwinszdef_setf
2300e338        23a6e71a        sw          a4,0x1ac,a5=>DAT_280001ac                               ;ble_rxsyncwinszdef_setf
2300e33c        ef800402        jal         ra,bz_phy_reset                         
2300e340        b7e70042        lui         a5,0x4200e                              
2300e344        b240            c.lwsp      ra,0xc,sp                               
2300e346        038547bb        lb          a0,-0x44c,a5=>g_txpower_dbm             
2300e34a        4101            c.addi      sp,0x10                                 
2300e34c        6ff09ff3        j           rf_txpwr_max_set    

These are Ghidra disassemblies of functions where
the DWARF data indicates functions where inlined.
Instructions belonging to an inlined function are
marked as such at the end. This is particularly
helpful for functions that access peripheral
registers where helper functions are used that
are almost always inlined and the name of the
inlined function can reveal the register name
or purpose.
@gamelaster gamelaster merged commit 397c75e into pine64:master Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants