summaryrefslogtreecommitdiff
path: root/Source/Library
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-11-08 12:58:27 +0100
committerAlexis211 <alexis211@gmail.com>2009-11-08 12:58:27 +0100
commitec6a6922d074da4b64976282333e308deb39aeec (patch)
tree60d5e4a63095af75fc3ddae38021fa4c92ffd361 /Source/Library
parent962b8e892ce060b9690a35b0bcf6bae9a882c330 (diff)
downloadMelon-ec6a6922d074da4b64976282333e308deb39aeec.tar.gz
Melon-ec6a6922d074da4b64976282333e308deb39aeec.zip
Introduced PaperWork : our init/login manager.
Login with user=root;pass=admin or user=alexis211;pass=iamgod
Diffstat (limited to 'Source/Library')
-rw-r--r--Source/Library/Interface/Process.iface.h4
-rw-r--r--Source/Library/Userland/Binding/Process.class.h6
-rw-r--r--Source/Library/Userland/Binding/VirtualTerminal.class.h4
-rw-r--r--Source/Library/Userland/Start.cpp10
-rw-r--r--Source/Library/Userland/Syscall/Syscall.wtf.cpp4
-rw-r--r--Source/Library/Userland/Syscall/Syscall.wtf.h2
6 files changed, 21 insertions, 9 deletions
diff --git a/Source/Library/Interface/Process.iface.h b/Source/Library/Interface/Process.iface.h
index 0152947..cdd6e47 100644
--- a/Source/Library/Interface/Process.iface.h
+++ b/Source/Library/Interface/Process.iface.h
@@ -25,4 +25,8 @@
#define PRIF_SETOUTVT 0x29
#define PRIF_SETINVT 0x30
+//Authenticate with password/without password (being in group root)
+#define PRIF_AUTHPW 0x40
+#define PRIF_AUTHNOPW 0x41
+
#endif
diff --git a/Source/Library/Userland/Binding/Process.class.h b/Source/Library/Userland/Binding/Process.class.h
index a3fc569..948d670 100644
--- a/Source/Library/Userland/Binding/Process.class.h
+++ b/Source/Library/Userland/Binding/Process.class.h
@@ -57,6 +57,12 @@ class Process : public RessourceCaller {
void setOutVT(VirtualTerminal vt) {
doCall(PRIF_SETOUTVT, vt.resId());
}
+ bool authenticatePW(String user, String pw) {
+ return (doCall(PRIF_AUTHPW, (u32int)&user, (u32int)&pw) == 1);
+ }
+ bool authenticateNoPW(String user) {
+ return (doCall(PRIF_AUTHNOPW, (u32int)&user) == 1);
+ }
};
#endif
diff --git a/Source/Library/Userland/Binding/VirtualTerminal.class.h b/Source/Library/Userland/Binding/VirtualTerminal.class.h
index 1bfce85..5fd9733 100644
--- a/Source/Library/Userland/Binding/VirtualTerminal.class.h
+++ b/Source/Library/Userland/Binding/VirtualTerminal.class.h
@@ -29,8 +29,8 @@ class VirtualTerminal : public RessourceCaller {
void write(String s) {
doCall(VTIF_WRITE, (u32int)&s);
}
- String readLine() {
- return String::unserialize(doCall(VTIF_READLINE));
+ String readLine(bool show = true) {
+ return String::unserialize(doCall(VTIF_READLINE, (show ? 1 : 0)));
}
void setColor(u8int fg, u8int bg = 0xFF) {
doCall(VTIF_SETCOLOR, (fg << 8) | bg);
diff --git a/Source/Library/Userland/Start.cpp b/Source/Library/Userland/Start.cpp
index 4c5c559..032450d 100644
--- a/Source/Library/Userland/Start.cpp
+++ b/Source/Library/Userland/Start.cpp
@@ -16,10 +16,6 @@ VirtualTerminal invt(0), outvt(0);
int main(const Vector<String>& args);
-void doExit(u32int v) {
- asm volatile("int $66" : : "a"(v));
-}
-
extern "C" void start() {
//Call static constructors
u32int i = 0;
@@ -29,8 +25,8 @@ extern "C" void start() {
heap.create(0x40000000, 0x00040000, 0x00004000); //Initially create a 256ko heap with 16ko index
invt = VirtualTerminal::getIn(); outvt = VirtualTerminal::getOut();
- if (!invt.valid()) doExit(1);
- if (!outvt.valid()) doExit(2);
+ if (!invt.valid()) threadFinishedSyscall(1);
+ if (!outvt.valid()) threadFinishedSyscall(2);
u32int argc = Process::get().argc();
Vector<String> args(argc);
@@ -43,7 +39,7 @@ extern "C" void start() {
((void (*)(void))*call)();
}
- doExit(r);
+ threadFinishedSyscall(r);
}
namespace Mem {
diff --git a/Source/Library/Userland/Syscall/Syscall.wtf.cpp b/Source/Library/Userland/Syscall/Syscall.wtf.cpp
index a28c202..b8d9526 100644
--- a/Source/Library/Userland/Syscall/Syscall.wtf.cpp
+++ b/Source/Library/Userland/Syscall/Syscall.wtf.cpp
@@ -7,6 +7,10 @@ u32int syscall(u32int n, u32int a, u32int b, u32int c, u32int d, u32int e) {
return r;
}
+void threadFinishedSyscall(u32int v) {
+ asm volatile("int $66" : : "a"(v));
+}
+
void putch(char c) {
u32int x = c;
syscall(0xFFFFFF01, x);
diff --git a/Source/Library/Userland/Syscall/Syscall.wtf.h b/Source/Library/Userland/Syscall/Syscall.wtf.h
index 0401a89..5234579 100644
--- a/Source/Library/Userland/Syscall/Syscall.wtf.h
+++ b/Source/Library/Userland/Syscall/Syscall.wtf.h
@@ -8,6 +8,8 @@ void putch(char);
void sleep(u32int);
void write_hex(u32int);
+void threadFinishedSyscall(u32int);
+
u32int syscall(u32int n, u32int a, u32int b = 0, u32int c = 0, u32int d = 0, u32int e = 0);
#endif