Creating a singleton terminal struct in C (OSDev)

I am not very knowledgeable about very low-level programming so I wanted to have a pet project to explore it – I am attempting to write something, that would hopefully be considered an OS.
Having written an assembly bootloader, I have proceeded to try to write a kernel in C, here is my code:

//kernel.c
#include "terminal.h"
#include "terminal_backend.h"
void _start(void) {
 Terminal* terminal = getTerminalInstance();
 T_clearScreen(terminal);
 for (;;) {}
 ...
}
//terminal.h
#pragma once
#include <stdint.h>

struct Terminal;
typedef struct Terminal Terminal;
//TBptr = Terminal backend function pointer
typedef void (*TBptr_moveCursor)(Terminal* t, uint16_t x, uint16_t y);
typedef void (*TBptr_getCursorPosition)(Terminal* t, uint16_t* x, uint16_t* y);
typedef void (*TBptr_clearScreen)(Terminal* t);
typedef void (*TBptr_putCharacter)(Terminal* t, uint32_t ch);
typedef void (*TBptr_getSize)(Terminal* t, uint16_t *w, uint16_t *h);

struct Terminal
{
        TBptr_moveCursor TF_moveCursor;
        TBptr_getCursorPosition TF_getCursorPosition;
        TBptr_clearScreen TF_clearScreen;
        TBptr_putCharacter TF_putCharacter;
        TBptr_getSize TF_getSize;
        void* backend_data;
};
...
//fragment of terminal.c
...
void T_clearScreen(Terminal* terminal)
{
        terminal->TF_clearScreen(terminal);
}
...
//fragment of terminal_backend.c
static void primitiveClearScreen(Terminal* terminal)
{
        for (;;) {}
        ...
}
...
static Terminal functionTable = {
        .TF_moveCursor = primitiveMoveCursor,
        .TF_getCursorPosition = primitiveGetCursorPosition,
        .TF_clearScreen = primitiveClearScreen,
        .TF_putCharacter = primitivePutCharacter,
        .TF_getSize = primitiveGetSize
};
  
Terminal* getTerminalInstance(void)
{                                                                                                                                  
        return &functionTable;                                                         
} 

The issue is that T_clearScreen(Terminal* terminal) gets called but the infinite loop in primitiveClearScreen(Terminal* terminal) does not get executed. It seems to me that the struct didn’t get properly configured and so couldn’t make the proper call to the function adresses. Compiler does not complain about the code. What I expected to happen is that this code should produce statically allocated struct Terminal with pointers to functions that I have implemented in terminal_backend.c and by calling getTerminalInstance() we get the singleton instance adress and can now call the T_clearScreen(terminal).

This also might be caused by process I did to the kernel and other files, but I am hoping that it is not the problem and it’s much simpler. I am still going to describe it in case that is.

The process of getting the C code into the floppy.bin (my virtual floppy) is that I paste the LOAD headers from ELF format into the floppy. Then I tell the bootloader to paste the binary into the proper locations + 0x40000 offset (to align with tutorial I am following). I suppose it could mess with addresses, so I consider it as a possible cause. The “proper locations” are in range from 0x0000 to 0x2000 – which I thought as too low, which is also a reason for including the offset.

I use QEMU, here is command that I use to run the floppy:
qemu-system-x86_64 -fda floppy.bin -cpu core2duo

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật