From 733e326d0a418cf70b2540a3ca871dc8eab9e7f0 Mon Sep 17 00:00:00 2001 From: "Magomed Kostoev (mkostoevr)" Date: Sat, 16 May 2020 11:58:21 +0000 Subject: [PATCH] Rewrite Backy to compile with GCC. git-svn-id: svn://kolibrios.org@7927 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/backy/Backy | Bin 8174 -> 4552 bytes programs/develop/backy/Backy-lib.h | 45 +++++++++++++++------------- programs/develop/backy/Backy.c | 4 +-- programs/develop/backy/make_gcc.bat | 4 +++ 4 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 programs/develop/backy/make_gcc.bat diff --git a/programs/develop/backy/Backy b/programs/develop/backy/Backy index 1278d178a11f9cbe2d42d107b0843576a7345a1f..ac95db75baf221778cbab9d7f898a184dce99dc9 100644 GIT binary patch literal 4552 zcmc&&eQXow8Gp}qz)OtJ?F`G3&|b&U87(+YMny=if=L1l0gXy1VOd8_;t&fbwwyZ% zCMVi^S*xG_p-Kr-G=%`PZh@)TZFOK&RD}@V=Sv;Y}t1iGlQRSFm~<<#(odQ zQ*~gRw&4|@#hAc)2Qxflz1P^yOy=UUSVCID4YnS$Lf)#*A~p3w?*y~J@M}c;?VSvs zi_5gyr&^DJ!Fq>DIQ|Tz7uJP^KxbIq+AeeiI>OPNLR&a0bV>e}ZGt}(3b**BV7L=D z%7o+8T)>OV)H>0oVJO3nBylO*soeF%)^jd}OluU&)Ju~Z#i}D~-JFD?3xrp-h^f*d z1WA;P)`=FX4Y8`hLbNidl#MbI`68-O^r#J#0-=l428YrkRx@b_(NUD2g#OGvg2O|0qyd*GX|1r^)_xyWBdu`T`2n$(i$n4i`AuM%Ac>d?kS(H zO*xKQMD{JlQge`wZZBJbA`OaaB7+^&-r>1zTU?&^C$H1UQVi|5XAl!*idt& z3zU%PqQqPUBrsg3iH6up>p|>XW+9kOk4HwH-QRq)pn7-c(E{J&EH>?~d9;O}KSVqD z(ZZelYx^KHieknZXf#2+rZnLp{6KP(|1EIH#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l0q;+#cMDMV{W_{$4(az8N#~k92`?_c?)+EkD=UuD-{in_PZC zU-S$>Wbj!8dQN4H9L)h+jP%g}g46#Qk!?!Vk$R z$-VgC7)5QLCI^mexP=e>0LblRr>oJt@dYiPJg+s%3psc-1NjX4>!lpQS0u0kt2BP+ z?N|fx$R#S8Ybd|K3xnakhlbJe$c-F zWLYFi;3YEMT+e~(LO5StLq?!CR2 z@yuKQHV?-0R0|Xx>(ePR2eF4792*;+(2Xo&1HQ1$60eBrPZ;9vi( UZYDpE%t#yZqo}m-T)=d)04eJ0`~Uy| diff --git a/programs/develop/backy/Backy-lib.h b/programs/develop/backy/Backy-lib.h index 9e8aee86d7..23b030251a 100644 --- a/programs/develop/backy/Backy-lib.h +++ b/programs/develop/backy/Backy-lib.h @@ -2,14 +2,7 @@ #ifndef __jxl_Date_get_h__ #define __jxl_Date_get_h__ -typedef unsigned int uint32_t; -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned long long uint64_t; -typedef char int8_t; -typedef short int int16_t; -typedef int int32_t; -typedef long long int64_t; +#include static inline uint32_t getDate(void) { @@ -44,18 +37,30 @@ static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uin { int32_t val; - uint8_t dt[28]; // basic information structure. - - (uint32_t) dt[0] = 2; // subfunction number. - (uint32_t) dt[4] = 0; // reserved. - (uint32_t) dt[8] = 0; // reserved. - (uint32_t) dt[12] = nbytes; // number of bytes to write. - (uint8_t *) dt[16] = data; // pointer to data. - (uint32_t) dt[20] = enc; // string encoding (0 = default, 1 = cp866, 2 = UTF-16LE, 3 = UTF-8). - (uint8_t *) dt[24] = path; // pointer to path. - - __asm__ __volatile__("int $0x40":"=a"(val):"a"(80), "b"(&dt)); - + struct file_op_t + { + uint32_t fn; + uint32_t reserved0; + uint32_t reserved1; + uint32_t number_of_bytes_to_write; + void * pointer_to_data; + char path[1]; + } *file_op = calloc(sizeof(*file_op) + strlen(path) + 2, 1); // FIXME: Not works on UTF16LE enc + + file_op->fn = 2; + file_op->number_of_bytes_to_write = nbytes; + file_op->pointer_to_data = data; + if (enc != 0) + { + file_op->path[0] = enc; + strcpy(file_op->path + 1, path); + } + else + { + strcpy(file_op->path, path); + } + + asm volatile ("int $0x40":"=a"(val):"a"(80), "b"(file_op)); return val; } diff --git a/programs/develop/backy/Backy.c b/programs/develop/backy/Backy.c index 0e862bb314..08ff93acff 100644 --- a/programs/develop/backy/Backy.c +++ b/programs/develop/backy/Backy.c @@ -212,7 +212,7 @@ int main(int argc, char** argv) } - itoab(*dta, num, 16); + itoa(*dta, num, 16); if (num[1] == 0) { @@ -254,7 +254,7 @@ int main(int argc, char** argv) if (i == 2) dta = &seconds; - itoab(*dta, num, 16); + itoa(*dta, num, 16); if (num[1] == 0) { diff --git a/programs/develop/backy/make_gcc.bat b/programs/develop/backy/make_gcc.bat new file mode 100644 index 0000000000..5dc7f96db3 --- /dev/null +++ b/programs/develop/backy/make_gcc.bat @@ -0,0 +1,4 @@ +gcc -m32 -c -fomit-frame-pointer -IC:\Users\Boppan\Documents\KolibriOS\contrib/sdk/sources/newlib/libc/include Backy.c -o Backy.o -Wall -Wextra +kos32-ld Backy.o -o Backy.gcc -static -S -nostdlib -T C:\Users\Boppan\Documents\KolibriOS\contrib/sdk/sources/newlib/app.lds --image-base 0 -L "C:\Program Files (x86)\kos32-msys-5.4.0\win32\lib" -lgcc -lapp -lc.dll +kos32-objcopy Backy.gcc -O binary +@pause \ No newline at end of file