wok rev 19903
linld/tazboot: fix memcpy32
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Apr 09 12:22:58 2017 +0200 (2017-04-09) |
parents | 3212f89e747f |
children | 7caa211f4e55 |
files | linld/stuff/src/COMMON.H linld/stuff/src/JUMP.ASM linld/stuff/src/LINKX.CMD linld/stuff/src/LOAD.CPP linld/stuff/src/MEMCPY32.ASM |
line diff
1.1 --- a/linld/stuff/src/COMMON.H Sat Apr 08 22:00:16 2017 +0000 1.2 +++ b/linld/stuff/src/COMMON.H Sun Apr 09 12:22:58 2017 +0200 1.3 @@ -101,4 +101,4 @@ 1.4 extern "C" int read_image(struct image_himem *m, void* data, int sz); 1.5 char* load_kernel(); 1.6 void load_initrd(); 1.7 -void boot_kernel(); 1.8 +extern "C" void boot_kernel();
2.1 --- a/linld/stuff/src/JUMP.ASM Sat Apr 08 22:00:16 2017 +0000 2.2 +++ b/linld/stuff/src/JUMP.ASM Sun Apr 09 12:22:58 2017 +0200 2.3 @@ -11,9 +11,15 @@ 2.4 p386 2.5 endif 2.6 2.7 - group DGROUP _TEXT,_BSS 2.8 + group DGROUP _TEXT,_DATA,_BSS 2.9 assume cs:DGROUP,ds:DGROUP 2.10 2.11 + segment _DATA byte public use16 'DATA' 2.12 + 2.13 +overflow db "Loaded too close to 9000:0",0 2.14 + 2.15 + ends _DATA 2.16 + 2.17 segment _BSS byte public use16 'BSS' 2.18 2.19 global _imgs:dword 2.20 @@ -23,6 +29,39 @@ 2.21 2.22 segment _TEXT byte public use16 'CODE' 2.23 2.24 + global _boot_kernel:near 2.25 +_boot_kernel: 2.26 +; Shrink stack: we won't need much of it now and have no malloc() plans 2.27 + extrn _heap_top:word 2.28 + mov ax,[_heap_top] 2.29 + inc ah 2.30 + cmp ax,sp 2.31 + ja samesp 2.32 + xchg ax,sp 2.33 +samesp: 2.34 + ifdef NO386 2.35 + extrn _topseg:near 2.36 + call near _topseg 2.37 + mov es,ax 2.38 + xchg ax,bx 2.39 + mov cl,4 2.40 + mov ax,sp 2.41 + shr ax,cl 2.42 + else 2.43 + mov bx,9000h 2.44 + mov es,bx 2.45 + mov ax,sp 2.46 + shr ax,4 2.47 + endif 2.48 + mov dx,cs 2.49 + add ax,dx 2.50 + cmp ax,bx 2.51 + jb nooverflow 2.52 +; Oops! We can stomp on our toes... better stop now 2.53 + mov bx,offset overflow 2.54 + extrn die:near 2.55 + jmp near die 2.56 +nooverflow: 2.57 ;*************************************************************** 2.58 ;void set_sregs_jump_seg_ofs(u32 csip); 2.59 ;****** Never returns 2.60 @@ -32,15 +71,6 @@ 2.61 2.62 extrn dos_shutdown:near 2.63 2.64 - ifdef NO386 2.65 - extrn _topseg:near 2.66 - call near _topseg 2.67 - mov es,ax 2.68 - xchg ax,bx 2.69 - else 2.70 - push 9000h 2.71 - pop es 2.72 - endif 2.73 cli ; we start doing destructive things to DOS 2.74 push es 2.75 pop ss
3.1 --- a/linld/stuff/src/LINKX.CMD Sat Apr 08 22:00:16 2017 +0000 3.2 +++ b/linld/stuff/src/LINKX.CMD Sun Apr 09 12:22:58 2017 +0200 3.3 @@ -1,1 +1,1 @@ 3.4 -_beg.obj memcpy32.obj jump.obj vcpi.obj himem.obj crtl.obj memtop.obj xmm.obj a20.obj load.obj iso9660.obj tazboot.obj _end.obj, tazboot 3.5 +_beg.obj memcpy32.obj memtop.obj jump.obj vcpi.obj himem.obj crtl.obj xmm.obj a20.obj load.obj iso9660.obj tazboot.obj _end.obj, tazboot
4.1 --- a/linld/stuff/src/LOAD.CPP Sat Apr 08 22:00:16 2017 +0000 4.2 +++ b/linld/stuff/src/LOAD.CPP Sun Apr 09 12:22:58 2017 +0200 4.3 @@ -263,19 +263,3 @@ 4.4 kernelparams->initrd_size = m->size; 4.5 } 4.6 } 4.7 - 4.8 -void boot_kernel() { 4.9 - 4.10 - // Shrink stack: we won't need much of it now and have no malloc() plans 4.11 - { 4.12 - u16 new_SP=u16(heap_top)+0x100; 4.13 - if(_SP>new_SP) _SP=new_SP; 4.14 - } 4.15 - if( (u16(_SP)>>4)+u16(_CS) >= topseg() ) { 4.16 - // Oops! We can stomp on our toes... better stop now 4.17 - die("Loaded too close to 9000:0"); 4.18 - } 4.19 - 4.20 - // Move rm loader & commandline to 0x90000, Jump to kernel rm code 4.21 - set_sregs_jump_seg_ofs(); 4.22 -}
5.1 --- a/linld/stuff/src/MEMCPY32.ASM Sat Apr 08 22:00:16 2017 +0000 5.2 +++ b/linld/stuff/src/MEMCPY32.ASM Sun Apr 09 12:22:58 2017 +0200 5.3 @@ -120,8 +120,7 @@ 5.4 5.5 ;****** Init *************************************************** 5.6 5.7 - ifndef FIXME_NO386 5.8 - p386 5.9 + ifndef NO386 5.10 5.11 enter TEMP_SIZE,0 5.12 ;cld 5.13 @@ -171,15 +170,15 @@ 5.14 xor bx,bx 5.15 xor dx,dx 5.16 xor si,si 5.17 - mov ax,[bp+8] ; srcseg 5.18 + mov ax,[srcseg] 5.19 mov cl,4 5.20 extrn N_LXLSH@:near 5.21 call near N_LXLSH@ 5.22 - add [bp+10],ax ; srcofs lo 5.23 - adc [bp+10+2],dx ; srcofs hi 5.24 + add [word srcofs],ax 5.25 + adc [word srcofs+2],dx 5.26 @@2flat: 5.27 - mov ax,[bp+si+10] ; srcofs, dstofs lo 5.28 - mov dx,[bp+si+10+2] ; srcofs, dstofs hi 5.29 + mov ax,[word si+srcofs] ; srcofs, dstofs lo 5.30 + mov dx,[word si+srcofs+2] ; srcofs, dstofs hi 5.31 extrn N_LXURSH@4:near 5.32 call near N_LXURSH@4 5.33 or bx,dx ; >=1mb flag 5.34 @@ -188,8 +187,8 @@ 5.35 jnz @@2flat 5.36 pop dx ; dstseg 5.37 pop ax ; srcseg 5.38 - test bx,bx ; <1mb ? (clear C) 5.39 - jnz @@pmcopy 5.40 + dec bx ; <1mb ? 5.41 + jns @@pmcopy 5.42 push di 5.43 @@movlp: 5.44 mov ds,ax