[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 return thread
def gcc(fin, fout): 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" defines = "-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_POSIX_C_SOURCE=200809L"
include = "-Iumka -Iumka/linux" 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) print(command)
os.system(command) os.system(command)
@ -195,8 +195,6 @@ def build_umka():
os.makedirs("umka/build/linux", exist_ok = True) os.makedirs("umka/build/linux", exist_ok = True)
sources = [ "umka_shell.c", sources = [ "umka_shell.c",
"shell.c", "shell.c",
"trace.c",
"trace_lbr.c",
"vdisk.c", "vdisk.c",
"lodepng.c", "lodepng.c",
"linux/pci.c", "linux/pci.c",

View File

@ -11,6 +11,7 @@ UMKA_OS = 3
UMKA_MEMORY_BYTES = 256 SHL 20 UMKA_MEMORY_BYTES = 256 SHL 20
public umka_sys_put_image_palette
public disk_add public disk_add
public disk_del public disk_del
public disk_list public disk_list
@ -570,6 +571,26 @@ proc umka_sti
ret ret
endp 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 reset_procmask
extrn get_fake_if extrn get_fake_if
public irq0 public irq0

View File

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