|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: amm (alessandro.musatti
gmail.com)
Date: Wed Oct 01 2008 - 06:25:09 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
int main()
{
int i;
short int *screen = (short int *) 0xB8000;
char msg[]="Hello World";
for(i=0; msg[i] != '\0'; *(screen++) = 0x1F00 | msg[i], ++i);
for(;;);
return 0;
}
When i compiled i got a very big main.bin file more then 960MByte, so i
tried to change the char vector with only a char and it works fine. I
think the problem was the buffer overflow protector system that take the
.nodata segment in other address, or something like that... (readelf -S
main)
So how can i use the char vector in my programs and build them in standalone
mode?
int main()
{
int i;
short int *screen = (short int *) 0xB8000;
char msg = 'H';
*screen = 0x1F00 | msg;
for(;;);
return 0;
}
gcc -c main.c -o main.o -fno-stack-protector -ffreestand
ld main.o -e main -Ttext 0x1000 -o main
objcopy -R .comment -R .note -S -O binary main main.bin
Regards
-Alex-
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]