[sys] And now for the user side too
This commit is contained in:
parent
3b12812608
commit
06c41369cc
2
Makefile
2
Makefile
@ -117,7 +117,7 @@ loader/crtbegin.o: loader/crtbegin.s
|
||||
@${YASM} -f elf32 -o $@ $<
|
||||
@${ECHO} "\r\033[32;1m yasm $<\033[0m"
|
||||
|
||||
initrd/bin/%: loader/%.o loader/crtbegin.o
|
||||
initrd/bin/%: loader/%.o loader/crtbegin.o loader/syscall.o
|
||||
@${ECHO} -n "\033[32m LD $<\033[0m"
|
||||
@${LD} -T loader/link.ld -o $@ $<
|
||||
@${ECHO} "\r\033[32;1m LD $<\033[0m"
|
||||
|
@ -1,16 +1,18 @@
|
||||
int syscall_print(const char * p1) {
|
||||
int a = 0xA5ADFACE;
|
||||
__asm__ __volatile__("int $0x7F" : "=a" (a) : "0" (1), "b" ((int)p1));
|
||||
return a;
|
||||
}
|
||||
#include <syscall.h>
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
syscall_print(argv[i]);
|
||||
if (i != argc - 1) {
|
||||
syscall_print(" ");
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
syscall_print(argv[i]);
|
||||
if (i != argc - 1) {
|
||||
syscall_print(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
syscall_print("\n");
|
||||
return 0;
|
||||
syscall_print("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* vim:tabstop=4
|
||||
* vim:noexpandtab
|
||||
* vim:shiftwidth=4
|
||||
*/
|
||||
|
@ -5,6 +5,7 @@
|
||||
OUTPUT_FORMAT(elf32-i386)
|
||||
ENTRY(_start)
|
||||
STARTUP(loader/crtbegin.o)
|
||||
INPUT(loader/syscall.o)
|
||||
phys = 0x02000000;
|
||||
SECTIONS
|
||||
{
|
||||
|
5
loader/syscall.c
Normal file
5
loader/syscall.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include <syscall.h>
|
||||
|
||||
DEFN_SYSCALL1(exit, 0, int)
|
||||
DEFN_SYSCALL1(print, 1, const char *)
|
||||
|
@ -1,8 +1,12 @@
|
||||
#include <syscall.h>
|
||||
|
||||
DEFN_SYSCALL1(print, 1, const char *)
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
syscall_print("Hello world!\n");
|
||||
return 0;
|
||||
syscall_print("Hello world!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* vim:tabstop=4
|
||||
* vim:noexpandtab
|
||||
* vim:shiftwidth=4
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user