wok-6.x rev 19204

linld/tobzimage: add realmode_switch support (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 11 20:26:42 2016 +0200 (2016-06-11)
parents 86c9fae82f47
children 55f1b37cebe1
files linld/stuff/jump.u linld/stuff/load.u
line diff
     1.1 --- a/linld/stuff/jump.u	Sat Jun 11 15:57:21 2016 +0200
     1.2 +++ b/linld/stuff/jump.u	Sat Jun 11 20:26:42 2016 +0200
     1.3 @@ -1,47 +1,47 @@
     1.4  --- LINLD097/JUMP.ASM
     1.5  +++ LINLD097/JUMP.ASM
     1.6  @@ -24,33 +24,22 @@
     1.7 -                         jmpseg  :word,  \
     1.8 -                         jmpofs  :word   = PARAM_SIZE
     1.9 - 
    1.10 --                push    bp      ;TODO: kinda useless, isn't it?
    1.11 --		mov	bp,sp
    1.12 --
    1.13 --              ;;mov     ax,[jmpseg]     ;Move data to CS segment var
    1.14 --              ;;mov     [seg2],ax       ;  we cannot use any other seg!
    1.15 --              ;;mov     ax,[jmpofs]     ;
    1.16 --              ;;mov     [ofs2],ax       ;
    1.17 --                mov     cx,[jmpofs]     ;Do NOT load in r32:
    1.18 --                mov     dx,[jmpseg]     ;  wrong order!
    1.19 --
    1.20 --                mov     ax,[sreg]
    1.21 --                mov     sp,[stk]        ;Do not use [bp+n] after this...
    1.22 --                mov     ds,ax
    1.23 --                mov     es,ax
    1.24 --                mov     ss,ax
    1.25 --                mov     fs,ax
    1.26 --                mov     gs,ax
    1.27 -+		pop	bx		;caller return address
    1.28 -+		pop	bx		; sreg
    1.29 -+		pop	ax		; stk
    1.30 -+		pop	dx		; jmpseg
    1.31 -+		pop	cx		; jmpofs
    1.32 -+                mov     ds,bx
    1.33 -+                mov     es,bx
    1.34 -+                mov     fs,bx
    1.35 -+                mov     gs,bx
    1.36 -+                mov     ss,bx
    1.37 -+                xchg	sp,ax
    1.38 - 		assume	nothing
    1.39 - 		assume	cs:DGROUP
    1.40 - 
    1.41 --              ;;jmp     [dword ofs2]
    1.42 --
    1.43 -                 push    dx cx
    1.44 -                 retf
    1.45 --; Data
    1.46 --;;ofs2            dw      ?
    1.47 --;;seg2            dw      ?
    1.48 -         endp    _set_sregs_jump_seg_ofs
    1.49 - 
    1.50 -         ends    _TEXT
    1.51 +                         jmpseg  :word,  \
    1.52 +                         jmpofs  :word   = PARAM_SIZE
    1.53 + 
    1.54 +-                push    bp      ;TODO: kinda useless, isn't it?
    1.55 +-		mov	bp,sp
    1.56 +-
    1.57 +-              ;;mov     ax,[jmpseg]     ;Move data to CS segment var
    1.58 +-              ;;mov     [seg2],ax       ;  we cannot use any other seg!
    1.59 +-              ;;mov     ax,[jmpofs]     ;
    1.60 +-              ;;mov     [ofs2],ax       ;
    1.61 +-                mov     cx,[jmpofs]     ;Do NOT load in r32:
    1.62 +-                mov     dx,[jmpseg]     ;  wrong order!
    1.63 +-
    1.64 +-                mov     ax,[sreg]
    1.65 +-                mov     sp,[stk]        ;Do not use [bp+n] after this...
    1.66 +-                mov     ds,ax
    1.67 +-                mov     es,ax
    1.68 +-                mov     ss,ax
    1.69 +-                mov     fs,ax
    1.70 +-                mov     gs,ax
    1.71 ++		pop	bx		;caller return address
    1.72 ++		pop	bx		; sreg
    1.73 ++		pop	ax		; stk
    1.74 ++		pop	dx		; jmpseg
    1.75 ++		pop	cx		; jmpofs
    1.76 ++                mov     ds,bx
    1.77 ++                mov     es,bx
    1.78 ++                mov     fs,bx
    1.79 ++                mov     gs,bx
    1.80 ++                mov     ss,bx
    1.81 ++                xchg	sp,ax
    1.82 + 		assume	nothing
    1.83 + 		assume	cs:DGROUP
    1.84 + 
    1.85 +-              ;;jmp     [dword ofs2]
    1.86 +-
    1.87 +                 push    dx cx
    1.88 +                 retf
    1.89 +-; Data
    1.90 +-;;ofs2            dw      ?
    1.91 +-;;seg2            dw      ?
    1.92 +         endp    _set_sregs_jump_seg_ofs
    1.93 + 
    1.94 +         ends    _TEXT
     2.1 --- a/linld/stuff/load.u	Sat Jun 11 15:57:21 2016 +0200
     2.2 +++ b/linld/stuff/load.u	Sat Jun 11 20:26:42 2016 +0200
     2.3 @@ -5,15 +5,15 @@
     2.4       if(first1k->boot_flag != 0xAA55)
     2.5           die("No boot signature (55,AA). It's not a kernel");
     2.6  -    if(first1k->header != HdrS)
     2.7 -+    if(first1k->header != HdrS) // starting linux 1.3.73
     2.8  -        die("No 'HdrS' signature (kernel is too old)");
     2.9 -+        die("No 'HdrS' signature (kernel is too old, try /usr/bin/tobzimage)");
    2.10  -    if(first1k->version < 0x202)
    2.11  -        die("Loader protocol version is less than 2.02 (kernel is too old)");
    2.12 ++    if(first1k->header != HdrS) // starting linux 1.3.73
    2.13 ++        die("No 'HdrS' signature (kernel is too old, try /usr/bin/tobzimage)");
    2.14       if(!(first1k->loadflags & 0x01))
    2.15           die("I can't load bzImages low");
    2.16   
    2.17 -@@ -414,7 +412,13 @@
    2.18 +@@ -414,15 +412,23 @@
    2.19       // Tell rm loader some info
    2.20   
    2.21       first1k->vid_mode = vid_mode;
    2.22 @@ -28,3 +28,17 @@
    2.23       first1k->type_of_loader = 0xff; // kernel do not know us (yet :-)
    2.24       // * will be called just before rm -> pm
    2.25       first1k->realmode_switch_ofs = ofs(last_ditch);
    2.26 +     first1k->realmode_switch_seg = seg(last_ditch);
    2.27 +-    // * offset limit of the setup heap
    2.28 +-    //   heap_end_ptr appears to be relative to the start of setup (ofs 0x0200)
    2.29 +-    first1k->heap_end_ptr = _32k-0x0200;
    2.30 +-    first1k->loadflags |= 0x80; // says to rm loader it's ok to use heap
    2.31 ++    if(first1k->version >= 0x201) {
    2.32 ++        // * offset limit of the setup heap
    2.33 ++        //   heap_end_ptr appears to be relative to the start of setup (ofs 0x0200)
    2.34 ++        first1k->heap_end_ptr = _32k-0x0200;
    2.35 ++        first1k->loadflags |= 0x80; // says to rm loader it's ok to use heap
    2.36 ++    }
    2.37 +     // * if we will ever stop moving ourself to 0x90000
    2.38 +     //   we must say setup.S how much to move
    2.39 +     //first1k->setup_move_size = _32k;