digitalmars.D.ldc - LDC 0.16.0 has been released!
- Kai Nacke (54/54) Oct 22 2015 Hi everyone!
- Daniel N (2/5) Oct 22 2015 Thanks and congratulations for this epic release!
- kinke (2/2) Oct 22 2015 Uh, the release still contains the VS detection bug on Win64 etc.
- Kai Nacke (4/7) Oct 24 2015 I can create a .1 release if needed.
- Marc =?UTF-8?B?U2Now7x0eg==?= (3/3) Oct 24 2015 Congratulations and thanks to the LDC team!
- guodemone (5/5) Oct 25 2015 sorry ,my english is poor!):
- David Nadlinger via digitalmars-d-ldc (10/13) Oct 25 2015 I'm afraid this question is a little too unspecific for us to be able to...
- guodemone (3/3) Oct 25 2015 thank you.
- guodemone (1/1) Oct 25 2015 I understand sent source to you,how
- David Nadlinger via digitalmars-d-ldc (5/8) Oct 25 2015 I'm afraid I don't quite have the time to spend on that right now. I
- guodemone (229/229) Oct 25 2015 #ifndef __BOOT_ASM_H__
- guodemone (14/14) Oct 25 2015 ld -m elf_i386 -N -e start -Ttext 0x7C00 bootasm.o bootmain.o
- guodemone (4/4) Oct 25 2015 I need excample bootloader(asm+D).
- Kagamin (5/5) Oct 26 2015 It's a missing function _d_dso_registry. Not sure if you need it
- guodemone (3/3) Oct 26 2015 How build .bin?
- Kagamin (1/1) Oct 26 2015 You mean a CD image with your loader in MBR?
- guodemone (242/242) Oct 26 2015 file asm.h
- guodemone (1/1) Oct 26 2015 bootloader of [asm+D] version
- Kagamin (3/3) Oct 26 2015 In C version you compile bootmain.c to object file bootmain.o, in
- guodemone (1/1) Oct 26 2015 wrong,Unable to link
- guodemone (2/2) Oct 26 2015 I want (asm.h bootasm.S bootmain.c) trans to (asm.h bootasm.S
- kinke (3/3) Oct 26 2015 Guys, please *stop* hijacking this thread. It's supposed to be
- guodemone (3/18) Nov 08 2015 minimal this OS, I use cdrom to pack it up and running after TSS
- guodemone (6/21) Nov 09 2015 I holp build OS,Dlang give me my help.but,error jmp to it,no body
Hi everyone! On behalf of the LDC team I am proud to announce the final LDC 0.16.0 release! It is based on the 2.067.1 front-end and LLVM 3.1-3.7 (OS X: no support for 3.3). The LDC team considers this the best LDC release of all times! Big news is that the Win64 version of the compiler reaches production quality, thanks to the work from kinke! This release has been checked to work on Linux/PPC64 and OpenSolaris (x86), too. There is still a major issue on FreeBSD Due to a library build problem with druntime/Phobos there is under investigation but we are also looking for volunteers. If you need this platform please consider helping us!!! Big thanks to everyone who provided feedback! Most important changes are: - Frontend is now at 2.067.1 - LLVM 3.7 is supported - DMD-style coverage analysis is added - ABI changes which fixes a lot of bugs in the Win64 compiler - The ldc2 driver now only use slow -debuglib libraries if explicitly asked to Be sure to read the change log at the GitHub release page which also has the package download links: https://github.com/ldc-developers/ldc/releases/tag/v0.16.0 MD5 checksums for the release packages: b8397cd1071315ad7612efc80c6844fc ldc-0.16.0-src.tar.gz 177a637431f6e5ee0ccebd5911d4baed ldc2-0.16.0-linux-x86.tar.gz 7ff847175bb442fd7682d748abb23072 ldc2-0.16.0-linux-x86.tar.xz b233210beef30483de08fec53536aa1e ldc2-0.16.0-linux-x86_64.tar.gz 4cf2316d581560d694b753026e8185e5 ldc2-0.16.0-linux-x86_64.tar.xz b6395ce58ef3803c53beae60bfc75176 ldc2-0.16.0-osx-x86_64.tar.gz cf411c9309913dada376ee9d630d8d1b ldc2-0.16.0-osx-x86_64.tar.xz 89f18774ba0c5c804a9b86b1097e505d ldc2-0.16.0-win64-msvc.zip Regarding the binaries: The Linux binaries are built on Ubuntu 12.04 LTS with gcc 4.8.x and LLVM 3.7.0. They work on Ubuntu 12.04 LTS (or later) without installing additional software. The OS X binaries are built with LLVM 3.6.2 on OS X 10.10. The Win64 MSVC version is built with VS2015 using LLVM 3.7 in release mode. The distribution now contains a precompiled libcurl 7.40.0 from http://d.darktech.org/libcurl.html. For any other VisualStudio version you need to rebuild the library. You find the build script here: https://github.com/ldc-developers/ldc-scripts/blob/master/ldc2-win64/RELEASE.proj Please be sure to report any bugs at https://github.com/ldc-developers/ldc/issues, and feel free to drop by at the digitalmars.D.ldc forums (http://forum.dlang.org/group/digitalmars.D.ldc) for any questions or comments. Thanks to everybody involved in making this happen! Regards, Kai
Oct 22 2015
On Thursday, 22 October 2015 at 18:58:29 UTC, Kai Nacke wrote:Thanks to everybody involved in making this happen! Regards, KaiThanks and congratulations for this epic release!
Oct 22 2015
Uh, the release still contains the VS detection bug on Win64 etc. I think the current head of branch master would be ideal for 0.16.
Oct 22 2015
On Thursday, 22 October 2015 at 22:13:23 UTC, kinke wrote:Uh, the release still contains the VS detection bug on Win64 etc. I think the current head of branch master would be ideal for 0.16.I can create a .1 release if needed. Regards, Kai
Oct 24 2015
Congratulations and thanks to the LDC team! Available on openSUSE: http://download.opensuse.org/repositories/devel:/languages:/D/
Oct 24 2015
sorry ,my english is poor!): I want to build the x86 bootloader with Dlang,but how to build. I have ucore os code(asm+C),I want ucore (asm+C) to (asm+D). help me,thank you. https://github.com/chyyuu, help me, ucore(asm+c) to (asm+D).
Oct 25 2015
Hi there, On 25 Oct 2015, at 16:08, guodemone via digitalmars-d-ldc wrote:I want to build the x86 bootloader with Dlang,but how to build. I have ucore os code(asm+C),I want ucore (asm+C) to (asm+D). help me,thank you.I'm afraid this question is a little too unspecific for us to be able to help you efficiently. Where exactly do you get stuck? You might want to have a look at the old https://github.com/xomboverlord/xomb project for inspiration (an exokernel written in D1), or Adam Ruppe's more recent experiments: http://arsdnet.net/dcode/minimal.zip Best, David
Oct 25 2015
thank you. what your email? I have bootloader source send to you. you look the source.
Oct 25 2015
On 25 Oct 2015, at 16:19, guodemone via digitalmars-d-ldc wrote:thank you. what your email? I have bootloader source send to you. you look the source.I'm afraid I don't quite have the time to spend on that right now. I would say your best bet is to work on the problem some more yourself until you get to the point where you can articulate a concrete question. — David
Oct 25 2015
#ifndef __BOOT_ASM_H__ #define __BOOT_ASM_H__ /* Assembler macros to create x86 segments */ /* Normal segment */ #define SEG_NULLASM \ .word 0, 0; \ .byte 0, 0, 0, 0 #define SEG_ASM(type,base,lim) \ .word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \ .byte (((base) >> 16) & 0xff), (0x90 | (type)), \ (0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff) /* Application segment type bits */ #define STA_X 0x8 #define STA_E 0x4 #define STA_C 0x4 #define STA_W 0x2 #define STA_R 0x2 #define STA_A 0x1 #endif /* !__BOOT_ASM_H__ */ ***************************************** #include <asm.h> into mode .globl start start: cli cld seta20.1: testb $0x2, %al jnz seta20.1 outb %al, $0x64 seta20.2: testb $0x2, %al jnz seta20.2 outb %al, $0x60 lgdt gdtdesc movl %cr0, %eax orl $CR0_PE_ON, %eax movl %eax, %cr0 ljmp $PROT_MODE_CSEG, $protcseg protcseg: movw $PROT_MODE_DSEG, %ax movl $0x0, %ebp movl $start, %esp call bootmain spin: jmp spin .p2align 2 gdt: SEG_NULLASM SEG_ASM(STA_X|STA_R, 0x0, 0xffffffff) SEG_ASM(STA_W, 0x0, 0xffffffff) gdtdesc: .word 0x17 .long gdt **************************************** module bootmain; import types; import x86; const COM1 = 0x3F8; const CRTPORT = 0x3D4; const LPTPORT = 0x378; const COM_TX = 0; const COM_LSR = 5; const COM_LSR_TXRDY = 20; extern (C){ uint8_t inb(uint16_t port); void outb(uint16_t port, uint8_t data); uint16_t *crt; // CGA memory } static this(){ uint16_t *crt = cast(uint16_t *)0xB8000; } /* stupid I/O delay routine necessitated by historical PC design flaws */ static void delay() { inb(0x84); inb(0x84); inb(0x84); inb(0x84); } /* lpt_putc - copy console output to parallel port */ static void lpt_putc(int c) { int i; for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) { delay(); } outb(LPTPORT + 0, cast(uint8_t)c); outb(LPTPORT + 2, 0x08 | 0x04 | 0x01); outb(LPTPORT + 2, 0x08); } /* cga_putc - print character to console */ static void cga_putc(int c) { int pos; // cursor position: col + 80*row. outb(CRTPORT, 14); pos = inb(CRTPORT + 1) << 8; outb(CRTPORT, 15); pos |= inb(CRTPORT + 1); if (c == '\n') { pos += 80 - pos % 80; } else { crt[pos ++] = (c & 0xff) | 0x0700; } outb(CRTPORT, 14); outb(CRTPORT + 1, cast(uint8_t)(pos >> 8)); outb(CRTPORT, 15); outb(CRTPORT + 1, cast(uint8_t)pos); } /* serial_putc - copy console output to serial port */ static void serial_putc(int c) { int i; for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) { delay(); } outb(COM1 + COM_TX, cast(uint8_t)c); } /* cons_putc - print a single character to console*/ static void cons_putc(int c) { lpt_putc(c); cga_putc(c); serial_putc(c); } /* cons_puts - print a string to console */ static void cons_puts(const char *str) { int i; for (i = 0; *str != '\0'; i ++) { cons_putc(str[i]); } } /* bootmain - the entry of bootloader */ static void bootmain() { cons_puts("This is a bootloader: Hello world!!"); /* do nothing */ while (true){} } **************************** module types; extern (C): alias int BOOL; alias char int8_t; //C typedef unsigned char uint8_t; alias ubyte uint8_t; //C typedef short int16_t; alias short int16_t; //C typedef unsigned short uint16_t; alias ushort uint16_t; //C typedef int int32_t; alias int int32_t; //C typedef unsigned int uint32_t; alias uint uint32_t; //C typedef long long int64_t; alias long int64_t; //C typedef unsigned long long uint64_t; alias ulong uint64_t; ******************************** module x86; import types; extern (C){ uint8_t inb(uint16_t port); void outb(uint16_t port, uint8_t data); } extern (C) uint8_t inb(uint16_t port) { uint8_t data; asm { mov DX,port; in AL,DX; mov data,AL; } return data; } extern (C) void outb(uint16_t port, uint8_t data) { asm { mov DX,port; mov AL,data; out DX,AL; } } ***************************** bootasm:bootasm.S asm.h rm obj\*.o -rf gcc -I. -fno-builtin -Wall -ggdb -m16 -nostdinc -fno-stack-protector -Os -nostdinc -c bootasm.S -o obj/bootasm.o bootmain:bootmain.d types.d x86.d ldc2 -L=Os -c $^ -odobj all:bootasm bootmain ****************************** bootblock:bootasm.o bootmain.o x86.o types.o ld -m elf_i386 -N -e start -Ttext 0x7C00 $^ -o bootblock.o objdump -S bootblock.o > bootblock.asm objcopy -S -O binary bootblock.o bootblock.out rm bootblock -f ./writeHDD bootblock.out bootblock dd if=/dev/zero of=ucore.img count=10000 dd if=bootblock of=ucore.img conv=notrunc
Oct 25 2015
ld -m elf_i386 -N -e start -Ttext 0x7C00 bootasm.o bootmain.o x86.o types.o -o bootblock.o bootasm.o:在函数‘protcseg’中: /home/glg/桌面/bootloader_D/bootasm.S:60:对‘bootmain’未定义的引用 bootmain.o:在函数‘ldc.dso_ctor.8bootmain’中: bootmain.d:(.text.ldc.dso_ctor.8bootmain[ldc.dso_ctor.8bootmain]+0x4d):对‘_d_dso_registry’未定义的引用 bootmain.o:在函数‘ldc.dso_dtor’中: bootmain.d:(.text.ldc.dso_dtor[ldc.dso_dtor]+0x4d):对‘_d_dso_registry’未定义的引用 x86.o:在函数‘ldc.dso_ctor.3x86’中: x86.d:(.text.ldc.dso_ctor.3x86[ldc.dso_ctor.3x86]+0x4d):对‘_d_dso_registry’未定义的引用 types.o:在函数‘ldc.dso_ctor.5types’中: types.d:(.text.ldc.dso_ctor.5types[ldc.dso_ctor.5types]+0x4d):对‘_d_dso_registry’未定义的引用 makefile:2: recipe for target 'bootblock' failed make: *** [bootblock] Error 1
Oct 25 2015
I need excample bootloader(asm+D). (dmd,gdc,ldc build flag) (linker flag) to now,D no have bootloader(asm+D).
Oct 25 2015
It's a missing function _d_dso_registry. Not sure if you need it or not, but you can stub it: extern(C) void _d_dso_registry(void* data) { } Also don't use static constructors yet. They are invoked during initialization of modules, which you probably don't run.
Oct 26 2015
file asm.h /* 是bootasm.S汇编文件所需要的头文件,主要是一些与X86保护模式的段访问方式相关的宏定义 */ #ifndef __BOOT_ASM_H__ #define __BOOT_ASM_H__ /* Assembler macros to create x86 segments */ /* Normal segment */ #define SEG_NULLASM \ .word 0, 0; \ .byte 0, 0, 0, 0 #define SEG_ASM(type,base,lim) \ .word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \ .byte (((base) >> 16) & 0xff), (0x90 | (type)), \ (0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff) /* Application segment type bits */ #define STA_X 0x8 // 可执行 #define STA_E 0x4 // 向下扩展段(非可执行段) #define STA_C 0x4 // 一致性代码段(只执行) #define STA_W 0x2 // 段可写(非可执行段) #define STA_R 0x2 // 段可读 (可执行段) #define STA_A 0x1 // 可访问 #endif /* !__BOOT_ASM_H__ */ ********************************************************** file bootasm.S #include <asm.h> into mode .globl start start: ,cld的作用是将direct flag标志位清零 seta20.1: testb $0x2, %al 是不是为0,如果不是跳回去继续执行 outb %al, $0x64 seta20.2: testb $0x2, %al jnz seta20.2 发送命令数据0xdf就是打开A20地址线,0xdd就是关闭 outb %al, $0x60 启动保护模式前建立好的段描述符合段描述符表 movl %cr0, %eax orl $CR0_PE_ON, %eax movl %eax, %cr0 CPL代表处于特权级。 000:7C00=0x00007C00 0000:protcseg 都是相对于物理内存0000基址的 ljmp $PROT_MODE_CSEG, $protcseg protcseg: 自定义数据段选择子,因为段选择子是16位的 0x0000 ^ 此地址为栈基址 0000 /|\ | | | 栈顶指针 spin: jmp spin gdt: bootloader and kernel CODE段 and kernel DATA段 gdtdesc: 数组是0开始的,所以数组长度就要减1 ***************************************************************************** file bootmain.c /* 定义并实现了bootmain函数实现了通过屏幕、串口和并口显示字符串 */ //#include <types.h> //#include <x86.h> #define COM1 0x3F8 #define CRTPORT 0x3D4 #define LPTPORT 0x378 #define COM_TX 0 // Out: Transmit buffer (DLAB=0) #define COM_LSR 5 // In: Line Status Register #define COM_LSR_TXRDY 20 // Transmit buffer avail static uint16_t *crt = (uint16_t *) 0xB8000; // CGA memory /* stupid I/O delay routine necessitated by historical PC design flaws */ static void delay(void) { inb(0x84); inb(0x84); inb(0x84); inb(0x84); } /* 考虑到简单性,在proj1中没有对并口设备进行初始化,通过并口进行输出的过程也很简单: 第一步:执行inb指令读取并口的I/O地址(LPTPORT + 1)的值,如果发现发现读出的值代表并口忙, 则空转一小会再读; 如果发现发现读出的值代表并口空闲,则执行outb指令把字符写到并口 I/O地址(LPTPORT ), 这样就完成了一个字符的并口输出。 */ /* lpt_putc - copy console output to parallel port */ static void lpt_putc(int c) { int i; for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) { delay(); } outb(LPTPORT + 0, c); outb(LPTPORT + 2, 0x08 | 0x04 | 0x01); outb(LPTPORT + 2, 0x08); } /* 通过CGA显示控制器进行输出的过程也很简单:首先通过in/out指令获取当前光标位置; 然后根据得到的位置计算出显存的地址,直接通过访存指令写内存来完成字符的输出; 最后通过in/out指令更新当前光标位置。 */ /* cga_putc - print character to console */ static void cga_putc(int c) { int pos; // cursor position: col + 80*row. outb(CRTPORT, 14); pos = inb(CRTPORT + 1) << 8; outb(CRTPORT, 15); pos |= inb(CRTPORT + 1); if (c == '\n') { pos += 80 - pos % 80; } else { crt[pos ++] = (c & 0xff) | 0x0700; } outb(CRTPORT, 14); outb(CRTPORT + 1, pos >> 8); outb(CRTPORT, 15); outb(CRTPORT + 1, pos); } /* 通过串口进行输出的过程也很简单:第一步:执行inb指令读取串 的I/O地址(COM1 + COM_LSR)的值, 如果发现发现读出的值代表串口忙,则空转一小会(0x84是什么地址???); 如果发现发现读出的值代表串口空闲,则执行outb指令把字符写到串 的I/O地址(COM1 + COM_TX), 这样就完成了一个字符的串口输出。 */ /* serial_putc - copy console output to serial port */ static void serial_putc(int c) { int i; for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) { delay(); } outb(COM1 + COM_TX, c); } /* 显示字符的函数接口*/ /* 一个cons_putc函数接口,完成字符的输出*/ /* cons_putc - print a single character to console*/ static void cons_putc(int c) { lpt_putc(c); cga_putc(c); serial_putc(c); } /* 提供了一个cons_puts函数接口:完成字符串的输出*/ /* cons_puts - print a string to console */ static void cons_puts(const char *str) { int i; for (i = 0; *str != '\0'; i ++) { cons_putc(*str ++); } } /* bootmain - the entry of bootloader */ void bootmain(void) { cons_puts("This is a bootloader: Hello world!!"); /* do nothing */ while (1); } *************************************************** These codes(asm.h bootasm.S bootmain.c) trans to (asm.h bootasm.S bootmain.d). ldc -c asm.h bootasm.S bootmain.d ld bootasm.o bootmain.o of outbin.o
Oct 26 2015
In C version you compile bootmain.c to object file bootmain.o, in d version you again get bootmain.o, after that you do the same as in C version.
Oct 26 2015
I want (asm.h bootasm.S bootmain.c) trans to (asm.h bootasm.S bootmanin.d)
Oct 26 2015
Guys, please *stop* hijacking this thread. It's supposed to be about the new release, and not about someone's project incl. code spam.
Oct 26 2015
sorry ,My englishi is poot. My mean is good to D. chinese people is Clever,But the language barrier,Which explains the significance of the error。
Oct 26 2015
google's tanslate into china,china to english.My idea was not to express
Oct 26 2015
Because,My poor(with English)。 I'd love to learn sign language,
Oct 26 2015
On Sunday, 25 October 2015 at 15:14:32 UTC, David Nadlinger wrote:Hi there, On 25 Oct 2015, at 16:08, guodemone via digitalmars-d-ldc wrote:minimal this OS, I use cdrom to pack it up and running after TSS error, do not know how to solve.I want to build the x86 bootloader with Dlang,but how to build. I have ucore os code(asm+C),I want ucore (asm+C) to (asm+D). help me,thank you.I'm afraid this question is a little too unspecific for us to be able to help you efficiently. Where exactly do you get stuck? You might want to have a look at the old https://github.com/xomboverlord/xomb project for inspiration (an exokernel written in D1), or Adam Ruppe's more recent experiments: http://arsdnet.net/dcode/minimal.zip Best, David
Nov 08 2015
On Sunday, 25 October 2015 at 15:14:32 UTC, David Nadlinger wrote:Hi there, On 25 Oct 2015, at 16:08, guodemone via digitalmars-d-ldc wrote:I holp build OS,Dlang give me my help.but,error jmp to it,no body help me. 我的英语实在不好[my english is poor] 我想知道的答案,没有办法得到解答【I want to know the answer, there is no way to get answers】I want to build the x86 bootloader with Dlang,but how to build. I have ucore os code(asm+C),I want ucore (asm+C) to (asm+D). help me,thank you.I'm afraid this question is a little too unspecific for us to be able to help you efficiently. Where exactly do you get stuck? You might want to have a look at the old https://github.com/xomboverlord/xomb project for inspiration (an exokernel written in D1), or Adam Ruppe's more recent experiments: http://arsdnet.net/dcode/minimal.zip Best, David
Nov 09 2015