MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / modify_ldt

Method modify_ldt

source/kernel/kthread.cpp:1293–1327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1291}
1292
1293U32 KThread::modify_ldt(U32 func, U32 ptr, U32 count) {
1294 if (func == 1 || func == 0x11) {
1295 int index = memory->readd(ptr);
1296 U32 address = memory->readd(ptr + 4);
1297 U32 limit = memory->readd(ptr + 8);
1298 U32 flags = memory->readd(ptr + 12);
1299
1300 if (index>=0 && index<LDT_ENTRIES) {
1301 struct user_desc* ldt = this->getLDT(index);
1302
1303 ldt->entry_number = index;
1304 ldt->limit = limit;
1305 ldt->base_addr = address;
1306 ldt->flags = flags;
1307 } else {
1308 kpanic_fmt("syscall_modify_ldt invalid index: %d", index);
1309 }
1310 return 0;
1311 } else if (func == 0) {
1312 int index = memory->readd(ptr);
1313 if (index>=0 && index<LDT_ENTRIES) {
1314 struct user_desc* ldt = this->getLDT(index);
1315
1316 memory->writed(ptr + 4, ldt->base_addr);
1317 memory->writed(ptr + 8, ldt->limit);
1318 memory->writed(ptr + 12, ldt->flags);
1319 } else {
1320 kpanic_fmt("syscall_modify_ldt invalid index: %d", index);
1321 }
1322 return 16;
1323 } else {
1324 kpanic_fmt("syscall_modify_ldt unknown func: %d", func);
1325 return -K_ENOSYS;
1326 }
1327}
1328
1329U32 KThread::nanoSleep(U64 nano) {
1330 U32 millies = (U32)(nano / 1000000);

Callers 1

syscall_modify_ldtFunction · 0.80

Calls 4

getLDTMethod · 0.95
kpanic_fmtFunction · 0.85
readdMethod · 0.45
writedMethod · 0.45

Tested by

no test coverage detected