Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* romfs move to __ebss */ |
| 2 | |
| 3 | #include <asm/linkage.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | |
| 5 | #if defined(__H8300H__) |
| 6 | .h8300h |
| 7 | #endif |
| 8 | #if defined(__H8300S__) |
| 9 | .h8300s |
| 10 | #endif |
| 11 | |
| 12 | #define BLKOFFSET 512 |
| 13 | |
| 14 | .text |
| 15 | .globl __move_romfs |
| 16 | _romfs_sig_len = 8 |
| 17 | |
| 18 | __move_romfs: |
| 19 | mov.l #__sbss,er0 |
| 20 | mov.l #_romfs_sig,er1 |
| 21 | mov.b #_romfs_sig_len,r3l |
| 22 | 1: /* check romfs image */ |
| 23 | mov.b @er0+,r2l |
| 24 | mov.b @er1+,r2h |
| 25 | cmp.b r2l,r2h |
| 26 | bne 2f |
| 27 | dec.b r3l |
| 28 | bne 1b |
| 29 | |
| 30 | /* find romfs image */ |
| 31 | mov.l @__sbss+8,er0 /* romfs length(be) */ |
| 32 | mov.l #__sbss,er1 |
| 33 | add.l er0,er1 /* romfs image end */ |
| 34 | mov.l #__ebss,er2 |
| 35 | add.l er0,er2 /* distination address */ |
| 36 | #if defined(CONFIG_INTELFLASH) |
| 37 | add.l #BLKOFFSET,er2 |
| 38 | #endif |
| 39 | adds #2,er0 |
| 40 | adds #1,er0 |
| 41 | shlr er0 |
| 42 | shlr er0 /* transfer length */ |
| 43 | 1: |
| 44 | mov.l @er1,er3 /* copy image */ |
| 45 | mov.l er3,@er2 |
| 46 | subs #4,er1 |
| 47 | subs #4,er2 |
| 48 | dec.l #1,er0 |
| 49 | bpl 1b |
| 50 | 2: |
| 51 | rts |
| 52 | |
| 53 | .section .rodata |
| 54 | _romfs_sig: |
| 55 | .ascii "-rom1fs-" |
| 56 | |
| 57 | .end |