[Help] all __gshared vairable address is 0.
lili
akozhao at tencent.com
Sun Aug 25 12:12:51 UTC 2019
Hi:
I'm writing a OS kernel in D. I meet a problem that all bss
variables's address is same
and is 0.
see code below:
extern(C) extern __gshared ulong p4_table; //defined in a boot.s
file
__gshared int xx= void;
abstract final class Vga
{
void init()
{
clearScreen();
Vga.println(cast(ulong)p4_table); //0
Vga.println(cast(ulong)&xx); //0
}
but i see the link map file p4_table and xx has different address.
0x0000000000104000 __bss = .
*(.bss)
.bss 0x0000000000104000 0x15000 boot.o
0x0000000000104000 p4_table
0x0000000000105000 p3_table
0x0000000000106000 p2_table
0x0000000000108000 idt_addr
*(.bss.*)
.bss.xx 0x0000000000119000 0x4 vga.o
0x0000000000119000 xx
and when i call asm_fn in d the return value of asm_fn is return
0x106000 not 0.
so why did it occur.
[global asm_fn]
asm_fn:
mov rax, p2_table
ret
src https://github.com/lilijreey/OS-D
More information about the digitalmars-d-ldc
mailing list