-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
typedef unsigned char uint8_t; | ||
typedef unsigned short uint16_t; | ||
typedef unsigned int uint32_t; | ||
typedef unsigned long long uint64_t; | ||
typedef long long int64_t; | ||
|
||
typedef struct { | ||
void (*fb_printf)(char *str, ...); | ||
} env_t; | ||
|
||
typedef struct { | ||
int reserved; | ||
} framebuffer_t; | ||
|
||
typedef struct { | ||
int reserved; | ||
} sys_info_t; | ||
|
||
typedef struct { | ||
char *name; | ||
void *addr; | ||
} module_func_t; | ||
|
||
typedef struct { | ||
char *name; | ||
char *message; | ||
int err_code; | ||
uint64_t func_count; | ||
module_func_t *func[]; | ||
} module_info_t; | ||
|
||
typedef struct { | ||
int reserved; | ||
} func_t; | ||
|
||
typedef struct { | ||
uint8_t a[4]; | ||
uint8_t b[4]; | ||
uint8_t c[4]; | ||
uint8_t d[4]; | ||
} uid_t; | ||
|
||
typedef struct { | ||
uint16_t year; | ||
uint8_t month; | ||
uint8_t day; | ||
uint8_t second; | ||
} time_t; | ||
|
||
void (*fb_printf)(char *str, ...); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#/bin/sh | ||
echo "Название: Hello world" | ||
echo "Лицензия: Публичное достояние" | ||
g++ -O0 -finput-charset=UTF-8 -fexec-charset=cp1251 -c -fPIC -nostdlib main.cpp -o hello.o | ||
gcc -I../../modlib -O0 -finput-charset=UTF-8 -fexec-charset=cp1251 -c -fPIC -nostdlib main.c -o hello.o | ||
gcc -shared -nostdlib hello.o -o hello.so -Wl,--entry=_start | ||
echo "Сборка завершена, файл: hello.so" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <system.h> | ||
|
||
const char name[] = "Привет мир!"; | ||
const char message[] = "Привет из модуля!"; | ||
module_info_t info; | ||
env_t *env; | ||
|
||
void hello( ) {} | ||
module_func_t func_table[] = { "hello", hello }; | ||
|
||
module_info_t *_start(env_t *env) { | ||
fb_printf = env->fb_printf; | ||
fb_printf("[hello]message=[%s]\n", message); | ||
|
||
info.name = (char *)&name; | ||
info.message = (char *)&message; | ||
info.func_count = 1; | ||
info.func = &func_table; | ||
info.err_code = 2023; | ||
|
||
return &info; | ||
} |
This file was deleted.
Oops, something went wrong.