wok-6.x annotate linld/stuff/src/JUMP.ASM @ rev 19515
linld: multi initrd support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Nov 22 21:19:01 2016 +0100 (2016-11-22) |
parents | |
children | 7f92b23984dc |
rev | line source |
---|---|
pascal@19515 | 1 ;*************************************************************** |
pascal@19515 | 2 ;****** This file is distributed under GPL |
pascal@19515 | 3 ;*************************************************************** |
pascal@19515 | 4 ideal |
pascal@19515 | 5 %crefref |
pascal@19515 | 6 %noincl |
pascal@19515 | 7 %nomacs |
pascal@19515 | 8 p386 |
pascal@19515 | 9 |
pascal@19515 | 10 group DGROUP _TEXT,_BSS |
pascal@19515 | 11 assume cs:DGROUP,ds:DGROUP |
pascal@19515 | 12 |
pascal@19515 | 13 segment _BSS byte public use16 'BSS' |
pascal@19515 | 14 |
pascal@19515 | 15 global _pm_high:byte |
pascal@19515 | 16 global _pm:dword |
pascal@19515 | 17 |
pascal@19515 | 18 ends _BSS |
pascal@19515 | 19 |
pascal@19515 | 20 |
pascal@19515 | 21 segment _TEXT byte public use16 'CODE' |
pascal@19515 | 22 |
pascal@19515 | 23 ;*************************************************************** |
pascal@19515 | 24 ;void set_sregs_jump_seg_ofs(u32 csip, u32 sssp); |
pascal@19515 | 25 ;****** Never returns |
pascal@19515 | 26 ;*************************************************************** |
pascal@19515 | 27 global _set_sregs_jump_seg_ofs:near |
pascal@19515 | 28 proc _set_sregs_jump_seg_ofs near |
pascal@19515 | 29 |
pascal@19515 | 30 extrn dos_shutdown:near |
pascal@19515 | 31 |
pascal@19515 | 32 pop ax ;caller return address |
pascal@19515 | 33 test [byte _pm_high],-1 ; load high ? clear CF |
pascal@19515 | 34 jne isbzimage |
pascal@19515 | 35 ; finish loading |
pascal@19515 | 36 extrn @last_ditch$qv:near |
pascal@19515 | 37 push cs |
pascal@19515 | 38 call @last_ditch$qv |
pascal@19515 | 39 mov bx,[word _pm+2+2] ; get pm->fallback high word |
pascal@19515 | 40 ; self move |
pascal@19515 | 41 cld |
pascal@19515 | 42 ; push 9940h ; 5120 bytes for cmdline |
pascal@19515 | 43 push 9820h ; 512 bytes for cmdline |
pascal@19515 | 44 pop es ; min 1024 bytes for stack |
pascal@19515 | 45 xor si,si ; A000 -9400 -0800(>movedend) |
pascal@19515 | 46 xor di,di ; set ZF |
pascal@19515 | 47 ; mov cx,offset movedend |
pascal@19515 | 48 global _bss_end:byte |
pascal@19515 | 49 mov cx,offset _bss_end |
pascal@19515 | 50 rep |
pascal@19515 | 51 movsb |
pascal@19515 | 52 push es |
pascal@19515 | 53 call near doretf ; mov cs,es |
pascal@19515 | 54 stc |
pascal@19515 | 55 isbzimage: |
pascal@19515 | 56 pop cx ; ip |
pascal@19515 | 57 pop dx ; cs |
pascal@19515 | 58 pop ax ; sp |
pascal@19515 | 59 pop ss ; ss |
pascal@19515 | 60 xchg sp,ax |
pascal@19515 | 61 push dx cx |
pascal@19515 | 62 jnc nomove |
pascal@19515 | 63 push cs |
pascal@19515 | 64 pop ds |
pascal@19515 | 65 call near dos_shutdown |
pascal@19515 | 66 ; move zImage pm |
pascal@19515 | 67 mov ax,8 |
pascal@19515 | 68 cwd |
pascal@19515 | 69 cmp bx,ax |
pascal@19515 | 70 jnb bufhigh |
pascal@19515 | 71 sub ax,bx |
pascal@19515 | 72 inc ax |
pascal@19515 | 73 bufhigh: |
pascal@19515 | 74 push ax |
pascal@19515 | 75 push dx ; size=up to 512k |
pascal@19515 | 76 push bx ; src ofs= pm.fallback |
pascal@19515 | 77 push dx |
pascal@19515 | 78 push dx ; srcseg=0 |
pascal@19515 | 79 push 1 ; dst |
pascal@19515 | 80 push dx ; ofs=64k |
pascal@19515 | 81 push dx ; dstseg=0 |
pascal@19515 | 82 extrn _memcpy32:near |
pascal@19515 | 83 call _memcpy32 |
pascal@19515 | 84 add sp,16 |
pascal@19515 | 85 |
pascal@19515 | 86 ifndef noelks |
pascal@19515 | 87 push ss |
pascal@19515 | 88 pop ds |
pascal@19515 | 89 ifndef NO386 |
pascal@19515 | 90 cmp [dword 1E6h],'SKLE' |
pascal@19515 | 91 else |
pascal@19515 | 92 cmp [word 1E6h],'LE' |
pascal@19515 | 93 jne notelks |
pascal@19515 | 94 cmp [word 1E8h],'SK' |
pascal@19515 | 95 endif |
pascal@19515 | 96 jne notelks |
pascal@19515 | 97 push 100h |
pascal@19515 | 98 pop es |
pascal@19515 | 99 xor si,si |
pascal@19515 | 100 xor di,di |
pascal@19515 | 101 mov ch,05h |
pascal@19515 | 102 rep |
pascal@19515 | 103 movsw |
pascal@19515 | 104 push es |
pascal@19515 | 105 pop ss |
pascal@19515 | 106 push 120h |
pascal@19515 | 107 push 0 |
pascal@19515 | 108 notelks: |
pascal@19515 | 109 endif |
pascal@19515 | 110 |
pascal@19515 | 111 nomove: |
pascal@19515 | 112 push ss |
pascal@19515 | 113 pop ds |
pascal@19515 | 114 push ss |
pascal@19515 | 115 pop es |
pascal@19515 | 116 push ss |
pascal@19515 | 117 pop fs |
pascal@19515 | 118 push ss |
pascal@19515 | 119 pop gs |
pascal@19515 | 120 assume nothing |
pascal@19515 | 121 assume cs:DGROUP |
pascal@19515 | 122 |
pascal@19515 | 123 doretf: |
pascal@19515 | 124 retf |
pascal@19515 | 125 |
pascal@19515 | 126 movedend: |
pascal@19515 | 127 endp _set_sregs_jump_seg_ofs |
pascal@19515 | 128 |
pascal@19515 | 129 ends _TEXT |
pascal@19515 | 130 |
pascal@19515 | 131 end |
pascal@19515 | 132 |
pascal@19515 | 133 ;###### END OF FILE ############################################ |