printf("argv[0] is %p %s\n", argv[0], argv[0]);
printf("len is %d\n", (int)strlen(argv[0]));
p = argv[0] + strlen (argv[0]);
printf("p is %p\n", p);
printf("p as string is %s\n", p);
printf("p current is %x\n", p[0]);
printf("as negative is %x\n", p[-1]);
which is generating (for that last line):
LM1873:
movl $4294967295, %eax
addq -64(%rbp), %rax
movsbl (%rax),%esi
movl $LC445, %edi
movb $0, %al
call _printf
That first instruction - the movl - has
negative 1 as an unsigned value. I tried
manually changing the generated assembler
to $-1 but the result appears to be the
same (I may have stuffed up the test).
On 20/01/24 00:16, bart wrote:
LM1873:
movl $4294967295, %eax
addq -64(%rbp), %rax
movsbl (%rax),%esi
movl $LC445, %edi
movb $0, %al
call _printf
That first instruction - the movl - has
negative 1 as an unsigned value. I tried
manually changing the generated assembler
to $-1 but the result appears to be the
same (I may have stuffed up the test).
Try changing:
movl $4294967295, %eax
to:
movq $-1, %rax
So changing both operands and the opcode.
Apologies - I forgot to spell that out.
Yes, I fully expect full 64-bit values to work.
What I would like to know is how it was possible
for GCC 3.2.3 to generate x64 operating systems
back in those days.
ie how did this code ever work?
On 20/01/24 00:16, bart wrote:
LM1873:
movl $4294967295, %eax
addq -64(%rbp), %rax
movsbl (%rax),%esi
movl $LC445, %edi
movb $0, %al
call _printf
That first instruction - the movl - has
negative 1 as an unsigned value. I tried
manually changing the generated assembler
to $-1 but the result appears to be the
same (I may have stuffed up the test).
Try changing:
movl $4294967295, %eax
to:
movq $-1, %rax
So changing both operands and the opcode.
Apologies - I forgot to spell that out.
Yes, I fully expect full 64-bit values to work.
What I would like to know is how it was possible
for GCC 3.2.3 to generate x64 operating systems
back in those days.
ie how did this code ever work?
Were operating systems back then restricted
via virtual memory to mask at the 4 GiB
mark to produce the required wrap or is there
something else I'm missing?
Thanks. Paul.
LM1873:
movl $4294967295, %eax
addq -64(%rbp), %rax
On 19/01/2024 16:24, Paul Edwards wrote:
On 20/01/24 00:16, bart wrote:
LM1873:
movl $4294967295, %eax
addq -64(%rbp), %rax
movsbl (%rax),%esi
movl $LC445, %edi
movb $0, %al
call _printf
That first instruction - the movl - has
negative 1 as an unsigned value. I tried
manually changing the generated assembler
to $-1 but the result appears to be the
same (I may have stuffed up the test).
Try changing:
movl $4294967295, %eax
to:
movq $-1, %rax
So changing both operands and the opcode.
Apologies - I forgot to spell that out.
Yes, I fully expect full 64-bit values to work.
What I would like to know is how it was possible
for GCC 3.2.3 to generate x64 operating systems
back in those days.
ie how did this code ever work?
Bizarrely, it does work. I'm still trying to figure it out; I'll carry
on doing so.
On 20/01/24 00:55, David Brown wrote:
and thus run on UCX64, as it is unlikely
that cc64 can handle the gcc 3.2.3 code,
even though it is C90-compliant.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 299 |
Nodes: | 16 (2 / 14) |
Uptime: | 53:08:37 |
Calls: | 6,690 |
Files: | 12,225 |
Messages: | 5,344,821 |