Get rid of crt0.c
This commit is contained in:
4
Makefile
4
Makefile
@@ -6,8 +6,8 @@ dev-image = 5150-dev
|
||||
crc16.s: crc16.c
|
||||
ia16-elf-gcc -S -Os -o crc16.s crc16.c
|
||||
|
||||
crc16.bin: crc16.s crt0.c
|
||||
ia16-elf-gcc -o crc16.bin -Os -nostdlib crc16.s crt0.c
|
||||
crc16.bin: crc16.s
|
||||
ia16-elf-gcc -o crc16.bin -Os -nostdlib crc16.s
|
||||
|
||||
CC = ia16-elf-gcc
|
||||
CXX = ia16-elf-gcc
|
||||
|
5
crc16.s
5
crc16.s
@@ -3,6 +3,11 @@
|
||||
.att_syntax prefix
|
||||
#NO_APP
|
||||
#APP
|
||||
.section .text.init
|
||||
.global _start
|
||||
_start:
|
||||
|
||||
.section .text.main
|
||||
.global main
|
||||
main:
|
||||
push %bp
|
||||
|
25
crt0.c
25
crt0.c
@@ -1,25 +0,0 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
int main();
|
||||
|
||||
asm(".section .init \n"
|
||||
".global _start \n"
|
||||
"_start: \n\t"
|
||||
"mov %cs, %ax \n\t"
|
||||
"mov %ax, %ds \n\t"
|
||||
"mov %ax, %es \n\t"
|
||||
"cli \n\t"
|
||||
"mov %ax, %ss \n\t"
|
||||
"mov $0x1000, %ax \n\t"
|
||||
"mov %ax, %sp \n\t"
|
||||
"sti \n\t"
|
||||
"jmp main");
|
||||
|
||||
void* memset(void* ptr, int val, size_t len) {
|
||||
uint8_t* p = ptr;
|
||||
while (len--) {
|
||||
*p++ = val;
|
||||
}
|
||||
return ptr;
|
||||
}
|
Reference in New Issue
Block a user