wok-6.x annotate linld/stuff/src/JUMP.ASM @ rev 19571

linld: large image support with VCPI
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 22 21:06:17 2016 +0100 (2016-12-22)
parents 7f92b23984dc
children 76087975885f
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@19571 24 ;void set_sregs_jump_seg_ofs(u32 csip);
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@19571 33 ifdef NO386
pascal@19571 34 extrn _topseg:near
pascal@19571 35 call near _topseg
pascal@19571 36 mov es,ax
pascal@19571 37 else
pascal@19571 38 push 9000h
pascal@19571 39 pop es
pascal@19571 40 endif
pascal@19571 41 pop cx ; ip
pascal@19571 42 pop dx ; cs
pascal@19571 43 push es
pascal@19571 44 pop ss
pascal@19571 45 mov sp,0A000h
pascal@19571 46 push dx cx
pascal@19571 47 extrn _rm_buf:word
pascal@19571 48 mov si,[_rm_buf]
pascal@19571 49 xor di,di
pascal@19571 50 extrn _rm_size:word
pascal@19571 51 mov cx,[_rm_size]
pascal@19571 52 ;cld
pascal@19571 53 rep
pascal@19571 54 movsb
pascal@19571 55 extrn _cmdline:word
pascal@19571 56 mov si,[_cmdline]
pascal@19571 57 mov di,8000h
pascal@19571 58 mov ch,10h ; 4k
pascal@19571 59 rep
pascal@19571 60 movsb
pascal@19571 61 cmp [_pm_high],cl ; load high ?
pascal@19515 62 jne isbzimage
pascal@19515 63 ; finish loading
pascal@19515 64 extrn @last_ditch$qv:near
pascal@19515 65 push cs
pascal@19515 66 call @last_ditch$qv
pascal@19571 67 mov ax,[word _pm+2+2] ; get pm->fallback high word
pascal@19515 68 ; self move
pascal@19571 69 ;cld
pascal@19538 70 push 9900h ; 4096 bytes for cmdline
pascal@19538 71 ;push 9820h ; 512 bytes for cmdline
pascal@19538 72 pop es ; min 2048 bytes for stack
pascal@19538 73 xor si,si ; A000 -9000 -0800(>movedend)
pascal@19515 74 xor di,di ; set ZF
pascal@19538 75 mov cx,offset movedend
pascal@19515 76 global _bss_end:byte
pascal@19538 77 ;mov cx,offset _bss_end
pascal@19515 78 rep
pascal@19515 79 movsb
pascal@19515 80 push es
pascal@19515 81 call near doretf ; mov cs,es
pascal@19571 82 push ss
pascal@19571 83 pop es
pascal@19515 84 push cs
pascal@19515 85 pop ds
pascal@19571 86 push ax
pascal@19515 87 call near dos_shutdown
pascal@19538 88 ;in al,70h
pascal@19538 89 ;or al,80h ; disable NMI
pascal@19538 90 ;out 70h,al
pascal@19538 91 pop bx
pascal@19515 92 ; move zImage pm
pascal@19515 93 mov ax,8
pascal@19515 94 cwd
pascal@19515 95 cmp bx,ax
pascal@19538 96 ja bufhigh
pascal@19515 97 sub ax,bx
pascal@19515 98 inc ax
pascal@19515 99 bufhigh:
pascal@19515 100 push ax
pascal@19515 101 push dx ; size=up to 512k
pascal@19515 102 push bx ; src ofs= pm.fallback
pascal@19515 103 push dx
pascal@19515 104 push dx ; srcseg=0
pascal@19515 105 push 1 ; dst
pascal@19515 106 push dx ; ofs=64k
pascal@19515 107 extrn _memcpy32:near
pascal@19515 108 call _memcpy32
pascal@19538 109 add sp,14
pascal@19515 110
pascal@19515 111 ifndef noelks
pascal@19515 112 push ss
pascal@19515 113 pop ds
pascal@19515 114 ifndef NO386
pascal@19515 115 cmp [dword 1E6h],'SKLE'
pascal@19515 116 else
pascal@19515 117 cmp [word 1E6h],'LE'
pascal@19515 118 jne notelks
pascal@19515 119 cmp [word 1E8h],'SK'
pascal@19515 120 endif
pascal@19515 121 jne notelks
pascal@19515 122 push 100h
pascal@19515 123 pop es
pascal@19515 124 xor si,si
pascal@19515 125 xor di,di
pascal@19515 126 mov ch,05h
pascal@19515 127 rep
pascal@19515 128 movsw
pascal@19515 129 push es
pascal@19515 130 pop ss
pascal@19515 131 push 120h
pascal@19515 132 push 0
pascal@19515 133 notelks:
pascal@19515 134 endif
pascal@19515 135
pascal@19571 136 isbzimage:
pascal@19515 137 push ss
pascal@19515 138 pop ds
pascal@19571 139 ;push ss
pascal@19571 140 ;pop es
pascal@19515 141 push ss
pascal@19515 142 pop fs
pascal@19515 143 push ss
pascal@19515 144 pop gs
pascal@19515 145 assume nothing
pascal@19515 146 assume cs:DGROUP
pascal@19515 147
pascal@19515 148 doretf:
pascal@19515 149 retf
pascal@19515 150
pascal@19515 151 movedend:
pascal@19515 152 endp _set_sregs_jump_seg_ofs
pascal@19515 153
pascal@19515 154 ends _TEXT
pascal@19515 155
pascal@19515 156 end
pascal@19515 157
pascal@19515 158 ;###### END OF FILE ############################################