Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using malloc and converting to 64bit #7

Closed
EducatedMF opened this issue May 15, 2019 · 1 comment
Closed

Using malloc and converting to 64bit #7

EducatedMF opened this issue May 15, 2019 · 1 comment

Comments

@EducatedMF
Copy link

EducatedMF commented May 15, 2019

Hello,
Before anything else, thanks for the videos and this repo, awesome work!
I managed to compile, print/read ints/strings and draw graphics.
But now I want to convert the OS to 64bit, also when horsing around testing stuff, I tried using malloc and even though I have included stdlib.h I get : "....c:(.text+0x602): undefined reference to `malloc'
"
this is where I am trying to use malloc

`typedef struct _POINT_
{
    unsigned int x;
    unsigned int y;
}_POINT_;


struct _POINT_* POINT(const unsigned int _x, const unsigned int _y)
{
    struct _POINT_* point = (_POINT_*)malloc(sizeof(struct _POINT_));

    if(point)
    {
        point->x = _x;
        point->y = _y;
    }
    return point;
};`

Also can you provide more detail/reading material different than wikipedia on how vga_entry(...) works?

@pritamzope
Copy link
Owner

malloc() is a standard library function. it requires kernel system call brk() to perform its operations.
you cannot just call it in kernel code because there are no system calls implemented yet.
so first you have to write your own malloc() function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants