mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-04 14:11:58 +03:00
limine: Reimplement proper callback functionality
This commit is contained in:
parent
d187c576d8
commit
ffa6d4e0c7
@ -267,6 +267,14 @@ uint64_t limine_term_write_ptr = 0;
|
||||
void limine_term_callback(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
|
||||
#endif
|
||||
|
||||
static uint64_t term_arg;
|
||||
static void (*actual_callback)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
|
||||
|
||||
static void callback_shim(struct term_context *ctx, uint64_t a, uint64_t b, uint64_t c, uint64_t d) {
|
||||
(void)ctx;
|
||||
actual_callback(term_arg, a, b, c, d);
|
||||
}
|
||||
|
||||
static void term_write_shim(uint64_t context, uint64_t buf, uint64_t count) {
|
||||
(void)context;
|
||||
_term_write(buf, count);
|
||||
@ -696,16 +704,20 @@ FEAT_START
|
||||
fb = fbinfo;
|
||||
|
||||
if (terminal_request->callback != 0) {
|
||||
term->callback = callback_shim;
|
||||
|
||||
#if defined (__i386__)
|
||||
term->callback = (void *)limine_term_callback;
|
||||
actual_callback = (void *)limine_term_callback;
|
||||
limine_term_callback_ptr = terminal_request->callback;
|
||||
#elif defined (__x86_64__) || defined (__aarch64__)
|
||||
term->callback = (void *)terminal_request->callback;
|
||||
actual_callback = (void *)terminal_request->callback;
|
||||
#else
|
||||
#error Unknown architecture
|
||||
#endif
|
||||
}
|
||||
|
||||
term_arg = reported_addr(terminal);
|
||||
|
||||
#if defined (__i386__)
|
||||
if (limine_rt_stack == NULL) {
|
||||
limine_rt_stack = ext_mem_alloc(16384) + 16384;
|
||||
|
Loading…
Reference in New Issue
Block a user