wok diff linld/stuff/src/LOAD.CPP @ rev 20751

Add libsbc
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 12 12:12:36 2019 +0100 (23 months ago)
parents 7f39f4ab7511
children 094f58ac8183
line diff
     1.1 --- a/linld/stuff/src/LOAD.CPP	Sun Feb 10 10:35:42 2019 +0100
     1.2 +++ b/linld/stuff/src/LOAD.CPP	Tue Feb 12 12:12:36 2019 +0100
     1.3 @@ -112,11 +112,10 @@
     1.4  const u32 HdrS = 'H' + ('d'<<8) + (u32('r')<<16) + (u32('S')<<24);
     1.5  
     1.6  // register value to launch the kernel real mode code
     1.7 +static u32 csip;
     1.8  #ifdef NO386
     1.9 -u32 csip;
    1.10  extern "C" u16 topseg();
    1.11  #else
    1.12 -u32 csip=0x90200000;
    1.13  #define topseg() 0x9000
    1.14  #endif
    1.15  u16 rm_size;
    1.16 @@ -133,25 +132,21 @@
    1.17  #define _rm_buf(m)	(((u8**)(m))[-1])
    1.18  #define _pm_high	(((u8*)(m))[-3])
    1.19  #define _rm_size	(*(u16*)((u8*)(m)-5))
    1.20 -#ifdef NO386
    1.21  #define _csip		(*(u32*)((u8*)(m)-9))
    1.22 -    *((u16 *)&csip+1)=topseg()+0x20;
    1.23 -#else
    1.24 -#define _csip		csip
    1.25 -#endif
    1.26 -    // Open kernel, read first kb, check it
    1.27 -    m->errmsg = kernel_file_error;
    1.28 -    open_image(kernel_name, m);
    1.29 -
    1.30      char *version_string;
    1.31    {
    1.32      struct kernelparams_t *kernelparams;
    1.33      kernelparams = &(((first1k_t*) (_rm_buf(m) = (u8 *)malloc_or_die(_32k)))->params);
    1.34  #define first1k		((first1k_t*)((u8 *)kernelparams-0x1F1))
    1.35  
    1.36 +    *((u16 *)&_csip+1)=topseg()|0x20;
    1.37 +    // Open kernel, read first kb, check it
    1.38 +    m->errmsg = kernel_file_error;
    1.39 +    open_image(kernel_name, m);
    1.40 +
    1.41  do {
    1.42      // Do not use malloc below until heap_top adjustment (see <*>)
    1.43 - if (read(m->fd, rm_buf, 0x200) == 0x200) {
    1.44 + if (readrm(m, 0x200) == 0x200) {
    1.45  
    1.46      lseekcur(m->fd,-0x200);
    1.47      if(kernelparams->setup_sects == 0) {
    1.48 @@ -171,7 +166,7 @@
    1.49      m->chunk_size -= _rm_size;
    1.50  
    1.51      // Read remaining rm loader
    1.52 -    if (read(m->fd, rm_buf, _rm_size) == _rm_size) break;
    1.53 +    if (readrm(m, _rm_size) == _rm_size) break;
    1.54   }
    1.55          die(kernel_file_error);
    1.56  } while (0);