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

Partially implements console ioctl with com = 0x20007461 #534

Closed
wants to merge 33 commits into from

Conversation

SuchAFuriousDeath
Copy link
Contributor

@SuchAFuriousDeath SuchAFuriousDeath commented Dec 23, 2023

Progresses #525.

@SuchAFuriousDeath SuchAFuriousDeath marked this pull request as ready for review December 23, 2023 23:49
@SuchAFuriousDeath
Copy link
Contributor Author

Thank god for Option::is_some_and.

@SuchAFuriousDeath SuchAFuriousDeath changed the title Implements console ioctl with com = 0x20007461 Partially implements console ioctl with com = 0x20007461 Dec 23, 2023
@SuchAFuriousDeath SuchAFuriousDeath requested a review from a team December 24, 2023 07:03
@SuchAFuriousDeath
Copy link
Contributor Author

By the way, I'm pretty sure I found the proc0_init function.

@SuchAFuriousDeath
Copy link
Contributor Author

It seems that kern.proc.appinfo is connected to workaround and to something with cpusets

@ultimaweapon
Copy link
Member

I can't take a look due to COVID-19. The headache is so bad even though I am already vaccinated.

@SuchAFuriousDeath
Copy link
Contributor Author

It's fine, take care.

This looks like it initializes budgets for processes.
image

@SuchAFuriousDeath
Copy link
Contributor Author

SuchAFuriousDeath commented Dec 24, 2023

It seems that kern.proc.appinfo is connected to workaround and to something with cpusets

Ok, I uncovered it now. The 'something to do with cpusets' acttually means that it calls 'pfind'. I didn't know what the function was up until now :D

@SuchAFuriousDeath
Copy link
Contributor Author

image This is the initial budget for a process.

@SuchAFuriousDeath
Copy link
Contributor Author

I'm not sure if the fields are named correctly, but their offsets are 0xaf0 and 0xaf4.

@SuchAFuriousDeath
Copy link
Contributor Author

There's also eventhandlers for id tables
image

@SuchAFuriousDeath
Copy link
Contributor Author

SuchAFuriousDeath commented Dec 24, 2023

Looking at this now, I probably created a reference cycle. Not sure if it's really a problem though.

@SuchAFuriousDeath
Copy link
Contributor Author

SuchAFuriousDeath commented Dec 27, 2023

By the way, do all the components have to be in an Arc? Couldn't we just create a struct that holds all the components and switch everything from Arc to just an immutable reference?

@ultimaweapon
Copy link
Member

By the way, do all the components have to be in an Arc? Couldn't we just create a struct that holds all the components and switch everything from Arc to just an immutable reference?

The problem is we need static lifetime due to PS4 threading, which mean those objects must be either global or getting a static lifetime with Box::leak.

@VocalFan
Copy link
Member

By the way, do all the components have to be in an Arc? Couldn't we just create a struct that holds all the components and switch everything from Arc to just an immutable reference?

The problem is we need static lifetime due to PS4 threading, which mean those objects must be either global or getting a static lifetime with Box::leak.

I just helped make a PR for SlimeVR... Their method to keep something is to use leak.

However, they do it a different way. std::mem::forget(job)

src/kernel/src/fs/mod.rs Outdated Show resolved Hide resolved
src/kernel/src/fs/dev/console.rs Outdated Show resolved Hide resolved
src/kernel/src/process/session.rs Outdated Show resolved Hide resolved
src/kernel/src/tty/mod.rs Outdated Show resolved Hide resolved
src/kernel/src/fs/vnode.rs Outdated Show resolved Hide resolved
@ultimaweapon
Copy link
Member

By the way, do all the components have to be in an Arc? Couldn't we just create a struct that holds all the components and switch everything from Arc to just an immutable reference?

The problem is we need static lifetime due to PS4 threading, which mean those objects must be either global or getting a static lifetime with Box::leak.

I just helped make a PR for SlimeVR... Their method to keep something is to use leak.

However, they do it a different way. std::mem::forget(job)

We have tried Box::leak before we switched to Arc. forget for a different purpose.

@ultimaweapon
Copy link
Member

Scoped-thread cannot be used to implement threading syscall.

@SuchAFuriousDeath
Copy link
Contributor Author

Why is that, if I may ask?

@ultimaweapon
Copy link
Member

Let's say we implement thr_new. How do we return to the caller without killing the spawned thread within the scope?

@SuchAFuriousDeath
Copy link
Contributor Author

Oh, right. I misunderstood what you meant by 'threading syscall'.

@SuchAFuriousDeath
Copy link
Contributor Author

But somehow, intuitevely, it feels like it should be possible to do, somehow.

@SuchAFuriousDeath
Copy link
Contributor Author

If we could somehow hold onto the scope as a field of VProc or something like that, the thread wouldn't die, but it would be guaranteed not to outlive the instance of VProc I don't know if something like that is possible though

@ultimaweapon
Copy link
Member

The point of scoped thread is to prevent any threads inside to leak. That mean it is not possible.

@SuchAFuriousDeath
Copy link
Contributor Author

I thought about this more and it seems you're right :((((

@SuchAFuriousDeath
Copy link
Contributor Author

By the way, don't you think it would be better to split our handle_64 function into handle_i64 and handle_u64 so that we don't have to change types?

@ultimaweapon
Copy link
Member

We can handled both types in handle_64.

@ultimaweapon
Copy link
Member

I got a bad news (or good news?). My next PR is going to be overthrow the current FS structure by start migrating to the new FS. That mean the easier way for this PR to migrate to a new FS is by start a clean branch and copy part by part from the old branch.

@SuchAFuriousDeath
Copy link
Contributor Author

SuchAFuriousDeath commented Dec 31, 2023

Nice (and not nice, at the same time :D).

@SuchAFuriousDeath SuchAFuriousDeath deleted the console-com-97 branch February 16, 2024 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants