Re: [SeaBIOS] Mysterious "is VARVERIFY32INIT but used from" problem while trying to improve SeaBIOS
On Sun, Feb 25, 2018 at 08:51:56PM +0300, Mike Banon wrote: > > > > Please see the developer documentation: > > > > I am afraid this documentation does not answer why this build problem > does not happen when I apply this patch to the standalone cloned seabios > while it does happens when I apply it to the seabios built by a coreboot The default seabios configuration is to build for qemu and not coreboot. So, by default it would not include that code and would not raise a compile time error. If you configured seabios to build for coreboot and it didn't raise a compile time error then that seems like a build defect. -Kevin ___ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] Mysterious "is VARVERIFY32INIT but used from" problem while trying to improve SeaBIOS
> > Please see the developer documentation: > I am afraid this documentation does not answer why this build problem does not happen when I apply this patch to the standalone cloned seabios while it does happens when I apply it to the seabios built by a coreboot Best regards, Mike On Sun, Feb 25, 2018 at 5:41 PM, Kevin O'Connorwrote: > On Sun, Feb 25, 2018 at 03:05:06AM +0300, Mike Banon wrote: >> Friends, I need your help. While trying to improve SeaBIOS I got stuck >> at this very strange problem - which does not appear when you do a >> standalone build of SeaBIOS but it happens when you try building a >> coreboot together with SeaBIOS. Steps to reproduce: > > Please see the developer documentation: > > https://www.seabios.org/Developer_Documentation > > In particular, read the "memory model" and "execution and code phase" > documents. > > -Kevin diff -rupN ./payloads/external/SeaBIOS/seabios/src/fw/coreboot.c ./payloads/external/SeaBIOS/seabios/src/fw/coreboot.c --- ./payloads/external/SeaBIOS/seabios/src/fw/coreboot.c 2018-02-25 14:00:00.0 +0200 +++ ./payloads/external/SeaBIOS/seabios/src/fw/coreboot.c 2018-02-25 14:00:00.0 +0200 @@ -273,6 +273,18 @@ find_acpi_features(); } +/* + (1) = OK, cbfs_copyfile + (2) = OK, coreboot_cbfs_init + (3) = ERR, cbfs_run_payload +*/ + +int // doesn't matter if static or not +testfunc(void) { +int *c = malloc_tmp(sizeof(int)); // doesn't matter if _tmp or _tmphigh +// free(c); // <--- commented out because doesn't affect the results +return 0; +} / * ulzma @@ -368,6 +380,7 @@ static int cbfs_copyfile } iomemcpy(temp, src, size); int ret = ulzma(dst, maxlen, temp, size); +testfunc(); // (1) <--- works OK there yield(); free(temp); return ret; @@ -478,6 +491,7 @@ void coreboot_cbfs_init } process_links_file(); +testfunc(); // (2) <--- works OK there } struct cbfs_payload_segment { @@ -533,6 +547,7 @@ void cbfs_run_payload } else if (CONFIG_LZMA && seg->compression == cpu_to_be32(CBFS_COMPRESS_LZMA)) { int ret = ulzma(dest, dest_len, src, src_len); +testfunc(); // (3) <--- gives "is VARVERIFY32INIT but used from" error if (ret < 0) return; src_len = ret; ___ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] Mysterious "is VARVERIFY32INIT but used from" problem while trying to improve SeaBIOS
On Sun, Feb 25, 2018 at 03:05:06AM +0300, Mike Banon wrote: > Friends, I need your help. While trying to improve SeaBIOS I got stuck > at this very strange problem - which does not appear when you do a > standalone build of SeaBIOS but it happens when you try building a > coreboot together with SeaBIOS. Steps to reproduce: Please see the developer documentation: https://www.seabios.org/Developer_Documentation In particular, read the "memory model" and "execution and code phase" documents. -Kevin ___ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] Mysterious "is VARVERIFY32INIT but used from" problem while trying to improve SeaBIOS
"varverify32init.patch" in the attachments. To apply a patch please copy it to the coreboot directory, "cd" to coreboot, and - if seabios is already cloned (e.g. after building a coreboot once, followed by a "make clean" of course) run " patch -l -p1 < varverify32init.patch " Sorry, my previous message had a typo, the final results for testfunc() : (1) = OK, inside " cbfs_copyfile " (2) = OK, inside " coreboot_cbfs_init " (3) = ERR, inside " cbfs_run_payload " P.S. I'm using the default "menuconfig" settings, "emulation/qemu-i440fx" target Best regards, Mike On Sun, Feb 25, 2018 at 11:55 AM, Paul Menzelwrote: > Dear Mike, > > > Am 25.02.2018 um 01:05 schrieb Mike Banon: >> >> Friends, I need your help. While trying to improve SeaBIOS I got stuck >> at this very strange problem - which does not appear when you do a >> standalone build of SeaBIOS but it happens when you try building a >> coreboot together with SeaBIOS. Steps to reproduce: > > > Please attach your patch, so that it can easily applied and the build > problem reproduced. > > […] > > > Kind regards, > > Paul diff -rupN ./payloads/external/SeaBIOS/seabios/src/fw/coreboot.c ./payloads/external/SeaBIOS/seabios/src/fw/coreboot.c --- ./payloads/external/SeaBIOS/seabios/src/fw/coreboot.c 2018-02-25 14:00:00.0 +0200 +++ ./payloads/external/SeaBIOS/seabios/src/fw/coreboot.c 2018-02-25 14:00:00.0 +0200 @@ -273,6 +273,18 @@ find_acpi_features(); } +/* + (1) = OK, cbfs_copyfile + (2) = OK, coreboot_cbfs_init + (3) = ERR, cbfs_run_payload +*/ + +int // doesn't matter if static or not +testfunc(void) { +int *c = malloc_tmp(sizeof(int)); // doesn't matter if _tmp or _tmphigh +// free(c); // <--- commented out because doesn't affect the results +return 0; +} / * ulzma @@ -368,6 +380,7 @@ static int cbfs_copyfile } iomemcpy(temp, src, size); int ret = ulzma(dst, maxlen, temp, size); +testfunc(); // (1) <--- works OK there yield(); free(temp); return ret; @@ -478,6 +491,7 @@ void coreboot_cbfs_init } process_links_file(); +testfunc(); // (2) <--- works OK there } struct cbfs_payload_segment { @@ -533,6 +547,7 @@ void cbfs_run_payload } else if (CONFIG_LZMA && seg->compression == cpu_to_be32(CBFS_COMPRESS_LZMA)) { int ret = ulzma(dest, dest_len, src, src_len); +testfunc(); // (3) <--- gives "is VARVERIFY32INIT but used from" error if (ret < 0) return; src_len = ret; ___ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] Mysterious "is VARVERIFY32INIT but used from" problem while trying to improve SeaBIOS
Dear Mike, Am 25.02.2018 um 01:05 schrieb Mike Banon: Friends, I need your help. While trying to improve SeaBIOS I got stuck at this very strange problem - which does not appear when you do a standalone build of SeaBIOS but it happens when you try building a coreboot together with SeaBIOS. Steps to reproduce: Please attach your patch, so that it can easily applied and the build problem reproduced. […] Kind regards, Paul ___ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios
[SeaBIOS] Mysterious "is VARVERIFY32INIT but used from" problem while trying to improve SeaBIOS
Friends, I need your help. While trying to improve SeaBIOS I got stuck at this very strange problem - which does not appear when you do a standalone build of SeaBIOS but it happens when you try building a coreboot together with SeaBIOS. Steps to reproduce: add this innocent looking function to the beginning of ./coreboot/payloads/external/SeaBIOS/seabios/src/fw/coreboot.c : int // doesn't matter if static or not testfunc(void) { int *c = malloc_tmp(sizeof(int)); // doesn't matter if _tmp or _tmphigh // free(c); // <--- commented out because doesn't affect the results return 0; } and try calling it from "cbfs_copyfile" function of the same file: static int cbfs_copyfile(struct romfile_s *file, void *dst, u32 maxlen) { ... void *temp = malloc_tmphigh(size); ... int ret = ulzma(dst, maxlen, temp, size); testfunc(); // <--- added ... } Then I get this problem while building a coreboot with together SeaBIOS : ... Compiling whole program out/code32seg.o Compiling whole program out/ccode16.o Compiling to assembler out/src/asm-offsets.s Generating offset file out/asm-offsets.h Compiling (16bit) out/romlayout.o Building ld scripts ERROR: .data.varinit.. is VARVERIFY32INIT but used from ['.text.runtime..', '.text.do_boot', '.text.malloc_tmp'] Makefile:162: recipe for target 'out/romlayout16.lds' failed make[2]: *** [out/romlayout16.lds] Error 1 Makefile:80: recipe for target 'build' failed make[1]: *** [build] Error 2 payloads/external/Makefile.inc:73: recipe for target 'payloads/external/SeaBIOS/seabios/out/bios.bin.elf' failed make: *** [payloads/external/SeaBIOS/seabios/out/bios.bin.elf] Error 2 However, if I try adding this function to the end of "coreboot_cbfs_init" function I don't get such an error: void coreboot_cbfs_init(void) { ... process_links_file(); testfunc(); // <--- works OK there } What is a difference between "cbfs_copyfile" and "coreboot_cbfs_init" that affects this behaviour? And why it is OK to call "malloc_" from inside the "cbfs_copyfile" function --- void *temp = malloc_tmphigh(size); --- but we couldn't call there our testfunc() which calls "malloc_" without running into this problem? Best regards, Mike Banon ___ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios