Comments (5)
Thanks to #27, build with option CONFIG_ROMCODE succeeded to generate setup
and system
object files, but now the generation of the ROM image fails at the following step:
tools/mkbootloader -c 0xe000 64 Image 0xe000 -a boot/setup 0xe000 -s boot/system 0xe060
boot/setup: ffffffe0h Bytes (- a.out) @e000
Wrong a.out table?
boot/system: 0h Bytes (strip) @e060
Bereichsfehler in Nr. 0 (offs < basis)!
Makefile:171 : la recette pour la cible « Image » a échouée
Both setup
and system
object files look correct when dumping with dumpobj86.
After debugging mkbootloader, it appears that the scanf() and printf() function calls use format "%lx" (long int) to fill or display int32_t variables, causing buffer overlap if built on 64 bits system.
from elks.
I have a patch that works on my 64 bits system, where I replaced %lx
by %x
, but I am not sure it would not cause regression on a 32 bits system. uint32_t
and such are portable with fixed size, but what about the format string of printf() and scanf () ?
from elks.
For the case of integer sizes with 32 and 64 bits systems using gcc and linux, see:
https://usrmisc.wordpress.com/2012/12/27/integer-sizes-in-c-on-32-bit-and-64-bit-linux/
So, for the program to work on 32 and 64 bit systems, all 32 bit integers should be "int" and use "%x", and all 64 bit integers should be "long long int" and use "%llx".
from elks.
Thanks Juan, so I can commit the mkbootloader
patch that replaces %lx
by %x
.
from elks.
The correct way to printf()
C99 integer types is covered in this Stack Overflow answer. In short, #include <inttypes.h>
and use the appropriate macros from that header for the type you're working with.
Alternatively, you could cast to int
for the printf()
only. That's what I do sometimes. It looks better than uint32_t r = 1000; printf("reading %" PRIu32 " bytes\n", r);
from elks.
Related Issues (20)
- elf.c:34:18: error: use of undeclared identifier 'LIBELF_ARCH' HOT 5
- 8018X system: bell-8254.c:24:14: error: ‘SPEAKER_PORT’ undeclared HOT 3
- Cannot compile v0.7.0, undefined reference to "hd_drive_map" HOT 6
- Incompatibility with 3inONEder HOT 3
- V25 support HOT 5
- fd_type number mismatch for FD1232 HOT 7
- ELKs rebuilds with no configuration changes HOT 1
- Congratulations and wish list for elks functionality HOT 1
- Net start does not start httpd HOT 1
- ftp not working HOT 4
- Question on return code on create in socket.c HOT 2
- Building/porting ELKS in ROM HOT 19
- Not an issue, but i am willing to donate the intel etherexpress 8/16 network card HOT 8
- [qemu] cannot get network up HOT 6
- PC-98 Build errors HOT 8
- serial 2 ps/2 mouse adapter mouse acts funny HOT 11
- Selecting NANO sockets breaks build HOT 1
- Use of plain char as signed char in libc is not optimal
- Elksemu support for OS/2 NE HOT 5
- Can not boot no HD image with supplied qemu.sh script HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elks.