[KERNEL][UMKA] Make it clang-compatible

git-svn-id: svn://kolibrios.org@9338 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Magomed Kostoev (mkostoevr) 2021-11-27 20:01:42 +00:00
parent d718f1b0de
commit 147fb23071
3 changed files with 36 additions and 32 deletions

View File

@ -171,10 +171,10 @@ def run_tests_serially(tests, root_dir):
return thread
def gcc(fin, fout):
flags = "-m32 -std=c11 -g -O0 -masm=intel -fno-pie -w"
flags = "-m32 -std=c11 -g -O0 -fno-pie -w" # -masm-intel
defines = "-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_POSIX_C_SOURCE=200809L"
include = "-Iumka -Iumka/linux"
command = f"gcc {flags} {defines} {include} -c {fin} -o {fout}"
command = f"clang {flags} {defines} {include} -c {fin} -o {fout}"
print(command)
os.system(command)
@ -195,8 +195,6 @@ def build_umka():
os.makedirs("umka/build/linux", exist_ok = True)
sources = [ "umka_shell.c",
"shell.c",
"trace.c",
"trace_lbr.c",
"vdisk.c",
"lodepng.c",
"linux/pci.c",

View File

@ -11,6 +11,7 @@ UMKA_OS = 3
UMKA_MEMORY_BYTES = 256 SHL 20
public umka_sys_put_image_palette
public disk_add
public disk_del
public disk_list
@ -570,6 +571,26 @@ proc umka_sti
ret
endp
proc umka_sys_put_image_palette c, image, xsize, ysize, x, y, bpp, palette, row_offset
pushad
push ebp
mov eax, 65
mov ebx, [image]
mov ecx, [xsize]
shl ecx, 16
or ecx, [ysize]
mov edx, [x]
shl edx, 16
or edx, [y]
mov esi, [bpp]
mov edi, [palette]
mov ebp, [row_offset]
call i40
pop ebp
popad
ret
endp
extrn reset_procmask
extrn get_fake_if
public irq0

View File

@ -448,13 +448,13 @@ static inline size_t
umka_new_sys_threads(uint32_t flags, void (*entry)(), void *stack) {
size_t tid;
__asm__ __inline__ __volatile__ (
"push ebx;"
"push esi;"
"push edi;"
"push %%ebx;"
"push %%esi;"
"push %%edi;"
"call kos_new_sys_threads;"
"pop edi;"
"pop esi;"
"pop ebx"
"pop %%edi;"
"pop %%esi;"
"pop %%ebx"
: "=a"(tid)
: "b"(flags),
"c"(entry),
@ -876,8 +876,8 @@ umka_find_next_task(int32_t priority) {
find_next_task_t fnt;
__asm__ __inline__ __volatile__ (
"call find_next_task;"
"setz al;"
"movzx eax, al"
"setz %%al;"
"movzx %%eax, %%al"
: "=b"(fnt.appdata),
"=D"(fnt.taskdata),
"=a"(fnt.same)
@ -889,10 +889,10 @@ umka_find_next_task(int32_t priority) {
static inline void
umka_i40(pushad_t *regs) {
__asm__ __inline__ __volatile__ (
"push ebp;"
"mov ebp, %[ebp];"
"push %%ebp;"
"mov %%ebp, %[ebp];"
"call i40;"
"pop ebp"
"pop %%ebp"
: "=a"(regs->eax),
"=b"(regs->ebx)
: "a"(regs->eax),
@ -1322,25 +1322,10 @@ umka_sys_set_font_size(uint32_t size) {
: "memory");
}
static inline void
void
umka_sys_put_image_palette(void *image, size_t xsize, size_t ysize,
size_t x, size_t y, size_t bpp, void *palette,
size_t row_offset) {
__asm__ __inline__ __volatile__ (
"push ebp;"
"mov ebp, %[row_offset];"
"call i40;"
"pop ebp"
:
: "a"(65),
"b"(image),
"c"((xsize << 16) + ysize),
"d"((x << 16) + y),
"S"(bpp),
"D"(palette),
[row_offset] "Rm"(row_offset)
: "memory");
}
size_t row_offset);
static inline void
umka_sys_move_window(size_t x, size_t y, ssize_t xsize, ssize_t ysize) {